From 946a2399531dc3f5827d6de853c5653daef40cd6 Mon Sep 17 00:00:00 2001 From: Itay Weinberger Date: Fri, 13 Mar 2015 00:22:52 +0200 Subject: [PATCH 01/20] #1 fixed issue with options. --- www/js/pockets.bundle.js | 10 +++++----- www/js/pockets.bundle.js.map | 2 +- www/lib/pockets/engine.js | 14 +++++++------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/www/js/pockets.bundle.js b/www/js/pockets.bundle.js index f7c7856..7501468 100644 --- a/www/js/pockets.bundle.js +++ b/www/js/pockets.bundle.js @@ -20,7 +20,7 @@ engine.init = function (options, callback) { engine.options = engine.common.extend(options || {}, { //default options - promisify: false + //promisify: false }); console.log(engine.options); if (engine.options.promisify) @@ -35,11 +35,12 @@ engine.promisify = function () { engine.pockets = promisify(engine.pockets); }; -if (typeof global.localStorage !== 'undefined') - engine.init({promisify: true}); - //inject globals require('./common/globals'); + +//fire the engine up if we're running in a browser +if (typeof global.localStorage !== 'undefined') + engine.init({promisify: true}); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"../../../package.json":"/home/itay/dev/pockets/package.json","./common/config":"/home/itay/dev/pockets/www/lib/pockets/common/config.js","./common/db":"/home/itay/dev/pockets/www/lib/pockets/common/db.js","./common/events":"/home/itay/dev/pockets/www/lib/pockets/common/events.js","./common/globals":"/home/itay/dev/pockets/www/lib/pockets/common/globals.js","./common/index":"/home/itay/dev/pockets/www/lib/pockets/common/index.js","./common/logger":"/home/itay/dev/pockets/www/lib/pockets/common/logger.js","./services/bitcoin":"/home/itay/dev/pockets/www/lib/pockets/services/bitcoin.js","./services/pockets":"/home/itay/dev/pockets/www/lib/pockets/services/pockets.js","thenify-all":"/home/itay/dev/pockets/node_modules/thenify-all/index.js"}],"/home/itay/dev/pockets/node_modules/assert/assert.js":[function(require,module,exports){ // http://wiki.commonjs.org/wiki/Unit_Testing/1.0 @@ -30552,7 +30553,6 @@ var var bitcoin = module.exports; - bitcoin.validateWallet = function (options, callback) { function isAddress(string) { try { diff --git a/www/js/pockets.bundle.js.map b/www/js/pockets.bundle.js.map index 85bf5a9..34f5052 100644 --- a/www/js/pockets.bundle.js.map +++ b/www/js/pockets.bundle.js.map @@ -1 +1 @@ -{"version":3,"names":[],"mappings":"","sources":["pockets.bundle.js"],"sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the 'Software'), to\n// deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n// sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// when used in node, this will actually load the util module we depend on\n// versus loading the builtin util module as happens otherwise\n// this is a bug in node module loading as far as I am concerned\nvar util = require('util/');\n\nvar pSlice = Array.prototype.slice;\nvar hasOwn = Object.prototype.hasOwnProperty;\n\n// 1. The assert module provides functions that throw\n// AssertionError's when particular conditions are not met. The\n// assert module must conform to the following interface.\n\nvar assert = module.exports = ok;\n\n// 2. The AssertionError is defined in assert.\n// new assert.AssertionError({ message: message,\n// actual: actual,\n// expected: expected })\n\nassert.AssertionError = function AssertionError(options) {\n this.name = 'AssertionError';\n this.actual = options.actual;\n this.expected = options.expected;\n this.operator = options.operator;\n if (options.message) {\n this.message = options.message;\n this.generatedMessage = false;\n } else {\n this.message = getMessage(this);\n this.generatedMessage = true;\n }\n var stackStartFunction = options.stackStartFunction || fail;\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, stackStartFunction);\n }\n else {\n // non v8 browsers so we can have a stacktrace\n var err = new Error();\n if (err.stack) {\n var out = err.stack;\n\n // try to strip useless frames\n var fn_name = stackStartFunction.name;\n var idx = out.indexOf('\\n' + fn_name);\n if (idx >= 0) {\n // once we have located the function frame\n // we need to strip out everything before it (and its line)\n var next_line = out.indexOf('\\n', idx + 1);\n out = out.substring(next_line + 1);\n }\n\n this.stack = out;\n }\n }\n};\n\n// assert.AssertionError instanceof Error\nutil.inherits(assert.AssertionError, Error);\n\nfunction replacer(key, value) {\n if (util.isUndefined(value)) {\n return '' + value;\n }\n if (util.isNumber(value) && !isFinite(value)) {\n return value.toString();\n }\n if (util.isFunction(value) || util.isRegExp(value)) {\n return value.toString();\n }\n return value;\n}\n\nfunction truncate(s, n) {\n if (util.isString(s)) {\n return s.length < n ? s : s.slice(0, n);\n } else {\n return s;\n }\n}\n\nfunction getMessage(self) {\n return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' +\n self.operator + ' ' +\n truncate(JSON.stringify(self.expected, replacer), 128);\n}\n\n// At present only the three keys mentioned above are used and\n// understood by the spec. Implementations or sub modules can pass\n// other keys to the AssertionError's constructor - they will be\n// ignored.\n\n// 3. All of the following functions must throw an AssertionError\n// when a corresponding condition is not met, with a message that\n// may be undefined if not provided. All assertion methods provide\n// both the actual and expected values to the assertion error for\n// display purposes.\n\nfunction fail(actual, expected, message, operator, stackStartFunction) {\n throw new assert.AssertionError({\n message: message,\n actual: actual,\n expected: expected,\n operator: operator,\n stackStartFunction: stackStartFunction\n });\n}\n\n// EXTENSION! allows for well behaved errors defined elsewhere.\nassert.fail = fail;\n\n// 4. Pure assertion tests whether a value is truthy, as determined\n// by !!guard.\n// assert.ok(guard, message_opt);\n// This statement is equivalent to assert.equal(true, !!guard,\n// message_opt);. To test strictly for the value true, use\n// assert.strictEqual(true, guard, message_opt);.\n\nfunction ok(value, message) {\n if (!value) fail(value, true, message, '==', assert.ok);\n}\nassert.ok = ok;\n\n// 5. The equality assertion tests shallow, coercive equality with\n// ==.\n// assert.equal(actual, expected, message_opt);\n\nassert.equal = function equal(actual, expected, message) {\n if (actual != expected) fail(actual, expected, message, '==', assert.equal);\n};\n\n// 6. The non-equality assertion tests for whether two objects are not equal\n// with != assert.notEqual(actual, expected, message_opt);\n\nassert.notEqual = function notEqual(actual, expected, message) {\n if (actual == expected) {\n fail(actual, expected, message, '!=', assert.notEqual);\n }\n};\n\n// 7. The equivalence assertion tests a deep equality relation.\n// assert.deepEqual(actual, expected, message_opt);\n\nassert.deepEqual = function deepEqual(actual, expected, message) {\n if (!_deepEqual(actual, expected)) {\n fail(actual, expected, message, 'deepEqual', assert.deepEqual);\n }\n};\n\nfunction _deepEqual(actual, expected) {\n // 7.1. All identical values are equivalent, as determined by ===.\n if (actual === expected) {\n return true;\n\n } else if (util.isBuffer(actual) && util.isBuffer(expected)) {\n if (actual.length != expected.length) return false;\n\n for (var i = 0; i < actual.length; i++) {\n if (actual[i] !== expected[i]) return false;\n }\n\n return true;\n\n // 7.2. If the expected value is a Date object, the actual value is\n // equivalent if it is also a Date object that refers to the same time.\n } else if (util.isDate(actual) && util.isDate(expected)) {\n return actual.getTime() === expected.getTime();\n\n // 7.3 If the expected value is a RegExp object, the actual value is\n // equivalent if it is also a RegExp object with the same source and\n // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).\n } else if (util.isRegExp(actual) && util.isRegExp(expected)) {\n return actual.source === expected.source &&\n actual.global === expected.global &&\n actual.multiline === expected.multiline &&\n actual.lastIndex === expected.lastIndex &&\n actual.ignoreCase === expected.ignoreCase;\n\n // 7.4. Other pairs that do not both pass typeof value == 'object',\n // equivalence is determined by ==.\n } else if (!util.isObject(actual) && !util.isObject(expected)) {\n return actual == expected;\n\n // 7.5 For all other Object pairs, including Array objects, equivalence is\n // determined by having the same number of owned properties (as verified\n // with Object.prototype.hasOwnProperty.call), the same set of keys\n // (although not necessarily the same order), equivalent values for every\n // corresponding key, and an identical 'prototype' property. Note: this\n // accounts for both named and indexed properties on Arrays.\n } else {\n return objEquiv(actual, expected);\n }\n}\n\nfunction isArguments(object) {\n return Object.prototype.toString.call(object) == '[object Arguments]';\n}\n\nfunction objEquiv(a, b) {\n if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b))\n return false;\n // an identical 'prototype' property.\n if (a.prototype !== b.prototype) return false;\n // if one is a primitive, the other must be same\n if (util.isPrimitive(a) || util.isPrimitive(b)) {\n return a === b;\n }\n var aIsArgs = isArguments(a),\n bIsArgs = isArguments(b);\n if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))\n return false;\n if (aIsArgs) {\n a = pSlice.call(a);\n b = pSlice.call(b);\n return _deepEqual(a, b);\n }\n var ka = objectKeys(a),\n kb = objectKeys(b),\n key, i;\n // having the same number of owned properties (keys incorporates\n // hasOwnProperty)\n if (ka.length != kb.length)\n return false;\n //the same set of keys (although not necessarily the same order),\n ka.sort();\n kb.sort();\n //~~~cheap key test\n for (i = ka.length - 1; i >= 0; i--) {\n if (ka[i] != kb[i])\n return false;\n }\n //equivalent values for every corresponding key, and\n //~~~possibly expensive deep test\n for (i = ka.length - 1; i >= 0; i--) {\n key = ka[i];\n if (!_deepEqual(a[key], b[key])) return false;\n }\n return true;\n}\n\n// 8. The non-equivalence assertion tests for any deep inequality.\n// assert.notDeepEqual(actual, expected, message_opt);\n\nassert.notDeepEqual = function notDeepEqual(actual, expected, message) {\n if (_deepEqual(actual, expected)) {\n fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);\n }\n};\n\n// 9. The strict equality assertion tests strict equality, as determined by ===.\n// assert.strictEqual(actual, expected, message_opt);\n\nassert.strictEqual = function strictEqual(actual, expected, message) {\n if (actual !== expected) {\n fail(actual, expected, message, '===', assert.strictEqual);\n }\n};\n\n// 10. The strict non-equality assertion tests for strict inequality, as\n// determined by !==. assert.notStrictEqual(actual, expected, message_opt);\n\nassert.notStrictEqual = function notStrictEqual(actual, expected, message) {\n if (actual === expected) {\n fail(actual, expected, message, '!==', assert.notStrictEqual);\n }\n};\n\nfunction expectedException(actual, expected) {\n if (!actual || !expected) {\n return false;\n }\n\n if (Object.prototype.toString.call(expected) == '[object RegExp]') {\n return expected.test(actual);\n } else if (actual instanceof expected) {\n return true;\n } else if (expected.call({}, actual) === true) {\n return true;\n }\n\n return false;\n}\n\nfunction _throws(shouldThrow, block, expected, message) {\n var actual;\n\n if (util.isString(expected)) {\n message = expected;\n expected = null;\n }\n\n try {\n block();\n } catch (e) {\n actual = e;\n }\n\n message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +\n (message ? ' ' + message : '.');\n\n if (shouldThrow && !actual) {\n fail(actual, expected, 'Missing expected exception' + message);\n }\n\n if (!shouldThrow && expectedException(actual, expected)) {\n fail(actual, expected, 'Got unwanted exception' + message);\n }\n\n if ((shouldThrow && actual && expected &&\n !expectedException(actual, expected)) || (!shouldThrow && actual)) {\n throw actual;\n }\n}\n\n// 11. Expected to throw an error:\n// assert.throws(block, Error_opt, message_opt);\n\nassert.throws = function(block, /*optional*/error, /*optional*/message) {\n _throws.apply(this, [true].concat(pSlice.call(arguments)));\n};\n\n// EXTENSION! This is annoying to write outside this module.\nassert.doesNotThrow = function(block, /*optional*/message) {\n _throws.apply(this, [false].concat(pSlice.call(arguments)));\n};\n\nassert.ifError = function(err) { if (err) {throw err;}};\n\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) {\n if (hasOwn.call(obj, key)) keys.push(key);\n }\n return keys;\n};\n\n},{\"util/\":\"/home/itay/dev/pockets/node_modules/assert/node_modules/util/util.js\"}],\"/home/itay/dev/pockets/node_modules/assert/node_modules/util/node_modules/inherits/inherits_browser.js\":[function(require,module,exports){\nif (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n\n},{}],\"/home/itay/dev/pockets/node_modules/assert/node_modules/util/support/isBufferBrowser.js\":[function(require,module,exports){\nmodule.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}\n},{}],\"/home/itay/dev/pockets/node_modules/assert/node_modules/util/util.js\":[function(require,module,exports){\n(function (process,global){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexports.debuglog = function(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\n}).call(this,require('_process'),typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"./support/isBuffer\":\"/home/itay/dev/pockets/node_modules/assert/node_modules/util/support/isBufferBrowser.js\",\"_process\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/process/browser.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/assert/node_modules/util/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/bigi/lib/bigi.js\":[function(require,module,exports){\n// (public) Constructor\nfunction BigInteger(a, b, c) {\n if (!(this instanceof BigInteger))\n return new BigInteger(a, b, c)\n\n if (a != null) {\n if (\"number\" == typeof a) this.fromNumber(a, b, c)\n else if (b == null && \"string\" != typeof a) this.fromString(a, 256)\n else this.fromString(a, b)\n }\n}\n\nvar proto = BigInteger.prototype\n\n// duck-typed isBigInteger\nproto.__bigi = require('../package.json').version\nBigInteger.isBigInteger = function (obj, check_ver) {\n return obj && obj.__bigi && (!check_ver || obj.__bigi === proto.__bigi)\n}\n\n// Bits per digit\nvar dbits\n\n// am: Compute w_j += (x*this_i), propagate carries,\n// c is initial carry, returns final carry.\n// c < 3*dvalue, x < 2*dvalue, this_i < dvalue\n// We need to select the fastest one that works in this environment.\n\n// am1: use a single mult and divide to get the high bits,\n// max digit bits should be 26 because\n// max internal value = 2*dvalue^2-2*dvalue (< 2^53)\nfunction am1(i, x, w, j, c, n) {\n while (--n >= 0) {\n var v = x * this[i++] + w[j] + c\n c = Math.floor(v / 0x4000000)\n w[j++] = v & 0x3ffffff\n }\n return c\n}\n// am2 avoids a big mult-and-extract completely.\n// Max digit bits should be <= 30 because we do bitwise ops\n// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)\nfunction am2(i, x, w, j, c, n) {\n var xl = x & 0x7fff,\n xh = x >> 15\n while (--n >= 0) {\n var l = this[i] & 0x7fff\n var h = this[i++] >> 15\n var m = xh * l + h * xl\n l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff)\n c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30)\n w[j++] = l & 0x3fffffff\n }\n return c\n}\n// Alternately, set max digit bits to 28 since some\n// browsers slow down when dealing with 32-bit numbers.\nfunction am3(i, x, w, j, c, n) {\n var xl = x & 0x3fff,\n xh = x >> 14\n while (--n >= 0) {\n var l = this[i] & 0x3fff\n var h = this[i++] >> 14\n var m = xh * l + h * xl\n l = xl * l + ((m & 0x3fff) << 14) + w[j] + c\n c = (l >> 28) + (m >> 14) + xh * h\n w[j++] = l & 0xfffffff\n }\n return c\n}\n\n// wtf?\nBigInteger.prototype.am = am1\ndbits = 26\n\nBigInteger.prototype.DB = dbits\nBigInteger.prototype.DM = ((1 << dbits) - 1)\nvar DV = BigInteger.prototype.DV = (1 << dbits)\n\nvar BI_FP = 52\nBigInteger.prototype.FV = Math.pow(2, BI_FP)\nBigInteger.prototype.F1 = BI_FP - dbits\nBigInteger.prototype.F2 = 2 * dbits - BI_FP\n\n// Digit conversions\nvar BI_RM = \"0123456789abcdefghijklmnopqrstuvwxyz\"\nvar BI_RC = new Array()\nvar rr, vv\nrr = \"0\".charCodeAt(0)\nfor (vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv\nrr = \"a\".charCodeAt(0)\nfor (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv\nrr = \"A\".charCodeAt(0)\nfor (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv\n\nfunction int2char(n) {\n return BI_RM.charAt(n)\n}\n\nfunction intAt(s, i) {\n var c = BI_RC[s.charCodeAt(i)]\n return (c == null) ? -1 : c\n}\n\n// (protected) copy this to r\nfunction bnpCopyTo(r) {\n for (var i = this.t - 1; i >= 0; --i) r[i] = this[i]\n r.t = this.t\n r.s = this.s\n}\n\n// (protected) set from integer value x, -DV <= x < DV\nfunction bnpFromInt(x) {\n this.t = 1\n this.s = (x < 0) ? -1 : 0\n if (x > 0) this[0] = x\n else if (x < -1) this[0] = x + DV\n else this.t = 0\n}\n\n// return bigint initialized to value\nfunction nbv(i) {\n var r = new BigInteger()\n r.fromInt(i)\n return r\n}\n\n// (protected) set from string and radix\nfunction bnpFromString(s, b) {\n var self = this\n\n var k\n if (b == 16) k = 4\n else if (b == 8) k = 3\n else if (b == 256) k = 8; // byte array\n else if (b == 2) k = 1\n else if (b == 32) k = 5\n else if (b == 4) k = 2\n else {\n self.fromRadix(s, b)\n return\n }\n self.t = 0\n self.s = 0\n var i = s.length,\n mi = false,\n sh = 0\n while (--i >= 0) {\n var x = (k == 8) ? s[i] & 0xff : intAt(s, i)\n if (x < 0) {\n if (s.charAt(i) == \"-\") mi = true\n continue\n }\n mi = false\n if (sh == 0)\n self[self.t++] = x\n else if (sh + k > self.DB) {\n self[self.t - 1] |= (x & ((1 << (self.DB - sh)) - 1)) << sh\n self[self.t++] = (x >> (self.DB - sh))\n } else\n self[self.t - 1] |= x << sh\n sh += k\n if (sh >= self.DB) sh -= self.DB\n }\n if (k == 8 && (s[0] & 0x80) != 0) {\n self.s = -1\n if (sh > 0) self[self.t - 1] |= ((1 << (self.DB - sh)) - 1) << sh\n }\n self.clamp()\n if (mi) BigInteger.ZERO.subTo(self, self)\n}\n\n// (protected) clamp off excess high words\nfunction bnpClamp() {\n var c = this.s & this.DM\n while (this.t > 0 && this[this.t - 1] == c)--this.t\n}\n\n// (public) return string representation in given radix\nfunction bnToString(b) {\n var self = this\n if (self.s < 0) return \"-\" + self.negate()\n .toString(b)\n var k\n if (b == 16) k = 4\n else if (b == 8) k = 3\n else if (b == 2) k = 1\n else if (b == 32) k = 5\n else if (b == 4) k = 2\n else return self.toRadix(b)\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = self.t\n var p = self.DB - (i * self.DB) % k\n if (i-- > 0) {\n if (p < self.DB && (d = self[i] >> p) > 0) {\n m = true\n r = int2char(d)\n }\n while (i >= 0) {\n if (p < k) {\n d = (self[i] & ((1 << p) - 1)) << (k - p)\n d |= self[--i] >> (p += self.DB - k)\n } else {\n d = (self[i] >> (p -= k)) & km\n if (p <= 0) {\n p += self.DB\n --i\n }\n }\n if (d > 0) m = true\n if (m) r += int2char(d)\n }\n }\n return m ? r : \"0\"\n}\n\n// (public) -this\nfunction bnNegate() {\n var r = new BigInteger()\n BigInteger.ZERO.subTo(this, r)\n return r\n}\n\n// (public) |this|\nfunction bnAbs() {\n return (this.s < 0) ? this.negate() : this\n}\n\n// (public) return + if this > a, - if this < a, 0 if equal\nfunction bnCompareTo(a) {\n var r = this.s - a.s\n if (r != 0) return r\n var i = this.t\n r = i - a.t\n if (r != 0) return (this.s < 0) ? -r : r\n while (--i >= 0)\n if ((r = this[i] - a[i]) != 0) return r\n return 0\n}\n\n// returns bit length of the integer x\nfunction nbits(x) {\n var r = 1,\n t\n if ((t = x >>> 16) != 0) {\n x = t\n r += 16\n }\n if ((t = x >> 8) != 0) {\n x = t\n r += 8\n }\n if ((t = x >> 4) != 0) {\n x = t\n r += 4\n }\n if ((t = x >> 2) != 0) {\n x = t\n r += 2\n }\n if ((t = x >> 1) != 0) {\n x = t\n r += 1\n }\n return r\n}\n\n// (public) return the number of bits in \"this\"\nfunction bnBitLength() {\n if (this.t <= 0) return 0\n return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM))\n}\n\n// (public) return the number of bytes in \"this\"\nfunction bnByteLength() {\n return this.bitLength() >> 3\n}\n\n// (protected) r = this << n*DB\nfunction bnpDLShiftTo(n, r) {\n var i\n for (i = this.t - 1; i >= 0; --i) r[i + n] = this[i]\n for (i = n - 1; i >= 0; --i) r[i] = 0\n r.t = this.t + n\n r.s = this.s\n}\n\n// (protected) r = this >> n*DB\nfunction bnpDRShiftTo(n, r) {\n for (var i = n; i < this.t; ++i) r[i - n] = this[i]\n r.t = Math.max(this.t - n, 0)\n r.s = this.s\n}\n\n// (protected) r = this << n\nfunction bnpLShiftTo(n, r) {\n var self = this\n var bs = n % self.DB\n var cbs = self.DB - bs\n var bm = (1 << cbs) - 1\n var ds = Math.floor(n / self.DB),\n c = (self.s << bs) & self.DM,\n i\n for (i = self.t - 1; i >= 0; --i) {\n r[i + ds + 1] = (self[i] >> cbs) | c\n c = (self[i] & bm) << bs\n }\n for (i = ds - 1; i >= 0; --i) r[i] = 0\n r[ds] = c\n r.t = self.t + ds + 1\n r.s = self.s\n r.clamp()\n}\n\n// (protected) r = this >> n\nfunction bnpRShiftTo(n, r) {\n var self = this\n r.s = self.s\n var ds = Math.floor(n / self.DB)\n if (ds >= self.t) {\n r.t = 0\n return\n }\n var bs = n % self.DB\n var cbs = self.DB - bs\n var bm = (1 << bs) - 1\n r[0] = self[ds] >> bs\n for (var i = ds + 1; i < self.t; ++i) {\n r[i - ds - 1] |= (self[i] & bm) << cbs\n r[i - ds] = self[i] >> bs\n }\n if (bs > 0) r[self.t - ds - 1] |= (self.s & bm) << cbs\n r.t = self.t - ds\n r.clamp()\n}\n\n// (protected) r = this - a\nfunction bnpSubTo(a, r) {\n var self = this\n var i = 0,\n c = 0,\n m = Math.min(a.t, self.t)\n while (i < m) {\n c += self[i] - a[i]\n r[i++] = c & self.DM\n c >>= self.DB\n }\n if (a.t < self.t) {\n c -= a.s\n while (i < self.t) {\n c += self[i]\n r[i++] = c & self.DM\n c >>= self.DB\n }\n c += self.s\n } else {\n c += self.s\n while (i < a.t) {\n c -= a[i]\n r[i++] = c & self.DM\n c >>= self.DB\n }\n c -= a.s\n }\n r.s = (c < 0) ? -1 : 0\n if (c < -1) r[i++] = self.DV + c\n else if (c > 0) r[i++] = c\n r.t = i\n r.clamp()\n}\n\n// (protected) r = this * a, r != this,a (HAC 14.12)\n// \"this\" should be the larger one if appropriate.\nfunction bnpMultiplyTo(a, r) {\n var x = this.abs(),\n y = a.abs()\n var i = x.t\n r.t = i + y.t\n while (--i >= 0) r[i] = 0\n for (i = 0; i < y.t; ++i) r[i + x.t] = x.am(0, y[i], r, i, 0, x.t)\n r.s = 0\n r.clamp()\n if (this.s != a.s) BigInteger.ZERO.subTo(r, r)\n}\n\n// (protected) r = this^2, r != this (HAC 14.16)\nfunction bnpSquareTo(r) {\n var x = this.abs()\n var i = r.t = 2 * x.t\n while (--i >= 0) r[i] = 0\n for (i = 0; i < x.t - 1; ++i) {\n var c = x.am(i, x[i], r, 2 * i, 0, 1)\n if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {\n r[i + x.t] -= x.DV\n r[i + x.t + 1] = 1\n }\n }\n if (r.t > 0) r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1)\n r.s = 0\n r.clamp()\n}\n\n// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)\n// r != q, this != m. q or r may be null.\nfunction bnpDivRemTo(m, q, r) {\n var self = this\n var pm = m.abs()\n if (pm.t <= 0) return\n var pt = self.abs()\n if (pt.t < pm.t) {\n if (q != null) q.fromInt(0)\n if (r != null) self.copyTo(r)\n return\n }\n if (r == null) r = new BigInteger()\n var y = new BigInteger(),\n ts = self.s,\n ms = m.s\n var nsh = self.DB - nbits(pm[pm.t - 1]); // normalize modulus\n if (nsh > 0) {\n pm.lShiftTo(nsh, y)\n pt.lShiftTo(nsh, r)\n } else {\n pm.copyTo(y)\n pt.copyTo(r)\n }\n var ys = y.t\n var y0 = y[ys - 1]\n if (y0 == 0) return\n var yt = y0 * (1 << self.F1) + ((ys > 1) ? y[ys - 2] >> self.F2 : 0)\n var d1 = self.FV / yt,\n d2 = (1 << self.F1) / yt,\n e = 1 << self.F2\n var i = r.t,\n j = i - ys,\n t = (q == null) ? new BigInteger() : q\n y.dlShiftTo(j, t)\n if (r.compareTo(t) >= 0) {\n r[r.t++] = 1\n r.subTo(t, r)\n }\n BigInteger.ONE.dlShiftTo(ys, t)\n t.subTo(y, y); // \"negative\" y so we can replace sub with am later\n while (y.t < ys) y[y.t++] = 0\n while (--j >= 0) {\n // Estimate quotient digit\n var qd = (r[--i] == y0) ? self.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2)\n if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) { // Try it out\n y.dlShiftTo(j, t)\n r.subTo(t, r)\n while (r[i] < --qd) r.subTo(t, r)\n }\n }\n if (q != null) {\n r.drShiftTo(ys, q)\n if (ts != ms) BigInteger.ZERO.subTo(q, q)\n }\n r.t = ys\n r.clamp()\n if (nsh > 0) r.rShiftTo(nsh, r); // Denormalize remainder\n if (ts < 0) BigInteger.ZERO.subTo(r, r)\n}\n\n// (public) this mod a\nfunction bnMod(a) {\n var r = new BigInteger()\n this.abs()\n .divRemTo(a, null, r)\n if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r, r)\n return r\n}\n\n// Modular reduction using \"classic\" algorithm\nfunction Classic(m) {\n this.m = m\n}\n\nfunction cConvert(x) {\n if (x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m)\n else return x\n}\n\nfunction cRevert(x) {\n return x\n}\n\nfunction cReduce(x) {\n x.divRemTo(this.m, null, x)\n}\n\nfunction cMulTo(x, y, r) {\n x.multiplyTo(y, r)\n this.reduce(r)\n}\n\nfunction cSqrTo(x, r) {\n x.squareTo(r)\n this.reduce(r)\n}\n\nClassic.prototype.convert = cConvert\nClassic.prototype.revert = cRevert\nClassic.prototype.reduce = cReduce\nClassic.prototype.mulTo = cMulTo\nClassic.prototype.sqrTo = cSqrTo\n\n// (protected) return \"-1/this % 2^DB\"; useful for Mont. reduction\n// justification:\n// xy == 1 (mod m)\n// xy = 1+km\n// xy(2-xy) = (1+km)(1-km)\n// x[y(2-xy)] = 1-k^2m^2\n// x[y(2-xy)] == 1 (mod m^2)\n// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2\n// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.\n// JS multiply \"overflows\" differently from C/C++, so care is needed here.\nfunction bnpInvDigit() {\n if (this.t < 1) return 0\n var x = this[0]\n if ((x & 1) == 0) return 0\n var y = x & 3; // y == 1/x mod 2^2\n y = (y * (2 - (x & 0xf) * y)) & 0xf; // y == 1/x mod 2^4\n y = (y * (2 - (x & 0xff) * y)) & 0xff; // y == 1/x mod 2^8\n y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff; // y == 1/x mod 2^16\n // last step - calculate inverse mod DV directly\n // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints\n y = (y * (2 - x * y % this.DV)) % this.DV; // y == 1/x mod 2^dbits\n // we really want the negative inverse, and -DV < y < DV\n return (y > 0) ? this.DV - y : -y\n}\n\n// Montgomery reduction\nfunction Montgomery(m) {\n this.m = m\n this.mp = m.invDigit()\n this.mpl = this.mp & 0x7fff\n this.mph = this.mp >> 15\n this.um = (1 << (m.DB - 15)) - 1\n this.mt2 = 2 * m.t\n}\n\n// xR mod m\nfunction montConvert(x) {\n var r = new BigInteger()\n x.abs()\n .dlShiftTo(this.m.t, r)\n r.divRemTo(this.m, null, r)\n if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r, r)\n return r\n}\n\n// x/R mod m\nfunction montRevert(x) {\n var r = new BigInteger()\n x.copyTo(r)\n this.reduce(r)\n return r\n}\n\n// x = x/R mod m (HAC 14.32)\nfunction montReduce(x) {\n while (x.t <= this.mt2) // pad x so am has enough room later\n x[x.t++] = 0\n for (var i = 0; i < this.m.t; ++i) {\n // faster way of calculating u0 = x[i]*mp mod DV\n var j = x[i] & 0x7fff\n var u0 = (j * this.mpl + (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) & x.DM\n // use am to combine the multiply-shift-add into one call\n j = i + this.m.t\n x[j] += this.m.am(0, u0, x, i, 0, this.m.t)\n // propagate carry\n while (x[j] >= x.DV) {\n x[j] -= x.DV\n x[++j]++\n }\n }\n x.clamp()\n x.drShiftTo(this.m.t, x)\n if (x.compareTo(this.m) >= 0) x.subTo(this.m, x)\n}\n\n// r = \"x^2/R mod m\"; x != r\nfunction montSqrTo(x, r) {\n x.squareTo(r)\n this.reduce(r)\n}\n\n// r = \"xy/R mod m\"; x,y != r\nfunction montMulTo(x, y, r) {\n x.multiplyTo(y, r)\n this.reduce(r)\n}\n\nMontgomery.prototype.convert = montConvert\nMontgomery.prototype.revert = montRevert\nMontgomery.prototype.reduce = montReduce\nMontgomery.prototype.mulTo = montMulTo\nMontgomery.prototype.sqrTo = montSqrTo\n\n// (protected) true iff this is even\nfunction bnpIsEven() {\n return ((this.t > 0) ? (this[0] & 1) : this.s) == 0\n}\n\n// (protected) this^e, e < 2^32, doing sqr and mul with \"r\" (HAC 14.79)\nfunction bnpExp(e, z) {\n if (e > 0xffffffff || e < 1) return BigInteger.ONE\n var r = new BigInteger(),\n r2 = new BigInteger(),\n g = z.convert(this),\n i = nbits(e) - 1\n g.copyTo(r)\n while (--i >= 0) {\n z.sqrTo(r, r2)\n if ((e & (1 << i)) > 0) z.mulTo(r2, g, r)\n else {\n var t = r\n r = r2\n r2 = t\n }\n }\n return z.revert(r)\n}\n\n// (public) this^e % m, 0 <= e < 2^32\nfunction bnModPowInt(e, m) {\n var z\n if (e < 256 || m.isEven()) z = new Classic(m)\n else z = new Montgomery(m)\n return this.exp(e, z)\n}\n\n// protected\nproto.copyTo = bnpCopyTo\nproto.fromInt = bnpFromInt\nproto.fromString = bnpFromString\nproto.clamp = bnpClamp\nproto.dlShiftTo = bnpDLShiftTo\nproto.drShiftTo = bnpDRShiftTo\nproto.lShiftTo = bnpLShiftTo\nproto.rShiftTo = bnpRShiftTo\nproto.subTo = bnpSubTo\nproto.multiplyTo = bnpMultiplyTo\nproto.squareTo = bnpSquareTo\nproto.divRemTo = bnpDivRemTo\nproto.invDigit = bnpInvDigit\nproto.isEven = bnpIsEven\nproto.exp = bnpExp\n\n// public\nproto.toString = bnToString\nproto.negate = bnNegate\nproto.abs = bnAbs\nproto.compareTo = bnCompareTo\nproto.bitLength = bnBitLength\nproto.byteLength = bnByteLength\nproto.mod = bnMod\nproto.modPowInt = bnModPowInt\n\n// (public)\nfunction bnClone() {\n var r = new BigInteger()\n this.copyTo(r)\n return r\n}\n\n// (public) return value as integer\nfunction bnIntValue() {\n if (this.s < 0) {\n if (this.t == 1) return this[0] - this.DV\n else if (this.t == 0) return -1\n } else if (this.t == 1) return this[0]\n else if (this.t == 0) return 0\n // assumes 16 < DB < 32\n return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0]\n}\n\n// (public) return value as byte\nfunction bnByteValue() {\n return (this.t == 0) ? this.s : (this[0] << 24) >> 24\n}\n\n// (public) return value as short (assumes DB>=16)\nfunction bnShortValue() {\n return (this.t == 0) ? this.s : (this[0] << 16) >> 16\n}\n\n// (protected) return x s.t. r^x < DV\nfunction bnpChunkSize(r) {\n return Math.floor(Math.LN2 * this.DB / Math.log(r))\n}\n\n// (public) 0 if this == 0, 1 if this > 0\nfunction bnSigNum() {\n if (this.s < 0) return -1\n else if (this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0\n else return 1\n}\n\n// (protected) convert to radix string\nfunction bnpToRadix(b) {\n if (b == null) b = 10\n if (this.signum() == 0 || b < 2 || b > 36) return \"0\"\n var cs = this.chunkSize(b)\n var a = Math.pow(b, cs)\n var d = nbv(a),\n y = new BigInteger(),\n z = new BigInteger(),\n r = \"\"\n this.divRemTo(d, y, z)\n while (y.signum() > 0) {\n r = (a + z.intValue())\n .toString(b)\n .substr(1) + r\n y.divRemTo(d, y, z)\n }\n return z.intValue()\n .toString(b) + r\n}\n\n// (protected) convert from radix string\nfunction bnpFromRadix(s, b) {\n var self = this\n self.fromInt(0)\n if (b == null) b = 10\n var cs = self.chunkSize(b)\n var d = Math.pow(b, cs),\n mi = false,\n j = 0,\n w = 0\n for (var i = 0; i < s.length; ++i) {\n var x = intAt(s, i)\n if (x < 0) {\n if (s.charAt(i) == \"-\" && self.signum() == 0) mi = true\n continue\n }\n w = b * w + x\n if (++j >= cs) {\n self.dMultiply(d)\n self.dAddOffset(w, 0)\n j = 0\n w = 0\n }\n }\n if (j > 0) {\n self.dMultiply(Math.pow(b, j))\n self.dAddOffset(w, 0)\n }\n if (mi) BigInteger.ZERO.subTo(self, self)\n}\n\n// (protected) alternate constructor\nfunction bnpFromNumber(a, b, c) {\n var self = this\n if (\"number\" == typeof b) {\n // new BigInteger(int,int,RNG)\n if (a < 2) self.fromInt(1)\n else {\n self.fromNumber(a, c)\n if (!self.testBit(a - 1)) // force MSB set\n self.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, self)\n if (self.isEven()) self.dAddOffset(1, 0); // force odd\n while (!self.isProbablePrime(b)) {\n self.dAddOffset(2, 0)\n if (self.bitLength() > a) self.subTo(BigInteger.ONE.shiftLeft(a - 1), self)\n }\n }\n } else {\n // new BigInteger(int,RNG)\n var x = new Array(),\n t = a & 7\n x.length = (a >> 3) + 1\n b.nextBytes(x)\n if (t > 0) x[0] &= ((1 << t) - 1)\n else x[0] = 0\n self.fromString(x, 256)\n }\n}\n\n// (public) convert to bigendian byte array\nfunction bnToByteArray() {\n var self = this\n var i = self.t,\n r = new Array()\n r[0] = self.s\n var p = self.DB - (i * self.DB) % 8,\n d, k = 0\n if (i-- > 0) {\n if (p < self.DB && (d = self[i] >> p) != (self.s & self.DM) >> p)\n r[k++] = d | (self.s << (self.DB - p))\n while (i >= 0) {\n if (p < 8) {\n d = (self[i] & ((1 << p) - 1)) << (8 - p)\n d |= self[--i] >> (p += self.DB - 8)\n } else {\n d = (self[i] >> (p -= 8)) & 0xff\n if (p <= 0) {\n p += self.DB\n --i\n }\n }\n if ((d & 0x80) != 0) d |= -256\n if (k === 0 && (self.s & 0x80) != (d & 0x80))++k\n if (k > 0 || d != self.s) r[k++] = d\n }\n }\n return r\n}\n\nfunction bnEquals(a) {\n return (this.compareTo(a) == 0)\n}\n\nfunction bnMin(a) {\n return (this.compareTo(a) < 0) ? this : a\n}\n\nfunction bnMax(a) {\n return (this.compareTo(a) > 0) ? this : a\n}\n\n// (protected) r = this op a (bitwise)\nfunction bnpBitwiseTo(a, op, r) {\n var self = this\n var i, f, m = Math.min(a.t, self.t)\n for (i = 0; i < m; ++i) r[i] = op(self[i], a[i])\n if (a.t < self.t) {\n f = a.s & self.DM\n for (i = m; i < self.t; ++i) r[i] = op(self[i], f)\n r.t = self.t\n } else {\n f = self.s & self.DM\n for (i = m; i < a.t; ++i) r[i] = op(f, a[i])\n r.t = a.t\n }\n r.s = op(self.s, a.s)\n r.clamp()\n}\n\n// (public) this & a\nfunction op_and(x, y) {\n return x & y\n}\n\nfunction bnAnd(a) {\n var r = new BigInteger()\n this.bitwiseTo(a, op_and, r)\n return r\n}\n\n// (public) this | a\nfunction op_or(x, y) {\n return x | y\n}\n\nfunction bnOr(a) {\n var r = new BigInteger()\n this.bitwiseTo(a, op_or, r)\n return r\n}\n\n// (public) this ^ a\nfunction op_xor(x, y) {\n return x ^ y\n}\n\nfunction bnXor(a) {\n var r = new BigInteger()\n this.bitwiseTo(a, op_xor, r)\n return r\n}\n\n// (public) this & ~a\nfunction op_andnot(x, y) {\n return x & ~y\n}\n\nfunction bnAndNot(a) {\n var r = new BigInteger()\n this.bitwiseTo(a, op_andnot, r)\n return r\n}\n\n// (public) ~this\nfunction bnNot() {\n var r = new BigInteger()\n for (var i = 0; i < this.t; ++i) r[i] = this.DM & ~this[i]\n r.t = this.t\n r.s = ~this.s\n return r\n}\n\n// (public) this << n\nfunction bnShiftLeft(n) {\n var r = new BigInteger()\n if (n < 0) this.rShiftTo(-n, r)\n else this.lShiftTo(n, r)\n return r\n}\n\n// (public) this >> n\nfunction bnShiftRight(n) {\n var r = new BigInteger()\n if (n < 0) this.lShiftTo(-n, r)\n else this.rShiftTo(n, r)\n return r\n}\n\n// return index of lowest 1-bit in x, x < 2^31\nfunction lbit(x) {\n if (x == 0) return -1\n var r = 0\n if ((x & 0xffff) == 0) {\n x >>= 16\n r += 16\n }\n if ((x & 0xff) == 0) {\n x >>= 8\n r += 8\n }\n if ((x & 0xf) == 0) {\n x >>= 4\n r += 4\n }\n if ((x & 3) == 0) {\n x >>= 2\n r += 2\n }\n if ((x & 1) == 0)++r\n return r\n}\n\n// (public) returns index of lowest 1-bit (or -1 if none)\nfunction bnGetLowestSetBit() {\n for (var i = 0; i < this.t; ++i)\n if (this[i] != 0) return i * this.DB + lbit(this[i])\n if (this.s < 0) return this.t * this.DB\n return -1\n}\n\n// return number of 1 bits in x\nfunction cbit(x) {\n var r = 0\n while (x != 0) {\n x &= x - 1\n ++r\n }\n return r\n}\n\n// (public) return number of set bits\nfunction bnBitCount() {\n var r = 0,\n x = this.s & this.DM\n for (var i = 0; i < this.t; ++i) r += cbit(this[i] ^ x)\n return r\n}\n\n// (public) true iff nth bit is set\nfunction bnTestBit(n) {\n var j = Math.floor(n / this.DB)\n if (j >= this.t) return (this.s != 0)\n return ((this[j] & (1 << (n % this.DB))) != 0)\n}\n\n// (protected) this op (1<>= self.DB\n }\n if (a.t < self.t) {\n c += a.s\n while (i < self.t) {\n c += self[i]\n r[i++] = c & self.DM\n c >>= self.DB\n }\n c += self.s\n } else {\n c += self.s\n while (i < a.t) {\n c += a[i]\n r[i++] = c & self.DM\n c >>= self.DB\n }\n c += a.s\n }\n r.s = (c < 0) ? -1 : 0\n if (c > 0) r[i++] = c\n else if (c < -1) r[i++] = self.DV + c\n r.t = i\n r.clamp()\n}\n\n// (public) this + a\nfunction bnAdd(a) {\n var r = new BigInteger()\n this.addTo(a, r)\n return r\n}\n\n// (public) this - a\nfunction bnSubtract(a) {\n var r = new BigInteger()\n this.subTo(a, r)\n return r\n}\n\n// (public) this * a\nfunction bnMultiply(a) {\n var r = new BigInteger()\n this.multiplyTo(a, r)\n return r\n}\n\n// (public) this^2\nfunction bnSquare() {\n var r = new BigInteger()\n this.squareTo(r)\n return r\n}\n\n// (public) this / a\nfunction bnDivide(a) {\n var r = new BigInteger()\n this.divRemTo(a, r, null)\n return r\n}\n\n// (public) this % a\nfunction bnRemainder(a) {\n var r = new BigInteger()\n this.divRemTo(a, null, r)\n return r\n}\n\n// (public) [this/a,this%a]\nfunction bnDivideAndRemainder(a) {\n var q = new BigInteger(),\n r = new BigInteger()\n this.divRemTo(a, q, r)\n return new Array(q, r)\n}\n\n// (protected) this *= n, this >= 0, 1 < n < DV\nfunction bnpDMultiply(n) {\n this[this.t] = this.am(0, n - 1, this, 0, 0, this.t)\n ++this.t\n this.clamp()\n}\n\n// (protected) this += n << w words, this >= 0\nfunction bnpDAddOffset(n, w) {\n if (n == 0) return\n while (this.t <= w) this[this.t++] = 0\n this[w] += n\n while (this[w] >= this.DV) {\n this[w] -= this.DV\n if (++w >= this.t) this[this.t++] = 0\n ++this[w]\n }\n}\n\n// A \"null\" reducer\nfunction NullExp() {}\n\nfunction nNop(x) {\n return x\n}\n\nfunction nMulTo(x, y, r) {\n x.multiplyTo(y, r)\n}\n\nfunction nSqrTo(x, r) {\n x.squareTo(r)\n}\n\nNullExp.prototype.convert = nNop\nNullExp.prototype.revert = nNop\nNullExp.prototype.mulTo = nMulTo\nNullExp.prototype.sqrTo = nSqrTo\n\n// (public) this^e\nfunction bnPow(e) {\n return this.exp(e, new NullExp())\n}\n\n// (protected) r = lower n words of \"this * a\", a.t <= n\n// \"this\" should be the larger one if appropriate.\nfunction bnpMultiplyLowerTo(a, n, r) {\n var i = Math.min(this.t + a.t, n)\n r.s = 0; // assumes a,this >= 0\n r.t = i\n while (i > 0) r[--i] = 0\n var j\n for (j = r.t - this.t; i < j; ++i) r[i + this.t] = this.am(0, a[i], r, i, 0, this.t)\n for (j = Math.min(a.t, n); i < j; ++i) this.am(0, a[i], r, i, 0, n - i)\n r.clamp()\n}\n\n// (protected) r = \"this * a\" without lower n words, n > 0\n// \"this\" should be the larger one if appropriate.\nfunction bnpMultiplyUpperTo(a, n, r) {\n --n\n var i = r.t = this.t + a.t - n\n r.s = 0; // assumes a,this >= 0\n while (--i >= 0) r[i] = 0\n for (i = Math.max(n - this.t, 0); i < a.t; ++i)\n r[this.t + i - n] = this.am(n - i, a[i], r, 0, 0, this.t + i - n)\n r.clamp()\n r.drShiftTo(1, r)\n}\n\n// Barrett modular reduction\nfunction Barrett(m) {\n // setup Barrett\n this.r2 = new BigInteger()\n this.q3 = new BigInteger()\n BigInteger.ONE.dlShiftTo(2 * m.t, this.r2)\n this.mu = this.r2.divide(m)\n this.m = m\n}\n\nfunction barrettConvert(x) {\n if (x.s < 0 || x.t > 2 * this.m.t) return x.mod(this.m)\n else if (x.compareTo(this.m) < 0) return x\n else {\n var r = new BigInteger()\n x.copyTo(r)\n this.reduce(r)\n return r\n }\n}\n\nfunction barrettRevert(x) {\n return x\n}\n\n// x = x mod m (HAC 14.42)\nfunction barrettReduce(x) {\n var self = this\n x.drShiftTo(self.m.t - 1, self.r2)\n if (x.t > self.m.t + 1) {\n x.t = self.m.t + 1\n x.clamp()\n }\n self.mu.multiplyUpperTo(self.r2, self.m.t + 1, self.q3)\n self.m.multiplyLowerTo(self.q3, self.m.t + 1, self.r2)\n while (x.compareTo(self.r2) < 0) x.dAddOffset(1, self.m.t + 1)\n x.subTo(self.r2, x)\n while (x.compareTo(self.m) >= 0) x.subTo(self.m, x)\n}\n\n// r = x^2 mod m; x != r\nfunction barrettSqrTo(x, r) {\n x.squareTo(r)\n this.reduce(r)\n}\n\n// r = x*y mod m; x,y != r\nfunction barrettMulTo(x, y, r) {\n x.multiplyTo(y, r)\n this.reduce(r)\n}\n\nBarrett.prototype.convert = barrettConvert\nBarrett.prototype.revert = barrettRevert\nBarrett.prototype.reduce = barrettReduce\nBarrett.prototype.mulTo = barrettMulTo\nBarrett.prototype.sqrTo = barrettSqrTo\n\n// (public) this^e % m (HAC 14.85)\nfunction bnModPow(e, m) {\n var i = e.bitLength(),\n k, r = nbv(1),\n z\n if (i <= 0) return r\n else if (i < 18) k = 1\n else if (i < 48) k = 3\n else if (i < 144) k = 4\n else if (i < 768) k = 5\n else k = 6\n if (i < 8)\n z = new Classic(m)\n else if (m.isEven())\n z = new Barrett(m)\n else\n z = new Montgomery(m)\n\n // precomputation\n var g = new Array(),\n n = 3,\n k1 = k - 1,\n km = (1 << k) - 1\n g[1] = z.convert(this)\n if (k > 1) {\n var g2 = new BigInteger()\n z.sqrTo(g[1], g2)\n while (n <= km) {\n g[n] = new BigInteger()\n z.mulTo(g2, g[n - 2], g[n])\n n += 2\n }\n }\n\n var j = e.t - 1,\n w, is1 = true,\n r2 = new BigInteger(),\n t\n i = nbits(e[j]) - 1\n while (j >= 0) {\n if (i >= k1) w = (e[j] >> (i - k1)) & km\n else {\n w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i)\n if (j > 0) w |= e[j - 1] >> (this.DB + i - k1)\n }\n\n n = k\n while ((w & 1) == 0) {\n w >>= 1\n --n\n }\n if ((i -= n) < 0) {\n i += this.DB\n --j\n }\n if (is1) { // ret == 1, don't bother squaring or multiplying it\n g[w].copyTo(r)\n is1 = false\n } else {\n while (n > 1) {\n z.sqrTo(r, r2)\n z.sqrTo(r2, r)\n n -= 2\n }\n if (n > 0) z.sqrTo(r, r2)\n else {\n t = r\n r = r2\n r2 = t\n }\n z.mulTo(r2, g[w], r)\n }\n\n while (j >= 0 && (e[j] & (1 << i)) == 0) {\n z.sqrTo(r, r2)\n t = r\n r = r2\n r2 = t\n if (--i < 0) {\n i = this.DB - 1\n --j\n }\n }\n }\n return z.revert(r)\n}\n\n// (public) gcd(this,a) (HAC 14.54)\nfunction bnGCD(a) {\n var x = (this.s < 0) ? this.negate() : this.clone()\n var y = (a.s < 0) ? a.negate() : a.clone()\n if (x.compareTo(y) < 0) {\n var t = x\n x = y\n y = t\n }\n var i = x.getLowestSetBit(),\n g = y.getLowestSetBit()\n if (g < 0) return x\n if (i < g) g = i\n if (g > 0) {\n x.rShiftTo(g, x)\n y.rShiftTo(g, y)\n }\n while (x.signum() > 0) {\n if ((i = x.getLowestSetBit()) > 0) x.rShiftTo(i, x)\n if ((i = y.getLowestSetBit()) > 0) y.rShiftTo(i, y)\n if (x.compareTo(y) >= 0) {\n x.subTo(y, x)\n x.rShiftTo(1, x)\n } else {\n y.subTo(x, y)\n y.rShiftTo(1, y)\n }\n }\n if (g > 0) y.lShiftTo(g, y)\n return y\n}\n\n// (protected) this % n, n < 2^26\nfunction bnpModInt(n) {\n if (n <= 0) return 0\n var d = this.DV % n,\n r = (this.s < 0) ? n - 1 : 0\n if (this.t > 0)\n if (d == 0) r = this[0] % n\n else\n for (var i = this.t - 1; i >= 0; --i) r = (d * r + this[i]) % n\n return r\n}\n\n// (public) 1/this % m (HAC 14.61)\nfunction bnModInverse(m) {\n var ac = m.isEven()\n if ((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO\n var u = m.clone(),\n v = this.clone()\n var a = nbv(1),\n b = nbv(0),\n c = nbv(0),\n d = nbv(1)\n while (u.signum() != 0) {\n while (u.isEven()) {\n u.rShiftTo(1, u)\n if (ac) {\n if (!a.isEven() || !b.isEven()) {\n a.addTo(this, a)\n b.subTo(m, b)\n }\n a.rShiftTo(1, a)\n } else if (!b.isEven()) b.subTo(m, b)\n b.rShiftTo(1, b)\n }\n while (v.isEven()) {\n v.rShiftTo(1, v)\n if (ac) {\n if (!c.isEven() || !d.isEven()) {\n c.addTo(this, c)\n d.subTo(m, d)\n }\n c.rShiftTo(1, c)\n } else if (!d.isEven()) d.subTo(m, d)\n d.rShiftTo(1, d)\n }\n if (u.compareTo(v) >= 0) {\n u.subTo(v, u)\n if (ac) a.subTo(c, a)\n b.subTo(d, b)\n } else {\n v.subTo(u, v)\n if (ac) c.subTo(a, c)\n d.subTo(b, d)\n }\n }\n if (v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO\n if (d.compareTo(m) >= 0) return d.subtract(m)\n if (d.signum() < 0) d.addTo(m, d)\n else return d\n if (d.signum() < 0) return d.add(m)\n else return d\n}\n\nvar lowprimes = [\n 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,\n 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151,\n 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233,\n 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317,\n 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419,\n 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503,\n 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607,\n 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701,\n 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811,\n 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911,\n 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997\n]\n\nvar lplim = (1 << 26) / lowprimes[lowprimes.length - 1]\n\n// (public) test primality with certainty >= 1-.5^t\nfunction bnIsProbablePrime(t) {\n var i, x = this.abs()\n if (x.t == 1 && x[0] <= lowprimes[lowprimes.length - 1]) {\n for (i = 0; i < lowprimes.length; ++i)\n if (x[0] == lowprimes[i]) return true\n return false\n }\n if (x.isEven()) return false\n i = 1\n while (i < lowprimes.length) {\n var m = lowprimes[i],\n j = i + 1\n while (j < lowprimes.length && m < lplim) m *= lowprimes[j++]\n m = x.modInt(m)\n while (i < j) if (m % lowprimes[i++] == 0) return false\n }\n return x.millerRabin(t)\n}\n\n// (protected) true if probably prime (HAC 4.24, Miller-Rabin)\nfunction bnpMillerRabin(t) {\n var n1 = this.subtract(BigInteger.ONE)\n var k = n1.getLowestSetBit()\n if (k <= 0) return false\n var r = n1.shiftRight(k)\n t = (t + 1) >> 1\n if (t > lowprimes.length) t = lowprimes.length\n var a = new BigInteger(null)\n var j, bases = []\n for (var i = 0; i < t; ++i) {\n for (;;) {\n j = lowprimes[Math.floor(Math.random() * lowprimes.length)]\n if (bases.indexOf(j) == -1) break\n }\n bases.push(j)\n a.fromInt(j)\n var y = a.modPow(r, this)\n if (y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {\n var j = 1\n while (j++ < k && y.compareTo(n1) != 0) {\n y = y.modPowInt(2, this)\n if (y.compareTo(BigInteger.ONE) == 0) return false\n }\n if (y.compareTo(n1) != 0) return false\n }\n }\n return true\n}\n\n// protected\nproto.chunkSize = bnpChunkSize\nproto.toRadix = bnpToRadix\nproto.fromRadix = bnpFromRadix\nproto.fromNumber = bnpFromNumber\nproto.bitwiseTo = bnpBitwiseTo\nproto.changeBit = bnpChangeBit\nproto.addTo = bnpAddTo\nproto.dMultiply = bnpDMultiply\nproto.dAddOffset = bnpDAddOffset\nproto.multiplyLowerTo = bnpMultiplyLowerTo\nproto.multiplyUpperTo = bnpMultiplyUpperTo\nproto.modInt = bnpModInt\nproto.millerRabin = bnpMillerRabin\n\n// public\nproto.clone = bnClone\nproto.intValue = bnIntValue\nproto.byteValue = bnByteValue\nproto.shortValue = bnShortValue\nproto.signum = bnSigNum\nproto.toByteArray = bnToByteArray\nproto.equals = bnEquals\nproto.min = bnMin\nproto.max = bnMax\nproto.and = bnAnd\nproto.or = bnOr\nproto.xor = bnXor\nproto.andNot = bnAndNot\nproto.not = bnNot\nproto.shiftLeft = bnShiftLeft\nproto.shiftRight = bnShiftRight\nproto.getLowestSetBit = bnGetLowestSetBit\nproto.bitCount = bnBitCount\nproto.testBit = bnTestBit\nproto.setBit = bnSetBit\nproto.clearBit = bnClearBit\nproto.flipBit = bnFlipBit\nproto.add = bnAdd\nproto.subtract = bnSubtract\nproto.multiply = bnMultiply\nproto.divide = bnDivide\nproto.remainder = bnRemainder\nproto.divideAndRemainder = bnDivideAndRemainder\nproto.modPow = bnModPow\nproto.modInverse = bnModInverse\nproto.pow = bnPow\nproto.gcd = bnGCD\nproto.isProbablePrime = bnIsProbablePrime\n\n// JSBN-specific extension\nproto.square = bnSquare\n\n// constants\nBigInteger.ZERO = nbv(0)\nBigInteger.ONE = nbv(1)\nBigInteger.valueOf = nbv\n\nmodule.exports = BigInteger\n\n},{\"../package.json\":\"/home/itay/dev/pockets/node_modules/bigi/package.json\"}],\"/home/itay/dev/pockets/node_modules/bigi/lib/convert.js\":[function(require,module,exports){\n(function (Buffer){\n// FIXME: Kind of a weird way to throw exceptions, consider removing\nvar assert = require('assert')\nvar BigInteger = require('./bigi')\n\n/**\n * Turns a byte array into a big integer.\n *\n * This function will interpret a byte array as a big integer in big\n * endian notation.\n */\nBigInteger.fromByteArrayUnsigned = function(byteArray) {\n // BigInteger expects a DER integer conformant byte array\n if (byteArray[0] & 0x80) {\n return new BigInteger([0].concat(byteArray))\n }\n\n return new BigInteger(byteArray)\n}\n\n/**\n * Returns a byte array representation of the big integer.\n *\n * This returns the absolute of the contained value in big endian\n * form. A value of zero results in an empty array.\n */\nBigInteger.prototype.toByteArrayUnsigned = function() {\n var byteArray = this.toByteArray()\n return byteArray[0] === 0 ? byteArray.slice(1) : byteArray\n}\n\nBigInteger.fromDERInteger = function(byteArray) {\n return new BigInteger(byteArray)\n}\n\n/*\n * Converts BigInteger to a DER integer representation.\n *\n * The format for this value uses the most significant bit as a sign\n * bit. If the most significant bit is already set and the integer is\n * positive, a 0x00 is prepended.\n *\n * Examples:\n *\n * 0 => 0x00\n * 1 => 0x01\n * -1 => 0xff\n * 127 => 0x7f\n * -127 => 0x81\n * 128 => 0x0080\n * -128 => 0x80\n * 255 => 0x00ff\n * -255 => 0xff01\n * 16300 => 0x3fac\n * -16300 => 0xc054\n * 62300 => 0x00f35c\n * -62300 => 0xff0ca4\n*/\nBigInteger.prototype.toDERInteger = BigInteger.prototype.toByteArray\n\nBigInteger.fromBuffer = function(buffer) {\n // BigInteger expects a DER integer conformant byte array\n if (buffer[0] & 0x80) {\n var byteArray = Array.prototype.slice.call(buffer)\n\n return new BigInteger([0].concat(byteArray))\n }\n\n return new BigInteger(buffer)\n}\n\nBigInteger.fromHex = function(hex) {\n if (hex === '') return BigInteger.ZERO\n\n assert.equal(hex, hex.match(/^[A-Fa-f0-9]+/), 'Invalid hex string')\n assert.equal(hex.length % 2, 0, 'Incomplete hex')\n return new BigInteger(hex, 16)\n}\n\nBigInteger.prototype.toBuffer = function(size) {\n var byteArray = this.toByteArrayUnsigned()\n var zeros = []\n\n var padding = size - byteArray.length\n while (zeros.length < padding) zeros.push(0)\n\n return new Buffer(zeros.concat(byteArray))\n}\n\nBigInteger.prototype.toHex = function(size) {\n return this.toBuffer(size).toString('hex')\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./bigi\":\"/home/itay/dev/pockets/node_modules/bigi/lib/bigi.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/bigi/lib/index.js\":[function(require,module,exports){\nvar BigInteger = require('./bigi')\n\n//addons\nrequire('./convert')\n\nmodule.exports = BigInteger\n},{\"./bigi\":\"/home/itay/dev/pockets/node_modules/bigi/lib/bigi.js\",\"./convert\":\"/home/itay/dev/pockets/node_modules/bigi/lib/convert.js\"}],\"/home/itay/dev/pockets/node_modules/bigi/package.json\":[function(require,module,exports){\nmodule.exports={\n \"name\": \"bigi\",\n \"version\": \"1.4.0\",\n \"description\": \"Big integers.\",\n \"keywords\": [\n \"cryptography\",\n \"math\",\n \"bitcoin\",\n \"arbitrary\",\n \"precision\",\n \"arithmetic\",\n \"big\",\n \"integer\",\n \"int\",\n \"number\",\n \"biginteger\",\n \"bigint\",\n \"bignumber\",\n \"decimal\",\n \"float\"\n ],\n \"devDependencies\": {\n \"mocha\": \"^1.20.1\",\n \"jshint\": \"^2.5.1\",\n \"coveralls\": \"^2.10.0\",\n \"istanbul\": \"^0.2.11\"\n },\n \"repository\": {\n \"url\": \"https://github.com/cryptocoinjs/bigi\",\n \"type\": \"git\"\n },\n \"main\": \"./lib/index.js\",\n \"scripts\": {\n \"test\": \"_mocha -- test/*.js\",\n \"jshint\": \"jshint --config jshint.json lib/*.js ; true\",\n \"unit\": \"mocha\",\n \"coverage\": \"istanbul cover ./node_modules/.bin/_mocha -- --reporter list test/*.js\",\n \"coveralls\": \"npm run-script coverage && node ./node_modules/.bin/coveralls < coverage/lcov.info\"\n },\n \"dependencies\": {},\n \"testling\": {\n \"files\": \"test/*.js\",\n \"harness\": \"mocha\",\n \"browsers\": [\n \"ie/9..latest\",\n \"firefox/latest\",\n \"chrome/latest\",\n \"safari/6.0..latest\",\n \"iphone/6.0..latest\",\n \"android-browser/4.2..latest\"\n ]\n },\n \"bugs\": {\n \"url\": \"https://github.com/cryptocoinjs/bigi/issues\"\n },\n \"homepage\": \"https://github.com/cryptocoinjs/bigi\",\n \"_id\": \"bigi@1.4.0\",\n \"dist\": {\n \"shasum\": \"90ac1aeac0a531216463bdb58f42c1e05c8407ac\",\n \"tarball\": \"http://registry.npmjs.org/bigi/-/bigi-1.4.0.tgz\"\n },\n \"_from\": \"bigi@\",\n \"_npmVersion\": \"1.4.3\",\n \"_npmUser\": {\n \"name\": \"jp\",\n \"email\": \"jprichardson@gmail.com\"\n },\n \"maintainers\": [\n {\n \"name\": \"jp\",\n \"email\": \"jprichardson@gmail.com\"\n },\n {\n \"name\": \"midnightlightning\",\n \"email\": \"boydb@midnightdesign.ws\"\n },\n {\n \"name\": \"sidazhang\",\n \"email\": \"sidazhang89@gmail.com\"\n },\n {\n \"name\": \"nadav\",\n \"email\": \"npm@shesek.info\"\n }\n ],\n \"directories\": {},\n \"_shasum\": \"90ac1aeac0a531216463bdb58f42c1e05c8407ac\",\n \"_resolved\": \"https://registry.npmjs.org/bigi/-/bigi-1.4.0.tgz\",\n \"readme\": \"ERROR: No README data found!\"\n}\n\n},{}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/bigi.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/bigi/lib/bigi.js\"][0].apply(exports,arguments)\n},{\"../package.json\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/package.json\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/convert.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/bigi/lib/convert.js\"][0].apply(exports,arguments)\n},{\"./bigi\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/bigi.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/index.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/bigi/lib/index.js\"][0].apply(exports,arguments)\n},{\"./bigi\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/bigi.js\",\"./convert\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/convert.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/package.json\":[function(require,module,exports){\nmodule.exports={\n \"name\": \"bigi\",\n \"version\": \"1.4.0\",\n \"description\": \"Big integers.\",\n \"keywords\": [\n \"cryptography\",\n \"math\",\n \"bitcoin\",\n \"arbitrary\",\n \"precision\",\n \"arithmetic\",\n \"big\",\n \"integer\",\n \"int\",\n \"number\",\n \"biginteger\",\n \"bigint\",\n \"bignumber\",\n \"decimal\",\n \"float\"\n ],\n \"devDependencies\": {\n \"mocha\": \"^1.20.1\",\n \"jshint\": \"^2.5.1\",\n \"coveralls\": \"^2.10.0\",\n \"istanbul\": \"^0.2.11\"\n },\n \"repository\": {\n \"url\": \"https://github.com/cryptocoinjs/bigi\",\n \"type\": \"git\"\n },\n \"main\": \"./lib/index.js\",\n \"scripts\": {\n \"test\": \"_mocha -- test/*.js\",\n \"jshint\": \"jshint --config jshint.json lib/*.js ; true\",\n \"unit\": \"mocha\",\n \"coverage\": \"istanbul cover ./node_modules/.bin/_mocha -- --reporter list test/*.js\",\n \"coveralls\": \"npm run-script coverage && node ./node_modules/.bin/coveralls < coverage/lcov.info\"\n },\n \"dependencies\": {},\n \"testling\": {\n \"files\": \"test/*.js\",\n \"harness\": \"mocha\",\n \"browsers\": [\n \"ie/9..latest\",\n \"firefox/latest\",\n \"chrome/latest\",\n \"safari/6.0..latest\",\n \"iphone/6.0..latest\",\n \"android-browser/4.2..latest\"\n ]\n },\n \"bugs\": {\n \"url\": \"https://github.com/cryptocoinjs/bigi/issues\"\n },\n \"homepage\": \"https://github.com/cryptocoinjs/bigi\",\n \"_id\": \"bigi@1.4.0\",\n \"dist\": {\n \"shasum\": \"90ac1aeac0a531216463bdb58f42c1e05c8407ac\",\n \"tarball\": \"http://registry.npmjs.org/bigi/-/bigi-1.4.0.tgz\"\n },\n \"_from\": \"bigi@^1.4.0\",\n \"_npmVersion\": \"1.4.3\",\n \"_npmUser\": {\n \"name\": \"jp\",\n \"email\": \"jprichardson@gmail.com\"\n },\n \"maintainers\": [\n {\n \"name\": \"jp\",\n \"email\": \"jprichardson@gmail.com\"\n },\n {\n \"name\": \"midnightlightning\",\n \"email\": \"boydb@midnightdesign.ws\"\n },\n {\n \"name\": \"sidazhang\",\n \"email\": \"sidazhang89@gmail.com\"\n },\n {\n \"name\": \"nadav\",\n \"email\": \"npm@shesek.info\"\n }\n ],\n \"directories\": {},\n \"_shasum\": \"90ac1aeac0a531216463bdb58f42c1e05c8407ac\",\n \"_resolved\": \"https://registry.npmjs.org/bigi/-/bigi-1.4.0.tgz\"\n}\n\n},{}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bs58check/node_modules/bs58/lib/bs58.js\":[function(require,module,exports){\n// Base58 encoding/decoding\n// Originally written by Mike Hearn for BitcoinJ\n// Copyright (c) 2011 Google Inc\n// Ported to JavaScript by Stefan Thomas\n// Merged Buffer refactorings from base58-native by Stephen Pair\n// Copyright (c) 2013 BitPay Inc\n\nvar ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'\nvar ALPHABET_MAP = {}\nfor(var i = 0; i < ALPHABET.length; i++) {\n ALPHABET_MAP[ALPHABET.charAt(i)] = i\n}\nvar BASE = 58\n\nfunction encode(buffer) {\n if (buffer.length === 0) return ''\n\n var i, j, digits = [0]\n for (i = 0; i < buffer.length; i++) {\n for (j = 0; j < digits.length; j++) digits[j] <<= 8\n\n digits[0] += buffer[i]\n\n var carry = 0\n for (j = 0; j < digits.length; ++j) {\n digits[j] += carry\n\n carry = (digits[j] / BASE) | 0\n digits[j] %= BASE\n }\n\n while (carry) {\n digits.push(carry % BASE)\n\n carry = (carry / BASE) | 0\n }\n }\n\n // deal with leading zeros\n for (i = 0; buffer[i] === 0 && i < buffer.length - 1; i++) digits.push(0)\n\n // convert digits to a string\n var stringOutput = \"\"\n for (var i = digits.length - 1; i >= 0; i--) {\n stringOutput = stringOutput + ALPHABET[digits[i]]\n }\n return stringOutput\n}\n\nfunction decode(string) {\n if (string.length === 0) return []\n\n var i, j, bytes = [0]\n for (i = 0; i < string.length; i++) {\n var c = string[i]\n if (!(c in ALPHABET_MAP)) throw new Error('Non-base58 character')\n\n for (j = 0; j < bytes.length; j++) bytes[j] *= BASE\n bytes[0] += ALPHABET_MAP[c]\n\n var carry = 0\n for (j = 0; j < bytes.length; ++j) {\n bytes[j] += carry\n\n carry = bytes[j] >> 8\n bytes[j] &= 0xff\n }\n\n while (carry) {\n bytes.push(carry & 0xff)\n\n carry >>= 8\n }\n }\n\n // deal with leading zeros\n for (i = 0; string[i] === '1' && i < string.length - 1; i++) bytes.push(0)\n\n return bytes.reverse()\n}\n\nmodule.exports = {\n encode: encode,\n decode: decode\n}\n\n},{}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bs58check/src/bs58check.js\":[function(require,module,exports){\n(function (Buffer){\n'use strict';\n\nvar assert = require('assert')\nvar base58 = require('bs58')\nvar crypto = require('crypto')\n\n// SHA256(SHA256(buffer))\nfunction sha256x2(buffer) {\n buffer = crypto.createHash('sha256').update(buffer).digest()\n return crypto.createHash('sha256').update(buffer).digest()\n}\n\n// Encode a buffer as a base58-check encoded string\nfunction encode(payload) {\n var checksum = sha256x2(payload).slice(0, 4)\n\n return base58.encode(Buffer.concat([\n payload,\n checksum\n ]))\n}\n\n// Decode a base58-check encoded string to a buffer\nfunction decode(string) {\n var buffer = new Buffer(base58.decode(string))\n\n var payload = buffer.slice(0, -4)\n var checksum = buffer.slice(-4)\n var newChecksum = sha256x2(payload).slice(0, 4)\n\n assert.deepEqual(newChecksum, checksum, 'Invalid checksum')\n\n return payload\n}\n\nmodule.exports = {\n encode: encode,\n decode: decode\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"bs58\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bs58check/node_modules/bs58/lib/bs58.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"crypto\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/curve.js\":[function(require,module,exports){\nvar assert = require('assert')\nvar BigInteger = require('bigi')\n\nvar Point = require('./point')\n\nfunction Curve(p, a, b, Gx, Gy, n, h) {\n this.p = p\n this.a = a\n this.b = b\n this.G = Point.fromAffine(this, Gx, Gy)\n this.n = n\n this.h = h\n\n this.infinity = new Point(this, null, null, BigInteger.ZERO)\n\n // result caching\n this.pOverFour = p.add(BigInteger.ONE).shiftRight(2)\n}\n\nCurve.prototype.pointFromX = function(isOdd, x) {\n var alpha = x.pow(3).add(this.a.multiply(x)).add(this.b).mod(this.p)\n var beta = alpha.modPow(this.pOverFour, this.p) // XXX: not compatible with all curves\n\n var y = beta\n if (beta.isEven() ^ !isOdd) {\n y = this.p.subtract(y) // -y % p\n }\n\n return Point.fromAffine(this, x, y)\n}\n\nCurve.prototype.isInfinity = function(Q) {\n if (Q === this.infinity) return true\n\n return Q.z.signum() === 0 && Q.y.signum() !== 0\n}\n\nCurve.prototype.isOnCurve = function(Q) {\n if (this.isInfinity(Q)) return true\n\n var x = Q.affineX\n var y = Q.affineY\n var a = this.a\n var b = this.b\n var p = this.p\n\n // Check that xQ and yQ are integers in the interval [0, p - 1]\n if (x.signum() < 0 || x.compareTo(p) >= 0) return false\n if (y.signum() < 0 || y.compareTo(p) >= 0) return false\n\n // and check that y^2 = x^3 + ax + b (mod p)\n var lhs = y.square().mod(p)\n var rhs = x.pow(3).add(a.multiply(x)).add(b).mod(p)\n return lhs.equals(rhs)\n}\n\n/**\n * Validate an elliptic curve point.\n *\n * See SEC 1, section 3.2.2.1: Elliptic Curve Public Key Validation Primitive\n */\nCurve.prototype.validate = function(Q) {\n // Check Q != O\n assert(!this.isInfinity(Q), 'Point is at infinity')\n assert(this.isOnCurve(Q), 'Point is not on the curve')\n\n // Check nQ = O (where Q is a scalar multiple of G)\n var nQ = Q.multiply(this.n)\n assert(this.isInfinity(nQ), 'Point is not a scalar multiple of G')\n\n return true\n}\n\nmodule.exports = Curve\n\n},{\"./point\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/point.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"bigi\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/curves.json\":[function(require,module,exports){\nmodule.exports={\n \"secp128r1\": {\n \"p\": \"fffffffdffffffffffffffffffffffff\",\n \"a\": \"fffffffdfffffffffffffffffffffffc\",\n \"b\": \"e87579c11079f43dd824993c2cee5ed3\",\n \"n\": \"fffffffe0000000075a30d1b9038a115\",\n \"h\": \"01\",\n \"Gx\": \"161ff7528b899b2d0c28607ca52c5b86\",\n \"Gy\": \"cf5ac8395bafeb13c02da292dded7a83\"\n },\n \"secp160k1\": {\n \"p\": \"fffffffffffffffffffffffffffffffeffffac73\",\n \"a\": \"00\",\n \"b\": \"07\",\n \"n\": \"0100000000000000000001b8fa16dfab9aca16b6b3\",\n \"h\": \"01\",\n \"Gx\": \"3b4c382ce37aa192a4019e763036f4f5dd4d7ebb\",\n \"Gy\": \"938cf935318fdced6bc28286531733c3f03c4fee\"\n },\n \"secp160r1\": {\n \"p\": \"ffffffffffffffffffffffffffffffff7fffffff\",\n \"a\": \"ffffffffffffffffffffffffffffffff7ffffffc\",\n \"b\": \"1c97befc54bd7a8b65acf89f81d4d4adc565fa45\",\n \"n\": \"0100000000000000000001f4c8f927aed3ca752257\",\n \"h\": \"01\",\n \"Gx\": \"4a96b5688ef573284664698968c38bb913cbfc82\",\n \"Gy\": \"23a628553168947d59dcc912042351377ac5fb32\"\n },\n \"secp192k1\": {\n \"p\": \"fffffffffffffffffffffffffffffffffffffffeffffee37\",\n \"a\": \"00\",\n \"b\": \"03\",\n \"n\": \"fffffffffffffffffffffffe26f2fc170f69466a74defd8d\",\n \"h\": \"01\",\n \"Gx\": \"db4ff10ec057e9ae26b07d0280b7f4341da5d1b1eae06c7d\",\n \"Gy\": \"9b2f2f6d9c5628a7844163d015be86344082aa88d95e2f9d\"\n },\n \"secp192r1\": {\n \"p\": \"fffffffffffffffffffffffffffffffeffffffffffffffff\",\n \"a\": \"fffffffffffffffffffffffffffffffefffffffffffffffc\",\n \"b\": \"64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1\",\n \"n\": \"ffffffffffffffffffffffff99def836146bc9b1b4d22831\",\n \"h\": \"01\",\n \"Gx\": \"188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012\",\n \"Gy\": \"07192b95ffc8da78631011ed6b24cdd573f977a11e794811\"\n },\n \"secp256k1\": {\n \"p\": \"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f\",\n \"a\": \"00\",\n \"b\": \"07\",\n \"n\": \"fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141\",\n \"h\": \"01\",\n \"Gx\": \"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798\",\n \"Gy\": \"483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8\"\n },\n \"secp256r1\": {\n \"p\": \"ffffffff00000001000000000000000000000000ffffffffffffffffffffffff\",\n \"a\": \"ffffffff00000001000000000000000000000000fffffffffffffffffffffffc\",\n \"b\": \"5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b\",\n \"n\": \"ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551\",\n \"h\": \"01\",\n \"Gx\": \"6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296\",\n \"Gy\": \"4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5\"\n }\n}\n\n},{}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/index.js\":[function(require,module,exports){\nvar Point = require('./point')\nvar Curve = require('./curve')\n\nvar getCurveByName = require('./names')\n\nmodule.exports = {\n Curve: Curve,\n Point: Point,\n getCurveByName: getCurveByName\n}\n\n},{\"./curve\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/curve.js\",\"./names\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/names.js\",\"./point\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/point.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/names.js\":[function(require,module,exports){\nvar BigInteger = require('bigi')\n\nvar curves = require('./curves')\nvar Curve = require('./curve')\n\nfunction getCurveByName(name) {\n var curve = curves[name]\n if (!curve) return null\n\n var p = new BigInteger(curve.p, 16)\n var a = new BigInteger(curve.a, 16)\n var b = new BigInteger(curve.b, 16)\n var n = new BigInteger(curve.n, 16)\n var h = new BigInteger(curve.h, 16)\n var Gx = new BigInteger(curve.Gx, 16)\n var Gy = new BigInteger(curve.Gy, 16)\n\n return new Curve(p, a, b, Gx, Gy, n, h)\n}\n\nmodule.exports = getCurveByName\n\n},{\"./curve\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/curve.js\",\"./curves\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/curves.json\",\"bigi\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/point.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar BigInteger = require('bigi')\n\nvar THREE = BigInteger.valueOf(3)\n\nfunction Point(curve, x, y, z) {\n assert.notStrictEqual(z, undefined, 'Missing Z coordinate')\n\n this.curve = curve\n this.x = x\n this.y = y\n this.z = z\n this._zInv = null\n\n this.compressed = true\n}\n\nObject.defineProperty(Point.prototype, 'zInv', {\n get: function() {\n if (this._zInv === null) {\n this._zInv = this.z.modInverse(this.curve.p)\n }\n\n return this._zInv\n }\n})\n\nObject.defineProperty(Point.prototype, 'affineX', {\n get: function() {\n return this.x.multiply(this.zInv).mod(this.curve.p)\n }\n})\n\nObject.defineProperty(Point.prototype, 'affineY', {\n get: function() {\n return this.y.multiply(this.zInv).mod(this.curve.p)\n }\n})\n\nPoint.fromAffine = function(curve, x, y) {\n return new Point(curve, x, y, BigInteger.ONE)\n}\n\nPoint.prototype.equals = function(other) {\n if (other === this) return true\n if (this.curve.isInfinity(this)) return this.curve.isInfinity(other)\n if (this.curve.isInfinity(other)) return this.curve.isInfinity(this)\n\n // u = Y2 * Z1 - Y1 * Z2\n var u = other.y.multiply(this.z).subtract(this.y.multiply(other.z)).mod(this.curve.p)\n\n if (u.signum() !== 0) return false\n\n // v = X2 * Z1 - X1 * Z2\n var v = other.x.multiply(this.z).subtract(this.x.multiply(other.z)).mod(this.curve.p)\n\n return v.signum() === 0\n}\n\nPoint.prototype.negate = function() {\n var y = this.curve.p.subtract(this.y)\n\n return new Point(this.curve, this.x, y, this.z)\n}\n\nPoint.prototype.add = function(b) {\n if (this.curve.isInfinity(this)) return b\n if (this.curve.isInfinity(b)) return this\n\n var x1 = this.x\n var y1 = this.y\n var x2 = b.x\n var y2 = b.y\n\n // u = Y2 * Z1 - Y1 * Z2\n var u = y2.multiply(this.z).subtract(y1.multiply(b.z)).mod(this.curve.p)\n // v = X2 * Z1 - X1 * Z2\n var v = x2.multiply(this.z).subtract(x1.multiply(b.z)).mod(this.curve.p)\n\n if (v.signum() === 0) {\n if (u.signum() === 0) {\n return this.twice() // this == b, so double\n }\n\n return this.curve.infinity // this = -b, so infinity\n }\n\n var v2 = v.square()\n var v3 = v2.multiply(v)\n var x1v2 = x1.multiply(v2)\n var zu2 = u.square().multiply(this.z)\n\n // x3 = v * (z2 * (z1 * u^2 - 2 * x1 * v^2) - v^3)\n var x3 = zu2.subtract(x1v2.shiftLeft(1)).multiply(b.z).subtract(v3).multiply(v).mod(this.curve.p)\n // y3 = z2 * (3 * x1 * u * v^2 - y1 * v^3 - z1 * u^3) + u * v^3\n 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)\n // z3 = v^3 * z1 * z2\n var z3 = v3.multiply(this.z).multiply(b.z).mod(this.curve.p)\n\n return new Point(this.curve, x3, y3, z3)\n}\n\nPoint.prototype.twice = function() {\n if (this.curve.isInfinity(this)) return this\n if (this.y.signum() === 0) return this.curve.infinity\n\n var x1 = this.x\n var y1 = this.y\n\n var y1z1 = y1.multiply(this.z)\n var y1sqz1 = y1z1.multiply(y1).mod(this.curve.p)\n var a = this.curve.a\n\n // w = 3 * x1^2 + a * z1^2\n var w = x1.square().multiply(THREE)\n\n if (a.signum() !== 0) {\n w = w.add(this.z.square().multiply(a))\n }\n\n w = w.mod(this.curve.p)\n // x3 = 2 * y1 * z1 * (w^2 - 8 * x1 * y1^2 * z1)\n var x3 = w.square().subtract(x1.shiftLeft(3).multiply(y1sqz1)).shiftLeft(1).multiply(y1z1).mod(this.curve.p)\n // y3 = 4 * y1^2 * z1 * (3 * w * x1 - 2 * y1^2 * z1) - w^3\n var y3 = w.multiply(THREE).multiply(x1).subtract(y1sqz1.shiftLeft(1)).shiftLeft(2).multiply(y1sqz1).subtract(w.pow(3)).mod(this.curve.p)\n // z3 = 8 * (y1 * z1)^3\n var z3 = y1z1.pow(3).shiftLeft(3).mod(this.curve.p)\n\n return new Point(this.curve, x3, y3, z3)\n}\n\n// Simple NAF (Non-Adjacent Form) multiplication algorithm\n// TODO: modularize the multiplication algorithm\nPoint.prototype.multiply = function(k) {\n if (this.curve.isInfinity(this)) return this\n if (k.signum() === 0) return this.curve.infinity\n\n var e = k\n var h = e.multiply(THREE)\n\n var neg = this.negate()\n var R = this\n\n for (var i = h.bitLength() - 2; i > 0; --i) {\n R = R.twice()\n\n var hBit = h.testBit(i)\n var eBit = e.testBit(i)\n\n if (hBit != eBit) {\n R = R.add(hBit ? this : neg)\n }\n }\n\n return R\n}\n\n// Compute this*j + x*k (simultaneous multiplication)\nPoint.prototype.multiplyTwo = function(j, x, k) {\n var i\n\n if (j.bitLength() > k.bitLength())\n i = j.bitLength() - 1\n else\n i = k.bitLength() - 1\n\n var R = this.curve.infinity\n var both = this.add(x)\n\n while (i >= 0) {\n R = R.twice()\n\n var jBit = j.testBit(i)\n var kBit = k.testBit(i)\n\n if (jBit) {\n if (kBit) {\n R = R.add(both)\n\n } else {\n R = R.add(this)\n }\n\n } else {\n if (kBit) {\n R = R.add(x)\n }\n }\n --i\n }\n\n return R\n}\n\nPoint.prototype.getEncoded = function(compressed) {\n if (compressed == undefined) compressed = this.compressed\n if (this.curve.isInfinity(this)) return new Buffer('00', 'hex') // Infinity point encoded is simply '00'\n\n var x = this.affineX\n var y = this.affineY\n\n var buffer\n\n // Determine size of q in bytes\n var byteLength = Math.floor((this.curve.p.bitLength() + 7) / 8)\n\n // 0x02/0x03 | X\n if (compressed) {\n buffer = new Buffer(1 + byteLength)\n buffer.writeUInt8(y.isEven() ? 0x02 : 0x03, 0)\n\n // 0x04 | X | Y\n } else {\n buffer = new Buffer(1 + byteLength + byteLength)\n buffer.writeUInt8(0x04, 0)\n\n y.toBuffer(byteLength).copy(buffer, 1 + byteLength)\n }\n\n x.toBuffer(byteLength).copy(buffer, 1)\n\n return buffer\n}\n\nPoint.decodeFrom = function(curve, buffer) {\n var type = buffer.readUInt8(0)\n var compressed = (type !== 4)\n\n var byteLength = Math.floor((curve.p.bitLength() + 7) / 8)\n var x = BigInteger.fromBuffer(buffer.slice(1, 1 + byteLength))\n\n var Q\n if (compressed) {\n assert.equal(buffer.length, byteLength + 1, 'Invalid sequence length')\n assert(type === 0x02 || type === 0x03, 'Invalid sequence tag')\n\n var isOdd = (type === 0x03)\n Q = curve.pointFromX(isOdd, x)\n\n } else {\n assert.equal(buffer.length, 1 + byteLength + byteLength, 'Invalid sequence length')\n\n var y = BigInteger.fromBuffer(buffer.slice(1 + byteLength))\n Q = Point.fromAffine(curve, x, y)\n }\n\n Q.compressed = compressed\n return Q\n}\n\nPoint.prototype.toString = function () {\n if (this.curve.isInfinity(this)) return '(INFINITY)'\n\n return '(' + this.affineX.toString() + ',' + this.affineY.toString() + ')'\n}\n\nmodule.exports = Point\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"bigi\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/index.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/typeforce/index.js\":[function(require,module,exports){\n(function (Buffer){\nfunction getName(value) {\n if (value === undefined) return ''\n if (value === null) return ''\n// if (value.constructor.name !== undefined) return fn.name\n\n // why not constructor.name: https://kangax.github.io/compat-table/es6/#function_name_property\n var match = value.constructor.toString().match(/function (.*?)\\(/)\n return match ? match[1] : null\n}\n\nmodule.exports = function enforce(type, value) {\n switch (type) {\n case 'Array': {\n if (Array.isArray(value)) return\n break\n }\n\n case 'Boolean': {\n if (typeof value === 'boolean') return\n break\n }\n\n case 'Buffer': {\n if (Buffer.isBuffer(value)) return\n break\n }\n\n case 'Function': {\n if (typeof value === 'function') return\n break\n }\n\n case 'Number': {\n if (typeof value === 'number') return\n break\n }\n\n case 'Object': {\n if (typeof value === 'object') return\n\n break\n }\n\n case 'String': {\n if (typeof value === 'string') return\n break\n }\n }\n\n switch (typeof type) {\n case 'string': {\n if (type === getName(value)) return\n\n break\n }\n\n // evaluate type templates\n case 'object': {\n if (Array.isArray(type)) {\n var subType = type[0]\n\n enforce('Array', value)\n value.forEach(enforce.bind(undefined, subType))\n\n return\n }\n\n enforce('Object', value)\n for (var propertyName in type) {\n var propertyType = type[propertyName]\n\n if (!(propertyName in value)) {\n throw new TypeError('Missing property \"' + propertyName + '\" of type ' + JSON.stringify(propertyType))\n }\n\n var propertyValue = value[propertyName]\n\n try {\n enforce(propertyType, propertyValue)\n } catch (e) {\n throw new TypeError('Expected property \"' + propertyName + '\" of type ' + JSON.stringify(propertyType) + ', got ' + getName(propertyValue) + ' ' + propertyValue)\n }\n }\n\n return\n }\n }\n\n throw new TypeError('Expected ' + type + ', got ' + getName(value) + ' ' + value)\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/address.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar base58check = require('bs58check')\nvar typeForce = require('typeforce')\nvar networks = require('./networks')\nvar scripts = require('./scripts')\n\nfunction findScriptTypeByVersion (version) {\n for (var networkName in networks) {\n var network = networks[networkName]\n\n if (version === network.pubKeyHash) return 'pubkeyhash'\n if (version === network.scriptHash) return 'scripthash'\n }\n}\n\nfunction Address (hash, version) {\n typeForce('Buffer', hash)\n\n assert.strictEqual(hash.length, 20, 'Invalid hash length')\n assert.strictEqual(version & 0xff, version, 'Invalid version byte')\n\n this.hash = hash\n this.version = version\n}\n\nAddress.fromBase58Check = function (string) {\n var payload = base58check.decode(string)\n var version = payload.readUInt8(0)\n var hash = payload.slice(1)\n\n return new Address(hash, version)\n}\n\nAddress.fromOutputScript = function (script, network) {\n network = network || networks.bitcoin\n\n if (scripts.isPubKeyHashOutput(script)) return new Address(script.chunks[2], network.pubKeyHash)\n if (scripts.isScriptHashOutput(script)) return new Address(script.chunks[1], network.scriptHash)\n\n assert(false, script.toASM() + ' has no matching Address')\n}\n\nAddress.prototype.toBase58Check = function () {\n var payload = new Buffer(21)\n payload.writeUInt8(this.version, 0)\n this.hash.copy(payload, 1)\n\n return base58check.encode(payload)\n}\n\nAddress.prototype.toOutputScript = function () {\n var scriptType = findScriptTypeByVersion(this.version)\n\n if (scriptType === 'pubkeyhash') return scripts.pubKeyHashOutput(this.hash)\n if (scriptType === 'scripthash') return scripts.scriptHashOutput(this.hash)\n\n assert(false, this.toString() + ' has no matching Script')\n}\n\nAddress.prototype.toString = Address.prototype.toBase58Check\n\nmodule.exports = Address\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./networks\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/networks.js\",\"./scripts\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/scripts.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"bs58check\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bs58check/src/bs58check.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"typeforce\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/typeforce/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/base58check.js\":[function(require,module,exports){\nvar bs58check = require('bs58check')\n\nfunction decode () {\n console.warn('bs58check will be removed in 2.0.0. require(\"bs58check\") instead.')\n\n return bs58check.decode.apply(undefined, arguments)\n}\n\nfunction encode () {\n console.warn('bs58check will be removed in 2.0.0. require(\"bs58check\") instead.')\n\n return bs58check.encode.apply(undefined, arguments)\n}\n\nmodule.exports = {\n decode: decode,\n encode: encode\n}\n\n},{\"bs58check\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bs58check/src/bs58check.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/block.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar bufferutils = require('./bufferutils')\nvar crypto = require('./crypto')\n\nvar Transaction = require('./transaction')\n\nfunction Block () {\n this.version = 1\n this.prevHash = null\n this.merkleRoot = null\n this.timestamp = 0\n this.bits = 0\n this.nonce = 0\n}\n\nBlock.fromBuffer = function (buffer) {\n assert(buffer.length >= 80, 'Buffer too small (< 80 bytes)')\n\n var offset = 0\n function readSlice (n) {\n offset += n\n return buffer.slice(offset - n, offset)\n }\n\n function readUInt32 () {\n var i = buffer.readUInt32LE(offset)\n offset += 4\n return i\n }\n\n var block = new Block()\n block.version = readUInt32()\n block.prevHash = readSlice(32)\n block.merkleRoot = readSlice(32)\n block.timestamp = readUInt32()\n block.bits = readUInt32()\n block.nonce = readUInt32()\n\n if (buffer.length === 80) return block\n\n function readVarInt () {\n var vi = bufferutils.readVarInt(buffer, offset)\n offset += vi.size\n return vi.number\n }\n\n // FIXME: poor performance\n function readTransaction () {\n var tx = Transaction.fromBuffer(buffer.slice(offset), true)\n\n offset += tx.toBuffer().length\n return tx\n }\n\n var nTransactions = readVarInt()\n block.transactions = []\n\n for (var i = 0; i < nTransactions; ++i) {\n var tx = readTransaction()\n block.transactions.push(tx)\n }\n\n return block\n}\n\nBlock.fromHex = function (hex) {\n return Block.fromBuffer(new Buffer(hex, 'hex'))\n}\n\nBlock.prototype.getHash = function () {\n return crypto.hash256(this.toBuffer(true))\n}\n\nBlock.prototype.getId = function () {\n return bufferutils.reverse(this.getHash()).toString('hex')\n}\n\nBlock.prototype.getUTCDate = function () {\n var date = new Date(0) // epoch\n date.setUTCSeconds(this.timestamp)\n\n return date\n}\n\nBlock.prototype.toBuffer = function (headersOnly) {\n var buffer = new Buffer(80)\n\n var offset = 0\n function writeSlice (slice) {\n slice.copy(buffer, offset)\n offset += slice.length\n }\n\n function writeUInt32 (i) {\n buffer.writeUInt32LE(i, offset)\n offset += 4\n }\n\n writeUInt32(this.version)\n writeSlice(this.prevHash)\n writeSlice(this.merkleRoot)\n writeUInt32(this.timestamp)\n writeUInt32(this.bits)\n writeUInt32(this.nonce)\n\n if (headersOnly || !this.transactions) return buffer\n\n var txLenBuffer = bufferutils.varIntBuffer(this.transactions.length)\n var txBuffers = this.transactions.map(function (tx) {\n return tx.toBuffer()\n })\n\n return Buffer.concat([buffer, txLenBuffer].concat(txBuffers))\n}\n\nBlock.prototype.toHex = function (headersOnly) {\n return this.toBuffer(headersOnly).toString('hex')\n}\n\nmodule.exports = Block\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./bufferutils\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/bufferutils.js\",\"./crypto\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/crypto.js\",\"./transaction\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/transaction.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/bufferutils.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar opcodes = require('./opcodes')\n\n// https://github.com/feross/buffer/blob/master/index.js#L1127\nfunction verifuint (value, max) {\n assert(typeof value === 'number', 'cannot write a non-number as a number')\n assert(value >= 0, 'specified a negative value for writing an unsigned value')\n assert(value <= max, 'value is larger than maximum value for type')\n assert(Math.floor(value) === value, 'value has a fractional component')\n}\n\nfunction pushDataSize (i) {\n return i < opcodes.OP_PUSHDATA1 ? 1\n : i < 0xff ? 2\n : i < 0xffff ? 3\n : 5\n}\n\nfunction readPushDataInt (buffer, offset) {\n var opcode = buffer.readUInt8(offset)\n var number, size\n\n // ~6 bit\n if (opcode < opcodes.OP_PUSHDATA1) {\n number = opcode\n size = 1\n\n // 8 bit\n } else if (opcode === opcodes.OP_PUSHDATA1) {\n if (offset + 2 > buffer.length) return null\n number = buffer.readUInt8(offset + 1)\n size = 2\n\n // 16 bit\n } else if (opcode === opcodes.OP_PUSHDATA2) {\n if (offset + 3 > buffer.length) return null\n number = buffer.readUInt16LE(offset + 1)\n size = 3\n\n // 32 bit\n } else {\n if (offset + 5 > buffer.length) return null\n assert.equal(opcode, opcodes.OP_PUSHDATA4, 'Unexpected opcode')\n\n number = buffer.readUInt32LE(offset + 1)\n size = 5\n }\n\n return {\n opcode: opcode,\n number: number,\n size: size\n }\n}\n\nfunction readUInt64LE (buffer, offset) {\n var a = buffer.readUInt32LE(offset)\n var b = buffer.readUInt32LE(offset + 4)\n b *= 0x100000000\n\n verifuint(b + a, 0x001fffffffffffff)\n\n return b + a\n}\n\nfunction readVarInt (buffer, offset) {\n var t = buffer.readUInt8(offset)\n var number, size\n\n // 8 bit\n if (t < 253) {\n number = t\n size = 1\n\n // 16 bit\n } else if (t < 254) {\n number = buffer.readUInt16LE(offset + 1)\n size = 3\n\n // 32 bit\n } else if (t < 255) {\n number = buffer.readUInt32LE(offset + 1)\n size = 5\n\n // 64 bit\n } else {\n number = readUInt64LE(buffer, offset + 1)\n size = 9\n }\n\n return {\n number: number,\n size: size\n }\n}\n\nfunction writePushDataInt (buffer, number, offset) {\n var size = pushDataSize(number)\n\n // ~6 bit\n if (size === 1) {\n buffer.writeUInt8(number, offset)\n\n // 8 bit\n } else if (size === 2) {\n buffer.writeUInt8(opcodes.OP_PUSHDATA1, offset)\n buffer.writeUInt8(number, offset + 1)\n\n // 16 bit\n } else if (size === 3) {\n buffer.writeUInt8(opcodes.OP_PUSHDATA2, offset)\n buffer.writeUInt16LE(number, offset + 1)\n\n // 32 bit\n } else {\n buffer.writeUInt8(opcodes.OP_PUSHDATA4, offset)\n buffer.writeUInt32LE(number, offset + 1)\n }\n\n return size\n}\n\nfunction writeUInt64LE (buffer, value, offset) {\n verifuint(value, 0x001fffffffffffff)\n\n buffer.writeInt32LE(value & -1, offset)\n buffer.writeUInt32LE(Math.floor(value / 0x100000000), offset + 4)\n}\n\nfunction varIntSize (i) {\n return i < 253 ? 1\n : i < 0x10000 ? 3\n : i < 0x100000000 ? 5\n : 9\n}\n\nfunction writeVarInt (buffer, number, offset) {\n var size = varIntSize(number)\n\n // 8 bit\n if (size === 1) {\n buffer.writeUInt8(number, offset)\n\n // 16 bit\n } else if (size === 3) {\n buffer.writeUInt8(253, offset)\n buffer.writeUInt16LE(number, offset + 1)\n\n // 32 bit\n } else if (size === 5) {\n buffer.writeUInt8(254, offset)\n buffer.writeUInt32LE(number, offset + 1)\n\n // 64 bit\n } else {\n buffer.writeUInt8(255, offset)\n writeUInt64LE(buffer, number, offset + 1)\n }\n\n return size\n}\n\nfunction varIntBuffer (i) {\n var size = varIntSize(i)\n var buffer = new Buffer(size)\n writeVarInt(buffer, i, 0)\n\n return buffer\n}\n\nfunction reverse (buffer) {\n var buffer2 = new Buffer(buffer)\n Array.prototype.reverse.call(buffer2)\n return buffer2\n}\n\nmodule.exports = {\n pushDataSize: pushDataSize,\n readPushDataInt: readPushDataInt,\n readUInt64LE: readUInt64LE,\n readVarInt: readVarInt,\n reverse: reverse,\n varIntBuffer: varIntBuffer,\n varIntSize: varIntSize,\n writePushDataInt: writePushDataInt,\n writeUInt64LE: writeUInt64LE,\n writeVarInt: writeVarInt\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./opcodes\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/opcodes.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/crypto.js\":[function(require,module,exports){\nvar crypto = require('crypto')\n\nfunction hash160 (buffer) {\n return ripemd160(sha256(buffer))\n}\n\nfunction hash256 (buffer) {\n return sha256(sha256(buffer))\n}\n\nfunction ripemd160 (buffer) {\n return crypto.createHash('rmd160').update(buffer).digest()\n}\n\nfunction sha1 (buffer) {\n return crypto.createHash('sha1').update(buffer).digest()\n}\n\nfunction sha256 (buffer) {\n return crypto.createHash('sha256').update(buffer).digest()\n}\n\n// FIXME: Name not consistent with others\nfunction HmacSHA256 (buffer, secret) {\n console.warn('Hmac* functions are deprecated for removal in 2.0.0, use node crypto instead')\n return crypto.createHmac('sha256', secret).update(buffer).digest()\n}\n\nfunction HmacSHA512 (buffer, secret) {\n console.warn('Hmac* functions are deprecated for removal in 2.0.0, use node crypto instead')\n return crypto.createHmac('sha512', secret).update(buffer).digest()\n}\n\nmodule.exports = {\n ripemd160: ripemd160,\n sha1: sha1,\n sha256: sha256,\n hash160: hash160,\n hash256: hash256,\n HmacSHA256: HmacSHA256,\n HmacSHA512: HmacSHA512\n}\n\n},{\"crypto\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecdsa.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar crypto = require('crypto')\nvar typeForce = require('typeforce')\n\nvar BigInteger = require('bigi')\nvar ECSignature = require('./ecsignature')\n\nvar ZERO = new Buffer([0])\nvar ONE = new Buffer([1])\n\n// https://tools.ietf.org/html/rfc6979#section-3.2\nfunction deterministicGenerateK (curve, hash, d, checkSig) {\n typeForce('Buffer', hash)\n typeForce('BigInteger', d)\n\n // FIXME: remove/uncomment for 2.0.0\n // typeForce('Function', checkSig)\n\n if (typeof checkSig !== 'function') {\n console.warn('deterministicGenerateK requires a checkSig callback in 2.0.0, see #337 for more information')\n\n checkSig = function (k) {\n var G = curve.G\n var n = curve.n\n var e = BigInteger.fromBuffer(hash)\n\n var Q = G.multiply(k)\n\n if (curve.isInfinity(Q))\n return false\n\n var r = Q.affineX.mod(n)\n if (r.signum() === 0)\n return false\n\n var s = k.modInverse(n).multiply(e.add(d.multiply(r))).mod(n)\n if (s.signum() === 0)\n return false\n\n return true\n }\n }\n\n // sanity check\n assert.equal(hash.length, 32, 'Hash must be 256 bit')\n\n var x = d.toBuffer(32)\n var k = new Buffer(32)\n var v = new Buffer(32)\n\n // Step A, ignored as hash already provided\n // Step B\n v.fill(1)\n\n // Step C\n k.fill(0)\n\n // Step D\n k = crypto.createHmac('sha256', k)\n .update(v)\n .update(ZERO)\n .update(x)\n .update(hash)\n .digest()\n\n // Step E\n v = crypto.createHmac('sha256', k).update(v).digest()\n\n // Step F\n k = crypto.createHmac('sha256', k)\n .update(v)\n .update(ONE)\n .update(x)\n .update(hash)\n .digest()\n\n // Step G\n v = crypto.createHmac('sha256', k).update(v).digest()\n\n // Step H1/H2a, ignored as tlen === qlen (256 bit)\n // Step H2b\n v = crypto.createHmac('sha256', k).update(v).digest()\n\n var T = BigInteger.fromBuffer(v)\n\n // Step H3, repeat until T is within the interval [1, n - 1] and is suitable for ECDSA\n while ((T.signum() <= 0) || (T.compareTo(curve.n) >= 0) || !checkSig(T)) {\n k = crypto.createHmac('sha256', k)\n .update(v)\n .update(ZERO)\n .digest()\n\n v = crypto.createHmac('sha256', k).update(v).digest()\n\n // Step H1/H2a, again, ignored as tlen === qlen (256 bit)\n // Step H2b again\n v = crypto.createHmac('sha256', k).update(v).digest()\n T = BigInteger.fromBuffer(v)\n }\n\n return T\n}\n\nfunction sign (curve, hash, d) {\n var r, s\n\n var e = BigInteger.fromBuffer(hash)\n var n = curve.n\n var G = curve.G\n\n deterministicGenerateK(curve, hash, d, function (k) {\n var Q = G.multiply(k)\n\n if (curve.isInfinity(Q))\n return false\n\n r = Q.affineX.mod(n)\n if (r.signum() === 0)\n return false\n\n s = k.modInverse(n).multiply(e.add(d.multiply(r))).mod(n)\n if (s.signum() === 0)\n return false\n\n return true\n })\n\n var N_OVER_TWO = n.shiftRight(1)\n\n // enforce low S values, see bip62: 'low s values in signatures'\n if (s.compareTo(N_OVER_TWO) > 0) {\n s = n.subtract(s)\n }\n\n return new ECSignature(r, s)\n}\n\nfunction verifyRaw (curve, e, signature, Q) {\n var n = curve.n\n var G = curve.G\n\n var r = signature.r\n var s = signature.s\n\n // 1.4.1 Enforce r and s are both integers in the interval [1, n − 1]\n if (r.signum() <= 0 || r.compareTo(n) >= 0) return false\n if (s.signum() <= 0 || s.compareTo(n) >= 0) return false\n\n // c = s^-1 mod n\n var c = s.modInverse(n)\n\n // 1.4.4 Compute u1 = es^−1 mod n\n // u2 = rs^−1 mod n\n var u1 = e.multiply(c).mod(n)\n var u2 = r.multiply(c).mod(n)\n\n // 1.4.5 Compute R = (xR, yR) = u1G + u2Q\n var R = G.multiplyTwo(u1, Q, u2)\n var v = R.affineX.mod(n)\n\n // 1.4.5 (cont.) Enforce R is not at infinity\n if (curve.isInfinity(R)) return false\n\n // 1.4.8 If v = r, output \"valid\", and if v != r, output \"invalid\"\n return v.equals(r)\n}\n\nfunction verify (curve, hash, signature, Q) {\n // 1.4.2 H = Hash(M), already done by the user\n // 1.4.3 e = H\n var e = BigInteger.fromBuffer(hash)\n\n return verifyRaw(curve, e, signature, Q)\n}\n\n/**\n * Recover a public key from a signature.\n *\n * See SEC 1: Elliptic Curve Cryptography, section 4.1.6, \"Public\n * Key Recovery Operation\".\n *\n * http://www.secg.org/download/aid-780/sec1-v2.pdf\n */\nfunction recoverPubKey (curve, e, signature, i) {\n assert.strictEqual(i & 3, i, 'Recovery param is more than two bits')\n\n var n = curve.n\n var G = curve.G\n\n var r = signature.r\n var s = signature.s\n\n assert(r.signum() > 0 && r.compareTo(n) < 0, 'Invalid r value')\n assert(s.signum() > 0 && s.compareTo(n) < 0, 'Invalid s value')\n\n // A set LSB signifies that the y-coordinate is odd\n var isYOdd = i & 1\n\n // The more significant bit specifies whether we should use the\n // first or second candidate key.\n var isSecondKey = i >> 1\n\n // 1.1 Let x = r + jn\n var x = isSecondKey ? r.add(n) : r\n var R = curve.pointFromX(isYOdd, x)\n\n // 1.4 Check that nR is at infinity\n var nR = R.multiply(n)\n assert(curve.isInfinity(nR), 'nR is not a valid curve point')\n\n // Compute -e from e\n var eNeg = e.negate().mod(n)\n\n // 1.6.1 Compute Q = r^-1 (sR - eG)\n // Q = r^-1 (sR + -eG)\n var rInv = r.modInverse(n)\n\n var Q = R.multiplyTwo(s, G, eNeg).multiply(rInv)\n curve.validate(Q)\n\n return Q\n}\n\n/**\n * Calculate pubkey extraction parameter.\n *\n * When extracting a pubkey from a signature, we have to\n * distinguish four different cases. Rather than putting this\n * burden on the verifier, Bitcoin includes a 2-bit value with the\n * signature.\n *\n * This function simply tries all four cases and returns the value\n * that resulted in a successful pubkey recovery.\n */\nfunction calcPubKeyRecoveryParam (curve, e, signature, Q) {\n for (var i = 0; i < 4; i++) {\n var Qprime = recoverPubKey(curve, e, signature, i)\n\n // 1.6.2 Verify Q\n if (Qprime.equals(Q)) {\n return i\n }\n }\n\n throw new Error('Unable to find valid recovery factor')\n}\n\nmodule.exports = {\n calcPubKeyRecoveryParam: calcPubKeyRecoveryParam,\n deterministicGenerateK: deterministicGenerateK,\n recoverPubKey: recoverPubKey,\n sign: sign,\n verify: verify,\n verifyRaw: verifyRaw\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./ecsignature\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecsignature.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"bigi\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/index.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"crypto\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/index.js\",\"typeforce\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/typeforce/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/eckey.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar base58check = require('bs58check')\nvar crypto = require('crypto')\nvar ecdsa = require('./ecdsa')\nvar typeForce = require('typeforce')\nvar networks = require('./networks')\n\nvar BigInteger = require('bigi')\nvar ECPubKey = require('./ecpubkey')\n\nvar ecurve = require('ecurve')\nvar secp256k1 = ecurve.getCurveByName('secp256k1')\n\nfunction ECKey (d, compressed) {\n assert(d.signum() > 0, 'Private key must be greater than 0')\n assert(d.compareTo(ECKey.curve.n) < 0, 'Private key must be less than the curve order')\n\n var Q = ECKey.curve.G.multiply(d)\n\n this.d = d\n this.pub = new ECPubKey(Q, compressed)\n}\n\n// Constants\nECKey.curve = secp256k1\n\n// Static constructors\nECKey.fromWIF = function (string) {\n var payload = base58check.decode(string)\n var compressed = false\n\n // Ignore the version byte\n payload = payload.slice(1)\n\n if (payload.length === 33) {\n assert.strictEqual(payload[32], 0x01, 'Invalid compression flag')\n\n // Truncate the compression flag\n payload = payload.slice(0, -1)\n compressed = true\n }\n\n assert.equal(payload.length, 32, 'Invalid WIF payload length')\n\n var d = BigInteger.fromBuffer(payload)\n return new ECKey(d, compressed)\n}\n\nECKey.makeRandom = function (compressed, rng) {\n rng = rng || crypto.randomBytes\n\n var buffer = rng(32)\n typeForce('Buffer', buffer)\n assert.equal(buffer.length, 32, 'Expected 256-bit Buffer from RNG')\n\n var d = BigInteger.fromBuffer(buffer)\n d = d.mod(ECKey.curve.n)\n\n return new ECKey(d, compressed)\n}\n\n// Export functions\nECKey.prototype.toWIF = function (network) {\n network = network || networks.bitcoin\n\n var bufferLen = this.pub.compressed ? 34 : 33\n var buffer = new Buffer(bufferLen)\n\n buffer.writeUInt8(network.wif, 0)\n this.d.toBuffer(32).copy(buffer, 1)\n\n if (this.pub.compressed) {\n buffer.writeUInt8(0x01, 33)\n }\n\n return base58check.encode(buffer)\n}\n\n// Operations\nECKey.prototype.sign = function (hash) {\n return ecdsa.sign(ECKey.curve, hash, this.d)\n}\n\nmodule.exports = ECKey\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./ecdsa\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecdsa.js\",\"./ecpubkey\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecpubkey.js\",\"./networks\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/networks.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"bigi\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/index.js\",\"bs58check\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bs58check/src/bs58check.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"crypto\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/index.js\",\"ecurve\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/index.js\",\"typeforce\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/typeforce/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecpubkey.js\":[function(require,module,exports){\n(function (Buffer){\nvar crypto = require('./crypto')\nvar ecdsa = require('./ecdsa')\nvar typeForce = require('typeforce')\nvar networks = require('./networks')\n\nvar Address = require('./address')\n\nvar ecurve = require('ecurve')\nvar secp256k1 = ecurve.getCurveByName('secp256k1')\n\nfunction ECPubKey (Q, compressed) {\n if (compressed === undefined) {\n compressed = true\n }\n\n typeForce('Point', Q)\n typeForce('Boolean', compressed)\n\n this.compressed = compressed\n this.Q = Q\n}\n\n// Constants\nECPubKey.curve = secp256k1\n\n// Static constructors\nECPubKey.fromBuffer = function (buffer) {\n var Q = ecurve.Point.decodeFrom(ECPubKey.curve, buffer)\n return new ECPubKey(Q, Q.compressed)\n}\n\nECPubKey.fromHex = function (hex) {\n return ECPubKey.fromBuffer(new Buffer(hex, 'hex'))\n}\n\n// Operations\nECPubKey.prototype.getAddress = function (network) {\n network = network || networks.bitcoin\n\n return new Address(crypto.hash160(this.toBuffer()), network.pubKeyHash)\n}\n\nECPubKey.prototype.verify = function (hash, signature) {\n return ecdsa.verify(ECPubKey.curve, hash, signature, this.Q)\n}\n\n// Export functions\nECPubKey.prototype.toBuffer = function () {\n return this.Q.getEncoded(this.compressed)\n}\n\nECPubKey.prototype.toHex = function () {\n return this.toBuffer().toString('hex')\n}\n\nmodule.exports = ECPubKey\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./address\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/address.js\",\"./crypto\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/crypto.js\",\"./ecdsa\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecdsa.js\",\"./networks\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/networks.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"ecurve\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/index.js\",\"typeforce\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/typeforce/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecsignature.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar typeForce = require('typeforce')\n\nvar BigInteger = require('bigi')\n\nfunction ECSignature (r, s) {\n typeForce('BigInteger', r)\n typeForce('BigInteger', s)\n\n this.r = r\n this.s = s\n}\n\nECSignature.parseCompact = function (buffer) {\n assert.equal(buffer.length, 65, 'Invalid signature length')\n var i = buffer.readUInt8(0) - 27\n\n // At most 3 bits\n assert.equal(i, i & 7, 'Invalid signature parameter')\n var compressed = !!(i & 4)\n\n // Recovery param only\n i = i & 3\n\n var r = BigInteger.fromBuffer(buffer.slice(1, 33))\n var s = BigInteger.fromBuffer(buffer.slice(33))\n\n return {\n compressed: compressed,\n i: i,\n signature: new ECSignature(r, s)\n }\n}\n\nECSignature.fromDER = function (buffer) {\n assert.equal(buffer.readUInt8(0), 0x30, 'Not a DER sequence')\n assert.equal(buffer.readUInt8(1), buffer.length - 2, 'Invalid sequence length')\n assert.equal(buffer.readUInt8(2), 0x02, 'Expected a DER integer')\n\n var rLen = buffer.readUInt8(3)\n assert(rLen > 0, 'R length is zero')\n\n var offset = 4 + rLen\n assert.equal(buffer.readUInt8(offset), 0x02, 'Expected a DER integer (2)')\n\n var sLen = buffer.readUInt8(offset + 1)\n assert(sLen > 0, 'S length is zero')\n\n var rB = buffer.slice(4, offset)\n var sB = buffer.slice(offset + 2)\n offset += 2 + sLen\n\n if (rLen > 1 && rB.readUInt8(0) === 0x00) {\n assert(rB.readUInt8(1) & 0x80, 'R value excessively padded')\n }\n\n if (sLen > 1 && sB.readUInt8(0) === 0x00) {\n assert(sB.readUInt8(1) & 0x80, 'S value excessively padded')\n }\n\n assert.equal(offset, buffer.length, 'Invalid DER encoding')\n var r = BigInteger.fromDERInteger(rB)\n var s = BigInteger.fromDERInteger(sB)\n\n assert(r.signum() >= 0, 'R value is negative')\n assert(s.signum() >= 0, 'S value is negative')\n\n return new ECSignature(r, s)\n}\n\n// BIP62: 1 byte hashType flag (only 0x01, 0x02, 0x03, 0x81, 0x82 and 0x83 are allowed)\nECSignature.parseScriptSignature = function (buffer) {\n var hashType = buffer.readUInt8(buffer.length - 1)\n var hashTypeMod = hashType & ~0x80\n\n assert(hashTypeMod > 0x00 && hashTypeMod < 0x04, 'Invalid hashType ' + hashType)\n\n return {\n signature: ECSignature.fromDER(buffer.slice(0, -1)),\n hashType: hashType\n }\n}\n\nECSignature.prototype.toCompact = function (i, compressed) {\n if (compressed) {\n i += 4\n }\n\n i += 27\n\n var buffer = new Buffer(65)\n buffer.writeUInt8(i, 0)\n\n this.r.toBuffer(32).copy(buffer, 1)\n this.s.toBuffer(32).copy(buffer, 33)\n\n return buffer\n}\n\nECSignature.prototype.toDER = function () {\n var rBa = this.r.toDERInteger()\n var sBa = this.s.toDERInteger()\n\n var sequence = []\n\n // INTEGER\n sequence.push(0x02, rBa.length)\n sequence = sequence.concat(rBa)\n\n // INTEGER\n sequence.push(0x02, sBa.length)\n sequence = sequence.concat(sBa)\n\n // SEQUENCE\n sequence.unshift(0x30, sequence.length)\n\n return new Buffer(sequence)\n}\n\nECSignature.prototype.toScriptSignature = function (hashType) {\n var hashTypeMod = hashType & ~0x80\n assert(hashTypeMod > 0x00 && hashTypeMod < 0x04, 'Invalid hashType ' + hashType)\n\n var hashTypeBuffer = new Buffer(1)\n hashTypeBuffer.writeUInt8(hashType, 0)\n\n return Buffer.concat([this.toDER(), hashTypeBuffer])\n}\n\nmodule.exports = ECSignature\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"bigi\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/index.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"typeforce\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/typeforce/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/hdnode.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar base58check = require('bs58check')\nvar bcrypto = require('./crypto')\nvar crypto = require('crypto')\nvar typeForce = require('typeforce')\nvar networks = require('./networks')\n\nvar BigInteger = require('bigi')\nvar ECKey = require('./eckey')\nvar ECPubKey = require('./ecpubkey')\n\nvar ecurve = require('ecurve')\nvar curve = ecurve.getCurveByName('secp256k1')\n\nfunction findBIP32NetworkByVersion (version) {\n for (var name in networks) {\n var network = networks[name]\n\n if (version === network.bip32.private || version === network.bip32.public) {\n return network\n }\n }\n\n assert(false, 'Could not find network for ' + version.toString(16))\n}\n\nfunction HDNode (K, chainCode, network) {\n network = network || networks.bitcoin\n\n typeForce('Buffer', chainCode)\n\n assert.equal(chainCode.length, 32, 'Expected chainCode length of 32, got ' + chainCode.length)\n assert(network.bip32, 'Unknown BIP32 constants for network')\n\n this.chainCode = chainCode\n this.depth = 0\n this.index = 0\n this.parentFingerprint = 0x00000000\n this.network = network\n\n if (K instanceof BigInteger) {\n this.privKey = new ECKey(K, true)\n this.pubKey = this.privKey.pub\n } else if (K instanceof ECKey) {\n assert(K.pub.compressed, 'ECKey must be compressed')\n this.privKey = K\n } else if (K instanceof ECPubKey) {\n assert(K.compressed, 'ECPubKey must be compressed')\n this.pubKey = K\n } else {\n this.pubKey = new ECPubKey(K, true)\n }\n}\n\nHDNode.MASTER_SECRET = new Buffer('Bitcoin seed')\nHDNode.HIGHEST_BIT = 0x80000000\nHDNode.LENGTH = 78\n\nHDNode.fromSeedBuffer = function (seed, network) {\n typeForce('Buffer', seed)\n\n assert(seed.length >= 16, 'Seed should be at least 128 bits')\n assert(seed.length <= 64, 'Seed should be at most 512 bits')\n\n var I = crypto.createHmac('sha512', HDNode.MASTER_SECRET).update(seed).digest()\n var IL = I.slice(0, 32)\n var IR = I.slice(32)\n\n // In case IL is 0 or >= n, the master key is invalid\n // This is handled by `new ECKey` in the HDNode constructor\n var pIL = BigInteger.fromBuffer(IL)\n\n return new HDNode(pIL, IR, network)\n}\n\nHDNode.fromSeedHex = function (hex, network) {\n return HDNode.fromSeedBuffer(new Buffer(hex, 'hex'), network)\n}\n\nHDNode.fromBase58 = function (string, network) {\n return HDNode.fromBuffer(base58check.decode(string), network, true)\n}\n\n// FIXME: remove in 2.x.y\nHDNode.fromBuffer = function (buffer, network, __ignoreDeprecation) {\n if (!__ignoreDeprecation) {\n console.warn('HDNode.fromBuffer() is deprecated for removal in 2.x.y, use fromBase58 instead')\n }\n\n assert.strictEqual(buffer.length, HDNode.LENGTH, 'Invalid buffer length')\n\n // 4 byte: version bytes\n var version = buffer.readUInt32BE(0)\n\n if (network) {\n assert(version === network.bip32.private || version === network.bip32.public, \"Network doesn't match\")\n\n // auto-detect\n } else {\n network = findBIP32NetworkByVersion(version)\n }\n\n // 1 byte: depth: 0x00 for master nodes, 0x01 for level-1 descendants, ...\n var depth = buffer.readUInt8(4)\n\n // 4 bytes: the fingerprint of the parent's key (0x00000000 if master key)\n var parentFingerprint = buffer.readUInt32BE(5)\n if (depth === 0) {\n assert.strictEqual(parentFingerprint, 0x00000000, 'Invalid parent fingerprint')\n }\n\n // 4 bytes: child number. This is the number i in xi = xpar/i, with xi the key being serialized.\n // This is encoded in MSB order. (0x00000000 if master key)\n var index = buffer.readUInt32BE(9)\n assert(depth > 0 || index === 0, 'Invalid index')\n\n // 32 bytes: the chain code\n var chainCode = buffer.slice(13, 45)\n var data, hd\n\n // 33 bytes: private key data (0x00 + k)\n if (version === network.bip32.private) {\n assert.strictEqual(buffer.readUInt8(45), 0x00, 'Invalid private key')\n data = buffer.slice(46, 78)\n var d = BigInteger.fromBuffer(data)\n hd = new HDNode(d, chainCode, network)\n\n // 33 bytes: public key data (0x02 + X or 0x03 + X)\n } else {\n data = buffer.slice(45, 78)\n var Q = ecurve.Point.decodeFrom(curve, data)\n assert.equal(Q.compressed, true, 'Invalid public key')\n\n // Verify that the X coordinate in the public point corresponds to a point on the curve.\n // If not, the extended public key is invalid.\n curve.validate(Q)\n\n hd = new HDNode(Q, chainCode, network)\n }\n\n hd.depth = depth\n hd.index = index\n hd.parentFingerprint = parentFingerprint\n\n return hd\n}\n\n// FIXME: remove in 2.x.y\nHDNode.fromHex = function (hex, network) {\n return HDNode.fromBuffer(new Buffer(hex, 'hex'), network)\n}\n\nHDNode.prototype.getIdentifier = function () {\n return bcrypto.hash160(this.pubKey.toBuffer())\n}\n\nHDNode.prototype.getFingerprint = function () {\n return this.getIdentifier().slice(0, 4)\n}\n\nHDNode.prototype.getAddress = function () {\n return this.pubKey.getAddress(this.network)\n}\n\nHDNode.prototype.neutered = function () {\n var neutered = new HDNode(this.pubKey.Q, this.chainCode, this.network)\n neutered.depth = this.depth\n neutered.index = this.index\n neutered.parentFingerprint = this.parentFingerprint\n\n return neutered\n}\n\nHDNode.prototype.toBase58 = function (isPrivate) {\n return base58check.encode(this.toBuffer(isPrivate, true))\n}\n\n// FIXME: remove in 2.x.y\nHDNode.prototype.toBuffer = function (isPrivate, __ignoreDeprecation) {\n if (isPrivate === undefined) {\n isPrivate = !!this.privKey\n\n // FIXME: remove in 2.x.y\n } else {\n console.warn('isPrivate flag is deprecated, please use the .neutered() method instead')\n }\n\n if (!__ignoreDeprecation) {\n console.warn('HDNode.toBuffer() is deprecated for removal in 2.x.y, use toBase58 instead')\n }\n\n // Version\n var version = isPrivate ? this.network.bip32.private : this.network.bip32.public\n var buffer = new Buffer(HDNode.LENGTH)\n\n // 4 bytes: version bytes\n buffer.writeUInt32BE(version, 0)\n\n // Depth\n // 1 byte: depth: 0x00 for master nodes, 0x01 for level-1 descendants, ....\n buffer.writeUInt8(this.depth, 4)\n\n // 4 bytes: the fingerprint of the parent's key (0x00000000 if master key)\n buffer.writeUInt32BE(this.parentFingerprint, 5)\n\n // 4 bytes: child number. This is the number i in xi = xpar/i, with xi the key being serialized.\n // This is encoded in Big endian. (0x00000000 if master key)\n buffer.writeUInt32BE(this.index, 9)\n\n // 32 bytes: the chain code\n this.chainCode.copy(buffer, 13)\n\n // 33 bytes: the public key or private key data\n if (isPrivate) {\n // FIXME: remove in 2.x.y\n assert(this.privKey, 'Missing private key')\n\n // 0x00 + k for private keys\n buffer.writeUInt8(0, 45)\n this.privKey.d.toBuffer(32).copy(buffer, 46)\n } else {\n // X9.62 encoding for public keys\n this.pubKey.toBuffer().copy(buffer, 45)\n }\n\n return buffer\n}\n\n// FIXME: remove in 2.x.y\nHDNode.prototype.toHex = function (isPrivate) {\n return this.toBuffer(isPrivate).toString('hex')\n}\n\n// https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#child-key-derivation-ckd-functions\nHDNode.prototype.derive = function (index) {\n var isHardened = index >= HDNode.HIGHEST_BIT\n var indexBuffer = new Buffer(4)\n indexBuffer.writeUInt32BE(index, 0)\n\n var data\n\n // Hardened child\n if (isHardened) {\n assert(this.privKey, 'Could not derive hardened child key')\n\n // data = 0x00 || ser256(kpar) || ser32(index)\n data = Buffer.concat([\n this.privKey.d.toBuffer(33),\n indexBuffer\n ])\n\n // Normal child\n } else {\n // data = serP(point(kpar)) || ser32(index)\n // = serP(Kpar) || ser32(index)\n data = Buffer.concat([\n this.pubKey.toBuffer(),\n indexBuffer\n ])\n }\n\n var I = crypto.createHmac('sha512', this.chainCode).update(data).digest()\n var IL = I.slice(0, 32)\n var IR = I.slice(32)\n\n var pIL = BigInteger.fromBuffer(IL)\n\n // In case parse256(IL) >= n, proceed with the next value for i\n if (pIL.compareTo(curve.n) >= 0) {\n return this.derive(index + 1)\n }\n\n // Private parent key -> private child key\n var hd\n if (this.privKey) {\n // ki = parse256(IL) + kpar (mod n)\n var ki = pIL.add(this.privKey.d).mod(curve.n)\n\n // In case ki == 0, proceed with the next value for i\n if (ki.signum() === 0) {\n return this.derive(index + 1)\n }\n\n hd = new HDNode(ki, IR, this.network)\n\n // Public parent key -> public child key\n } else {\n // Ki = point(parse256(IL)) + Kpar\n // = G*IL + Kpar\n var Ki = curve.G.multiply(pIL).add(this.pubKey.Q)\n\n // In case Ki is the point at infinity, proceed with the next value for i\n if (curve.isInfinity(Ki)) {\n return this.derive(index + 1)\n }\n\n hd = new HDNode(Ki, IR, this.network)\n }\n\n hd.depth = this.depth + 1\n hd.index = index\n hd.parentFingerprint = this.getFingerprint().readUInt32BE(0)\n\n return hd\n}\n\nHDNode.prototype.deriveHardened = function (index) {\n // Only derives hardened private keys by default\n return this.derive(index + HDNode.HIGHEST_BIT)\n}\n\nHDNode.prototype.toString = HDNode.prototype.toBase58\n\nmodule.exports = HDNode\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./crypto\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/crypto.js\",\"./eckey\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/eckey.js\",\"./ecpubkey\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecpubkey.js\",\"./networks\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/networks.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"bigi\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/index.js\",\"bs58check\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bs58check/src/bs58check.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"crypto\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/index.js\",\"ecurve\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/index.js\",\"typeforce\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/typeforce/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/index.js\":[function(require,module,exports){\nmodule.exports = {\n Address: require('./address'),\n base58check: require('./base58check'),\n Block: require('./block'),\n bufferutils: require('./bufferutils'),\n crypto: require('./crypto'),\n ecdsa: require('./ecdsa'),\n ECKey: require('./eckey'),\n ECPubKey: require('./ecpubkey'),\n ECSignature: require('./ecsignature'),\n Message: require('./message'),\n opcodes: require('./opcodes'),\n HDNode: require('./hdnode'),\n Script: require('./script'),\n scripts: require('./scripts'),\n Transaction: require('./transaction'),\n TransactionBuilder: require('./transaction_builder'),\n networks: require('./networks'),\n Wallet: require('./wallet')\n}\n\n},{\"./address\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/address.js\",\"./base58check\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/base58check.js\",\"./block\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/block.js\",\"./bufferutils\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/bufferutils.js\",\"./crypto\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/crypto.js\",\"./ecdsa\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecdsa.js\",\"./eckey\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/eckey.js\",\"./ecpubkey\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecpubkey.js\",\"./ecsignature\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecsignature.js\",\"./hdnode\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/hdnode.js\",\"./message\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/message.js\",\"./networks\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/networks.js\",\"./opcodes\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/opcodes.js\",\"./script\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/script.js\",\"./scripts\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/scripts.js\",\"./transaction\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/transaction.js\",\"./transaction_builder\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/transaction_builder.js\",\"./wallet\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/wallet.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/message.js\":[function(require,module,exports){\n(function (Buffer){\nvar bufferutils = require('./bufferutils')\nvar crypto = require('./crypto')\nvar ecdsa = require('./ecdsa')\nvar networks = require('./networks')\n\nvar BigInteger = require('bigi')\nvar ECPubKey = require('./ecpubkey')\nvar ECSignature = require('./ecsignature')\n\nvar ecurve = require('ecurve')\nvar ecparams = ecurve.getCurveByName('secp256k1')\n\nfunction magicHash (message, network) {\n var magicPrefix = new Buffer(network.magicPrefix)\n var messageBuffer = new Buffer(message)\n var lengthBuffer = bufferutils.varIntBuffer(messageBuffer.length)\n\n var buffer = Buffer.concat([magicPrefix, lengthBuffer, messageBuffer])\n return crypto.hash256(buffer)\n}\n\nfunction sign (privKey, message, network) {\n network = network || networks.bitcoin\n\n var hash = magicHash(message, network)\n var signature = privKey.sign(hash)\n var e = BigInteger.fromBuffer(hash)\n var i = ecdsa.calcPubKeyRecoveryParam(ecparams, e, signature, privKey.pub.Q)\n\n return signature.toCompact(i, privKey.pub.compressed)\n}\n\n// TODO: network could be implied from address\nfunction verify (address, signature, message, network) {\n if (!Buffer.isBuffer(signature)) {\n signature = new Buffer(signature, 'base64')\n }\n\n network = network || networks.bitcoin\n\n var hash = magicHash(message, network)\n var parsed = ECSignature.parseCompact(signature)\n var e = BigInteger.fromBuffer(hash)\n var Q = ecdsa.recoverPubKey(ecparams, e, parsed.signature, parsed.i)\n\n var pubKey = new ECPubKey(Q, parsed.compressed)\n return pubKey.getAddress(network).toString() === address.toString()\n}\n\nmodule.exports = {\n magicHash: magicHash,\n sign: sign,\n verify: verify\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./bufferutils\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/bufferutils.js\",\"./crypto\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/crypto.js\",\"./ecdsa\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecdsa.js\",\"./ecpubkey\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecpubkey.js\",\"./ecsignature\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecsignature.js\",\"./networks\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/networks.js\",\"bigi\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/index.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"ecurve\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/networks.js\":[function(require,module,exports){\n// https://en.bitcoin.it/wiki/List_of_address_prefixes\n// Dogecoin BIP32 is a proposed standard: https://bitcointalk.org/index.php?topic=409731\n\nvar networks = {\n bitcoin: {\n magicPrefix: '\\x18Bitcoin Signed Message:\\n',\n bip32: {\n public: 0x0488b21e,\n private: 0x0488ade4\n },\n pubKeyHash: 0x00,\n scriptHash: 0x05,\n wif: 0x80,\n dustThreshold: 546, // https://github.com/bitcoin/bitcoin/blob/v0.9.2/src/core.h#L151-L162\n feePerKb: 10000, // https://github.com/bitcoin/bitcoin/blob/v0.9.2/src/main.cpp#L53\n estimateFee: estimateFee('bitcoin')\n },\n testnet: {\n magicPrefix: '\\x18Bitcoin Signed Message:\\n',\n bip32: {\n public: 0x043587cf,\n private: 0x04358394\n },\n pubKeyHash: 0x6f,\n scriptHash: 0xc4,\n wif: 0xef,\n dustThreshold: 546,\n feePerKb: 10000,\n estimateFee: estimateFee('testnet')\n },\n litecoin: {\n magicPrefix: '\\x19Litecoin Signed Message:\\n',\n bip32: {\n public: 0x019da462,\n private: 0x019d9cfe\n },\n pubKeyHash: 0x30,\n scriptHash: 0x05,\n wif: 0xb0,\n dustThreshold: 0, // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.cpp#L360-L365\n dustSoftThreshold: 100000, // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.h#L53\n feePerKb: 100000, // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.cpp#L56\n estimateFee: estimateFee('litecoin')\n },\n dogecoin: {\n magicPrefix: '\\x19Dogecoin Signed Message:\\n',\n bip32: {\n public: 0x02facafd,\n private: 0x02fac398\n },\n pubKeyHash: 0x1e,\n scriptHash: 0x16,\n wif: 0x9e,\n dustThreshold: 0, // https://github.com/dogecoin/dogecoin/blob/v1.7.1/src/core.h#L155-L160\n dustSoftThreshold: 100000000, // https://github.com/dogecoin/dogecoin/blob/v1.7.1/src/main.h#L62\n feePerKb: 100000000, // https://github.com/dogecoin/dogecoin/blob/v1.7.1/src/main.cpp#L58\n estimateFee: estimateFee('dogecoin')\n },\n viacoin: {\n magicPrefix: '\\x18Viacoin Signed Message:\\n',\n bip32: {\n public: 0x0488b21e,\n private: 0x0488ade4\n },\n pubKeyHash: 0x47,\n scriptHash: 0x21,\n wif: 0xc7,\n dustThreshold: 560,\n dustSoftThreshold: 100000,\n feePerKb: 100000, //\n estimateFee: estimateFee('viacoin')\n },\n viacointestnet: {\n magicPrefix: '\\x18Viacoin Signed Message:\\n',\n bip32: {\n public: 0x043587cf,\n private: 0x04358394\n },\n pubKeyHash: 0x7f,\n scriptHash: 0xc4,\n wif: 0xff,\n dustThreshold: 560,\n dustSoftThreshold: 100000,\n feePerKb: 100000,\n estimateFee: estimateFee('viacointestnet')\n },\n gamerscoin: {\n magicPrefix: '\\x19Gamerscoin Signed Message:\\n',\n bip32: {\n public: 0x019da462,\n private: 0x019d9cfe\n },\n pubKeyHash: 0x26,\n scriptHash: 0x05,\n wif: 0xA6,\n dustThreshold: 0, // https://github.com/gamers-coin/gamers-coinv3/blob/master/src/main.cpp#L358-L363\n dustSoftThreshold: 100000, // https://github.com/gamers-coin/gamers-coinv3/blob/master/src/main.cpp#L51\n feePerKb: 100000, // https://github.com/gamers-coin/gamers-coinv3/blob/master/src/main.cpp#L54\n estimateFee: estimateFee('gamerscoin')\n },\n jumbucks: {\n magicPrefix: '\\x19Jumbucks Signed Message:\\n',\n bip32: {\n public: 0x037a689a,\n private: 0x037a6460\n },\n pubKeyHash: 0x2b,\n scriptHash: 0x05,\n wif: 0xab,\n dustThreshold: 0,\n dustSoftThreshold: 10000,\n feePerKb: 10000,\n estimateFee: estimateFee('jumbucks')\n },\n zetacoin: {\n magicPrefix: '\\x18Zetacoin Signed Message:\\n',\n bip32: {\n public: 0x0488b21e,\n private: 0x0488ade4\n },\n pubKeyHash: 0x50,\n scriptHash: 0x09,\n wif: 0xe0,\n dustThreshold: 546, // https://github.com/zetacoin/zetacoin/blob/master/src/core.h#L159\n feePerKb: 10000, // https://github.com/zetacoin/zetacoin/blob/master/src/main.cpp#L54\n estimateFee: estimateFee('zetacoin')\n }\n}\n\nfunction estimateFee (type) {\n return function (tx) {\n var network = networks[type]\n var baseFee = network.feePerKb\n var byteSize = tx.toBuffer().length\n\n var fee = baseFee * Math.ceil(byteSize / 1000)\n if (network.dustSoftThreshold === undefined) return fee\n\n tx.outs.forEach(function (e) {\n if (e.value < network.dustSoftThreshold) {\n fee += baseFee\n }\n })\n\n return fee\n }\n}\n\nmodule.exports = networks\n\n},{}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/opcodes.js\":[function(require,module,exports){\nmodule.exports = {\n // push value\n OP_FALSE: 0,\n OP_0: 0,\n OP_PUSHDATA1: 76,\n OP_PUSHDATA2: 77,\n OP_PUSHDATA4: 78,\n OP_1NEGATE: 79,\n OP_RESERVED: 80,\n OP_1: 81,\n OP_TRUE: 81,\n OP_2: 82,\n OP_3: 83,\n OP_4: 84,\n OP_5: 85,\n OP_6: 86,\n OP_7: 87,\n OP_8: 88,\n OP_9: 89,\n OP_10: 90,\n OP_11: 91,\n OP_12: 92,\n OP_13: 93,\n OP_14: 94,\n OP_15: 95,\n OP_16: 96,\n\n // control\n OP_NOP: 97,\n OP_VER: 98,\n OP_IF: 99,\n OP_NOTIF: 100,\n OP_VERIF: 101,\n OP_VERNOTIF: 102,\n OP_ELSE: 103,\n OP_ENDIF: 104,\n OP_VERIFY: 105,\n OP_RETURN: 106,\n\n // stack ops\n OP_TOALTSTACK: 107,\n OP_FROMALTSTACK: 108,\n OP_2DROP: 109,\n OP_2DUP: 110,\n OP_3DUP: 111,\n OP_2OVER: 112,\n OP_2ROT: 113,\n OP_2SWAP: 114,\n OP_IFDUP: 115,\n OP_DEPTH: 116,\n OP_DROP: 117,\n OP_DUP: 118,\n OP_NIP: 119,\n OP_OVER: 120,\n OP_PICK: 121,\n OP_ROLL: 122,\n OP_ROT: 123,\n OP_SWAP: 124,\n OP_TUCK: 125,\n\n // splice ops\n OP_CAT: 126,\n OP_SUBSTR: 127,\n OP_LEFT: 128,\n OP_RIGHT: 129,\n OP_SIZE: 130,\n\n // bit logic\n OP_INVERT: 131,\n OP_AND: 132,\n OP_OR: 133,\n OP_XOR: 134,\n OP_EQUAL: 135,\n OP_EQUALVERIFY: 136,\n OP_RESERVED1: 137,\n OP_RESERVED2: 138,\n\n // numeric\n OP_1ADD: 139,\n OP_1SUB: 140,\n OP_2MUL: 141,\n OP_2DIV: 142,\n OP_NEGATE: 143,\n OP_ABS: 144,\n OP_NOT: 145,\n OP_0NOTEQUAL: 146,\n\n OP_ADD: 147,\n OP_SUB: 148,\n OP_MUL: 149,\n OP_DIV: 150,\n OP_MOD: 151,\n OP_LSHIFT: 152,\n OP_RSHIFT: 153,\n\n OP_BOOLAND: 154,\n OP_BOOLOR: 155,\n OP_NUMEQUAL: 156,\n OP_NUMEQUALVERIFY: 157,\n OP_NUMNOTEQUAL: 158,\n OP_LESSTHAN: 159,\n OP_GREATERTHAN: 160,\n OP_LESSTHANOREQUAL: 161,\n OP_GREATERTHANOREQUAL: 162,\n OP_MIN: 163,\n OP_MAX: 164,\n\n OP_WITHIN: 165,\n\n // crypto\n OP_RIPEMD160: 166,\n OP_SHA1: 167,\n OP_SHA256: 168,\n OP_HASH160: 169,\n OP_HASH256: 170,\n OP_CODESEPARATOR: 171,\n OP_CHECKSIG: 172,\n OP_CHECKSIGVERIFY: 173,\n OP_CHECKMULTISIG: 174,\n OP_CHECKMULTISIGVERIFY: 175,\n\n // expansion\n OP_NOP1: 176,\n OP_NOP2: 177,\n OP_NOP3: 178,\n OP_NOP4: 179,\n OP_NOP5: 180,\n OP_NOP6: 181,\n OP_NOP7: 182,\n OP_NOP8: 183,\n OP_NOP9: 184,\n OP_NOP10: 185,\n\n // template matching params\n OP_PUBKEYHASH: 253,\n OP_PUBKEY: 254,\n OP_INVALIDOPCODE: 255\n}\n\n},{}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/script.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar bufferutils = require('./bufferutils')\nvar crypto = require('./crypto')\nvar typeForce = require('typeforce')\nvar opcodes = require('./opcodes')\n\nfunction Script (buffer, chunks) {\n typeForce('Buffer', buffer)\n typeForce('Array', chunks)\n\n this.buffer = buffer\n this.chunks = chunks\n}\n\nScript.fromASM = function (asm) {\n var strChunks = asm.split(' ')\n var chunks = strChunks.map(function (strChunk) {\n // opcode\n if (strChunk in opcodes) {\n return opcodes[strChunk]\n\n // data chunk\n } else {\n return new Buffer(strChunk, 'hex')\n }\n })\n\n return Script.fromChunks(chunks)\n}\n\nScript.fromBuffer = function (buffer) {\n var chunks = []\n var i = 0\n\n while (i < buffer.length) {\n var opcode = buffer.readUInt8(i)\n\n // data chunk\n if ((opcode > opcodes.OP_0) && (opcode <= opcodes.OP_PUSHDATA4)) {\n var d = bufferutils.readPushDataInt(buffer, i)\n\n // did reading a pushDataInt fail? return non-chunked script\n if (d === null) return new Script(buffer, [])\n i += d.size\n\n // attempt to read too much data?\n if (i + d.number > buffer.length) return new Script(buffer, [])\n\n var data = buffer.slice(i, i + d.number)\n i += d.number\n\n chunks.push(data)\n\n // opcode\n } else {\n chunks.push(opcode)\n\n i += 1\n }\n }\n\n return new Script(buffer, chunks)\n}\n\nScript.fromChunks = function (chunks) {\n typeForce('Array', chunks)\n\n var bufferSize = chunks.reduce(function (accum, chunk) {\n // data chunk\n if (Buffer.isBuffer(chunk)) {\n return accum + bufferutils.pushDataSize(chunk.length) + chunk.length\n }\n\n // opcode\n return accum + 1\n }, 0.0)\n\n var buffer = new Buffer(bufferSize)\n var offset = 0\n\n chunks.forEach(function (chunk) {\n // data chunk\n if (Buffer.isBuffer(chunk)) {\n offset += bufferutils.writePushDataInt(buffer, chunk.length, offset)\n\n chunk.copy(buffer, offset)\n offset += chunk.length\n\n // opcode\n } else {\n buffer.writeUInt8(chunk, offset)\n offset += 1\n }\n })\n\n assert.equal(offset, buffer.length, 'Could not decode chunks')\n return new Script(buffer, chunks)\n}\n\nScript.fromHex = function (hex) {\n return Script.fromBuffer(new Buffer(hex, 'hex'))\n}\n\nScript.EMPTY = Script.fromChunks([])\n\nScript.prototype.getHash = function () {\n return crypto.hash160(this.buffer)\n}\n\n// FIXME: doesn't work for data chunks, maybe time to use buffertools.compare...\nScript.prototype.without = function (needle) {\n return Script.fromChunks(this.chunks.filter(function (op) {\n return op !== needle\n }))\n}\n\nvar reverseOps = []\nfor (var op in opcodes) {\n var code = opcodes[op]\n reverseOps[code] = op\n}\n\nScript.prototype.toASM = function () {\n return this.chunks.map(function (chunk) {\n // data chunk\n if (Buffer.isBuffer(chunk)) {\n return chunk.toString('hex')\n\n // opcode\n } else {\n return reverseOps[chunk]\n }\n }).join(' ')\n}\n\nScript.prototype.toBuffer = function () {\n return this.buffer\n}\n\nScript.prototype.toHex = function () {\n return this.toBuffer().toString('hex')\n}\n\nmodule.exports = Script\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./bufferutils\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/bufferutils.js\",\"./crypto\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/crypto.js\",\"./opcodes\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/opcodes.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"typeforce\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/typeforce/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/scripts.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar ops = require('./opcodes')\nvar typeForce = require('typeforce')\n\nvar ecurve = require('ecurve')\nvar curve = ecurve.getCurveByName('secp256k1')\n\nvar ECSignature = require('./ecsignature')\nvar Script = require('./script')\n\nfunction isCanonicalPubKey (buffer) {\n if (!Buffer.isBuffer(buffer)) return false\n\n try {\n ecurve.Point.decodeFrom(curve, buffer)\n } catch (e) {\n if (!(e.message.match(/Invalid sequence (length|tag)/)))\n throw e\n\n return false\n }\n\n return true\n}\n\nfunction isCanonicalSignature (buffer) {\n if (!Buffer.isBuffer(buffer)) return false\n\n try {\n ECSignature.parseScriptSignature(buffer)\n } catch (e) {\n if (!(e.message.match(/Not a DER sequence|Invalid sequence length|Expected a DER integer|R length is zero|S length is zero|R value excessively padded|S value excessively padded|R value is negative|S value is negative|Invalid hashType/))) {\n throw e\n }\n\n return false\n }\n\n return true\n}\n\nfunction isPubKeyHashInput (script) {\n return script.chunks.length === 2 &&\n isCanonicalSignature(script.chunks[0]) &&\n isCanonicalPubKey(script.chunks[1])\n}\n\nfunction isPubKeyHashOutput (script) {\n return script.chunks.length === 5 &&\n script.chunks[0] === ops.OP_DUP &&\n script.chunks[1] === ops.OP_HASH160 &&\n Buffer.isBuffer(script.chunks[2]) &&\n script.chunks[2].length === 20 &&\n script.chunks[3] === ops.OP_EQUALVERIFY &&\n script.chunks[4] === ops.OP_CHECKSIG\n}\n\nfunction isPubKeyInput (script) {\n return script.chunks.length === 1 &&\n isCanonicalSignature(script.chunks[0])\n}\n\nfunction isPubKeyOutput (script) {\n return script.chunks.length === 2 &&\n isCanonicalPubKey(script.chunks[0]) &&\n script.chunks[1] === ops.OP_CHECKSIG\n}\n\nfunction isScriptHashInput (script, allowIncomplete) {\n if (script.chunks.length < 2) return false\n\n var lastChunk = script.chunks[script.chunks.length - 1]\n if (!Buffer.isBuffer(lastChunk)) return false\n\n var scriptSig = Script.fromChunks(script.chunks.slice(0, -1))\n var redeemScript = Script.fromBuffer(lastChunk)\n\n // is redeemScript a valid script?\n if (redeemScript.chunks.length === 0) return false\n\n return classifyInput(scriptSig, allowIncomplete) === classifyOutput(redeemScript)\n}\n\nfunction isScriptHashOutput (script) {\n return script.chunks.length === 3 &&\n script.chunks[0] === ops.OP_HASH160 &&\n Buffer.isBuffer(script.chunks[1]) &&\n script.chunks[1].length === 20 &&\n script.chunks[2] === ops.OP_EQUAL\n}\n\n// allowIncomplete is to account for combining signatures\n// See https://github.com/bitcoin/bitcoin/blob/f425050546644a36b0b8e0eb2f6934a3e0f6f80f/src/script/sign.cpp#L195-L197\nfunction isMultisigInput (script, allowIncomplete) {\n if (script.chunks.length < 2) return false\n if (script.chunks[0] !== ops.OP_0) return false\n\n if (allowIncomplete) {\n return script.chunks.slice(1).every(function (chunk) {\n return chunk === ops.OP_0 || isCanonicalSignature(chunk)\n })\n }\n\n return script.chunks.slice(1).every(isCanonicalSignature)\n}\n\nfunction isMultisigOutput (script) {\n if (script.chunks.length < 4) return false\n if (script.chunks[script.chunks.length - 1] !== ops.OP_CHECKMULTISIG) return false\n\n var mOp = script.chunks[0]\n if (mOp === ops.OP_0) return false\n if (mOp < ops.OP_1) return false\n if (mOp > ops.OP_16) return false\n\n var nOp = script.chunks[script.chunks.length - 2]\n if (nOp === ops.OP_0) return false\n if (nOp < ops.OP_1) return false\n if (nOp > ops.OP_16) return false\n\n var m = mOp - (ops.OP_1 - 1)\n var n = nOp - (ops.OP_1 - 1)\n if (n < m) return false\n\n var pubKeys = script.chunks.slice(1, -2)\n if (n < pubKeys.length) return false\n\n return pubKeys.every(isCanonicalPubKey)\n}\n\nfunction isNullDataOutput (script) {\n return script.chunks[0] === ops.OP_RETURN\n}\n\nfunction classifyOutput (script) {\n typeForce('Script', script)\n\n if (isPubKeyHashOutput(script)) {\n return 'pubkeyhash'\n } else if (isScriptHashOutput(script)) {\n return 'scripthash'\n } else if (isMultisigOutput(script)) {\n return 'multisig'\n } else if (isPubKeyOutput(script)) {\n return 'pubkey'\n } else if (isNullDataOutput(script)) {\n return 'nulldata'\n }\n\n return 'nonstandard'\n}\n\nfunction classifyInput (script, allowIncomplete) {\n typeForce('Script', script)\n\n if (isPubKeyHashInput(script)) {\n return 'pubkeyhash'\n } else if (isMultisigInput(script, allowIncomplete)) {\n return 'multisig'\n } else if (isScriptHashInput(script, allowIncomplete)) {\n return 'scripthash'\n } else if (isPubKeyInput(script)) {\n return 'pubkey'\n }\n\n return 'nonstandard'\n}\n\n// Standard Script Templates\n// {pubKey} OP_CHECKSIG\nfunction pubKeyOutput (pubKey) {\n return Script.fromChunks([\n pubKey.toBuffer(),\n ops.OP_CHECKSIG\n ])\n}\n\n// OP_DUP OP_HASH160 {pubKeyHash} OP_EQUALVERIFY OP_CHECKSIG\nfunction pubKeyHashOutput (hash) {\n typeForce('Buffer', hash)\n\n return Script.fromChunks([\n ops.OP_DUP,\n ops.OP_HASH160,\n hash,\n ops.OP_EQUALVERIFY,\n ops.OP_CHECKSIG\n ])\n}\n\n// OP_HASH160 {scriptHash} OP_EQUAL\nfunction scriptHashOutput (hash) {\n typeForce('Buffer', hash)\n\n return Script.fromChunks([\n ops.OP_HASH160,\n hash,\n ops.OP_EQUAL\n ])\n}\n\n// m [pubKeys ...] n OP_CHECKMULTISIG\nfunction multisigOutput (m, pubKeys) {\n typeForce(['ECPubKey'], pubKeys)\n\n assert(pubKeys.length >= m, 'Not enough pubKeys provided')\n\n var pubKeyBuffers = pubKeys.map(function (pubKey) {\n return pubKey.toBuffer()\n })\n var n = pubKeys.length\n\n return Script.fromChunks([].concat(\n (ops.OP_1 - 1) + m,\n pubKeyBuffers,\n (ops.OP_1 - 1) + n,\n ops.OP_CHECKMULTISIG\n ))\n}\n\n// {signature}\nfunction pubKeyInput (signature) {\n typeForce('Buffer', signature)\n\n return Script.fromChunks([signature])\n}\n\n// {signature} {pubKey}\nfunction pubKeyHashInput (signature, pubKey) {\n typeForce('Buffer', signature)\n\n return Script.fromChunks([signature, pubKey.toBuffer()])\n}\n\n// {serialized scriptPubKey script}\nfunction scriptHashInput (scriptSig, scriptPubKey) {\n return Script.fromChunks([].concat(\n scriptSig.chunks,\n scriptPubKey.toBuffer()\n ))\n}\n\n// OP_0 [signatures ...]\nfunction multisigInput (signatures, scriptPubKey) {\n if (scriptPubKey) {\n assert(isMultisigOutput(scriptPubKey))\n\n var mOp = scriptPubKey.chunks[0]\n var nOp = scriptPubKey.chunks[scriptPubKey.chunks.length - 2]\n var m = mOp - (ops.OP_1 - 1)\n var n = nOp - (ops.OP_1 - 1)\n\n assert(signatures.length >= m, 'Not enough signatures provided')\n assert(signatures.length <= n, 'Too many signatures provided')\n }\n\n return Script.fromChunks([].concat(ops.OP_0, signatures))\n}\n\nfunction nullDataOutput (data) {\n return Script.fromChunks([ops.OP_RETURN, data])\n}\n\nmodule.exports = {\n isCanonicalPubKey: isCanonicalPubKey,\n isCanonicalSignature: isCanonicalSignature,\n isPubKeyHashInput: isPubKeyHashInput,\n isPubKeyHashOutput: isPubKeyHashOutput,\n isPubKeyInput: isPubKeyInput,\n isPubKeyOutput: isPubKeyOutput,\n isScriptHashInput: isScriptHashInput,\n isScriptHashOutput: isScriptHashOutput,\n isMultisigInput: isMultisigInput,\n isMultisigOutput: isMultisigOutput,\n isNullDataOutput: isNullDataOutput,\n classifyOutput: classifyOutput,\n classifyInput: classifyInput,\n pubKeyOutput: pubKeyOutput,\n pubKeyHashOutput: pubKeyHashOutput,\n scriptHashOutput: scriptHashOutput,\n multisigOutput: multisigOutput,\n pubKeyInput: pubKeyInput,\n pubKeyHashInput: pubKeyHashInput,\n scriptHashInput: scriptHashInput,\n multisigInput: multisigInput,\n dataOutput: function (data) {\n console.warn('dataOutput is deprecated, use nullDataOutput by 2.0.0')\n return nullDataOutput(data)\n },\n nullDataOutput: nullDataOutput\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./ecsignature\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecsignature.js\",\"./opcodes\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/opcodes.js\",\"./script\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/script.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"ecurve\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/index.js\",\"typeforce\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/typeforce/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/transaction.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar bufferutils = require('./bufferutils')\nvar crypto = require('./crypto')\nvar typeForce = require('typeforce')\nvar opcodes = require('./opcodes')\nvar scripts = require('./scripts')\n\nvar Address = require('./address')\nvar ECSignature = require('./ecsignature')\nvar Script = require('./script')\n\nfunction Transaction () {\n this.version = 1\n this.locktime = 0\n this.ins = []\n this.outs = []\n}\n\nTransaction.DEFAULT_SEQUENCE = 0xffffffff\nTransaction.SIGHASH_ALL = 0x01\nTransaction.SIGHASH_NONE = 0x02\nTransaction.SIGHASH_SINGLE = 0x03\nTransaction.SIGHASH_ANYONECANPAY = 0x80\n\nTransaction.fromBuffer = function (buffer, __disableAssert) {\n var offset = 0\n function readSlice (n) {\n offset += n\n return buffer.slice(offset - n, offset)\n }\n\n function readUInt32 () {\n var i = buffer.readUInt32LE(offset)\n offset += 4\n return i\n }\n\n function readUInt64 () {\n var i = bufferutils.readUInt64LE(buffer, offset)\n offset += 8\n return i\n }\n\n function readVarInt () {\n var vi = bufferutils.readVarInt(buffer, offset)\n offset += vi.size\n return vi.number\n }\n\n function readScript () {\n return Script.fromBuffer(readSlice(readVarInt()))\n }\n\n function readGenerationScript () {\n return new Script(readSlice(readVarInt()), [])\n }\n\n var tx = new Transaction()\n tx.version = readUInt32()\n\n var vinLen = readVarInt()\n for (var i = 0; i < vinLen; ++i) {\n var hash = readSlice(32)\n\n if (Transaction.isCoinbaseHash(hash)) {\n tx.ins.push({\n hash: hash,\n index: readUInt32(),\n script: readGenerationScript(),\n sequence: readUInt32()\n })\n } else {\n tx.ins.push({\n hash: hash,\n index: readUInt32(),\n script: readScript(),\n sequence: readUInt32()\n })\n }\n }\n\n var voutLen = readVarInt()\n for (i = 0; i < voutLen; ++i) {\n tx.outs.push({\n value: readUInt64(),\n script: readScript()\n })\n }\n\n tx.locktime = readUInt32()\n\n if (!__disableAssert) {\n assert.equal(offset, buffer.length, 'Transaction has unexpected data')\n }\n\n return tx\n}\n\nTransaction.fromHex = function (hex) {\n return Transaction.fromBuffer(new Buffer(hex, 'hex'))\n}\n\nTransaction.isCoinbaseHash = function (buffer) {\n return Array.prototype.every.call(buffer, function (x) {\n return x === 0\n })\n}\n\n/**\n * Create a new txIn.\n *\n * Can be called with any of:\n *\n * - A transaction and an index\n * - A transaction hash and an index\n *\n * Note that this method does not sign the created input.\n */\nTransaction.prototype.addInput = function (hash, index, sequence, script) {\n if (sequence === undefined || sequence === null) {\n sequence = Transaction.DEFAULT_SEQUENCE\n }\n\n script = script || Script.EMPTY\n\n if (typeof hash === 'string') {\n // TxId hex is big-endian, we need little-endian\n hash = bufferutils.reverse(new Buffer(hash, 'hex'))\n } else if (hash instanceof Transaction) {\n hash = hash.getHash()\n }\n\n typeForce('Buffer', hash)\n typeForce('Number', index)\n typeForce('Number', sequence)\n typeForce('Script', script)\n\n assert.equal(hash.length, 32, 'Expected hash length of 32, got ' + hash.length)\n\n // Add the input and return the input's index\n return (this.ins.push({\n hash: hash,\n index: index,\n script: script,\n sequence: sequence\n }) - 1)\n}\n\n/**\n * Create a new txOut.\n *\n * Can be called with:\n *\n * - A base58 address string and a value\n * - An Address object and a value\n * - A scriptPubKey Script and a value\n */\nTransaction.prototype.addOutput = function (scriptPubKey, value) {\n // Attempt to get a valid address if it's a base58 address string\n if (typeof scriptPubKey === 'string') {\n scriptPubKey = Address.fromBase58Check(scriptPubKey)\n }\n\n // Attempt to get a valid script if it's an Address object\n if (scriptPubKey instanceof Address) {\n scriptPubKey = scriptPubKey.toOutputScript()\n }\n\n typeForce('Script', scriptPubKey)\n typeForce('Number', value)\n\n // Add the output and return the output's index\n return (this.outs.push({\n script: scriptPubKey,\n value: value\n }) - 1)\n}\n\nTransaction.prototype.clone = function () {\n var newTx = new Transaction()\n newTx.version = this.version\n newTx.locktime = this.locktime\n\n newTx.ins = this.ins.map(function (txIn) {\n return {\n hash: txIn.hash,\n index: txIn.index,\n script: txIn.script,\n sequence: txIn.sequence\n }\n })\n\n newTx.outs = this.outs.map(function (txOut) {\n return {\n script: txOut.script,\n value: txOut.value\n }\n })\n\n return newTx\n}\n\n/**\n * Hash transaction for signing a specific input.\n *\n * Bitcoin uses a different hash for each signed transaction input. This\n * method copies the transaction, makes the necessary changes based on the\n * hashType, serializes and finally hashes the result. This hash can then be\n * used to sign the transaction input in question.\n */\nTransaction.prototype.hashForSignature = function (inIndex, prevOutScript, hashType) {\n // FIXME: remove in 2.x.y\n if (arguments[0] instanceof Script) {\n console.warn('hashForSignature(prevOutScript, inIndex, ...) has been deprecated. Use hashForSignature(inIndex, prevOutScript, ...)')\n\n // swap the arguments (must be stored in tmp, arguments is special)\n var tmp = arguments[0]\n inIndex = arguments[1]\n prevOutScript = tmp\n }\n\n typeForce('Number', inIndex)\n typeForce('Script', prevOutScript)\n typeForce('Number', hashType)\n\n assert(inIndex >= 0, 'Invalid vin index')\n assert(inIndex < this.ins.length, 'Invalid vin index')\n\n var txTmp = this.clone()\n var hashScript = prevOutScript.without(opcodes.OP_CODESEPARATOR)\n\n // Blank out other inputs' signatures\n txTmp.ins.forEach(function (txIn) {\n txIn.script = Script.EMPTY\n })\n txTmp.ins[inIndex].script = hashScript\n\n var hashTypeModifier = hashType & 0x1f\n\n if (hashTypeModifier === Transaction.SIGHASH_NONE) {\n assert(false, 'SIGHASH_NONE not yet supported')\n } else if (hashTypeModifier === Transaction.SIGHASH_SINGLE) {\n assert(false, 'SIGHASH_SINGLE not yet supported')\n }\n\n if (hashType & Transaction.SIGHASH_ANYONECANPAY) {\n assert(false, 'SIGHASH_ANYONECANPAY not yet supported')\n }\n\n var hashTypeBuffer = new Buffer(4)\n hashTypeBuffer.writeInt32LE(hashType, 0)\n\n var buffer = Buffer.concat([txTmp.toBuffer(), hashTypeBuffer])\n return crypto.hash256(buffer)\n}\n\nTransaction.prototype.getHash = function () {\n return crypto.hash256(this.toBuffer())\n}\n\nTransaction.prototype.getId = function () {\n // TxHash is little-endian, we need big-endian\n return bufferutils.reverse(this.getHash()).toString('hex')\n}\n\nTransaction.prototype.toBuffer = function () {\n function scriptSize (script) {\n var length = script.buffer.length\n\n return bufferutils.varIntSize(length) + length\n }\n\n var buffer = new Buffer(\n 8 +\n bufferutils.varIntSize(this.ins.length) +\n bufferutils.varIntSize(this.outs.length) +\n this.ins.reduce(function (sum, input) { return sum + 40 + scriptSize(input.script) }, 0) +\n this.outs.reduce(function (sum, output) { return sum + 8 + scriptSize(output.script) }, 0)\n )\n\n var offset = 0\n function writeSlice (slice) {\n slice.copy(buffer, offset)\n offset += slice.length\n }\n\n function writeUInt32 (i) {\n buffer.writeUInt32LE(i, offset)\n offset += 4\n }\n\n function writeUInt64 (i) {\n bufferutils.writeUInt64LE(buffer, i, offset)\n offset += 8\n }\n\n function writeVarInt (i) {\n var n = bufferutils.writeVarInt(buffer, i, offset)\n offset += n\n }\n\n writeUInt32(this.version)\n writeVarInt(this.ins.length)\n\n this.ins.forEach(function (txIn) {\n writeSlice(txIn.hash)\n writeUInt32(txIn.index)\n writeVarInt(txIn.script.buffer.length)\n writeSlice(txIn.script.buffer)\n writeUInt32(txIn.sequence)\n })\n\n writeVarInt(this.outs.length)\n this.outs.forEach(function (txOut) {\n writeUInt64(txOut.value)\n writeVarInt(txOut.script.buffer.length)\n writeSlice(txOut.script.buffer)\n })\n\n writeUInt32(this.locktime)\n\n return buffer\n}\n\nTransaction.prototype.toHex = function () {\n return this.toBuffer().toString('hex')\n}\n\nTransaction.prototype.setInputScript = function (index, script) {\n typeForce('Number', index)\n typeForce('Script', script)\n\n this.ins[index].script = script\n}\n\n// FIXME: remove in 2.x.y\nTransaction.prototype.sign = function (index, privKey, hashType) {\n console.warn('Transaction.prototype.sign is deprecated. Use TransactionBuilder instead.')\n\n var prevOutScript = privKey.pub.getAddress().toOutputScript()\n var signature = this.signInput(index, prevOutScript, privKey, hashType)\n\n var scriptSig = scripts.pubKeyHashInput(signature, privKey.pub)\n this.setInputScript(index, scriptSig)\n}\n\n// FIXME: remove in 2.x.y\nTransaction.prototype.signInput = function (index, prevOutScript, privKey, hashType) {\n console.warn('Transaction.prototype.signInput is deprecated. Use TransactionBuilder instead.')\n\n hashType = hashType || Transaction.SIGHASH_ALL\n\n var hash = this.hashForSignature(index, prevOutScript, hashType)\n var signature = privKey.sign(hash)\n\n return signature.toScriptSignature(hashType)\n}\n\n// FIXME: remove in 2.x.y\nTransaction.prototype.validateInput = function (index, prevOutScript, pubKey, buffer) {\n console.warn('Transaction.prototype.validateInput is deprecated. Use TransactionBuilder instead.')\n\n var parsed = ECSignature.parseScriptSignature(buffer)\n var hash = this.hashForSignature(index, prevOutScript, parsed.hashType)\n\n return pubKey.verify(hash, parsed.signature)\n}\n\nmodule.exports = Transaction\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./address\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/address.js\",\"./bufferutils\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/bufferutils.js\",\"./crypto\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/crypto.js\",\"./ecsignature\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecsignature.js\",\"./opcodes\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/opcodes.js\",\"./script\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/script.js\",\"./scripts\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/scripts.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"typeforce\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/typeforce/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/transaction_builder.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar ops = require('./opcodes')\nvar scripts = require('./scripts')\n\nvar ECPubKey = require('./ecpubkey')\nvar ECSignature = require('./ecsignature')\nvar Script = require('./script')\nvar Transaction = require('./transaction')\n\nfunction extractInput (txIn) {\n var redeemScript\n var scriptSig = txIn.script\n var prevOutScript\n var prevOutType = scripts.classifyInput(scriptSig, true)\n var scriptType\n\n // Re-classify if scriptHash\n if (prevOutType === 'scripthash') {\n redeemScript = Script.fromBuffer(scriptSig.chunks.slice(-1)[0])\n prevOutScript = scripts.scriptHashOutput(redeemScript.getHash())\n\n scriptSig = Script.fromChunks(scriptSig.chunks.slice(0, -1))\n scriptType = scripts.classifyInput(scriptSig, true)\n } else {\n scriptType = prevOutType\n }\n\n // Extract hashType, pubKeys and signatures\n var hashType, parsed, pubKeys, signatures\n\n switch (scriptType) {\n case 'pubkeyhash': {\n parsed = ECSignature.parseScriptSignature(scriptSig.chunks[0])\n hashType = parsed.hashType\n pubKeys = [ECPubKey.fromBuffer(scriptSig.chunks[1])]\n signatures = [parsed.signature]\n prevOutScript = pubKeys[0].getAddress().toOutputScript()\n\n break\n }\n\n case 'pubkey': {\n parsed = ECSignature.parseScriptSignature(scriptSig.chunks[0])\n hashType = parsed.hashType\n signatures = [parsed.signature]\n\n if (redeemScript) {\n pubKeys = [ECPubKey.fromBuffer(redeemScript.chunks[0])]\n }\n\n break\n }\n\n case 'multisig': {\n signatures = scriptSig.chunks.slice(1).map(function (chunk) {\n if (chunk === ops.OP_0) return chunk\n\n var parsed = ECSignature.parseScriptSignature(chunk)\n hashType = parsed.hashType\n\n return parsed.signature\n })\n\n if (redeemScript) {\n pubKeys = redeemScript.chunks.slice(1, -2).map(ECPubKey.fromBuffer)\n }\n\n break\n }\n }\n\n return {\n hashType: hashType,\n prevOutScript: prevOutScript,\n prevOutType: prevOutType,\n pubKeys: pubKeys,\n redeemScript: redeemScript,\n scriptType: scriptType,\n signatures: signatures\n }\n}\n\nfunction TransactionBuilder () {\n this.prevTxMap = {}\n this.prevOutScripts = {}\n this.prevOutTypes = {}\n\n this.inputs = []\n this.tx = new Transaction()\n}\n\nTransactionBuilder.fromTransaction = function (transaction) {\n var txb = new TransactionBuilder()\n\n // Copy other transaction fields\n txb.tx.version = transaction.version\n txb.tx.locktime = transaction.locktime\n\n // Extract/add inputs\n transaction.ins.forEach(function (txIn) {\n txb.addInput(txIn.hash, txIn.index, txIn.sequence)\n })\n\n // Extract/add outputs\n transaction.outs.forEach(function (txOut) {\n txb.addOutput(txOut.script, txOut.value)\n })\n\n // Extract/add signatures\n txb.inputs = transaction.ins.map(function (txIn) {\n // TODO: remove me after testcase added\n assert(!Transaction.isCoinbaseHash(txIn.hash), 'coinbase inputs not supported')\n\n // Ignore empty scripts\n if (txIn.script.buffer.length === 0) return\n\n return extractInput(txIn)\n })\n\n return txb\n}\n\nTransactionBuilder.prototype.addInput = function (prevTx, index, sequence, prevOutScript) {\n var prevOutHash\n\n // txId\n if (typeof prevTx === 'string') {\n prevOutHash = new Buffer(prevTx, 'hex')\n\n // TxId hex is big-endian, we want little-endian hash\n Array.prototype.reverse.call(prevOutHash)\n\n // Transaction\n } else if (prevTx instanceof Transaction) {\n prevOutHash = prevTx.getHash()\n prevOutScript = prevTx.outs[index].script\n\n // txHash\n } else {\n prevOutHash = prevTx\n }\n\n var input = {}\n if (prevOutScript) {\n var prevOutType = scripts.classifyOutput(prevOutScript)\n\n // if we can, extract pubKey information\n switch (prevOutType) {\n case 'multisig': {\n input.pubKeys = prevOutScript.chunks.slice(1, -2).map(ECPubKey.fromBuffer)\n break\n }\n\n case 'pubkey': {\n input.pubKeys = prevOutScript.chunks.slice(0, 1).map(ECPubKey.fromBuffer)\n break\n }\n }\n\n if (prevOutType !== 'scripthash') {\n input.scriptType = prevOutType\n }\n\n input.prevOutScript = prevOutScript\n input.prevOutType = prevOutType\n }\n\n assert(this.inputs.every(function (input2) {\n if (input2.hashType === undefined) return true\n\n return input2.hashType & Transaction.SIGHASH_ANYONECANPAY\n }), 'No, this would invalidate signatures')\n\n var prevOut = prevOutHash.toString('hex') + ':' + index\n assert(!(prevOut in this.prevTxMap), 'Transaction is already an input')\n\n var vin = this.tx.addInput(prevOutHash, index, sequence)\n this.inputs[vin] = input\n this.prevTxMap[prevOut] = vin\n\n return vin\n}\n\nTransactionBuilder.prototype.addOutput = function (scriptPubKey, value) {\n assert(this.inputs.every(function (input) {\n if (input.hashType === undefined) return true\n\n return (input.hashType & 0x1f) === Transaction.SIGHASH_SINGLE\n }), 'No, this would invalidate signatures')\n\n return this.tx.addOutput(scriptPubKey, value)\n}\n\nTransactionBuilder.prototype.build = function () {\n return this.__build(false)\n}\nTransactionBuilder.prototype.buildIncomplete = function () {\n return this.__build(true)\n}\n\nvar canSignTypes = {\n 'pubkeyhash': true,\n 'multisig': true,\n 'pubkey': true\n}\n\nTransactionBuilder.prototype.__build = function (allowIncomplete) {\n if (!allowIncomplete) {\n assert(this.tx.ins.length > 0, 'Transaction has no inputs')\n assert(this.tx.outs.length > 0, 'Transaction has no outputs')\n }\n\n var tx = this.tx.clone()\n\n // Create script signatures from signature meta-data\n this.inputs.forEach(function (input, index) {\n var scriptType = input.scriptType\n var scriptSig\n\n if (!allowIncomplete) {\n assert(!!scriptType, 'Transaction is not complete')\n assert(scriptType in canSignTypes, scriptType + ' not supported')\n assert(input.signatures, 'Transaction is missing signatures')\n }\n\n if (input.signatures) {\n switch (scriptType) {\n case 'pubkeyhash': {\n var pkhSignature = input.signatures[0].toScriptSignature(input.hashType)\n scriptSig = scripts.pubKeyHashInput(pkhSignature, input.pubKeys[0])\n break\n }\n\n case 'multisig': {\n // Array.prototype.map is sparse-compatible\n var msSignatures = input.signatures.map(function (signature) {\n return signature.toScriptSignature(input.hashType)\n })\n\n // fill in blanks with OP_0\n if (allowIncomplete) {\n for (var i = 0; i < msSignatures.length; ++i) {\n if (msSignatures[i]) continue\n\n msSignatures[i] = ops.OP_0\n }\n } else {\n // Array.prototype.filter returns non-sparse array\n msSignatures = msSignatures.filter(function (x) { return x })\n }\n\n var redeemScript = allowIncomplete ? undefined : input.redeemScript\n scriptSig = scripts.multisigInput(msSignatures, redeemScript)\n break\n }\n\n case 'pubkey': {\n var pkSignature = input.signatures[0].toScriptSignature(input.hashType)\n scriptSig = scripts.pubKeyInput(pkSignature)\n break\n }\n }\n }\n\n // did we build a scriptSig?\n if (scriptSig) {\n // wrap as scriptHash if necessary\n if (input.prevOutType === 'scripthash') {\n scriptSig = scripts.scriptHashInput(scriptSig, input.redeemScript)\n }\n\n tx.setInputScript(index, scriptSig)\n }\n })\n\n return tx\n}\n\nTransactionBuilder.prototype.sign = function (index, privKey, redeemScript, hashType) {\n assert(index in this.inputs, 'No input at index: ' + index)\n hashType = hashType || Transaction.SIGHASH_ALL\n\n var input = this.inputs[index]\n var canSign = input.hashType &&\n input.prevOutScript &&\n input.prevOutType &&\n input.pubKeys &&\n input.scriptType &&\n input.signatures\n\n // are we almost ready to sign?\n if (canSign) {\n // if redeemScript was provided, enforce consistency\n if (redeemScript) {\n assert.deepEqual(input.redeemScript, redeemScript, 'Inconsistent redeemScript')\n }\n\n assert.equal(input.hashType, hashType, 'Inconsistent hashType')\n\n // no? prepare\n } else {\n // must be pay-to-scriptHash?\n if (redeemScript) {\n // if we have a prevOutScript, enforce scriptHash equality to the redeemScript\n if (input.prevOutScript) {\n assert.equal(input.prevOutType, 'scripthash', 'PrevOutScript must be P2SH')\n\n var scriptHash = input.prevOutScript.chunks[1]\n assert.deepEqual(scriptHash, redeemScript.getHash(), 'RedeemScript does not match ' + scriptHash.toString('hex'))\n }\n\n var scriptType = scripts.classifyOutput(redeemScript)\n assert(scriptType in canSignTypes, 'RedeemScript not supported (' + scriptType + ')')\n\n var pubKeys = []\n switch (scriptType) {\n case 'multisig': {\n pubKeys = redeemScript.chunks.slice(1, -2).map(ECPubKey.fromBuffer)\n break\n }\n\n case 'pubkeyhash': {\n var pkh1 = redeemScript.chunks[2]\n var pkh2 = privKey.pub.getAddress().hash\n\n assert.deepEqual(pkh1, pkh2, 'privateKey cannot sign for this input')\n pubKeys = [privKey.pub]\n break\n }\n\n case 'pubkey': {\n pubKeys = redeemScript.chunks.slice(0, 1).map(ECPubKey.fromBuffer)\n break\n }\n }\n\n if (!input.prevOutScript) {\n input.prevOutScript = scripts.scriptHashOutput(redeemScript.getHash())\n input.prevOutType = 'scripthash'\n }\n\n input.pubKeys = pubKeys\n input.redeemScript = redeemScript\n input.scriptType = scriptType\n\n // cannot be pay-to-scriptHash\n } else {\n assert.notEqual(input.prevOutType, 'scripthash', 'PrevOutScript is P2SH, missing redeemScript')\n\n // can we otherwise sign this?\n if (input.scriptType) {\n assert(input.pubKeys, input.scriptType + ' not supported')\n\n // we know nothin' Jon Snow, assume pubKeyHash\n } else {\n input.prevOutScript = privKey.pub.getAddress().toOutputScript()\n input.prevOutType = 'pubkeyhash'\n input.pubKeys = [privKey.pub]\n input.scriptType = input.prevOutType\n }\n }\n\n input.hashType = hashType\n input.signatures = input.signatures || []\n }\n\n // enforce in order signing of public keys\n assert(input.pubKeys.some(function (pubKey, i) {\n if (!privKey.pub.Q.equals(pubKey.Q)) return false\n\n assert(!input.signatures[i], 'Signature already exists')\n var signatureScript = input.redeemScript || input.prevOutScript\n var signatureHash = this.tx.hashForSignature(index, signatureScript, hashType)\n var signature = privKey.sign(signatureHash)\n input.signatures[i] = signature\n\n return true\n }, this), 'privateKey cannot sign for this input')\n}\n\nmodule.exports = TransactionBuilder\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./ecpubkey\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecpubkey.js\",\"./ecsignature\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecsignature.js\",\"./opcodes\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/opcodes.js\",\"./script\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/script.js\",\"./scripts\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/scripts.js\",\"./transaction\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/transaction.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/wallet.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar bufferutils = require('./bufferutils')\nvar crypto = require('crypto')\nvar typeForce = require('typeforce')\nvar networks = require('./networks')\n\nvar Address = require('./address')\nvar HDNode = require('./hdnode')\nvar TransactionBuilder = require('./transaction_builder')\nvar Script = require('./script')\n\nfunction Wallet (seed, network) {\n console.warn('Wallet is deprecated and will be removed in 2.0.0, see #296')\n\n seed = seed || crypto.randomBytes(32)\n network = network || networks.bitcoin\n\n // Stored in a closure to make accidental serialization less likely\n var masterKey = HDNode.fromSeedBuffer(seed, network)\n\n // HD first-level child derivation method should be hardened\n // See https://bitcointalk.org/index.php?topic=405179.msg4415254#msg4415254\n var accountZero = masterKey.deriveHardened(0)\n var externalAccount = accountZero.derive(0)\n var internalAccount = accountZero.derive(1)\n\n this.addresses = []\n this.changeAddresses = []\n this.network = network\n this.unspents = []\n\n // FIXME: remove in 2.0.0\n this.unspentMap = {}\n\n // FIXME: remove in 2.0.0\n var me = this\n this.newMasterKey = function (seed) {\n console.warn('newMasterKey is deprecated, please make a new Wallet instance instead')\n\n seed = seed || crypto.randomBytes(32)\n masterKey = HDNode.fromSeedBuffer(seed, network)\n\n accountZero = masterKey.deriveHardened(0)\n externalAccount = accountZero.derive(0)\n internalAccount = accountZero.derive(1)\n\n me.addresses = []\n me.changeAddresses = []\n\n me.unspents = []\n me.unspentMap = {}\n }\n\n this.getMasterKey = function () {\n return masterKey\n }\n this.getAccountZero = function () {\n return accountZero\n }\n this.getExternalAccount = function () {\n return externalAccount\n }\n this.getInternalAccount = function () {\n return internalAccount\n }\n}\n\nWallet.prototype.createTransaction = function (to, value, options) {\n // FIXME: remove in 2.0.0\n if (typeof options !== 'object') {\n if (options !== undefined) {\n console.warn('Non options object parameters are deprecated, use options object instead')\n\n options = {\n fixedFee: arguments[2],\n changeAddress: arguments[3]\n }\n }\n }\n\n options = options || {}\n\n assert(value > this.network.dustThreshold, value + ' must be above dust threshold (' + this.network.dustThreshold + ' Satoshis)')\n\n var changeAddress = options.changeAddress\n var fixedFee = options.fixedFee\n var minConf = options.minConf === undefined ? 0 : options.minConf // FIXME: change minConf:1 by default in 2.0.0\n\n // filter by minConf, then pending and sort by descending value\n var unspents = this.unspents.filter(function (unspent) {\n return unspent.confirmations >= minConf\n }).filter(function (unspent) {\n return !unspent.pending\n }).sort(function (o1, o2) {\n return o2.value - o1.value\n })\n\n var accum = 0\n var addresses = []\n var subTotal = value\n\n var txb = new TransactionBuilder()\n txb.addOutput(to, value)\n\n for (var i = 0; i < unspents.length; ++i) {\n var unspent = unspents[i]\n addresses.push(unspent.address)\n\n txb.addInput(unspent.txHash, unspent.index)\n\n var fee = fixedFee === undefined ? estimatePaddedFee(txb.buildIncomplete(), this.network) : fixedFee\n\n accum += unspent.value\n subTotal = value + fee\n\n if (accum >= subTotal) {\n var change = accum - subTotal\n\n if (change > this.network.dustThreshold) {\n txb.addOutput(changeAddress || this.getChangeAddress(), change)\n }\n\n break\n }\n }\n\n assert(accum >= subTotal, 'Not enough funds (incl. fee): ' + accum + ' < ' + subTotal)\n\n return this.signWith(txb, addresses).build()\n}\n\n// FIXME: remove in 2.0.0\nWallet.prototype.processPendingTx = function (tx) {\n this.__processTx(tx, true)\n}\n\n// FIXME: remove in 2.0.0\nWallet.prototype.processConfirmedTx = function (tx) {\n this.__processTx(tx, false)\n}\n\n// FIXME: remove in 2.0.0\nWallet.prototype.__processTx = function (tx, isPending) {\n console.warn('processTransaction is considered harmful, see issue #260 for more information')\n\n var txId = tx.getId()\n var txHash = tx.getHash()\n\n tx.outs.forEach(function (txOut, i) {\n var address\n\n try {\n address = Address.fromOutputScript(txOut.script, this.network).toString()\n } catch (e) {\n if (!(e.message.match(/has no matching Address/)))\n throw e\n }\n\n var myAddresses = this.addresses.concat(this.changeAddresses)\n if (myAddresses.indexOf(address) > -1) {\n var lookup = txId + ':' + i\n if (lookup in this.unspentMap) return\n\n // its unique, add it\n var unspent = {\n address: address,\n confirmations: 0, // no way to determine this without more information\n index: i,\n txHash: txHash,\n txId: txId,\n value: txOut.value,\n pending: isPending\n }\n\n this.unspentMap[lookup] = unspent\n this.unspents.push(unspent)\n }\n }, this)\n\n tx.ins.forEach(function (txIn) {\n // copy and convert to big-endian hex\n var txInId = bufferutils.reverse(txIn.hash).toString('hex')\n\n var lookup = txInId + ':' + txIn.index\n if (!(lookup in this.unspentMap)) return\n\n var unspent = this.unspentMap[lookup]\n\n if (isPending) {\n unspent.pending = true\n unspent.spent = true\n } else {\n delete this.unspentMap[lookup]\n\n this.unspents = this.unspents.filter(function (unspent2) {\n return unspent !== unspent2\n })\n }\n }, this)\n}\n\nWallet.prototype.generateAddress = function () {\n var k = this.addresses.length\n var address = this.getExternalAccount().derive(k).getAddress()\n\n this.addresses.push(address.toString())\n\n return this.getReceiveAddress()\n}\n\nWallet.prototype.generateChangeAddress = function () {\n var k = this.changeAddresses.length\n var address = this.getInternalAccount().derive(k).getAddress()\n\n this.changeAddresses.push(address.toString())\n\n return this.getChangeAddress()\n}\n\nWallet.prototype.getAddress = function () {\n if (this.addresses.length === 0) {\n this.generateAddress()\n }\n\n return this.addresses[this.addresses.length - 1]\n}\n\nWallet.prototype.getBalance = function (minConf) {\n minConf = minConf || 0\n\n return this.unspents.filter(function (unspent) {\n return unspent.confirmations >= minConf\n\n // FIXME: remove spent filter in 2.0.0\n }).filter(function (unspent) {\n return !unspent.spent\n }).reduce(function (accum, unspent) {\n return accum + unspent.value\n }, 0)\n}\n\nWallet.prototype.getChangeAddress = function () {\n if (this.changeAddresses.length === 0) {\n this.generateChangeAddress()\n }\n\n return this.changeAddresses[this.changeAddresses.length - 1]\n}\n\nWallet.prototype.getInternalPrivateKey = function (index) {\n return this.getInternalAccount().derive(index).privKey\n}\n\nWallet.prototype.getPrivateKey = function (index) {\n return this.getExternalAccount().derive(index).privKey\n}\n\nWallet.prototype.getPrivateKeyForAddress = function (address) {\n var index\n\n if ((index = this.addresses.indexOf(address)) > -1) {\n return this.getPrivateKey(index)\n }\n\n if ((index = this.changeAddresses.indexOf(address)) > -1) {\n return this.getInternalPrivateKey(index)\n }\n\n assert(false, 'Unknown address. Make sure the address is from the keychain and has been generated')\n}\n\nWallet.prototype.getUnspentOutputs = function (minConf) {\n minConf = minConf || 0\n\n return this.unspents.filter(function (unspent) {\n return unspent.confirmations >= minConf\n\n // FIXME: remove spent filter in 2.0.0\n }).filter(function (unspent) {\n return !unspent.spent\n }).map(function (unspent) {\n return {\n address: unspent.address,\n confirmations: unspent.confirmations,\n index: unspent.index,\n txId: unspent.txId,\n value: unspent.value,\n\n // FIXME: remove in 2.0.0\n hash: unspent.txId,\n pending: unspent.pending\n }\n })\n}\n\nWallet.prototype.setUnspentOutputs = function (unspents) {\n this.unspentMap = {}\n this.unspents = unspents.map(function (unspent) {\n // FIXME: remove unspent.hash in 2.0.0\n var txId = unspent.txId || unspent.hash\n var index = unspent.index\n\n // FIXME: remove in 2.0.0\n if (unspent.hash !== undefined) {\n console.warn('unspent.hash is deprecated, use unspent.txId instead')\n }\n\n // FIXME: remove in 2.0.0\n if (index === undefined) {\n console.warn('unspent.outputIndex is deprecated, use unspent.index instead')\n index = unspent.outputIndex\n }\n\n typeForce('String', txId)\n typeForce('Number', index)\n typeForce('Number', unspent.value)\n\n assert.equal(txId.length, 64, 'Expected valid txId, got ' + txId)\n assert.doesNotThrow(function () {\n Address.fromBase58Check(unspent.address)\n }, 'Expected Base58 Address, got ' + unspent.address)\n assert(isFinite(index), 'Expected finite index, got ' + index)\n\n // FIXME: remove branch in 2.0.0\n if (unspent.confirmations !== undefined) {\n typeForce('Number', unspent.confirmations)\n }\n\n var txHash = bufferutils.reverse(new Buffer(txId, 'hex'))\n\n unspent = {\n address: unspent.address,\n confirmations: unspent.confirmations || 0,\n index: index,\n txHash: txHash,\n txId: txId,\n value: unspent.value,\n\n // FIXME: remove in 2.0.0\n pending: unspent.pending || false\n }\n\n // FIXME: remove in 2.0.0\n this.unspentMap[txId + ':' + index] = unspent\n\n return unspent\n }, this)\n}\n\nWallet.prototype.signWith = function (tx, addresses) {\n addresses.forEach(function (address, i) {\n var privKey = this.getPrivateKeyForAddress(address)\n\n tx.sign(i, privKey)\n }, this)\n\n return tx\n}\n\nfunction estimatePaddedFee (tx, network) {\n var tmpTx = tx.clone()\n tmpTx.addOutput(Script.EMPTY, network.dustSoftThreshold || 0)\n\n return network.estimateFee(tmpTx)\n}\n\n// FIXME: 1.0.0 shims, remove in 2.0.0\nWallet.prototype.getReceiveAddress = Wallet.prototype.getAddress\nWallet.prototype.createTx = Wallet.prototype.createTransaction\n\nmodule.exports = Wallet\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./address\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/address.js\",\"./bufferutils\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/bufferutils.js\",\"./hdnode\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/hdnode.js\",\"./networks\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/networks.js\",\"./script\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/script.js\",\"./transaction_builder\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/transaction_builder.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"crypto\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/index.js\",\"typeforce\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/typeforce/index.js\"}],\"/home/itay/dev/pockets/node_modules/bluebird/js/browser/bluebird.js\":[function(require,module,exports){\n(function (process,global){\n/* @preserve\n * The MIT License (MIT)\n * \n * Copyright (c) 2014 Petka Antonov\n * \n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:

\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n * \n */\n/**\n * bluebird build version 2.9.14\n * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, progress, cancel, using, filter, any, each, timers\n*/\n!function(e){if(\"object\"==typeof exports&&\"undefined\"!=typeof module)module.exports=e();else if(\"function\"==typeof define&&define.amd)define([],e);else{var f;\"undefined\"!=typeof window?f=window:\"undefined\"!=typeof global?f=global:\"undefined\"!=typeof self&&(f=self),f.Promise=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_==\"function\"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_==\"function\"&&_dereq_;for(var o=0;o 0;\n};\n\nAsync.prototype._withDomain = function(fn) {\n if (_process !== undefined &&\n _process.domain != null &&\n !fn.domain) {\n fn = _process.domain.bind(fn);\n }\n return fn;\n};\n\nAsync.prototype.throwLater = function(fn, arg) {\n if (arguments.length === 1) {\n arg = fn;\n fn = function () { throw arg; };\n }\n fn = this._withDomain(fn);\n if (typeof setTimeout !== \"undefined\") {\n setTimeout(function() {\n fn(arg);\n }, 0);\n } else try {\n this._schedule(function() {\n fn(arg);\n });\n } catch (e) {\n throw new Error(\"No async scheduler available\\u000a\\u000a See http://goo.gl/m3OTXk\\u000a\");\n }\n};\n\nAsync.prototype.invokeLater = function (fn, receiver, arg) {\n fn = this._withDomain(fn);\n this._lateQueue.push(fn, receiver, arg);\n this._queueTick();\n};\n\nAsync.prototype.invokeFirst = function (fn, receiver, arg) {\n fn = this._withDomain(fn);\n this._normalQueue.unshift(fn, receiver, arg);\n this._queueTick();\n};\n\nAsync.prototype.invoke = function (fn, receiver, arg) {\n fn = this._withDomain(fn);\n this._normalQueue.push(fn, receiver, arg);\n this._queueTick();\n};\n\nAsync.prototype.settlePromises = function(promise) {\n this._normalQueue._pushOne(promise);\n this._queueTick();\n};\n\nAsync.prototype._drainQueue = function(queue) {\n while (queue.length() > 0) {\n var fn = queue.shift();\n if (typeof fn !== \"function\") {\n fn._settlePromises();\n continue;\n }\n var receiver = queue.shift();\n var arg = queue.shift();\n fn.call(receiver, arg);\n }\n};\n\nAsync.prototype._drainQueues = function () {\n this._drainQueue(this._normalQueue);\n this._reset();\n this._drainQueue(this._lateQueue);\n};\n\nAsync.prototype._queueTick = function () {\n if (!this._isTickUsed) {\n this._isTickUsed = true;\n this._schedule(this.drainQueues);\n }\n};\n\nAsync.prototype._reset = function () {\n this._isTickUsed = false;\n};\n\nmodule.exports = new Async();\nmodule.exports.firstLineError = firstLineError;\n\n},{\"./queue.js\":28,\"./schedule.js\":31}],3:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL, tryConvertToPromise) {\nvar rejectThis = function(_, e) {\n this._reject(e);\n};\n\nvar targetRejected = function(e, context) {\n context.promiseRejectionQueued = true;\n context.bindingPromise._then(rejectThis, rejectThis, null, this, e);\n};\n\nvar bindingResolved = function(thisArg, context) {\n this._setBoundTo(thisArg);\n if (this._isPending()) {\n this._resolveCallback(context.target);\n }\n};\n\nvar bindingRejected = function(e, context) {\n if (!context.promiseRejectionQueued) this._reject(e);\n};\n\nPromise.prototype.bind = function (thisArg) {\n var maybePromise = tryConvertToPromise(thisArg);\n var ret = new Promise(INTERNAL);\n ret._propagateFrom(this, 1);\n var target = this._target();\n if (maybePromise instanceof Promise) {\n var context = {\n promiseRejectionQueued: false,\n promise: ret,\n target: target,\n bindingPromise: maybePromise\n };\n target._then(INTERNAL, targetRejected, ret._progress, ret, context);\n maybePromise._then(\n bindingResolved, bindingRejected, ret._progress, ret, context);\n } else {\n ret._setBoundTo(thisArg);\n ret._resolveCallback(target);\n }\n return ret;\n};\n\nPromise.prototype._setBoundTo = function (obj) {\n if (obj !== undefined) {\n this._bitField = this._bitField | 131072;\n this._boundTo = obj;\n } else {\n this._bitField = this._bitField & (~131072);\n }\n};\n\nPromise.prototype._isBound = function () {\n return (this._bitField & 131072) === 131072;\n};\n\nPromise.bind = function (thisArg, value) {\n var maybePromise = tryConvertToPromise(thisArg);\n var ret = new Promise(INTERNAL);\n\n if (maybePromise instanceof Promise) {\n maybePromise._then(function(thisArg) {\n ret._setBoundTo(thisArg);\n ret._resolveCallback(value);\n }, ret._reject, ret._progress, ret, null);\n } else {\n ret._setBoundTo(thisArg);\n ret._resolveCallback(value);\n }\n return ret;\n};\n};\n\n},{}],4:[function(_dereq_,module,exports){\n\"use strict\";\nvar old;\nif (typeof Promise !== \"undefined\") old = Promise;\nfunction noConflict() {\n try { if (Promise === bluebird) Promise = old; }\n catch (e) {}\n return bluebird;\n}\nvar bluebird = _dereq_(\"./promise.js\")();\nbluebird.noConflict = noConflict;\nmodule.exports = bluebird;\n\n},{\"./promise.js\":23}],5:[function(_dereq_,module,exports){\n\"use strict\";\nvar cr = Object.create;\nif (cr) {\n var callerCache = cr(null);\n var getterCache = cr(null);\n callerCache[\" size\"] = getterCache[\" size\"] = 0;\n}\n\nmodule.exports = function(Promise) {\nvar util = _dereq_(\"./util.js\");\nvar canEvaluate = util.canEvaluate;\nvar isIdentifier = util.isIdentifier;\n\nvar getMethodCaller;\nvar getGetter;\nif (!true) {\nvar makeMethodCaller = function (methodName) {\n return new Function(\"ensureMethod\", \" \\n\\\n return function(obj) { \\n\\\n 'use strict' \\n\\\n var len = this.length; \\n\\\n ensureMethod(obj, 'methodName'); \\n\\\n switch(len) { \\n\\\n case 1: return obj.methodName(this[0]); \\n\\\n case 2: return obj.methodName(this[0], this[1]); \\n\\\n case 3: return obj.methodName(this[0], this[1], this[2]); \\n\\\n case 0: return obj.methodName(); \\n\\\n default: \\n\\\n return obj.methodName.apply(obj, this); \\n\\\n } \\n\\\n }; \\n\\\n \".replace(/methodName/g, methodName))(ensureMethod);\n};\n\nvar makeGetter = function (propertyName) {\n return new Function(\"obj\", \" \\n\\\n 'use strict'; \\n\\\n return obj.propertyName; \\n\\\n \".replace(\"propertyName\", propertyName));\n};\n\nvar getCompiled = function(name, compiler, cache) {\n var ret = cache[name];\n if (typeof ret !== \"function\") {\n if (!isIdentifier(name)) {\n return null;\n }\n ret = compiler(name);\n cache[name] = ret;\n cache[\" size\"]++;\n if (cache[\" size\"] > 512) {\n var keys = Object.keys(cache);\n for (var i = 0; i < 256; ++i) delete cache[keys[i]];\n cache[\" size\"] = keys.length - 256;\n }\n }\n return ret;\n};\n\ngetMethodCaller = function(name) {\n return getCompiled(name, makeMethodCaller, callerCache);\n};\n\ngetGetter = function(name) {\n return getCompiled(name, makeGetter, getterCache);\n};\n}\n\nfunction ensureMethod(obj, methodName) {\n var fn;\n if (obj != null) fn = obj[methodName];\n if (typeof fn !== \"function\") {\n var message = \"Object \" + util.classString(obj) + \" has no method '\" +\n util.toString(methodName) + \"'\";\n throw new Promise.TypeError(message);\n }\n return fn;\n}\n\nfunction caller(obj) {\n var methodName = this.pop();\n var fn = ensureMethod(obj, methodName);\n return fn.apply(obj, this);\n}\nPromise.prototype.call = function (methodName) {\n var $_len = arguments.length;var args = new Array($_len - 1); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];}\n if (!true) {\n if (canEvaluate) {\n var maybeCaller = getMethodCaller(methodName);\n if (maybeCaller !== null) {\n return this._then(\n maybeCaller, undefined, undefined, args, undefined);\n }\n }\n }\n args.push(methodName);\n return this._then(caller, undefined, undefined, args, undefined);\n};\n\nfunction namedGetter(obj) {\n return obj[this];\n}\nfunction indexedGetter(obj) {\n var index = +this;\n if (index < 0) index = Math.max(0, index + obj.length);\n return obj[index];\n}\nPromise.prototype.get = function (propertyName) {\n var isIndex = (typeof propertyName === \"number\");\n var getter;\n if (!isIndex) {\n if (canEvaluate) {\n var maybeGetter = getGetter(propertyName);\n getter = maybeGetter !== null ? maybeGetter : namedGetter;\n } else {\n getter = namedGetter;\n }\n } else {\n getter = indexedGetter;\n }\n return this._then(getter, undefined, undefined, propertyName, undefined);\n};\n};\n\n},{\"./util.js\":38}],6:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise) {\nvar errors = _dereq_(\"./errors.js\");\nvar async = _dereq_(\"./async.js\");\nvar CancellationError = errors.CancellationError;\n\nPromise.prototype._cancel = function (reason) {\n if (!this.isCancellable()) return this;\n var parent;\n var promiseToReject = this;\n while ((parent = promiseToReject._cancellationParent) !== undefined &&\n parent.isCancellable()) {\n promiseToReject = parent;\n }\n this._unsetCancellable();\n promiseToReject._target()._rejectCallback(reason, false, true);\n};\n\nPromise.prototype.cancel = function (reason) {\n if (!this.isCancellable()) return this;\n if (reason === undefined) reason = new CancellationError();\n async.invokeLater(this._cancel, this, reason);\n return this;\n};\n\nPromise.prototype.cancellable = function () {\n if (this._cancellable()) return this;\n this._setCancellable();\n this._cancellationParent = undefined;\n return this;\n};\n\nPromise.prototype.uncancellable = function () {\n var ret = this.then();\n ret._unsetCancellable();\n return ret;\n};\n\nPromise.prototype.fork = function (didFulfill, didReject, didProgress) {\n var ret = this._then(didFulfill, didReject, didProgress,\n undefined, undefined);\n\n ret._setCancellable();\n ret._cancellationParent = undefined;\n return ret;\n};\n};\n\n},{\"./async.js\":2,\"./errors.js\":13}],7:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function() {\nvar async = _dereq_(\"./async.js\");\nvar util = _dereq_(\"./util.js\");\nvar bluebirdFramePattern =\n /[\\\\\\/]bluebird[\\\\\\/]js[\\\\\\/](main|debug|zalgo|instrumented)/;\nvar stackFramePattern = null;\nvar formatStack = null;\nvar indentStackFrames = false;\nvar warn;\n\nfunction CapturedTrace(parent) {\n this._parent = parent;\n var length = this._length = 1 + (parent === undefined ? 0 : parent._length);\n captureStackTrace(this, CapturedTrace);\n if (length > 32) this.uncycle();\n}\nutil.inherits(CapturedTrace, Error);\n\nCapturedTrace.prototype.uncycle = function() {\n var length = this._length;\n if (length < 2) return;\n var nodes = [];\n var stackToIndex = {};\n\n for (var i = 0, node = this; node !== undefined; ++i) {\n nodes.push(node);\n node = node._parent;\n }\n length = this._length = i;\n for (var i = length - 1; i >= 0; --i) {\n var stack = nodes[i].stack;\n if (stackToIndex[stack] === undefined) {\n stackToIndex[stack] = i;\n }\n }\n for (var i = 0; i < length; ++i) {\n var currentStack = nodes[i].stack;\n var index = stackToIndex[currentStack];\n if (index !== undefined && index !== i) {\n if (index > 0) {\n nodes[index - 1]._parent = undefined;\n nodes[index - 1]._length = 1;\n }\n nodes[i]._parent = undefined;\n nodes[i]._length = 1;\n var cycleEdgeNode = i > 0 ? nodes[i - 1] : this;\n\n if (index < length - 1) {\n cycleEdgeNode._parent = nodes[index + 1];\n cycleEdgeNode._parent.uncycle();\n cycleEdgeNode._length =\n cycleEdgeNode._parent._length + 1;\n } else {\n cycleEdgeNode._parent = undefined;\n cycleEdgeNode._length = 1;\n }\n var currentChildLength = cycleEdgeNode._length + 1;\n for (var j = i - 2; j >= 0; --j) {\n nodes[j]._length = currentChildLength;\n currentChildLength++;\n }\n return;\n }\n }\n};\n\nCapturedTrace.prototype.parent = function() {\n return this._parent;\n};\n\nCapturedTrace.prototype.hasParent = function() {\n return this._parent !== undefined;\n};\n\nCapturedTrace.prototype.attachExtraTrace = function(error) {\n if (error.__stackCleaned__) return;\n this.uncycle();\n var parsed = CapturedTrace.parseStackAndMessage(error);\n var message = parsed.message;\n var stacks = [parsed.stack];\n\n var trace = this;\n while (trace !== undefined) {\n stacks.push(cleanStack(trace.stack.split(\"\\n\")));\n trace = trace._parent;\n }\n removeCommonRoots(stacks);\n removeDuplicateOrEmptyJumps(stacks);\n error.stack = reconstructStack(message, stacks);\n util.notEnumerableProp(error, \"__stackCleaned__\", true);\n};\n\nfunction reconstructStack(message, stacks) {\n for (var i = 0; i < stacks.length - 1; ++i) {\n stacks[i].push(\"From previous event:\");\n stacks[i] = stacks[i].join(\"\\n\");\n }\n if (i < stacks.length) {\n stacks[i] = stacks[i].join(\"\\n\");\n }\n return message + \"\\n\" + stacks.join(\"\\n\");\n}\n\nfunction removeDuplicateOrEmptyJumps(stacks) {\n for (var i = 0; i < stacks.length; ++i) {\n if (stacks[i].length === 0 ||\n ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) {\n stacks.splice(i, 1);\n i--;\n }\n }\n}\n\nfunction removeCommonRoots(stacks) {\n var current = stacks[0];\n for (var i = 1; i < stacks.length; ++i) {\n var prev = stacks[i];\n var currentLastIndex = current.length - 1;\n var currentLastLine = current[currentLastIndex];\n var commonRootMeetPoint = -1;\n\n for (var j = prev.length - 1; j >= 0; --j) {\n if (prev[j] === currentLastLine) {\n commonRootMeetPoint = j;\n break;\n }\n }\n\n for (var j = commonRootMeetPoint; j >= 0; --j) {\n var line = prev[j];\n if (current[currentLastIndex] === line) {\n current.pop();\n currentLastIndex--;\n } else {\n break;\n }\n }\n current = prev;\n }\n}\n\nfunction cleanStack(stack) {\n var ret = [];\n for (var i = 0; i < stack.length; ++i) {\n var line = stack[i];\n var isTraceLine = stackFramePattern.test(line) ||\n \" (No stack trace)\" === line;\n var isInternalFrame = isTraceLine && shouldIgnore(line);\n if (isTraceLine && !isInternalFrame) {\n if (indentStackFrames && line.charAt(0) !== \" \") {\n line = \" \" + line;\n }\n ret.push(line);\n }\n }\n return ret;\n}\n\nfunction stackFramesAsArray(error) {\n var stack = error.stack.replace(/\\s+$/g, \"\").split(\"\\n\");\n for (var i = 0; i < stack.length; ++i) {\n var line = stack[i];\n if (\" (No stack trace)\" === line || stackFramePattern.test(line)) {\n break;\n }\n }\n if (i > 0) {\n stack = stack.slice(i);\n }\n return stack;\n}\n\nCapturedTrace.parseStackAndMessage = function(error) {\n var stack = error.stack;\n var message = error.toString();\n stack = typeof stack === \"string\" && stack.length > 0\n ? stackFramesAsArray(error) : [\" (No stack trace)\"];\n return {\n message: message,\n stack: cleanStack(stack)\n };\n};\n\nCapturedTrace.formatAndLogError = function(error, title) {\n if (typeof console !== \"undefined\") {\n var message;\n if (typeof error === \"object\" || typeof error === \"function\") {\n var stack = error.stack;\n message = title + formatStack(stack, error);\n } else {\n message = title + String(error);\n }\n if (typeof warn === \"function\") {\n warn(message);\n } else if (typeof console.log === \"function\" ||\n typeof console.log === \"object\") {\n console.log(message);\n }\n }\n};\n\nCapturedTrace.unhandledRejection = function (reason) {\n CapturedTrace.formatAndLogError(reason, \"^--- With additional stack trace: \");\n};\n\nCapturedTrace.isSupported = function () {\n return typeof captureStackTrace === \"function\";\n};\n\nCapturedTrace.fireRejectionEvent =\nfunction(name, localHandler, reason, promise) {\n var localEventFired = false;\n try {\n if (typeof localHandler === \"function\") {\n localEventFired = true;\n if (name === \"rejectionHandled\") {\n localHandler(promise);\n } else {\n localHandler(reason, promise);\n }\n }\n } catch (e) {\n async.throwLater(e);\n }\n\n var globalEventFired = false;\n try {\n globalEventFired = fireGlobalEvent(name, reason, promise);\n } catch (e) {\n globalEventFired = true;\n async.throwLater(e);\n }\n\n var domEventFired = false;\n if (fireDomEvent) {\n try {\n domEventFired = fireDomEvent(name.toLowerCase(), {\n reason: reason,\n promise: promise\n });\n } catch (e) {\n domEventFired = true;\n async.throwLater(e);\n }\n }\n\n if (!globalEventFired && !localEventFired && !domEventFired &&\n name === \"unhandledRejection\") {\n CapturedTrace.formatAndLogError(reason, \"Unhandled rejection \");\n }\n};\n\nfunction formatNonError(obj) {\n var str;\n if (typeof obj === \"function\") {\n str = \"[function \" +\n (obj.name || \"anonymous\") +\n \"]\";\n } else {\n str = obj.toString();\n var ruselessToString = /\\[object [a-zA-Z0-9$_]+\\]/;\n if (ruselessToString.test(str)) {\n try {\n var newStr = JSON.stringify(obj);\n str = newStr;\n }\n catch(e) {\n\n }\n }\n if (str.length === 0) {\n str = \"(empty array)\";\n }\n }\n return (\"(<\" + snip(str) + \">, no stack trace)\");\n}\n\nfunction snip(str) {\n var maxChars = 41;\n if (str.length < maxChars) {\n return str;\n }\n return str.substr(0, maxChars - 3) + \"...\";\n}\n\nvar shouldIgnore = function() { return false; };\nvar parseLineInfoRegex = /[\\/<\\(]([^:\\/]+):(\\d+):(?:\\d+)\\)?\\s*$/;\nfunction parseLineInfo(line) {\n var matches = line.match(parseLineInfoRegex);\n if (matches) {\n return {\n fileName: matches[1],\n line: parseInt(matches[2], 10)\n };\n }\n}\nCapturedTrace.setBounds = function(firstLineError, lastLineError) {\n if (!CapturedTrace.isSupported()) return;\n var firstStackLines = firstLineError.stack.split(\"\\n\");\n var lastStackLines = lastLineError.stack.split(\"\\n\");\n var firstIndex = -1;\n var lastIndex = -1;\n var firstFileName;\n var lastFileName;\n for (var i = 0; i < firstStackLines.length; ++i) {\n var result = parseLineInfo(firstStackLines[i]);\n if (result) {\n firstFileName = result.fileName;\n firstIndex = result.line;\n break;\n }\n }\n for (var i = 0; i < lastStackLines.length; ++i) {\n var result = parseLineInfo(lastStackLines[i]);\n if (result) {\n lastFileName = result.fileName;\n lastIndex = result.line;\n break;\n }\n }\n if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName ||\n firstFileName !== lastFileName || firstIndex >= lastIndex) {\n return;\n }\n\n shouldIgnore = function(line) {\n if (bluebirdFramePattern.test(line)) return true;\n var info = parseLineInfo(line);\n if (info) {\n if (info.fileName === firstFileName &&\n (firstIndex <= info.line && info.line <= lastIndex)) {\n return true;\n }\n }\n return false;\n };\n};\n\nvar captureStackTrace = (function stackDetection() {\n var v8stackFramePattern = /^\\s*at\\s*/;\n var v8stackFormatter = function(stack, error) {\n if (typeof stack === \"string\") return stack;\n\n if (error.name !== undefined &&\n error.message !== undefined) {\n return error.toString();\n }\n return formatNonError(error);\n };\n\n if (typeof Error.stackTraceLimit === \"number\" &&\n typeof Error.captureStackTrace === \"function\") {\n Error.stackTraceLimit = Error.stackTraceLimit + 6;\n stackFramePattern = v8stackFramePattern;\n formatStack = v8stackFormatter;\n var captureStackTrace = Error.captureStackTrace;\n\n shouldIgnore = function(line) {\n return bluebirdFramePattern.test(line);\n };\n return function(receiver, ignoreUntil) {\n Error.stackTraceLimit = Error.stackTraceLimit + 6;\n captureStackTrace(receiver, ignoreUntil);\n Error.stackTraceLimit = Error.stackTraceLimit - 6;\n };\n }\n var err = new Error();\n\n if (typeof err.stack === \"string\" &&\n err.stack.split(\"\\n\")[0].indexOf(\"stackDetection@\") >= 0) {\n stackFramePattern = /@/;\n formatStack = v8stackFormatter;\n indentStackFrames = true;\n return function captureStackTrace(o) {\n o.stack = new Error().stack;\n };\n }\n\n var hasStackAfterThrow;\n try { throw new Error(); }\n catch(e) {\n hasStackAfterThrow = (\"stack\" in e);\n }\n if (!(\"stack\" in err) && hasStackAfterThrow) {\n stackFramePattern = v8stackFramePattern;\n formatStack = v8stackFormatter;\n return function captureStackTrace(o) {\n Error.stackTraceLimit = Error.stackTraceLimit + 6;\n try { throw new Error(); }\n catch(e) { o.stack = e.stack; }\n Error.stackTraceLimit = Error.stackTraceLimit - 6;\n };\n }\n\n formatStack = function(stack, error) {\n if (typeof stack === \"string\") return stack;\n\n if ((typeof error === \"object\" ||\n typeof error === \"function\") &&\n error.name !== undefined &&\n error.message !== undefined) {\n return error.toString();\n }\n return formatNonError(error);\n };\n\n return null;\n\n})([]);\n\nvar fireDomEvent;\nvar fireGlobalEvent = (function() {\n if (util.isNode) {\n return function(name, reason, promise) {\n if (name === \"rejectionHandled\") {\n return process.emit(name, promise);\n } else {\n return process.emit(name, reason, promise);\n }\n };\n } else {\n var customEventWorks = false;\n var anyEventWorks = true;\n try {\n var ev = new self.CustomEvent(\"test\");\n customEventWorks = ev instanceof CustomEvent;\n } catch (e) {}\n if (!customEventWorks) {\n try {\n var event = document.createEvent(\"CustomEvent\");\n event.initCustomEvent(\"testingtheevent\", false, true, {});\n self.dispatchEvent(event);\n } catch (e) {\n anyEventWorks = false;\n }\n }\n if (anyEventWorks) {\n fireDomEvent = function(type, detail) {\n var event;\n if (customEventWorks) {\n event = new self.CustomEvent(type, {\n detail: detail,\n bubbles: false,\n cancelable: true\n });\n } else if (self.dispatchEvent) {\n event = document.createEvent(\"CustomEvent\");\n event.initCustomEvent(type, false, true, detail);\n }\n\n return event ? !self.dispatchEvent(event) : false;\n };\n }\n\n var toWindowMethodNameMap = {};\n toWindowMethodNameMap[\"unhandledRejection\"] = (\"on\" +\n \"unhandledRejection\").toLowerCase();\n toWindowMethodNameMap[\"rejectionHandled\"] = (\"on\" +\n \"rejectionHandled\").toLowerCase();\n\n return function(name, reason, promise) {\n var methodName = toWindowMethodNameMap[name];\n var method = self[methodName];\n if (!method) return false;\n if (name === \"rejectionHandled\") {\n method.call(self, promise);\n } else {\n method.call(self, reason, promise);\n }\n return true;\n };\n }\n})();\n\nif (typeof console !== \"undefined\" && typeof console.warn !== \"undefined\") {\n warn = function (message) {\n console.warn(message);\n };\n if (util.isNode && process.stderr.isTTY) {\n warn = function(message) {\n process.stderr.write(\"\\u001b[31m\" + message + \"\\u001b[39m\\n\");\n };\n } else if (!util.isNode && typeof (new Error().stack) === \"string\") {\n warn = function(message) {\n console.warn(\"%c\" + message, \"color: red\");\n };\n }\n}\n\nreturn CapturedTrace;\n};\n\n},{\"./async.js\":2,\"./util.js\":38}],8:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(NEXT_FILTER) {\nvar util = _dereq_(\"./util.js\");\nvar errors = _dereq_(\"./errors.js\");\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\nvar keys = _dereq_(\"./es5.js\").keys;\nvar TypeError = errors.TypeError;\n\nfunction CatchFilter(instances, callback, promise) {\n this._instances = instances;\n this._callback = callback;\n this._promise = promise;\n}\n\nfunction safePredicate(predicate, e) {\n var safeObject = {};\n var retfilter = tryCatch(predicate).call(safeObject, e);\n\n if (retfilter === errorObj) return retfilter;\n\n var safeKeys = keys(safeObject);\n if (safeKeys.length) {\n errorObj.e = new TypeError(\"Catch filter must inherit from Error or be a simple predicate function\\u000a\\u000a See http://goo.gl/o84o68\\u000a\");\n return errorObj;\n }\n return retfilter;\n}\n\nCatchFilter.prototype.doFilter = function (e) {\n var cb = this._callback;\n var promise = this._promise;\n var boundTo = promise._boundTo;\n for (var i = 0, len = this._instances.length; i < len; ++i) {\n var item = this._instances[i];\n var itemIsErrorType = item === Error ||\n (item != null && item.prototype instanceof Error);\n\n if (itemIsErrorType && e instanceof item) {\n var ret = tryCatch(cb).call(boundTo, e);\n if (ret === errorObj) {\n NEXT_FILTER.e = ret.e;\n return NEXT_FILTER;\n }\n return ret;\n } else if (typeof item === \"function\" && !itemIsErrorType) {\n var shouldHandle = safePredicate(item, e);\n if (shouldHandle === errorObj) {\n e = errorObj.e;\n break;\n } else if (shouldHandle) {\n var ret = tryCatch(cb).call(boundTo, e);\n if (ret === errorObj) {\n NEXT_FILTER.e = ret.e;\n return NEXT_FILTER;\n }\n return ret;\n }\n }\n }\n NEXT_FILTER.e = e;\n return NEXT_FILTER;\n};\n\nreturn CatchFilter;\n};\n\n},{\"./errors.js\":13,\"./es5.js\":14,\"./util.js\":38}],9:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, CapturedTrace, isDebugging) {\nvar contextStack = [];\nfunction Context() {\n this._trace = new CapturedTrace(peekContext());\n}\nContext.prototype._pushContext = function () {\n if (!isDebugging()) return;\n if (this._trace !== undefined) {\n contextStack.push(this._trace);\n }\n};\n\nContext.prototype._popContext = function () {\n if (!isDebugging()) return;\n if (this._trace !== undefined) {\n contextStack.pop();\n }\n};\n\nfunction createContext() {\n if (isDebugging()) return new Context();\n}\n\nfunction peekContext() {\n var lastIndex = contextStack.length - 1;\n if (lastIndex >= 0) {\n return contextStack[lastIndex];\n }\n return undefined;\n}\n\nPromise.prototype._peekContext = peekContext;\nPromise.prototype._pushContext = Context.prototype._pushContext;\nPromise.prototype._popContext = Context.prototype._popContext;\n\nreturn createContext;\n};\n\n},{}],10:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, CapturedTrace) {\nvar async = _dereq_(\"./async.js\");\nvar Warning = _dereq_(\"./errors.js\").Warning;\nvar util = _dereq_(\"./util.js\");\nvar canAttachTrace = util.canAttachTrace;\nvar unhandledRejectionHandled;\nvar possiblyUnhandledRejection;\nvar debugging = false || (util.isNode &&\n (!!process.env[\"BLUEBIRD_DEBUG\"] ||\n process.env[\"NODE_ENV\"] === \"development\"));\n\nPromise.prototype._ensurePossibleRejectionHandled = function () {\n this._setRejectionIsUnhandled();\n async.invokeLater(this._notifyUnhandledRejection, this, undefined);\n};\n\nPromise.prototype._notifyUnhandledRejectionIsHandled = function () {\n CapturedTrace.fireRejectionEvent(\"rejectionHandled\",\n unhandledRejectionHandled, undefined, this);\n};\n\nPromise.prototype._notifyUnhandledRejection = function () {\n if (this._isRejectionUnhandled()) {\n var reason = this._getCarriedStackTrace() || this._settledValue;\n this._setUnhandledRejectionIsNotified();\n CapturedTrace.fireRejectionEvent(\"unhandledRejection\",\n possiblyUnhandledRejection, reason, this);\n }\n};\n\nPromise.prototype._setUnhandledRejectionIsNotified = function () {\n this._bitField = this._bitField | 524288;\n};\n\nPromise.prototype._unsetUnhandledRejectionIsNotified = function () {\n this._bitField = this._bitField & (~524288);\n};\n\nPromise.prototype._isUnhandledRejectionNotified = function () {\n return (this._bitField & 524288) > 0;\n};\n\nPromise.prototype._setRejectionIsUnhandled = function () {\n this._bitField = this._bitField | 2097152;\n};\n\nPromise.prototype._unsetRejectionIsUnhandled = function () {\n this._bitField = this._bitField & (~2097152);\n if (this._isUnhandledRejectionNotified()) {\n this._unsetUnhandledRejectionIsNotified();\n this._notifyUnhandledRejectionIsHandled();\n }\n};\n\nPromise.prototype._isRejectionUnhandled = function () {\n return (this._bitField & 2097152) > 0;\n};\n\nPromise.prototype._setCarriedStackTrace = function (capturedTrace) {\n this._bitField = this._bitField | 1048576;\n this._fulfillmentHandler0 = capturedTrace;\n};\n\nPromise.prototype._isCarryingStackTrace = function () {\n return (this._bitField & 1048576) > 0;\n};\n\nPromise.prototype._getCarriedStackTrace = function () {\n return this._isCarryingStackTrace()\n ? this._fulfillmentHandler0\n : undefined;\n};\n\nPromise.prototype._captureStackTrace = function () {\n if (debugging) {\n this._trace = new CapturedTrace(this._peekContext());\n }\n return this;\n};\n\nPromise.prototype._attachExtraTrace = function (error, ignoreSelf) {\n if (debugging && canAttachTrace(error)) {\n var trace = this._trace;\n if (trace !== undefined) {\n if (ignoreSelf) trace = trace._parent;\n }\n if (trace !== undefined) {\n trace.attachExtraTrace(error);\n } else if (!error.__stackCleaned__) {\n var parsed = CapturedTrace.parseStackAndMessage(error);\n error.stack = parsed.message + \"\\n\" + parsed.stack.join(\"\\n\");\n util.notEnumerableProp(error, \"__stackCleaned__\", true);\n }\n }\n};\n\nPromise.prototype._warn = function(message) {\n var warning = new Warning(message);\n var ctx = this._peekContext();\n if (ctx) {\n ctx.attachExtraTrace(warning);\n } else {\n var parsed = CapturedTrace.parseStackAndMessage(warning);\n warning.stack = parsed.message + \"\\n\" + parsed.stack.join(\"\\n\");\n }\n CapturedTrace.formatAndLogError(warning, \"\");\n};\n\nPromise.onPossiblyUnhandledRejection = function (fn) {\n possiblyUnhandledRejection = typeof fn === \"function\" ? fn : undefined;\n};\n\nPromise.onUnhandledRejectionHandled = function (fn) {\n unhandledRejectionHandled = typeof fn === \"function\" ? fn : undefined;\n};\n\nPromise.longStackTraces = function () {\n if (async.haveItemsQueued() &&\n debugging === false\n ) {\n throw new Error(\"cannot enable long stack traces after promises have been created\\u000a\\u000a See http://goo.gl/DT1qyG\\u000a\");\n }\n debugging = CapturedTrace.isSupported();\n};\n\nPromise.hasLongStackTraces = function () {\n return debugging && CapturedTrace.isSupported();\n};\n\nif (!CapturedTrace.isSupported()) {\n Promise.longStackTraces = function(){};\n debugging = false;\n}\n\nreturn function() {\n return debugging;\n};\n};\n\n},{\"./async.js\":2,\"./errors.js\":13,\"./util.js\":38}],11:[function(_dereq_,module,exports){\n\"use strict\";\nvar util = _dereq_(\"./util.js\");\nvar isPrimitive = util.isPrimitive;\nvar wrapsPrimitiveReceiver = util.wrapsPrimitiveReceiver;\n\nmodule.exports = function(Promise) {\nvar returner = function () {\n return this;\n};\nvar thrower = function () {\n throw this;\n};\n\nvar wrapper = function (value, action) {\n if (action === 1) {\n return function () {\n throw value;\n };\n } else if (action === 2) {\n return function () {\n return value;\n };\n }\n};\n\n\nPromise.prototype[\"return\"] =\nPromise.prototype.thenReturn = function (value) {\n if (wrapsPrimitiveReceiver && isPrimitive(value)) {\n return this._then(\n wrapper(value, 2),\n undefined,\n undefined,\n undefined,\n undefined\n );\n }\n return this._then(returner, undefined, undefined, value, undefined);\n};\n\nPromise.prototype[\"throw\"] =\nPromise.prototype.thenThrow = function (reason) {\n if (wrapsPrimitiveReceiver && isPrimitive(reason)) {\n return this._then(\n wrapper(reason, 1),\n undefined,\n undefined,\n undefined,\n undefined\n );\n }\n return this._then(thrower, undefined, undefined, reason, undefined);\n};\n};\n\n},{\"./util.js\":38}],12:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL) {\nvar PromiseReduce = Promise.reduce;\n\nPromise.prototype.each = function (fn) {\n return PromiseReduce(this, fn, null, INTERNAL);\n};\n\nPromise.each = function (promises, fn) {\n return PromiseReduce(promises, fn, null, INTERNAL);\n};\n};\n\n},{}],13:[function(_dereq_,module,exports){\n\"use strict\";\nvar es5 = _dereq_(\"./es5.js\");\nvar Objectfreeze = es5.freeze;\nvar util = _dereq_(\"./util.js\");\nvar inherits = util.inherits;\nvar notEnumerableProp = util.notEnumerableProp;\n\nfunction subError(nameProperty, defaultMessage) {\n function SubError(message) {\n if (!(this instanceof SubError)) return new SubError(message);\n notEnumerableProp(this, \"message\",\n typeof message === \"string\" ? message : defaultMessage);\n notEnumerableProp(this, \"name\", nameProperty);\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n Error.call(this);\n }\n }\n inherits(SubError, Error);\n return SubError;\n}\n\nvar _TypeError, _RangeError;\nvar Warning = subError(\"Warning\", \"warning\");\nvar CancellationError = subError(\"CancellationError\", \"cancellation error\");\nvar TimeoutError = subError(\"TimeoutError\", \"timeout error\");\nvar AggregateError = subError(\"AggregateError\", \"aggregate error\");\ntry {\n _TypeError = TypeError;\n _RangeError = RangeError;\n} catch(e) {\n _TypeError = subError(\"TypeError\", \"type error\");\n _RangeError = subError(\"RangeError\", \"range error\");\n}\n\nvar methods = (\"join pop push shift unshift slice filter forEach some \" +\n \"every map indexOf lastIndexOf reduce reduceRight sort reverse\").split(\" \");\n\nfor (var i = 0; i < methods.length; ++i) {\n if (typeof Array.prototype[methods[i]] === \"function\") {\n AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];\n }\n}\n\nes5.defineProperty(AggregateError.prototype, \"length\", {\n value: 0,\n configurable: false,\n writable: true,\n enumerable: true\n});\nAggregateError.prototype[\"isOperational\"] = true;\nvar level = 0;\nAggregateError.prototype.toString = function() {\n var indent = Array(level * 4 + 1).join(\" \");\n var ret = \"\\n\" + indent + \"AggregateError of:\" + \"\\n\";\n level++;\n indent = Array(level * 4 + 1).join(\" \");\n for (var i = 0; i < this.length; ++i) {\n var str = this[i] === this ? \"[Circular AggregateError]\" : this[i] + \"\";\n var lines = str.split(\"\\n\");\n for (var j = 0; j < lines.length; ++j) {\n lines[j] = indent + lines[j];\n }\n str = lines.join(\"\\n\");\n ret += str + \"\\n\";\n }\n level--;\n return ret;\n};\n\nfunction OperationalError(message) {\n if (!(this instanceof OperationalError))\n return new OperationalError(message);\n notEnumerableProp(this, \"name\", \"OperationalError\");\n notEnumerableProp(this, \"message\", message);\n this.cause = message;\n this[\"isOperational\"] = true;\n\n if (message instanceof Error) {\n notEnumerableProp(this, \"message\", message.message);\n notEnumerableProp(this, \"stack\", message.stack);\n } else if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n\n}\ninherits(OperationalError, Error);\n\nvar errorTypes = Error[\"__BluebirdErrorTypes__\"];\nif (!errorTypes) {\n errorTypes = Objectfreeze({\n CancellationError: CancellationError,\n TimeoutError: TimeoutError,\n OperationalError: OperationalError,\n RejectionError: OperationalError,\n AggregateError: AggregateError\n });\n notEnumerableProp(Error, \"__BluebirdErrorTypes__\", errorTypes);\n}\n\nmodule.exports = {\n Error: Error,\n TypeError: _TypeError,\n RangeError: _RangeError,\n CancellationError: errorTypes.CancellationError,\n OperationalError: errorTypes.OperationalError,\n TimeoutError: errorTypes.TimeoutError,\n AggregateError: errorTypes.AggregateError,\n Warning: Warning\n};\n\n},{\"./es5.js\":14,\"./util.js\":38}],14:[function(_dereq_,module,exports){\nvar isES5 = (function(){\n \"use strict\";\n return this === undefined;\n})();\n\nif (isES5) {\n module.exports = {\n freeze: Object.freeze,\n defineProperty: Object.defineProperty,\n getDescriptor: Object.getOwnPropertyDescriptor,\n keys: Object.keys,\n names: Object.getOwnPropertyNames,\n getPrototypeOf: Object.getPrototypeOf,\n isArray: Array.isArray,\n isES5: isES5,\n propertyIsWritable: function(obj, prop) {\n var descriptor = Object.getOwnPropertyDescriptor(obj, prop);\n return !!(!descriptor || descriptor.writable || descriptor.set);\n }\n };\n} else {\n var has = {}.hasOwnProperty;\n var str = {}.toString;\n var proto = {}.constructor.prototype;\n\n var ObjectKeys = function (o) {\n var ret = [];\n for (var key in o) {\n if (has.call(o, key)) {\n ret.push(key);\n }\n }\n return ret;\n };\n\n var ObjectGetDescriptor = function(o, key) {\n return {value: o[key]};\n };\n\n var ObjectDefineProperty = function (o, key, desc) {\n o[key] = desc.value;\n return o;\n };\n\n var ObjectFreeze = function (obj) {\n return obj;\n };\n\n var ObjectGetPrototypeOf = function (obj) {\n try {\n return Object(obj).constructor.prototype;\n }\n catch (e) {\n return proto;\n }\n };\n\n var ArrayIsArray = function (obj) {\n try {\n return str.call(obj) === \"[object Array]\";\n }\n catch(e) {\n return false;\n }\n };\n\n module.exports = {\n isArray: ArrayIsArray,\n keys: ObjectKeys,\n names: ObjectKeys,\n defineProperty: ObjectDefineProperty,\n getDescriptor: ObjectGetDescriptor,\n freeze: ObjectFreeze,\n getPrototypeOf: ObjectGetPrototypeOf,\n isES5: isES5,\n propertyIsWritable: function() {\n return true;\n }\n };\n}\n\n},{}],15:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL) {\nvar PromiseMap = Promise.map;\n\nPromise.prototype.filter = function (fn, options) {\n return PromiseMap(this, fn, options, INTERNAL);\n};\n\nPromise.filter = function (promises, fn, options) {\n return PromiseMap(promises, fn, options, INTERNAL);\n};\n};\n\n},{}],16:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, NEXT_FILTER, tryConvertToPromise) {\nvar util = _dereq_(\"./util.js\");\nvar wrapsPrimitiveReceiver = util.wrapsPrimitiveReceiver;\nvar isPrimitive = util.isPrimitive;\nvar thrower = util.thrower;\n\nfunction returnThis() {\n return this;\n}\nfunction throwThis() {\n throw this;\n}\nfunction return$(r) {\n return function() {\n return r;\n };\n}\nfunction throw$(r) {\n return function() {\n throw r;\n };\n}\nfunction promisedFinally(ret, reasonOrValue, isFulfilled) {\n var then;\n if (wrapsPrimitiveReceiver && isPrimitive(reasonOrValue)) {\n then = isFulfilled ? return$(reasonOrValue) : throw$(reasonOrValue);\n } else {\n then = isFulfilled ? returnThis : throwThis;\n }\n return ret._then(then, thrower, undefined, reasonOrValue, undefined);\n}\n\nfunction finallyHandler(reasonOrValue) {\n var promise = this.promise;\n var handler = this.handler;\n\n var ret = promise._isBound()\n ? handler.call(promise._boundTo)\n : handler();\n\n if (ret !== undefined) {\n var maybePromise = tryConvertToPromise(ret, promise);\n if (maybePromise instanceof Promise) {\n maybePromise = maybePromise._target();\n return promisedFinally(maybePromise, reasonOrValue,\n promise.isFulfilled());\n }\n }\n\n if (promise.isRejected()) {\n NEXT_FILTER.e = reasonOrValue;\n return NEXT_FILTER;\n } else {\n return reasonOrValue;\n }\n}\n\nfunction tapHandler(value) {\n var promise = this.promise;\n var handler = this.handler;\n\n var ret = promise._isBound()\n ? handler.call(promise._boundTo, value)\n : handler(value);\n\n if (ret !== undefined) {\n var maybePromise = tryConvertToPromise(ret, promise);\n if (maybePromise instanceof Promise) {\n maybePromise = maybePromise._target();\n return promisedFinally(maybePromise, value, true);\n }\n }\n return value;\n}\n\nPromise.prototype._passThroughHandler = function (handler, isFinally) {\n if (typeof handler !== \"function\") return this.then();\n\n var promiseAndHandler = {\n promise: this,\n handler: handler\n };\n\n return this._then(\n isFinally ? finallyHandler : tapHandler,\n isFinally ? finallyHandler : undefined, undefined,\n promiseAndHandler, undefined);\n};\n\nPromise.prototype.lastly =\nPromise.prototype[\"finally\"] = function (handler) {\n return this._passThroughHandler(handler, true);\n};\n\nPromise.prototype.tap = function (handler) {\n return this._passThroughHandler(handler, false);\n};\n};\n\n},{\"./util.js\":38}],17:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise,\n apiRejection,\n INTERNAL,\n tryConvertToPromise) {\nvar errors = _dereq_(\"./errors.js\");\nvar TypeError = errors.TypeError;\nvar util = _dereq_(\"./util.js\");\nvar errorObj = util.errorObj;\nvar tryCatch = util.tryCatch;\nvar yieldHandlers = [];\n\nfunction promiseFromYieldHandler(value, yieldHandlers, traceParent) {\n for (var i = 0; i < yieldHandlers.length; ++i) {\n traceParent._pushContext();\n var result = tryCatch(yieldHandlers[i])(value);\n traceParent._popContext();\n if (result === errorObj) {\n traceParent._pushContext();\n var ret = Promise.reject(errorObj.e);\n traceParent._popContext();\n return ret;\n }\n var maybePromise = tryConvertToPromise(result, traceParent);\n if (maybePromise instanceof Promise) return maybePromise;\n }\n return null;\n}\n\nfunction PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) {\n var promise = this._promise = new Promise(INTERNAL);\n promise._captureStackTrace();\n this._stack = stack;\n this._generatorFunction = generatorFunction;\n this._receiver = receiver;\n this._generator = undefined;\n this._yieldHandlers = typeof yieldHandler === \"function\"\n ? [yieldHandler].concat(yieldHandlers)\n : yieldHandlers;\n}\n\nPromiseSpawn.prototype.promise = function () {\n return this._promise;\n};\n\nPromiseSpawn.prototype._run = function () {\n this._generator = this._generatorFunction.call(this._receiver);\n this._receiver =\n this._generatorFunction = undefined;\n this._next(undefined);\n};\n\nPromiseSpawn.prototype._continue = function (result) {\n if (result === errorObj) {\n return this._promise._rejectCallback(result.e, false, true);\n }\n\n var value = result.value;\n if (result.done === true) {\n this._promise._resolveCallback(value);\n } else {\n var maybePromise = tryConvertToPromise(value, this._promise);\n if (!(maybePromise instanceof Promise)) {\n maybePromise =\n promiseFromYieldHandler(maybePromise,\n this._yieldHandlers,\n this._promise);\n if (maybePromise === null) {\n this._throw(\n new TypeError(\n \"A value %s was yielded that could not be treated as a promise\\u000a\\u000a See http://goo.gl/4Y4pDk\\u000a\\u000a\".replace(\"%s\", value) +\n \"From coroutine:\\u000a\" +\n this._stack.split(\"\\n\").slice(1, -7).join(\"\\n\")\n )\n );\n return;\n }\n }\n maybePromise._then(\n this._next,\n this._throw,\n undefined,\n this,\n null\n );\n }\n};\n\nPromiseSpawn.prototype._throw = function (reason) {\n this._promise._attachExtraTrace(reason);\n this._promise._pushContext();\n var result = tryCatch(this._generator[\"throw\"])\n .call(this._generator, reason);\n this._promise._popContext();\n this._continue(result);\n};\n\nPromiseSpawn.prototype._next = function (value) {\n this._promise._pushContext();\n var result = tryCatch(this._generator.next).call(this._generator, value);\n this._promise._popContext();\n this._continue(result);\n};\n\nPromise.coroutine = function (generatorFunction, options) {\n if (typeof generatorFunction !== \"function\") {\n throw new TypeError(\"generatorFunction must be a function\\u000a\\u000a See http://goo.gl/6Vqhm0\\u000a\");\n }\n var yieldHandler = Object(options).yieldHandler;\n var PromiseSpawn$ = PromiseSpawn;\n var stack = new Error().stack;\n return function () {\n var generator = generatorFunction.apply(this, arguments);\n var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler,\n stack);\n spawn._generator = generator;\n spawn._next(undefined);\n return spawn.promise();\n };\n};\n\nPromise.coroutine.addYieldHandler = function(fn) {\n if (typeof fn !== \"function\") throw new TypeError(\"fn must be a function\\u000a\\u000a See http://goo.gl/916lJJ\\u000a\");\n yieldHandlers.push(fn);\n};\n\nPromise.spawn = function (generatorFunction) {\n if (typeof generatorFunction !== \"function\") {\n return apiRejection(\"generatorFunction must be a function\\u000a\\u000a See http://goo.gl/6Vqhm0\\u000a\");\n }\n var spawn = new PromiseSpawn(generatorFunction, this);\n var ret = spawn.promise();\n spawn._run(Promise.spawn);\n return ret;\n};\n};\n\n},{\"./errors.js\":13,\"./util.js\":38}],18:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports =\nfunction(Promise, PromiseArray, tryConvertToPromise, INTERNAL) {\nvar util = _dereq_(\"./util.js\");\nvar canEvaluate = util.canEvaluate;\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\nvar reject;\n\nif (!true) {\nif (canEvaluate) {\n var thenCallback = function(i) {\n return new Function(\"value\", \"holder\", \" \\n\\\n 'use strict'; \\n\\\n holder.pIndex = value; \\n\\\n holder.checkFulfillment(this); \\n\\\n \".replace(/Index/g, i));\n };\n\n var caller = function(count) {\n var values = [];\n for (var i = 1; i <= count; ++i) values.push(\"holder.p\" + i);\n return new Function(\"holder\", \" \\n\\\n 'use strict'; \\n\\\n var callback = holder.fn; \\n\\\n return callback(values); \\n\\\n \".replace(/values/g, values.join(\", \")));\n };\n var thenCallbacks = [];\n var callers = [undefined];\n for (var i = 1; i <= 5; ++i) {\n thenCallbacks.push(thenCallback(i));\n callers.push(caller(i));\n }\n\n var Holder = function(total, fn) {\n this.p1 = this.p2 = this.p3 = this.p4 = this.p5 = null;\n this.fn = fn;\n this.total = total;\n this.now = 0;\n };\n\n Holder.prototype.callers = callers;\n Holder.prototype.checkFulfillment = function(promise) {\n var now = this.now;\n now++;\n var total = this.total;\n if (now >= total) {\n var handler = this.callers[total];\n promise._pushContext();\n var ret = tryCatch(handler)(this);\n promise._popContext();\n if (ret === errorObj) {\n promise._rejectCallback(ret.e, false, true);\n } else {\n promise._resolveCallback(ret);\n }\n } else {\n this.now = now;\n }\n };\n\n var reject = function (reason) {\n this._reject(reason);\n };\n}\n}\n\nPromise.join = function () {\n var last = arguments.length - 1;\n var fn;\n if (last > 0 && typeof arguments[last] === \"function\") {\n fn = arguments[last];\n if (!true) {\n if (last < 6 && canEvaluate) {\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n var holder = new Holder(last, fn);\n var callbacks = thenCallbacks;\n for (var i = 0; i < last; ++i) {\n var maybePromise = tryConvertToPromise(arguments[i], ret);\n if (maybePromise instanceof Promise) {\n maybePromise = maybePromise._target();\n if (maybePromise._isPending()) {\n maybePromise._then(callbacks[i], reject,\n undefined, ret, holder);\n } else if (maybePromise._isFulfilled()) {\n callbacks[i].call(ret,\n maybePromise._value(), holder);\n } else {\n ret._reject(maybePromise._reason());\n }\n } else {\n callbacks[i].call(ret, maybePromise, holder);\n }\n }\n return ret;\n }\n }\n }\n var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];}\n if (fn) args.pop();\n var ret = new PromiseArray(args).promise();\n return fn !== undefined ? ret.spread(fn) : ret;\n};\n\n};\n\n},{\"./util.js\":38}],19:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise,\n PromiseArray,\n apiRejection,\n tryConvertToPromise,\n INTERNAL) {\nvar async = _dereq_(\"./async.js\");\nvar util = _dereq_(\"./util.js\");\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\nvar PENDING = {};\nvar EMPTY_ARRAY = [];\n\nfunction MappingPromiseArray(promises, fn, limit, _filter) {\n this.constructor$(promises);\n this._promise._captureStackTrace();\n this._callback = fn;\n this._preservedValues = _filter === INTERNAL\n ? new Array(this.length())\n : null;\n this._limit = limit;\n this._inFlight = 0;\n this._queue = limit >= 1 ? [] : EMPTY_ARRAY;\n async.invoke(init, this, undefined);\n}\nutil.inherits(MappingPromiseArray, PromiseArray);\nfunction init() {this._init$(undefined, -2);}\n\nMappingPromiseArray.prototype._init = function () {};\n\nMappingPromiseArray.prototype._promiseFulfilled = function (value, index) {\n var values = this._values;\n var length = this.length();\n var preservedValues = this._preservedValues;\n var limit = this._limit;\n if (values[index] === PENDING) {\n values[index] = value;\n if (limit >= 1) {\n this._inFlight--;\n this._drainQueue();\n if (this._isResolved()) return;\n }\n } else {\n if (limit >= 1 && this._inFlight >= limit) {\n values[index] = value;\n this._queue.push(index);\n return;\n }\n if (preservedValues !== null) preservedValues[index] = value;\n\n var callback = this._callback;\n var receiver = this._promise._boundTo;\n this._promise._pushContext();\n var ret = tryCatch(callback).call(receiver, value, index, length);\n this._promise._popContext();\n if (ret === errorObj) return this._reject(ret.e);\n\n var maybePromise = tryConvertToPromise(ret, this._promise);\n if (maybePromise instanceof Promise) {\n maybePromise = maybePromise._target();\n if (maybePromise._isPending()) {\n if (limit >= 1) this._inFlight++;\n values[index] = PENDING;\n return maybePromise._proxyPromiseArray(this, index);\n } else if (maybePromise._isFulfilled()) {\n ret = maybePromise._value();\n } else {\n return this._reject(maybePromise._reason());\n }\n }\n values[index] = ret;\n }\n var totalResolved = ++this._totalResolved;\n if (totalResolved >= length) {\n if (preservedValues !== null) {\n this._filter(values, preservedValues);\n } else {\n this._resolve(values);\n }\n\n }\n};\n\nMappingPromiseArray.prototype._drainQueue = function () {\n var queue = this._queue;\n var limit = this._limit;\n var values = this._values;\n while (queue.length > 0 && this._inFlight < limit) {\n if (this._isResolved()) return;\n var index = queue.pop();\n this._promiseFulfilled(values[index], index);\n }\n};\n\nMappingPromiseArray.prototype._filter = function (booleans, values) {\n var len = values.length;\n var ret = new Array(len);\n var j = 0;\n for (var i = 0; i < len; ++i) {\n if (booleans[i]) ret[j++] = values[i];\n }\n ret.length = j;\n this._resolve(ret);\n};\n\nMappingPromiseArray.prototype.preservedValues = function () {\n return this._preservedValues;\n};\n\nfunction map(promises, fn, options, _filter) {\n var limit = typeof options === \"object\" && options !== null\n ? options.concurrency\n : 0;\n limit = typeof limit === \"number\" &&\n isFinite(limit) && limit >= 1 ? limit : 0;\n return new MappingPromiseArray(promises, fn, limit, _filter);\n}\n\nPromise.prototype.map = function (fn, options) {\n if (typeof fn !== \"function\") return apiRejection(\"fn must be a function\\u000a\\u000a See http://goo.gl/916lJJ\\u000a\");\n\n return map(this, fn, options, null).promise();\n};\n\nPromise.map = function (promises, fn, options, _filter) {\n if (typeof fn !== \"function\") return apiRejection(\"fn must be a function\\u000a\\u000a See http://goo.gl/916lJJ\\u000a\");\n return map(promises, fn, options, _filter).promise();\n};\n\n\n};\n\n},{\"./async.js\":2,\"./util.js\":38}],20:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports =\nfunction(Promise, INTERNAL, tryConvertToPromise, apiRejection) {\nvar util = _dereq_(\"./util.js\");\nvar tryCatch = util.tryCatch;\n\nPromise.method = function (fn) {\n if (typeof fn !== \"function\") {\n throw new Promise.TypeError(\"fn must be a function\\u000a\\u000a See http://goo.gl/916lJJ\\u000a\");\n }\n return function () {\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n ret._pushContext();\n var value = tryCatch(fn).apply(this, arguments);\n ret._popContext();\n ret._resolveFromSyncValue(value);\n return ret;\n };\n};\n\nPromise.attempt = Promise[\"try\"] = function (fn, args, ctx) {\n if (typeof fn !== \"function\") {\n return apiRejection(\"fn must be a function\\u000a\\u000a See http://goo.gl/916lJJ\\u000a\");\n }\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n ret._pushContext();\n var value = util.isArray(args)\n ? tryCatch(fn).apply(ctx, args)\n : tryCatch(fn).call(ctx, args);\n ret._popContext();\n ret._resolveFromSyncValue(value);\n return ret;\n};\n\nPromise.prototype._resolveFromSyncValue = function (value) {\n if (value === util.errorObj) {\n this._rejectCallback(value.e, false, true);\n } else {\n this._resolveCallback(value, true);\n }\n};\n};\n\n},{\"./util.js\":38}],21:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise) {\nvar util = _dereq_(\"./util.js\");\nvar async = _dereq_(\"./async.js\");\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\n\nfunction spreadAdapter(val, nodeback) {\n var promise = this;\n if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback);\n var ret = tryCatch(nodeback).apply(promise._boundTo, [null].concat(val));\n if (ret === errorObj) {\n async.throwLater(ret.e);\n }\n}\n\nfunction successAdapter(val, nodeback) {\n var promise = this;\n var receiver = promise._boundTo;\n var ret = val === undefined\n ? tryCatch(nodeback).call(receiver, null)\n : tryCatch(nodeback).call(receiver, null, val);\n if (ret === errorObj) {\n async.throwLater(ret.e);\n }\n}\nfunction errorAdapter(reason, nodeback) {\n var promise = this;\n if (!reason) {\n var target = promise._target();\n var newReason = target._getCarriedStackTrace();\n newReason.cause = reason;\n reason = newReason;\n }\n var ret = tryCatch(nodeback).call(promise._boundTo, reason);\n if (ret === errorObj) {\n async.throwLater(ret.e);\n }\n}\n\nPromise.prototype.nodeify = function (nodeback, options) {\n if (typeof nodeback == \"function\") {\n var adapter = successAdapter;\n if (options !== undefined && Object(options).spread) {\n adapter = spreadAdapter;\n }\n this._then(\n adapter,\n errorAdapter,\n undefined,\n this,\n nodeback\n );\n }\n return this;\n};\n};\n\n},{\"./async.js\":2,\"./util.js\":38}],22:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, PromiseArray) {\nvar util = _dereq_(\"./util.js\");\nvar async = _dereq_(\"./async.js\");\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\n\nPromise.prototype.progressed = function (handler) {\n return this._then(undefined, undefined, handler, undefined, undefined);\n};\n\nPromise.prototype._progress = function (progressValue) {\n if (this._isFollowingOrFulfilledOrRejected()) return;\n this._target()._progressUnchecked(progressValue);\n\n};\n\nPromise.prototype._progressHandlerAt = function (index) {\n return index === 0\n ? this._progressHandler0\n : this[(index << 2) + index - 5 + 2];\n};\n\nPromise.prototype._doProgressWith = function (progression) {\n var progressValue = progression.value;\n var handler = progression.handler;\n var promise = progression.promise;\n var receiver = progression.receiver;\n\n var ret = tryCatch(handler).call(receiver, progressValue);\n if (ret === errorObj) {\n if (ret.e != null &&\n ret.e.name !== \"StopProgressPropagation\") {\n var trace = util.canAttachTrace(ret.e)\n ? ret.e : new Error(util.toString(ret.e));\n promise._attachExtraTrace(trace);\n promise._progress(ret.e);\n }\n } else if (ret instanceof Promise) {\n ret._then(promise._progress, null, null, promise, undefined);\n } else {\n promise._progress(ret);\n }\n};\n\n\nPromise.prototype._progressUnchecked = function (progressValue) {\n var len = this._length();\n var progress = this._progress;\n for (var i = 0; i < len; i++) {\n var handler = this._progressHandlerAt(i);\n var promise = this._promiseAt(i);\n if (!(promise instanceof Promise)) {\n var receiver = this._receiverAt(i);\n if (typeof handler === \"function\") {\n handler.call(receiver, progressValue, promise);\n } else if (receiver instanceof PromiseArray &&\n !receiver._isResolved()) {\n receiver._promiseProgressed(progressValue, promise);\n }\n continue;\n }\n\n if (typeof handler === \"function\") {\n async.invoke(this._doProgressWith, this, {\n handler: handler,\n promise: promise,\n receiver: this._receiverAt(i),\n value: progressValue\n });\n } else {\n async.invoke(progress, promise, progressValue);\n }\n }\n};\n};\n\n},{\"./async.js\":2,\"./util.js\":38}],23:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function() {\nvar makeSelfResolutionError = function () {\n return new TypeError(\"circular promise resolution chain\\u000a\\u000a See http://goo.gl/LhFpo0\\u000a\");\n};\nvar reflect = function() {\n return new Promise.PromiseInspection(this._target());\n};\nvar apiRejection = function(msg) {\n return Promise.reject(new TypeError(msg));\n};\nvar util = _dereq_(\"./util.js\");\nvar async = _dereq_(\"./async.js\");\nvar errors = _dereq_(\"./errors.js\");\nvar TypeError = Promise.TypeError = errors.TypeError;\nPromise.RangeError = errors.RangeError;\nPromise.CancellationError = errors.CancellationError;\nPromise.TimeoutError = errors.TimeoutError;\nPromise.OperationalError = errors.OperationalError;\nPromise.RejectionError = errors.OperationalError;\nPromise.AggregateError = errors.AggregateError;\nvar INTERNAL = function(){};\nvar APPLY = {};\nvar NEXT_FILTER = {e: null};\nvar tryConvertToPromise = _dereq_(\"./thenables.js\")(Promise, INTERNAL);\nvar PromiseArray =\n _dereq_(\"./promise_array.js\")(Promise, INTERNAL,\n tryConvertToPromise, apiRejection);\nvar CapturedTrace = _dereq_(\"./captured_trace.js\")();\nvar isDebugging = _dereq_(\"./debuggability.js\")(Promise, CapturedTrace);\n /*jshint unused:false*/\nvar createContext =\n _dereq_(\"./context.js\")(Promise, CapturedTrace, isDebugging);\nvar CatchFilter = _dereq_(\"./catch_filter.js\")(NEXT_FILTER);\nvar PromiseResolver = _dereq_(\"./promise_resolver.js\");\nvar nodebackForPromise = PromiseResolver._nodebackForPromise;\nvar errorObj = util.errorObj;\nvar tryCatch = util.tryCatch;\nfunction Promise(resolver) {\n if (typeof resolver !== \"function\") {\n throw new TypeError(\"the promise constructor requires a resolver function\\u000a\\u000a See http://goo.gl/EC22Yn\\u000a\");\n }\n if (this.constructor !== Promise) {\n throw new TypeError(\"the promise constructor cannot be invoked directly\\u000a\\u000a See http://goo.gl/KsIlge\\u000a\");\n }\n this._bitField = 0;\n this._fulfillmentHandler0 = undefined;\n this._rejectionHandler0 = undefined;\n this._progressHandler0 = undefined;\n this._promise0 = undefined;\n this._receiver0 = undefined;\n this._settledValue = undefined;\n if (resolver !== INTERNAL) this._resolveFromResolver(resolver);\n}\n\nPromise.prototype.toString = function () {\n return \"[object Promise]\";\n};\n\nPromise.prototype.caught = Promise.prototype[\"catch\"] = function (fn) {\n var len = arguments.length;\n if (len > 1) {\n var catchInstances = new Array(len - 1),\n j = 0, i;\n for (i = 0; i < len - 1; ++i) {\n var item = arguments[i];\n if (typeof item === \"function\") {\n catchInstances[j++] = item;\n } else {\n return Promise.reject(\n new TypeError(\"Catch filter must inherit from Error or be a simple predicate function\\u000a\\u000a See http://goo.gl/o84o68\\u000a\"));\n }\n }\n catchInstances.length = j;\n fn = arguments[i];\n var catchFilter = new CatchFilter(catchInstances, fn, this);\n return this._then(undefined, catchFilter.doFilter, undefined,\n catchFilter, undefined);\n }\n return this._then(undefined, fn, undefined, undefined, undefined);\n};\n\nPromise.prototype.reflect = function () {\n return this._then(reflect, reflect, undefined, this, undefined);\n};\n\nPromise.prototype.then = function (didFulfill, didReject, didProgress) {\n if (isDebugging() && arguments.length > 0 &&\n typeof didFulfill !== \"function\" &&\n typeof didReject !== \"function\") {\n var msg = \".then() only accepts functions but was passed: \" +\n util.classString(didFulfill);\n if (arguments.length > 1) {\n msg += \", \" + util.classString(didReject);\n }\n this._warn(msg);\n }\n return this._then(didFulfill, didReject, didProgress,\n undefined, undefined);\n};\n\nPromise.prototype.done = function (didFulfill, didReject, didProgress) {\n var promise = this._then(didFulfill, didReject, didProgress,\n undefined, undefined);\n promise._setIsFinal();\n};\n\nPromise.prototype.spread = function (didFulfill, didReject) {\n return this.all()._then(didFulfill, didReject, undefined, APPLY, undefined);\n};\n\nPromise.prototype.isCancellable = function () {\n return !this.isResolved() &&\n this._cancellable();\n};\n\nPromise.prototype.toJSON = function () {\n var ret = {\n isFulfilled: false,\n isRejected: false,\n fulfillmentValue: undefined,\n rejectionReason: undefined\n };\n if (this.isFulfilled()) {\n ret.fulfillmentValue = this.value();\n ret.isFulfilled = true;\n } else if (this.isRejected()) {\n ret.rejectionReason = this.reason();\n ret.isRejected = true;\n }\n return ret;\n};\n\nPromise.prototype.all = function () {\n return new PromiseArray(this).promise();\n};\n\nPromise.prototype.error = function (fn) {\n return this.caught(util.originatesFromRejection, fn);\n};\n\nPromise.is = function (val) {\n return val instanceof Promise;\n};\n\nPromise.fromNode = function(fn) {\n var ret = new Promise(INTERNAL);\n var result = tryCatch(fn)(nodebackForPromise(ret));\n if (result === errorObj) {\n ret._rejectCallback(result.e, true, true);\n }\n return ret;\n};\n\nPromise.all = function (promises) {\n return new PromiseArray(promises).promise();\n};\n\nPromise.defer = Promise.pending = function () {\n var promise = new Promise(INTERNAL);\n return new PromiseResolver(promise);\n};\n\nPromise.cast = function (obj) {\n var ret = tryConvertToPromise(obj);\n if (!(ret instanceof Promise)) {\n var val = ret;\n ret = new Promise(INTERNAL);\n ret._fulfillUnchecked(val);\n }\n return ret;\n};\n\nPromise.resolve = Promise.fulfilled = Promise.cast;\n\nPromise.reject = Promise.rejected = function (reason) {\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n ret._rejectCallback(reason, true);\n return ret;\n};\n\nPromise.setScheduler = function(fn) {\n if (typeof fn !== \"function\") throw new TypeError(\"fn must be a function\\u000a\\u000a See http://goo.gl/916lJJ\\u000a\");\n var prev = async._schedule;\n async._schedule = fn;\n return prev;\n};\n\nPromise.prototype._then = function (\n didFulfill,\n didReject,\n didProgress,\n receiver,\n internalData\n) {\n var haveInternalData = internalData !== undefined;\n var ret = haveInternalData ? internalData : new Promise(INTERNAL);\n\n if (!haveInternalData) {\n ret._propagateFrom(this, 4 | 1);\n ret._captureStackTrace();\n }\n\n var target = this._target();\n if (target !== this) {\n if (receiver === undefined) receiver = this._boundTo;\n if (!haveInternalData) ret._setIsMigrated();\n }\n\n var callbackIndex =\n target._addCallbacks(didFulfill, didReject, didProgress, ret, receiver);\n\n if (target._isResolved() && !target._isSettlePromisesQueued()) {\n async.invoke(\n target._settlePromiseAtPostResolution, target, callbackIndex);\n }\n\n return ret;\n};\n\nPromise.prototype._settlePromiseAtPostResolution = function (index) {\n if (this._isRejectionUnhandled()) this._unsetRejectionIsUnhandled();\n this._settlePromiseAt(index);\n};\n\nPromise.prototype._length = function () {\n return this._bitField & 131071;\n};\n\nPromise.prototype._isFollowingOrFulfilledOrRejected = function () {\n return (this._bitField & 939524096) > 0;\n};\n\nPromise.prototype._isFollowing = function () {\n return (this._bitField & 536870912) === 536870912;\n};\n\nPromise.prototype._setLength = function (len) {\n this._bitField = (this._bitField & -131072) |\n (len & 131071);\n};\n\nPromise.prototype._setFulfilled = function () {\n this._bitField = this._bitField | 268435456;\n};\n\nPromise.prototype._setRejected = function () {\n this._bitField = this._bitField | 134217728;\n};\n\nPromise.prototype._setFollowing = function () {\n this._bitField = this._bitField | 536870912;\n};\n\nPromise.prototype._setIsFinal = function () {\n this._bitField = this._bitField | 33554432;\n};\n\nPromise.prototype._isFinal = function () {\n return (this._bitField & 33554432) > 0;\n};\n\nPromise.prototype._cancellable = function () {\n return (this._bitField & 67108864) > 0;\n};\n\nPromise.prototype._setCancellable = function () {\n this._bitField = this._bitField | 67108864;\n};\n\nPromise.prototype._unsetCancellable = function () {\n this._bitField = this._bitField & (~67108864);\n};\n\nPromise.prototype._setIsMigrated = function () {\n this._bitField = this._bitField | 4194304;\n};\n\nPromise.prototype._unsetIsMigrated = function () {\n this._bitField = this._bitField & (~4194304);\n};\n\nPromise.prototype._isMigrated = function () {\n return (this._bitField & 4194304) > 0;\n};\n\nPromise.prototype._receiverAt = function (index) {\n var ret = index === 0\n ? this._receiver0\n : this[\n index * 5 - 5 + 4];\n if (ret === undefined && this._isBound()) {\n return this._boundTo;\n }\n return ret;\n};\n\nPromise.prototype._promiseAt = function (index) {\n return index === 0\n ? this._promise0\n : this[index * 5 - 5 + 3];\n};\n\nPromise.prototype._fulfillmentHandlerAt = function (index) {\n return index === 0\n ? this._fulfillmentHandler0\n : this[index * 5 - 5 + 0];\n};\n\nPromise.prototype._rejectionHandlerAt = function (index) {\n return index === 0\n ? this._rejectionHandler0\n : this[index * 5 - 5 + 1];\n};\n\nPromise.prototype._migrateCallbacks = function (follower, index) {\n var fulfill = follower._fulfillmentHandlerAt(index);\n var reject = follower._rejectionHandlerAt(index);\n var progress = follower._progressHandlerAt(index);\n var promise = follower._promiseAt(index);\n var receiver = follower._receiverAt(index);\n if (promise instanceof Promise) promise._setIsMigrated();\n this._addCallbacks(fulfill, reject, progress, promise, receiver);\n};\n\nPromise.prototype._addCallbacks = function (\n fulfill,\n reject,\n progress,\n promise,\n receiver\n) {\n var index = this._length();\n\n if (index >= 131071 - 5) {\n index = 0;\n this._setLength(0);\n }\n\n if (index === 0) {\n this._promise0 = promise;\n if (receiver !== undefined) this._receiver0 = receiver;\n if (typeof fulfill === \"function\" && !this._isCarryingStackTrace())\n this._fulfillmentHandler0 = fulfill;\n if (typeof reject === \"function\") this._rejectionHandler0 = reject;\n if (typeof progress === \"function\") this._progressHandler0 = progress;\n } else {\n var base = index * 5 - 5;\n this[base + 3] = promise;\n this[base + 4] = receiver;\n if (typeof fulfill === \"function\")\n this[base + 0] = fulfill;\n if (typeof reject === \"function\")\n this[base + 1] = reject;\n if (typeof progress === \"function\")\n this[base + 2] = progress;\n }\n this._setLength(index + 1);\n return index;\n};\n\nPromise.prototype._setProxyHandlers = function (receiver, promiseSlotValue) {\n var index = this._length();\n\n if (index >= 131071 - 5) {\n index = 0;\n this._setLength(0);\n }\n if (index === 0) {\n this._promise0 = promiseSlotValue;\n this._receiver0 = receiver;\n } else {\n var base = index * 5 - 5;\n this[base + 3] = promiseSlotValue;\n this[base + 4] = receiver;\n }\n this._setLength(index + 1);\n};\n\nPromise.prototype._proxyPromiseArray = function (promiseArray, index) {\n this._setProxyHandlers(promiseArray, index);\n};\n\nPromise.prototype._resolveCallback = function(value, shouldBind) {\n if (this._isFollowingOrFulfilledOrRejected()) return;\n if (value === this)\n return this._rejectCallback(makeSelfResolutionError(), false, true);\n var maybePromise = tryConvertToPromise(value, this);\n if (!(maybePromise instanceof Promise)) return this._fulfill(value);\n\n var propagationFlags = 1 | (shouldBind ? 4 : 0);\n this._propagateFrom(maybePromise, propagationFlags);\n var promise = maybePromise._target();\n if (promise._isPending()) {\n var len = this._length();\n for (var i = 0; i < len; ++i) {\n promise._migrateCallbacks(this, i);\n }\n this._setFollowing();\n this._setLength(0);\n this._setFollowee(promise);\n } else if (promise._isFulfilled()) {\n this._fulfillUnchecked(promise._value());\n } else {\n this._rejectUnchecked(promise._reason(),\n promise._getCarriedStackTrace());\n }\n};\n\nPromise.prototype._rejectCallback =\nfunction(reason, synchronous, shouldNotMarkOriginatingFromRejection) {\n if (!shouldNotMarkOriginatingFromRejection) {\n util.markAsOriginatingFromRejection(reason);\n }\n var trace = util.ensureErrorObject(reason);\n var hasStack = trace === reason;\n this._attachExtraTrace(trace, synchronous ? hasStack : false);\n this._reject(reason, hasStack ? undefined : trace);\n};\n\nPromise.prototype._resolveFromResolver = function (resolver) {\n var promise = this;\n this._captureStackTrace();\n this._pushContext();\n var synchronous = true;\n var r = tryCatch(resolver)(function(value) {\n if (promise === null) return;\n promise._resolveCallback(value);\n promise = null;\n }, function (reason) {\n if (promise === null) return;\n promise._rejectCallback(reason, synchronous);\n promise = null;\n });\n synchronous = false;\n this._popContext();\n\n if (r !== undefined && r === errorObj && promise !== null) {\n promise._rejectCallback(r.e, true, true);\n promise = null;\n }\n};\n\nPromise.prototype._settlePromiseFromHandler = function (\n handler, receiver, value, promise\n) {\n if (promise._isRejected()) return;\n promise._pushContext();\n var x;\n if (receiver === APPLY && !this._isRejected()) {\n x = tryCatch(handler).apply(this._boundTo, value);\n } else {\n x = tryCatch(handler).call(receiver, value);\n }\n promise._popContext();\n\n if (x === errorObj || x === promise || x === NEXT_FILTER) {\n var err = x === promise ? makeSelfResolutionError() : x.e;\n promise._rejectCallback(err, false, true);\n } else {\n promise._resolveCallback(x);\n }\n};\n\nPromise.prototype._target = function() {\n var ret = this;\n while (ret._isFollowing()) ret = ret._followee();\n return ret;\n};\n\nPromise.prototype._followee = function() {\n return this._rejectionHandler0;\n};\n\nPromise.prototype._setFollowee = function(promise) {\n this._rejectionHandler0 = promise;\n};\n\nPromise.prototype._cleanValues = function () {\n if (this._cancellable()) {\n this._cancellationParent = undefined;\n }\n};\n\nPromise.prototype._propagateFrom = function (parent, flags) {\n if ((flags & 1) > 0 && parent._cancellable()) {\n this._setCancellable();\n this._cancellationParent = parent;\n }\n if ((flags & 4) > 0 && parent._isBound()) {\n this._setBoundTo(parent._boundTo);\n }\n};\n\nPromise.prototype._fulfill = function (value) {\n if (this._isFollowingOrFulfilledOrRejected()) return;\n this._fulfillUnchecked(value);\n};\n\nPromise.prototype._reject = function (reason, carriedStackTrace) {\n if (this._isFollowingOrFulfilledOrRejected()) return;\n this._rejectUnchecked(reason, carriedStackTrace);\n};\n\nPromise.prototype._settlePromiseAt = function (index) {\n var promise = this._promiseAt(index);\n var isPromise = promise instanceof Promise;\n\n if (isPromise && promise._isMigrated()) {\n promise._unsetIsMigrated();\n return async.invoke(this._settlePromiseAt, this, index);\n }\n var handler = this._isFulfilled()\n ? this._fulfillmentHandlerAt(index)\n : this._rejectionHandlerAt(index);\n\n var carriedStackTrace =\n this._isCarryingStackTrace() ? this._getCarriedStackTrace() : undefined;\n var value = this._settledValue;\n var receiver = this._receiverAt(index);\n\n\n this._clearCallbackDataAtIndex(index);\n\n if (typeof handler === \"function\") {\n if (!isPromise) {\n handler.call(receiver, value, promise);\n } else {\n this._settlePromiseFromHandler(handler, receiver, value, promise);\n }\n } else if (receiver instanceof PromiseArray) {\n if (!receiver._isResolved()) {\n if (this._isFulfilled()) {\n receiver._promiseFulfilled(value, promise);\n }\n else {\n receiver._promiseRejected(value, promise);\n }\n }\n } else if (isPromise) {\n if (this._isFulfilled()) {\n promise._fulfill(value);\n } else {\n promise._reject(value, carriedStackTrace);\n }\n }\n\n if (index >= 4 && (index & 31) === 4)\n async.invokeLater(this._setLength, this, 0);\n};\n\nPromise.prototype._clearCallbackDataAtIndex = function(index) {\n if (index === 0) {\n if (!this._isCarryingStackTrace()) {\n this._fulfillmentHandler0 = undefined;\n }\n this._rejectionHandler0 =\n this._progressHandler0 =\n this._receiver0 =\n this._promise0 = undefined;\n } else {\n var base = index * 5 - 5;\n this[base + 3] =\n this[base + 4] =\n this[base + 0] =\n this[base + 1] =\n this[base + 2] = undefined;\n }\n};\n\nPromise.prototype._isSettlePromisesQueued = function () {\n return (this._bitField &\n -1073741824) === -1073741824;\n};\n\nPromise.prototype._setSettlePromisesQueued = function () {\n this._bitField = this._bitField | -1073741824;\n};\n\nPromise.prototype._unsetSettlePromisesQueued = function () {\n this._bitField = this._bitField & (~-1073741824);\n};\n\nPromise.prototype._queueSettlePromises = function() {\n async.settlePromises(this);\n this._setSettlePromisesQueued();\n};\n\nPromise.prototype._fulfillUnchecked = function (value) {\n if (value === this) {\n var err = makeSelfResolutionError();\n this._attachExtraTrace(err);\n return this._rejectUnchecked(err, undefined);\n }\n this._setFulfilled();\n this._settledValue = value;\n this._cleanValues();\n\n if (this._length() > 0) {\n this._queueSettlePromises();\n }\n};\n\nPromise.prototype._rejectUncheckedCheckError = function (reason) {\n var trace = util.ensureErrorObject(reason);\n this._rejectUnchecked(reason, trace === reason ? undefined : trace);\n};\n\nPromise.prototype._rejectUnchecked = function (reason, trace) {\n if (reason === this) {\n var err = makeSelfResolutionError();\n this._attachExtraTrace(err);\n return this._rejectUnchecked(err);\n }\n this._setRejected();\n this._settledValue = reason;\n this._cleanValues();\n\n if (this._isFinal()) {\n async.throwLater(function(e) {\n if (\"stack\" in e) {\n async.invokeFirst(\n CapturedTrace.unhandledRejection, undefined, e);\n }\n throw e;\n }, trace === undefined ? reason : trace);\n return;\n }\n\n if (trace !== undefined && trace !== reason) {\n this._setCarriedStackTrace(trace);\n }\n\n if (this._length() > 0) {\n this._queueSettlePromises();\n } else {\n this._ensurePossibleRejectionHandled();\n }\n};\n\nPromise.prototype._settlePromises = function () {\n this._unsetSettlePromisesQueued();\n var len = this._length();\n for (var i = 0; i < len; i++) {\n this._settlePromiseAt(i);\n }\n};\n\nPromise._makeSelfResolutionError = makeSelfResolutionError;\n_dereq_(\"./method.js\")(Promise, INTERNAL, tryConvertToPromise, apiRejection);\n_dereq_(\"./bind.js\")(Promise, INTERNAL, tryConvertToPromise);\n_dereq_(\"./finally.js\")(Promise, NEXT_FILTER, tryConvertToPromise);\n_dereq_(\"./direct_resolve.js\")(Promise);\n_dereq_(\"./synchronous_inspection.js\")(Promise);\n_dereq_(\"./join.js\")(Promise, PromiseArray, tryConvertToPromise, INTERNAL);\nPromise.Promise = Promise;\n_dereq_('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL);\n_dereq_('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext);\n_dereq_('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise);\n_dereq_('./nodeify.js')(Promise);\n_dereq_('./cancel.js')(Promise);\n_dereq_('./promisify.js')(Promise, INTERNAL);\n_dereq_('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection);\n_dereq_('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection);\n_dereq_('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL);\n_dereq_('./settle.js')(Promise, PromiseArray);\n_dereq_('./call_get.js')(Promise);\n_dereq_('./some.js')(Promise, PromiseArray, apiRejection);\n_dereq_('./progress.js')(Promise, PromiseArray);\n_dereq_('./any.js')(Promise);\n_dereq_('./each.js')(Promise, INTERNAL);\n_dereq_('./timers.js')(Promise, INTERNAL);\n_dereq_('./filter.js')(Promise, INTERNAL);\n \n util.toFastProperties(Promise); \n util.toFastProperties(Promise.prototype); \n function fillTypes(value) { \n var p = new Promise(INTERNAL); \n p._fulfillmentHandler0 = value; \n p._rejectionHandler0 = value; \n p._progressHandler0 = value; \n p._promise0 = value; \n p._receiver0 = value; \n p._settledValue = value; \n } \n // Complete slack tracking, opt out of field-type tracking and \n // stabilize map \n fillTypes({a: 1}); \n fillTypes({b: 2}); \n fillTypes({c: 3}); \n fillTypes(1); \n fillTypes(function(){}); \n fillTypes(undefined); \n fillTypes(false); \n fillTypes(new Promise(INTERNAL)); \n CapturedTrace.setBounds(async.firstLineError, util.lastLineError); \n return Promise; \n\n};\n\n},{\"./any.js\":1,\"./async.js\":2,\"./bind.js\":3,\"./call_get.js\":5,\"./cancel.js\":6,\"./captured_trace.js\":7,\"./catch_filter.js\":8,\"./context.js\":9,\"./debuggability.js\":10,\"./direct_resolve.js\":11,\"./each.js\":12,\"./errors.js\":13,\"./filter.js\":15,\"./finally.js\":16,\"./generators.js\":17,\"./join.js\":18,\"./map.js\":19,\"./method.js\":20,\"./nodeify.js\":21,\"./progress.js\":22,\"./promise_array.js\":24,\"./promise_resolver.js\":25,\"./promisify.js\":26,\"./props.js\":27,\"./race.js\":29,\"./reduce.js\":30,\"./settle.js\":32,\"./some.js\":33,\"./synchronous_inspection.js\":34,\"./thenables.js\":35,\"./timers.js\":36,\"./using.js\":37,\"./util.js\":38}],24:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL, tryConvertToPromise,\n apiRejection) {\nvar util = _dereq_(\"./util.js\");\nvar isArray = util.isArray;\n\nfunction toResolutionValue(val) {\n switch(val) {\n case -2: return [];\n case -3: return {};\n }\n}\n\nfunction PromiseArray(values) {\n var promise = this._promise = new Promise(INTERNAL);\n var parent;\n if (values instanceof Promise) {\n parent = values;\n promise._propagateFrom(parent, 1 | 4);\n }\n this._values = values;\n this._length = 0;\n this._totalResolved = 0;\n this._init(undefined, -2);\n}\nPromiseArray.prototype.length = function () {\n return this._length;\n};\n\nPromiseArray.prototype.promise = function () {\n return this._promise;\n};\n\nPromiseArray.prototype._init = function init(_, resolveValueIfEmpty) {\n var values = tryConvertToPromise(this._values, this._promise);\n if (values instanceof Promise) {\n values = values._target();\n this._values = values;\n if (values._isFulfilled()) {\n values = values._value();\n if (!isArray(values)) {\n var err = new Promise.TypeError(\"expecting an array, a promise or a thenable\\u000a\\u000a See http://goo.gl/s8MMhc\\u000a\");\n this.__hardReject__(err);\n return;\n }\n } else if (values._isPending()) {\n values._then(\n init,\n this._reject,\n undefined,\n this,\n resolveValueIfEmpty\n );\n return;\n } else {\n this._reject(values._reason());\n return;\n }\n } else if (!isArray(values)) {\n this._promise._reject(apiRejection(\"expecting an array, a promise or a thenable\\u000a\\u000a See http://goo.gl/s8MMhc\\u000a\")._reason());\n return;\n }\n\n if (values.length === 0) {\n if (resolveValueIfEmpty === -5) {\n this._resolveEmptyArray();\n }\n else {\n this._resolve(toResolutionValue(resolveValueIfEmpty));\n }\n return;\n }\n var len = this.getActualLength(values.length);\n this._length = len;\n this._values = this.shouldCopyValues() ? new Array(len) : this._values;\n var promise = this._promise;\n for (var i = 0; i < len; ++i) {\n var isResolved = this._isResolved();\n var maybePromise = tryConvertToPromise(values[i], promise);\n if (maybePromise instanceof Promise) {\n maybePromise = maybePromise._target();\n if (isResolved) {\n maybePromise._unsetRejectionIsUnhandled();\n } else if (maybePromise._isPending()) {\n maybePromise._proxyPromiseArray(this, i);\n } else if (maybePromise._isFulfilled()) {\n this._promiseFulfilled(maybePromise._value(), i);\n } else {\n this._promiseRejected(maybePromise._reason(), i);\n }\n } else if (!isResolved) {\n this._promiseFulfilled(maybePromise, i);\n }\n }\n};\n\nPromiseArray.prototype._isResolved = function () {\n return this._values === null;\n};\n\nPromiseArray.prototype._resolve = function (value) {\n this._values = null;\n this._promise._fulfill(value);\n};\n\nPromiseArray.prototype.__hardReject__ =\nPromiseArray.prototype._reject = function (reason) {\n this._values = null;\n this._promise._rejectCallback(reason, false, true);\n};\n\nPromiseArray.prototype._promiseProgressed = function (progressValue, index) {\n this._promise._progress({\n index: index,\n value: progressValue\n });\n};\n\n\nPromiseArray.prototype._promiseFulfilled = function (value, index) {\n this._values[index] = value;\n var totalResolved = ++this._totalResolved;\n if (totalResolved >= this._length) {\n this._resolve(this._values);\n }\n};\n\nPromiseArray.prototype._promiseRejected = function (reason, index) {\n this._totalResolved++;\n this._reject(reason);\n};\n\nPromiseArray.prototype.shouldCopyValues = function () {\n return true;\n};\n\nPromiseArray.prototype.getActualLength = function (len) {\n return len;\n};\n\nreturn PromiseArray;\n};\n\n},{\"./util.js\":38}],25:[function(_dereq_,module,exports){\n\"use strict\";\nvar util = _dereq_(\"./util.js\");\nvar maybeWrapAsError = util.maybeWrapAsError;\nvar errors = _dereq_(\"./errors.js\");\nvar TimeoutError = errors.TimeoutError;\nvar OperationalError = errors.OperationalError;\nvar haveGetters = util.haveGetters;\nvar es5 = _dereq_(\"./es5.js\");\n\nfunction isUntypedError(obj) {\n return obj instanceof Error &&\n es5.getPrototypeOf(obj) === Error.prototype;\n}\n\nvar rErrorKey = /^(?:name|message|stack|cause)$/;\nfunction wrapAsOperationalError(obj) {\n var ret;\n if (isUntypedError(obj)) {\n ret = new OperationalError(obj);\n ret.name = obj.name;\n ret.message = obj.message;\n ret.stack = obj.stack;\n var keys = es5.keys(obj);\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n if (!rErrorKey.test(key)) {\n ret[key] = obj[key];\n }\n }\n return ret;\n }\n util.markAsOriginatingFromRejection(obj);\n return obj;\n}\n\nfunction nodebackForPromise(promise) {\n return function(err, value) {\n if (promise === null) return;\n\n if (err) {\n var wrapped = wrapAsOperationalError(maybeWrapAsError(err));\n promise._attachExtraTrace(wrapped);\n promise._reject(wrapped);\n } else if (arguments.length > 2) {\n var $_len = arguments.length;var args = new Array($_len - 1); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];}\n promise._fulfill(args);\n } else {\n promise._fulfill(value);\n }\n\n promise = null;\n };\n}\n\n\nvar PromiseResolver;\nif (!haveGetters) {\n PromiseResolver = function (promise) {\n this.promise = promise;\n this.asCallback = nodebackForPromise(promise);\n this.callback = this.asCallback;\n };\n}\nelse {\n PromiseResolver = function (promise) {\n this.promise = promise;\n };\n}\nif (haveGetters) {\n var prop = {\n get: function() {\n return nodebackForPromise(this.promise);\n }\n };\n es5.defineProperty(PromiseResolver.prototype, \"asCallback\", prop);\n es5.defineProperty(PromiseResolver.prototype, \"callback\", prop);\n}\n\nPromiseResolver._nodebackForPromise = nodebackForPromise;\n\nPromiseResolver.prototype.toString = function () {\n return \"[object PromiseResolver]\";\n};\n\nPromiseResolver.prototype.resolve =\nPromiseResolver.prototype.fulfill = function (value) {\n if (!(this instanceof PromiseResolver)) {\n throw new TypeError(\"Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\\u000a\\u000a See http://goo.gl/sdkXL9\\u000a\");\n }\n this.promise._resolveCallback(value);\n};\n\nPromiseResolver.prototype.reject = function (reason) {\n if (!(this instanceof PromiseResolver)) {\n throw new TypeError(\"Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\\u000a\\u000a See http://goo.gl/sdkXL9\\u000a\");\n }\n this.promise._rejectCallback(reason);\n};\n\nPromiseResolver.prototype.progress = function (value) {\n if (!(this instanceof PromiseResolver)) {\n throw new TypeError(\"Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\\u000a\\u000a See http://goo.gl/sdkXL9\\u000a\");\n }\n this.promise._progress(value);\n};\n\nPromiseResolver.prototype.cancel = function (err) {\n this.promise.cancel(err);\n};\n\nPromiseResolver.prototype.timeout = function () {\n this.reject(new TimeoutError(\"timeout\"));\n};\n\nPromiseResolver.prototype.isResolved = function () {\n return this.promise.isResolved();\n};\n\nPromiseResolver.prototype.toJSON = function () {\n return this.promise.toJSON();\n};\n\nmodule.exports = PromiseResolver;\n\n},{\"./errors.js\":13,\"./es5.js\":14,\"./util.js\":38}],26:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL) {\nvar THIS = {};\nvar util = _dereq_(\"./util.js\");\nvar nodebackForPromise = _dereq_(\"./promise_resolver.js\")\n ._nodebackForPromise;\nvar withAppended = util.withAppended;\nvar maybeWrapAsError = util.maybeWrapAsError;\nvar canEvaluate = util.canEvaluate;\nvar TypeError = _dereq_(\"./errors\").TypeError;\nvar defaultSuffix = \"Async\";\nvar defaultPromisified = {__isPromisified__: true};\nvar noCopyPropsPattern =\n /^(?:length|name|arguments|caller|prototype|__isPromisified__)$/;\nvar defaultFilter = function(name, func) {\n return util.isIdentifier(name) &&\n name.charAt(0) !== \"_\" &&\n !util.isClass(func);\n};\n\nfunction propsFilter(key) {\n return !noCopyPropsPattern.test(key);\n}\n\nfunction isPromisified(fn) {\n try {\n return fn.__isPromisified__ === true;\n }\n catch (e) {\n return false;\n }\n}\n\nfunction hasPromisified(obj, key, suffix) {\n var val = util.getDataPropertyOrDefault(obj, key + suffix,\n defaultPromisified);\n return val ? isPromisified(val) : false;\n}\nfunction checkValid(ret, suffix, suffixRegexp) {\n for (var i = 0; i < ret.length; i += 2) {\n var key = ret[i];\n if (suffixRegexp.test(key)) {\n var keyWithoutAsyncSuffix = key.replace(suffixRegexp, \"\");\n for (var j = 0; j < ret.length; j += 2) {\n if (ret[j] === keyWithoutAsyncSuffix) {\n throw new TypeError(\"Cannot promisify an API that has normal methods with '%s'-suffix\\u000a\\u000a See http://goo.gl/iWrZbw\\u000a\"\n .replace(\"%s\", suffix));\n }\n }\n }\n }\n}\n\nfunction promisifiableMethods(obj, suffix, suffixRegexp, filter) {\n var keys = util.inheritedDataKeys(obj);\n var ret = [];\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n var value = obj[key];\n var passesDefaultFilter = filter === defaultFilter\n ? true : defaultFilter(key, value, obj);\n if (typeof value === \"function\" &&\n !isPromisified(value) &&\n !hasPromisified(obj, key, suffix) &&\n filter(key, value, obj, passesDefaultFilter)) {\n ret.push(key, value);\n }\n }\n checkValid(ret, suffix, suffixRegexp);\n return ret;\n}\n\nvar escapeIdentRegex = function(str) {\n return str.replace(/([$])/, \"\\\\$\");\n};\n\nvar makeNodePromisifiedEval;\nif (!true) {\nvar switchCaseArgumentOrder = function(likelyArgumentCount) {\n var ret = [likelyArgumentCount];\n var min = Math.max(0, likelyArgumentCount - 1 - 3);\n for(var i = likelyArgumentCount - 1; i >= min; --i) {\n ret.push(i);\n }\n for(var i = likelyArgumentCount + 1; i <= 3; ++i) {\n ret.push(i);\n }\n return ret;\n};\n\nvar argumentSequence = function(argumentCount) {\n return util.filledRange(argumentCount, \"_arg\", \"\");\n};\n\nvar parameterDeclaration = function(parameterCount) {\n return util.filledRange(\n Math.max(parameterCount, 3), \"_arg\", \"\");\n};\n\nvar parameterCount = function(fn) {\n if (typeof fn.length === \"number\") {\n return Math.max(Math.min(fn.length, 1023 + 1), 0);\n }\n return 0;\n};\n\nmakeNodePromisifiedEval =\nfunction(callback, receiver, originalName, fn) {\n var newParameterCount = Math.max(0, parameterCount(fn) - 1);\n var argumentOrder = switchCaseArgumentOrder(newParameterCount);\n var shouldProxyThis = typeof callback === \"string\" || receiver === THIS;\n\n function generateCallForArgumentCount(count) {\n var args = argumentSequence(count).join(\", \");\n var comma = count > 0 ? \", \" : \"\";\n var ret;\n if (shouldProxyThis) {\n ret = \"ret = callback.call(this, {{args}}, nodeback); break;\\n\";\n } else {\n ret = receiver === undefined\n ? \"ret = callback({{args}}, nodeback); break;\\n\"\n : \"ret = callback.call(receiver, {{args}}, nodeback); break;\\n\";\n }\n return ret.replace(\"{{args}}\", args).replace(\", \", comma);\n }\n\n function generateArgumentSwitchCase() {\n var ret = \"\";\n for (var i = 0; i < argumentOrder.length; ++i) {\n ret += \"case \" + argumentOrder[i] +\":\" +\n generateCallForArgumentCount(argumentOrder[i]);\n }\n\n ret += \" \\n\\\n default: \\n\\\n var args = new Array(len + 1); \\n\\\n var i = 0; \\n\\\n for (var i = 0; i < len; ++i) { \\n\\\n args[i] = arguments[i]; \\n\\\n } \\n\\\n args[i] = nodeback; \\n\\\n [CodeForCall] \\n\\\n break; \\n\\\n \".replace(\"[CodeForCall]\", (shouldProxyThis\n ? \"ret = callback.apply(this, args);\\n\"\n : \"ret = callback.apply(receiver, args);\\n\"));\n return ret;\n }\n\n var getFunctionCode = typeof callback === \"string\"\n ? (\"this != null ? this['\"+callback+\"'] : fn\")\n : \"fn\";\n\n return new Function(\"Promise\",\n \"fn\",\n \"receiver\",\n \"withAppended\",\n \"maybeWrapAsError\",\n \"nodebackForPromise\",\n \"tryCatch\",\n \"errorObj\",\n \"INTERNAL\",\"'use strict'; \\n\\\n var ret = function (Parameters) { \\n\\\n 'use strict'; \\n\\\n var len = arguments.length; \\n\\\n var promise = new Promise(INTERNAL); \\n\\\n promise._captureStackTrace(); \\n\\\n var nodeback = nodebackForPromise(promise); \\n\\\n var ret; \\n\\\n var callback = tryCatch([GetFunctionCode]); \\n\\\n switch(len) { \\n\\\n [CodeForSwitchCase] \\n\\\n } \\n\\\n if (ret === errorObj) { \\n\\\n promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\\n\\\n } \\n\\\n return promise; \\n\\\n }; \\n\\\n ret.__isPromisified__ = true; \\n\\\n return ret; \\n\\\n \"\n .replace(\"Parameters\", parameterDeclaration(newParameterCount))\n .replace(\"[CodeForSwitchCase]\", generateArgumentSwitchCase())\n .replace(\"[GetFunctionCode]\", getFunctionCode))(\n Promise,\n fn,\n receiver,\n withAppended,\n maybeWrapAsError,\n nodebackForPromise,\n util.tryCatch,\n util.errorObj,\n INTERNAL\n );\n};\n}\n\nfunction makeNodePromisifiedClosure(callback, receiver, _, fn) {\n var defaultThis = (function() {return this;})();\n var method = callback;\n if (typeof method === \"string\") {\n callback = fn;\n }\n function promisified() {\n var _receiver = receiver;\n if (receiver === THIS) _receiver = this;\n var promise = new Promise(INTERNAL);\n promise._captureStackTrace();\n var cb = typeof method === \"string\" && this !== defaultThis\n ? this[method] : callback;\n var fn = nodebackForPromise(promise);\n try {\n cb.apply(_receiver, withAppended(arguments, fn));\n } catch(e) {\n promise._rejectCallback(maybeWrapAsError(e), true, true);\n }\n return promise;\n }\n promisified.__isPromisified__ = true;\n return promisified;\n}\n\nvar makeNodePromisified = canEvaluate\n ? makeNodePromisifiedEval\n : makeNodePromisifiedClosure;\n\nfunction promisifyAll(obj, suffix, filter, promisifier) {\n var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + \"$\");\n var methods =\n promisifiableMethods(obj, suffix, suffixRegexp, filter);\n\n for (var i = 0, len = methods.length; i < len; i+= 2) {\n var key = methods[i];\n var fn = methods[i+1];\n var promisifiedKey = key + suffix;\n obj[promisifiedKey] = promisifier === makeNodePromisified\n ? makeNodePromisified(key, THIS, key, fn, suffix)\n : promisifier(fn, function() {\n return makeNodePromisified(key, THIS, key, fn, suffix);\n });\n }\n util.toFastProperties(obj);\n return obj;\n}\n\nfunction promisify(callback, receiver) {\n return makeNodePromisified(callback, receiver, undefined, callback);\n}\n\nPromise.promisify = function (fn, receiver) {\n if (typeof fn !== \"function\") {\n throw new TypeError(\"fn must be a function\\u000a\\u000a See http://goo.gl/916lJJ\\u000a\");\n }\n if (isPromisified(fn)) {\n return fn;\n }\n var ret = promisify(fn, arguments.length < 2 ? THIS : receiver);\n util.copyDescriptors(fn, ret, propsFilter);\n return ret;\n};\n\nPromise.promisifyAll = function (target, options) {\n if (typeof target !== \"function\" && typeof target !== \"object\") {\n throw new TypeError(\"the target of promisifyAll must be an object or a function\\u000a\\u000a See http://goo.gl/9ITlV0\\u000a\");\n }\n options = Object(options);\n var suffix = options.suffix;\n if (typeof suffix !== \"string\") suffix = defaultSuffix;\n var filter = options.filter;\n if (typeof filter !== \"function\") filter = defaultFilter;\n var promisifier = options.promisifier;\n if (typeof promisifier !== \"function\") promisifier = makeNodePromisified;\n\n if (!util.isIdentifier(suffix)) {\n throw new RangeError(\"suffix must be a valid identifier\\u000a\\u000a See http://goo.gl/8FZo5V\\u000a\");\n }\n\n var keys = util.inheritedDataKeys(target);\n for (var i = 0; i < keys.length; ++i) {\n var value = target[keys[i]];\n if (keys[i] !== \"constructor\" &&\n util.isClass(value)) {\n promisifyAll(value.prototype, suffix, filter, promisifier);\n promisifyAll(value, suffix, filter, promisifier);\n }\n }\n\n return promisifyAll(target, suffix, filter, promisifier);\n};\n};\n\n\n},{\"./errors\":13,\"./promise_resolver.js\":25,\"./util.js\":38}],27:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(\n Promise, PromiseArray, tryConvertToPromise, apiRejection) {\nvar util = _dereq_(\"./util.js\");\nvar isObject = util.isObject;\nvar es5 = _dereq_(\"./es5.js\");\n\nfunction PropertiesPromiseArray(obj) {\n var keys = es5.keys(obj);\n var len = keys.length;\n var values = new Array(len * 2);\n for (var i = 0; i < len; ++i) {\n var key = keys[i];\n values[i] = obj[key];\n values[i + len] = key;\n }\n this.constructor$(values);\n}\nutil.inherits(PropertiesPromiseArray, PromiseArray);\n\nPropertiesPromiseArray.prototype._init = function () {\n this._init$(undefined, -3) ;\n};\n\nPropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) {\n this._values[index] = value;\n var totalResolved = ++this._totalResolved;\n if (totalResolved >= this._length) {\n var val = {};\n var keyOffset = this.length();\n for (var i = 0, len = this.length(); i < len; ++i) {\n val[this._values[i + keyOffset]] = this._values[i];\n }\n this._resolve(val);\n }\n};\n\nPropertiesPromiseArray.prototype._promiseProgressed = function (value, index) {\n this._promise._progress({\n key: this._values[index + this.length()],\n value: value\n });\n};\n\nPropertiesPromiseArray.prototype.shouldCopyValues = function () {\n return false;\n};\n\nPropertiesPromiseArray.prototype.getActualLength = function (len) {\n return len >> 1;\n};\n\nfunction props(promises) {\n var ret;\n var castValue = tryConvertToPromise(promises);\n\n if (!isObject(castValue)) {\n return apiRejection(\"cannot await properties of a non-object\\u000a\\u000a See http://goo.gl/OsFKC8\\u000a\");\n } else if (castValue instanceof Promise) {\n ret = castValue._then(\n Promise.props, undefined, undefined, undefined, undefined);\n } else {\n ret = new PropertiesPromiseArray(castValue).promise();\n }\n\n if (castValue instanceof Promise) {\n ret._propagateFrom(castValue, 4);\n }\n return ret;\n}\n\nPromise.prototype.props = function () {\n return props(this);\n};\n\nPromise.props = function (promises) {\n return props(promises);\n};\n};\n\n},{\"./es5.js\":14,\"./util.js\":38}],28:[function(_dereq_,module,exports){\n\"use strict\";\nfunction arrayMove(src, srcIndex, dst, dstIndex, len) {\n for (var j = 0; j < len; ++j) {\n dst[j + dstIndex] = src[j + srcIndex];\n src[j + srcIndex] = void 0;\n }\n}\n\nfunction Queue(capacity) {\n this._capacity = capacity;\n this._length = 0;\n this._front = 0;\n}\n\nQueue.prototype._willBeOverCapacity = function (size) {\n return this._capacity < size;\n};\n\nQueue.prototype._pushOne = function (arg) {\n var length = this.length();\n this._checkCapacity(length + 1);\n var i = (this._front + length) & (this._capacity - 1);\n this[i] = arg;\n this._length = length + 1;\n};\n\nQueue.prototype._unshiftOne = function(value) {\n var capacity = this._capacity;\n this._checkCapacity(this.length() + 1);\n var front = this._front;\n var i = (((( front - 1 ) &\n ( capacity - 1) ) ^ capacity ) - capacity );\n this[i] = value;\n this._front = i;\n this._length = this.length() + 1;\n};\n\nQueue.prototype.unshift = function(fn, receiver, arg) {\n this._unshiftOne(arg);\n this._unshiftOne(receiver);\n this._unshiftOne(fn);\n};\n\nQueue.prototype.push = function (fn, receiver, arg) {\n var length = this.length() + 3;\n if (this._willBeOverCapacity(length)) {\n this._pushOne(fn);\n this._pushOne(receiver);\n this._pushOne(arg);\n return;\n }\n var j = this._front + length - 3;\n this._checkCapacity(length);\n var wrapMask = this._capacity - 1;\n this[(j + 0) & wrapMask] = fn;\n this[(j + 1) & wrapMask] = receiver;\n this[(j + 2) & wrapMask] = arg;\n this._length = length;\n};\n\nQueue.prototype.shift = function () {\n var front = this._front,\n ret = this[front];\n\n this[front] = undefined;\n this._front = (front + 1) & (this._capacity - 1);\n this._length--;\n return ret;\n};\n\nQueue.prototype.length = function () {\n return this._length;\n};\n\nQueue.prototype._checkCapacity = function (size) {\n if (this._capacity < size) {\n this._resizeTo(this._capacity << 1);\n }\n};\n\nQueue.prototype._resizeTo = function (capacity) {\n var oldCapacity = this._capacity;\n this._capacity = capacity;\n var front = this._front;\n var length = this._length;\n var moveItemsCount = (front + length) & (oldCapacity - 1);\n arrayMove(this, 0, this, oldCapacity, moveItemsCount);\n};\n\nmodule.exports = Queue;\n\n},{}],29:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(\n Promise, INTERNAL, tryConvertToPromise, apiRejection) {\nvar isArray = _dereq_(\"./util.js\").isArray;\n\nvar raceLater = function (promise) {\n return promise.then(function(array) {\n return race(array, promise);\n });\n};\n\nfunction race(promises, parent) {\n var maybePromise = tryConvertToPromise(promises);\n\n if (maybePromise instanceof Promise) {\n return raceLater(maybePromise);\n } else if (!isArray(promises)) {\n return apiRejection(\"expecting an array, a promise or a thenable\\u000a\\u000a See http://goo.gl/s8MMhc\\u000a\");\n }\n\n var ret = new Promise(INTERNAL);\n if (parent !== undefined) {\n ret._propagateFrom(parent, 4 | 1);\n }\n var fulfill = ret._fulfill;\n var reject = ret._reject;\n for (var i = 0, len = promises.length; i < len; ++i) {\n var val = promises[i];\n\n if (val === undefined && !(i in promises)) {\n continue;\n }\n\n Promise.cast(val)._then(fulfill, reject, undefined, ret, null);\n }\n return ret;\n}\n\nPromise.race = function (promises) {\n return race(promises, undefined);\n};\n\nPromise.prototype.race = function () {\n return race(this, undefined);\n};\n\n};\n\n},{\"./util.js\":38}],30:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise,\n PromiseArray,\n apiRejection,\n tryConvertToPromise,\n INTERNAL) {\nvar async = _dereq_(\"./async.js\");\nvar util = _dereq_(\"./util.js\");\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\nfunction ReductionPromiseArray(promises, fn, accum, _each) {\n this.constructor$(promises);\n this._promise._captureStackTrace();\n this._preservedValues = _each === INTERNAL ? [] : null;\n this._zerothIsAccum = (accum === undefined);\n this._gotAccum = false;\n this._reducingIndex = (this._zerothIsAccum ? 1 : 0);\n this._valuesPhase = undefined;\n var maybePromise = tryConvertToPromise(accum, this._promise);\n var rejected = false;\n var isPromise = maybePromise instanceof Promise;\n if (isPromise) {\n maybePromise = maybePromise._target();\n if (maybePromise._isPending()) {\n maybePromise._proxyPromiseArray(this, -1);\n } else if (maybePromise._isFulfilled()) {\n accum = maybePromise._value();\n this._gotAccum = true;\n } else {\n this._reject(maybePromise._reason());\n rejected = true;\n }\n }\n if (!(isPromise || this._zerothIsAccum)) this._gotAccum = true;\n this._callback = fn;\n this._accum = accum;\n if (!rejected) async.invoke(init, this, undefined);\n}\nfunction init() {\n this._init$(undefined, -5);\n}\nutil.inherits(ReductionPromiseArray, PromiseArray);\n\nReductionPromiseArray.prototype._init = function () {};\n\nReductionPromiseArray.prototype._resolveEmptyArray = function () {\n if (this._gotAccum || this._zerothIsAccum) {\n this._resolve(this._preservedValues !== null\n ? [] : this._accum);\n }\n};\n\nReductionPromiseArray.prototype._promiseFulfilled = function (value, index) {\n var values = this._values;\n values[index] = value;\n var length = this.length();\n var preservedValues = this._preservedValues;\n var isEach = preservedValues !== null;\n var gotAccum = this._gotAccum;\n var valuesPhase = this._valuesPhase;\n var valuesPhaseIndex;\n if (!valuesPhase) {\n valuesPhase = this._valuesPhase = new Array(length);\n for (valuesPhaseIndex=0; valuesPhaseIndex= this._length) {\n this._resolve(this._values);\n }\n};\n\nSettledPromiseArray.prototype._promiseFulfilled = function (value, index) {\n var ret = new PromiseInspection();\n ret._bitField = 268435456;\n ret._settledValue = value;\n this._promiseResolved(index, ret);\n};\nSettledPromiseArray.prototype._promiseRejected = function (reason, index) {\n var ret = new PromiseInspection();\n ret._bitField = 134217728;\n ret._settledValue = reason;\n this._promiseResolved(index, ret);\n};\n\nPromise.settle = function (promises) {\n return new SettledPromiseArray(promises).promise();\n};\n\nPromise.prototype.settle = function () {\n return new SettledPromiseArray(this).promise();\n};\n};\n\n},{\"./util.js\":38}],33:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports =\nfunction(Promise, PromiseArray, apiRejection) {\nvar util = _dereq_(\"./util.js\");\nvar RangeError = _dereq_(\"./errors.js\").RangeError;\nvar AggregateError = _dereq_(\"./errors.js\").AggregateError;\nvar isArray = util.isArray;\n\n\nfunction SomePromiseArray(values) {\n this.constructor$(values);\n this._howMany = 0;\n this._unwrap = false;\n this._initialized = false;\n}\nutil.inherits(SomePromiseArray, PromiseArray);\n\nSomePromiseArray.prototype._init = function () {\n if (!this._initialized) {\n return;\n }\n if (this._howMany === 0) {\n this._resolve([]);\n return;\n }\n this._init$(undefined, -5);\n var isArrayResolved = isArray(this._values);\n if (!this._isResolved() &&\n isArrayResolved &&\n this._howMany > this._canPossiblyFulfill()) {\n this._reject(this._getRangeError(this.length()));\n }\n};\n\nSomePromiseArray.prototype.init = function () {\n this._initialized = true;\n this._init();\n};\n\nSomePromiseArray.prototype.setUnwrap = function () {\n this._unwrap = true;\n};\n\nSomePromiseArray.prototype.howMany = function () {\n return this._howMany;\n};\n\nSomePromiseArray.prototype.setHowMany = function (count) {\n this._howMany = count;\n};\n\nSomePromiseArray.prototype._promiseFulfilled = function (value) {\n this._addFulfilled(value);\n if (this._fulfilled() === this.howMany()) {\n this._values.length = this.howMany();\n if (this.howMany() === 1 && this._unwrap) {\n this._resolve(this._values[0]);\n } else {\n this._resolve(this._values);\n }\n }\n\n};\nSomePromiseArray.prototype._promiseRejected = function (reason) {\n this._addRejected(reason);\n if (this.howMany() > this._canPossiblyFulfill()) {\n var e = new AggregateError();\n for (var i = this.length(); i < this._values.length; ++i) {\n e.push(this._values[i]);\n }\n this._reject(e);\n }\n};\n\nSomePromiseArray.prototype._fulfilled = function () {\n return this._totalResolved;\n};\n\nSomePromiseArray.prototype._rejected = function () {\n return this._values.length - this.length();\n};\n\nSomePromiseArray.prototype._addRejected = function (reason) {\n this._values.push(reason);\n};\n\nSomePromiseArray.prototype._addFulfilled = function (value) {\n this._values[this._totalResolved++] = value;\n};\n\nSomePromiseArray.prototype._canPossiblyFulfill = function () {\n return this.length() - this._rejected();\n};\n\nSomePromiseArray.prototype._getRangeError = function (count) {\n var message = \"Input array must contain at least \" +\n this._howMany + \" items but contains only \" + count + \" items\";\n return new RangeError(message);\n};\n\nSomePromiseArray.prototype._resolveEmptyArray = function () {\n this._reject(this._getRangeError(0));\n};\n\nfunction some(promises, howMany) {\n if ((howMany | 0) !== howMany || howMany < 0) {\n return apiRejection(\"expecting a positive integer\\u000a\\u000a See http://goo.gl/1wAmHx\\u000a\");\n }\n var ret = new SomePromiseArray(promises);\n var promise = ret.promise();\n ret.setHowMany(howMany);\n ret.init();\n return promise;\n}\n\nPromise.some = function (promises, howMany) {\n return some(promises, howMany);\n};\n\nPromise.prototype.some = function (howMany) {\n return some(this, howMany);\n};\n\nPromise._SomePromiseArray = SomePromiseArray;\n};\n\n},{\"./errors.js\":13,\"./util.js\":38}],34:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise) {\nfunction PromiseInspection(promise) {\n if (promise !== undefined) {\n promise = promise._target();\n this._bitField = promise._bitField;\n this._settledValue = promise._settledValue;\n }\n else {\n this._bitField = 0;\n this._settledValue = undefined;\n }\n}\n\nPromiseInspection.prototype.value = function () {\n if (!this.isFulfilled()) {\n throw new TypeError(\"cannot get fulfillment value of a non-fulfilled promise\\u000a\\u000a See http://goo.gl/hc1DLj\\u000a\");\n }\n return this._settledValue;\n};\n\nPromiseInspection.prototype.error =\nPromiseInspection.prototype.reason = function () {\n if (!this.isRejected()) {\n throw new TypeError(\"cannot get rejection reason of a non-rejected promise\\u000a\\u000a See http://goo.gl/hPuiwB\\u000a\");\n }\n return this._settledValue;\n};\n\nPromiseInspection.prototype.isFulfilled =\nPromise.prototype._isFulfilled = function () {\n return (this._bitField & 268435456) > 0;\n};\n\nPromiseInspection.prototype.isRejected =\nPromise.prototype._isRejected = function () {\n return (this._bitField & 134217728) > 0;\n};\n\nPromiseInspection.prototype.isPending =\nPromise.prototype._isPending = function () {\n return (this._bitField & 402653184) === 0;\n};\n\nPromiseInspection.prototype.isResolved =\nPromise.prototype._isResolved = function () {\n return (this._bitField & 402653184) > 0;\n};\n\nPromise.prototype.isPending = function() {\n return this._target()._isPending();\n};\n\nPromise.prototype.isRejected = function() {\n return this._target()._isRejected();\n};\n\nPromise.prototype.isFulfilled = function() {\n return this._target()._isFulfilled();\n};\n\nPromise.prototype.isResolved = function() {\n return this._target()._isResolved();\n};\n\nPromise.prototype._value = function() {\n return this._settledValue;\n};\n\nPromise.prototype._reason = function() {\n this._unsetRejectionIsUnhandled();\n return this._settledValue;\n};\n\nPromise.prototype.value = function() {\n var target = this._target();\n if (!target.isFulfilled()) {\n throw new TypeError(\"cannot get fulfillment value of a non-fulfilled promise\\u000a\\u000a See http://goo.gl/hc1DLj\\u000a\");\n }\n return target._settledValue;\n};\n\nPromise.prototype.reason = function() {\n var target = this._target();\n if (!target.isRejected()) {\n throw new TypeError(\"cannot get rejection reason of a non-rejected promise\\u000a\\u000a See http://goo.gl/hPuiwB\\u000a\");\n }\n target._unsetRejectionIsUnhandled();\n return target._settledValue;\n};\n\n\nPromise.PromiseInspection = PromiseInspection;\n};\n\n},{}],35:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL) {\nvar util = _dereq_(\"./util.js\");\nvar errorObj = util.errorObj;\nvar isObject = util.isObject;\n\nfunction tryConvertToPromise(obj, context) {\n if (isObject(obj)) {\n if (obj instanceof Promise) {\n return obj;\n }\n else if (isAnyBluebirdPromise(obj)) {\n var ret = new Promise(INTERNAL);\n obj._then(\n ret._fulfillUnchecked,\n ret._rejectUncheckedCheckError,\n ret._progressUnchecked,\n ret,\n null\n );\n return ret;\n }\n var then = util.tryCatch(getThen)(obj);\n if (then === errorObj) {\n if (context) context._pushContext();\n var ret = Promise.reject(then.e);\n if (context) context._popContext();\n return ret;\n } else if (typeof then === \"function\") {\n return doThenable(obj, then, context);\n }\n }\n return obj;\n}\n\nfunction getThen(obj) {\n return obj.then;\n}\n\nvar hasProp = {}.hasOwnProperty;\nfunction isAnyBluebirdPromise(obj) {\n return hasProp.call(obj, \"_promise0\");\n}\n\nfunction doThenable(x, then, context) {\n var promise = new Promise(INTERNAL);\n var ret = promise;\n if (context) context._pushContext();\n promise._captureStackTrace();\n if (context) context._popContext();\n var synchronous = true;\n var result = util.tryCatch(then).call(x,\n resolveFromThenable,\n rejectFromThenable,\n progressFromThenable);\n synchronous = false;\n if (promise && result === errorObj) {\n promise._rejectCallback(result.e, true, true);\n promise = null;\n }\n\n function resolveFromThenable(value) {\n if (!promise) return;\n if (x === value) {\n promise._rejectCallback(\n Promise._makeSelfResolutionError(), false, true);\n } else {\n promise._resolveCallback(value);\n }\n promise = null;\n }\n\n function rejectFromThenable(reason) {\n if (!promise) return;\n promise._rejectCallback(reason, synchronous, true);\n promise = null;\n }\n\n function progressFromThenable(value) {\n if (!promise) return;\n if (typeof promise._progress === \"function\") {\n promise._progress(value);\n }\n }\n return ret;\n}\n\nreturn tryConvertToPromise;\n};\n\n},{\"./util.js\":38}],36:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL) {\nvar util = _dereq_(\"./util.js\");\nvar TimeoutError = Promise.TimeoutError;\n\nvar afterTimeout = function (promise, message) {\n if (!promise.isPending()) return;\n if (typeof message !== \"string\") {\n message = \"operation timed out\";\n }\n var err = new TimeoutError(message);\n util.markAsOriginatingFromRejection(err);\n promise._attachExtraTrace(err);\n promise._cancel(err);\n};\n\nvar afterValue = function(value) { return delay(+this).thenReturn(value); };\nvar delay = Promise.delay = function (value, ms) {\n if (ms === undefined) {\n ms = value;\n value = undefined;\n var ret = new Promise(INTERNAL);\n setTimeout(function() { ret._fulfill(); }, ms);\n return ret;\n }\n ms = +ms;\n return Promise.resolve(value)._then(afterValue, null, null, ms, undefined);\n};\n\nPromise.prototype.delay = function (ms) {\n return delay(this, ms);\n};\n\nfunction successClear(value) {\n var handle = this;\n if (handle instanceof Number) handle = +handle;\n clearTimeout(handle);\n return value;\n}\n\nfunction failureClear(reason) {\n var handle = this;\n if (handle instanceof Number) handle = +handle;\n clearTimeout(handle);\n throw reason;\n}\n\nPromise.prototype.timeout = function (ms, message) {\n ms = +ms;\n var ret = this.then().cancellable();\n ret._cancellationParent = this;\n var handle = setTimeout(function timeoutTimeout() {\n afterTimeout(ret, message);\n }, ms);\n return ret._then(successClear, failureClear, undefined, handle, undefined);\n};\n\n};\n\n},{\"./util.js\":38}],37:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function (Promise, apiRejection, tryConvertToPromise,\n createContext) {\n var TypeError = _dereq_(\"./errors.js\").TypeError;\n var inherits = _dereq_(\"./util.js\").inherits;\n var PromiseInspection = Promise.PromiseInspection;\n\n function inspectionMapper(inspections) {\n var len = inspections.length;\n for (var i = 0; i < len; ++i) {\n var inspection = inspections[i];\n if (inspection.isRejected()) {\n return Promise.reject(inspection.error());\n }\n inspections[i] = inspection._settledValue;\n }\n return inspections;\n }\n\n function thrower(e) {\n setTimeout(function(){throw e;}, 0);\n }\n\n function castPreservingDisposable(thenable) {\n var maybePromise = tryConvertToPromise(thenable);\n if (maybePromise !== thenable &&\n typeof thenable._isDisposable === \"function\" &&\n typeof thenable._getDisposer === \"function\" &&\n thenable._isDisposable()) {\n maybePromise._setDisposable(thenable._getDisposer());\n }\n return maybePromise;\n }\n function dispose(resources, inspection) {\n var i = 0;\n var len = resources.length;\n var ret = Promise.defer();\n function iterator() {\n if (i >= len) return ret.resolve();\n var maybePromise = castPreservingDisposable(resources[i++]);\n if (maybePromise instanceof Promise &&\n maybePromise._isDisposable()) {\n try {\n maybePromise = tryConvertToPromise(\n maybePromise._getDisposer().tryDispose(inspection),\n resources.promise);\n } catch (e) {\n return thrower(e);\n }\n if (maybePromise instanceof Promise) {\n return maybePromise._then(iterator, thrower,\n null, null, null);\n }\n }\n iterator();\n }\n iterator();\n return ret.promise;\n }\n\n function disposerSuccess(value) {\n var inspection = new PromiseInspection();\n inspection._settledValue = value;\n inspection._bitField = 268435456;\n return dispose(this, inspection).thenReturn(value);\n }\n\n function disposerFail(reason) {\n var inspection = new PromiseInspection();\n inspection._settledValue = reason;\n inspection._bitField = 134217728;\n return dispose(this, inspection).thenThrow(reason);\n }\n\n function Disposer(data, promise, context) {\n this._data = data;\n this._promise = promise;\n this._context = context;\n }\n\n Disposer.prototype.data = function () {\n return this._data;\n };\n\n Disposer.prototype.promise = function () {\n return this._promise;\n };\n\n Disposer.prototype.resource = function () {\n if (this.promise().isFulfilled()) {\n return this.promise().value();\n }\n return null;\n };\n\n Disposer.prototype.tryDispose = function(inspection) {\n var resource = this.resource();\n var context = this._context;\n if (context !== undefined) context._pushContext();\n var ret = resource !== null\n ? this.doDispose(resource, inspection) : null;\n if (context !== undefined) context._popContext();\n this._promise._unsetDisposable();\n this._data = null;\n return ret;\n };\n\n Disposer.isDisposer = function (d) {\n return (d != null &&\n typeof d.resource === \"function\" &&\n typeof d.tryDispose === \"function\");\n };\n\n function FunctionDisposer(fn, promise, context) {\n this.constructor$(fn, promise, context);\n }\n inherits(FunctionDisposer, Disposer);\n\n FunctionDisposer.prototype.doDispose = function (resource, inspection) {\n var fn = this.data();\n return fn.call(resource, resource, inspection);\n };\n\n function maybeUnwrapDisposer(value) {\n if (Disposer.isDisposer(value)) {\n this.resources[this.index]._setDisposable(value);\n return value.promise();\n }\n return value;\n }\n\n Promise.using = function () {\n var len = arguments.length;\n if (len < 2) return apiRejection(\n \"you must pass at least 2 arguments to Promise.using\");\n var fn = arguments[len - 1];\n if (typeof fn !== \"function\") return apiRejection(\"fn must be a function\\u000a\\u000a See http://goo.gl/916lJJ\\u000a\");\n len--;\n var resources = new Array(len);\n for (var i = 0; i < len; ++i) {\n var resource = arguments[i];\n if (Disposer.isDisposer(resource)) {\n var disposer = resource;\n resource = resource.promise();\n resource._setDisposable(disposer);\n } else {\n var maybePromise = tryConvertToPromise(resource);\n if (maybePromise instanceof Promise) {\n resource =\n maybePromise._then(maybeUnwrapDisposer, null, null, {\n resources: resources,\n index: i\n }, undefined);\n }\n }\n resources[i] = resource;\n }\n\n var promise = Promise.settle(resources)\n .then(inspectionMapper)\n .then(function(vals) {\n promise._pushContext();\n var ret;\n try {\n ret = fn.apply(undefined, vals);\n } finally {\n promise._popContext();\n }\n return ret;\n })\n ._then(\n disposerSuccess, disposerFail, undefined, resources, undefined);\n resources.promise = promise;\n return promise;\n };\n\n Promise.prototype._setDisposable = function (disposer) {\n this._bitField = this._bitField | 262144;\n this._disposer = disposer;\n };\n\n Promise.prototype._isDisposable = function () {\n return (this._bitField & 262144) > 0;\n };\n\n Promise.prototype._getDisposer = function () {\n return this._disposer;\n };\n\n Promise.prototype._unsetDisposable = function () {\n this._bitField = this._bitField & (~262144);\n this._disposer = undefined;\n };\n\n Promise.prototype.disposer = function (fn) {\n if (typeof fn === \"function\") {\n return new FunctionDisposer(fn, this, createContext());\n }\n throw new TypeError();\n };\n\n};\n\n},{\"./errors.js\":13,\"./util.js\":38}],38:[function(_dereq_,module,exports){\n\"use strict\";\nvar es5 = _dereq_(\"./es5.js\");\nvar canEvaluate = typeof navigator == \"undefined\";\nvar haveGetters = (function(){\n try {\n var o = {};\n es5.defineProperty(o, \"f\", {\n get: function () {\n return 3;\n }\n });\n return o.f === 3;\n }\n catch (e) {\n return false;\n }\n\n})();\n\nvar errorObj = {e: {}};\nvar tryCatchTarget;\nfunction tryCatcher() {\n try {\n return tryCatchTarget.apply(this, arguments);\n } catch (e) {\n errorObj.e = e;\n return errorObj;\n }\n}\nfunction tryCatch(fn) {\n tryCatchTarget = fn;\n return tryCatcher;\n}\n\nvar inherits = function(Child, Parent) {\n var hasProp = {}.hasOwnProperty;\n\n function T() {\n this.constructor = Child;\n this.constructor$ = Parent;\n for (var propertyName in Parent.prototype) {\n if (hasProp.call(Parent.prototype, propertyName) &&\n propertyName.charAt(propertyName.length-1) !== \"$\"\n ) {\n this[propertyName + \"$\"] = Parent.prototype[propertyName];\n }\n }\n }\n T.prototype = Parent.prototype;\n Child.prototype = new T();\n return Child.prototype;\n};\n\n\nfunction isPrimitive(val) {\n return val == null || val === true || val === false ||\n typeof val === \"string\" || typeof val === \"number\";\n\n}\n\nfunction isObject(value) {\n return !isPrimitive(value);\n}\n\nfunction maybeWrapAsError(maybeError) {\n if (!isPrimitive(maybeError)) return maybeError;\n\n return new Error(safeToString(maybeError));\n}\n\nfunction withAppended(target, appendee) {\n var len = target.length;\n var ret = new Array(len + 1);\n var i;\n for (i = 0; i < len; ++i) {\n ret[i] = target[i];\n }\n ret[i] = appendee;\n return ret;\n}\n\nfunction getDataPropertyOrDefault(obj, key, defaultValue) {\n if (es5.isES5) {\n var desc = Object.getOwnPropertyDescriptor(obj, key);\n if (desc != null) {\n return desc.get == null && desc.set == null\n ? desc.value\n : defaultValue;\n }\n } else {\n return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined;\n }\n}\n\nfunction notEnumerableProp(obj, name, value) {\n if (isPrimitive(obj)) return obj;\n var descriptor = {\n value: value,\n configurable: true,\n enumerable: false,\n writable: true\n };\n es5.defineProperty(obj, name, descriptor);\n return obj;\n}\n\n\nvar wrapsPrimitiveReceiver = (function() {\n return this !== \"string\";\n}).call(\"string\");\n\nfunction thrower(r) {\n throw r;\n}\n\nvar inheritedDataKeys = (function() {\n if (es5.isES5) {\n var oProto = Object.prototype;\n var getKeys = Object.getOwnPropertyNames;\n return function(obj) {\n var ret = [];\n var visitedKeys = Object.create(null);\n while (obj != null && obj !== oProto) {\n var keys;\n try {\n keys = getKeys(obj);\n } catch (e) {\n return ret;\n }\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n if (visitedKeys[key]) continue;\n visitedKeys[key] = true;\n var desc = Object.getOwnPropertyDescriptor(obj, key);\n if (desc != null && desc.get == null && desc.set == null) {\n ret.push(key);\n }\n }\n obj = es5.getPrototypeOf(obj);\n }\n return ret;\n };\n } else {\n return function(obj) {\n var ret = [];\n /*jshint forin:false */\n for (var key in obj) {\n ret.push(key);\n }\n return ret;\n };\n }\n\n})();\n\nfunction isClass(fn) {\n try {\n if (typeof fn === \"function\") {\n var keys = es5.names(fn.prototype);\n if (es5.isES5) return keys.length > 1;\n return keys.length > 0 &&\n !(keys.length === 1 && keys[0] === \"constructor\");\n }\n return false;\n } catch (e) {\n return false;\n }\n}\n\nfunction toFastProperties(obj) {\n /*jshint -W027*/\n function f() {}\n f.prototype = obj;\n return f;\n eval(obj);\n}\n\nvar rident = /^[a-z$_][a-z$_0-9]*$/i;\nfunction isIdentifier(str) {\n return rident.test(str);\n}\n\nfunction filledRange(count, prefix, suffix) {\n var ret = new Array(count);\n for(var i = 0; i < count; ++i) {\n ret[i] = prefix + i + suffix;\n }\n return ret;\n}\n\nfunction safeToString(obj) {\n try {\n return obj + \"\";\n } catch (e) {\n return \"[no string representation]\";\n }\n}\n\nfunction markAsOriginatingFromRejection(e) {\n try {\n notEnumerableProp(e, \"isOperational\", true);\n }\n catch(ignore) {}\n}\n\nfunction originatesFromRejection(e) {\n if (e == null) return false;\n return ((e instanceof Error[\"__BluebirdErrorTypes__\"].OperationalError) ||\n e[\"isOperational\"] === true);\n}\n\nfunction canAttachTrace(obj) {\n return obj instanceof Error && es5.propertyIsWritable(obj, \"stack\");\n}\n\nvar ensureErrorObject = (function() {\n if (!(\"stack\" in new Error())) {\n return function(value) {\n if (canAttachTrace(value)) return value;\n try {throw new Error(safeToString(value));}\n catch(err) {return err;}\n };\n } else {\n return function(value) {\n if (canAttachTrace(value)) return value;\n return new Error(safeToString(value));\n };\n }\n})();\n\nfunction classString(obj) {\n return {}.toString.call(obj);\n}\n\nfunction copyDescriptors(from, to, filter) {\n var keys = es5.names(from);\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n if (filter(key)) {\n es5.defineProperty(to, key, es5.getDescriptor(from, key));\n }\n }\n}\n\nvar ret = {\n isClass: isClass,\n isIdentifier: isIdentifier,\n inheritedDataKeys: inheritedDataKeys,\n getDataPropertyOrDefault: getDataPropertyOrDefault,\n thrower: thrower,\n isArray: es5.isArray,\n haveGetters: haveGetters,\n notEnumerableProp: notEnumerableProp,\n isPrimitive: isPrimitive,\n isObject: isObject,\n canEvaluate: canEvaluate,\n errorObj: errorObj,\n tryCatch: tryCatch,\n inherits: inherits,\n withAppended: withAppended,\n maybeWrapAsError: maybeWrapAsError,\n wrapsPrimitiveReceiver: wrapsPrimitiveReceiver,\n toFastProperties: toFastProperties,\n filledRange: filledRange,\n toString: safeToString,\n canAttachTrace: canAttachTrace,\n ensureErrorObject: ensureErrorObject,\n originatesFromRejection: originatesFromRejection,\n markAsOriginatingFromRejection: markAsOriginatingFromRejection,\n classString: classString,\n copyDescriptors: copyDescriptors,\n isNode: typeof process !== \"undefined\" &&\n classString(process).toLowerCase() === \"[object process]\"\n};\ntry {throw new Error(); } catch (e) {ret.lastLineError = e;}\nmodule.exports = ret;\n\n},{\"./es5.js\":14}]},{},[4])(4)\n}); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; }\n}).call(this,require('_process'),typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"_process\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/process/browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/lib/_empty.js\":[function(require,module,exports){\n\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/browser-resolve/empty.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/lib/_empty.js\"][0].apply(exports,arguments)\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\":[function(require,module,exports){\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('is-array')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\nBuffer.poolSize = 8192 // not used by this implementation\n\nvar kMaxLength = 0x3fffffff\nvar rootParent = {}\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Note:\n *\n * - Implementation must support adding new properties to `Uint8Array` instances.\n * Firefox 4-29 lacked support, fixed in Firefox 30+.\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n *\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they will\n * get the Object implementation, which is slower but will work correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = (function () {\n try {\n var buf = new ArrayBuffer(0)\n var arr = new Uint8Array(buf)\n arr.foo = function () { return 42 }\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n new Uint8Array(1).subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n})()\n\n/**\n * Class: Buffer\n * =============\n *\n * The Buffer constructor returns instances of `Uint8Array` that are augmented\n * with function properties for all the node `Buffer` API functions. We use\n * `Uint8Array` so that square bracket notation works as expected -- it returns\n * a single octet.\n *\n * By augmenting the instances, we can avoid modifying the `Uint8Array`\n * prototype.\n */\nfunction Buffer (subject, encoding) {\n var self = this\n if (!(self instanceof Buffer)) return new Buffer(subject, encoding)\n\n var type = typeof subject\n var length\n\n if (type === 'number') {\n length = +subject\n } else if (type === 'string') {\n length = Buffer.byteLength(subject, encoding)\n } else if (type === 'object' && subject !== null) {\n // assume object is array-like\n if (subject.type === 'Buffer' && isArray(subject.data)) subject = subject.data\n length = +subject.length\n } else {\n throw new TypeError('must start with number, buffer, array or string')\n }\n\n if (length > kMaxLength) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum size: 0x' +\n kMaxLength.toString(16) + ' bytes')\n }\n\n if (length < 0) length = 0\n else length >>>= 0 // coerce to uint32\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Preferred: Return an augmented `Uint8Array` instance for best performance\n self = Buffer._augment(new Uint8Array(length)) // eslint-disable-line consistent-this\n } else {\n // Fallback: Return THIS instance of Buffer (created by `new`)\n self.length = length\n self._isBuffer = true\n }\n\n var i\n if (Buffer.TYPED_ARRAY_SUPPORT && typeof subject.byteLength === 'number') {\n // Speed optimization -- use set if we're copying from a typed array\n self._set(subject)\n } else if (isArrayish(subject)) {\n // Treat array-ish objects as a byte array\n if (Buffer.isBuffer(subject)) {\n for (i = 0; i < length; i++) {\n self[i] = subject.readUInt8(i)\n }\n } else {\n for (i = 0; i < length; i++) {\n self[i] = ((subject[i] % 256) + 256) % 256\n }\n }\n } else if (type === 'string') {\n self.write(subject, 0, encoding)\n } else if (type === 'number' && !Buffer.TYPED_ARRAY_SUPPORT) {\n for (i = 0; i < length; i++) {\n self[i] = 0\n }\n }\n\n if (length > 0 && length <= Buffer.poolSize) self.parent = rootParent\n\n return self\n}\n\nfunction SlowBuffer (subject, encoding) {\n if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding)\n\n var buf = new Buffer(subject, encoding)\n delete buf.parent\n return buf\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n for (var i = 0, len = Math.min(x, y); i < len && a[i] === b[i]; i++) {}\n if (i !== len) {\n x = a[i]\n y = b[i]\n }\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'binary':\n case 'base64':\n case 'raw':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, totalLength) {\n if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.')\n\n if (list.length === 0) {\n return new Buffer(0)\n } else if (list.length === 1) {\n return list[0]\n }\n\n var i\n if (totalLength === undefined) {\n totalLength = 0\n for (i = 0; i < list.length; i++) {\n totalLength += list[i].length\n }\n }\n\n var buf = new Buffer(totalLength)\n var pos = 0\n for (i = 0; i < list.length; i++) {\n var item = list[i]\n item.copy(buf, pos)\n pos += item.length\n }\n return buf\n}\n\nBuffer.byteLength = function byteLength (str, encoding) {\n var ret\n str = str + ''\n switch (encoding || 'utf8') {\n case 'ascii':\n case 'binary':\n case 'raw':\n ret = str.length\n break\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n ret = str.length * 2\n break\n case 'hex':\n ret = str.length >>> 1\n break\n case 'utf8':\n case 'utf-8':\n ret = utf8ToBytes(str).length\n break\n case 'base64':\n ret = base64ToBytes(str).length\n break\n default:\n ret = str.length\n }\n return ret\n}\n\n// pre-set for values that may exist in the future\nBuffer.prototype.length = undefined\nBuffer.prototype.parent = undefined\n\n// toString(encoding, start=0, end=buffer.length)\nBuffer.prototype.toString = function toString (encoding, start, end) {\n var loweredCase = false\n\n start = start >>> 0\n end = end === undefined || end === Infinity ? this.length : end >>> 0\n\n if (!encoding) encoding = 'utf8'\n if (start < 0) start = 0\n if (end > this.length) end = this.length\n if (end <= start) return ''\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'binary':\n return binarySlice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return 0\n return Buffer.compare(this, b)\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset) {\n if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff\n else if (byteOffset < -0x80000000) byteOffset = -0x80000000\n byteOffset >>= 0\n\n if (this.length === 0) return -1\n if (byteOffset >= this.length) return -1\n\n // Negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)\n\n if (typeof val === 'string') {\n if (val.length === 0) return -1 // special case: looking for empty string always fails\n return String.prototype.indexOf.call(this, val, byteOffset)\n }\n if (Buffer.isBuffer(val)) {\n return arrayIndexOf(this, val, byteOffset)\n }\n if (typeof val === 'number') {\n if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {\n return Uint8Array.prototype.indexOf.call(this, val, byteOffset)\n }\n return arrayIndexOf(this, [ val ], byteOffset)\n }\n\n function arrayIndexOf (arr, val, byteOffset) {\n var foundIndex = -1\n for (var i = 0; byteOffset + i < arr.length; i++) {\n if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex\n } else {\n foundIndex = -1\n }\n }\n return -1\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\n// `get` will be removed in Node 0.13+\nBuffer.prototype.get = function get (offset) {\n console.log('.get() is deprecated. Access using array indexes instead.')\n return this.readUInt8(offset)\n}\n\n// `set` will be removed in Node 0.13+\nBuffer.prototype.set = function set (v, offset) {\n console.log('.set() is deprecated. Access using array indexes instead.')\n return this.writeUInt8(v, offset)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new Error('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; i++) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) throw new Error('Invalid hex string')\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n var charsWritten = blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n return charsWritten\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n var charsWritten = blitBuffer(asciiToBytes(string), buf, offset, length)\n return charsWritten\n}\n\nfunction binaryWrite (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n var charsWritten = blitBuffer(base64ToBytes(string), buf, offset, length)\n return charsWritten\n}\n\nfunction utf16leWrite (buf, string, offset, length) {\n var charsWritten = blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n return charsWritten\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Support both (string, offset, length, encoding)\n // and the legacy (string, encoding, offset, length)\n if (isFinite(offset)) {\n if (!isFinite(length)) {\n encoding = length\n length = undefined\n }\n } else { // legacy\n var swap = encoding\n encoding = offset\n offset = length\n length = swap\n }\n\n offset = Number(offset) || 0\n\n if (length < 0 || offset < 0 || offset > this.length) {\n throw new RangeError('attempt to write outside buffer bounds')\n }\n\n var remaining = this.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n encoding = String(encoding || 'utf8').toLowerCase()\n\n var ret\n switch (encoding) {\n case 'hex':\n ret = hexWrite(this, string, offset, length)\n break\n case 'utf8':\n case 'utf-8':\n ret = utf8Write(this, string, offset, length)\n break\n case 'ascii':\n ret = asciiWrite(this, string, offset, length)\n break\n case 'binary':\n ret = binaryWrite(this, string, offset, length)\n break\n case 'base64':\n ret = base64Write(this, string, offset, length)\n break\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n ret = utf16leWrite(this, string, offset, length)\n break\n default:\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n return ret\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n var res = ''\n var tmp = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; i++) {\n if (buf[i] <= 0x7F) {\n res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i])\n tmp = ''\n } else {\n tmp += '%' + buf[i].toString(16)\n }\n }\n\n return res + decodeUtf8Char(tmp)\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; i++) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction binarySlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; i++) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; i++) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = Buffer._augment(this.subarray(start, end))\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; i++) {\n newBuf[i] = this[i + start]\n }\n }\n\n if (newBuf.length) newBuf.parent = this.parent || this\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('value is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) >>> 0 & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) >>> 0 & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = value\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = value\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = value\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = value\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = value\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkInt(\n this, value, offset, byteLength,\n Math.pow(2, 8 * byteLength - 1) - 1,\n -Math.pow(2, 8 * byteLength - 1)\n )\n }\n\n var i = 0\n var mul = 1\n var sub = value < 0 ? 1 : 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkInt(\n this, value, offset, byteLength,\n Math.pow(2, 8 * byteLength - 1) - 1,\n -Math.pow(2, 8 * byteLength - 1)\n )\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = value < 0 ? 1 : 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = value\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = value\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = value\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = value\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = value\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (value > max || value < min) throw new RangeError('value is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('index out of range')\n if (offset < 0) throw new RangeError('index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, target_start, start, end) {\n var self = this // source\n\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (target_start >= target.length) target_start = target.length\n if (!target_start) target_start = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || self.length === 0) return 0\n\n // Fatal error conditions\n if (target_start < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= self.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - target_start < end - start) {\n end = target.length - target_start + start\n }\n\n var len = end - start\n\n if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < len; i++) {\n target[i + target_start] = this[i + start]\n }\n } else {\n target._set(this.subarray(start, start + len), target_start)\n }\n\n return len\n}\n\n// fill(value, start=0, end=buffer.length)\nBuffer.prototype.fill = function fill (value, start, end) {\n if (!value) value = 0\n if (!start) start = 0\n if (!end) end = this.length\n\n if (end < start) throw new RangeError('end < start')\n\n // Fill 0 bytes; we're done\n if (end === start) return\n if (this.length === 0) return\n\n if (start < 0 || start >= this.length) throw new RangeError('start out of bounds')\n if (end < 0 || end > this.length) throw new RangeError('end out of bounds')\n\n var i\n if (typeof value === 'number') {\n for (i = start; i < end; i++) {\n this[i] = value\n }\n } else {\n var bytes = utf8ToBytes(value.toString())\n var len = bytes.length\n for (i = start; i < end; i++) {\n this[i] = bytes[i % len]\n }\n }\n\n return this\n}\n\n/**\n * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.\n * Added in Node 0.12. Only available in browsers that support ArrayBuffer.\n */\nBuffer.prototype.toArrayBuffer = function toArrayBuffer () {\n if (typeof Uint8Array !== 'undefined') {\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n return (new Buffer(this)).buffer\n } else {\n var buf = new Uint8Array(this.length)\n for (var i = 0, len = buf.length; i < len; i += 1) {\n buf[i] = this[i]\n }\n return buf.buffer\n }\n } else {\n throw new TypeError('Buffer.toArrayBuffer not supported in this browser')\n }\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar BP = Buffer.prototype\n\n/**\n * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods\n */\nBuffer._augment = function _augment (arr) {\n arr.constructor = Buffer\n arr._isBuffer = true\n\n // save reference to original Uint8Array get/set methods before overwriting\n arr._get = arr.get\n arr._set = arr.set\n\n // deprecated, will be removed in node 0.13+\n arr.get = BP.get\n arr.set = BP.set\n\n arr.write = BP.write\n arr.toString = BP.toString\n arr.toLocaleString = BP.toString\n arr.toJSON = BP.toJSON\n arr.equals = BP.equals\n arr.compare = BP.compare\n arr.indexOf = BP.indexOf\n arr.copy = BP.copy\n arr.slice = BP.slice\n arr.readUIntLE = BP.readUIntLE\n arr.readUIntBE = BP.readUIntBE\n arr.readUInt8 = BP.readUInt8\n arr.readUInt16LE = BP.readUInt16LE\n arr.readUInt16BE = BP.readUInt16BE\n arr.readUInt32LE = BP.readUInt32LE\n arr.readUInt32BE = BP.readUInt32BE\n arr.readIntLE = BP.readIntLE\n arr.readIntBE = BP.readIntBE\n arr.readInt8 = BP.readInt8\n arr.readInt16LE = BP.readInt16LE\n arr.readInt16BE = BP.readInt16BE\n arr.readInt32LE = BP.readInt32LE\n arr.readInt32BE = BP.readInt32BE\n arr.readFloatLE = BP.readFloatLE\n arr.readFloatBE = BP.readFloatBE\n arr.readDoubleLE = BP.readDoubleLE\n arr.readDoubleBE = BP.readDoubleBE\n arr.writeUInt8 = BP.writeUInt8\n arr.writeUIntLE = BP.writeUIntLE\n arr.writeUIntBE = BP.writeUIntBE\n arr.writeUInt16LE = BP.writeUInt16LE\n arr.writeUInt16BE = BP.writeUInt16BE\n arr.writeUInt32LE = BP.writeUInt32LE\n arr.writeUInt32BE = BP.writeUInt32BE\n arr.writeIntLE = BP.writeIntLE\n arr.writeIntBE = BP.writeIntBE\n arr.writeInt8 = BP.writeInt8\n arr.writeInt16LE = BP.writeInt16LE\n arr.writeInt16BE = BP.writeInt16BE\n arr.writeInt32LE = BP.writeInt32LE\n arr.writeInt32BE = BP.writeInt32BE\n arr.writeFloatLE = BP.writeFloatLE\n arr.writeFloatBE = BP.writeFloatBE\n arr.writeDoubleLE = BP.writeDoubleLE\n arr.writeDoubleBE = BP.writeDoubleBE\n arr.fill = BP.fill\n arr.inspect = BP.inspect\n arr.toArrayBuffer = BP.toArrayBuffer\n\n return arr\n}\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-z\\-]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction isArrayish (subject) {\n return isArray(subject) || Buffer.isBuffer(subject) ||\n subject && typeof subject === 'object' &&\n typeof subject.length === 'number'\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n var i = 0\n\n for (; i < length; i++) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (leadSurrogate) {\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n } else {\n // valid surrogate pair\n codePoint = leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00 | 0x10000\n leadSurrogate = null\n }\n } else {\n // no lead yet\n\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else {\n // valid lead\n leadSurrogate = codePoint\n continue\n }\n }\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = null\n }\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x200000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; i++) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; i++) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; i++) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction decodeUtf8Char (str) {\n try {\n return decodeURIComponent(str)\n } catch (err) {\n return String.fromCharCode(0xFFFD) // UTF 8 invalid char\n }\n}\n\n},{\"base64-js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/node_modules/base64-js/lib/b64.js\",\"ieee754\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/node_modules/ieee754/index.js\",\"is-array\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/node_modules/is-array/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/node_modules/base64-js/lib/b64.js\":[function(require,module,exports){\nvar lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n;(function (exports) {\n\t'use strict';\n\n var Arr = (typeof Uint8Array !== 'undefined')\n ? Uint8Array\n : Array\n\n\tvar PLUS = '+'.charCodeAt(0)\n\tvar SLASH = '/'.charCodeAt(0)\n\tvar NUMBER = '0'.charCodeAt(0)\n\tvar LOWER = 'a'.charCodeAt(0)\n\tvar UPPER = 'A'.charCodeAt(0)\n\tvar PLUS_URL_SAFE = '-'.charCodeAt(0)\n\tvar SLASH_URL_SAFE = '_'.charCodeAt(0)\n\n\tfunction decode (elt) {\n\t\tvar code = elt.charCodeAt(0)\n\t\tif (code === PLUS ||\n\t\t code === PLUS_URL_SAFE)\n\t\t\treturn 62 // '+'\n\t\tif (code === SLASH ||\n\t\t code === SLASH_URL_SAFE)\n\t\t\treturn 63 // '/'\n\t\tif (code < NUMBER)\n\t\t\treturn -1 //no match\n\t\tif (code < NUMBER + 10)\n\t\t\treturn code - NUMBER + 26 + 26\n\t\tif (code < UPPER + 26)\n\t\t\treturn code - UPPER\n\t\tif (code < LOWER + 26)\n\t\t\treturn code - LOWER + 26\n\t}\n\n\tfunction b64ToByteArray (b64) {\n\t\tvar i, j, l, tmp, placeHolders, arr\n\n\t\tif (b64.length % 4 > 0) {\n\t\t\tthrow new Error('Invalid string. Length must be a multiple of 4')\n\t\t}\n\n\t\t// the number of equal signs (place holders)\n\t\t// if there are two placeholders, than the two characters before it\n\t\t// represent one byte\n\t\t// if there is only one, then the three characters before it represent 2 bytes\n\t\t// this is just a cheap hack to not do indexOf twice\n\t\tvar len = b64.length\n\t\tplaceHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0\n\n\t\t// base64 is 4/3 + up to two characters of the original data\n\t\tarr = new Arr(b64.length * 3 / 4 - placeHolders)\n\n\t\t// if there are placeholders, only get up to the last complete 4 chars\n\t\tl = placeHolders > 0 ? b64.length - 4 : b64.length\n\n\t\tvar L = 0\n\n\t\tfunction push (v) {\n\t\t\tarr[L++] = v\n\t\t}\n\n\t\tfor (i = 0, j = 0; i < l; i += 4, j += 3) {\n\t\t\ttmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))\n\t\t\tpush((tmp & 0xFF0000) >> 16)\n\t\t\tpush((tmp & 0xFF00) >> 8)\n\t\t\tpush(tmp & 0xFF)\n\t\t}\n\n\t\tif (placeHolders === 2) {\n\t\t\ttmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)\n\t\t\tpush(tmp & 0xFF)\n\t\t} else if (placeHolders === 1) {\n\t\t\ttmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)\n\t\t\tpush((tmp >> 8) & 0xFF)\n\t\t\tpush(tmp & 0xFF)\n\t\t}\n\n\t\treturn arr\n\t}\n\n\tfunction uint8ToBase64 (uint8) {\n\t\tvar i,\n\t\t\textraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes\n\t\t\toutput = \"\",\n\t\t\ttemp, length\n\n\t\tfunction encode (num) {\n\t\t\treturn lookup.charAt(num)\n\t\t}\n\n\t\tfunction tripletToBase64 (num) {\n\t\t\treturn encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)\n\t\t}\n\n\t\t// go through the array every three bytes, we'll deal with trailing stuff later\n\t\tfor (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {\n\t\t\ttemp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\n\t\t\toutput += tripletToBase64(temp)\n\t\t}\n\n\t\t// pad the end with zeros, but make sure to not forget the extra bytes\n\t\tswitch (extraBytes) {\n\t\t\tcase 1:\n\t\t\t\ttemp = uint8[uint8.length - 1]\n\t\t\t\toutput += encode(temp >> 2)\n\t\t\t\toutput += encode((temp << 4) & 0x3F)\n\t\t\t\toutput += '=='\n\t\t\t\tbreak\n\t\t\tcase 2:\n\t\t\t\ttemp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])\n\t\t\t\toutput += encode(temp >> 10)\n\t\t\t\toutput += encode((temp >> 4) & 0x3F)\n\t\t\t\toutput += encode((temp << 2) & 0x3F)\n\t\t\t\toutput += '='\n\t\t\t\tbreak\n\t\t}\n\n\t\treturn output\n\t}\n\n\texports.toByteArray = b64ToByteArray\n\texports.fromByteArray = uint8ToBase64\n}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))\n\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/node_modules/ieee754/index.js\":[function(require,module,exports){\nexports.read = function(buffer, offset, isLE, mLen, nBytes) {\n var e, m,\n eLen = nBytes * 8 - mLen - 1,\n eMax = (1 << eLen) - 1,\n eBias = eMax >> 1,\n nBits = -7,\n i = isLE ? (nBytes - 1) : 0,\n d = isLE ? -1 : 1,\n s = buffer[offset + i];\n\n i += d;\n\n e = s & ((1 << (-nBits)) - 1);\n s >>= (-nBits);\n nBits += eLen;\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8);\n\n m = e & ((1 << (-nBits)) - 1);\n e >>= (-nBits);\n nBits += mLen;\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8);\n\n if (e === 0) {\n e = 1 - eBias;\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity);\n } else {\n m = m + Math.pow(2, mLen);\n e = e - eBias;\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen);\n};\n\nexports.write = function(buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c,\n eLen = nBytes * 8 - mLen - 1,\n eMax = (1 << eLen) - 1,\n eBias = eMax >> 1,\n rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),\n i = isLE ? 0 : (nBytes - 1),\n d = isLE ? 1 : -1,\n s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;\n\n value = Math.abs(value);\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0;\n e = eMax;\n } else {\n e = Math.floor(Math.log(value) / Math.LN2);\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--;\n c *= 2;\n }\n if (e + eBias >= 1) {\n value += rt / c;\n } else {\n value += rt * Math.pow(2, 1 - eBias);\n }\n if (value * c >= 2) {\n e++;\n c /= 2;\n }\n\n if (e + eBias >= eMax) {\n m = 0;\n e = eMax;\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen);\n e = e + eBias;\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);\n e = 0;\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8);\n\n e = (e << mLen) | m;\n eLen += mLen;\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8);\n\n buffer[offset + i - d] |= s * 128;\n};\n\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/node_modules/is-array/index.js\":[function(require,module,exports){\n\n/**\n * isArray\n */\n\nvar isArray = Array.isArray;\n\n/**\n * toString\n */\n\nvar str = Object.prototype.toString;\n\n/**\n * Whether or not the given `val`\n * is an array.\n *\n * example:\n *\n * isArray([]);\n * // > true\n * isArray(arguments);\n * // > false\n * isArray('');\n * // > false\n *\n * @param {mixed} val\n * @return {bool}\n */\n\nmodule.exports = isArray || function (val) {\n return !! val && '[object Array]' == str.call(val);\n};\n\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/index.js\":[function(require,module,exports){\n'use strict';\n\nexports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require('randombytes')\n\nexports.createHash = exports.Hash = require('create-hash')\n\nexports.createHmac = exports.Hmac = require('create-hmac')\n\nvar hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(Object.keys(require('browserify-sign/algos')))\nexports.getHashes = function () {\n return hashes;\n}\n\nvar p = require('pbkdf2-compat')\nexports.pbkdf2 = p.pbkdf2\nexports.pbkdf2Sync = p.pbkdf2Sync\n\nvar aes = require('browserify-aes');\n[\n 'Cipher',\n 'createCipher',\n 'Cipheriv',\n 'createCipheriv',\n 'Decipher',\n 'createDecipher',\n 'Decipheriv',\n 'createDecipheriv',\n 'getCiphers',\n 'listCiphers'\n].forEach(function (key) {\n exports[key] = aes[key];\n})\n\nvar dh = require('diffie-hellman');\n[\n 'DiffieHellmanGroup',\n 'createDiffieHellmanGroup',\n 'getDiffieHellman',\n 'createDiffieHellman',\n 'DiffieHellman'\n].forEach(function (key) {\n exports[key] = dh[key];\n})\n\nrequire('browserify-sign/inject')(module.exports, exports);\n\nexports.createECDH = require('create-ecdh')\n\nvar publicEncrypt = require('public-encrypt');\n\n[\n 'publicEncrypt',\n 'privateEncrypt',\n 'publicDecrypt',\n 'privateDecrypt'\n].forEach(function (key) {\n exports[key] = publicEncrypt[key];\n})\n\n// the least I can do is make error messages for the rest of the node.js/crypto api.\n;[\n 'createCredentials'\n].forEach(function (name) {\n exports[name] = function () {\n throw new Error([\n 'sorry, ' + name + ' is not implemented yet',\n 'we accept pull requests',\n 'https://github.com/crypto-browserify/crypto-browserify'\n ].join('\\n'));\n }\n})\n\n},{\"browserify-aes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/browser.js\",\"browserify-sign/algos\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/algos.js\",\"browserify-sign/inject\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/inject.js\",\"create-ecdh\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/index.js\",\"create-hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/browser.js\",\"create-hmac\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hmac/browser.js\",\"diffie-hellman\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/browser.js\",\"pbkdf2-compat\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/pbkdf2-compat/browser.js\",\"public-encrypt\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/browser.js\",\"randombytes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/randombytes/browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/EVP_BytesToKey.js\":[function(require,module,exports){\n(function (Buffer){\nvar md5 = require('create-hash/md5');\nmodule.exports = EVP_BytesToKey;\nfunction EVP_BytesToKey(password, keyLen, ivLen) {\n if (!Buffer.isBuffer(password)) {\n password = new Buffer(password, 'binary');\n }\n keyLen = keyLen/8;\n ivLen = ivLen || 0;\n var ki = 0;\n var ii = 0;\n var key = new Buffer(keyLen);\n var iv = new Buffer(ivLen);\n var addmd = 0;\n var md_buf;\n var i;\n var bufs = [];\n while (true) {\n if(addmd++ > 0) {\n bufs.push(md_buf);\n }\n bufs.push(password);\n md_buf = md5(Buffer.concat(bufs));\n bufs = [];\n i = 0;\n if(keyLen > 0) {\n while(true) {\n if(keyLen === 0) {\n break;\n }\n if(i === md_buf.length) {\n break;\n }\n key[ki++] = md_buf[i];\n keyLen--;\n i++;\n }\n }\n if(ivLen > 0 && i !== md_buf.length) {\n while(true) {\n if(ivLen === 0) {\n break;\n }\n if(i === md_buf.length) {\n break;\n }\n iv[ii++] = md_buf[i];\n ivLen--;\n i++;\n }\n }\n if(keyLen === 0 && ivLen === 0) {\n break;\n }\n }\n for(i=0;i uint_max || x < 0 ? (x_pos = Math.abs(x) % uint_max, x < 0 ? uint_max - x_pos : x_pos) : x;\n return ret;\n}\nfunction scrub_vec(v) {\n var i, _i, _ref;\n for (i = _i = 0, _ref = v.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {\n v[i] = 0;\n }\n return false;\n}\n\nfunction Global() {\n var i;\n this.SBOX = [];\n this.INV_SBOX = [];\n this.SUB_MIX = (function() {\n var _i, _results;\n _results = [];\n for (i = _i = 0; _i < 4; i = ++_i) {\n _results.push([]);\n }\n return _results;\n })();\n this.INV_SUB_MIX = (function() {\n var _i, _results;\n _results = [];\n for (i = _i = 0; _i < 4; i = ++_i) {\n _results.push([]);\n }\n return _results;\n })();\n this.init();\n this.RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];\n}\n\nGlobal.prototype.init = function() {\n var d, i, sx, t, x, x2, x4, x8, xi, _i;\n d = (function() {\n var _i, _results;\n _results = [];\n for (i = _i = 0; _i < 256; i = ++_i) {\n if (i < 128) {\n _results.push(i << 1);\n } else {\n _results.push((i << 1) ^ 0x11b);\n }\n }\n return _results;\n })();\n x = 0;\n xi = 0;\n for (i = _i = 0; _i < 256; i = ++_i) {\n sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);\n sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;\n this.SBOX[x] = sx;\n this.INV_SBOX[sx] = x;\n x2 = d[x];\n x4 = d[x2];\n x8 = d[x4];\n t = (d[sx] * 0x101) ^ (sx * 0x1010100);\n this.SUB_MIX[0][x] = (t << 24) | (t >>> 8);\n this.SUB_MIX[1][x] = (t << 16) | (t >>> 16);\n this.SUB_MIX[2][x] = (t << 8) | (t >>> 24);\n this.SUB_MIX[3][x] = t;\n t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);\n this.INV_SUB_MIX[0][sx] = (t << 24) | (t >>> 8);\n this.INV_SUB_MIX[1][sx] = (t << 16) | (t >>> 16);\n this.INV_SUB_MIX[2][sx] = (t << 8) | (t >>> 24);\n this.INV_SUB_MIX[3][sx] = t;\n if (x === 0) {\n x = xi = 1;\n } else {\n x = x2 ^ d[d[d[x8 ^ x2]]];\n xi ^= d[d[xi]];\n }\n }\n return true;\n};\n\nvar G = new Global();\n\n\nAES.blockSize = 4 * 4;\n\nAES.prototype.blockSize = AES.blockSize;\n\nAES.keySize = 256 / 8;\n\nAES.prototype.keySize = AES.keySize;\n\n function bufferToArray(buf) {\n var len = buf.length/4;\n var out = new Array(len);\n var i = -1;\n while (++i < len) {\n out[i] = buf.readUInt32BE(i * 4);\n }\n return out;\n }\nfunction AES(key) {\n this._key = bufferToArray(key);\n this._doReset();\n}\n\nAES.prototype._doReset = function() {\n var invKsRow, keySize, keyWords, ksRow, ksRows, t, _i, _j;\n keyWords = this._key;\n keySize = keyWords.length;\n this._nRounds = keySize + 6;\n ksRows = (this._nRounds + 1) * 4;\n this._keySchedule = [];\n for (ksRow = _i = 0; 0 <= ksRows ? _i < ksRows : _i > ksRows; ksRow = 0 <= ksRows ? ++_i : --_i) {\n this._keySchedule[ksRow] = ksRow < keySize ? keyWords[ksRow] : (t = this._keySchedule[ksRow - 1], (ksRow % keySize) === 0 ? (t = (t << 8) | (t >>> 24), t = (G.SBOX[t >>> 24] << 24) | (G.SBOX[(t >>> 16) & 0xff] << 16) | (G.SBOX[(t >>> 8) & 0xff] << 8) | G.SBOX[t & 0xff], t ^= G.RCON[(ksRow / keySize) | 0] << 24) : keySize > 6 && ksRow % keySize === 4 ? t = (G.SBOX[t >>> 24] << 24) | (G.SBOX[(t >>> 16) & 0xff] << 16) | (G.SBOX[(t >>> 8) & 0xff] << 8) | G.SBOX[t & 0xff] : void 0, this._keySchedule[ksRow - keySize] ^ t);\n }\n this._invKeySchedule = [];\n for (invKsRow = _j = 0; 0 <= ksRows ? _j < ksRows : _j > ksRows; invKsRow = 0 <= ksRows ? ++_j : --_j) {\n ksRow = ksRows - invKsRow;\n t = this._keySchedule[ksRow - (invKsRow % 4 ? 0 : 4)];\n this._invKeySchedule[invKsRow] = invKsRow < 4 || ksRow <= 4 ? t : G.INV_SUB_MIX[0][G.SBOX[t >>> 24]] ^ G.INV_SUB_MIX[1][G.SBOX[(t >>> 16) & 0xff]] ^ G.INV_SUB_MIX[2][G.SBOX[(t >>> 8) & 0xff]] ^ G.INV_SUB_MIX[3][G.SBOX[t & 0xff]];\n }\n return true;\n};\n\nAES.prototype.encryptBlock = function(M) {\n M = bufferToArray(new Buffer(M));\n var out = this._doCryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX);\n var buf = new Buffer(16);\n buf.writeUInt32BE(out[0], 0);\n buf.writeUInt32BE(out[1], 4);\n buf.writeUInt32BE(out[2], 8);\n buf.writeUInt32BE(out[3], 12);\n return buf;\n};\n\nAES.prototype.decryptBlock = function(M) {\n M = bufferToArray(new Buffer(M));\n var temp = [M[3], M[1]];\n M[1] = temp[0];\n M[3] = temp[1];\n var out = this._doCryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX);\n var buf = new Buffer(16);\n buf.writeUInt32BE(out[0], 0);\n buf.writeUInt32BE(out[3], 4);\n buf.writeUInt32BE(out[2], 8);\n buf.writeUInt32BE(out[1], 12);\n return buf;\n};\n\nAES.prototype.scrub = function() {\n scrub_vec(this._keySchedule);\n scrub_vec(this._invKeySchedule);\n scrub_vec(this._key);\n};\n\nAES.prototype._doCryptBlock = function(M, keySchedule, SUB_MIX, SBOX) {\n var ksRow, round, s0, s1, s2, s3, t0, t1, t2, t3, _i, _ref;\n\n s0 = M[0] ^ keySchedule[0];\n s1 = M[1] ^ keySchedule[1];\n s2 = M[2] ^ keySchedule[2];\n s3 = M[3] ^ keySchedule[3];\n ksRow = 4;\n for (round = _i = 1, _ref = this._nRounds; 1 <= _ref ? _i < _ref : _i > _ref; round = 1 <= _ref ? ++_i : --_i) {\n t0 = SUB_MIX[0][s0 >>> 24] ^ SUB_MIX[1][(s1 >>> 16) & 0xff] ^ SUB_MIX[2][(s2 >>> 8) & 0xff] ^ SUB_MIX[3][s3 & 0xff] ^ keySchedule[ksRow++];\n t1 = SUB_MIX[0][s1 >>> 24] ^ SUB_MIX[1][(s2 >>> 16) & 0xff] ^ SUB_MIX[2][(s3 >>> 8) & 0xff] ^ SUB_MIX[3][s0 & 0xff] ^ keySchedule[ksRow++];\n t2 = SUB_MIX[0][s2 >>> 24] ^ SUB_MIX[1][(s3 >>> 16) & 0xff] ^ SUB_MIX[2][(s0 >>> 8) & 0xff] ^ SUB_MIX[3][s1 & 0xff] ^ keySchedule[ksRow++];\n t3 = SUB_MIX[0][s3 >>> 24] ^ SUB_MIX[1][(s0 >>> 16) & 0xff] ^ SUB_MIX[2][(s1 >>> 8) & 0xff] ^ SUB_MIX[3][s2 & 0xff] ^ keySchedule[ksRow++];\n s0 = t0;\n s1 = t1;\n s2 = t2;\n s3 = t3;\n }\n t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];\n t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];\n t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];\n t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];\n return [\n fixup_uint32(t0),\n fixup_uint32(t1),\n fixup_uint32(t2),\n fixup_uint32(t3)\n ];\n\n};\n\n\n\n\n exports.AES = AES;\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/authCipher.js\":[function(require,module,exports){\n(function (Buffer){\nvar aes = require('./aes');\nvar Transform = require('./cipherBase');\nvar inherits = require('inherits');\nvar GHASH = require('./ghash');\nvar xor = require('./xor');\ninherits(StreamCipher, Transform);\nmodule.exports = StreamCipher;\n\nfunction StreamCipher(mode, key, iv, decrypt) {\n if (!(this instanceof StreamCipher)) {\n return new StreamCipher(mode, key, iv);\n }\n Transform.call(this);\n this._finID = Buffer.concat([iv, new Buffer([0, 0, 0, 1])]);\n iv = Buffer.concat([iv, new Buffer([0, 0, 0, 2])]);\n this._cipher = new aes.AES(key);\n this._prev = new Buffer(iv.length);\n this._cache = new Buffer('');\n this._secCache = new Buffer('');\n this._decrypt = decrypt;\n this._alen = 0;\n this._len = 0;\n iv.copy(this._prev);\n this._mode = mode;\n var h = new Buffer(4);\n h.fill(0);\n this._ghash = new GHASH(this._cipher.encryptBlock(h));\n this._authTag = null;\n this._called = false;\n}\nStreamCipher.prototype._update = function (chunk) {\n if (!this._called && this._alen) {\n var rump = 16 - (this._alen % 16);\n if (rump <16) {\n rump = new Buffer(rump);\n rump.fill(0);\n this._ghash.update(rump);\n }\n }\n this._called = true;\n var out = this._mode.encrypt(this, chunk);\n if (this._decrypt) {\n this._ghash.update(chunk);\n } else {\n this._ghash.update(out);\n }\n this._len += chunk.length;\n return out;\n};\nStreamCipher.prototype._final = function () {\n if (this._decrypt && !this._authTag) {\n throw new Error('Unsupported state or unable to authenticate data');\n }\n var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID));\n if (this._decrypt) {\n if (xorTest(tag, this._authTag)) {\n throw new Error('Unsupported state or unable to authenticate data');\n }\n } else {\n this._authTag = tag;\n }\n this._cipher.scrub();\n};\nStreamCipher.prototype.getAuthTag = function getAuthTag () {\n if (!this._decrypt && Buffer.isBuffer(this._authTag)) {\n return this._authTag;\n } else {\n throw new Error('Attempting to get auth tag in unsupported state');\n }\n};\nStreamCipher.prototype.setAuthTag = function setAuthTag (tag) {\n if (this._decrypt) {\n this._authTag = tag;\n } else {\n throw new Error('Attempting to set auth tag in unsupported state');\n }\n};\nStreamCipher.prototype.setAAD = function setAAD (buf) {\n if (!this._called) {\n this._ghash.update(buf);\n this._alen += buf.length;\n } else {\n throw new Error('Attempting to set AAD in unsupported state');\n }\n};\nfunction xorTest(a, b) {\n var out = 0;\n if (a.length !== b.length) {\n out++;\n }\n var len = Math.min(a.length, b.length);\n var i = -1;\n while (++i < len) {\n out += (a[i] ^ b[i]);\n }\n return out;\n}\n\n\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./aes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/aes.js\",\"./cipherBase\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/cipherBase.js\",\"./ghash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/ghash.js\",\"./xor\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/xor.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/browser.js\":[function(require,module,exports){\nvar ciphers = require('./encrypter');\nexports.createCipher = exports.Cipher = ciphers.createCipher;\nexports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv;\nvar deciphers = require('./decrypter');\nexports.createDecipher = exports.Decipher = deciphers.createDecipher;\nexports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv;\nvar modes = require('./modes');\nfunction getCiphers () {\n return Object.keys(modes);\n}\nexports.listCiphers = exports.getCiphers = getCiphers;\n\n},{\"./decrypter\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/decrypter.js\",\"./encrypter\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/encrypter.js\",\"./modes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/cipherBase.js\":[function(require,module,exports){\n(function (Buffer){\nvar Transform = require('stream').Transform;\nvar inherits = require('inherits');\n\nmodule.exports = CipherBase;\ninherits(CipherBase, Transform);\nfunction CipherBase() {\n Transform.call(this);\n}\nCipherBase.prototype.update = function (data, inputEnc, outputEnc) {\n if (typeof data === 'string') {\n data = new Buffer(data, inputEnc);\n }\n var outData = this._update(data);\n if (outputEnc) {\n outData = outData.toString(outputEnc);\n }\n return outData;\n};\nCipherBase.prototype._transform = function (data, _, next) {\n this.push(this._update(data));\n next();\n};\nCipherBase.prototype._flush = function (next) {\n try {\n this.push(this._final());\n } catch(e) {\n return next(e);\n }\n next();\n};\nCipherBase.prototype.final = function (outputEnc) {\n var outData = this._final() || new Buffer('');\n if (outputEnc) {\n outData = outData.toString(outputEnc);\n }\n return outData;\n};\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\",\"stream\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/stream-browserify/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/decrypter.js\":[function(require,module,exports){\n(function (Buffer){\nvar aes = require('./aes');\nvar Transform = require('./cipherBase');\nvar inherits = require('inherits');\nvar modes = require('./modes');\nvar StreamCipher = require('./streamCipher');\nvar AuthCipher = require('./authCipher');\nvar ebtk = require('./EVP_BytesToKey');\n\ninherits(Decipher, Transform);\nfunction Decipher(mode, key, iv) {\n if (!(this instanceof Decipher)) {\n return new Decipher(mode, key, iv);\n }\n Transform.call(this);\n this._cache = new Splitter();\n this._last = void 0;\n this._cipher = new aes.AES(key);\n this._prev = new Buffer(iv.length);\n iv.copy(this._prev);\n this._mode = mode;\n this._autopadding = true;\n}\nDecipher.prototype._update = function (data) {\n this._cache.add(data);\n var chunk;\n var thing;\n var out = [];\n while ((chunk = this._cache.get(this._autopadding))) {\n thing = this._mode.decrypt(this, chunk);\n out.push(thing);\n }\n return Buffer.concat(out);\n};\nDecipher.prototype._final = function () {\n var chunk = this._cache.flush();\n if (this._autopadding) {\n return unpad(this._mode.decrypt(this, chunk));\n } else if (chunk) {\n throw new Error('data not multiple of block length');\n }\n};\nDecipher.prototype.setAutoPadding = function (setTo) {\n this._autopadding = !!setTo;\n};\nfunction Splitter() {\n if (!(this instanceof Splitter)) {\n return new Splitter();\n }\n this.cache = new Buffer('');\n}\nSplitter.prototype.add = function (data) {\n this.cache = Buffer.concat([this.cache, data]);\n};\n\nSplitter.prototype.get = function (autoPadding) {\n var out;\n if (autoPadding) {\n if (this.cache.length > 16) {\n out = this.cache.slice(0, 16);\n this.cache = this.cache.slice(16);\n return out;\n }\n } else {\n if (this.cache.length >= 16) {\n out = this.cache.slice(0, 16);\n this.cache = this.cache.slice(16);\n return out;\n }\n }\n return null;\n};\nSplitter.prototype.flush = function () {\n if (this.cache.length) {\n return this.cache;\n }\n};\nfunction unpad(last) {\n var padded = last[15];\n var i = -1;\n while (++i < padded) {\n if (last[(i + (16 - padded))] !== padded) {\n throw new Error('unable to decrypt data');\n }\n }\n if (padded === 16) {\n return;\n }\n return last.slice(0, 16 - padded);\n}\n\nvar modelist = {\n ECB: require('./modes/ecb'),\n CBC: require('./modes/cbc'),\n CFB: require('./modes/cfb'),\n CFB8: require('./modes/cfb8'),\n CFB1: require('./modes/cfb1'),\n OFB: require('./modes/ofb'),\n CTR: require('./modes/ctr'),\n GCM: require('./modes/ctr')\n};\n\n\nfunction createDecipheriv(suite, password, iv) {\n var config = modes[suite.toLowerCase()];\n if (!config) {\n throw new TypeError('invalid suite type');\n }\n if (typeof iv === 'string') {\n iv = new Buffer(iv);\n }\n if (typeof password === 'string') {\n password = new Buffer(password);\n }\n if (password.length !== config.key/8) {\n throw new TypeError('invalid key length ' + password.length);\n }\n if (iv.length !== config.iv) {\n throw new TypeError('invalid iv length ' + iv.length);\n }\n if (config.type === 'stream') {\n return new StreamCipher(modelist[config.mode], password, iv, true);\n } else if (config.type === 'auth') {\n return new AuthCipher(modelist[config.mode], password, iv, true);\n }\n return new Decipher(modelist[config.mode], password, iv);\n}\n\nfunction createDecipher (suite, password) {\n var config = modes[suite.toLowerCase()];\n if (!config) {\n throw new TypeError('invalid suite type');\n }\n var keys = ebtk(password, config.key, config.iv);\n return createDecipheriv(suite, keys.key, keys.iv);\n}\nexports.createDecipher = createDecipher;\nexports.createDecipheriv = createDecipheriv;\n}).call(this,require(\"buffer\").Buffer)\n},{\"./EVP_BytesToKey\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/EVP_BytesToKey.js\",\"./aes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/aes.js\",\"./authCipher\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/authCipher.js\",\"./cipherBase\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/cipherBase.js\",\"./modes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes.js\",\"./modes/cbc\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cbc.js\",\"./modes/cfb\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb.js\",\"./modes/cfb1\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb1.js\",\"./modes/cfb8\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb8.js\",\"./modes/ctr\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ctr.js\",\"./modes/ecb\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ecb.js\",\"./modes/ofb\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ofb.js\",\"./streamCipher\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/streamCipher.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/encrypter.js\":[function(require,module,exports){\n(function (Buffer){\nvar aes = require('./aes');\nvar Transform = require('./cipherBase');\nvar inherits = require('inherits');\nvar modes = require('./modes');\nvar ebtk = require('./EVP_BytesToKey');\nvar StreamCipher = require('./streamCipher');\nvar AuthCipher = require('./authCipher');\ninherits(Cipher, Transform);\nfunction Cipher(mode, key, iv) {\n if (!(this instanceof Cipher)) {\n return new Cipher(mode, key, iv);\n }\n Transform.call(this);\n this._cache = new Splitter();\n this._cipher = new aes.AES(key);\n this._prev = new Buffer(iv.length);\n iv.copy(this._prev);\n this._mode = mode;\n this._autopadding = true;\n}\nCipher.prototype._update = function (data) {\n this._cache.add(data);\n var chunk;\n var thing;\n var out = [];\n while ((chunk = this._cache.get())) {\n thing = this._mode.encrypt(this, chunk);\n out.push(thing);\n }\n return Buffer.concat(out);\n};\nCipher.prototype._final = function () {\n var chunk = this._cache.flush();\n if (this._autopadding) {\n chunk = this._mode.encrypt(this, chunk);\n this._cipher.scrub();\n return chunk;\n } else if (chunk.toString('hex') !== '10101010101010101010101010101010') {\n this._cipher.scrub();\n throw new Error('data not multiple of block length');\n }\n};\nCipher.prototype.setAutoPadding = function (setTo) {\n this._autopadding = !!setTo;\n};\n\nfunction Splitter() {\n if (!(this instanceof Splitter)) {\n return new Splitter();\n }\n this.cache = new Buffer('');\n}\nSplitter.prototype.add = function (data) {\n this.cache = Buffer.concat([this.cache, data]);\n};\n\nSplitter.prototype.get = function () {\n if (this.cache.length > 15) {\n var out = this.cache.slice(0, 16);\n this.cache = this.cache.slice(16);\n return out;\n }\n return null;\n};\nSplitter.prototype.flush = function () {\n var len = 16 - this.cache.length;\n var padBuff = new Buffer(len);\n\n var i = -1;\n while (++i < len) {\n padBuff.writeUInt8(len, i);\n }\n var out = Buffer.concat([this.cache, padBuff]);\n return out;\n};\nvar modelist = {\n ECB: require('./modes/ecb'),\n CBC: require('./modes/cbc'),\n CFB: require('./modes/cfb'),\n CFB8: require('./modes/cfb8'),\n CFB1: require('./modes/cfb1'),\n OFB: require('./modes/ofb'),\n CTR: require('./modes/ctr'),\n GCM: require('./modes/ctr')\n};\n\nfunction createCipheriv(suite, password, iv) {\n var config = modes[suite.toLowerCase()];\n if (!config) {\n throw new TypeError('invalid suite type');\n }\n if (typeof iv === 'string') {\n iv = new Buffer(iv);\n }\n if (typeof password === 'string') {\n password = new Buffer(password);\n }\n if (password.length !== config.key/8) {\n throw new TypeError('invalid key length ' + password.length);\n }\n if (iv.length !== config.iv) {\n throw new TypeError('invalid iv length ' + iv.length);\n }\n if (config.type === 'stream') {\n return new StreamCipher(modelist[config.mode], password, iv);\n } else if (config.type === 'auth') {\n return new AuthCipher(modelist[config.mode], password, iv);\n }\n return new Cipher(modelist[config.mode], password, iv);\n}\nfunction createCipher (suite, password) {\n var config = modes[suite.toLowerCase()];\n if (!config) {\n throw new TypeError('invalid suite type');\n }\n var keys = ebtk(password, config.key, config.iv);\n return createCipheriv(suite, keys.key, keys.iv);\n}\n\nexports.createCipheriv = createCipheriv;\nexports.createCipher = createCipher;\n}).call(this,require(\"buffer\").Buffer)\n},{\"./EVP_BytesToKey\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/EVP_BytesToKey.js\",\"./aes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/aes.js\",\"./authCipher\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/authCipher.js\",\"./cipherBase\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/cipherBase.js\",\"./modes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes.js\",\"./modes/cbc\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cbc.js\",\"./modes/cfb\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb.js\",\"./modes/cfb1\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb1.js\",\"./modes/cfb8\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb8.js\",\"./modes/ctr\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ctr.js\",\"./modes/ecb\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ecb.js\",\"./modes/ofb\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ofb.js\",\"./streamCipher\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/streamCipher.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/ghash.js\":[function(require,module,exports){\n(function (Buffer){\nvar zeros = new Buffer(16);\nzeros.fill(0);\nmodule.exports = GHASH;\nfunction GHASH(key){\n this.h = key;\n this.state = new Buffer(16);\n this.state.fill(0);\n this.cache = new Buffer('');\n}\n// from http://bitwiseshiftleft.github.io/sjcl/doc/symbols/src/core_gcm.js.html\n// by Juho Vähä-Herttua\nGHASH.prototype.ghash = function (block) {\n var i = -1;\n while (++i < block.length) {\n this.state[i] ^= block[i];\n }\n this._multiply();\n};\n\nGHASH.prototype._multiply = function () {\n var Vi = toArray(this.h);\n var Zi = [0, 0, 0, 0];\n var j, xi, lsb_Vi;\n var i = -1;\n while (++i < 128) {\n xi = (this.state[~~(i/8)] & (1 << (7-i%8))) !== 0;\n if (xi) {\n // Z_i+1 = Z_i ^ V_i\n Zi = xor(Zi, Vi);\n }\n\n // Store the value of LSB(V_i)\n lsb_Vi = (Vi[3] & 1) !== 0;\n\n // V_i+1 = V_i >> 1\n for (j=3; j>0; j--) {\n Vi[j] = (Vi[j] >>> 1) | ((Vi[j-1]&1) << 31);\n }\n Vi[0] = Vi[0] >>> 1;\n\n // If LSB(V_i) is 1, V_i+1 = (V_i >> 1) ^ R\n if (lsb_Vi) {\n Vi[0] = Vi[0] ^ (0xe1 << 24);\n }\n }\n this.state = fromArray(Zi);\n};\nGHASH.prototype.update = function (buf) {\n this.cache = Buffer.concat([this.cache, buf]);\n var chunk;\n while (this.cache.length >= 16) {\n chunk = this.cache.slice(0, 16);\n this.cache = this.cache.slice(16);\n this.ghash(chunk);\n }\n};\nGHASH.prototype.final = function (abl, bl) {\n if (this.cache.length) {\n this.ghash(Buffer.concat([this.cache, zeros], 16));\n }\n this.ghash(fromArray([\n 0, abl,\n 0, bl\n ]));\n return this.state;\n};\n\nfunction toArray(buf) {\n return [\n buf.readUInt32BE(0),\n buf.readUInt32BE(4),\n buf.readUInt32BE(8),\n buf.readUInt32BE(12)\n ];\n}\nfunction fromArray(out) {\n out = out.map(fixup_uint32);\n var buf = new Buffer(16);\n buf.writeUInt32BE(out[0], 0);\n buf.writeUInt32BE(out[1], 4);\n buf.writeUInt32BE(out[2], 8);\n buf.writeUInt32BE(out[3], 12);\n return buf;\n}\nvar uint_max = Math.pow(2, 32);\nfunction fixup_uint32(x) {\n var ret, x_pos;\n ret = x > uint_max || x < 0 ? (x_pos = Math.abs(x) % uint_max, x < 0 ? uint_max - x_pos : x_pos) : x;\n return ret;\n}\nfunction xor(a, b) {\n return [\n a[0] ^ b[0],\n a[1] ^ b[1],\n a[2] ^ b[2],\n a[3] ^ b[3],\n ];\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes.js\":[function(require,module,exports){\nexports['aes-128-ecb'] = {\n cipher: 'AES',\n key: 128,\n iv: 0,\n mode: 'ECB',\n type: 'block'\n};\nexports['aes-192-ecb'] = {\n cipher: 'AES',\n key: 192,\n iv: 0,\n mode: 'ECB',\n type: 'block'\n};\nexports['aes-256-ecb'] = {\n cipher: 'AES',\n key: 256,\n iv: 0,\n mode: 'ECB',\n type: 'block'\n};\nexports['aes-128-cbc'] = {\n cipher: 'AES',\n key: 128,\n iv: 16,\n mode: 'CBC',\n type: 'block'\n};\nexports['aes-192-cbc'] = {\n cipher: 'AES',\n key: 192,\n iv: 16,\n mode: 'CBC',\n type: 'block'\n};\nexports['aes-256-cbc'] = {\n cipher: 'AES',\n key: 256,\n iv: 16,\n mode: 'CBC',\n type: 'block'\n};\nexports['aes128'] = exports['aes-128-cbc'];\nexports['aes192'] = exports['aes-192-cbc'];\nexports['aes256'] = exports['aes-256-cbc'];\nexports['aes-128-cfb'] = {\n cipher: 'AES',\n key: 128,\n iv: 16,\n mode: 'CFB',\n type: 'stream'\n};\nexports['aes-192-cfb'] = {\n cipher: 'AES',\n key: 192,\n iv: 16,\n mode: 'CFB',\n type: 'stream'\n};\nexports['aes-256-cfb'] = {\n cipher: 'AES',\n key: 256,\n iv: 16,\n mode: 'CFB',\n type: 'stream'\n};\nexports['aes-128-cfb8'] = {\n cipher: 'AES',\n key: 128,\n iv: 16,\n mode: 'CFB8',\n type: 'stream'\n};\nexports['aes-192-cfb8'] = {\n cipher: 'AES',\n key: 192,\n iv: 16,\n mode: 'CFB8',\n type: 'stream'\n};\nexports['aes-256-cfb8'] = {\n cipher: 'AES',\n key: 256,\n iv: 16,\n mode: 'CFB8',\n type: 'stream'\n};\nexports['aes-128-cfb1'] = {\n cipher: 'AES',\n key: 128,\n iv: 16,\n mode: 'CFB1',\n type: 'stream'\n};\nexports['aes-192-cfb1'] = {\n cipher: 'AES',\n key: 192,\n iv: 16,\n mode: 'CFB1',\n type: 'stream'\n};\nexports['aes-256-cfb1'] = {\n cipher: 'AES',\n key: 256,\n iv: 16,\n mode: 'CFB1',\n type: 'stream'\n};\nexports['aes-128-ofb'] = {\n cipher: 'AES',\n key: 128,\n iv: 16,\n mode: 'OFB',\n type: 'stream'\n};\nexports['aes-192-ofb'] = {\n cipher: 'AES',\n key: 192,\n iv: 16,\n mode: 'OFB',\n type: 'stream'\n};\nexports['aes-256-ofb'] = {\n cipher: 'AES',\n key: 256,\n iv: 16,\n mode: 'OFB',\n type: 'stream'\n};\nexports['aes-128-ctr'] = {\n cipher: 'AES',\n key: 128,\n iv: 16,\n mode: 'CTR',\n type: 'stream'\n};\nexports['aes-192-ctr'] = {\n cipher: 'AES',\n key: 192,\n iv: 16,\n mode: 'CTR',\n type: 'stream'\n};\nexports['aes-256-ctr'] = {\n cipher: 'AES',\n key: 256,\n iv: 16,\n mode: 'CTR',\n type: 'stream'\n};\nexports['aes-128-gcm'] = {\n cipher: 'AES',\n key: 128,\n iv: 12,\n mode: 'GCM',\n type: 'auth'\n};\nexports['aes-192-gcm'] = {\n cipher: 'AES',\n key: 192,\n iv: 12,\n mode: 'GCM',\n type: 'auth'\n};\nexports['aes-256-gcm'] = {\n cipher: 'AES',\n key: 256,\n iv: 12,\n mode: 'GCM',\n type: 'auth'\n};\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cbc.js\":[function(require,module,exports){\nvar xor = require('../xor');\nexports.encrypt = function (self, block) {\n var data = xor(block, self._prev);\n self._prev = self._cipher.encryptBlock(data);\n return self._prev;\n};\nexports.decrypt = function (self, block) {\n var pad = self._prev;\n self._prev = block;\n var out = self._cipher.decryptBlock(block);\n return xor(out, pad);\n};\n},{\"../xor\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/xor.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb.js\":[function(require,module,exports){\n(function (Buffer){\nvar xor = require('../xor');\nexports.encrypt = function (self, data, decrypt) {\n var out = new Buffer('');\n var len;\n while (data.length) {\n if (self._cache.length === 0) {\n self._cache = self._cipher.encryptBlock(self._prev);\n self._prev = new Buffer('');\n }\n if (self._cache.length <= data.length) {\n len = self._cache.length;\n out = Buffer.concat([out, encryptStart(self, data.slice(0, len), decrypt)]);\n data = data.slice(len);\n } else {\n out = Buffer.concat([out, encryptStart(self, data, decrypt)]);\n break;\n }\n }\n return out;\n};\nfunction encryptStart(self, data, decrypt) {\n var len = data.length;\n var out = xor(data, self._cache);\n self._cache = self._cache.slice(len);\n self._prev = Buffer.concat([self._prev, decrypt?data:out]);\n return out;\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"../xor\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/xor.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb1.js\":[function(require,module,exports){\n(function (Buffer){\n\nfunction encryptByte(self, byte, decrypt) {\n var pad;\n var i = -1;\n var len = 8;\n var out = 0;\n var bit, value;\n while (++i < len) {\n pad = self._cipher.encryptBlock(self._prev);\n bit = (byte & (1 << (7-i))) ? 0x80:0;\n value = pad[0] ^ bit;\n out += ((value&0x80) >> (i%8));\n self._prev = shiftIn(self._prev, decrypt?bit:value);\n }\n return out;\n}\nexports.encrypt = function (self, chunk, decrypt) {\n var len = chunk.length;\n var out = new Buffer(len);\n var i = -1;\n while (++i < len) {\n out[i] = encryptByte(self, chunk[i], decrypt);\n }\n return out;\n};\nfunction shiftIn(buffer, value) {\n var len = buffer.length;\n var i = -1;\n var out = new Buffer(buffer.length);\n buffer = Buffer.concat([buffer, new Buffer([value])]);\n while(++i < len) {\n out[i] = buffer[i]<<1 | buffer[i+1]>>(7);\n }\n return out;\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb8.js\":[function(require,module,exports){\n(function (Buffer){\nfunction encryptByte(self, byte, decrypt) {\n var pad = self._cipher.encryptBlock(self._prev);\n var out = pad[0] ^ byte;\n self._prev = Buffer.concat([self._prev.slice(1), new Buffer([decrypt?byte:out])]);\n return out;\n}\nexports.encrypt = function (self, chunk, decrypt) {\n var len = chunk.length;\n var out = new Buffer(len);\n var i = -1;\n while (++i < len) {\n out[i] = encryptByte(self, chunk[i], decrypt);\n }\n return out;\n};\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ctr.js\":[function(require,module,exports){\n(function (Buffer){\nvar xor = require('../xor');\nfunction getBlock(self) {\n var out = self._cipher.encryptBlock(self._prev);\n incr32(self._prev);\n return out;\n}\nexports.encrypt = function (self, chunk) {\n while (self._cache.length < chunk.length) {\n self._cache = Buffer.concat([self._cache, getBlock(self)]);\n }\n var pad = self._cache.slice(0, chunk.length);\n self._cache = self._cache.slice(chunk.length);\n return xor(chunk, pad);\n};\nfunction incr32(iv) {\n var len = iv.length;\n var item;\n while (len--) {\n item = iv.readUInt8(len);\n if (item === 255) {\n iv.writeUInt8(0, len);\n } else {\n item++;\n iv.writeUInt8(item, len);\n break;\n }\n }\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"../xor\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/xor.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ecb.js\":[function(require,module,exports){\nexports.encrypt = function (self, block) {\n return self._cipher.encryptBlock(block);\n};\nexports.decrypt = function (self, block) {\n return self._cipher.decryptBlock(block);\n};\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ofb.js\":[function(require,module,exports){\n(function (Buffer){\nvar xor = require('../xor');\nfunction getBlock(self) {\n self._prev = self._cipher.encryptBlock(self._prev);\n return self._prev;\n}\nexports.encrypt = function (self, chunk) {\n while (self._cache.length < chunk.length) {\n self._cache = Buffer.concat([self._cache, getBlock(self)]);\n }\n var pad = self._cache.slice(0, chunk.length);\n self._cache = self._cache.slice(chunk.length);\n return xor(chunk, pad);\n};\n}).call(this,require(\"buffer\").Buffer)\n},{\"../xor\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/xor.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/streamCipher.js\":[function(require,module,exports){\n(function (Buffer){\nvar aes = require('./aes');\nvar Transform = require('./cipherBase');\nvar inherits = require('inherits');\n\ninherits(StreamCipher, Transform);\nmodule.exports = StreamCipher;\nfunction StreamCipher(mode, key, iv, decrypt) {\n if (!(this instanceof StreamCipher)) {\n return new StreamCipher(mode, key, iv);\n }\n Transform.call(this);\n this._cipher = new aes.AES(key);\n this._prev = new Buffer(iv.length);\n this._cache = new Buffer('');\n this._secCache = new Buffer('');\n this._decrypt = decrypt;\n iv.copy(this._prev);\n this._mode = mode;\n}\nStreamCipher.prototype._update = function (chunk) {\n return this._mode.encrypt(this, chunk, this._decrypt);\n};\nStreamCipher.prototype._final = function () {\n this._cipher.scrub();\n};\n}).call(this,require(\"buffer\").Buffer)\n},{\"./aes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/aes.js\",\"./cipherBase\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/cipherBase.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/xor.js\":[function(require,module,exports){\n(function (Buffer){\nmodule.exports = xor;\nfunction xor(a, b) {\n var len = Math.min(a.length, b.length);\n var out = new Buffer(len);\n var i = -1;\n while (++i < len) {\n out.writeUInt8(a[i] ^ b[i], i);\n }\n return out;\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/algos.js\":[function(require,module,exports){\n(function (Buffer){\nexports['RSA-SHA224'] = exports.sha224WithRSAEncryption = {\n sign: 'rsa',\n hash: 'sha224',\n id: new Buffer('302d300d06096086480165030402040500041c', 'hex')\n};\nexports['RSA-SHA256'] = exports.sha256WithRSAEncryption = {\n sign: 'rsa',\n hash: 'sha256',\n id: new Buffer('3031300d060960864801650304020105000420', 'hex')\n};\nexports['RSA-SHA384'] = exports.sha384WithRSAEncryption = {\n sign: 'rsa',\n hash: 'sha384',\n id: new Buffer('3041300d060960864801650304020205000430', 'hex')\n};\nexports['RSA-SHA512'] = exports.sha512WithRSAEncryption = {\n sign: 'rsa',\n hash: 'sha512',\n id: new Buffer('3051300d060960864801650304020305000440', 'hex')\n};\nexports['RSA-SHA1'] = {\n\tsign: 'rsa',\n\thash: 'sha1',\n\tid: new Buffer('3021300906052b0e03021a05000414', 'hex')\n};\nexports['ecdsa-with-SHA1'] = {\n\tsign: 'ecdsa',\n\thash: 'sha1',\n\tid: new Buffer('', 'hex')\n};\nexports.DSA = exports['DSA-SHA1'] = exports['DSA-SHA'] = {\n sign: 'dsa',\n hash: 'sha1',\n id: new Buffer('', 'hex')\n};\nexports['DSA-SHA224'] = exports['DSA-WITH-SHA224'] = {\n sign: 'dsa',\n hash: 'sha224',\n id: new Buffer('', 'hex')\n};\nexports['DSA-SHA256'] = exports['DSA-WITH-SHA256'] = {\n sign: 'dsa',\n hash: 'sha256',\n id: new Buffer('', 'hex')\n};\nexports['DSA-SHA384'] = exports['DSA-WITH-SHA384'] = {\n sign: 'dsa',\n hash: 'sha384',\n id: new Buffer('', 'hex')\n};\nexports['DSA-SHA512'] = exports['DSA-WITH-SHA512'] = {\n sign: 'dsa',\n hash: 'sha512',\n id: new Buffer('', 'hex')\n};\nexports['DSA-RIPEMD160'] = {\n sign: 'dsa',\n hash: 'rmd160',\n id: new Buffer('', 'hex')\n};\nexports['RSA-RIPEMD160'] = exports.ripemd160WithRSA = {\n sign: 'rsa',\n hash: 'rmd160',\n id: new Buffer('3021300906052b2403020105000414', 'hex')\n};\nexports['RSA-MD5'] = exports.md5WithRSAEncryption = {\n sign: 'rsa',\n hash: 'md5',\n id: new Buffer('3020300c06082a864886f70d020505000410', 'hex')\n};\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/inject.js\":[function(require,module,exports){\n(function (Buffer){\nvar sign = require('./sign');\nvar verify = require('./verify');\nvar stream = require('stream');\nvar inherits = require('inherits');\nvar _algos = require('./algos');\nvar algos = {};\nObject.keys(_algos).forEach(function (key) {\n\talgos[key] = algos[key.toLowerCase()] = _algos[key];\n});\n'use strict';\nmodule.exports = function (exports, crypto) {\n\texports.createSign = exports.Sign = createSign;\n\tfunction createSign(algorithm) {\n\n\t\treturn new Sign(algorithm, crypto);\n\t}\n\texports.createVerify = exports.Verify = createVerify;\n\tfunction createVerify(algorithm) {\n\t\treturn new Verify(algorithm, crypto);\n\t}\n};\ninherits(Sign, stream.Writable);\nfunction Sign(algorithm, crypto) {\n\tstream.Writable.call(this);\n\tvar data = algos[algorithm];\n\tif (!data) {\n\t\tthrow new Error('Unknown message digest');\n\t}\n\tthis._hashType = data.hash;\n\tthis._hash = crypto.createHash(data.hash);\n\tthis._tag = data.id;\n\tthis._crypto = crypto;\n}\nSign.prototype._write = function _write(data, _, done) {\n\tthis._hash.update(data);\n\tdone();\n};\nSign.prototype.update = function update(data) {\n\tthis.write(data);\n\treturn this;\n};\n\nSign.prototype.sign = function signMethod(key, enc) {\n\tthis.end();\n\tvar hash = this._hash.digest();\n\tvar sig = sign(Buffer.concat([this._tag, hash]), key, this._hashType, this._crypto);\n\tif (enc) {\n\t\tsig = sig.toString(enc);\n\t}\n\treturn sig;\n};\n\ninherits(Verify, stream.Writable);\nfunction Verify(algorithm, crypto) {\n\tstream.Writable.call(this);\n\tvar data = algos[algorithm];\n\tif (!data) {\n\t\tthrow new Error('Unknown message digest');\n\t}\n\tthis._hash = crypto.createHash(data.hash);\n\tthis._tag = data.id;\n}\nVerify.prototype._write = function _write(data, _, done) {\n\tthis._hash.update(data);\n\tdone();\n};\nVerify.prototype.update = function update(data) {\n\tthis.write(data);\n\treturn this;\n};\n\nVerify.prototype.verify = function verifyMethod(key, sig, enc) {\n\tthis.end();\n\tvar hash = this._hash.digest();\n\tif (!Buffer.isBuffer(sig)) {\n\t\tsig = new Buffer(sig, enc);\n\t}\n\treturn verify(sig, Buffer.concat([this._tag, hash]), key);\n};\n}).call(this,require(\"buffer\").Buffer)\n},{\"./algos\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/algos.js\",\"./sign\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/sign.js\",\"./verify\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/verify.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\",\"stream\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/stream-browserify/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\":[function(require,module,exports){\n(function(module, exports) {\n\n'use strict';\n\n// Utils\n\nfunction assert(val, msg) {\n if (!val)\n throw new Error(msg || 'Assertion failed');\n}\n\n// Could use `inherits` module, but don't want to move from single file\n// architecture yet.\nfunction inherits(ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n}\n\n// BN\n\nfunction BN(number, base, endian) {\n // May be `new BN(bn)` ?\n if (number !== null &&\n typeof number === 'object' &&\n Array.isArray(number.words)) {\n return number;\n }\n\n this.sign = false;\n this.words = null;\n this.length = 0;\n\n // Reduction context\n this.red = null;\n\n if (base === 'le' || base === 'be') {\n endian = base;\n base = 10;\n }\n\n if (number !== null)\n this._init(number || 0, base || 10, endian || 'be');\n}\nif (typeof module === 'object')\n module.exports = BN;\nelse\n exports.BN = BN;\n\nBN.BN = BN;\nBN.wordSize = 26;\n\nBN.prototype._init = function init(number, base, endian) {\n if (typeof number === 'number') {\n if (number < 0) {\n this.sign = true;\n number = -number;\n }\n if (number < 0x4000000) {\n this.words = [ number & 0x3ffffff ];\n this.length = 1;\n } else {\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff\n ];\n this.length = 2;\n }\n return;\n } else if (typeof number === 'object') {\n return this._initArray(number, base, endian);\n }\n if (base === 'hex')\n base = 16;\n assert(base === (base | 0) && base >= 2 && base <= 36);\n\n number = number.toString().replace(/\\s+/g, '');\n var start = 0;\n if (number[0] === '-')\n start++;\n\n if (base === 16)\n this._parseHex(number, start);\n else\n this._parseBase(number, base, start);\n\n if (number[0] === '-')\n this.sign = true;\n\n this.strip();\n};\n\nBN.prototype._initArray = function _initArray(number, base, endian) {\n // Perhaps a Uint8Array\n assert(typeof number.length === 'number');\n this.length = Math.ceil(number.length / 3);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++)\n this.words[i] = 0;\n\n var off = 0;\n if (endian === 'be') {\n for (var i = number.length - 1, j = 0; i >= 0; i -= 3) {\n var w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n } else if (endian === 'le') {\n for (var i = 0, j = 0; i < number.length; i += 3) {\n var w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n }\n return this.strip();\n};\n\nfunction parseHex(str, start, end) {\n var r = 0;\n var len = Math.min(str.length, end);\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n\n r <<= 4;\n\n // 'a' - 'f'\n if (c >= 49 && c <= 54)\n r |= c - 49 + 0xa;\n\n // 'A' - 'F'\n else if (c >= 17 && c <= 22)\n r |= c - 17 + 0xa;\n\n // '0' - '9'\n else\n r |= c & 0xf;\n }\n return r;\n}\n\nBN.prototype._parseHex = function _parseHex(number, start) {\n // Create possibly bigger array to ensure that it fits the number\n this.length = Math.ceil((number.length - start) / 6);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++)\n this.words[i] = 0;\n\n // Scan 24-bit chunks and add them to the number\n var off = 0;\n for (var i = number.length - 6, j = 0; i >= start; i -= 6) {\n var w = parseHex(number, i, i + 6);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n if (i + 6 !== start) {\n var w = parseHex(number, start, i + 6);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;\n }\n this.strip();\n};\n\nfunction parseBase(str, start, end, mul) {\n var r = 0;\n var len = Math.min(str.length, end);\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n\n r *= mul;\n\n // 'a'\n if (c >= 49)\n r += c - 49 + 0xa;\n\n // 'A'\n else if (c >= 17)\n r += c - 17 + 0xa;\n\n // '0' - '9'\n else\n r += c;\n }\n return r;\n}\n\nBN.prototype._parseBase = function _parseBase(number, base, start) {\n // Initialize as zero\n this.words = [ 0 ];\n this.length = 1;\n\n // Find length of limb in base\n for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base)\n limbLen++;\n limbLen--;\n limbPow = (limbPow / base) | 0;\n\n var total = number.length - start;\n var mod = total % limbLen;\n var end = Math.min(total, total - mod) + start;\n\n var word = 0;\n for (var i = start; i < end; i += limbLen) {\n word = parseBase(number, i, i + limbLen, base);\n\n this.imuln(limbPow);\n if (this.words[0] + word < 0x4000000)\n this.words[0] += word;\n else\n this._iaddn(word);\n }\n\n if (mod !== 0) {\n var pow = 1;\n var word = parseBase(number, i, number.length, base);\n\n for (var i = 0; i < mod; i++)\n pow *= base;\n this.imuln(pow);\n if (this.words[0] + word < 0x4000000)\n this.words[0] += word;\n else\n this._iaddn(word);\n }\n};\n\nBN.prototype.copy = function copy(dest) {\n dest.words = new Array(this.length);\n for (var i = 0; i < this.length; i++)\n dest.words[i] = this.words[i];\n dest.length = this.length;\n dest.sign = this.sign;\n dest.red = this.red;\n};\n\nBN.prototype.clone = function clone() {\n var r = new BN(null);\n this.copy(r);\n return r;\n};\n\n// Remove leading `0` from `this`\nBN.prototype.strip = function strip() {\n while (this.length > 1 && this.words[this.length - 1] === 0)\n this.length--;\n return this._normSign();\n};\n\nBN.prototype._normSign = function _normSign() {\n // -0 = 0\n if (this.length === 1 && this.words[0] === 0)\n this.sign = false;\n return this;\n};\n\nBN.prototype.inspect = function inspect() {\n return (this.red ? '';\n};\n\n/*\n\nvar zeros = [];\nvar groupSizes = [];\nvar groupBases = [];\n\nvar s = '';\nvar i = -1;\nwhile (++i < BN.wordSize) {\n zeros[i] = s;\n s += '0';\n}\ngroupSizes[0] = 0;\ngroupSizes[1] = 0;\ngroupBases[0] = 0;\ngroupBases[1] = 0;\nvar base = 2 - 1;\nwhile (++base < 36 + 1) {\n var groupSize = 0;\n var groupBase = 1;\n while (groupBase < (1 << BN.wordSize) / base) {\n groupBase *= base;\n groupSize += 1;\n }\n groupSizes[base] = groupSize;\n groupBases[base] = groupBase;\n}\n\n*/\n\nvar zeros = [\n '',\n '0',\n '00',\n '000',\n '0000',\n '00000',\n '000000',\n '0000000',\n '00000000',\n '000000000',\n '0000000000',\n '00000000000',\n '000000000000',\n '0000000000000',\n '00000000000000',\n '000000000000000',\n '0000000000000000',\n '00000000000000000',\n '000000000000000000',\n '0000000000000000000',\n '00000000000000000000',\n '000000000000000000000',\n '0000000000000000000000',\n '00000000000000000000000',\n '000000000000000000000000',\n '0000000000000000000000000'\n];\n\nvar groupSizes = [\n 0, 0,\n 25, 16, 12, 11, 10, 9, 8,\n 8, 7, 7, 7, 7, 6, 6,\n 6, 6, 6, 6, 6, 5, 5,\n 5, 5, 5, 5, 5, 5, 5,\n 5, 5, 5, 5, 5, 5, 5\n];\n\nvar groupBases = [\n 0, 0,\n 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,\n 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,\n 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,\n 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,\n 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176\n];\n\nBN.prototype.toString = function toString(base, padding) {\n base = base || 10;\n if (base === 16 || base === 'hex') {\n var out = '';\n var off = 0;\n var padding = padding | 0 || 1;\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i];\n var word = (((w << off) | carry) & 0xffffff).toString(16);\n carry = (w >>> (24 - off)) & 0xffffff;\n if (carry !== 0 || i !== this.length - 1)\n out = zeros[6 - word.length] + word + out;\n else\n out = word + out;\n off += 2;\n if (off >= 26) {\n off -= 26;\n i--;\n }\n }\n if (carry !== 0)\n out = carry.toString(16) + out;\n while (out.length % padding !== 0)\n out = '0' + out;\n if (this.sign)\n out = '-' + out;\n return out;\n } else if (base === (base | 0) && base >= 2 && base <= 36) {\n // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));\n var groupSize = groupSizes[base];\n // var groupBase = Math.pow(base, groupSize);\n var groupBase = groupBases[base];\n var out = '';\n var c = this.clone();\n c.sign = false;\n while (c.cmpn(0) !== 0) {\n var r = c.modn(groupBase).toString(base);\n c = c.idivn(groupBase);\n\n if (c.cmpn(0) !== 0)\n out = zeros[groupSize - r.length] + r + out;\n else\n out = r + out;\n }\n if (this.cmpn(0) === 0)\n out = '0' + out;\n if (this.sign)\n out = '-' + out;\n return out;\n } else {\n assert(false, 'Base should be between 2 and 36');\n }\n};\n\nBN.prototype.toJSON = function toJSON() {\n return this.toString(16);\n};\n\nBN.prototype.toArray = function toArray() {\n this.strip();\n var res = new Array(this.byteLength());\n res[0] = 0;\n\n var q = this.clone();\n for (var i = 0; q.cmpn(0) !== 0; i++) {\n var b = q.andln(0xff);\n q.ishrn(8);\n\n // Assume big-endian\n res[res.length - i - 1] = b;\n }\n\n return res;\n};\n\n/*\nfunction genCountBits(bits) {\n var arr = [];\n\n for (var i = bits - 1; i >= 0; i--) {\n var bit = '0x' + (1 << i).toString(16);\n arr.push('w >= ' + bit + ' ? ' + (i + 1));\n }\n\n return new Function('w', 'return ' + arr.join(' :\\n') + ' :\\n0;');\n};\n\nBN.prototype._countBits = genCountBits(26);\n*/\n\n// Sadly chrome apps could not contain `new Function()` calls\nBN.prototype._countBits = function _countBits(w) {\n return w >= 0x2000000 ? 26 :\n w >= 0x1000000 ? 25 :\n w >= 0x800000 ? 24 :\n w >= 0x400000 ? 23 :\n w >= 0x200000 ? 22 :\n w >= 0x100000 ? 21 :\n w >= 0x80000 ? 20 :\n w >= 0x40000 ? 19 :\n w >= 0x20000 ? 18 :\n w >= 0x10000 ? 17 :\n w >= 0x8000 ? 16 :\n w >= 0x4000 ? 15 :\n w >= 0x2000 ? 14 :\n w >= 0x1000 ? 13 :\n w >= 0x800 ? 12 :\n w >= 0x400 ? 11 :\n w >= 0x200 ? 10 :\n w >= 0x100 ? 9 :\n w >= 0x80 ? 8 :\n w >= 0x40 ? 7 :\n w >= 0x20 ? 6 :\n w >= 0x10 ? 5 :\n w >= 0x8 ? 4 :\n w >= 0x4 ? 3 :\n w >= 0x2 ? 2 :\n w >= 0x1 ? 1 :\n 0;\n};\n\n// Return number of used bits in a BN\nBN.prototype.bitLength = function bitLength() {\n var hi = 0;\n var w = this.words[this.length - 1];\n var hi = this._countBits(w);\n return (this.length - 1) * 26 + hi;\n};\n\nBN.prototype.byteLength = function byteLength() {\n return Math.ceil(this.bitLength() / 8);\n};\n\n// Return negative clone of `this`\nBN.prototype.neg = function neg() {\n if (this.cmpn(0) === 0)\n return this.clone();\n\n var r = this.clone();\n r.sign = !this.sign;\n return r;\n};\n\n\n// Or `num` with `this` in-place\nBN.prototype.ior = function ior(num) {\n this.sign = this.sign || num.sign;\n\n while (this.length < num.length)\n this.words[this.length++] = 0;\n\n for (var i = 0; i < num.length; i++)\n this.words[i] = this.words[i] | num.words[i];\n\n return this.strip();\n};\n\n\n// Or `num` with `this`\nBN.prototype.or = function or(num) {\n if (this.length > num.length)\n return this.clone().ior(num);\n else\n return num.clone().ior(this);\n};\n\n\n// And `num` with `this` in-place\nBN.prototype.iand = function iand(num) {\n this.sign = this.sign && num.sign;\n\n // b = min-length(num, this)\n var b;\n if (this.length > num.length)\n b = num;\n else\n b = this;\n\n for (var i = 0; i < b.length; i++)\n this.words[i] = this.words[i] & num.words[i];\n\n this.length = b.length;\n\n return this.strip();\n};\n\n\n// And `num` with `this`\nBN.prototype.and = function and(num) {\n if (this.length > num.length)\n return this.clone().iand(num);\n else\n return num.clone().iand(this);\n};\n\n\n// Xor `num` with `this` in-place\nBN.prototype.ixor = function ixor(num) {\n this.sign = this.sign || num.sign;\n\n // a.length > b.length\n var a;\n var b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n for (var i = 0; i < b.length; i++)\n this.words[i] = a.words[i] ^ b.words[i];\n\n if (this !== a)\n for (; i < a.length; i++)\n this.words[i] = a.words[i];\n\n this.length = a.length;\n\n return this.strip();\n};\n\n\n// Xor `num` with `this`\nBN.prototype.xor = function xor(num) {\n if (this.length > num.length)\n return this.clone().ixor(num);\n else\n return num.clone().ixor(this);\n};\n\n\n// Set `bit` of `this`\nBN.prototype.setn = function setn(bit, val) {\n assert(typeof bit === 'number' && bit >= 0);\n\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n while (this.length <= off)\n this.words[this.length++] = 0;\n\n if (val)\n this.words[off] = this.words[off] | (1 << wbit);\n else\n this.words[off] = this.words[off] & ~(1 << wbit);\n\n return this.strip();\n};\n\n\n// Add `num` to `this` in-place\nBN.prototype.iadd = function iadd(num) {\n // negative + positive\n if (this.sign && !num.sign) {\n this.sign = false;\n var r = this.isub(num);\n this.sign = !this.sign;\n return this._normSign();\n\n // positive + negative\n } else if (!this.sign && num.sign) {\n num.sign = false;\n var r = this.isub(num);\n num.sign = true;\n return r._normSign();\n }\n\n // a.length > b.length\n var a;\n var b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n var r = a.words[i] + b.words[i] + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n for (; carry !== 0 && i < a.length; i++) {\n var r = a.words[i] + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n this.length = a.length;\n if (carry !== 0) {\n this.words[this.length] = carry;\n this.length++;\n // Copy the rest of the words\n } else if (a !== this) {\n for (; i < a.length; i++)\n this.words[i] = a.words[i];\n }\n\n return this;\n};\n\n// Add `num` to `this`\nBN.prototype.add = function add(num) {\n if (num.sign && !this.sign) {\n num.sign = false;\n var res = this.sub(num);\n num.sign = true;\n return res;\n } else if (!num.sign && this.sign) {\n this.sign = false;\n var res = num.sub(this);\n this.sign = true;\n return res;\n }\n\n if (this.length > num.length)\n return this.clone().iadd(num);\n else\n return num.clone().iadd(this);\n};\n\n// Subtract `num` from `this` in-place\nBN.prototype.isub = function isub(num) {\n // this - (-num) = this + num\n if (num.sign) {\n num.sign = false;\n var r = this.iadd(num);\n num.sign = true;\n return r._normSign();\n\n // -this - num = -(this + num)\n } else if (this.sign) {\n this.sign = false;\n this.iadd(num);\n this.sign = true;\n return this._normSign();\n }\n\n // At this point both numbers are positive\n var cmp = this.cmp(num);\n\n // Optimization - zeroify\n if (cmp === 0) {\n this.sign = false;\n this.length = 1;\n this.words[0] = 0;\n return this;\n }\n\n // a > b\n var a;\n var b;\n if (cmp > 0) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n var r = a.words[i] - b.words[i] + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n for (; carry !== 0 && i < a.length; i++) {\n var r = a.words[i] + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n\n // Copy rest of the words\n if (carry === 0 && i < a.length && a !== this)\n for (; i < a.length; i++)\n this.words[i] = a.words[i];\n this.length = Math.max(this.length, i);\n\n if (a !== this)\n this.sign = true;\n\n return this.strip();\n};\n\n// Subtract `num` from `this`\nBN.prototype.sub = function sub(num) {\n return this.clone().isub(num);\n};\n\n/*\n// NOTE: This could be potentionally used to generate loop-less multiplications\nfunction _genCombMulTo(alen, blen) {\n var len = alen + blen - 1;\n var src = [\n 'var a = this.words, b = num.words, o = out.words, c = 0, w, ' +\n 'mask = 0x3ffffff, shift = 0x4000000;',\n 'out.length = ' + len + ';'\n ];\n for (var k = 0; k < len; k++) {\n var minJ = Math.max(0, k - alen + 1);\n var maxJ = Math.min(k, blen - 1);\n\n for (var j = minJ; j <= maxJ; j++) {\n var i = k - j;\n var mul = 'a[' + i + '] * b[' + j + ']';\n\n if (j === minJ) {\n src.push('w = ' + mul + ' + c;');\n src.push('c = (w / shift) | 0;');\n } else {\n src.push('w += ' + mul + ';');\n src.push('c += (w / shift) | 0;');\n }\n src.push('w &= mask;');\n }\n src.push('o[' + k + '] = w;');\n }\n src.push('if (c !== 0) {',\n ' o[' + k + '] = c;',\n ' out.length++;',\n '}',\n 'return out;');\n\n return src.join('\\n');\n}\n*/\n\nBN.prototype._smallMulTo = function _smallMulTo(num, out) {\n out.sign = num.sign !== this.sign;\n out.length = this.length + num.length;\n\n var carry = 0;\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = carry >>> 26;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - this.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = this.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;\n lo = (lo + rword) | 0;\n rword = lo & 0x3ffffff;\n ncarry = (ncarry + (lo >>> 26)) | 0;\n }\n out.words[k] = rword;\n carry = ncarry;\n }\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out.strip();\n};\n\nBN.prototype._bigMulTo = function _bigMulTo(num, out) {\n out.sign = num.sign !== this.sign;\n out.length = this.length + num.length;\n\n var carry = 0;\n var hncarry = 0;\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = hncarry;\n hncarry = 0;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - this.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = this.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;\n lo = (lo + rword) | 0;\n rword = lo & 0x3ffffff;\n ncarry = (ncarry + (lo >>> 26)) | 0;\n\n hncarry += ncarry >>> 26;\n ncarry &= 0x3ffffff;\n }\n out.words[k] = rword;\n carry = ncarry;\n ncarry = hncarry;\n }\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out.strip();\n};\n\nBN.prototype.mulTo = function mulTo(num, out) {\n var res;\n if (this.length + num.length < 63)\n res = this._smallMulTo(num, out);\n else\n res = this._bigMulTo(num, out);\n return res;\n};\n\n// Multiply `this` by `num`\nBN.prototype.mul = function mul(num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return this.mulTo(num, out);\n};\n\n// In-place Multiplication\nBN.prototype.imul = function imul(num) {\n if (this.cmpn(0) === 0 || num.cmpn(0) === 0) {\n this.words[0] = 0;\n this.length = 1;\n return this;\n }\n\n var tlen = this.length;\n var nlen = num.length;\n\n this.sign = num.sign !== this.sign;\n this.length = this.length + num.length;\n this.words[this.length - 1] = 0;\n\n for (var k = this.length - 2; k >= 0; k--) {\n // Sum all words with the same `i + j = k` and accumulate `carry`,\n // note that carry could be >= 0x3ffffff\n var carry = 0;\n var rword = 0;\n var maxJ = Math.min(k, nlen - 1);\n for (var j = Math.max(0, k - tlen + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = this.words[i];\n var b = num.words[j];\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n carry += (r / 0x4000000) | 0;\n lo += rword;\n rword = lo & 0x3ffffff;\n carry += lo >>> 26;\n }\n this.words[k] = rword;\n this.words[k + 1] += carry;\n carry = 0;\n }\n\n // Propagate overflows\n var carry = 0;\n for (var i = 1; i < this.length; i++) {\n var w = this.words[i] + carry;\n this.words[i] = w & 0x3ffffff;\n carry = w >>> 26;\n }\n\n return this.strip();\n};\n\nBN.prototype.imuln = function imuln(num) {\n assert(typeof num === 'number');\n\n // Carry\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i] * num;\n var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);\n carry >>= 26;\n carry += (w / 0x4000000) | 0;\n // NOTE: lo is 27bit maximum\n carry += lo >>> 26;\n this.words[i] = lo & 0x3ffffff;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return this;\n};\n\n// `this` * `this`\nBN.prototype.sqr = function sqr() {\n return this.mul(this);\n};\n\n// `this` * `this` in-place\nBN.prototype.isqr = function isqr() {\n return this.mul(this);\n};\n\n// Shift-left in-place\nBN.prototype.ishln = function ishln(bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);\n\n if (r !== 0) {\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var newCarry = this.words[i] & carryMask;\n var c = (this.words[i] - newCarry) << r;\n this.words[i] = c | carry;\n carry = newCarry >>> (26 - r);\n }\n if (carry) {\n this.words[i] = carry;\n this.length++;\n }\n }\n\n if (s !== 0) {\n for (var i = this.length - 1; i >= 0; i--)\n this.words[i + s] = this.words[i];\n for (var i = 0; i < s; i++)\n this.words[i] = 0;\n this.length += s;\n }\n\n return this.strip();\n};\n\n// Shift-right in-place\n// NOTE: `hint` is a lowest bit before trailing zeroes\n// NOTE: if `extended` is true - { lo: ..., hi: } object will be returned\nBN.prototype.ishrn = function ishrn(bits, hint, extended) {\n assert(typeof bits === 'number' && bits >= 0);\n if (hint)\n hint = (hint - (hint % 26)) / 26;\n else\n hint = 0;\n\n var r = bits % 26;\n var s = Math.min((bits - r) / 26, this.length);\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n var maskedWords = extended;\n\n hint -= s;\n hint = Math.max(0, hint);\n\n // Extended mode, copy masked part\n if (maskedWords) {\n for (var i = 0; i < s; i++)\n maskedWords.words[i] = this.words[i];\n maskedWords.length = s;\n }\n\n if (s === 0) {\n // No-op, we should not move anything at all\n } else if (this.length > s) {\n this.length -= s;\n for (var i = 0; i < this.length; i++)\n this.words[i] = this.words[i + s];\n } else {\n this.words[0] = 0;\n this.length = 1;\n }\n\n var carry = 0;\n for (var i = this.length - 1; i >= 0 && (carry !== 0 || i >= hint); i--) {\n var word = this.words[i];\n this.words[i] = (carry << (26 - r)) | (word >>> r);\n carry = word & mask;\n }\n\n // Push carried bits as a mask\n if (maskedWords && carry !== 0)\n maskedWords.words[maskedWords.length++] = carry;\n\n if (this.length === 0) {\n this.words[0] = 0;\n this.length = 1;\n }\n\n this.strip();\n if (extended)\n return { hi: this, lo: maskedWords };\n\n return this;\n};\n\n// Shift-left\nBN.prototype.shln = function shln(bits) {\n return this.clone().ishln(bits);\n};\n\n// Shift-right\nBN.prototype.shrn = function shrn(bits) {\n return this.clone().ishrn(bits);\n};\n\n// Test if n bit is set\nBN.prototype.testn = function testn(bit) {\n assert(typeof bit === 'number' && bit >= 0);\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) {\n return false;\n }\n\n // Check bit and return\n var w = this.words[s];\n\n return !!(w & q);\n};\n\n// Return only lowers bits of number (in-place)\nBN.prototype.imaskn = function imaskn(bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n\n assert(!this.sign, 'imaskn works only with positive numbers');\n\n if (r !== 0)\n s++;\n this.length = Math.min(s, this.length);\n\n if (r !== 0) {\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n this.words[this.length - 1] &= mask;\n }\n\n return this.strip();\n};\n\n// Return only lowers bits of number\nBN.prototype.maskn = function maskn(bits) {\n return this.clone().imaskn(bits);\n};\n\n// Add plain number `num` to `this`\nBN.prototype.iaddn = function iaddn(num) {\n assert(typeof num === 'number');\n if (num < 0)\n return this.isubn(-num);\n\n // Possible sign change\n if (this.sign) {\n if (this.length === 1 && this.words[0] < num) {\n this.words[0] = num - this.words[0];\n this.sign = false;\n return this;\n }\n\n this.sign = false;\n this.isubn(num);\n this.sign = true;\n return this;\n }\n\n // Add without checks\n return this._iaddn(num);\n};\n\nBN.prototype._iaddn = function _iaddn(num) {\n this.words[0] += num;\n\n // Carry\n for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {\n this.words[i] -= 0x4000000;\n if (i === this.length - 1)\n this.words[i + 1] = 1;\n else\n this.words[i + 1]++;\n }\n this.length = Math.max(this.length, i + 1);\n\n return this;\n};\n\n// Subtract plain number `num` from `this`\nBN.prototype.isubn = function isubn(num) {\n assert(typeof num === 'number');\n if (num < 0)\n return this.iaddn(-num);\n\n if (this.sign) {\n this.sign = false;\n this.iaddn(num);\n this.sign = true;\n return this;\n }\n\n this.words[0] -= num;\n\n // Carry\n for (var i = 0; i < this.length && this.words[i] < 0; i++) {\n this.words[i] += 0x4000000;\n this.words[i + 1] -= 1;\n }\n\n return this.strip();\n};\n\nBN.prototype.addn = function addn(num) {\n return this.clone().iaddn(num);\n};\n\nBN.prototype.subn = function subn(num) {\n return this.clone().isubn(num);\n};\n\nBN.prototype.iabs = function iabs() {\n this.sign = false;\n\n return this;\n};\n\nBN.prototype.abs = function abs() {\n return this.clone().iabs();\n};\n\nBN.prototype._ishlnsubmul = function _ishlnsubmul(num, mul, shift) {\n // Bigger storage is needed\n var len = num.length + shift;\n var i;\n if (this.words.length < len) {\n var t = new Array(len);\n for (var i = 0; i < this.length; i++)\n t[i] = this.words[i];\n this.words = t;\n } else {\n i = this.length;\n }\n\n // Zeroify rest\n this.length = Math.max(this.length, len);\n for (; i < this.length; i++)\n this.words[i] = 0;\n\n var carry = 0;\n for (var i = 0; i < num.length; i++) {\n var w = this.words[i + shift] + carry;\n var right = num.words[i] * mul;\n w -= right & 0x3ffffff;\n carry = (w >> 26) - ((right / 0x4000000) | 0);\n this.words[i + shift] = w & 0x3ffffff;\n }\n for (; i < this.length - shift; i++) {\n var w = this.words[i + shift] + carry;\n carry = w >> 26;\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n if (carry === 0)\n return this.strip();\n\n // Subtraction overflow\n assert(carry === -1);\n carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = -this.words[i] + carry;\n carry = w >> 26;\n this.words[i] = w & 0x3ffffff;\n }\n this.sign = true;\n\n return this.strip();\n};\n\nBN.prototype._wordDiv = function _wordDiv(num, mode) {\n var shift = this.length - num.length;\n\n var a = this.clone();\n var b = num;\n\n // Normalize\n var bhi = b.words[b.length - 1];\n for (var shift = 0; bhi < 0x2000000; shift++)\n bhi <<= 1;\n if (shift !== 0) {\n b = b.shln(shift);\n a.ishln(shift);\n bhi = b.words[b.length - 1];\n }\n\n // Initialize quotient\n var m = a.length - b.length;\n var q;\n\n if (mode !== 'mod') {\n q = new BN(null);\n q.length = m + 1;\n q.words = new Array(q.length);\n for (var i = 0; i < q.length; i++)\n q.words[i] = 0;\n }\n\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n if (!diff.sign) {\n a = diff;\n if (q)\n q.words[m] = 1;\n }\n\n for (var j = m - 1; j >= 0; j--) {\n var qj = a.words[b.length + j] * 0x4000000 + a.words[b.length + j - 1];\n\n // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max\n // (0x7ffffff)\n qj = Math.min((qj / bhi) | 0, 0x3ffffff);\n\n a._ishlnsubmul(b, qj, j);\n while (a.sign) {\n qj--;\n a.sign = false;\n a._ishlnsubmul(b, 1, j);\n a.sign = !a.sign;\n }\n if (q)\n q.words[j] = qj;\n }\n if (q)\n q.strip();\n a.strip();\n\n // Denormalize\n if (mode !== 'div' && shift !== 0)\n a.ishrn(shift);\n return { div: q ? q : null, mod: a };\n};\n\nBN.prototype.divmod = function divmod(num, mode) {\n assert(num.cmpn(0) !== 0);\n\n if (this.sign && !num.sign) {\n var res = this.neg().divmod(num, mode);\n var div;\n var mod;\n if (mode !== 'mod')\n div = res.div.neg();\n if (mode !== 'div')\n mod = res.mod.cmpn(0) === 0 ? res.mod : num.sub(res.mod);\n return {\n div: div,\n mod: mod\n };\n } else if (!this.sign && num.sign) {\n var res = this.divmod(num.neg(), mode);\n var div;\n if (mode !== 'mod')\n div = res.div.neg();\n return { div: div, mod: res.mod };\n } else if (this.sign && num.sign) {\n return this.neg().divmod(num.neg(), mode);\n }\n\n // Both numbers are positive at this point\n\n // Strip both numbers to approximate shift value\n if (num.length > this.length || this.cmp(num) < 0)\n return { div: new BN(0), mod: this };\n\n // Very short reduction\n if (num.length === 1) {\n if (mode === 'div')\n return { div: this.divn(num.words[0]), mod: null };\n else if (mode === 'mod')\n return { div: null, mod: new BN(this.modn(num.words[0])) };\n return {\n div: this.divn(num.words[0]),\n mod: new BN(this.modn(num.words[0]))\n };\n }\n\n return this._wordDiv(num, mode);\n};\n\n// Find `this` / `num`\nBN.prototype.div = function div(num) {\n return this.divmod(num, 'div').div;\n};\n\n// Find `this` % `num`\nBN.prototype.mod = function mod(num) {\n return this.divmod(num, 'mod').mod;\n};\n\n// Find Round(`this` / `num`)\nBN.prototype.divRound = function divRound(num) {\n var dm = this.divmod(num);\n\n // Fast case - exact division\n if (dm.mod.cmpn(0) === 0)\n return dm.div;\n\n var mod = dm.div.sign ? dm.mod.isub(num) : dm.mod;\n\n var half = num.shrn(1);\n var r2 = num.andln(1);\n var cmp = mod.cmp(half);\n\n // Round down\n if (cmp < 0 || r2 === 1 && cmp === 0)\n return dm.div;\n\n // Round up\n return dm.div.sign ? dm.div.isubn(1) : dm.div.iaddn(1);\n};\n\nBN.prototype.modn = function modn(num) {\n assert(num <= 0x3ffffff);\n var p = (1 << 26) % num;\n\n var acc = 0;\n for (var i = this.length - 1; i >= 0; i--)\n acc = (p * acc + this.words[i]) % num;\n\n return acc;\n};\n\n// In-place division by number\nBN.prototype.idivn = function idivn(num) {\n assert(num <= 0x3ffffff);\n\n var carry = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var w = this.words[i] + carry * 0x4000000;\n this.words[i] = (w / num) | 0;\n carry = w % num;\n }\n\n return this.strip();\n};\n\nBN.prototype.divn = function divn(num) {\n return this.clone().idivn(num);\n};\n\nBN.prototype._egcd = function _egcd(x1, p) {\n assert(!p.sign);\n assert(p.cmpn(0) !== 0);\n\n var a = this;\n var b = p.clone();\n\n if (a.sign)\n a = a.mod(p);\n else\n a = a.clone();\n\n var x2 = new BN(0);\n while (b.isEven())\n b.ishrn(1);\n var delta = b.clone();\n while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {\n while (a.isEven()) {\n a.ishrn(1);\n if (x1.isEven())\n x1.ishrn(1);\n else\n x1.iadd(delta).ishrn(1);\n }\n while (b.isEven()) {\n b.ishrn(1);\n if (x2.isEven())\n x2.ishrn(1);\n else\n x2.iadd(delta).ishrn(1);\n }\n if (a.cmp(b) >= 0) {\n a.isub(b);\n x1.isub(x2);\n } else {\n b.isub(a);\n x2.isub(x1);\n }\n }\n if (a.cmpn(1) === 0)\n return x1;\n else\n return x2;\n};\n\nBN.prototype.gcd = function gcd(num) {\n if (this.cmpn(0) === 0)\n return num.clone();\n if (num.cmpn(0) === 0)\n return this.clone();\n\n var a = this.clone();\n var b = num.clone();\n a.sign = false;\n b.sign = false;\n\n // Remove common factor of two\n for (var shift = 0; a.isEven() && b.isEven(); shift++) {\n a.ishrn(1);\n b.ishrn(1);\n }\n\n while (a.isEven())\n a.ishrn(1);\n\n do {\n while (b.isEven())\n b.ishrn(1);\n\n // Swap `a` and `b` to make `a` always bigger than `b`\n if (a.cmp(b) < 0) {\n var t = a;\n a = b;\n b = t;\n }\n a.isub(a.div(b).mul(b));\n } while (a.cmpn(0) !== 0 && b.cmpn(0) !== 0);\n if (a.cmpn(0) === 0)\n return b.ishln(shift);\n else\n return a.ishln(shift);\n};\n\n// Invert number in the field F(num)\nBN.prototype.invm = function invm(num) {\n return this._egcd(new BN(1), num).mod(num);\n};\n\nBN.prototype.isEven = function isEven() {\n return (this.words[0] & 1) === 0;\n};\n\nBN.prototype.isOdd = function isOdd() {\n return (this.words[0] & 1) === 1;\n};\n\n// And first word and num\nBN.prototype.andln = function andln(num) {\n return this.words[0] & num;\n};\n\n// Increment at the bit position in-line\nBN.prototype.bincn = function bincn(bit) {\n assert(typeof bit === 'number');\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) {\n for (var i = this.length; i < s + 1; i++)\n this.words[i] = 0;\n this.words[s] |= q;\n this.length = s + 1;\n return this;\n }\n\n // Add bit and propagate, if needed\n var carry = q;\n for (var i = s; carry !== 0 && i < this.length; i++) {\n var w = this.words[i];\n w += carry;\n carry = w >>> 26;\n w &= 0x3ffffff;\n this.words[i] = w;\n }\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n return this;\n};\n\nBN.prototype.cmpn = function cmpn(num) {\n var sign = num < 0;\n if (sign)\n num = -num;\n\n if (this.sign && !sign)\n return -1;\n else if (!this.sign && sign)\n return 1;\n\n num &= 0x3ffffff;\n this.strip();\n\n var res;\n if (this.length > 1) {\n res = 1;\n } else {\n var w = this.words[0];\n res = w === num ? 0 : w < num ? -1 : 1;\n }\n if (this.sign)\n res = -res;\n return res;\n};\n\n// Compare two numbers and return:\n// 1 - if `this` > `num`\n// 0 - if `this` == `num`\n// -1 - if `this` < `num`\nBN.prototype.cmp = function cmp(num) {\n if (this.sign && !num.sign)\n return -1;\n else if (!this.sign && num.sign)\n return 1;\n\n var res = this.ucmp(num);\n if (this.sign)\n return -res;\n else\n return res;\n};\n\n// Unsigned comparison\nBN.prototype.ucmp = function ucmp(num) {\n // At this point both numbers have the same sign\n if (this.length > num.length)\n return 1;\n else if (this.length < num.length)\n return -1;\n\n var res = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var a = this.words[i];\n var b = num.words[i];\n\n if (a === b)\n continue;\n if (a < b)\n res = -1;\n else if (a > b)\n res = 1;\n break;\n }\n return res;\n};\n\n//\n// A reduce context, could be using montgomery or something better, depending\n// on the `m` itself.\n//\nBN.red = function red(num) {\n return new Red(num);\n};\n\nBN.prototype.toRed = function toRed(ctx) {\n assert(!this.red, 'Already a number in reduction context');\n assert(!this.sign, 'red works only with positives');\n return ctx.convertTo(this)._forceRed(ctx);\n};\n\nBN.prototype.fromRed = function fromRed() {\n assert(this.red, 'fromRed works only with numbers in reduction context');\n return this.red.convertFrom(this);\n};\n\nBN.prototype._forceRed = function _forceRed(ctx) {\n this.red = ctx;\n return this;\n};\n\nBN.prototype.forceRed = function forceRed(ctx) {\n assert(!this.red, 'Already a number in reduction context');\n return this._forceRed(ctx);\n};\n\nBN.prototype.redAdd = function redAdd(num) {\n assert(this.red, 'redAdd works only with red numbers');\n return this.red.add(this, num);\n};\n\nBN.prototype.redIAdd = function redIAdd(num) {\n assert(this.red, 'redIAdd works only with red numbers');\n return this.red.iadd(this, num);\n};\n\nBN.prototype.redSub = function redSub(num) {\n assert(this.red, 'redSub works only with red numbers');\n return this.red.sub(this, num);\n};\n\nBN.prototype.redISub = function redISub(num) {\n assert(this.red, 'redISub works only with red numbers');\n return this.red.isub(this, num);\n};\n\nBN.prototype.redShl = function redShl(num) {\n assert(this.red, 'redShl works only with red numbers');\n return this.red.shl(this, num);\n};\n\nBN.prototype.redMul = function redMul(num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.mul(this, num);\n};\n\nBN.prototype.redIMul = function redIMul(num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.imul(this, num);\n};\n\nBN.prototype.redSqr = function redSqr() {\n assert(this.red, 'redSqr works only with red numbers');\n this.red._verify1(this);\n return this.red.sqr(this);\n};\n\nBN.prototype.redISqr = function redISqr() {\n assert(this.red, 'redISqr works only with red numbers');\n this.red._verify1(this);\n return this.red.isqr(this);\n};\n\n// Square root over p\nBN.prototype.redSqrt = function redSqrt() {\n assert(this.red, 'redSqrt works only with red numbers');\n this.red._verify1(this);\n return this.red.sqrt(this);\n};\n\nBN.prototype.redInvm = function redInvm() {\n assert(this.red, 'redInvm works only with red numbers');\n this.red._verify1(this);\n return this.red.invm(this);\n};\n\n// Return negative clone of `this` % `red modulo`\nBN.prototype.redNeg = function redNeg() {\n assert(this.red, 'redNeg works only with red numbers');\n this.red._verify1(this);\n return this.red.neg(this);\n};\n\nBN.prototype.redPow = function redPow(num) {\n assert(this.red && !num.red, 'redPow(normalNum)');\n this.red._verify1(this);\n return this.red.pow(this, num);\n};\n\n// Prime numbers with efficient reduction\nvar primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n};\n\n// Pseudo-Mersenne prime\nfunction MPrime(name, p) {\n // P = 2 ^ N - K\n this.name = name;\n this.p = new BN(p, 16);\n this.n = this.p.bitLength();\n this.k = new BN(1).ishln(this.n).isub(this.p);\n\n this.tmp = this._tmp();\n}\n\nMPrime.prototype._tmp = function _tmp() {\n var tmp = new BN(null);\n tmp.words = new Array(Math.ceil(this.n / 13));\n return tmp;\n};\n\nMPrime.prototype.ireduce = function ireduce(num) {\n // Assumes that `num` is less than `P^2`\n // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)\n var r = num;\n var rlen;\n\n do {\n var pair = r.ishrn(this.n, 0, this.tmp);\n r = this.imulK(pair.hi);\n r = r.iadd(pair.lo);\n rlen = r.bitLength();\n } while (rlen > this.n);\n\n var cmp = rlen < this.n ? -1 : r.cmp(this.p);\n if (cmp === 0) {\n r.words[0] = 0;\n r.length = 1;\n } else if (cmp > 0) {\n r.isub(this.p);\n } else {\n r.strip();\n }\n\n return r;\n};\n\nMPrime.prototype.imulK = function imulK(num) {\n return num.imul(this.k);\n};\n\nfunction K256() {\n MPrime.call(\n this,\n 'k256',\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');\n}\ninherits(K256, MPrime);\n\nK256.prototype.imulK = function imulK(num) {\n // K = 0x1000003d1 = [ 0x40, 0x3d1 ]\n num.words[num.length] = 0;\n num.words[num.length + 1] = 0;\n num.length += 2;\n\n // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390\n var hi;\n var lo = 0;\n for (var i = 0; i < num.length; i++) {\n var w = num.words[i];\n hi = w * 0x40;\n lo += w * 0x3d1;\n hi += (lo / 0x4000000) | 0;\n lo &= 0x3ffffff;\n\n num.words[i] = lo;\n\n lo = hi;\n }\n\n // Fast length reduction\n if (num.words[num.length - 1] === 0) {\n num.length--;\n if (num.words[num.length - 1] === 0)\n num.length--;\n }\n return num;\n};\n\nfunction P224() {\n MPrime.call(\n this,\n 'p224',\n 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');\n}\ninherits(P224, MPrime);\n\nfunction P192() {\n MPrime.call(\n this,\n 'p192',\n 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');\n}\ninherits(P192, MPrime);\n\nfunction P25519() {\n // 2 ^ 255 - 19\n MPrime.call(\n this,\n '25519',\n '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');\n}\ninherits(P25519, MPrime);\n\nP25519.prototype.imulK = function imulK(num) {\n // K = 0x13\n var carry = 0;\n for (var i = 0; i < num.length; i++) {\n var hi = num.words[i] * 0x13 + carry;\n var lo = hi & 0x3ffffff;\n hi >>>= 26;\n\n num.words[i] = lo;\n carry = hi;\n }\n if (carry !== 0)\n num.words[num.length++] = carry;\n return num;\n};\n\n// Exported mostly for testing purposes, use plain name instead\nBN._prime = function prime(name) {\n // Cached version of prime\n if (primes[name])\n return primes[name];\n\n var prime;\n if (name === 'k256')\n prime = new K256();\n else if (name === 'p224')\n prime = new P224();\n else if (name === 'p192')\n prime = new P192();\n else if (name === 'p25519')\n prime = new P25519();\n else\n throw new Error('Unknown prime ' + name);\n primes[name] = prime;\n\n return prime;\n};\n\n//\n// Base reduction engine\n//\nfunction Red(m) {\n if (typeof m === 'string') {\n var prime = BN._prime(m);\n this.m = prime.p;\n this.prime = prime;\n } else {\n this.m = m;\n this.prime = null;\n }\n}\n\nRed.prototype._verify1 = function _verify1(a) {\n assert(!a.sign, 'red works only with positives');\n assert(a.red, 'red works only with red numbers');\n};\n\nRed.prototype._verify2 = function _verify2(a, b) {\n assert(!a.sign && !b.sign, 'red works only with positives');\n assert(a.red && a.red === b.red,\n 'red works only with red numbers');\n};\n\nRed.prototype.imod = function imod(a) {\n if (this.prime)\n return this.prime.ireduce(a)._forceRed(this);\n return a.mod(this.m)._forceRed(this);\n};\n\nRed.prototype.neg = function neg(a) {\n var r = a.clone();\n r.sign = !r.sign;\n return r.iadd(this.m)._forceRed(this);\n};\n\nRed.prototype.add = function add(a, b) {\n this._verify2(a, b);\n\n var res = a.add(b);\n if (res.cmp(this.m) >= 0)\n res.isub(this.m);\n return res._forceRed(this);\n};\n\nRed.prototype.iadd = function iadd(a, b) {\n this._verify2(a, b);\n\n var res = a.iadd(b);\n if (res.cmp(this.m) >= 0)\n res.isub(this.m);\n return res;\n};\n\nRed.prototype.sub = function sub(a, b) {\n this._verify2(a, b);\n\n var res = a.sub(b);\n if (res.cmpn(0) < 0)\n res.iadd(this.m);\n return res._forceRed(this);\n};\n\nRed.prototype.isub = function isub(a, b) {\n this._verify2(a, b);\n\n var res = a.isub(b);\n if (res.cmpn(0) < 0)\n res.iadd(this.m);\n return res;\n};\n\nRed.prototype.shl = function shl(a, num) {\n this._verify1(a);\n return this.imod(a.shln(num));\n};\n\nRed.prototype.imul = function imul(a, b) {\n this._verify2(a, b);\n return this.imod(a.imul(b));\n};\n\nRed.prototype.mul = function mul(a, b) {\n this._verify2(a, b);\n return this.imod(a.mul(b));\n};\n\nRed.prototype.isqr = function isqr(a) {\n return this.imul(a, a);\n};\n\nRed.prototype.sqr = function sqr(a) {\n return this.mul(a, a);\n};\n\nRed.prototype.sqrt = function sqrt(a) {\n if (a.cmpn(0) === 0)\n return a.clone();\n\n var mod3 = this.m.andln(3);\n assert(mod3 % 2 === 1);\n\n // Fast case\n if (mod3 === 3) {\n var pow = this.m.add(new BN(1)).ishrn(2);\n var r = this.pow(a, pow);\n return r;\n }\n\n // Tonelli-Shanks algorithm (Totally unoptimized and slow)\n //\n // Find Q and S, that Q * 2 ^ S = (P - 1)\n var q = this.m.subn(1);\n var s = 0;\n while (q.cmpn(0) !== 0 && q.andln(1) === 0) {\n s++;\n q.ishrn(1);\n }\n assert(q.cmpn(0) !== 0);\n\n var one = new BN(1).toRed(this);\n var nOne = one.redNeg();\n\n // Find quadratic non-residue\n // NOTE: Max is such because of generalized Riemann hypothesis.\n var lpow = this.m.subn(1).ishrn(1);\n var z = this.m.bitLength();\n z = new BN(2 * z * z).toRed(this);\n while (this.pow(z, lpow).cmp(nOne) !== 0)\n z.redIAdd(nOne);\n\n var c = this.pow(z, q);\n var r = this.pow(a, q.addn(1).ishrn(1));\n var t = this.pow(a, q);\n var m = s;\n while (t.cmp(one) !== 0) {\n var tmp = t;\n for (var i = 0; tmp.cmp(one) !== 0; i++)\n tmp = tmp.redSqr();\n assert(i < m);\n var b = this.pow(c, new BN(1).ishln(m - i - 1));\n\n r = r.redMul(b);\n c = b.redSqr();\n t = t.redMul(c);\n m = i;\n }\n\n return r;\n};\n\nRed.prototype.invm = function invm(a) {\n var inv = a._egcd(new BN(1), this.m);\n if (inv.sign) {\n inv.sign = false;\n return this.imod(inv).redNeg();\n } else {\n return this.imod(inv);\n }\n};\n\nRed.prototype.pow = function pow(a, num) {\n var w = [];\n var q = num.clone();\n while (q.cmpn(0) !== 0) {\n w.push(q.andln(1));\n q.ishrn(1);\n }\n\n // Skip leading zeroes\n var res = a;\n for (var i = 0; i < w.length; i++, res = this.sqr(res))\n if (w[i] !== 0)\n break;\n\n if (++i < w.length) {\n for (var q = this.sqr(res); i < w.length; i++, q = this.sqr(q)) {\n if (w[i] === 0)\n continue;\n res = this.mul(res, q);\n }\n }\n\n return res;\n};\n\nRed.prototype.convertTo = function convertTo(num) {\n return num.clone();\n};\n\nRed.prototype.convertFrom = function convertFrom(num) {\n var res = num.clone();\n res.red = null;\n return res;\n};\n\n//\n// Montgomery method engine\n//\n\nBN.mont = function mont(num) {\n return new Mont(num);\n};\n\nfunction Mont(m) {\n Red.call(this, m);\n\n this.shift = this.m.bitLength();\n if (this.shift % 26 !== 0)\n this.shift += 26 - (this.shift % 26);\n this.r = new BN(1).ishln(this.shift);\n this.r2 = this.imod(this.r.sqr());\n this.rinv = this.r.invm(this.m);\n\n this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);\n this.minv.sign = true;\n this.minv = this.minv.mod(this.r);\n}\ninherits(Mont, Red);\n\nMont.prototype.convertTo = function convertTo(num) {\n return this.imod(num.shln(this.shift));\n};\n\nMont.prototype.convertFrom = function convertFrom(num) {\n var r = this.imod(num.mul(this.rinv));\n r.red = null;\n return r;\n};\n\nMont.prototype.imul = function imul(a, b) {\n if (a.cmpn(0) === 0 || b.cmpn(0) === 0) {\n a.words[0] = 0;\n a.length = 1;\n return a;\n }\n\n var t = a.imul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).ishrn(this.shift);\n var res = u;\n if (u.cmp(this.m) >= 0)\n res = u.isub(this.m);\n else if (u.cmpn(0) < 0)\n res = u.iadd(this.m);\n\n return res._forceRed(this);\n};\n\nMont.prototype.mul = function mul(a, b) {\n if (a.cmpn(0) === 0 || b.cmpn(0) === 0)\n return new BN(0)._forceRed(this);\n\n var t = a.mul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).ishrn(this.shift);\n var res = u;\n if (u.cmp(this.m) >= 0)\n res = u.isub(this.m);\n else if (u.cmpn(0) < 0)\n res = u.iadd(this.m);\n\n return res._forceRed(this);\n};\n\nMont.prototype.invm = function invm(a) {\n // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R\n var res = this.imod(a.invm(this.m).mul(this.r2));\n return res._forceRed(this);\n};\n\n})(typeof module === 'undefined' || module, this);\n\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/browserify-rsa/index.js\":[function(require,module,exports){\n(function (Buffer){\nvar bn = require('bn.js');\nmodule.exports = crt;\nfunction blind(priv, crypto) {\n var r = getr(priv, crypto);\n var blinder = r.toRed(bn.mont(priv.modulus))\n .redPow(new bn(priv.publicExponent)).fromRed();\n return {\n blinder: blinder,\n unblinder:r.invm(priv.modulus)\n };\n}\nfunction crt(msg, priv, crypto) {\n var blinds = blind(priv, crypto);\n var len = priv.modulus.byteLength();\n var mod = bn.mont(priv.modulus);\n var blinded = new bn(msg).mul(blinds.blinder).mod(priv.modulus);\n var c1 = blinded.toRed(bn.mont(priv.prime1));\n var c2 = blinded.toRed(bn.mont(priv.prime2));\n var qinv = priv.coefficient;\n var p = priv.prime1;\n var q = priv.prime2;\n var m1 = c1.redPow(priv.exponent1);\n var m2 = c2.redPow(priv.exponent2);\n m1 = m1.fromRed();\n m2 = m2.fromRed();\n var h = m1.isub(m2).imul(qinv).mod(p);\n h.imul(q);\n m2.iadd(h);\n var out = new Buffer(m2.imul(blinds.unblinder).mod(priv.modulus).toArray());\n if (out.length < len) {\n var prefix = new Buffer(len - out.length);\n prefix.fill(0);\n out = Buffer.concat([prefix, out], len);\n }\n return out;\n}\ncrt.getr = getr;\nfunction getr(priv, crypto) {\n var len = priv.modulus.byteLength();\n var r = new bn(crypto.randomBytes(len));\n while (r.cmp(priv.modulus) >= 0 || !r.mod(priv.prime1) || !r.mod(priv.prime2)) {\n r = new bn(crypto.randomBytes(len));\n }\n return r;\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\":[function(require,module,exports){\nvar elliptic = exports;\n\nelliptic.version = require('../package.json').version;\nelliptic.utils = require('./elliptic/utils');\nelliptic.rand = require('brorand');\nelliptic.hmacDRBG = require('./elliptic/hmac-drbg');\nelliptic.curve = require('./elliptic/curve');\nelliptic.curves = require('./elliptic/curves');\n\n// Protocols\nelliptic.ec = require('./elliptic/ec');\n\n},{\"../package.json\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/package.json\",\"./elliptic/curve\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/index.js\",\"./elliptic/curves\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curves.js\",\"./elliptic/ec\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/index.js\",\"./elliptic/hmac-drbg\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/hmac-drbg.js\",\"./elliptic/utils\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/utils.js\",\"brorand\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/base.js\":[function(require,module,exports){\nvar bn = require('bn.js');\nvar elliptic = require('../../elliptic');\n\nvar getNAF = elliptic.utils.getNAF;\nvar getJSF = elliptic.utils.getJSF;\nvar assert = elliptic.utils.assert;\n\nfunction BaseCurve(type, conf) {\n this.type = type;\n this.p = new bn(conf.p, 16);\n\n // Use Montgomery, when there is no fast reduction for the prime\n this.red = conf.prime ? bn.red(conf.prime) : bn.mont(this.p);\n\n // Useful for many curves\n this.zero = new bn(0).toRed(this.red);\n this.one = new bn(1).toRed(this.red);\n this.two = new bn(2).toRed(this.red);\n\n // Curve configuration, optional\n this.n = conf.n && new bn(conf.n, 16);\n this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed);\n\n // Temporary arrays\n this._wnafT1 = new Array(4);\n this._wnafT2 = new Array(4);\n this._wnafT3 = new Array(4);\n this._wnafT4 = new Array(4);\n}\nmodule.exports = BaseCurve;\n\nBaseCurve.prototype.point = function point() {\n throw new Error('Not implemented');\n};\n\nBaseCurve.prototype.validate = function validate(point) {\n throw new Error('Not implemented');\n};\n\nBaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {\n var doubles = p._getDoubles();\n\n var naf = getNAF(k, 1);\n var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1);\n I /= 3;\n\n // Translate into more windowed form\n var repr = [];\n for (var j = 0; j < naf.length; j += doubles.step) {\n var nafW = 0;\n for (var k = j + doubles.step - 1; k >= j; k--)\n nafW = (nafW << 1) + naf[k];\n repr.push(nafW);\n }\n\n var a = this.jpoint(null, null, null);\n var b = this.jpoint(null, null, null);\n for (var i = I; i > 0; i--) {\n for (var j = 0; j < repr.length; j++) {\n var nafW = repr[j];\n if (nafW === i)\n b = b.mixedAdd(doubles.points[j]);\n else if (nafW === -i)\n b = b.mixedAdd(doubles.points[j].neg());\n }\n a = a.add(b);\n }\n return a.toP();\n};\n\nBaseCurve.prototype._wnafMul = function _wnafMul(p, k) {\n var w = 4;\n\n // Precompute window\n var nafPoints = p._getNAFPoints(w);\n w = nafPoints.wnd;\n var wnd = nafPoints.points;\n\n // Get NAF form\n var naf = getNAF(k, w);\n\n // Add `this`*(N+1) for every w-NAF index\n var acc = this.jpoint(null, null, null);\n for (var i = naf.length - 1; i >= 0; i--) {\n // Count zeroes\n for (var k = 0; i >= 0 && naf[i] === 0; i--)\n k++;\n if (i >= 0)\n k++;\n acc = acc.dblp(k);\n\n if (i < 0)\n break;\n var z = naf[i];\n assert(z !== 0);\n if (p.type === 'affine') {\n // J +- P\n if (z > 0)\n acc = acc.mixedAdd(wnd[(z - 1) >> 1]);\n else\n acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg());\n } else {\n // J +- J\n if (z > 0)\n acc = acc.add(wnd[(z - 1) >> 1]);\n else\n acc = acc.add(wnd[(-z - 1) >> 1].neg());\n }\n }\n return p.type === 'affine' ? acc.toP() : acc;\n};\n\nBaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,\n points,\n coeffs,\n len) {\n var wndWidth = this._wnafT1;\n var wnd = this._wnafT2;\n var naf = this._wnafT3;\n\n // Fill all arrays\n var max = 0;\n for (var i = 0; i < len; i++) {\n var p = points[i];\n var nafPoints = p._getNAFPoints(defW);\n wndWidth[i] = nafPoints.wnd;\n wnd[i] = nafPoints.points;\n }\n\n // Comb small window NAFs\n for (var i = len - 1; i >= 1; i -= 2) {\n var a = i - 1;\n var b = i;\n if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {\n naf[a] = getNAF(coeffs[a], wndWidth[a]);\n naf[b] = getNAF(coeffs[b], wndWidth[b]);\n max = Math.max(naf[a].length, max);\n max = Math.max(naf[b].length, max);\n continue;\n }\n\n var comb = [\n points[a], /* 1 */\n null, /* 3 */\n null, /* 5 */\n points[b] /* 7 */\n ];\n\n // Try to avoid Projective points, if possible\n if (points[a].y.cmp(points[b].y) === 0) {\n comb[1] = points[a].add(points[b]);\n comb[2] = points[a].toJ().mixedAdd(points[b].neg());\n } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) {\n comb[1] = points[a].toJ().mixedAdd(points[b]);\n comb[2] = points[a].add(points[b].neg());\n } else {\n comb[1] = points[a].toJ().mixedAdd(points[b]);\n comb[2] = points[a].toJ().mixedAdd(points[b].neg());\n }\n\n var index = [\n -3, /* -1 -1 */\n -1, /* -1 0 */\n -5, /* -1 1 */\n -7, /* 0 -1 */\n 0, /* 0 0 */\n 7, /* 0 1 */\n 5, /* 1 -1 */\n 1, /* 1 0 */\n 3 /* 1 1 */\n ];\n\n var jsf = getJSF(coeffs[a], coeffs[b]);\n max = Math.max(jsf[0].length, max);\n naf[a] = new Array(max);\n naf[b] = new Array(max);\n for (var j = 0; j < max; j++) {\n var ja = jsf[0][j] | 0;\n var jb = jsf[1][j] | 0;\n\n naf[a][j] = index[(ja + 1) * 3 + (jb + 1)];\n naf[b][j] = 0;\n wnd[a] = comb;\n }\n }\n\n var acc = this.jpoint(null, null, null);\n var tmp = this._wnafT4;\n for (var i = max; i >= 0; i--) {\n var k = 0;\n\n while (i >= 0) {\n var zero = true;\n for (var j = 0; j < len; j++) {\n tmp[j] = naf[j][i] | 0;\n if (tmp[j] !== 0)\n zero = false;\n }\n if (!zero)\n break;\n k++;\n i--;\n }\n if (i >= 0)\n k++;\n acc = acc.dblp(k);\n if (i < 0)\n break;\n\n for (var j = 0; j < len; j++) {\n var z = tmp[j];\n var p;\n if (z === 0)\n continue;\n else if (z > 0)\n p = wnd[j][(z - 1) >> 1];\n else if (z < 0)\n p = wnd[j][(-z - 1) >> 1].neg();\n\n if (p.type === 'affine')\n acc = acc.mixedAdd(p);\n else\n acc = acc.add(p);\n }\n }\n // Zeroify references\n for (var i = 0; i < len; i++)\n wnd[i] = null;\n return acc.toP();\n};\n\nBaseCurve.BasePoint = BasePoint;\n\nfunction BasePoint(curve, type) {\n this.curve = curve;\n this.type = type;\n this.precomputed = null;\n}\n\nBasePoint.prototype.validate = function validate() {\n return this.curve.validate(this);\n};\n\nBasePoint.prototype.precompute = function precompute(power, _beta) {\n if (this.precomputed)\n return this;\n\n var precomputed = {\n doubles: null,\n naf: null,\n beta: null\n };\n precomputed.naf = this._getNAFPoints(8);\n precomputed.doubles = this._getDoubles(4, power);\n precomputed.beta = this._getBeta();\n this.precomputed = precomputed;\n\n return this;\n};\n\nBasePoint.prototype._getDoubles = function _getDoubles(step, power) {\n if (this.precomputed && this.precomputed.doubles)\n return this.precomputed.doubles;\n\n var doubles = [ this ];\n var acc = this;\n for (var i = 0; i < power; i += step) {\n for (var j = 0; j < step; j++)\n acc = acc.dbl();\n doubles.push(acc);\n }\n return {\n step: step,\n points: doubles\n };\n};\n\nBasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {\n if (this.precomputed && this.precomputed.naf)\n return this.precomputed.naf;\n\n var res = [ this ];\n var max = (1 << wnd) - 1;\n var dbl = max === 1 ? null : this.dbl();\n for (var i = 1; i < max; i++)\n res[i] = res[i - 1].add(dbl);\n return {\n wnd: wnd,\n points: res\n };\n};\n\nBasePoint.prototype._getBeta = function _getBeta() {\n return null;\n};\n\nBasePoint.prototype.dblp = function dblp(k) {\n var r = this;\n for (var i = 0; i < k; i++)\n r = r.dbl();\n return r;\n};\n\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/edwards.js\":[function(require,module,exports){\nvar curve = require('../curve');\nvar elliptic = require('../../elliptic');\nvar bn = require('bn.js');\nvar inherits = require('inherits');\nvar Base = curve.base;\n\nvar getNAF = elliptic.utils.getNAF;\nvar assert = elliptic.utils.assert;\n\nfunction EdwardsCurve(conf) {\n // NOTE: Important as we are creating point in Base.call()\n this.twisted = conf.a != 1;\n this.mOneA = this.twisted && conf.a == -1;\n this.extended = this.mOneA;\n\n Base.call(this, 'mont', conf);\n\n this.a = new bn(conf.a, 16).mod(this.red.m).toRed(this.red);\n this.c = new bn(conf.c, 16).toRed(this.red);\n this.c2 = this.c.redSqr();\n this.d = new bn(conf.d, 16).toRed(this.red);\n this.dd = this.d.redAdd(this.d);\n\n assert(!this.twisted || this.c.fromRed().cmpn(1) === 0);\n this.oneC = conf.c == 1;\n}\ninherits(EdwardsCurve, Base);\nmodule.exports = EdwardsCurve;\n\nEdwardsCurve.prototype._mulA = function _mulA(num) {\n if (this.mOneA)\n return num.redNeg();\n else\n return this.a.redMul(num);\n};\n\nEdwardsCurve.prototype._mulC = function _mulC(num) {\n if (this.oneC)\n return num;\n else\n return this.c.redMul(num);\n};\n\nEdwardsCurve.prototype.point = function point(x, y, z, t) {\n return new Point(this, x, y, z, t);\n};\n\n// Just for compatibility with Short curve\nEdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) {\n return this.point(x, y, z, t);\n};\n\nEdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) {\n return Point.fromJSON(this, obj);\n};\n\nEdwardsCurve.prototype.pointFromX = function pointFromX(odd, x) {\n x = new bn(x, 16);\n if (!x.red)\n x = x.toRed(this.red);\n\n var x2 = x.redSqr();\n var rhs = this.c2.redSub(this.a.redMul(x2));\n var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2));\n\n var y = rhs.redMul(lhs.redInvm()).redSqrt();\n var isOdd = y.fromRed().isOdd();\n if (odd && !isOdd || !odd && isOdd)\n y = y.redNeg();\n\n return this.point(x, y, curve.one);\n};\n\nEdwardsCurve.prototype.validate = function validate(point) {\n if (point.isInfinity())\n return true;\n\n // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2)\n point.normalize();\n\n var x2 = point.x.redSqr();\n var y2 = point.y.redSqr();\n var lhs = x2.redMul(this.a).redAdd(y2);\n var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));\n\n return lhs.cmp(rhs) === 0;\n};\n\nfunction Point(curve, x, y, z, t) {\n Base.BasePoint.call(this, curve, 'projective');\n if (x === null && y === null && z === null) {\n this.x = this.curve.zero;\n this.y = this.curve.one;\n this.z = this.curve.one;\n this.t = this.curve.zero;\n this.zOne = true;\n } else {\n this.x = new bn(x, 16);\n this.y = new bn(y, 16);\n this.z = z ? new bn(z, 16) : this.curve.one;\n this.t = t && new bn(t, 16);\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.y.red)\n this.y = this.y.toRed(this.curve.red);\n if (!this.z.red)\n this.z = this.z.toRed(this.curve.red);\n if (this.t && !this.t.red)\n this.t = this.t.toRed(this.curve.red);\n this.zOne = this.z === this.curve.one;\n\n // Use extended coordinates\n if (this.curve.extended && !this.t) {\n this.t = this.x.redMul(this.y);\n if (!this.zOne)\n this.t = this.t.redMul(this.z.redInvm());\n }\n }\n}\ninherits(Point, Base.BasePoint);\n\nPoint.fromJSON = function fromJSON(curve, obj) {\n return new Point(curve, obj[0], obj[1], obj[2]);\n};\n\nPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nPoint.prototype.isInfinity = function isInfinity() {\n // XXX This code assumes that zero is always zero in red\n return this.x.cmpn(0) === 0 &&\n this.y.cmp(this.z) === 0;\n};\n\nPoint.prototype._extDbl = function _extDbl() {\n // http://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#doubling-dbl-2008-hwcd\n // 4M + 4S\n\n // A = X1^2\n var a = this.x.redSqr();\n // B = Y1^2\n var b = this.y.redSqr();\n // C = 2 * Z1^2\n var c = this.z.redSqr();\n c = c.redIAdd(c);\n // D = a * A\n var d = this.curve._mulA(a);\n // E = (X1 + Y1)^2 - A - B\n var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b);\n // G = D + B\n var g = d.redAdd(b);\n // F = G - C\n var f = g.redSub(c);\n // H = D - B\n var h = d.redSub(b);\n // X3 = E * F\n var nx = e.redMul(f);\n // Y3 = G * H\n var ny = g.redMul(h);\n // T3 = E * H\n var nt = e.redMul(h);\n // Z3 = F * G\n var nz = f.redMul(g);\n return this.curve.point(nx, ny, nz, nt);\n};\n\nPoint.prototype._projDbl = function _projDbl() {\n // http://hyperelliptic.org/EFD/g1p/auto-twisted-projective.html#doubling-dbl-2008-bbjlp\n // http://hyperelliptic.org/EFD/g1p/auto-edwards-projective.html#doubling-dbl-2007-bl\n // and others\n // Generally 3M + 4S or 2M + 4S\n\n // B = (X1 + Y1)^2\n var b = this.x.redAdd(this.y).redSqr();\n // C = X1^2\n var c = this.x.redSqr();\n // D = Y1^2\n var d = this.y.redSqr();\n\n if (this.curve.twisted) {\n // E = a * C\n var e = this.curve._mulA(c);\n // F = E + D\n var f = e.redAdd(d);\n if (this.zOne) {\n // X3 = (B - C - D) * (F - 2)\n var nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two));\n // Y3 = F * (E - D)\n var ny = f.redMul(e.redSub(d));\n // Z3 = F^2 - 2 * F\n var nz = f.redSqr().redSub(f).redSub(f);\n } else {\n // H = Z1^2\n var h = this.z.redSqr();\n // J = F - 2 * H\n var j = f.redSub(h).redISub(h);\n // X3 = (B-C-D)*J\n var nx = b.redSub(c).redISub(d).redMul(j);\n // Y3 = F * (E - D)\n var ny = f.redMul(e.redSub(d));\n // Z3 = F * J\n var nz = f.redMul(j);\n }\n } else {\n // E = C + D\n var e = c.redAdd(d);\n // H = (c * Z1)^2\n var h = this.curve._mulC(redMul(this.z)).redSqr();\n // J = E - 2 * H\n var j = e.redSub(h).redSub(h);\n // X3 = c * (B - E) * J\n var nx = this.curve._mulC(b.redISub(e)).redMul(j);\n // Y3 = c * E * (C - D)\n var ny = this.curve._mulC(e).redMul(c.redISub(d));\n // Z3 = E * J\n var nz = e.redMul(j);\n }\n return this.curve.point(nx, ny, nz);\n};\n\nPoint.prototype.dbl = function dbl() {\n if (this.isInfinity())\n return this;\n\n // Double in extended coordinates\n if (this.curve.extended)\n return this._extDbl();\n else\n return this._projDbl();\n};\n\nPoint.prototype._extAdd = function _extAdd(p) {\n // http://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#addition-add-2008-hwcd-3\n // 8M\n\n // A = (Y1 - X1) * (Y2 - X2)\n var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x));\n // B = (Y1 + X1) * (Y2 + X2)\n var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x));\n // C = T1 * k * T2\n var c = this.t.redMul(this.curve.dd).redMul(p.t);\n // D = Z1 * 2 * Z2\n var d = this.z.redMul(p.z.redAdd(p.z));\n // E = B - A\n var e = b.redSub(a);\n // F = D - C\n var f = d.redSub(c);\n // G = D + C\n var g = d.redAdd(c);\n // H = B + A\n var h = b.redAdd(a);\n // X3 = E * F\n var nx = e.redMul(f);\n // Y3 = G * H\n var ny = g.redMul(h);\n // T3 = E * H\n var nt = e.redMul(h);\n // Z3 = F * G\n var nz = f.redMul(g);\n return this.curve.point(nx, ny, nz, nt);\n};\n\nPoint.prototype._projAdd = function _projAdd(p) {\n // http://hyperelliptic.org/EFD/g1p/auto-twisted-projective.html#addition-add-2008-bbjlp\n // http://hyperelliptic.org/EFD/g1p/auto-edwards-projective.html#addition-add-2007-bl\n // 10M + 1S\n\n // A = Z1 * Z2\n var a = this.z.redMul(p.z);\n // B = A^2\n var b = a.redSqr();\n // C = X1 * X2\n var c = this.x.redMul(p.x);\n // D = Y1 * Y2\n var d = this.y.redMul(p.y);\n // E = d * C * D\n var e = this.curve.d.redMul(c).redMul(d);\n // F = B - E\n var f = b.redSub(e);\n // G = B + E\n var g = b.redAdd(e);\n // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D)\n var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d);\n var nx = a.redMul(f).redMul(tmp);\n if (this.curve.twisted) {\n // Y3 = A * G * (D - a * C)\n var ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c)));\n // Z3 = F * G\n var nz = f.redMul(g);\n } else {\n // Y3 = A * G * (D - C)\n var ny = a.redMul(g).redMul(d.redSub(c));\n // Z3 = c * F * G\n var nz = this.curve._mulC(f).redMul(g);\n }\n return this.curve.point(nx, ny, nz);\n};\n\nPoint.prototype.add = function add(p) {\n if (this.isInfinity())\n return p;\n if (p.isInfinity())\n return this;\n\n if (this.curve.extended)\n return this._extAdd(p);\n else\n return this._projAdd(p);\n};\n\nPoint.prototype.mul = function mul(k) {\n if (this.precomputed && this.precomputed.doubles)\n return this.curve._fixedNafMul(this, k);\n else\n return this.curve._wnafMul(this, k);\n};\n\nPoint.prototype.mulAdd = function mulAdd(k1, p, k2) {\n return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2);\n};\n\nPoint.prototype.normalize = function normalize() {\n if (this.zOne)\n return this;\n\n // Normalize coordinates\n var zi = this.z.redInvm();\n this.x = this.x.redMul(zi);\n this.y = this.y.redMul(zi);\n if (this.t)\n this.t = this.t.redMul(zi);\n this.z = this.curve.one;\n this.zOne = true;\n return this;\n};\n\nPoint.prototype.neg = function neg() {\n return this.curve.point(this.x.redNeg(),\n this.y,\n this.z,\n this.t && this.t.redNeg());\n};\n\nPoint.prototype.getX = function getX() {\n this.normalize();\n return this.x.fromRed();\n};\n\nPoint.prototype.getY = function getY() {\n this.normalize();\n return this.y.fromRed();\n};\n\n// Compatibility with BaseCurve\nPoint.prototype.toP = Point.prototype.normalize;\nPoint.prototype.mixedAdd = Point.prototype.add;\n\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\",\"../curve\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/index.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/index.js\":[function(require,module,exports){\nvar curve = exports;\n\ncurve.base = require('./base');\ncurve.short = require('./short');\ncurve.mont = require('./mont');\ncurve.edwards = require('./edwards');\n\n},{\"./base\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/base.js\",\"./edwards\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/edwards.js\",\"./mont\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/mont.js\",\"./short\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/short.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/mont.js\":[function(require,module,exports){\nvar curve = require('../curve');\nvar elliptic = require('../../elliptic');\nvar bn = require('bn.js');\nvar inherits = require('inherits');\nvar Base = curve.base;\n\nvar getNAF = elliptic.utils.getNAF;\nvar assert = elliptic.utils.assert;\n\nfunction MontCurve(conf) {\n Base.call(this, 'mont', conf);\n\n this.a = new bn(conf.a, 16).toRed(this.red);\n this.b = new bn(conf.b, 16).toRed(this.red);\n this.i4 = new bn(4).toRed(this.red).redInvm();\n this.two = new bn(2).toRed(this.red);\n this.a24 = this.i4.redMul(this.a.redAdd(this.two));\n}\ninherits(MontCurve, Base);\nmodule.exports = MontCurve;\n\nMontCurve.prototype.point = function point(x, z) {\n return new Point(this, x, z);\n};\n\nMontCurve.prototype.pointFromJSON = function pointFromJSON(obj) {\n return Point.fromJSON(this, obj);\n}\n\nMontCurve.prototype.validate = function validate(point) {\n var x = point.normalize().x;\n var x2 = x.redSqr();\n var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);\n var y = rhs.redSqrt();\n\n return y.redSqr().cmp(rhs) === 0;\n};\n\nfunction Point(curve, x, z) {\n Base.BasePoint.call(this, curve, 'projective');\n if (x === null && z === null) {\n this.x = this.curve.one;\n this.z = this.curve.zero;\n } else {\n this.x = new bn(x, 16);\n this.z = new bn(z, 16);\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.z.red)\n this.z = this.z.toRed(this.curve.red);\n }\n}\ninherits(Point, Base.BasePoint);\n\nPoint.prototype.precompute = function precompute() {\n // No-op\n};\n\nPoint.fromJSON = function fromJSON(curve, obj) {\n return new Point(curve, obj[0], obj[1] || curve.one);\n};\n\nPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nPoint.prototype.isInfinity = function isInfinity() {\n // XXX This code assumes that zero is always zero in red\n return this.z.cmpn(0) === 0;\n};\n\nPoint.prototype.dbl = function dbl() {\n // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3\n // 2M + 2S + 4A\n\n // A = X1 + Z1\n var a = this.x.redAdd(this.z);\n // AA = A^2\n var aa = a.redSqr();\n // B = X1 - Z1\n var b = this.x.redSub(this.z);\n // BB = B^2\n var bb = b.redSqr();\n // C = AA - BB\n var c = aa.redSub(bb);\n // X3 = AA * BB\n var nx = aa.redMul(bb);\n // Z3 = C * (BB + A24 * C)\n var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c)));\n return this.curve.point(nx, nz);\n};\n\nPoint.prototype.add = function add(p) {\n throw new Error('Not supported on Montgomery curve');\n};\n\nPoint.prototype.diffAdd = function diffAdd(p, diff) {\n // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3\n // 4M + 2S + 6A\n\n // A = X2 + Z2\n var a = this.x.redAdd(this.z);\n // B = X2 - Z2\n var b = this.x.redSub(this.z);\n // C = X3 + Z3\n var c = p.x.redAdd(p.z);\n // D = X3 - Z3\n var d = p.x.redSub(p.z);\n // DA = D * A\n var da = d.redMul(a);\n // CB = C * B\n var cb = c.redMul(b);\n // X5 = Z1 * (DA + CB)^2\n var nx = diff.z.redMul(da.redAdd(cb).redSqr());\n // Z5 = X1 * (DA - CB)^2\n var nz = diff.x.redMul(da.redISub(cb).redSqr());\n return this.curve.point(nx, nz);\n};\n\nPoint.prototype.mul = function mul(k) {\n var t = k.clone();\n var a = this; // (N / 2) * Q + Q\n var b = this.curve.point(null, null); // (N / 2) * Q\n var c = this; // Q\n\n for (var bits = []; t.cmpn(0) !== 0; t.ishrn(1))\n bits.push(t.andln(1));\n\n for (var i = bits.length - 1; i >= 0; i--) {\n if (bits[i] === 0) {\n // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q\n a = a.diffAdd(b, c);\n // N * Q = 2 * ((N / 2) * Q + Q))\n b = b.dbl();\n } else {\n // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q)\n b = a.diffAdd(b, c);\n // N * Q + Q = 2 * ((N / 2) * Q + Q)\n a = a.dbl();\n }\n }\n return b;\n};\n\nPoint.prototype.mulAdd = function mulAdd() {\n throw new Error('Not supported on Montgomery curve');\n};\n\nPoint.prototype.normalize = function normalize() {\n this.x = this.x.redMul(this.z.redInvm());\n this.z = this.curve.one;\n return this;\n};\n\nPoint.prototype.getX = function getX() {\n // Normalize coordinates\n this.normalize();\n\n return this.x.fromRed();\n};\n\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\",\"../curve\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/index.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/short.js\":[function(require,module,exports){\nvar curve = require('../curve');\nvar elliptic = require('../../elliptic');\nvar bn = require('bn.js');\nvar inherits = require('inherits');\nvar Base = curve.base;\n\nvar getNAF = elliptic.utils.getNAF;\nvar assert = elliptic.utils.assert;\n\nfunction ShortCurve(conf) {\n Base.call(this, 'short', conf);\n\n this.a = new bn(conf.a, 16).toRed(this.red);\n this.b = new bn(conf.b, 16).toRed(this.red);\n this.tinv = this.two.redInvm();\n\n this.zeroA = this.a.fromRed().cmpn(0) === 0;\n this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0;\n\n // If the curve is endomorphic, precalculate beta and lambda\n this.endo = this._getEndomorphism(conf);\n this._endoWnafT1 = new Array(4);\n this._endoWnafT2 = new Array(4);\n}\ninherits(ShortCurve, Base);\nmodule.exports = ShortCurve;\n\nShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {\n // No efficient endomorphism\n if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)\n return;\n\n // Compute beta and lambda, that lambda * P = (beta * Px; Py)\n var beta;\n var lambda;\n if (conf.beta) {\n beta = new bn(conf.beta, 16).toRed(this.red);\n } else {\n var betas = this._getEndoRoots(this.p);\n // Choose the smallest beta\n beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1];\n beta = beta.toRed(this.red);\n }\n if (conf.lambda) {\n lambda = new bn(conf.lambda, 16);\n } else {\n // Choose the lambda that is matching selected beta\n var lambdas = this._getEndoRoots(this.n);\n if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) {\n lambda = lambdas[0];\n } else {\n lambda = lambdas[1];\n assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);\n }\n }\n\n // Get basis vectors, used for balanced length-two representation\n var basis;\n if (conf.basis) {\n basis = conf.basis.map(function(vec) {\n return {\n a: new bn(vec.a, 16),\n b: new bn(vec.b, 16),\n };\n });\n } else {\n basis = this._getEndoBasis(lambda);\n }\n\n return {\n beta: beta,\n lambda: lambda,\n basis: basis\n };\n};\n\nShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) {\n // Find roots of for x^2 + x + 1 in F\n // Root = (-1 +- Sqrt(-3)) / 2\n //\n var red = num === this.p ? this.red : bn.mont(num);\n var tinv = new bn(2).toRed(red).redInvm();\n var ntinv = tinv.redNeg();\n var one = new bn(1).toRed(red);\n\n var s = new bn(3).toRed(red).redNeg().redSqrt().redMul(tinv);\n\n var l1 = ntinv.redAdd(s).fromRed();\n var l2 = ntinv.redSub(s).fromRed();\n return [ l1, l2 ];\n};\n\nShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) {\n // aprxSqrt >= sqrt(this.n)\n var aprxSqrt = this.n.shrn(Math.floor(this.n.bitLength() / 2));\n\n // 3.74\n // Run EGCD, until r(L + 1) < aprxSqrt\n var u = lambda;\n var v = this.n.clone();\n var x1 = new bn(1);\n var y1 = new bn(0);\n var x2 = new bn(0);\n var y2 = new bn(1);\n\n // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n)\n var a0;\n var b0;\n // First vector\n var a1;\n var b1;\n // Second vector\n var a2;\n var b2;\n\n var prevR;\n var i = 0;\n while (u.cmpn(0) !== 0) {\n var q = v.div(u);\n var r = v.sub(q.mul(u));\n var x = x2.sub(q.mul(x1));\n var y = y2.sub(q.mul(y1));\n\n if (!a1 && r.cmp(aprxSqrt) < 0) {\n a0 = prevR.neg();\n b0 = x1;\n a1 = r.neg();\n b1 = x;\n } else if (a1 && ++i === 2) {\n break;\n }\n prevR = r;\n\n v = u;\n u = r;\n x2 = x1;\n x1 = x;\n y2 = y1;\n y1 = y;\n }\n a2 = r.neg();\n b2 = x;\n\n var len1 = a1.sqr().add(b1.sqr());\n var len2 = a2.sqr().add(b2.sqr());\n if (len2.cmp(len1) >= 0) {\n a2 = a0;\n b2 = b0;\n }\n\n // Normalize signs\n if (a1.sign) {\n a1 = a1.neg();\n b1 = b1.neg();\n }\n if (a2.sign) {\n a2 = a2.neg();\n b2 = b2.neg();\n }\n\n return [\n { a: a1, b: b1 },\n { a: a2, b: b2 }\n ];\n};\n\nShortCurve.prototype._endoSplit = function _endoSplit(k) {\n var basis = this.endo.basis;\n var v1 = basis[0];\n var v2 = basis[1];\n\n var c1 = v2.b.mul(k).divRound(this.n);\n var c2 = v1.b.neg().mul(k).divRound(this.n);\n\n var p1 = c1.mul(v1.a);\n var p2 = c2.mul(v2.a);\n var q1 = c1.mul(v1.b);\n var q2 = c2.mul(v2.b);\n\n // Calculate answer\n var k1 = k.sub(p1).sub(p2);\n var k2 = q1.add(q2).neg();\n return { k1: k1, k2: k2 };\n};\n\nShortCurve.prototype.point = function point(x, y, isRed) {\n return new Point(this, x, y, isRed);\n};\n\nShortCurve.prototype.pointFromX = function pointFromX(odd, x) {\n x = new bn(x, 16);\n if (!x.red)\n x = x.toRed(this.red);\n\n var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);\n var y = y2.redSqrt();\n\n // XXX Is there any way to tell if the number is odd without converting it\n // to non-red form?\n var isOdd = y.fromRed().isOdd();\n if (odd && !isOdd || !odd && isOdd)\n y = y.redNeg();\n\n return this.point(x, y);\n};\n\nShortCurve.prototype.jpoint = function jpoint(x, y, z) {\n return new JPoint(this, x, y, z);\n};\n\nShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) {\n return Point.fromJSON(this, obj, red);\n};\n\nShortCurve.prototype.validate = function validate(point) {\n if (point.inf)\n return true;\n\n var x = point.x;\n var y = point.y;\n\n var ax = this.a.redMul(x);\n var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);\n return y.redSqr().redISub(rhs).cmpn(0) === 0;\n};\n\nShortCurve.prototype._endoWnafMulAdd = function _endoWnafMulAdd(points, coeffs) {\n var npoints = this._endoWnafT1;\n var ncoeffs = this._endoWnafT2;\n for (var i = 0; i < points.length; i++) {\n var split = this._endoSplit(coeffs[i]);\n var p = points[i];\n var beta = p._getBeta();\n\n if (split.k1.sign) {\n split.k1.sign = !split.k1.sign;\n p = p.neg(true);\n }\n if (split.k2.sign) {\n split.k2.sign = !split.k2.sign;\n beta = beta.neg(true);\n }\n\n npoints[i * 2] = p;\n npoints[i * 2 + 1] = beta;\n ncoeffs[i * 2] = split.k1;\n ncoeffs[i * 2 + 1] = split.k2;\n }\n var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2);\n\n // Clean-up references to points and coefficients\n for (var j = 0; j < i * 2; j++) {\n npoints[j] = null;\n ncoeffs[j] = null;\n }\n return res;\n};\n\nfunction Point(curve, x, y, isRed) {\n Base.BasePoint.call(this, curve, 'affine');\n if (x === null && y === null) {\n this.x = null;\n this.y = null;\n this.inf = true;\n } else {\n this.x = new bn(x, 16);\n this.y = new bn(y, 16);\n // Force redgomery representation when loading from JSON\n if (isRed) {\n this.x.forceRed(this.curve.red);\n this.y.forceRed(this.curve.red);\n }\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.y.red)\n this.y = this.y.toRed(this.curve.red);\n this.inf = false;\n }\n}\ninherits(Point, Base.BasePoint);\n\nPoint.prototype._getBeta = function _getBeta() {\n if (!this.curve.endo)\n return;\n\n var pre = this.precomputed;\n if (pre && pre.beta)\n return pre.beta;\n\n var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);\n if (pre) {\n var curve = this.curve;\n function endoMul(p) {\n return curve.point(p.x.redMul(curve.endo.beta), p.y);\n }\n pre.beta = beta;\n beta.precomputed = {\n beta: null,\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(endoMul)\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(endoMul)\n }\n };\n }\n return beta;\n};\n\nPoint.prototype.toJSON = function toJSON() {\n if (!this.precomputed)\n return [ this.x, this.y ];\n\n return [ this.x, this.y, this.precomputed && {\n doubles: this.precomputed.doubles && {\n step: this.precomputed.doubles.step,\n points: this.precomputed.doubles.points.slice(1)\n },\n naf: this.precomputed.naf && {\n wnd: this.precomputed.naf.wnd,\n points: this.precomputed.naf.points.slice(1)\n }\n }];\n};\n\nPoint.fromJSON = function fromJSON(curve, obj, red) {\n if (typeof obj === 'string')\n obj = JSON.parse(obj);\n var res = curve.point(obj[0], obj[1], red);\n if (!obj[2])\n return res;\n\n function obj2point(obj) {\n return curve.point(obj[0], obj[1], red);\n }\n\n var pre = obj[2];\n res.precomputed = {\n beta: null,\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: [ res ].concat(pre.doubles.points.map(obj2point))\n },\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: [ res ].concat(pre.naf.points.map(obj2point))\n }\n };\n return res;\n};\n\nPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nPoint.prototype.isInfinity = function isInfinity() {\n return this.inf;\n};\n\nPoint.prototype.add = function add(p) {\n // O + P = P\n if (this.inf)\n return p;\n\n // P + O = P\n if (p.inf)\n return this;\n\n // P + P = 2P\n if (this.eq(p))\n return this.dbl();\n\n // P + (-P) = O\n if (this.neg().eq(p))\n return this.curve.point(null, null);\n\n // P + Q = O\n if (this.x.cmp(p.x) === 0)\n return this.curve.point(null, null);\n\n var c = this.y.redSub(p.y);\n if (c.cmpn(0) !== 0)\n c = c.redMul(this.x.redSub(p.x).redInvm());\n var nx = c.redSqr().redISub(this.x).redISub(p.x);\n var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n};\n\nPoint.prototype.dbl = function dbl() {\n if (this.inf)\n return this;\n\n // 2P = O\n var ys1 = this.y.redAdd(this.y);\n if (ys1.cmpn(0) === 0)\n return this.curve.point(null, null);\n\n var a = this.curve.a;\n\n var x2 = this.x.redSqr();\n var dyinv = ys1.redInvm();\n var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);\n\n var nx = c.redSqr().redISub(this.x.redAdd(this.x));\n var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n};\n\nPoint.prototype.getX = function getX() {\n return this.x.fromRed();\n};\n\nPoint.prototype.getY = function getY() {\n return this.y.fromRed();\n};\n\nPoint.prototype.mul = function mul(k) {\n k = new bn(k, 16);\n\n if (this.precomputed && this.precomputed.doubles)\n return this.curve._fixedNafMul(this, k);\n else if (this.curve.endo)\n return this.curve._endoWnafMulAdd([ this ], [ k ]);\n else\n return this.curve._wnafMul(this, k);\n};\n\nPoint.prototype.mulAdd = function mulAdd(k1, p2, k2) {\n var points = [ this, p2 ];\n var coeffs = [ k1, k2 ];\n if (this.curve.endo)\n return this.curve._endoWnafMulAdd(points, coeffs);\n else\n return this.curve._wnafMulAdd(1, points, coeffs, 2);\n};\n\nPoint.prototype.eq = function eq(p) {\n return this === p ||\n this.inf === p.inf &&\n (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);\n};\n\nPoint.prototype.neg = function neg(_precompute) {\n if (this.inf)\n return this;\n\n var res = this.curve.point(this.x, this.y.redNeg());\n if (_precompute && this.precomputed) {\n var pre = this.precomputed;\n function negate(p) {\n return p.neg();\n }\n res.precomputed = {\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(negate)\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(negate)\n }\n };\n }\n return res;\n};\n\nPoint.prototype.toJ = function toJ() {\n if (this.inf)\n return this.curve.jpoint(null, null, null);\n\n var res = this.curve.jpoint(this.x, this.y, this.curve.one);\n return res;\n};\n\nfunction JPoint(curve, x, y, z) {\n Base.BasePoint.call(this, curve, 'jacobian');\n if (x === null && y === null && z === null) {\n this.x = this.curve.one;\n this.y = this.curve.one;\n this.z = new bn(0);\n } else {\n this.x = new bn(x, 16);\n this.y = new bn(y, 16);\n this.z = new bn(z, 16);\n }\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.y.red)\n this.y = this.y.toRed(this.curve.red);\n if (!this.z.red)\n this.z = this.z.toRed(this.curve.red);\n\n this.zOne = this.z === this.curve.one;\n}\ninherits(JPoint, Base.BasePoint);\n\nJPoint.prototype.toP = function toP() {\n if (this.isInfinity())\n return this.curve.point(null, null);\n\n var zinv = this.z.redInvm();\n var zinv2 = zinv.redSqr();\n var ax = this.x.redMul(zinv2);\n var ay = this.y.redMul(zinv2).redMul(zinv);\n\n return this.curve.point(ax, ay);\n};\n\nJPoint.prototype.neg = function neg() {\n return this.curve.jpoint(this.x, this.y.redNeg(), this.z);\n};\n\nJPoint.prototype.add = function add(p) {\n // O + P = P\n if (this.isInfinity())\n return p;\n\n // P + O = P\n if (p.isInfinity())\n return this;\n\n // 12M + 4S + 7A\n var pz2 = p.z.redSqr();\n var z2 = this.z.redSqr();\n var u1 = this.x.redMul(pz2);\n var u2 = p.x.redMul(z2);\n var s1 = this.y.redMul(pz2.redMul(p.z));\n var s2 = p.y.redMul(z2.redMul(this.z));\n\n var h = u1.redSub(u2);\n var r = s1.redSub(s2);\n if (h.cmpn(0) === 0) {\n if (r.cmpn(0) !== 0)\n return this.curve.jpoint(null, null, null);\n else\n return this.dbl();\n }\n\n var h2 = h.redSqr();\n var h3 = h2.redMul(h);\n var v = u1.redMul(h2);\n\n var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);\n var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));\n var nz = this.z.redMul(p.z).redMul(h);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.mixedAdd = function mixedAdd(p) {\n // O + P = P\n if (this.isInfinity())\n return p.toJ();\n\n // P + O = P\n if (p.isInfinity())\n return this;\n\n // 8M + 3S + 7A\n var z2 = this.z.redSqr();\n var u1 = this.x;\n var u2 = p.x.redMul(z2);\n var s1 = this.y;\n var s2 = p.y.redMul(z2).redMul(this.z);\n\n var h = u1.redSub(u2);\n var r = s1.redSub(s2);\n if (h.cmpn(0) === 0) {\n if (r.cmpn(0) !== 0)\n return this.curve.jpoint(null, null, null);\n else\n return this.dbl();\n }\n\n var h2 = h.redSqr();\n var h3 = h2.redMul(h);\n var v = u1.redMul(h2);\n\n var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);\n var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));\n var nz = this.z.redMul(h);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.dblp = function dblp(pow) {\n if (pow === 0)\n return this;\n if (this.isInfinity())\n return this;\n if (!pow)\n return this.dbl();\n\n if (this.curve.zeroA || this.curve.threeA) {\n var r = this;\n for (var i = 0; i < pow; i++)\n r = r.dbl();\n return r;\n }\n\n // 1M + 2S + 1A + N * (4S + 5M + 8A)\n // N = 1 => 6M + 6S + 9A\n var a = this.curve.a;\n var tinv = this.curve.tinv;\n\n var jx = this.x;\n var jy = this.y;\n var jz = this.z;\n var jz4 = jz.redSqr().redSqr();\n\n // Reuse results\n var jyd = jy.redAdd(jy);\n for (var i = 0; i < pow; i++) {\n var jx2 = jx.redSqr();\n var jyd2 = jyd.redSqr();\n var jyd4 = jyd2.redSqr();\n var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));\n\n var t1 = jx.redMul(jyd2);\n var nx = c.redSqr().redISub(t1.redAdd(t1));\n var t2 = t1.redISub(nx);\n var dny = c.redMul(t2);\n dny = dny.redIAdd(dny).redISub(jyd4);\n var nz = jyd.redMul(jz);\n if (i + 1 < pow)\n jz4 = jz4.redMul(jyd4);\n\n jx = nx;\n jz = nz;\n jyd = dny;\n }\n\n return this.curve.jpoint(jx, jyd.redMul(tinv), jz);\n};\n\nJPoint.prototype.dbl = function dbl() {\n if (this.isInfinity())\n return this;\n\n if (this.curve.zeroA)\n return this._zeroDbl();\n else if (this.curve.threeA)\n return this._threeDbl();\n else\n return this._dbl();\n};\n\nJPoint.prototype._zeroDbl = function _zeroDbl() {\n // Z = 1\n if (this.zOne) {\n // http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-mdbl-2007-bl\n // 1M + 5S + 14A\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // S = 2 * ((X1 + YY)^2 - XX - YYYY)\n var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s);\n // M = 3 * XX + a; a = 0\n var m = xx.redAdd(xx).redIAdd(xx);\n // T = M ^ 2 - 2*S\n var t = m.redSqr().redISub(s).redISub(s);\n\n // 8 * YYYY\n var yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n\n // X3 = T\n var nx = t;\n // Y3 = M * (S - T) - 8 * YYYY\n var ny = m.redMul(s.redISub(t)).redISub(yyyy8);\n // Z3 = 2*Y1\n var nz = this.y.redAdd(this.y);\n } else {\n // http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l\n // 2M + 5S + 13A\n\n // A = X1^2\n var a = this.x.redSqr();\n // B = Y1^2\n var b = this.y.redSqr();\n // C = B^2\n var c = b.redSqr();\n // D = 2 * ((X1 + B)^2 - A - C)\n var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);\n d = d.redIAdd(d);\n // E = 3 * A\n var e = a.redAdd(a).redIAdd(a);\n // F = E^2\n var f = e.redSqr();\n\n // 8 * C\n var c8 = c.redIAdd(c);\n c8 = c8.redIAdd(c8);\n c8 = c8.redIAdd(c8);\n\n // X3 = F - 2 * D\n var nx = f.redISub(d).redISub(d);\n // Y3 = E * (D - X3) - 8 * C\n var ny = e.redMul(d.redISub(nx)).redISub(c8);\n // Z3 = 2 * Y1 * Z1\n var nz = this.y.redMul(this.z);\n nz = nz.redIAdd(nz);\n }\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype._threeDbl = function _threeDbl() {\n // Z = 1\n if (this.zOne) {\n // http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-mdbl-2007-bl\n // 1M + 5S + 15A\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // S = 2 * ((X1 + YY)^2 - XX - YYYY)\n var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s);\n // M = 3 * XX + a\n var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a);\n // T = M^2 - 2 * S\n var t = m.redSqr().redISub(s).redISub(s);\n // X3 = T\n var nx = t;\n // Y3 = M * (S - T) - 8 * YYYY\n var yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n var ny = m.redMul(s.redISub(t)).redISub(yyyy8);\n // Z3 = 2 * Y1\n var nz = this.y.redAdd(this.y);\n } else {\n // http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b\n // 3M + 5S\n\n // delta = Z1^2\n var delta = this.z.redSqr();\n // gamma = Y1^2\n var gamma = this.y.redSqr();\n // beta = X1 * gamma\n var beta = this.x.redMul(gamma);\n // alpha = 3 * (X1 - delta) * (X1 + delta)\n var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));\n alpha = alpha.redAdd(alpha).redIAdd(alpha);\n // X3 = alpha^2 - 8 * beta\n var beta4 = beta.redIAdd(beta);\n beta4 = beta4.redIAdd(beta4);\n var beta8 = beta4.redAdd(beta4);\n var nx = alpha.redSqr().redISub(beta8);\n // Z3 = (Y1 + Z1)^2 - gamma - delta\n var nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);\n // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2\n var ggamma8 = gamma.redSqr();\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ggamma8 = ggamma8.redIAdd(ggamma8);\n var ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);\n }\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype._dbl = function _dbl() {\n var a = this.curve.a;\n var tinv = this.curve.tinv;\n\n // 4M + 6S + 10A\n var jx = this.x;\n var jy = this.y;\n var jz = this.z;\n var jz4 = jz.redSqr().redSqr();\n\n var jx2 = jx.redSqr();\n var jy2 = jy.redSqr();\n\n var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));\n\n var jxd4 = jx.redAdd(jx);\n jxd4 = jxd4.redIAdd(jxd4);\n var t1 = jxd4.redMul(jy2);\n var nx = c.redSqr().redISub(t1.redAdd(t1));\n var t2 = t1.redISub(nx);\n\n var jyd8 = jy2.redSqr();\n jyd8 = jyd8.redIAdd(jyd8);\n jyd8 = jyd8.redIAdd(jyd8);\n jyd8 = jyd8.redIAdd(jyd8);\n var ny = c.redMul(t2).redISub(jyd8);\n var nz = jy.redAdd(jy).redMul(jz);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.trpl = function trpl() {\n if (!this.curve.zeroA)\n return this.dbl().add(this);\n\n // http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl\n // 5M + 10S + ...\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // ZZ = Z1^2\n var zz = this.z.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // M = 3 * XX + a * ZZ2; a = 0\n var m = xx.redAdd(xx).redIAdd(xx);\n // MM = M^2\n var mm = m.redSqr();\n // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM\n var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n e = e.redIAdd(e);\n e = e.redAdd(e).redIAdd(e);\n e = e.redISub(mm);\n // EE = E^2\n var ee = e.redSqr();\n // T = 16*YYYY\n var t = yyyy.redIAdd(yyyy);\n t = t.redIAdd(t);\n t = t.redIAdd(t);\n t = t.redIAdd(t);\n // U = (M + E)^2 - MM - EE - T\n var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t);\n // X3 = 4 * (X1 * EE - 4 * YY * U)\n var yyu4 = yy.redMul(u);\n yyu4 = yyu4.redIAdd(yyu4);\n yyu4 = yyu4.redIAdd(yyu4);\n var nx = this.x.redMul(ee).redISub(yyu4);\n nx = nx.redIAdd(nx);\n nx = nx.redIAdd(nx);\n // Y3 = 8 * Y1 * (U * (T - U) - E * EE)\n var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));\n ny = ny.redIAdd(ny);\n ny = ny.redIAdd(ny);\n ny = ny.redIAdd(ny);\n // Z3 = (Z1 + E)^2 - ZZ - EE\n var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.mul = function mul(k, kbase) {\n k = new bn(k, kbase);\n\n return this.curve._wnafMul(this, k);\n};\n\nJPoint.prototype.eq = function eq(p) {\n if (p.type === 'affine')\n return this.eq(p.toJ());\n\n if (this === p)\n return true;\n\n // x1 * z2^2 == x2 * z1^2\n var z2 = this.z.redSqr();\n var pz2 = p.z.redSqr();\n if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0)\n return false;\n\n // y1 * z2^3 == y2 * z1^3\n var z3 = z2.redMul(this.z);\n var pz3 = pz2.redMul(p.z);\n return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;\n};\n\nJPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nJPoint.prototype.isInfinity = function isInfinity() {\n // XXX This code assumes that zero is always zero in red\n return this.z.cmpn(0) === 0;\n};\n\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\",\"../curve\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/index.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curves.js\":[function(require,module,exports){\nvar curves = exports;\n\nvar hash = require('hash.js');\nvar bn = require('bn.js');\nvar elliptic = require('../elliptic');\n\nvar assert = elliptic.utils.assert;\n\nfunction PresetCurve(options) {\n if (options.type === 'short')\n this.curve = new elliptic.curve.short(options);\n else if (options.type === 'edwards')\n this.curve = new elliptic.curve.edwards(options);\n else\n this.curve = new elliptic.curve.mont(options);\n this.g = this.curve.g;\n this.n = this.curve.n;\n this.hash = options.hash;\n\n assert(this.g.validate(), 'Invalid curve');\n assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');\n}\ncurves.PresetCurve = PresetCurve;\n\nfunction defineCurve(name, options) {\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n get: function() {\n var curve = new PresetCurve(options);\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n value: curve\n });\n return curve;\n }\n });\n}\n\ndefineCurve('p192', {\n type: 'short',\n prime: 'p192',\n p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',\n b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',\n n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',\n hash: hash.sha256,\n gRed: false,\n g: [\n '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012',\n '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811'\n ],\n});\n\ndefineCurve('p224', {\n type: 'short',\n prime: 'p224',\n p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',\n b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',\n n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',\n hash: hash.sha256,\n gRed: false,\n g: [\n 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21',\n 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34'\n ],\n});\n\ndefineCurve('p256', {\n type: 'short',\n prime: null,\n p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',\n a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',\n b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',\n n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',\n hash: hash.sha256,\n gRed: false,\n g: [\n '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296',\n '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5'\n ],\n});\n\ndefineCurve('curve25519', {\n type: 'mont',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '76d06',\n b: '0',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: hash.sha256,\n gRed: false,\n g: [\n '9'\n ]\n});\n\ndefineCurve('ed25519', {\n type: 'edwards',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '-1',\n c: '1',\n // -121665 * (121666^(-1)) (mod P)\n d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: hash.sha256,\n gRed: false,\n g: [\n '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a',\n\n // 4/5\n '6666666666666666666666666666666666666666666666666666666666666658'\n ]\n});\n\ndefineCurve('secp256k1', {\n type: 'short',\n prime: 'k256',\n p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',\n a: '0',\n b: '7',\n n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',\n h: '1',\n hash: hash.sha256,\n\n // Precomputed endomorphism\n beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',\n lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',\n basis: [\n {\n a: '3086d221a7d46bcde86c90e49284eb15',\n b: '-e4437ed6010e88286f547fa90abfe4c3'\n },\n {\n a: '114ca50f7a8e2f3f657c1108d9d44cfd8',\n b: '3086d221a7d46bcde86c90e49284eb15'\n }\n ],\n\n gRed: false,\n g: [\n '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',\n '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',\n {\n 'doubles': {\n 'step': 4,\n 'points': [\n [\n 'e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a',\n 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821'\n ],\n [\n '8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508',\n '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf'\n ],\n [\n '175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739',\n 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695'\n ],\n [\n '363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640',\n '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9'\n ],\n [\n '8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c',\n '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36'\n ],\n [\n '723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda',\n '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f'\n ],\n [\n 'eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa',\n '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999'\n ],\n [\n '100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0',\n 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09'\n ],\n [\n 'e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d',\n '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d'\n ],\n [\n 'feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d',\n 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088'\n ],\n [\n 'da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1',\n '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d'\n ],\n [\n '53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0',\n '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8'\n ],\n [\n '8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047',\n '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a'\n ],\n [\n '385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862',\n '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453'\n ],\n [\n '6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7',\n '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160'\n ],\n [\n '3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd',\n '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0'\n ],\n [\n '85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83',\n '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6'\n ],\n [\n '948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a',\n '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589'\n ],\n [\n '6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8',\n 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17'\n ],\n [\n 'e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d',\n '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda'\n ],\n [\n 'e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725',\n '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd'\n ],\n [\n '213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754',\n '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2'\n ],\n [\n '4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c',\n '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6'\n ],\n [\n 'fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6',\n '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f'\n ],\n [\n '76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39',\n 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01'\n ],\n [\n 'c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891',\n '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3'\n ],\n [\n 'd895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b',\n 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f'\n ],\n [\n 'b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03',\n '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7'\n ],\n [\n 'e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d',\n 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78'\n ],\n [\n 'a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070',\n '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1'\n ],\n [\n '90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4',\n 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150'\n ],\n [\n '8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da',\n '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82'\n ],\n [\n 'e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11',\n '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc'\n ],\n [\n '8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e',\n 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b'\n ],\n [\n 'e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41',\n '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51'\n ],\n [\n 'b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef',\n '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45'\n ],\n [\n 'd68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8',\n 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120'\n ],\n [\n '324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d',\n '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84'\n ],\n [\n '4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96',\n '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d'\n ],\n [\n '9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd',\n 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d'\n ],\n [\n '6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5',\n '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8'\n ],\n [\n 'a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266',\n '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8'\n ],\n [\n '7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71',\n '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac'\n ],\n [\n '928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac',\n 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f'\n ],\n [\n '85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751',\n '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962'\n ],\n [\n 'ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e',\n '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907'\n ],\n [\n '827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241',\n 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec'\n ],\n [\n 'eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3',\n 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d'\n ],\n [\n 'e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f',\n '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414'\n ],\n [\n '1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19',\n 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd'\n ],\n [\n '146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be',\n 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0'\n ],\n [\n 'fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9',\n '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811'\n ],\n [\n 'da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2',\n '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1'\n ],\n [\n 'a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13',\n '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c'\n ],\n [\n '174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c',\n 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73'\n ],\n [\n '959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba',\n '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd'\n ],\n [\n 'd2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151',\n 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405'\n ],\n [\n '64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073',\n 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589'\n ],\n [\n '8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458',\n '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e'\n ],\n [\n '13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b',\n '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27'\n ],\n [\n 'bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366',\n 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1'\n ],\n [\n '8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa',\n '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482'\n ],\n [\n '8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0',\n '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945'\n ],\n [\n 'dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787',\n '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573'\n ],\n [\n 'f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e',\n 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82'\n ]\n ]\n },\n 'naf': {\n 'wnd': 7,\n 'points': [\n [\n 'f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9',\n '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672'\n ],\n [\n '2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4',\n 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6'\n ],\n [\n '5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc',\n '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da'\n ],\n [\n 'acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe',\n 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37'\n ],\n [\n '774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb',\n 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b'\n ],\n [\n 'f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8',\n 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81'\n ],\n [\n 'd7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e',\n '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58'\n ],\n [\n 'defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34',\n '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77'\n ],\n [\n '2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c',\n '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a'\n ],\n [\n '352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5',\n '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c'\n ],\n [\n '2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f',\n '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67'\n ],\n [\n '9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714',\n '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402'\n ],\n [\n 'daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729',\n 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55'\n ],\n [\n 'c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db',\n '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482'\n ],\n [\n '6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4',\n 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82'\n ],\n [\n '1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5',\n 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396'\n ],\n [\n '605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479',\n '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49'\n ],\n [\n '62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d',\n '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf'\n ],\n [\n '80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f',\n '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a'\n ],\n [\n '7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb',\n 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7'\n ],\n [\n 'd528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9',\n 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933'\n ],\n [\n '49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963',\n '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a'\n ],\n [\n '77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74',\n '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6'\n ],\n [\n 'f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530',\n 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37'\n ],\n [\n '463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b',\n '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e'\n ],\n [\n 'f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247',\n 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6'\n ],\n [\n 'caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1',\n 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476'\n ],\n [\n '2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120',\n '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40'\n ],\n [\n '7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435',\n '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61'\n ],\n [\n '754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18',\n '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683'\n ],\n [\n 'e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8',\n '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5'\n ],\n [\n '186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb',\n '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b'\n ],\n [\n 'df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f',\n '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417'\n ],\n [\n '5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143',\n 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868'\n ],\n [\n '290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba',\n 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a'\n ],\n [\n 'af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45',\n 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6'\n ],\n [\n '766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a',\n '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996'\n ],\n [\n '59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e',\n 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e'\n ],\n [\n 'f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8',\n 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d'\n ],\n [\n '7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c',\n '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2'\n ],\n [\n '948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519',\n 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e'\n ],\n [\n '7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab',\n '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437'\n ],\n [\n '3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca',\n 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311'\n ],\n [\n 'd3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf',\n '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4'\n ],\n [\n '1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610',\n '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575'\n ],\n [\n '733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4',\n 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d'\n ],\n [\n '15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c',\n 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d'\n ],\n [\n 'a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940',\n 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629'\n ],\n [\n 'e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980',\n 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06'\n ],\n [\n '311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3',\n '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374'\n ],\n [\n '34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf',\n '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee'\n ],\n [\n 'f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63',\n '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1'\n ],\n [\n 'd7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448',\n 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b'\n ],\n [\n '32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf',\n '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661'\n ],\n [\n '7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5',\n '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6'\n ],\n [\n 'ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6',\n '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e'\n ],\n [\n '16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5',\n '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d'\n ],\n [\n 'eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99',\n 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc'\n ],\n [\n '78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51',\n 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4'\n ],\n [\n '494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5',\n '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c'\n ],\n [\n 'a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5',\n '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b'\n ],\n [\n 'c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997',\n '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913'\n ],\n [\n '841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881',\n '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154'\n ],\n [\n '5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5',\n '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865'\n ],\n [\n '36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66',\n 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc'\n ],\n [\n '336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726',\n 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224'\n ],\n [\n '8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede',\n '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e'\n ],\n [\n '1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94',\n '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6'\n ],\n [\n '85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31',\n '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511'\n ],\n [\n '29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51',\n 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b'\n ],\n [\n 'a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252',\n 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2'\n ],\n [\n '4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5',\n 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c'\n ],\n [\n 'd24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b',\n '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3'\n ],\n [\n 'ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4',\n '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d'\n ],\n [\n 'af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f',\n '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700'\n ],\n [\n 'e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889',\n '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4'\n ],\n [\n '591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246',\n 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196'\n ],\n [\n '11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984',\n '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4'\n ],\n [\n '3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a',\n 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257'\n ],\n [\n 'cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030',\n 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13'\n ],\n [\n 'c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197',\n '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096'\n ],\n [\n 'c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593',\n 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38'\n ],\n [\n 'a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef',\n '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f'\n ],\n [\n '347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38',\n '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448'\n ],\n [\n 'da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a',\n '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a'\n ],\n [\n 'c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111',\n '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4'\n ],\n [\n '4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502',\n '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437'\n ],\n [\n '3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea',\n 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7'\n ],\n [\n 'cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26',\n '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d'\n ],\n [\n 'b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986',\n '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a'\n ],\n [\n 'd4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e',\n '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54'\n ],\n [\n '48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4',\n '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77'\n ],\n [\n 'dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda',\n 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517'\n ],\n [\n '6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859',\n 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10'\n ],\n [\n 'e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f',\n 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125'\n ],\n [\n 'eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c',\n '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e'\n ],\n [\n '13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942',\n 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1'\n ],\n [\n 'ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a',\n '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2'\n ],\n [\n 'b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80',\n '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423'\n ],\n [\n 'ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d',\n '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8'\n ],\n [\n '8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1',\n 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758'\n ],\n [\n '52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63',\n 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375'\n ],\n [\n 'e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352',\n '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d'\n ],\n [\n '7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193',\n 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec'\n ],\n [\n '5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00',\n '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0'\n ],\n [\n '32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58',\n 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c'\n ],\n [\n 'e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7',\n 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4'\n ],\n [\n '8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8',\n 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f'\n ],\n [\n '4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e',\n '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649'\n ],\n [\n '3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d',\n 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826'\n ],\n [\n '674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b',\n '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5'\n ],\n [\n 'd32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f',\n 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87'\n ],\n [\n '30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6',\n '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b'\n ],\n [\n 'be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297',\n '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc'\n ],\n [\n '93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a',\n '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c'\n ],\n [\n 'b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c',\n 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f'\n ],\n [\n 'd5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52',\n '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a'\n ],\n [\n 'd3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb',\n 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46'\n ],\n [\n '463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065',\n 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f'\n ],\n [\n '7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917',\n '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03'\n ],\n [\n '74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9',\n 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08'\n ],\n [\n '30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3',\n '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8'\n ],\n [\n '9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57',\n '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373'\n ],\n [\n '176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66',\n 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3'\n ],\n [\n '75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8',\n '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8'\n ],\n [\n '809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721',\n '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1'\n ],\n [\n '1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180',\n '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9'\n ]\n ]\n }\n }\n ]\n});\n\n},{\"../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\",\"hash.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/index.js\":[function(require,module,exports){\nvar bn = require('bn.js');\nvar elliptic = require('../../elliptic');\nvar utils = elliptic.utils;\nvar assert = utils.assert;\n\nvar KeyPair = require('./key');\nvar Signature = require('./signature');\n\nfunction EC(options) {\n if (!(this instanceof EC))\n return new EC(options);\n\n // Shortcut `elliptic.ec(curve-name)`\n if (typeof options === 'string') {\n assert(elliptic.curves.hasOwnProperty(options), 'Unknown curve ' + options);\n\n options = elliptic.curves[options];\n }\n\n // Shortcut for `elliptic.ec(elliptic.curves.curveName)`\n if (options instanceof elliptic.curves.PresetCurve)\n options = { curve: options };\n\n this.curve = options.curve.curve;\n this.n = this.curve.n;\n this.nh = this.n.shrn(1);\n this.g = this.curve.g;\n\n // Point on curve\n this.g = options.curve.g;\n this.g.precompute(options.curve.n.bitLength() + 1);\n\n // Hash for function for DRBG\n this.hash = options.hash || options.curve.hash;\n}\nmodule.exports = EC;\n\nEC.prototype.keyPair = function keyPair(priv, pub) {\n return new KeyPair(this, priv, pub);\n};\n\nEC.prototype.genKeyPair = function genKeyPair(options) {\n if (!options)\n options = {};\n\n // Instantiate Hmac_DRBG\n var drbg = new elliptic.hmacDRBG({\n hash: this.hash,\n pers: options.pers,\n entropy: options.entropy || elliptic.rand(this.hash.hmacStrength),\n nonce: this.n.toArray()\n });\n\n var bytes = this.n.byteLength();\n var ns2 = this.n.sub(new bn(2));\n do {\n var priv = new bn(drbg.generate(bytes));\n if (priv.cmp(ns2) > 0)\n continue;\n\n priv.iaddn(1);\n return this.keyPair(priv);\n } while (true);\n};\n\nEC.prototype._truncateToN = function truncateToN(msg, truncOnly) {\n var delta = msg.byteLength() * 8 - this.n.bitLength();\n if (delta > 0)\n msg = msg.shrn(delta);\n if (!truncOnly && msg.cmp(this.n) >= 0)\n return msg.sub(this.n);\n else\n return msg;\n};\n\nEC.prototype.sign = function sign(msg, key, options) {\n key = this.keyPair(key, 'hex');\n msg = this._truncateToN(new bn(msg, 16));\n if (!options)\n options = {};\n\n // Zero-extend key to provide enough entropy\n var bytes = this.n.byteLength();\n var bkey = key.getPrivate().toArray();\n for (var i = bkey.length; i < 21; i++)\n bkey.unshift(0);\n\n // Zero-extend nonce to have the same byte size as N\n var nonce = msg.toArray();\n for (var i = nonce.length; i < bytes; i++)\n nonce.unshift(0);\n\n // Instantiate Hmac_DRBG\n var drbg = new elliptic.hmacDRBG({\n hash: this.hash,\n entropy: bkey,\n nonce: nonce\n });\n\n // Number of bytes to generate\n var ns1 = this.n.sub(new bn(1));\n do {\n var k = new bn(drbg.generate(this.n.byteLength()));\n k = this._truncateToN(k, true);\n if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0)\n continue;\n\n var kp = this.g.mul(k);\n if (kp.isInfinity())\n continue;\n\n var r = kp.getX().mod(this.n);\n if (r.cmpn(0) === 0)\n continue;\n\n var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg)).mod(this.n);\n if (s.cmpn(0) === 0)\n continue;\n\n // Use complement of `s`, if it is > `n / 2`\n if (options.canonical && s.cmp(this.nh) > 0)\n s = this.n.sub(s);\n\n return new Signature(r, s);\n } while (true);\n};\n\nEC.prototype.verify = function verify(msg, signature, key) {\n msg = this._truncateToN(new bn(msg, 16));\n key = this.keyPair(key, 'hex');\n signature = new Signature(signature, 'hex');\n\n // Perform primitive values validation\n var r = signature.r;\n var s = signature.s;\n if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0)\n return false;\n if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0)\n return false;\n\n // Validate signature\n var sinv = s.invm(this.n);\n var u1 = sinv.mul(msg).mod(this.n);\n var u2 = sinv.mul(r).mod(this.n);\n\n var p = this.g.mulAdd(u1, key.getPublic(), u2);\n if (p.isInfinity())\n return false;\n\n return p.getX().mod(this.n).cmp(r) === 0;\n};\n\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\",\"./key\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/key.js\",\"./signature\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/signature.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/key.js\":[function(require,module,exports){\nvar bn = require('bn.js');\n\nvar elliptic = require('../../elliptic');\nvar utils = elliptic.utils;\nvar assert = utils.assert;\n\nfunction KeyPair(ec, priv, pub) {\n if (priv instanceof KeyPair)\n return priv;\n if (pub instanceof KeyPair)\n return pub;\n\n if (!priv) {\n priv = pub;\n pub = null;\n }\n if (priv !== null && typeof priv === 'object') {\n if (priv.x) {\n // KeyPair(public)\n pub = priv;\n priv = null;\n } else if (priv.priv || priv.pub) {\n // KeyPair({ priv: ..., pub: ... })\n pub = priv.pub;\n priv = priv.priv;\n }\n }\n\n this.ec = ec;\n this.priv = null;\n this.pub = null;\n\n // KeyPair(public, 'hex')\n if (this._importPublicHex(priv, pub))\n return;\n\n if (pub === 'hex')\n pub = null;\n\n // KeyPair(priv, pub)\n if (priv)\n this._importPrivate(priv);\n if (pub)\n this._importPublic(pub);\n}\nmodule.exports = KeyPair;\n\nKeyPair.prototype.validate = function validate() {\n var pub = this.getPublic();\n\n if (pub.isInfinity())\n return { result: false, reason: 'Invalid public key' };\n if (!pub.validate())\n return { result: false, reason: 'Public key is not a point' };\n if (!pub.mul(this.ec.curve.n).isInfinity())\n return { result: false, reason: 'Public key * N != O' };\n\n return { result: true, reason: null };\n};\n\nKeyPair.prototype.getPublic = function getPublic(compact, enc) {\n if (!this.pub)\n this.pub = this.ec.g.mul(this.priv);\n\n // compact is optional argument\n if (typeof compact === 'string') {\n enc = compact;\n compact = null;\n }\n\n if (!enc)\n return this.pub;\n\n var len = this.ec.curve.p.byteLength();\n var x = this.pub.getX().toArray();\n\n for (var i = x.length; i < len; i++)\n x.unshift(0);\n\n if (compact) {\n var res = [ this.pub.getY().isEven() ? 0x02 : 0x03 ].concat(x);\n } else {\n var y = this.pub.getY().toArray();\n for (var i = y.length; i < len; i++)\n y.unshift(0);\n var res = [ 0x04 ].concat(x, y);\n }\n return utils.encode(res, enc);\n};\n\nKeyPair.prototype.getPrivate = function getPrivate(enc) {\n if (enc === 'hex')\n return this.priv.toString(16, 2);\n else\n return this.priv;\n};\n\nKeyPair.prototype._importPrivate = function _importPrivate(key) {\n this.priv = new bn(key, 16);\n\n // Ensure that the priv won't be bigger than n, otherwise we may fail\n // in fixed multiplication method\n this.priv = this.priv.mod(this.ec.curve.n);\n};\n\nKeyPair.prototype._importPublic = function _importPublic(key) {\n this.pub = this.ec.curve.point(key.x, key.y);\n};\n\nKeyPair.prototype._importPublicHex = function _importPublic(key, enc) {\n key = utils.toArray(key, enc);\n var len = this.ec.curve.p.byteLength();\n if (key[0] === 0x04 && key.length - 1 === 2 * len) {\n this.pub = this.ec.curve.point(\n key.slice(1, 1 + len),\n key.slice(1 + len, 1 + 2 * len));\n } else if ((key[0] === 0x02 || key[0] === 0x03) && key.length - 1 === len) {\n this.pub = this.ec.curve.pointFromX(key[0] === 0x03,\n key.slice(1, 1 +len));\n } else {\n return false;\n }\n\n return true;\n};\n\n// ECDH\nKeyPair.prototype.derive = function derive(pub) {\n return pub.mul(this.priv).getX();\n};\n\n// ECDSA\nKeyPair.prototype.sign = function sign(msg) {\n return this.ec.sign(msg, this);\n};\n\nKeyPair.prototype.verify = function verify(msg, signature) {\n return this.ec.verify(msg, signature, this);\n};\n\nKeyPair.prototype.inspect = function inspect() {\n return '';\n};\n\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/signature.js\":[function(require,module,exports){\nvar bn = require('bn.js');\n\nvar elliptic = require('../../elliptic');\nvar utils = elliptic.utils;\nvar assert = utils.assert;\n\nfunction Signature(r, s) {\n if (r instanceof Signature)\n return r;\n\n if (this._importDER(r, s))\n return;\n\n assert(r && s, 'Signature without r or s');\n this.r = new bn(r, 16);\n this.s = new bn(s, 16);\n}\nmodule.exports = Signature;\n\nSignature.prototype._importDER = function _importDER(data, enc) {\n data = utils.toArray(data, enc);\n if (data.length < 6 || data[0] !== 0x30 || data[2] !== 0x02)\n return false;\n var total = data[1];\n if (1 + total > data.length)\n return false;\n var rlen = data[3];\n // Short length notation\n if (rlen >= 0x80)\n return false;\n if (4 + rlen + 2 >= data.length)\n return false;\n if (data[4 + rlen] !== 0x02)\n return false;\n var slen = data[5 + rlen];\n // Short length notation\n if (slen >= 0x80)\n return false;\n if (4 + rlen + 2 + slen > data.length)\n return false;\n\n this.r = new bn(data.slice(4, 4 + rlen));\n this.s = new bn(data.slice(4 + rlen + 2, 4 + rlen + 2 + slen));\n\n return true;\n};\n\nSignature.prototype.toDER = function toDER(enc) {\n var r = this.r.toArray();\n var s = this.s.toArray();\n\n // Pad values\n if (r[0] & 0x80)\n r = [ 0 ].concat(r);\n // Pad values\n if (s[0] & 0x80)\n s = [ 0 ].concat(s);\n\n var total = r.length + s.length + 4;\n var res = [ 0x30, total, 0x02, r.length ];\n res = res.concat(r, [ 0x02, s.length ], s);\n return utils.encode(res, enc);\n};\n\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/hmac-drbg.js\":[function(require,module,exports){\nvar hash = require('hash.js');\nvar elliptic = require('../elliptic');\nvar utils = elliptic.utils;\nvar assert = utils.assert;\n\nfunction HmacDRBG(options) {\n if (!(this instanceof HmacDRBG))\n return new HmacDRBG(options);\n this.hash = options.hash;\n this.predResist = !!options.predResist;\n\n this.outLen = this.hash.outSize;\n this.minEntropy = options.minEntropy || this.hash.hmacStrength;\n\n this.reseed = null;\n this.reseedInterval = null;\n this.K = null;\n this.V = null;\n\n var entropy = utils.toArray(options.entropy, options.entropyEnc);\n var nonce = utils.toArray(options.nonce, options.nonceEnc);\n var pers = utils.toArray(options.pers, options.persEnc);\n assert(entropy.length >= (this.minEntropy / 8),\n 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');\n this._init(entropy, nonce, pers);\n}\nmodule.exports = HmacDRBG;\n\nHmacDRBG.prototype._init = function init(entropy, nonce, pers) {\n var seed = entropy.concat(nonce).concat(pers);\n\n this.K = new Array(this.outLen / 8);\n this.V = new Array(this.outLen / 8);\n for (var i = 0; i < this.V.length; i++) {\n this.K[i] = 0x00;\n this.V[i] = 0x01;\n }\n\n this._update(seed);\n this.reseed = 1;\n this.reseedInterval = 0x1000000000000; // 2^48\n};\n\nHmacDRBG.prototype._hmac = function hmac() {\n return new hash.hmac(this.hash, this.K);\n};\n\nHmacDRBG.prototype._update = function update(seed) {\n var kmac = this._hmac()\n .update(this.V)\n .update([ 0x00 ]);\n if (seed)\n kmac = kmac.update(seed);\n this.K = kmac.digest();\n this.V = this._hmac().update(this.V).digest();\n if (!seed)\n return;\n\n this.K = this._hmac()\n .update(this.V)\n .update([ 0x01 ])\n .update(seed)\n .digest();\n this.V = this._hmac().update(this.V).digest();\n};\n\nHmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) {\n // Optional entropy enc\n if (typeof entropyEnc !== 'string') {\n addEnc = add;\n add = entropyEnc;\n entropyEnc = null;\n }\n\n entropy = utils.toBuffer(entropy, entropyEnc);\n add = utils.toBuffer(add, addEnc);\n\n assert(entropy.length >= (this.minEntropy / 8),\n 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');\n\n this._update(entropy.concat(add || []));\n this.reseed = 1;\n};\n\nHmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) {\n if (this.reseed > this.reseedInterval)\n throw new Error('Reseed is required');\n\n // Optional encoding\n if (typeof enc !== 'string') {\n addEnc = add;\n add = enc;\n enc = null;\n }\n\n // Optional additional data\n if (add) {\n add = utils.toArray(add, addEnc);\n this._update(add);\n }\n\n var temp = [];\n while (temp.length < len) {\n this.V = this._hmac().update(this.V).digest();\n temp = temp.concat(this.V);\n }\n\n var res = temp.slice(0, len);\n this._update(add);\n this.reseed++;\n return utils.encode(res, enc);\n};\n\n},{\"../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\",\"hash.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/utils.js\":[function(require,module,exports){\nvar bn = require('bn.js');\n\nvar utils = exports;\n\nutils.assert = function assert(val, msg) {\n if (!val)\n throw new Error(msg || 'Assertion failed');\n};\n\nfunction toArray(msg, enc) {\n if (Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg === 'string') {\n if (!enc) {\n for (var i = 0; i < msg.length; i++) {\n var c = msg.charCodeAt(i);\n var hi = c >> 8;\n var lo = c & 0xff;\n if (hi)\n res.push(hi, lo);\n else\n res.push(lo);\n }\n } else if (enc === 'hex') {\n msg = msg.replace(/[^a-z0-9]+/ig, '');\n if (msg.length % 2 !== 0)\n msg = '0' + msg;\n for (var i = 0; i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n }\n } else {\n for (var i = 0; i < msg.length; i++)\n res[i] = msg[i] | 0;\n }\n return res;\n}\nutils.toArray = toArray;\n\nfunction toHex(msg) {\n var res = '';\n for (var i = 0; i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n}\nutils.toHex = toHex;\n\nutils.encode = function encode(arr, enc) {\n if (enc === 'hex')\n return toHex(arr);\n else\n return arr;\n};\n\nfunction zero2(word) {\n if (word.length === 1)\n return '0' + word;\n else\n return word;\n}\nutils.zero2 = zero2;\n\n// Represent num in a w-NAF form\nfunction getNAF(num, w) {\n var naf = [];\n var ws = 1 << (w + 1);\n var k = num.clone();\n while (k.cmpn(1) >= 0) {\n var z;\n if (k.isOdd()) {\n var mod = k.andln(ws - 1);\n if (mod > (ws >> 1) - 1)\n z = (ws >> 1) - mod;\n else\n z = mod;\n k.isubn(z);\n } else {\n z = 0;\n }\n naf.push(z);\n\n // Optimization, shift by word if possible\n var shift = (k.cmpn(0) !== 0 && k.andln(ws - 1) === 0) ? (w + 1) : 1;\n for (var i = 1; i < shift; i++)\n naf.push(0);\n k.ishrn(shift);\n }\n\n return naf;\n}\nutils.getNAF = getNAF;\n\n// Represent k1, k2 in a Joint Sparse Form\nfunction getJSF(k1, k2) {\n var jsf = [\n [],\n []\n ];\n\n k1 = k1.clone();\n k2 = k2.clone();\n var d1 = 0;\n var d2 = 0;\n while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) {\n\n // First phase\n var m14 = (k1.andln(3) + d1) & 3;\n var m24 = (k2.andln(3) + d2) & 3;\n if (m14 === 3)\n m14 = -1;\n if (m24 === 3)\n m24 = -1;\n var u1;\n if ((m14 & 1) === 0) {\n u1 = 0;\n } else {\n var m8 = (k1.andln(7) + d1) & 7;\n if ((m8 === 3 || m8 === 5) && m24 === 2)\n u1 = -m14;\n else\n u1 = m14;\n }\n jsf[0].push(u1);\n\n var u2;\n if ((m24 & 1) === 0) {\n u2 = 0;\n } else {\n var m8 = (k2.andln(7) + d2) & 7;\n if ((m8 === 3 || m8 === 5) && m14 === 2)\n u2 = -m24;\n else\n u2 = m24;\n }\n jsf[1].push(u2);\n\n // Second phase\n if (2 * d1 === u1 + 1)\n d1 = 1 - d1;\n if (2 * d2 === u2 + 1)\n d2 = 1 - d2;\n k1.ishrn(1);\n k2.ishrn(1);\n }\n\n return jsf;\n}\nutils.getJSF = getJSF;\n\n},{\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/index.js\":[function(require,module,exports){\nvar r;\n\nmodule.exports = function rand(len) {\n if (!r)\n r = new Rand(null);\n\n return r.generate(len);\n};\n\nfunction Rand(rand) {\n this.rand = rand;\n}\nmodule.exports.Rand = Rand;\n\nRand.prototype.generate = function generate(len) {\n return this._rand(len);\n};\n\nif (typeof window === 'object') {\n if (window.crypto && window.crypto.getRandomValues) {\n // Modern browsers\n Rand.prototype._rand = function _rand(n) {\n var arr = new Uint8Array(n);\n window.crypto.getRandomValues(arr);\n return arr;\n };\n } else if (window.msCrypto && window.msCrypto.getRandomValues) {\n // IE\n Rand.prototype._rand = function _rand(n) {\n var arr = new Uint8Array(n);\n window.msCrypto.getRandomValues(arr);\n return arr;\n };\n } else {\n // Old junk\n Rand.prototype._rand = function() {\n throw new Error('Not implemented yet');\n };\n }\n} else {\n // Node.js or Web worker\n try {\n var crypto = require('cry' + 'pto');\n\n Rand.prototype._rand = function _rand(n) {\n return crypto.randomBytes(n);\n };\n } catch (e) {\n // Emulate crypto API using randy\n Rand.prototype._rand = function _rand(n) {\n var res = new Uint8Array(n);\n for (var i = 0; i < res.length; i++)\n res[i] = this.rand.getByte();\n return res;\n };\n }\n}\n\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash.js\":[function(require,module,exports){\nvar hash = exports;\n\nhash.utils = require('./hash/utils');\nhash.common = require('./hash/common');\nhash.sha = require('./hash/sha');\nhash.ripemd = require('./hash/ripemd');\nhash.hmac = require('./hash/hmac');\n\n// Proxy hash functions to the main object\nhash.sha1 = hash.sha.sha1;\nhash.sha256 = hash.sha.sha256;\nhash.sha224 = hash.sha.sha224;\nhash.sha384 = hash.sha.sha384;\nhash.sha512 = hash.sha.sha512;\nhash.ripemd160 = hash.ripemd.ripemd160;\n\n},{\"./hash/common\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/common.js\",\"./hash/hmac\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/hmac.js\",\"./hash/ripemd\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/ripemd.js\",\"./hash/sha\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/sha.js\",\"./hash/utils\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/utils.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/common.js\":[function(require,module,exports){\nvar hash = require('../hash');\nvar utils = hash.utils;\nvar assert = utils.assert;\n\nfunction BlockHash() {\n this.pending = null;\n this.pendingTotal = 0;\n this.blockSize = this.constructor.blockSize;\n this.outSize = this.constructor.outSize;\n this.hmacStrength = this.constructor.hmacStrength;\n this.padLength = this.constructor.padLength / 8;\n this.endian = 'big';\n\n this._delta8 = this.blockSize / 8;\n this._delta32 = this.blockSize / 32;\n}\nexports.BlockHash = BlockHash;\n\nBlockHash.prototype.update = function update(msg, enc) {\n // Convert message to array, pad it, and join into 32bit blocks\n msg = utils.toArray(msg, enc);\n if (!this.pending)\n this.pending = msg;\n else\n this.pending = this.pending.concat(msg);\n this.pendingTotal += msg.length;\n\n // Enough data, try updating\n if (this.pending.length >= this._delta8) {\n msg = this.pending;\n\n // Process pending data in blocks\n var r = msg.length % this._delta8;\n this.pending = msg.slice(msg.length - r, msg.length);\n if (this.pending.length === 0)\n this.pending = null;\n\n msg = utils.join32(msg, 0, msg.length - r, this.endian);\n for (var i = 0; i < msg.length; i += this._delta32)\n this._update(msg, i, i + this._delta32);\n }\n\n return this;\n};\n\nBlockHash.prototype.digest = function digest(enc) {\n this.update(this._pad());\n assert(this.pending === null);\n\n return this._digest(enc);\n};\n\nBlockHash.prototype._pad = function pad() {\n var len = this.pendingTotal;\n var bytes = this._delta8;\n var k = bytes - ((len + this.padLength) % bytes);\n var res = new Array(k + this.padLength);\n res[0] = 0x80;\n for (var i = 1; i < k; i++)\n res[i] = 0;\n\n // Append length\n len <<= 3;\n if (this.endian === 'big') {\n for (var t = 8; t < this.padLength; t++)\n res[i++] = 0;\n\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = (len >>> 24) & 0xff;\n res[i++] = (len >>> 16) & 0xff;\n res[i++] = (len >>> 8) & 0xff;\n res[i++] = len & 0xff;\n } else {\n res[i++] = len & 0xff;\n res[i++] = (len >>> 8) & 0xff;\n res[i++] = (len >>> 16) & 0xff;\n res[i++] = (len >>> 24) & 0xff;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n\n for (var t = 8; t < this.padLength; t++)\n res[i++] = 0;\n }\n\n return res;\n};\n\n},{\"../hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/hmac.js\":[function(require,module,exports){\nvar hmac = exports;\n\nvar hash = require('../hash');\nvar utils = hash.utils;\nvar assert = utils.assert;\n\nfunction Hmac(hash, key, enc) {\n if (!(this instanceof Hmac))\n return new Hmac(hash, key, enc);\n this.Hash = hash;\n this.blockSize = hash.blockSize / 8;\n this.outSize = hash.outSize / 8;\n this.inner = null;\n this.outer = null;\n\n this._init(utils.toArray(key, enc));\n}\nmodule.exports = Hmac;\n\nHmac.prototype._init = function init(key) {\n // Shorten key, if needed\n if (key.length > this.blockSize)\n key = new this.Hash().update(key).digest();\n assert(key.length <= this.blockSize);\n\n // Add padding to key\n for (var i = key.length; i < this.blockSize; i++)\n key.push(0);\n\n for (var i = 0; i < key.length; i++)\n key[i] ^= 0x36;\n this.inner = new this.Hash().update(key);\n\n // 0x36 ^ 0x5c = 0x6a\n for (var i = 0; i < key.length; i++)\n key[i] ^= 0x6a;\n this.outer = new this.Hash().update(key);\n};\n\nHmac.prototype.update = function update(msg, enc) {\n this.inner.update(msg, enc);\n return this;\n};\n\nHmac.prototype.digest = function digest(enc) {\n this.outer.update(this.inner.digest());\n return this.outer.digest(enc);\n};\n\n},{\"../hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/ripemd.js\":[function(require,module,exports){\nvar hash = require('../hash');\nvar utils = hash.utils;\n\nvar rotl32 = utils.rotl32;\nvar sum32 = utils.sum32;\nvar sum32_3 = utils.sum32_3;\nvar sum32_4 = utils.sum32_4;\nvar BlockHash = hash.common.BlockHash;\n\nfunction RIPEMD160() {\n if (!(this instanceof RIPEMD160))\n return new RIPEMD160();\n\n BlockHash.call(this);\n\n this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ];\n this.endian = 'little';\n}\nutils.inherits(RIPEMD160, BlockHash);\nexports.ripemd160 = RIPEMD160;\n\nRIPEMD160.blockSize = 512;\nRIPEMD160.outSize = 160;\nRIPEMD160.hmacStrength = 192;\nRIPEMD160.padLength = 64;\n\nRIPEMD160.prototype._update = function update(msg, start) {\n var A = this.h[0];\n var B = this.h[1];\n var C = this.h[2];\n var D = this.h[3];\n var E = this.h[4];\n var Ah = A;\n var Bh = B;\n var Ch = C;\n var Dh = D;\n var Eh = E;\n for (var j = 0; j < 80; j++) {\n var T = sum32(\n rotl32(\n sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)),\n s[j]),\n E);\n A = E;\n E = D;\n D = rotl32(C, 10);\n C = B;\n B = T;\n T = sum32(\n rotl32(\n sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)),\n sh[j]),\n Eh);\n Ah = Eh;\n Eh = Dh;\n Dh = rotl32(Ch, 10);\n Ch = Bh;\n Bh = T;\n }\n T = sum32_3(this.h[1], C, Dh);\n this.h[1] = sum32_3(this.h[2], D, Eh);\n this.h[2] = sum32_3(this.h[3], E, Ah);\n this.h[3] = sum32_3(this.h[4], A, Bh);\n this.h[4] = sum32_3(this.h[0], B, Ch);\n this.h[0] = T;\n};\n\nRIPEMD160.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'little');\n else\n return utils.split32(this.h, 'little');\n};\n\nfunction f(j, x, y, z) {\n if (j <= 15)\n return x ^ y ^ z;\n else if (j <= 31)\n return (x & y) | ((~x) & z);\n else if (j <= 47)\n return (x | (~y)) ^ z;\n else if (j <= 63)\n return (x & z) | (y & (~z));\n else\n return x ^ (y | (~z));\n}\n\nfunction K(j) {\n if (j <= 15)\n return 0x00000000;\n else if (j <= 31)\n return 0x5a827999;\n else if (j <= 47)\n return 0x6ed9eba1;\n else if (j <= 63)\n return 0x8f1bbcdc;\n else\n return 0xa953fd4e;\n}\n\nfunction Kh(j) {\n if (j <= 15)\n return 0x50a28be6;\n else if (j <= 31)\n return 0x5c4dd124;\n else if (j <= 47)\n return 0x6d703ef3;\n else if (j <= 63)\n return 0x7a6d76e9;\n else\n return 0x00000000;\n}\n\nvar r = [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,\n 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,\n 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,\n 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13,\n];\n\nvar rh = [\n 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,\n 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,\n 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,\n 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,\n 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11\n];\n\nvar s = [\n 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,\n 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,\n 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,\n 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,\n 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6,\n];\n\nvar sh = [\n 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,\n 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,\n 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,\n 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,\n 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11\n];\n\n},{\"../hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/sha.js\":[function(require,module,exports){\nvar hash = require('../hash');\nvar utils = hash.utils;\nvar assert = utils.assert;\n\nvar rotr32 = utils.rotr32;\nvar rotl32 = utils.rotl32;\nvar sum32 = utils.sum32;\nvar sum32_4 = utils.sum32_4;\nvar sum32_5 = utils.sum32_5;\nvar rotr64_hi = utils.rotr64_hi;\nvar rotr64_lo = utils.rotr64_lo;\nvar shr64_hi = utils.shr64_hi;\nvar shr64_lo = utils.shr64_lo;\nvar sum64 = utils.sum64;\nvar sum64_hi = utils.sum64_hi;\nvar sum64_lo = utils.sum64_lo;\nvar sum64_4_hi = utils.sum64_4_hi;\nvar sum64_4_lo = utils.sum64_4_lo;\nvar sum64_5_hi = utils.sum64_5_hi;\nvar sum64_5_lo = utils.sum64_5_lo;\nvar BlockHash = hash.common.BlockHash;\n\nvar sha256_K = [\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,\n 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,\n 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,\n 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,\n 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,\n 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,\n 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n];\n\nvar sha512_K = [\n 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,\n 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,\n 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,\n 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,\n 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,\n 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,\n 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,\n 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,\n 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,\n 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,\n 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,\n 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,\n 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,\n 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,\n 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,\n 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,\n 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,\n 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,\n 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,\n 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,\n 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,\n 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,\n 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,\n 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,\n 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,\n 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,\n 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,\n 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,\n 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,\n 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,\n 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,\n 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,\n 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,\n 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,\n 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,\n 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,\n 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,\n 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,\n 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,\n 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817\n];\n\nvar sha1_K = [\n 0x5A827999, 0x6ED9EBA1,\n 0x8F1BBCDC, 0xCA62C1D6\n];\n\nfunction SHA256() {\n if (!(this instanceof SHA256))\n return new SHA256();\n\n BlockHash.call(this);\n this.h = [ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,\n 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 ];\n this.k = sha256_K;\n this.W = new Array(64);\n}\nutils.inherits(SHA256, BlockHash);\nexports.sha256 = SHA256;\n\nSHA256.blockSize = 512;\nSHA256.outSize = 256;\nSHA256.hmacStrength = 192;\nSHA256.padLength = 64;\n\nSHA256.prototype._update = function _update(msg, start) {\n var W = this.W;\n\n for (var i = 0; i < 16; i++)\n W[i] = msg[start + i];\n for (; i < W.length; i++)\n W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);\n\n var a = this.h[0];\n var b = this.h[1];\n var c = this.h[2];\n var d = this.h[3];\n var e = this.h[4];\n var f = this.h[5];\n var g = this.h[6];\n var h = this.h[7];\n\n assert(this.k.length === W.length);\n for (var i = 0; i < W.length; i++) {\n var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);\n var T2 = sum32(s0_256(a), maj32(a, b, c));\n h = g;\n g = f;\n f = e;\n e = sum32(d, T1);\n d = c;\n c = b;\n b = a;\n a = sum32(T1, T2);\n }\n\n this.h[0] = sum32(this.h[0], a);\n this.h[1] = sum32(this.h[1], b);\n this.h[2] = sum32(this.h[2], c);\n this.h[3] = sum32(this.h[3], d);\n this.h[4] = sum32(this.h[4], e);\n this.h[5] = sum32(this.h[5], f);\n this.h[6] = sum32(this.h[6], g);\n this.h[7] = sum32(this.h[7], h);\n};\n\nSHA256.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'big');\n else\n return utils.split32(this.h, 'big');\n};\n\nfunction SHA224() {\n if (!(this instanceof SHA224))\n return new SHA224();\n\n SHA256.call(this);\n this.h = [ 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,\n 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ];\n}\nutils.inherits(SHA224, SHA256);\nexports.sha224 = SHA224;\n\nSHA224.blockSize = 512;\nSHA224.outSize = 224;\nSHA224.hmacStrength = 192;\nSHA224.padLength = 64;\n\nSHA224.prototype._digest = function digest(enc) {\n // Just truncate output\n if (enc === 'hex')\n return utils.toHex32(this.h.slice(0, 7), 'big');\n else\n return utils.split32(this.h.slice(0, 7), 'big');\n};\n\nfunction SHA512() {\n if (!(this instanceof SHA512))\n return new SHA512();\n\n BlockHash.call(this);\n this.h = [ 0x6a09e667, 0xf3bcc908,\n 0xbb67ae85, 0x84caa73b,\n 0x3c6ef372, 0xfe94f82b,\n 0xa54ff53a, 0x5f1d36f1,\n 0x510e527f, 0xade682d1,\n 0x9b05688c, 0x2b3e6c1f,\n 0x1f83d9ab, 0xfb41bd6b,\n 0x5be0cd19, 0x137e2179 ];\n this.k = sha512_K;\n this.W = new Array(160);\n}\nutils.inherits(SHA512, BlockHash);\nexports.sha512 = SHA512;\n\nSHA512.blockSize = 1024;\nSHA512.outSize = 512;\nSHA512.hmacStrength = 192;\nSHA512.padLength = 128;\n\nSHA512.prototype._prepareBlock = function _prepareBlock(msg, start) {\n var W = this.W;\n\n // 32 x 32bit words\n for (var i = 0; i < 32; i++)\n W[i] = msg[start + i];\n for (; i < W.length; i += 2) {\n var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2\n var c0_lo = g1_512_lo(W[i - 4], W[i - 3]);\n var c1_hi = W[i - 14]; // i - 7\n var c1_lo = W[i - 13];\n var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15\n var c2_lo = g0_512_lo(W[i - 30], W[i - 29]);\n var c3_hi = W[i - 32]; // i - 16\n var c3_lo = W[i - 31];\n\n W[i] = sum64_4_hi(c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo);\n W[i + 1] = sum64_4_lo(c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo);\n }\n};\n\nSHA512.prototype._update = function _update(msg, start) {\n this._prepareBlock(msg, start);\n\n var W = this.W;\n\n var ah = this.h[0];\n var al = this.h[1];\n var bh = this.h[2];\n var bl = this.h[3];\n var ch = this.h[4];\n var cl = this.h[5];\n var dh = this.h[6];\n var dl = this.h[7];\n var eh = this.h[8];\n var el = this.h[9];\n var fh = this.h[10];\n var fl = this.h[11];\n var gh = this.h[12];\n var gl = this.h[13];\n var hh = this.h[14];\n var hl = this.h[15];\n\n assert(this.k.length === W.length);\n for (var i = 0; i < W.length; i += 2) {\n var c0_hi = hh;\n var c0_lo = hl;\n var c1_hi = s1_512_hi(eh, el);\n var c1_lo = s1_512_lo(eh, el);\n var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl);\n var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);\n var c3_hi = this.k[i];\n var c3_lo = this.k[i + 1];\n var c4_hi = W[i];\n var c4_lo = W[i + 1];\n\n var T1_hi = sum64_5_hi(c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo,\n c4_hi, c4_lo);\n var T1_lo = sum64_5_lo(c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo,\n c4_hi, c4_lo);\n\n var c0_hi = s0_512_hi(ah, al);\n var c0_lo = s0_512_lo(ah, al);\n var c1_hi = maj64_hi(ah, al, bh, bl, ch, cl);\n var c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);\n\n var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);\n var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);\n\n hh = gh;\n hl = gl;\n\n gh = fh;\n gl = fl;\n\n fh = eh;\n fl = el;\n\n eh = sum64_hi(dh, dl, T1_hi, T1_lo);\n el = sum64_lo(dl, dl, T1_hi, T1_lo);\n\n dh = ch;\n dl = cl;\n\n ch = bh;\n cl = bl;\n\n bh = ah;\n bl = al;\n\n ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo);\n al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);\n }\n\n sum64(this.h, 0, ah, al);\n sum64(this.h, 2, bh, bl);\n sum64(this.h, 4, ch, cl);\n sum64(this.h, 6, dh, dl);\n sum64(this.h, 8, eh, el);\n sum64(this.h, 10, fh, fl);\n sum64(this.h, 12, gh, gl);\n sum64(this.h, 14, hh, hl);\n};\n\nSHA512.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'big');\n else\n return utils.split32(this.h, 'big');\n};\n\nfunction SHA384() {\n if (!(this instanceof SHA384))\n return new SHA384();\n\n SHA512.call(this);\n this.h = [ 0xcbbb9d5d, 0xc1059ed8,\n 0x629a292a, 0x367cd507,\n 0x9159015a, 0x3070dd17,\n 0x152fecd8, 0xf70e5939,\n 0x67332667, 0xffc00b31,\n 0x8eb44a87, 0x68581511,\n 0xdb0c2e0d, 0x64f98fa7,\n 0x47b5481d, 0xbefa4fa4 ];\n}\nutils.inherits(SHA384, SHA512);\nexports.sha384 = SHA384;\n\nSHA384.blockSize = 1024;\nSHA384.outSize = 384;\nSHA384.hmacStrength = 192;\nSHA384.padLength = 128;\n\nSHA384.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h.slice(0, 12), 'big');\n else\n return utils.split32(this.h.slice(0, 12), 'big');\n};\n\nfunction SHA1() {\n if (!(this instanceof SHA1))\n return new SHA1();\n\n BlockHash.call(this);\n this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe,\n 0x10325476, 0xc3d2e1f0 ];\n this.W = new Array(80);\n}\n\nutils.inherits(SHA1, BlockHash);\nexports.sha1 = SHA1;\n\nSHA1.blockSize = 512;\nSHA1.outSize = 160;\nSHA1.hmacStrength = 80;\nSHA1.padLength = 64;\n\nSHA1.prototype._update = function _update(msg, start) {\n var W = this.W;\n\n for (var i = 0; i < 16; i++)\n W[i] = msg[start + i];\n\n for(; i < W.length; i++)\n W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);\n\n var a = this.h[0];\n var b = this.h[1];\n var c = this.h[2];\n var d = this.h[3];\n var e = this.h[4];\n\n for (var i = 0; i < W.length; i++) {\n var s = ~~(i / 20);\n var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);\n e = d;\n d = c;\n c = rotl32(b, 30);\n b = a;\n a = t;\n }\n\n this.h[0] = sum32(this.h[0], a);\n this.h[1] = sum32(this.h[1], b);\n this.h[2] = sum32(this.h[2], c);\n this.h[3] = sum32(this.h[3], d);\n this.h[4] = sum32(this.h[4], e);\n};\n\nSHA1.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'big');\n else\n return utils.split32(this.h, 'big');\n};\n\nfunction ch32(x, y, z) {\n return (x & y) ^ ((~x) & z);\n}\n\nfunction maj32(x, y, z) {\n return (x & y) ^ (x & z) ^ (y & z);\n}\n\nfunction p32(x, y, z) {\n return x ^ y ^ z;\n}\n\nfunction s0_256(x) {\n return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);\n}\n\nfunction s1_256(x) {\n return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);\n}\n\nfunction g0_256(x) {\n return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3);\n}\n\nfunction g1_256(x) {\n return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10);\n}\n\nfunction ft_1(s, x, y, z) {\n if (s === 0)\n return ch32(x, y, z);\n if (s === 1 || s === 3)\n return p32(x, y, z);\n if (s === 2)\n return maj32(x, y, z);\n}\n\nfunction ch64_hi(xh, xl, yh, yl, zh, zl) {\n var r = (xh & yh) ^ ((~xh) & zh);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction ch64_lo(xh, xl, yh, yl, zh, zl) {\n var r = (xl & yl) ^ ((~xl) & zl);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction maj64_hi(xh, xl, yh, yl, zh, zl) {\n var r = (xh & yh) ^ (xh & zh) ^ (yh & zh);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction maj64_lo(xh, xl, yh, yl, zh, zl) {\n var r = (xl & yl) ^ (xl & zl) ^ (yl & zl);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 28);\n var c1_hi = rotr64_hi(xl, xh, 2); // 34\n var c2_hi = rotr64_hi(xl, xh, 7); // 39\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 28);\n var c1_lo = rotr64_lo(xl, xh, 2); // 34\n var c2_lo = rotr64_lo(xl, xh, 7); // 39\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 14);\n var c1_hi = rotr64_hi(xh, xl, 18);\n var c2_hi = rotr64_hi(xl, xh, 9); // 41\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 14);\n var c1_lo = rotr64_lo(xh, xl, 18);\n var c2_lo = rotr64_lo(xl, xh, 9); // 41\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 1);\n var c1_hi = rotr64_hi(xh, xl, 8);\n var c2_hi = shr64_hi(xh, xl, 7);\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 1);\n var c1_lo = rotr64_lo(xh, xl, 8);\n var c2_lo = shr64_lo(xh, xl, 7);\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 19);\n var c1_hi = rotr64_hi(xl, xh, 29); // 61\n var c2_hi = shr64_hi(xh, xl, 6);\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 19);\n var c1_lo = rotr64_lo(xl, xh, 29); // 61\n var c2_lo = shr64_lo(xh, xl, 6);\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\n},{\"../hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/utils.js\":[function(require,module,exports){\nvar utils = exports;\nvar inherits = require('inherits');\n\nfunction toArray(msg, enc) {\n if (Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg === 'string') {\n if (!enc) {\n for (var i = 0; i < msg.length; i++) {\n var c = msg.charCodeAt(i);\n var hi = c >> 8;\n var lo = c & 0xff;\n if (hi)\n res.push(hi, lo);\n else\n res.push(lo);\n }\n } else if (enc === 'hex') {\n msg = msg.replace(/[^a-z0-9]+/ig, '');\n if (msg.length % 2 !== 0)\n msg = '0' + msg;\n for (var i = 0; i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n }\n } else {\n for (var i = 0; i < msg.length; i++)\n res[i] = msg[i] | 0;\n }\n return res;\n}\nutils.toArray = toArray;\n\nfunction toHex(msg) {\n var res = '';\n for (var i = 0; i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n}\nutils.toHex = toHex;\n\nfunction htonl(w) {\n var res = (w >>> 24) |\n ((w >>> 8) & 0xff00) |\n ((w << 8) & 0xff0000) |\n ((w & 0xff) << 24);\n return res >>> 0;\n}\nutils.htonl = htonl;\n\nfunction toHex32(msg, endian) {\n var res = '';\n for (var i = 0; i < msg.length; i++) {\n var w = msg[i];\n if (endian === 'little')\n w = htonl(w);\n res += zero8(w.toString(16));\n }\n return res;\n}\nutils.toHex32 = toHex32;\n\nfunction zero2(word) {\n if (word.length === 1)\n return '0' + word;\n else\n return word;\n}\nutils.zero2 = zero2;\n\nfunction zero8(word) {\n if (word.length === 7)\n return '0' + word;\n else if (word.length === 6)\n return '00' + word;\n else if (word.length === 5)\n return '000' + word;\n else if (word.length === 4)\n return '0000' + word;\n else if (word.length === 3)\n return '00000' + word;\n else if (word.length === 2)\n return '000000' + word;\n else if (word.length === 1)\n return '0000000' + word;\n else\n return word;\n}\nutils.zero8 = zero8;\n\nfunction join32(msg, start, end, endian) {\n var len = end - start;\n assert(len % 4 === 0);\n var res = new Array(len / 4);\n for (var i = 0, k = start; i < res.length; i++, k += 4) {\n var w;\n if (endian === 'big')\n w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3];\n else\n w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k];\n res[i] = w >>> 0;\n }\n return res;\n}\nutils.join32 = join32;\n\nfunction split32(msg, endian) {\n var res = new Array(msg.length * 4);\n for (var i = 0, k = 0; i < msg.length; i++, k += 4) {\n var m = msg[i];\n if (endian === 'big') {\n res[k] = m >>> 24;\n res[k + 1] = (m >>> 16) & 0xff;\n res[k + 2] = (m >>> 8) & 0xff;\n res[k + 3] = m & 0xff;\n } else {\n res[k + 3] = m >>> 24;\n res[k + 2] = (m >>> 16) & 0xff;\n res[k + 1] = (m >>> 8) & 0xff;\n res[k] = m & 0xff;\n }\n }\n return res;\n}\nutils.split32 = split32;\n\nfunction rotr32(w, b) {\n return (w >>> b) | (w << (32 - b));\n}\nutils.rotr32 = rotr32;\n\nfunction rotl32(w, b) {\n return (w << b) | (w >>> (32 - b));\n}\nutils.rotl32 = rotl32;\n\nfunction sum32(a, b) {\n return (a + b) >>> 0;\n}\nutils.sum32 = sum32;\n\nfunction sum32_3(a, b, c) {\n return (a + b + c) >>> 0;\n}\nutils.sum32_3 = sum32_3;\n\nfunction sum32_4(a, b, c, d) {\n return (a + b + c + d) >>> 0;\n}\nutils.sum32_4 = sum32_4;\n\nfunction sum32_5(a, b, c, d, e) {\n return (a + b + c + d + e) >>> 0;\n}\nutils.sum32_5 = sum32_5;\n\nfunction assert(cond, msg) {\n if (!cond)\n throw new Error(msg || 'Assertion failed');\n}\nutils.assert = assert;\n\nutils.inherits = inherits;\n\nfunction sum64(buf, pos, ah, al) {\n var bh = buf[pos];\n var bl = buf[pos + 1];\n\n var lo = (al + bl) >>> 0;\n var hi = (lo < al ? 1 : 0) + ah + bh;\n buf[pos] = hi >>> 0;\n buf[pos + 1] = lo;\n}\nexports.sum64 = sum64;\n\nfunction sum64_hi(ah, al, bh, bl) {\n var lo = (al + bl) >>> 0;\n var hi = (lo < al ? 1 : 0) + ah + bh;\n return hi >>> 0;\n};\nexports.sum64_hi = sum64_hi;\n\nfunction sum64_lo(ah, al, bh, bl) {\n var lo = al + bl;\n return lo >>> 0;\n};\nexports.sum64_lo = sum64_lo;\n\nfunction sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {\n var carry = 0;\n var lo = al;\n lo = (lo + bl) >>> 0;\n carry += lo < al ? 1 : 0;\n lo = (lo + cl) >>> 0;\n carry += lo < cl ? 1 : 0;\n lo = (lo + dl) >>> 0;\n carry += lo < dl ? 1 : 0;\n\n var hi = ah + bh + ch + dh + carry;\n return hi >>> 0;\n};\nexports.sum64_4_hi = sum64_4_hi;\n\nfunction sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {\n var lo = al + bl + cl + dl;\n return lo >>> 0;\n};\nexports.sum64_4_lo = sum64_4_lo;\n\nfunction sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {\n var carry = 0;\n var lo = al;\n lo = (lo + bl) >>> 0;\n carry += lo < al ? 1 : 0;\n lo = (lo + cl) >>> 0;\n carry += lo < cl ? 1 : 0;\n lo = (lo + dl) >>> 0;\n carry += lo < dl ? 1 : 0;\n lo = (lo + el) >>> 0;\n carry += lo < el ? 1 : 0;\n\n var hi = ah + bh + ch + dh + eh + carry;\n return hi >>> 0;\n};\nexports.sum64_5_hi = sum64_5_hi;\n\nfunction sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {\n var lo = al + bl + cl + dl + el;\n\n return lo >>> 0;\n};\nexports.sum64_5_lo = sum64_5_lo;\n\nfunction rotr64_hi(ah, al, num) {\n var r = (al << (32 - num)) | (ah >>> num);\n return r >>> 0;\n};\nexports.rotr64_hi = rotr64_hi;\n\nfunction rotr64_lo(ah, al, num) {\n var r = (ah << (32 - num)) | (al >>> num);\n return r >>> 0;\n};\nexports.rotr64_lo = rotr64_lo;\n\nfunction shr64_hi(ah, al, num) {\n return ah >>> num;\n};\nexports.shr64_hi = shr64_hi;\n\nfunction shr64_lo(ah, al, num) {\n var r = (ah << (32 - num)) | (al >>> num);\n return r >>> 0;\n};\nexports.shr64_lo = shr64_lo;\n\n},{\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/package.json\":[function(require,module,exports){\nmodule.exports={\n \"name\": \"elliptic\",\n \"version\": \"1.0.1\",\n \"description\": \"EC cryptography\",\n \"main\": \"lib/elliptic.js\",\n \"scripts\": {\n \"test\": \"mocha --reporter=spec test/*-test.js\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git@github.com:indutny/elliptic\"\n },\n \"keywords\": [\n \"EC\",\n \"Elliptic\",\n \"curve\",\n \"Cryptography\"\n ],\n \"author\": {\n \"name\": \"Fedor Indutny\",\n \"email\": \"fedor@indutny.com\"\n },\n \"license\": \"MIT\",\n \"bugs\": {\n \"url\": \"https://github.com/indutny/elliptic/issues\"\n },\n \"homepage\": \"https://github.com/indutny/elliptic\",\n \"devDependencies\": {\n \"browserify\": \"^3.44.2\",\n \"mocha\": \"^1.18.2\",\n \"uglify-js\": \"^2.4.13\"\n },\n \"dependencies\": {\n \"bn.js\": \"^1.0.0\",\n \"brorand\": \"^1.0.1\",\n \"hash.js\": \"^1.0.0\",\n \"inherits\": \"^2.0.1\"\n },\n \"gitHead\": \"17dc013761dd1efcfb868e2b06b0b897627b40be\",\n \"_id\": \"elliptic@1.0.1\",\n \"_shasum\": \"d180376b66a17d74995c837796362ac4d22aefe3\",\n \"_from\": \"elliptic@^1.0.0\",\n \"_npmVersion\": \"1.4.28\",\n \"_npmUser\": {\n \"name\": \"indutny\",\n \"email\": \"fedor@indutny.com\"\n },\n \"maintainers\": [\n {\n \"name\": \"indutny\",\n \"email\": \"fedor@indutny.com\"\n }\n ],\n \"dist\": {\n \"shasum\": \"d180376b66a17d74995c837796362ac4d22aefe3\",\n \"tarball\": \"http://registry.npmjs.org/elliptic/-/elliptic-1.0.1.tgz\"\n },\n \"directories\": {},\n \"_resolved\": \"https://registry.npmjs.org/elliptic/-/elliptic-1.0.1.tgz\",\n \"readme\": \"ERROR: No README data found!\"\n}\n\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/EVP_BytesToKey.js\":[function(require,module,exports){\n(function (Buffer){\n\nmodule.exports = function evp(crypto, password, salt, keyLen) {\n keyLen = keyLen/8;\n var ki = 0;\n var ii = 0;\n var key = new Buffer(keyLen);\n var addmd = 0;\n var md, md_buf;\n var i;\n while (true) {\n md = crypto.createHash('md5');\n if(addmd++ > 0) {\n md.update(md_buf);\n }\n md.update(password);\n md.update(salt);\n md_buf = md.digest();\n i = 0;\n if(keyLen > 0) {\n while(true) {\n if(keyLen === 0) {\n break;\n }\n if(i === md_buf.length) {\n break;\n }\n key[ki++] = md_buf[i++];\n keyLen--;\n }\n }\n if(keyLen === 0) {\n break;\n }\n }\n for(i=0;i 3)\n return new bignum(raw);\n\n while (!buffer.isEmpty()) {\n res <<= 8;\n var i = buffer.readUInt8();\n if (buffer.isError(i))\n return i;\n res |= i;\n }\n\n if (values)\n res = values[res] || res;\n\n return res;\n};\n\nDERNode.prototype._use = function use(entity, obj) {\n if (typeof entity === 'function')\n entity = entity(obj);\n return entity._getDecoder('der').tree;\n};\n\n// Utility methods\n\nfunction derDecodeTag(buf, fail) {\n var tag = buf.readUInt8(fail);\n if (buf.isError(tag))\n return tag;\n\n var cls = der.tagClass[tag >> 6];\n var primitive = (tag & 0x20) === 0;\n\n // Multi-octet tag - load\n if ((tag & 0x1f) === 0x1f) {\n var oct = tag;\n tag = 0;\n while ((oct & 0x80) === 0x80) {\n oct = buf.readUInt8(fail);\n if (buf.isError(oct))\n return oct;\n\n tag <<= 7;\n tag |= oct & 0x7f;\n }\n } else {\n tag &= 0x1f;\n }\n var tagStr = der.tag[tag];\n\n return {\n cls: cls,\n primitive: primitive,\n tag: tag,\n tagStr: tagStr\n };\n}\n\nfunction derDecodeLen(buf, primitive, fail) {\n var len = buf.readUInt8(fail);\n if (buf.isError(len))\n return len;\n\n // Indefinite form\n if (!primitive && len === 0x80)\n return null;\n\n // Definite form\n if ((len & 0x80) === 0) {\n // Short form\n return len;\n }\n\n // Long form\n var num = len & 0x7f;\n if (num >= 4)\n return buf.error('length octect is too long');\n\n len = 0;\n for (var i = 0; i < num; i++) {\n len <<= 8;\n var j = buf.readUInt8(fail);\n if (buf.isError(j))\n return j;\n len |= j;\n }\n\n return len;\n}\n\n},{\"../../asn1\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/decoders/index.js\":[function(require,module,exports){\nvar decoders = exports;\n\ndecoders.der = require('./der');\n\n},{\"./der\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/decoders/der.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/encoders/der.js\":[function(require,module,exports){\nvar inherits = require('inherits');\nvar Buffer = require('buffer').Buffer;\n\nvar asn1 = require('../../asn1');\nvar base = asn1.base;\nvar bignum = asn1.bignum;\n\n// Import DER constants\nvar der = asn1.constants.der;\n\nfunction DEREncoder(entity) {\n this.enc = 'der';\n this.name = entity.name;\n this.entity = entity;\n\n // Construct base tree\n this.tree = new DERNode();\n this.tree._init(entity.body);\n};\nmodule.exports = DEREncoder;\n\nDEREncoder.prototype.encode = function encode(data, reporter) {\n return this.tree._encode(data, reporter).join();\n};\n\n// Tree methods\n\nfunction DERNode(parent) {\n base.Node.call(this, 'der', parent);\n}\ninherits(DERNode, base.Node);\n\nDERNode.prototype._encodeComposite = function encodeComposite(tag,\n primitive,\n cls,\n content) {\n var encodedTag = encodeTag(tag, primitive, cls, this.reporter);\n\n // Short form\n if (content.length < 0x80) {\n var header = new Buffer(2);\n header[0] = encodedTag;\n header[1] = content.length;\n return this._createEncoderBuffer([ header, content ]);\n }\n\n // Long form\n // Count octets required to store length\n var lenOctets = 1;\n for (var i = content.length; i >= 0x100; i >>= 8)\n lenOctets++;\n\n var header = new Buffer(1 + 1 + lenOctets);\n header[0] = encodedTag;\n header[1] = 0x80 | lenOctets;\n\n for (var i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8)\n header[i] = j & 0xff;\n\n return this._createEncoderBuffer([ header, content ]);\n};\n\nDERNode.prototype._encodeStr = function encodeStr(str, tag) {\n if (tag === 'octstr')\n return this._createEncoderBuffer(str);\n else if (tag === 'bitstr')\n return this._createEncoderBuffer([ str.unused | 0, str.data ]);\n else if (tag === 'ia5str')\n return this._createEncoderBuffer(str);\n return this.reporter.error('Encoding of string type: ' + tag +\n ' unsupported');\n};\n\nDERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) {\n if (typeof id === 'string') {\n if (!values)\n return this.reporter.error('string objid given, but no values map found');\n if (!values.hasOwnProperty(id))\n return this.reporter.error('objid not found in values map');\n id = values[id].split(/\\s+/g);\n for (var i = 0; i < id.length; i++)\n id[i] |= 0;\n } else if (Array.isArray(id)) {\n id = id.slice();\n }\n\n if (!Array.isArray(id)) {\n return this.reporter.error('objid() should be either array or string, ' +\n 'got: ' + JSON.stringify(id));\n }\n\n if (!relative) {\n if (id[1] >= 40)\n return this.reporter.error('Second objid identifier OOB');\n id.splice(0, 2, id[0] * 40 + id[1]);\n }\n\n // Count number of octets\n var size = 0;\n for (var i = 0; i < id.length; i++) {\n var ident = id[i];\n for (size++; ident >= 0x80; ident >>= 7)\n size++;\n }\n\n var objid = new Buffer(size);\n var offset = objid.length - 1;\n for (var i = id.length - 1; i >= 0; i--) {\n var ident = id[i];\n objid[offset--] = ident & 0x7f;\n while ((ident >>= 7) > 0)\n objid[offset--] = 0x80 | (ident & 0x7f);\n }\n\n return this._createEncoderBuffer(objid);\n};\n\nfunction two(num) {\n if (num <= 10)\n return '0' + num;\n else\n return num;\n}\n\nDERNode.prototype._encodeTime = function encodeTime(time, tag) {\n var str;\n var date = new Date(time);\n\n if (tag === 'gentime') {\n str = [\n date.getFullYear(),\n two(date.getUTCMonth() + 1),\n two(date.getUTCDate()),\n two(date.getUTCHours()),\n two(date.getUTCMinutes()),\n two(date.getUTCSeconds()),\n 'Z'\n ].join('');\n } else if (tag === 'utctime') {\n str = [\n date.getFullYear() % 100,\n two(date.getUTCMonth() + 1),\n two(date.getUTCDate()),\n two(date.getUTCHours()),\n two(date.getUTCMinutes()),\n two(date.getUTCSeconds()),\n 'Z'\n ].join('');\n } else {\n this.reporter.error('Encoding ' + tag + ' time is not supported yet');\n }\n\n return this._encodeStr(str, 'octstr');\n};\n\nDERNode.prototype._encodeNull = function encodeNull() {\n return this._createEncoderBuffer('');\n};\n\nDERNode.prototype._encodeInt = function encodeInt(num, values) {\n if (typeof num === 'string') {\n if (!values)\n return this.reporter.error('String int or enum given, but no values map');\n if (!values.hasOwnProperty(num)) {\n return this.reporter.error('Values map doesn\\'t contain: ' +\n JSON.stringify(num));\n }\n num = values[num];\n }\n\n // Bignum, assume big endian\n if (bignum !== null && num instanceof bignum) {\n var numArray = num.toArray();\n if(num.sign === false && numArray[0] & 0x80) {\n numArray.unshift(0);\n }\n num = new Buffer(numArray);\n }\n\n if (Buffer.isBuffer(num)) {\n var size = num.length;\n if (num.length === 0)\n size++;\n\n var out = new Buffer(size);\n num.copy(out);\n if (num.length === 0)\n out[0] = 0\n return this._createEncoderBuffer(out);\n }\n\n if (num < 0x80)\n return this._createEncoderBuffer(num);\n\n if (num < 0x100)\n return this._createEncoderBuffer([0, num]);\n\n var size = 1;\n for (var i = num; i >= 0x100; i >>= 8)\n size++;\n\n var out = new Array(size);\n for (var i = out.length - 1; i >= 0; i--) {\n out[i] = num & 0xff;\n num >>= 8;\n }\n if(out[0] & 0x80) {\n out.unshift(0);\n }\n\n return this._createEncoderBuffer(new Buffer(out));\n};\n\nDERNode.prototype._encodeBool = function encodeBool(value) {\n return this._createEncoderBuffer(value ? 0xff : 0);\n};\n\nDERNode.prototype._use = function use(entity, obj) {\n if (typeof entity === 'function')\n entity = entity(obj);\n return entity._getEncoder('der').tree;\n};\n\nDERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) {\n var state = this._baseState;\n var i;\n if (state['default'] === null)\n return false;\n\n var data = dataBuffer.join();\n if (state.defaultBuffer === undefined)\n state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join();\n\n if (data.length !== state.defaultBuffer.length)\n return false;\n\n for (i=0; i < data.length; i++)\n if (data[i] !== state.defaultBuffer[i])\n return false;\n\n return true;\n};\n\n// Utility methods\n\nfunction encodeTag(tag, primitive, cls, reporter) {\n var res;\n\n if (tag === 'seqof')\n tag = 'seq';\n else if (tag === 'setof')\n tag = 'set';\n\n if (der.tagByName.hasOwnProperty(tag))\n res = der.tagByName[tag];\n else if (typeof tag === 'number' && (tag | 0) === tag)\n res = tag;\n else\n return reporter.error('Unknown tag: ' + tag);\n\n if (res >= 0x1f)\n return reporter.error('Multi-octet tag encoding unsupported');\n\n if (!primitive)\n res |= 0x20;\n\n res |= (der.tagClassByName[cls || 'universal'] << 6);\n\n return res;\n}\n\n},{\"../../asn1\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/encoders/index.js\":[function(require,module,exports){\nvar encoders = exports;\n\nencoders.der = require('./der');\n\n},{\"./der\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/encoders/der.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/node_modules/minimalistic-assert/index.js\":[function(require,module,exports){\nmodule.exports = assert;\n\nfunction assert(val, msg) {\n if (!val)\n throw new Error(msg || 'Assertion failed');\n}\n\nassert.equal = function assertEqual(l, r, msg) {\n if (l != r)\n throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));\n};\n\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pemstrip/index.js\":[function(require,module,exports){\nexports.strip = function strip(artifact) {\n artifact = artifact.toString()\n var startRegex = /^-----BEGIN (.*)-----\\n/;\n var match = startRegex.exec(artifact);\n var tag = match[1];\n var endRegex = new RegExp(\"\\n-----END \" + tag + \"-----(\\n*)$\");\n var base64 = artifact.slice(match[0].length).replace(endRegex, \"\").replace(/\\n/g, \"\");\n return {tag: tag, base64: base64};\n};\n\n// http://stackoverflow.com/a/7033705\nvar wrap = function wrap(str, l) {\n var chunks = [];\n while (str) {\n if (str.length < l) {\n chunks.push(str);\n break;\n }\n else {\n chunks.push(str.substr(0, l));\n str = str.substr(l);\n }\n }\n return chunks.join(\"\\n\");\n}\n\nexports.assemble = function assemble(info) {\n var tag = info.tag;\n var base64 = info.base64;\n var startLine = \"-----BEGIN \" + tag + \"-----\";\n var endLine = \"-----END \" + tag + \"-----\";\n return startLine + \"\\n\" + wrap(base64, 64) + \"\\n\" + endLine + \"\\n\";\n}\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/sign.js\":[function(require,module,exports){\n(function (Buffer){\n// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js\nvar parseKeys = require('parse-asn1');\nvar bn = require('bn.js');\nvar elliptic = require('elliptic');\nvar crt = require(\"browserify-rsa\");\nmodule.exports = sign;\nfunction sign(hash, key, hashType, crypto) {\n var priv = parseKeys(key, crypto);\n if (priv.curve) {\n return ecSign(hash, priv, crypto);\n } else if (priv.type === 'dsa') {\n return dsaSign(hash, priv, hashType, crypto);\n }\n var len = priv.modulus.byteLength();\n var pad = [ 0, 1 ];\n while (hash.length + pad.length + 1 < len) {\n pad.push(0xff);\n }\n pad.push(0x00);\n var i = -1;\n while (++i < hash.length) {\n pad.push(hash[i]);\n }\n \n var out = crt(pad, priv, crypto);\n return out;\n}\nfunction ecSign(hash, priv, crypto) {\n elliptic.rand = crypto.randomBytes;\n var curve;\n if (priv.curve.join('.') === '1.3.132.0.10') {\n curve = new elliptic.ec('secp256k1');\n }\n var key = curve.genKeyPair();\n key._importPrivate(priv.privateKey);\n var out = key.sign(hash);\n return new Buffer(out.toDER());\n}\nfunction dsaSign(hash, priv, algo, crypto) {\n var x = priv.params.priv_key;\n var p = priv.params.p;\n var q = priv.params.q;\n var montq = bn.mont(q);\n var g = priv.params.g;\n var r = new bn(0);\n var k;\n var H = bits2int(hash, q).mod(q);\n var s = false;\n var kv = getKay(x, q, hash, algo, crypto);\n while (s === false) {\n k = makeKey(q, kv, algo, crypto);\n r = makeR(g, k, p, q);\n s = k.invm(q).imul(H.add(x.mul(r))).mod(q);\n if (!s.cmpn(0)) {\n s = false;\n r = new bn(0);\n }\n }\n return toDER(r,s);\n}\nfunction toDER(r, s) {\n r = r.toArray();\n s = s.toArray();\n\n // Pad values\n if (r[0] & 0x80)\n r = [ 0 ].concat(r);\n // Pad values\n if (s[0] & 0x80)\n s = [0].concat(s);\n\n var total = r.length + s.length + 4;\n var res = [ 0x30, total, 0x02, r.length ];\n res = res.concat(r, [ 0x02, s.length ], s);\n return new Buffer(res);\n}\nmodule.exports.getKay = getKay;\nfunction getKay(x, q, hash, algo, crypto) {\n x = new Buffer(x.toArray());\n if (x.length < q.byteLength()) {\n var zeros = new Buffer(q.byteLength() - x.length);\n zeros.fill(0);\n x = Buffer.concat([zeros, x]);\n }\n var hlen = hash.length;\n var hbits = bits2octets(hash, q);\n var v = new Buffer(hlen);\n v.fill(1);\n var k = new Buffer(hlen);\n k.fill(0);\n k = crypto.createHmac(algo, k)\n .update(v)\n .update(new Buffer([0]))\n .update(x)\n .update(hbits)\n .digest();\n v = crypto.createHmac(algo, k)\n .update(v)\n .digest();\n k = crypto.createHmac(algo, k)\n .update(v)\n .update(new Buffer([1]))\n .update(x)\n .update(hbits)\n .digest();\n v = crypto.createHmac(algo, k)\n .update(v)\n .digest();\n return {\n k:k,\n v:v\n };\n}\nfunction bits2int(obits, q) {\n bits = new bn(obits);\n var shift = obits.length * 8 - q.bitLength();\n if (shift > 0) {\n bits.ishrn(shift);\n }\n return bits;\n}\nfunction bits2octets (bits, q) {\n bits = bits2int(bits, q);\n bits = bits.mod(q);\n var out = new Buffer(bits.toArray());\n if (out.length < q.byteLength()) {\n var zeros = new Buffer(q.byteLength() - out.length);\n zeros.fill(0);\n out = Buffer.concat([zeros, out]);\n }\n return out;\n}\nmodule.exports.makeKey = makeKey;\nfunction makeKey(q, kv, algo, crypto) {\n var t;\n var k;\n while (true) {\n t = new Buffer('');\n while (t.length * 8 < q.bitLength()) {\n kv.v = crypto.createHmac(algo, kv.k)\n .update(kv.v)\n .digest();\n t = Buffer.concat([t, kv.v]);\n }\n k = bits2int(t, q);\n kv.k = crypto.createHmac(algo, kv.k)\n .update(kv.v)\n .update(new Buffer([0]))\n .digest();\n kv.v = crypto.createHmac(algo, kv.k)\n .update(kv.v)\n .digest();\n if (k.cmp(q) === -1) {\n return k;\n }\n }\n}\nfunction makeR(g, k, p, q) {\n return g.toRed(bn.mont(p)).redPow(k).fromRed().mod(q);\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\",\"browserify-rsa\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/browserify-rsa/index.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\",\"parse-asn1\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/verify.js\":[function(require,module,exports){\n(function (Buffer){\n// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js\nvar parseKeys = require('parse-asn1');\nvar elliptic = require('elliptic');\nvar bn = require('bn.js');\nmodule.exports = verify;\nfunction verify(sig, hash, key) {\n var pub = parseKeys(key);\n if (pub.type === 'ec') {\n return ecVerify(sig, hash, pub);\n } else if (pub.type === 'dsa') {\n return dsaVerify(sig, hash, pub);\n }\n var len = pub.modulus.byteLength();\n var pad = [ 0, 1 ];\n while (hash.length + pad.length + 1 < len) {\n pad.push(0xff);\n }\n pad.push(0x00);\n var i = -1;\n while (++i < hash.length) {\n pad.push(hash[i]);\n }\n pad = hash;\n var red = bn.mont(pub.modulus);\n sig = new bn(sig).toRed(red);\n\n sig = sig.redPow(new bn(pub.publicExponent));\n\n sig = new Buffer(sig.fromRed().toArray());\n sig = sig.slice(sig.length - hash.length);\n var out = 0;\n len = sig.length;\n i = -1;\n while (++i < len) {\n out += (sig[i] ^ hash[i]);\n }\n return !out;\n}\nfunction ecVerify(sig, hash, pub) {\n var curve;\n if (pub.data.algorithm.curve.join('.') === '1.3.132.0.10') {\n curve = new elliptic.ec('secp256k1');\n }\n var pubkey = pub.data.subjectPrivateKey.data;\n return curve.verify(hash.toString('hex'), sig.toString('hex'), pubkey.toString('hex'));\n}\nfunction dsaVerify(sig, hash, pub) {\n var p = pub.data.p;\n var q = pub.data.q;\n var g = pub.data.g;\n var y = pub.data.pub_key;\n var unpacked = parseKeys.signature.decode(sig, 'der');\n var s = unpacked.s;\n var r = unpacked.r;\n checkValue(s, q);\n checkValue(r, q);\n var montq = bn.mont(q);\n var montp = bn.mont(p);\n var w = s.invm(q);\n var v = g.toRed(montp)\n .redPow(new bn(hash).mul(w).mod(q))\n .fromRed()\n .mul(\n y.toRed(montp)\n .redPow(r.mul(w).mod(q))\n .fromRed()\n ).mod(p).mod(q);\n return !v.cmp(r);\n}\nfunction checkValue(b, q) {\n if (b.cmpn(0) <= 0) {\n throw new Error('invalid sig');\n }\n if (b.cmp(q) >= q) {\n throw new Error('invalid sig');\n }\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\",\"parse-asn1\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/browser.js\":[function(require,module,exports){\n(function (Buffer){\nvar elliptic = require('elliptic');\nvar BN = require('bn.js');\n\nmodule.exports = function createECDH(curve) {\n\treturn new ECDH(curve);\n};\n\nvar aliases = {\n\tsecp256k1: {\n\t\tname: 'secp256k1',\n\t\tbyteLength: 32\n\t},\n\tsecp224r1: {\n\t\tname: 'p224',\n\t\tbyteLength: 28\n\t},\n\tprime256v1: {\n\t\tname: 'p256',\n\t\tbyteLength: 32\n\t},\n\tprime192v1: {\n\t\tname: 'p192',\n\t\tbyteLength: 24\n\t},\n\ted25519: {\n\t\tname: 'ed25519',\n\t\tbyteLength: 32\n\t}\n};\n\naliases.p224 = aliases.secp224r1;\naliases.p256 = aliases.secp256r1 = aliases.prime256v1;\naliases.p192 = aliases.secp192r1 = aliases.prime192v1;\n\nfunction ECDH(curve) {\n\tthis.curveType = aliases[curve];\n\tif (!this.curveType ) {\n\t\tthis.curveType = {\n\t\t\tname: curve\n\t\t};\n\t}\n\tthis.curve = new elliptic.ec(this.curveType.name);\n\tthis.keys = void 0;\n}\n\nECDH.prototype.generateKeys = function (enc, format) {\n\tthis.keys = this.curve.genKeyPair();\n\treturn this.getPublicKey(enc, format);\n};\n\nECDH.prototype.computeSecret = function (other, inenc, enc) {\n\tinenc = inenc || 'utf8';\n\tif (!Buffer.isBuffer(other)) {\n\t\tother = new Buffer(other, inenc);\n\t}\n\tother = new BN(other);\n\tother = other.toString(16);\n\tvar otherPub = this.curve.keyPair(other, 'hex').getPublic();\n\tvar out = otherPub.mul(this.keys.getPrivate()).getX();\n\treturn formatReturnValue(out, enc, this.curveType.byteLength);\n};\n\nECDH.prototype.getPublicKey = function (enc, format) {\n\tvar key = this.keys.getPublic(format === 'compressed', true);\n\tif (format === 'hybrid') {\n\t\tif (key[key.length - 1] % 2) {\n\t\t\tkey[0] = 7;\n\t\t} else {\n\t\t\tkey [0] = 6;\n\t\t}\n\t}\n\treturn formatReturnValue(key, enc);\n};\n\nECDH.prototype.getPrivateKey = function (enc) {\n\treturn formatReturnValue(this.keys.getPrivate(), enc);\n};\n\nECDH.prototype.setPublicKey = function (pub, enc) {\n\tenc = enc || 'utf8';\n\tif (!Buffer.isBuffer(pub)) {\n\t\tpub = new Buffer(pub, enc);\n\t}\n\tvar pkey = new BN(pub);\n\tpkey = pkey.toArray();\n\tthis.keys._importPublicHex(pkey);\n\treturn this;\n};\n\nECDH.prototype.setPrivateKey = function (priv, enc) {\n\tenc = enc || 'utf8';\n\tif (!Buffer.isBuffer(priv)) {\n\t\tpriv = new Buffer(priv, enc);\n\t}\n\tvar _priv = new BN(priv);\n\t_priv = _priv.toString(16);\n\tthis.keys._importPrivate(_priv);\n\treturn this;\n};\n\nfunction formatReturnValue(bn, enc, len) {\n\tif (!Array.isArray(bn)) {\n\t\tbn = bn.toArray();\n\t}\n\tvar buf = new Buffer(bn);\n\tif (len && buf.length < len) {\n\t\tvar zeros = new Buffer(len - buf.length);\n\t\tzeros.fill(0);\n\t\tbuf = Buffer.concat([zeros, buf]);\n\t}\n\tif (!enc) {\n\t\treturn buf;\n\t} else {\n\t\treturn buf.toString(enc);\n\t}\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/index.js\":[function(require,module,exports){\nvar createECDH = require('crypto').createECDH;\n\nmodule.exports = createECDH || require('./browser');\n},{\"./browser\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/browser.js\",\"crypto\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\"][0].apply(exports,arguments)\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\"][0].apply(exports,arguments)\n},{\"../package.json\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/package.json\",\"./elliptic/curve\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/index.js\",\"./elliptic/curves\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curves.js\",\"./elliptic/ec\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/ec/index.js\",\"./elliptic/hmac-drbg\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/hmac-drbg.js\",\"./elliptic/utils\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/utils.js\",\"brorand\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/brorand/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/base.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/base.js\"][0].apply(exports,arguments)\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/edwards.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/edwards.js\"][0].apply(exports,arguments)\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js\",\"../curve\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/index.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/index.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/index.js\"][0].apply(exports,arguments)\n},{\"./base\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/base.js\",\"./edwards\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/edwards.js\",\"./mont\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/mont.js\",\"./short\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/short.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/mont.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/mont.js\"][0].apply(exports,arguments)\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js\",\"../curve\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/index.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/short.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/short.js\"][0].apply(exports,arguments)\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js\",\"../curve\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/index.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curves.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curves.js\"][0].apply(exports,arguments)\n},{\"../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js\",\"hash.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/ec/index.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/index.js\"][0].apply(exports,arguments)\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js\",\"./key\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/ec/key.js\",\"./signature\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/ec/signature.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/ec/key.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/key.js\"][0].apply(exports,arguments)\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/ec/signature.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/signature.js\"][0].apply(exports,arguments)\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/hmac-drbg.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/hmac-drbg.js\"][0].apply(exports,arguments)\n},{\"../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js\",\"hash.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/utils.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/utils.js\"][0].apply(exports,arguments)\n},{\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/brorand/index.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/index.js\"][0].apply(exports,arguments)\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"][0].apply(exports,arguments)\n},{\"./hash/common\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/common.js\",\"./hash/hmac\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/hmac.js\",\"./hash/ripemd\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/ripemd.js\",\"./hash/sha\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/sha.js\",\"./hash/utils\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/utils.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/common.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/common.js\"][0].apply(exports,arguments)\n},{\"../hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/hmac.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/hmac.js\"][0].apply(exports,arguments)\n},{\"../hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/ripemd.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/ripemd.js\"][0].apply(exports,arguments)\n},{\"../hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/sha.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/sha.js\"][0].apply(exports,arguments)\n},{\"../hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/utils.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/utils.js\"][0].apply(exports,arguments)\n},{\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/package.json\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/package.json\"][0].apply(exports,arguments)\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/browser.js\":[function(require,module,exports){\n(function (Buffer){\n'use strict';\nvar createHash = require('sha.js')\n\nvar md5 = require('./md5')\nvar rmd160 = require('ripemd160')\nvar Transform = require('stream').Transform;\nvar inherits = require('inherits')\n\nmodule.exports = function (alg) {\n if('md5' === alg) return new HashNoConstructor(md5)\n if('rmd160' === alg) return new HashNoConstructor(rmd160)\n return new Hash(createHash(alg))\n}\ninherits(HashNoConstructor, Transform)\n\nfunction HashNoConstructor(hash) {\n Transform.call(this);\n this._hash = hash\n this.buffers = []\n}\n\nHashNoConstructor.prototype._transform = function (data, _, done) {\n this.buffers.push(data)\n done()\n}\nHashNoConstructor.prototype._flush = function (done) {\n var buf = Buffer.concat(this.buffers)\n var r = this._hash(buf)\n this.buffers = null\n this.push(r)\n done()\n}\nHashNoConstructor.prototype.update = function (data, enc) {\n this.write(data, enc)\n return this\n}\n\nHashNoConstructor.prototype.digest = function (enc) {\n this.end()\n var outData = new Buffer('')\n var chunk\n while ((chunk = this.read())) {\n outData = Buffer.concat([outData, chunk])\n }\n if (enc) {\n outData = outData.toString(enc)\n }\n return outData\n}\n\ninherits(Hash, Transform)\n\nfunction Hash(hash) {\n Transform.call(this);\n this._hash = hash\n}\n\nHash.prototype._transform = function (data, _, done) {\n this._hash.update(data)\n done()\n}\nHash.prototype._flush = function (done) {\n this.push(this._hash.digest())\n this._hash = null\n done()\n}\nHash.prototype.update = function (data, enc) {\n this.write(data, enc)\n return this\n}\n\nHash.prototype.digest = function (enc) {\n this.end()\n var outData = new Buffer('')\n var chunk\n while ((chunk = this.read())) {\n outData = Buffer.concat([outData, chunk])\n }\n if (enc) {\n outData = outData.toString(enc)\n }\n return outData\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"./md5\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/md5.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\",\"ripemd160\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/ripemd160/lib/ripemd160.js\",\"sha.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/index.js\",\"stream\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/stream-browserify/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/helpers.js\":[function(require,module,exports){\n(function (Buffer){\n'use strict';\nvar intSize = 4;\nvar zeroBuffer = new Buffer(intSize); zeroBuffer.fill(0);\nvar chrsz = 8;\n\nfunction toArray(buf, bigEndian) {\n if ((buf.length % intSize) !== 0) {\n var len = buf.length + (intSize - (buf.length % intSize));\n buf = Buffer.concat([buf, zeroBuffer], len);\n }\n\n var arr = [];\n var fn = bigEndian ? buf.readInt32BE : buf.readInt32LE;\n for (var i = 0; i < buf.length; i += intSize) {\n arr.push(fn.call(buf, i));\n }\n return arr;\n}\n\nfunction toBuffer(arr, size, bigEndian) {\n var buf = new Buffer(size);\n var fn = bigEndian ? buf.writeInt32BE : buf.writeInt32LE;\n for (var i = 0; i < arr.length; i++) {\n fn.call(buf, arr[i], i * 4, true);\n }\n return buf;\n}\n\nfunction hash(buf, fn, hashSize, bigEndian) {\n if (!Buffer.isBuffer(buf)) buf = new Buffer(buf);\n var arr = fn(toArray(buf, bigEndian), buf.length * chrsz);\n return toBuffer(arr, hashSize, bigEndian);\n}\nexports.hash = hash;\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/md5.js\":[function(require,module,exports){\n'use strict';\n/*\n * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\n * Digest Algorithm, as defined in RFC 1321.\n * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for more info.\n */\n\nvar helpers = require('./helpers');\n\n/*\n * Calculate the MD5 of an array of little-endian words, and a bit length\n */\nfunction core_md5(x, len)\n{\n /* append padding */\n x[len >> 5] |= 0x80 << ((len) % 32);\n x[(((len + 64) >>> 9) << 4) + 14] = len;\n\n var a = 1732584193;\n var b = -271733879;\n var c = -1732584194;\n var d = 271733878;\n\n for(var i = 0; i < x.length; i += 16)\n {\n var olda = a;\n var oldb = b;\n var oldc = c;\n var oldd = d;\n\n a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);\n d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);\n c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819);\n b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);\n a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);\n d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426);\n c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);\n b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);\n a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416);\n d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);\n c = md5_ff(c, d, a, b, x[i+10], 17, -42063);\n b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);\n a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682);\n d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);\n c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);\n b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329);\n\n a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);\n d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);\n c = md5_gg(c, d, a, b, x[i+11], 14, 643717713);\n b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);\n a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);\n d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083);\n c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);\n b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);\n a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438);\n d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);\n c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);\n b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501);\n a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);\n d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);\n c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473);\n b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);\n\n a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);\n d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);\n c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562);\n b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);\n a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);\n d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353);\n c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);\n b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);\n a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174);\n d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);\n c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);\n b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189);\n a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);\n d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);\n c = md5_hh(c, d, a, b, x[i+15], 16, 530742520);\n b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);\n\n a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);\n d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415);\n c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);\n b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);\n a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571);\n d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);\n c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);\n b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);\n a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359);\n d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);\n c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);\n b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649);\n a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);\n d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);\n c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259);\n b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);\n\n a = safe_add(a, olda);\n b = safe_add(b, oldb);\n c = safe_add(c, oldc);\n d = safe_add(d, oldd);\n }\n return Array(a, b, c, d);\n\n}\n\n/*\n * These functions implement the four basic operations the algorithm uses.\n */\nfunction md5_cmn(q, a, b, x, s, t)\n{\n return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);\n}\nfunction md5_ff(a, b, c, d, x, s, t)\n{\n return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);\n}\nfunction md5_gg(a, b, c, d, x, s, t)\n{\n return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);\n}\nfunction md5_hh(a, b, c, d, x, s, t)\n{\n return md5_cmn(b ^ c ^ d, a, b, x, s, t);\n}\nfunction md5_ii(a, b, c, d, x, s, t)\n{\n return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);\n}\n\n/*\n * Add integers, wrapping at 2^32. This uses 16-bit operations internally\n * to work around bugs in some JS interpreters.\n */\nfunction safe_add(x, y)\n{\n var lsw = (x & 0xFFFF) + (y & 0xFFFF);\n var msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n return (msw << 16) | (lsw & 0xFFFF);\n}\n\n/*\n * Bitwise rotate a 32-bit number to the left.\n */\nfunction bit_rol(num, cnt)\n{\n return (num << cnt) | (num >>> (32 - cnt));\n}\n\nmodule.exports = function md5(buf) {\n return helpers.hash(buf, core_md5, 16);\n};\n},{\"./helpers\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/helpers.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/ripemd160/lib/ripemd160.js\":[function(require,module,exports){\n(function (Buffer){\n/*\nCryptoJS v3.1.2\ncode.google.com/p/crypto-js\n(c) 2009-2013 by Jeff Mott. All rights reserved.\ncode.google.com/p/crypto-js/wiki/License\n*/\n/** @preserve\n(c) 2012 by Cédric Mesnil. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n - 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.\n\nTHIS 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.\n*/\n\n// constants table\nvar zl = [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,\n 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,\n 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,\n 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]\n\nvar zr = [\n 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,\n 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,\n 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,\n 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,\n 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]\n\nvar sl = [\n 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,\n 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,\n 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,\n 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,\n 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]\n\nvar sr = [\n 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,\n 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,\n 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,\n 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,\n 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]\n\n\nvar hl = [0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]\nvar hr = [0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]\n\nfunction bytesToWords(bytes) {\n var words = []\n for (var i = 0, b = 0; i < bytes.length; i++, b += 8) {\n words[b >>> 5] |= bytes[i] << (24 - b % 32)\n }\n return words\n}\n\nfunction wordsToBytes(words) {\n var bytes = []\n for (var b = 0; b < words.length * 32; b += 8) {\n bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF)\n }\n return bytes\n}\n\nfunction processBlock(H, M, offset) {\n // swap endian\n for (var i = 0; i < 16; i++) {\n var offset_i = offset + i;\n var M_offset_i = M[offset_i]\n\n // Swap\n M[offset_i] = (\n (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |\n (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)\n )\n }\n\n // Working variables\n var al, bl, cl, dl, el\n var ar, br, cr, dr, er\n\n ar = al = H[0]\n br = bl = H[1]\n cr = cl = H[2]\n dr = dl = H[3]\n er = el = H[4]\n\n // computation\n var t\n for (var i = 0; i < 80; i += 1) {\n t = (al + M[offset+zl[i]])|0\n if (i<16){\n t += f1(bl,cl,dl) + hl[0]\n } else if (i<32) {\n t += f2(bl,cl,dl) + hl[1]\n } else if (i<48) {\n t += f3(bl,cl,dl) + hl[2]\n } else if (i<64) {\n t += f4(bl,cl,dl) + hl[3]\n } else {// if (i<80) {\n t += f5(bl,cl,dl) + hl[4]\n }\n t = t|0\n t = rotl(t,sl[i])\n t = (t+el)|0\n al = el\n el = dl\n dl = rotl(cl, 10)\n cl = bl\n bl = t\n\n t = (ar + M[offset+zr[i]])|0\n if (i<16) {\n t += f5(br,cr,dr) + hr[0]\n } else if (i<32) {\n t += f4(br,cr,dr) + hr[1]\n } else if (i<48) {\n t += f3(br,cr,dr) + hr[2]\n } else if (i<64) {\n t += f2(br,cr,dr) + hr[3]\n } else {// if (i<80) {\n t += f1(br,cr,dr) + hr[4]\n }\n\n t = t|0\n t = rotl(t,sr[i]) \n t = (t+er)|0\n ar = er\n er = dr\n dr = rotl(cr, 10)\n cr = br\n br = t\n }\n\n // intermediate hash value\n t = (H[1] + cl + dr)|0\n H[1] = (H[2] + dl + er)|0\n H[2] = (H[3] + el + ar)|0\n H[3] = (H[4] + al + br)|0\n H[4] = (H[0] + bl + cr)|0\n H[0] = t\n}\n\nfunction f1(x, y, z) {\n return ((x) ^ (y) ^ (z))\n}\n\nfunction f2(x, y, z) {\n return (((x)&(y)) | ((~x)&(z)))\n}\n\nfunction f3(x, y, z) {\n return (((x) | (~(y))) ^ (z))\n}\n\nfunction f4(x, y, z) {\n return (((x) & (z)) | ((y)&(~(z))))\n}\n\nfunction f5(x, y, z) {\n return ((x) ^ ((y) |(~(z))))\n}\n\nfunction rotl(x,n) {\n return (x<>>(32-n))\n}\n\nfunction ripemd160(message) {\n var H = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]\n\n if (typeof message == 'string')\n message = new Buffer(message, 'utf8')\n\n var m = bytesToWords(message)\n\n var nBitsLeft = message.length * 8\n var nBitsTotal = message.length * 8\n\n // Add padding\n m[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32)\n m[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (\n (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) |\n (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00)\n )\n\n for (var i=0 ; i>> 24)) & 0x00ff00ff) |\n (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00)\n }\n\n var digestbytes = wordsToBytes(H)\n return new Buffer(digestbytes)\n}\n\nmodule.exports = ripemd160\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/hash.js\":[function(require,module,exports){\n(function (Buffer){\n//prototype class for hash functions\nfunction Hash (blockSize, finalSize) {\n this._block = new Buffer(blockSize) //new Uint32Array(blockSize/4)\n this._finalSize = finalSize\n this._blockSize = blockSize\n this._len = 0\n this._s = 0\n}\n\nHash.prototype.update = function (data, enc) {\n if (\"string\" === typeof data) {\n enc = enc || \"utf8\"\n data = new Buffer(data, enc)\n }\n\n var l = this._len += data.length\n var s = this._s || 0\n var f = 0\n var buffer = this._block\n\n while (s < l) {\n var t = Math.min(data.length, f + this._blockSize - (s % this._blockSize))\n var ch = (t - f)\n\n for (var i = 0; i < ch; i++) {\n buffer[(s % this._blockSize) + i] = data[i + f]\n }\n\n s += ch\n f += ch\n\n if ((s % this._blockSize) === 0) {\n this._update(buffer)\n }\n }\n this._s = s\n\n return this\n}\n\nHash.prototype.digest = function (enc) {\n // Suppose the length of the message M, in bits, is l\n var l = this._len * 8\n\n // Append the bit 1 to the end of the message\n this._block[this._len % this._blockSize] = 0x80\n\n // and then k zero bits, where k is the smallest non-negative solution to the equation (l + 1 + k) === finalSize mod blockSize\n this._block.fill(0, this._len % this._blockSize + 1)\n\n if (l % (this._blockSize * 8) >= this._finalSize * 8) {\n this._update(this._block)\n this._block.fill(0)\n }\n\n // to this append the block which is equal to the number l written in binary\n // TODO: handle case where l is > Math.pow(2, 29)\n this._block.writeInt32BE(l, this._blockSize - 4)\n\n var hash = this._update(this._block) || this._hash()\n\n return enc ? hash.toString(enc) : hash\n}\n\nHash.prototype._update = function () {\n throw new Error('_update must be implemented by subclass')\n}\n\nmodule.exports = Hash\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/index.js\":[function(require,module,exports){\nvar exports = module.exports = function (alg) {\n var Alg = exports[alg.toLowerCase()]\n if(!Alg) throw new Error(alg + ' is not supported (we accept pull requests)')\n return new Alg()\n}\n\n\nexports.sha1 = require('./sha1')\nexports.sha224 = require('./sha224')\nexports.sha256 = require('./sha256')\nexports.sha384 = require('./sha384')\nexports.sha512 = require('./sha512')\n\n},{\"./sha1\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha1.js\",\"./sha224\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha224.js\",\"./sha256\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha256.js\",\"./sha384\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha384.js\",\"./sha512\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha512.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha1.js\":[function(require,module,exports){\n(function (Buffer){\n/*\n * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined\n * in FIPS PUB 180-1\n * Version 2.1a Copyright Paul Johnston 2000 - 2002.\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for details.\n */\n\nvar inherits = require('inherits')\nvar Hash = require('./hash')\n\nvar W = new Array(80)\n\nfunction Sha1() {\n this.init()\n this._w = W\n\n Hash.call(this, 64, 56)\n}\n\ninherits(Sha1, Hash)\n\nSha1.prototype.init = function () {\n this._a = 0x67452301\n this._b = 0xefcdab89\n this._c = 0x98badcfe\n this._d = 0x10325476\n this._e = 0xc3d2e1f0\n\n return this\n}\n\n/*\n * Bitwise rotate a 32-bit number to the left.\n */\nfunction rol(num, cnt) {\n return (num << cnt) | (num >>> (32 - cnt));\n}\n\nSha1.prototype._update = function (M) {\n var W = this._w\n\n var a = this._a\n var b = this._b\n var c = this._c\n var d = this._d\n var e = this._e\n\n var j = 0, k\n\n function calcW() { return rol(W[j - 3] ^ W[j - 8] ^ W[j - 14] ^ W[j - 16], 1) }\n function loop(w, f) {\n W[j] = w\n\n var t = rol(a, 5) + f + e + w + k\n\n e = d\n d = c\n c = rol(b, 30)\n b = a\n a = t\n j++\n }\n\n k = 1518500249\n while (j < 16) loop(M.readInt32BE(j * 4), (b & c) | ((~b) & d))\n while (j < 20) loop(calcW(), (b & c) | ((~b) & d))\n k = 1859775393\n while (j < 40) loop(calcW(), b ^ c ^ d)\n k = -1894007588\n while (j < 60) loop(calcW(), (b & c) | (b & d) | (c & d))\n k = -899497514\n while (j < 80) loop(calcW(), b ^ c ^ d)\n\n this._a = (a + this._a) | 0\n this._b = (b + this._b) | 0\n this._c = (c + this._c) | 0\n this._d = (d + this._d) | 0\n this._e = (e + this._e) | 0\n}\n\nSha1.prototype._hash = function () {\n var H = new Buffer(20)\n\n H.writeInt32BE(this._a|0, 0)\n H.writeInt32BE(this._b|0, 4)\n H.writeInt32BE(this._c|0, 8)\n H.writeInt32BE(this._d|0, 12)\n H.writeInt32BE(this._e|0, 16)\n\n return H\n}\n\nmodule.exports = Sha1\n\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/hash.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha224.js\":[function(require,module,exports){\n(function (Buffer){\n/**\n * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined\n * in FIPS 180-2\n * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n *\n */\n\nvar inherits = require('inherits')\nvar SHA256 = require('./sha256')\nvar Hash = require('./hash')\n\nvar W = new Array(64)\n\nfunction Sha224() {\n this.init()\n\n this._w = W // new Array(64)\n\n Hash.call(this, 64, 56)\n}\n\ninherits(Sha224, SHA256)\n\nSha224.prototype.init = function () {\n this._a = 0xc1059ed8|0\n this._b = 0x367cd507|0\n this._c = 0x3070dd17|0\n this._d = 0xf70e5939|0\n this._e = 0xffc00b31|0\n this._f = 0x68581511|0\n this._g = 0x64f98fa7|0\n this._h = 0xbefa4fa4|0\n\n return this\n}\n\nSha224.prototype._hash = function () {\n var H = new Buffer(28)\n\n H.writeInt32BE(this._a, 0)\n H.writeInt32BE(this._b, 4)\n H.writeInt32BE(this._c, 8)\n H.writeInt32BE(this._d, 12)\n H.writeInt32BE(this._e, 16)\n H.writeInt32BE(this._f, 20)\n H.writeInt32BE(this._g, 24)\n\n return H\n}\n\nmodule.exports = Sha224\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/hash.js\",\"./sha256\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha256.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha256.js\":[function(require,module,exports){\n(function (Buffer){\n/**\n * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined\n * in FIPS 180-2\n * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n *\n */\n\nvar inherits = require('inherits')\nvar Hash = require('./hash')\n\nvar K = [\n 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,\n 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,\n 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,\n 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,\n 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,\n 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,\n 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,\n 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,\n 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,\n 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,\n 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,\n 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,\n 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,\n 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,\n 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,\n 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2\n]\n\nvar W = new Array(64)\n\nfunction Sha256() {\n this.init()\n\n this._w = W // new Array(64)\n\n Hash.call(this, 64, 56)\n}\n\ninherits(Sha256, Hash)\n\nSha256.prototype.init = function () {\n this._a = 0x6a09e667|0\n this._b = 0xbb67ae85|0\n this._c = 0x3c6ef372|0\n this._d = 0xa54ff53a|0\n this._e = 0x510e527f|0\n this._f = 0x9b05688c|0\n this._g = 0x1f83d9ab|0\n this._h = 0x5be0cd19|0\n\n return this\n}\n\nfunction S (X, n) {\n return (X >>> n) | (X << (32 - n));\n}\n\nfunction R (X, n) {\n return (X >>> n);\n}\n\nfunction Ch (x, y, z) {\n return ((x & y) ^ ((~x) & z));\n}\n\nfunction Maj (x, y, z) {\n return ((x & y) ^ (x & z) ^ (y & z));\n}\n\nfunction Sigma0256 (x) {\n return (S(x, 2) ^ S(x, 13) ^ S(x, 22));\n}\n\nfunction Sigma1256 (x) {\n return (S(x, 6) ^ S(x, 11) ^ S(x, 25));\n}\n\nfunction Gamma0256 (x) {\n return (S(x, 7) ^ S(x, 18) ^ R(x, 3));\n}\n\nfunction Gamma1256 (x) {\n return (S(x, 17) ^ S(x, 19) ^ R(x, 10));\n}\n\nSha256.prototype._update = function(M) {\n var W = this._w\n\n var a = this._a | 0\n var b = this._b | 0\n var c = this._c | 0\n var d = this._d | 0\n var e = this._e | 0\n var f = this._f | 0\n var g = this._g | 0\n var h = this._h | 0\n\n var j = 0\n\n function calcW() { return Gamma1256(W[j - 2]) + W[j - 7] + Gamma0256(W[j - 15]) + W[j - 16] }\n function loop(w) {\n W[j] = w\n\n var T1 = h + Sigma1256(e) + Ch(e, f, g) + K[j] + w\n var T2 = Sigma0256(a) + Maj(a, b, c);\n\n h = g;\n g = f;\n f = e;\n e = d + T1;\n d = c;\n c = b;\n b = a;\n a = T1 + T2;\n\n j++\n }\n\n while (j < 16) loop(M.readInt32BE(j * 4))\n while (j < 64) loop(calcW())\n\n this._a = (a + this._a) | 0\n this._b = (b + this._b) | 0\n this._c = (c + this._c) | 0\n this._d = (d + this._d) | 0\n this._e = (e + this._e) | 0\n this._f = (f + this._f) | 0\n this._g = (g + this._g) | 0\n this._h = (h + this._h) | 0\n};\n\nSha256.prototype._hash = function () {\n var H = new Buffer(32)\n\n H.writeInt32BE(this._a, 0)\n H.writeInt32BE(this._b, 4)\n H.writeInt32BE(this._c, 8)\n H.writeInt32BE(this._d, 12)\n H.writeInt32BE(this._e, 16)\n H.writeInt32BE(this._f, 20)\n H.writeInt32BE(this._g, 24)\n H.writeInt32BE(this._h, 28)\n\n return H\n}\n\nmodule.exports = Sha256\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/hash.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha384.js\":[function(require,module,exports){\n(function (Buffer){\nvar inherits = require('inherits')\nvar SHA512 = require('./sha512');\nvar Hash = require('./hash')\n\nvar W = new Array(160)\n\nfunction Sha384() {\n this.init()\n this._w = W\n\n Hash.call(this, 128, 112)\n}\n\ninherits(Sha384, SHA512)\n\nSha384.prototype.init = function () {\n this._a = 0xcbbb9d5d|0\n this._b = 0x629a292a|0\n this._c = 0x9159015a|0\n this._d = 0x152fecd8|0\n this._e = 0x67332667|0\n this._f = 0x8eb44a87|0\n this._g = 0xdb0c2e0d|0\n this._h = 0x47b5481d|0\n\n this._al = 0xc1059ed8|0\n this._bl = 0x367cd507|0\n this._cl = 0x3070dd17|0\n this._dl = 0xf70e5939|0\n this._el = 0xffc00b31|0\n this._fl = 0x68581511|0\n this._gl = 0x64f98fa7|0\n this._hl = 0xbefa4fa4|0\n\n return this\n}\n\nSha384.prototype._hash = function () {\n var H = new Buffer(48)\n\n function writeInt64BE(h, l, offset) {\n H.writeInt32BE(h, offset)\n H.writeInt32BE(l, offset + 4)\n }\n\n writeInt64BE(this._a, this._al, 0)\n writeInt64BE(this._b, this._bl, 8)\n writeInt64BE(this._c, this._cl, 16)\n writeInt64BE(this._d, this._dl, 24)\n writeInt64BE(this._e, this._el, 32)\n writeInt64BE(this._f, this._fl, 40)\n\n return H\n}\n\nmodule.exports = Sha384\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/hash.js\",\"./sha512\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha512.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha512.js\":[function(require,module,exports){\n(function (Buffer){\nvar inherits = require('inherits')\nvar Hash = require('./hash')\n\nvar K = [\n 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,\n 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,\n 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,\n 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,\n 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,\n 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,\n 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,\n 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,\n 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,\n 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,\n 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,\n 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,\n 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,\n 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,\n 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,\n 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,\n 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,\n 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,\n 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,\n 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,\n 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,\n 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,\n 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,\n 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,\n 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,\n 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,\n 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,\n 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,\n 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,\n 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,\n 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,\n 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,\n 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,\n 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,\n 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,\n 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,\n 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,\n 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,\n 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,\n 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817\n]\n\nvar W = new Array(160)\n\nfunction Sha512() {\n this.init()\n this._w = W\n\n Hash.call(this, 128, 112)\n}\n\ninherits(Sha512, Hash)\n\nSha512.prototype.init = function () {\n this._a = 0x6a09e667|0\n this._b = 0xbb67ae85|0\n this._c = 0x3c6ef372|0\n this._d = 0xa54ff53a|0\n this._e = 0x510e527f|0\n this._f = 0x9b05688c|0\n this._g = 0x1f83d9ab|0\n this._h = 0x5be0cd19|0\n\n this._al = 0xf3bcc908|0\n this._bl = 0x84caa73b|0\n this._cl = 0xfe94f82b|0\n this._dl = 0x5f1d36f1|0\n this._el = 0xade682d1|0\n this._fl = 0x2b3e6c1f|0\n this._gl = 0xfb41bd6b|0\n this._hl = 0x137e2179|0\n\n return this\n}\n\nfunction S (X, Xl, n) {\n return (X >>> n) | (Xl << (32 - n))\n}\n\nfunction Ch (x, y, z) {\n return ((x & y) ^ ((~x) & z));\n}\n\nfunction Maj (x, y, z) {\n return ((x & y) ^ (x & z) ^ (y & z));\n}\n\nSha512.prototype._update = function(M) {\n var W = this._w\n\n var a = this._a | 0\n var b = this._b | 0\n var c = this._c | 0\n var d = this._d | 0\n var e = this._e | 0\n var f = this._f | 0\n var g = this._g | 0\n var h = this._h | 0\n\n var al = this._al | 0\n var bl = this._bl | 0\n var cl = this._cl | 0\n var dl = this._dl | 0\n var el = this._el | 0\n var fl = this._fl | 0\n var gl = this._gl | 0\n var hl = this._hl | 0\n\n var i = 0, j = 0\n var Wi, Wil\n function calcW() {\n var x = W[j - 15*2]\n var xl = W[j - 15*2 + 1]\n var gamma0 = S(x, xl, 1) ^ S(x, xl, 8) ^ (x >>> 7)\n var gamma0l = S(xl, x, 1) ^ S(xl, x, 8) ^ S(xl, x, 7)\n\n x = W[j - 2*2]\n xl = W[j - 2*2 + 1]\n var gamma1 = S(x, xl, 19) ^ S(xl, x, 29) ^ (x >>> 6)\n var gamma1l = S(xl, x, 19) ^ S(x, xl, 29) ^ S(xl, x, 6)\n\n // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]\n var Wi7 = W[j - 7*2]\n var Wi7l = W[j - 7*2 + 1]\n\n var Wi16 = W[j - 16*2]\n var Wi16l = W[j - 16*2 + 1]\n\n Wil = gamma0l + Wi7l\n Wi = gamma0 + Wi7 + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0)\n Wil = Wil + gamma1l\n Wi = Wi + gamma1 + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0)\n Wil = Wil + Wi16l\n Wi = Wi + Wi16 + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0)\n }\n\n function loop() {\n W[j] = Wi\n W[j + 1] = Wil\n\n var maj = Maj(a, b, c)\n var majl = Maj(al, bl, cl)\n\n var sigma0h = S(a, al, 28) ^ S(al, a, 2) ^ S(al, a, 7)\n var sigma0l = S(al, a, 28) ^ S(a, al, 2) ^ S(a, al, 7)\n var sigma1h = S(e, el, 14) ^ S(e, el, 18) ^ S(el, e, 9)\n var sigma1l = S(el, e, 14) ^ S(el, e, 18) ^ S(e, el, 9)\n\n // t1 = h + sigma1 + ch + K[i] + W[i]\n var Ki = K[j]\n var Kil = K[j + 1]\n\n var ch = Ch(e, f, g)\n var chl = Ch(el, fl, gl)\n\n var t1l = hl + sigma1l\n var t1 = h + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0)\n t1l = t1l + chl\n t1 = t1 + ch + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0)\n t1l = t1l + Kil\n t1 = t1 + Ki + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0)\n t1l = t1l + Wil\n t1 = t1 + Wi + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0)\n\n // t2 = sigma0 + maj\n var t2l = sigma0l + majl\n var t2 = sigma0h + maj + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0)\n\n h = g\n hl = gl\n g = f\n gl = fl\n f = e\n fl = el\n el = (dl + t1l) | 0\n e = (d + t1 + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0\n d = c\n dl = cl\n c = b\n cl = bl\n b = a\n bl = al\n al = (t1l + t2l) | 0\n a = (t1 + t2 + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0\n\n i++\n j += 2\n }\n\n while (i < 16) {\n Wi = M.readInt32BE(j * 4)\n Wil = M.readInt32BE(j * 4 + 4)\n\n loop()\n }\n\n while (i < 80) {\n calcW()\n loop()\n }\n\n this._al = (this._al + al) | 0\n this._bl = (this._bl + bl) | 0\n this._cl = (this._cl + cl) | 0\n this._dl = (this._dl + dl) | 0\n this._el = (this._el + el) | 0\n this._fl = (this._fl + fl) | 0\n this._gl = (this._gl + gl) | 0\n this._hl = (this._hl + hl) | 0\n\n this._a = (this._a + a + ((this._al >>> 0) < (al >>> 0) ? 1 : 0)) | 0\n this._b = (this._b + b + ((this._bl >>> 0) < (bl >>> 0) ? 1 : 0)) | 0\n this._c = (this._c + c + ((this._cl >>> 0) < (cl >>> 0) ? 1 : 0)) | 0\n this._d = (this._d + d + ((this._dl >>> 0) < (dl >>> 0) ? 1 : 0)) | 0\n this._e = (this._e + e + ((this._el >>> 0) < (el >>> 0) ? 1 : 0)) | 0\n this._f = (this._f + f + ((this._fl >>> 0) < (fl >>> 0) ? 1 : 0)) | 0\n this._g = (this._g + g + ((this._gl >>> 0) < (gl >>> 0) ? 1 : 0)) | 0\n this._h = (this._h + h + ((this._hl >>> 0) < (hl >>> 0) ? 1 : 0)) | 0\n}\n\nSha512.prototype._hash = function () {\n var H = new Buffer(64)\n\n function writeInt64BE(h, l, offset) {\n H.writeInt32BE(h, offset)\n H.writeInt32BE(l, offset + 4)\n }\n\n writeInt64BE(this._a, this._al, 0)\n writeInt64BE(this._b, this._bl, 8)\n writeInt64BE(this._c, this._cl, 16)\n writeInt64BE(this._d, this._dl, 24)\n writeInt64BE(this._e, this._el, 32)\n writeInt64BE(this._f, this._fl, 40)\n writeInt64BE(this._g, this._gl, 48)\n writeInt64BE(this._h, this._hl, 56)\n\n return H\n}\n\nmodule.exports = Sha512\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/hash.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hmac/browser.js\":[function(require,module,exports){\n(function (Buffer){\n'use strict';\nvar createHash = require('create-hash/browser');\nvar inherits = require('inherits')\n\nvar Transform = require('stream').Transform\n\nvar ZEROS = new Buffer(128)\nZEROS.fill(0)\n\nfunction Hmac(alg, key) {\n Transform.call(this)\n\n if (typeof key === 'string') {\n key = new Buffer(key)\n }\n\n var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64\n\n this._alg = alg\n this._key = key\n\n if (key.length > blocksize) {\n key = createHash(alg).update(key).digest()\n\n } else if (key.length < blocksize) {\n key = Buffer.concat([key, ZEROS], blocksize)\n }\n\n var ipad = this._ipad = new Buffer(blocksize)\n var opad = this._opad = new Buffer(blocksize)\n\n for (var i = 0; i < blocksize; i++) {\n ipad[i] = key[i] ^ 0x36\n opad[i] = key[i] ^ 0x5C\n }\n\n this._hash = createHash(alg).update(ipad)\n}\n\ninherits(Hmac, Transform)\n\nHmac.prototype.update = function (data, enc) {\n this._hash.update(data, enc)\n\n return this\n}\n\nHmac.prototype._transform = function (data, _, next) {\n this._hash.update(data)\n\n next()\n}\n\nHmac.prototype._flush = function (next) {\n this.push(this.digest())\n\n next()\n}\n\nHmac.prototype.digest = function (enc) {\n var h = this._hash.digest()\n\n return createHash(this._alg).update(this._opad).update(h).digest(enc)\n}\n\nmodule.exports = function createHmac(alg, key) {\n return new Hmac(alg, key)\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"create-hash/browser\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/browser.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\",\"stream\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/stream-browserify/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/browser.js\":[function(require,module,exports){\n(function (Buffer){\nvar generatePrime = require('./lib/generatePrime');\nvar primes = require('./lib/primes');\n\nvar DH = require('./lib/dh');\n\nfunction getDiffieHellman(mod) {\n var prime = new Buffer(primes[mod].prime, 'hex');\n var gen = new Buffer(primes[mod].gen, 'hex');\n\n return new DH(prime, gen);\n}\n\nfunction createDiffieHellman(prime, enc, generator, genc) {\n if (Buffer.isBuffer(enc) || (typeof enc === 'string' && ['hex', 'binary', 'base64'].indexOf(enc) === -1)) {\n genc = generator;\n generator = enc;\n enc = undefined;\n }\n\n enc = enc || 'binary';\n genc = genc || 'binary';\n generator = generator || new Buffer([2]);\n\n if (!Buffer.isBuffer(generator)) {\n generator = new Buffer(generator, genc);\n }\n\n if (typeof prime === 'number') {\n return new DH(generatePrime(prime, generator), generator, true);\n }\n\n if (!Buffer.isBuffer(prime)) {\n prime = new Buffer(prime, enc);\n }\n\n return new DH(prime, generator, true);\n}\n\nexports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman;\nexports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman;\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./lib/dh\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/dh.js\",\"./lib/generatePrime\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/generatePrime.js\",\"./lib/primes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/primes.json\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/dh.js\":[function(require,module,exports){\n(function (Buffer){\nvar BN = require('bn.js');\nvar MillerRabin = require('miller-rabin');\nvar millerRabin = new MillerRabin();\nvar TWENTYFOUR = new BN(24);\nvar ELEVEN = new BN(11);\nvar TEN = new BN(10);\nvar THREE = new BN(3);\nvar SEVEN = new BN(7);\nvar primes = require('./generatePrime');\nvar randomBytes = require('randombytes');\nmodule.exports = DH;\n\nfunction setPublicKey(pub, enc) {\n enc = enc || 'utf8';\n if (!Buffer.isBuffer(pub)) {\n pub = new Buffer(pub, enc);\n }\n this._pub = new BN(pub);\n return this;\n}\n\nfunction setPrivateKey(priv, enc) {\n enc = enc || 'utf8';\n if (!Buffer.isBuffer(priv)) {\n priv = new Buffer(priv, enc);\n }\n this._priv = new BN(priv);\n return this;\n}\n\nvar primeCache = {};\nfunction checkPrime(prime, generator) {\n var gen = generator.toString('hex');\n var hex = [gen, prime.toString(16)].join('_');\n if (hex in primeCache) {\n return primeCache[hex];\n }\n var error = 0;\n \n if (prime.isEven() ||\n !primes.simpleSieve ||\n !primes.fermatTest(prime) ||\n !millerRabin.test(prime)) {\n //not a prime so +1\n error += 1;\n \n if (gen === '02' || gen === '05') {\n // we'd be able to check the generator\n // it would fail so +8\n error += 8;\n } else {\n //we wouldn't be able to test the generator\n // so +4\n error += 4;\n }\n primeCache[hex] = error;\n return error;\n }\n if (!millerRabin.test(prime.shrn(1))) {\n //not a safe prime\n error += 2;\n }\n var rem;\n switch (gen) {\n case '02':\n if (prime.mod(TWENTYFOUR).cmp(ELEVEN)) {\n // unsuidable generator\n error += 8;\n }\n break;\n case '05':\n rem = prime.mod(TEN);\n if (rem.cmp(THREE) && rem.cmp(SEVEN)) {\n // prime mod 10 needs to equal 3 or 7\n error += 8;\n } \n break;\n default: \n error += 4;\n }\n primeCache[hex] = error;\n return error;\n}\n\nfunction defineError (self, error) {\n try {\n Object.defineProperty(self, 'verifyError', {\n enumerable: true,\n value: error,\n writable: false\n });\n } catch(e) {\n self.verifyError = error;\n }\n}\nfunction DH(prime, generator, malleable) {\n this.setGenerator(generator);\n this.__prime = new BN(prime);\n this._prime = BN.mont(this.__prime);\n this._primeLen = prime.length;\n this._pub = void 0;\n this._priv = void 0;\n \n if (malleable) {\n this.setPublicKey = setPublicKey;\n this.setPrivateKey = setPrivateKey;\n defineError(this, checkPrime(this.__prime, generator));\n } else {\n defineError(this, 8);\n }\n}\n\nDH.prototype.generateKeys = function () {\n if (!this._priv) {\n this._priv = new BN(randomBytes(this._primeLen));\n }\n this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed();\n return this.getPublicKey();\n};\n\nDH.prototype.computeSecret = function (other) {\n other = new BN(other);\n other = other.toRed(this._prime);\n var secret = other.redPow(this._priv).fromRed();\n var out = new Buffer(secret.toArray());\n var prime = this.getPrime();\n if (out.length < prime.length) {\n var front = new Buffer(prime.length - out.length);\n front.fill(0);\n out = Buffer.concat([front, out]);\n }\n return out;\n};\n\nDH.prototype.getPublicKey = function getPublicKey(enc) {\n return formatReturnValue(this._pub, enc);\n};\n\nDH.prototype.getPrivateKey = function getPrivateKey(enc) {\n return formatReturnValue(this._priv, enc);\n};\n\nDH.prototype.getPrime = function (enc) {\n return formatReturnValue(this.__prime, enc);\n};\n\nDH.prototype.getGenerator = function (enc) {\n return formatReturnValue(this._gen, enc);\n};\n\nDH.prototype.setGenerator = function (gen, enc) {\n enc = enc || 'utf8';\n if (!Buffer.isBuffer(gen)) {\n gen = new Buffer(gen, enc);\n }\n this._gen = new BN(gen);\n return this;\n};\n\nfunction formatReturnValue(bn, enc) {\n var buf = new Buffer(bn.toArray());\n if (!enc) {\n return buf;\n } else {\n return buf.toString(enc);\n }\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"./generatePrime\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/generatePrime.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"miller-rabin\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/lib/mr.js\",\"randombytes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/randombytes/browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/generatePrime.js\":[function(require,module,exports){\nvar randomBytes = require('randombytes');\nmodule.exports = findPrime;\nfindPrime.simpleSieve = simpleSieve;\nfindPrime.fermatTest = fermatTest;\nvar BN = require('bn.js');\nvar TWENTYFOUR = new BN(24);\nvar MillerRabin = require('miller-rabin');\nvar millerRabin = new MillerRabin();\nvar ONE = new BN(1);\nvar TWO = new BN(2);\nvar FIVE = new BN(5);\nvar SIXTEEN = new BN(16);\nvar EIGHT = new BN(8);\nvar TEN = new BN(10);\nvar THREE = new BN(3);\nvar SEVEN = new BN(7);\nvar ELEVEN = new BN(11);\nvar FOUR = new BN(4);\nvar TWELVE = new BN(12);\nvar primes = null;\n\nfunction _getPrimes() {\n if (primes !== null)\n return primes;\n\n var limit = 0x100000;\n var res = [];\n res[0] = 2;\n for (var i = 1, k = 3; k < limit; k += 2) {\n var sqrt = Math.ceil(Math.sqrt(k));\n for (var j = 0; j < i && res[j] <= sqrt; j++)\n if (k % res[j] === 0)\n break;\n\n if (i !== j && res[j] <= sqrt)\n continue;\n\n res[i++] = k;\n }\n primes = res;\n return res;\n}\n\nfunction simpleSieve(p) {\n var primes = _getPrimes();\n\n for (var i = 0; i < primes.length; i++)\n if (p.modn(primes[i]) === 0) {\n if (p.cmpn(primes[i]) === 0) {\n return true;\n } else {\n return false;\n }\n }\n\n return true;\n}\n\nfunction fermatTest(p) {\n var red = BN.mont(p);\n return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0;\n}\n\nfunction findPrime(bits, gen) {\n if (bits < 16) {\n // this is what openssl does\n if (gen === 2 || gen === 5) {\n return new BN([0x8c, 0x7b]);\n } else {\n return new BN([0x8c, 0x27]);\n }\n }\n gen = new BN(gen);\n var runs, comp;\n function generateRandom(bits) {\n runs = -1;\n var out = new BN(randomBytes(Math.ceil(bits / 8)));\n while (out.bitLength() > bits) {\n out.ishrn(1);\n }\n if (out.isEven()) {\n out.iadd(ONE);\n }\n if (!out.testn(1)) {\n out.iadd(TWO);\n }\n if (!gen.cmp(TWO)) {\n while (out.mod(TWENTYFOUR).cmp(ELEVEN)) {\n out.iadd(FOUR);\n }\n comp = {\n major: [TWENTYFOUR],\n minor: [TWELVE]\n };\n } else if (!gen.cmp(FIVE)) {\n rem = out.mod(TEN);\n while (rem.cmp(THREE)) {\n out.iadd(FOUR);\n rem = out.mod(TEN);\n }\n comp = {\n major: [FOUR, SIXTEEN],\n minor: [TWO, EIGHT]\n };\n } else {\n comp = {\n major: [FOUR],\n minor: [TWO]\n };\n }\n return out;\n }\n var num = generateRandom(bits);\n\n var n2 = num.shrn(1);\n\n while (true) {\n while (num.bitLength() > bits) {\n num = generateRandom(bits);\n n2 = num.shrn(1);\n }\n runs++;\n if (simpleSieve(n2) && simpleSieve(num) &&\n fermatTest(n2) && fermatTest(num) &&\n millerRabin.test(n2) && millerRabin.test(num)) {\n return num;\n }\n num.iadd(comp.major[runs%comp.major.length]);\n n2.iadd(comp.minor[runs%comp.minor.length]);\n }\n\n}\n},{\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js\",\"miller-rabin\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/lib/mr.js\",\"randombytes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/randombytes/browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/primes.json\":[function(require,module,exports){\nmodule.exports={\n \"modp1\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff\"\n },\n \"modp2\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff\"\n },\n \"modp5\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff\"\n },\n \"modp14\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff\"\n },\n \"modp15\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff\"\n },\n \"modp16\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff\"\n },\n \"modp17\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff\"\n },\n \"modp18\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff\"\n }\n}\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\"][0].apply(exports,arguments)\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/lib/mr.js\":[function(require,module,exports){\nvar bn = require('bn.js');\nvar brorand = require('brorand');\n\nfunction MillerRabin(rand) {\n this.rand = rand || new brorand.Rand();\n}\nmodule.exports = MillerRabin;\n\nMillerRabin.create = function create(rand) {\n return new MillerRabin(rand);\n};\n\nMillerRabin.prototype._rand = function _rand(n) {\n var len = n.bitLength();\n var buf = this.rand.generate(Math.ceil(len / 8));\n\n // Set low bits\n buf[0] |= 3;\n\n // Mask high bits\n var mask = len & 0x7;\n if (mask !== 0)\n buf[buf.length - 1] >>= 7 - mask;\n\n return new bn(buf);\n}\n\nMillerRabin.prototype.test = function test(n, k, cb) {\n var len = n.bitLength();\n var red = bn.mont(n);\n var rone = new bn(1).toRed(red);\n\n if (!k)\n k = Math.max(1, (len / 48) | 0);\n\n // Find d and s, (n - 1) = (2 ^ s) * d;\n var n1 = n.subn(1);\n var n2 = n1.subn(1);\n for (var s = 0; !n1.testn(s); s++) {}\n var d = n.shrn(s);\n\n var rn1 = n1.toRed(red);\n\n var prime = true;\n for (; k > 0; k--) {\n var a = this._rand(n2);\n if (cb)\n cb(a);\n\n var x = a.toRed(red).redPow(d);\n if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)\n continue;\n\n for (var i = 1; i < s; i++) {\n x = x.redSqr();\n\n if (x.cmp(rone) === 0)\n return false;\n if (x.cmp(rn1) === 0)\n break;\n }\n\n if (i === s)\n return false;\n }\n\n return prime;\n};\n\nMillerRabin.prototype.getDivisor = function getDivisor(n, k) {\n var len = n.bitLength();\n var red = bn.mont(n);\n var rone = new bn(1).toRed(red);\n\n if (!k)\n k = Math.max(1, (len / 48) | 0);\n\n // Find d and s, (n - 1) = (2 ^ s) * d;\n var n1 = n.subn(1);\n var n2 = n1.subn(1);\n for (var s = 0; !n1.testn(s); s++) {}\n var d = n.shrn(s);\n\n var rn1 = n1.toRed(red);\n\n var prime = true;\n for (; k > 0; k--) {\n var a = this._rand(n2);\n\n var g = n.gcd(a);\n if (g.cmpn(1) !== 0)\n return g;\n\n var x = a.toRed(red).redPow(d);\n if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)\n continue;\n\n for (var i = 1; i < s; i++) {\n x = x.redSqr();\n\n if (x.cmp(rone) === 0)\n return x.fromRed().subn(1).gcd(n);\n if (x.cmp(rn1) === 0)\n break;\n }\n\n if (i === s) {\n x = x.redSqr();\n return x.fromRed().subn(1).gcd(n);\n }\n }\n\n return prime;\n};\n\n},{\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js\",\"brorand\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/node_modules/brorand/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/node_modules/brorand/index.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/index.js\"][0].apply(exports,arguments)\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/pbkdf2-compat/browser.js\":[function(require,module,exports){\n(function (Buffer){\nvar createHmac = require('create-hmac')\n\nexports.pbkdf2 = pbkdf2\nfunction pbkdf2 (password, salt, iterations, keylen, digest, callback) {\n if (typeof digest === 'function') {\n callback = digest\n digest = undefined\n }\n\n if (typeof callback !== 'function') {\n throw new Error('No callback provided to pbkdf2')\n }\n\n var result = pbkdf2Sync(password, salt, iterations, keylen, digest)\n setTimeout(function () {\n callback(undefined, result)\n })\n}\n\nexports.pbkdf2Sync = pbkdf2Sync\nfunction pbkdf2Sync (password, salt, iterations, keylen, digest) {\n if (typeof iterations !== 'number')\n throw new TypeError('Iterations not a number')\n\n if (iterations < 0)\n throw new TypeError('Bad iterations')\n\n if (typeof keylen !== 'number')\n throw new TypeError('Key length not a number')\n\n if (keylen < 0)\n throw new TypeError('Bad key length')\n\n digest = digest || 'sha1'\n\n if (!Buffer.isBuffer(password)) password = new Buffer(password)\n if (!Buffer.isBuffer(salt)) salt = new Buffer(salt)\n\n var hLen\n var l = 1\n var DK = new Buffer(keylen)\n var block1 = new Buffer(salt.length + 4)\n salt.copy(block1, 0, 0, salt.length)\n\n var r\n var T\n\n for (var i = 1; i <= l; i++) {\n block1.writeUInt32BE(i, salt.length)\n var U = createHmac(digest, password).update(block1).digest()\n\n if (!hLen) {\n hLen = U.length\n T = new Buffer(hLen)\n l = Math.ceil(keylen / hLen)\n r = keylen - (l - 1) * hLen\n\n if (keylen > (Math.pow(2, 32) - 1) * hLen)\n throw new TypeError('keylen exceeds maximum length')\n }\n\n U.copy(T, 0, 0, hLen)\n\n for (var j = 1; j < iterations; j++) {\n U = createHmac(digest, password).update(U).digest()\n\n for (var k = 0; k < hLen; k++) {\n T[k] ^= U[k]\n }\n }\n\n var destPos = (i - 1) * hLen\n var len = (i === l ? r : hLen)\n T.copy(DK, destPos, 0, len)\n }\n\n return DK\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"create-hmac\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hmac/browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/browser.js\":[function(require,module,exports){\nexports.publicEncrypt = require('./publicEncrypt');\nexports.privateDecrypt = require('./privateDecrypt');\n\nexports.privateEncrypt = function privateEncrypt(key, buf) {\n return exports.publicEncrypt(key, buf, true);\n};\n\nexports.publicDecrypt = function publicDecrypt(key, buf) {\n return exports.privateDecrypt(key, buf, true);\n};\n},{\"./privateDecrypt\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/privateDecrypt.js\",\"./publicEncrypt\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/publicEncrypt.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/mgf.js\":[function(require,module,exports){\n(function (Buffer){\nvar createHash = require('create-hash');\nmodule.exports = function (seed, len) {\n var t = new Buffer('');\n var i = 0, c;\n while (t.length < len) {\n c = i2ops(i++);\n t = Buffer.concat([t, createHash('sha1').update(seed).update(c).digest()]);\n }\n return t.slice(0, len);\n};\n\nfunction i2ops(c) {\n var out = new Buffer(4);\n out.writeUInt32BE(c,0);\n return out;\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"create-hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/lib/bn.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\"][0].apply(exports,arguments)\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/browserify-rsa/index.js\":[function(require,module,exports){\n(function (Buffer){\nvar bn = require('bn.js');\nvar randomBytes = require('randombytes');\nmodule.exports = crt;\nfunction blind(priv) {\n var r = getr(priv);\n var blinder = r.toRed(bn.mont(priv.modulus))\n .redPow(new bn(priv.publicExponent)).fromRed();\n return {\n blinder: blinder,\n unblinder:r.invm(priv.modulus)\n };\n}\nfunction crt(msg, priv) {\n var blinds = blind(priv);\n var len = priv.modulus.byteLength();\n var mod = bn.mont(priv.modulus);\n var blinded = new bn(msg).mul(blinds.blinder).mod(priv.modulus);\n var c1 = blinded.toRed(bn.mont(priv.prime1));\n var c2 = blinded.toRed(bn.mont(priv.prime2));\n var qinv = priv.coefficient;\n var p = priv.prime1;\n var q = priv.prime2;\n var m1 = c1.redPow(priv.exponent1);\n var m2 = c2.redPow(priv.exponent2);\n m1 = m1.fromRed();\n m2 = m2.fromRed();\n var h = m1.isub(m2).imul(qinv).mod(p);\n h.imul(q);\n m2.iadd(h);\n var out = new Buffer(m2.imul(blinds.unblinder).mod(priv.modulus).toArray());\n if (out.length < len) {\n var prefix = new Buffer(len - out.length);\n prefix.fill(0);\n out = Buffer.concat([prefix, out], len);\n }\n return out;\n}\ncrt.getr = getr;\nfunction getr(priv) {\n var len = priv.modulus.byteLength();\n var r = new bn(randomBytes(len));\n while (r.cmp(priv.modulus) >= 0 || !r.mod(priv.prime1) || !r.mod(priv.prime2)) {\n r = new bn(randomBytes(len));\n }\n return r;\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/lib/bn.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"randombytes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/randombytes/browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/EVP_BytesToKey.js\":[function(require,module,exports){\n(function (Buffer){\nvar createHash = require('create-hash');\nmodule.exports = function evp(password, salt, keyLen) {\n keyLen = keyLen/8;\n var ki = 0;\n var ii = 0;\n var key = new Buffer(keyLen);\n var addmd = 0;\n var md, md_buf;\n var i;\n while (true) {\n md = createHash('md5');\n if(addmd++ > 0) {\n md.update(md_buf);\n }\n md.update(password);\n md.update(salt);\n md_buf = md.digest();\n i = 0;\n if(keyLen > 0) {\n while(true) {\n if(keyLen === 0) {\n break;\n }\n if(i === md_buf.length) {\n break;\n }\n key[ki++] = md_buf[i++];\n keyLen--;\n }\n }\n if(keyLen === 0) {\n break;\n }\n }\n for(i=0;i k || new bn(enc).cmp(key.modulus) >= 0) {\n throw new Error('decryption error');\n }\n var msg;\n if (reverse) {\n msg = withPublic(new bn(enc), key);\n } else {\n msg = crt(enc, key);\n }\n var zBuffer = new Buffer(k - msg.length);\n zBuffer.fill(0);\n msg = Buffer.concat([zBuffer, msg], k);\n if (padding === 4) {\n return oaep(key, msg);\n } else if (padding === 1) {\n return pkcs1(key, msg, reverse);\n } else if (padding === 3) {\n return msg;\n } else {\n throw new Error('unknown padding');\n }\n};\n\nfunction oaep(key, msg){\n var n = key.modulus;\n var k = key.modulus.byteLength();\n var mLen = msg.length;\n var iHash = createHash('sha1').update(new Buffer('')).digest();\n var hLen = iHash.length;\n var hLen2 = 2 * hLen;\n if (msg[0] !== 0) {\n throw new Error('decryption error');\n }\n var maskedSeed = msg.slice(1, hLen + 1);\n var maskedDb = msg.slice(hLen + 1);\n var seed = xor(maskedSeed, mgf(maskedDb, hLen));\n var db = xor(maskedDb, mgf(seed, k - hLen - 1));\n if (compare(iHash, db.slice(0, hLen))) {\n throw new Error('decryption error');\n }\n var i = hLen;\n while (db[i] === 0) {\n i++;\n }\n if (db[i++] !== 1) {\n throw new Error('decryption error');\n }\n return db.slice(i);\n}\n\nfunction pkcs1(key, msg, reverse){\n var p1 = msg.slice(0, 2);\n var i = 2;\n var status = 0;\n while (msg[i++] !== 0) {\n if (i >= msg.length) {\n status++;\n break;\n }\n }\n var ps = msg.slice(2, i - 1);\n var p2 = msg.slice(i - 1, i);\n\n if ((p1.toString('hex') !== '0002' && !reverse) || (p1.toString('hex') !== '0001' && reverse)){\n status++;\n }\n if (ps.length < 8) {\n status++;\n }\n if (status) {\n throw new Error('decryption error');\n }\n return msg.slice(i);\n}\nfunction compare(a, b){\n a = new Buffer(a);\n b = new Buffer(b);\n var dif = 0;\n var len = a.length;\n if (a.length !== b.length) {\n dif++;\n len = Math.min(a.length, b.length);\n }\n var i = -1;\n while (++i < len) {\n dif += (a[i] ^ b[i]);\n }\n return dif;\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"./mgf\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/mgf.js\",\"./withPublic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/withPublic.js\",\"./xor\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/xor.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/lib/bn.js\",\"browserify-rsa\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/browserify-rsa/index.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"create-hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/browser.js\",\"parse-asn1\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/publicEncrypt.js\":[function(require,module,exports){\n(function (Buffer){\nvar parseKeys = require('parse-asn1');\nvar randomBytes = require('randombytes');\nvar createHash = require('create-hash');\nvar mgf = require('./mgf');\nvar xor = require('./xor');\nvar bn = require('bn.js');\nvar withPublic = require('./withPublic');\nvar crt = require('browserify-rsa');\n\nvar constants = {\n RSA_PKCS1_OAEP_PADDING: 4,\n RSA_PKCS1_PADDIN: 1,\n RSA_NO_PADDING: 3\n};\n\nmodule.exports = function publicEncrypt(public_key, msg, reverse) {\n var padding;\n if (public_key.padding) {\n padding = public_key.padding;\n } else if (reverse) {\n padding = 1;\n } else {\n padding = 4;\n }\n var key = parseKeys(public_key);\n var paddedMsg;\n if (padding === 4) {\n paddedMsg = oaep(key, msg);\n } else if (padding === 1) {\n paddedMsg = pkcs1(key, msg, reverse);\n } else if (padding === 3) {\n paddedMsg = new bn(msg);\n if (paddedMsg.cmp(key.modulus) >= 0) {\n throw new Error('data too long for modulus');\n }\n } else {\n throw new Error('unknown padding');\n }\n if (reverse) {\n return crt(paddedMsg, key);\n } else {\n return withPublic(paddedMsg, key);\n }\n};\n\nfunction oaep(key, msg){\n var k = key.modulus.byteLength();\n var mLen = msg.length;\n var iHash = createHash('sha1').update(new Buffer('')).digest();\n var hLen = iHash.length;\n var hLen2 = 2 * hLen;\n if (mLen > k - hLen2 - 2) {\n throw new Error('message too long');\n }\n var ps = new Buffer(k - mLen - hLen2 - 2);\n ps.fill(0);\n var dblen = k - hLen - 1;\n var seed = randomBytes(hLen);\n var maskedDb = xor(Buffer.concat([iHash, ps, new Buffer([1]), msg], dblen), mgf(seed, dblen));\n var maskedSeed = xor(seed, mgf(maskedDb, hLen));\n return new bn(Buffer.concat([new Buffer([0]), maskedSeed, maskedDb], k));\n}\nfunction pkcs1(key, msg, reverse){\n var mLen = msg.length;\n var k = key.modulus.byteLength();\n if (mLen > k - 11) {\n throw new Error('message too long');\n }\n var ps;\n if (reverse) {\n ps = new Buffer(k - mLen - 3);\n ps.fill(0xff);\n } else {\n ps = nonZero(k - mLen - 3);\n }\n return new bn(Buffer.concat([new Buffer([0, reverse?1:2]), ps, new Buffer([0]), msg], k));\n}\nfunction nonZero(len, crypto) {\n var out = new Buffer(len);\n var i = 0;\n var cache = randomBytes(len*2);\n var cur = 0;\n var num;\n while (i < len) {\n if (cur === cache.length) {\n cache = randomBytes(len*2);\n cur = 0;\n }\n num = cache[cur++];\n if (num) {\n out[i++] = num;\n }\n }\n return out;\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"./mgf\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/mgf.js\",\"./withPublic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/withPublic.js\",\"./xor\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/xor.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/lib/bn.js\",\"browserify-rsa\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/browserify-rsa/index.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"create-hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/browser.js\",\"parse-asn1\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/index.js\",\"randombytes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/randombytes/browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/withPublic.js\":[function(require,module,exports){\n(function (Buffer){\nvar bn = require('bn.js');\nfunction withPublic(paddedMsg, key) {\n return new Buffer(paddedMsg\n .toRed(bn.mont(key.modulus))\n .redPow(new bn(key.publicExponent))\n .fromRed()\n .toArray());\n}\n\nmodule.exports = withPublic;\n}).call(this,require(\"buffer\").Buffer)\n},{\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/lib/bn.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/xor.js\":[function(require,module,exports){\nmodule.exports = function xor(a, b) {\n var len = a.length;\n var i = -1;\n while (++i < len) {\n a[i] ^= b[i];\n }\n return a\n};\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/randombytes/browser.js\":[function(require,module,exports){\n(function (process,global,Buffer){\n'use strict';\n\nvar crypto = global.crypto || global.msCrypto\nif(crypto && crypto.getRandomValues) {\n module.exports = randomBytes;\n} else {\n module.exports = oldBrowser;\n}\nfunction randomBytes(size, cb) {\n var bytes = new Buffer(size); //in browserify, this is an extended Uint8Array\n /* This will not work in older browsers.\n * See https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues\n */\n\n crypto.getRandomValues(bytes);\n if (typeof cb === 'function') {\n return process.nextTick(function () {\n cb(null, bytes);\n });\n }\n return bytes;\n}\nfunction oldBrowser() {\n throw new Error(\n 'secure random number generation not supported by this browser\\n'+\n 'use chrome, FireFox or Internet Explorer 11'\n )\n}\n\n}).call(this,require('_process'),typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {},require(\"buffer\").Buffer)\n},{\"_process\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/process/browser.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/events/events.js\":[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfunction EventEmitter() {\n this._events = this._events || {};\n this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nEventEmitter.defaultMaxListeners = 10;\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function(n) {\n if (!isNumber(n) || n < 0 || isNaN(n))\n throw TypeError('n must be a positive number');\n this._maxListeners = n;\n return this;\n};\n\nEventEmitter.prototype.emit = function(type) {\n var er, handler, len, args, i, listeners;\n\n if (!this._events)\n this._events = {};\n\n // If there is no 'error' event listener then throw.\n if (type === 'error') {\n if (!this._events.error ||\n (isObject(this._events.error) && !this._events.error.length)) {\n er = arguments[1];\n if (er instanceof Error) {\n throw er; // Unhandled 'error' event\n }\n throw TypeError('Uncaught, unspecified \"error\" event.');\n }\n }\n\n handler = this._events[type];\n\n if (isUndefined(handler))\n return false;\n\n if (isFunction(handler)) {\n switch (arguments.length) {\n // fast cases\n case 1:\n handler.call(this);\n break;\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n default:\n len = arguments.length;\n args = new Array(len - 1);\n for (i = 1; i < len; i++)\n args[i - 1] = arguments[i];\n handler.apply(this, args);\n }\n } else if (isObject(handler)) {\n len = arguments.length;\n args = new Array(len - 1);\n for (i = 1; i < len; i++)\n args[i - 1] = arguments[i];\n\n listeners = handler.slice();\n len = listeners.length;\n for (i = 0; i < len; i++)\n listeners[i].apply(this, args);\n }\n\n return true;\n};\n\nEventEmitter.prototype.addListener = function(type, listener) {\n var m;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events)\n this._events = {};\n\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (this._events.newListener)\n this.emit('newListener', type,\n isFunction(listener.listener) ?\n listener.listener : listener);\n\n if (!this._events[type])\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n else if (isObject(this._events[type]))\n // If we've already got an array, just append.\n this._events[type].push(listener);\n else\n // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener];\n\n // Check for listener leak\n if (isObject(this._events[type]) && !this._events[type].warned) {\n var m;\n if (!isUndefined(this._maxListeners)) {\n m = this._maxListeners;\n } else {\n m = EventEmitter.defaultMaxListeners;\n }\n\n if (m && m > 0 && this._events[type].length > m) {\n this._events[type].warned = true;\n console.error('(node) warning: possible EventEmitter memory ' +\n 'leak detected. %d listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.',\n this._events[type].length);\n if (typeof console.trace === 'function') {\n // not supported in IE 10\n console.trace();\n }\n }\n }\n\n return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n var fired = false;\n\n function g() {\n this.removeListener(type, g);\n\n if (!fired) {\n fired = true;\n listener.apply(this, arguments);\n }\n }\n\n g.listener = listener;\n this.on(type, g);\n\n return this;\n};\n\n// emits a 'removeListener' event iff the listener was removed\nEventEmitter.prototype.removeListener = function(type, listener) {\n var list, position, length, i;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events || !this._events[type])\n return this;\n\n list = this._events[type];\n length = list.length;\n position = -1;\n\n if (list === listener ||\n (isFunction(list.listener) && list.listener === listener)) {\n delete this._events[type];\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n\n } else if (isObject(list)) {\n for (i = length; i-- > 0;) {\n if (list[i] === listener ||\n (list[i].listener && list[i].listener === listener)) {\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (list.length === 1) {\n list.length = 0;\n delete this._events[type];\n } else {\n list.splice(position, 1);\n }\n\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n }\n\n return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n var key, listeners;\n\n if (!this._events)\n return this;\n\n // not listening for removeListener, no need to emit\n if (!this._events.removeListener) {\n if (arguments.length === 0)\n this._events = {};\n else if (this._events[type])\n delete this._events[type];\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n for (key in this._events) {\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = {};\n return this;\n }\n\n listeners = this._events[type];\n\n if (isFunction(listeners)) {\n this.removeListener(type, listeners);\n } else {\n // LIFO order\n while (listeners.length)\n this.removeListener(type, listeners[listeners.length - 1]);\n }\n delete this._events[type];\n\n return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n var ret;\n if (!this._events || !this._events[type])\n ret = [];\n else if (isFunction(this._events[type]))\n ret = [this._events[type]];\n else\n ret = this._events[type].slice();\n return ret;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n var ret;\n if (!emitter._events || !emitter._events[type])\n ret = 0;\n else if (isFunction(emitter._events[type]))\n ret = 1;\n else\n ret = emitter._events[type].length;\n return ret;\n};\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\n\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/assert/node_modules/util/node_modules/inherits/inherits_browser.js\"][0].apply(exports,arguments)\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/isarray/index.js\":[function(require,module,exports){\nmodule.exports = Array.isArray || function (arr) {\n return Object.prototype.toString.call(arr) == '[object Array]';\n};\n\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/path-browserify/index.js\":[function(require,module,exports){\n(function (process){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n}\n\n// Split a filename into [root, dir, basename, ext], unix version\n// 'root' is just a slash, or nothing.\nvar splitPathRe =\n /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;\nvar splitPath = function(filename) {\n return splitPathRe.exec(filename).slice(1);\n};\n\n// path.resolve([from ...], to)\n// posix version\nexports.resolve = function() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : process.cwd();\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n};\n\n// path.normalize(path)\n// posix version\nexports.normalize = function(path) {\n var isAbsolute = exports.isAbsolute(path),\n trailingSlash = substr(path, -1) === '/';\n\n // Normalize the path\n path = normalizeArray(filter(path.split('/'), function(p) {\n return !!p;\n }), !isAbsolute).join('/');\n\n if (!path && !isAbsolute) {\n path = '.';\n }\n if (path && trailingSlash) {\n path += '/';\n }\n\n return (isAbsolute ? '/' : '') + path;\n};\n\n// posix version\nexports.isAbsolute = function(path) {\n return path.charAt(0) === '/';\n};\n\n// posix version\nexports.join = function() {\n var paths = Array.prototype.slice.call(arguments, 0);\n return exports.normalize(filter(paths, function(p, index) {\n if (typeof p !== 'string') {\n throw new TypeError('Arguments to path.join must be strings');\n }\n return p;\n }).join('/'));\n};\n\n\n// path.relative(from, to)\n// posix version\nexports.relative = function(from, to) {\n from = exports.resolve(from).substr(1);\n to = exports.resolve(to).substr(1);\n\n function trim(arr) {\n var start = 0;\n for (; start < arr.length; start++) {\n if (arr[start] !== '') break;\n }\n\n var end = arr.length - 1;\n for (; end >= 0; end--) {\n if (arr[end] !== '') break;\n }\n\n if (start > end) return [];\n return arr.slice(start, end - start + 1);\n }\n\n var fromParts = trim(from.split('/'));\n var toParts = trim(to.split('/'));\n\n var length = Math.min(fromParts.length, toParts.length);\n var samePartsLength = length;\n for (var i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i;\n break;\n }\n }\n\n var outputParts = [];\n for (var i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..');\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n return outputParts.join('/');\n};\n\nexports.sep = '/';\nexports.delimiter = ':';\n\nexports.dirname = function(path) {\n var result = splitPath(path),\n root = result[0],\n dir = result[1];\n\n if (!root && !dir) {\n // No dirname whatsoever\n return '.';\n }\n\n if (dir) {\n // It has a dirname, strip trailing slash\n dir = dir.substr(0, dir.length - 1);\n }\n\n return root + dir;\n};\n\n\nexports.basename = function(path, ext) {\n var f = splitPath(path)[2];\n // TODO: make this comparison case-insensitive on windows?\n if (ext && f.substr(-1 * ext.length) === ext) {\n f = f.substr(0, f.length - ext.length);\n }\n return f;\n};\n\n\nexports.extname = function(path) {\n return splitPath(path)[3];\n};\n\nfunction filter (xs, f) {\n if (xs.filter) return xs.filter(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n if (f(xs[i], i, xs)) res.push(xs[i]);\n }\n return res;\n}\n\n// String.prototype.substr - negative index don't work in IE8\nvar substr = 'ab'.substr(-1) === 'b'\n ? function (str, start, len) { return str.substr(start, len) }\n : function (str, start, len) {\n if (start < 0) start = str.length + start;\n return str.substr(start, len);\n }\n;\n\n}).call(this,require('_process'))\n},{\"_process\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/process/browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/process/browser.js\":[function(require,module,exports){\n// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n draining = true;\n var currentQueue;\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n var i = -1;\n while (++i < len) {\n currentQueue[i]();\n }\n len = queue.length;\n }\n draining = false;\n}\nprocess.nextTick = function (fun) {\n queue.push(fun);\n if (!draining) {\n setTimeout(drainQueue, 0);\n }\n};\n\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\n// TODO(shtylman)\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/duplex.js\":[function(require,module,exports){\nmodule.exports = require(\"./lib/_stream_duplex.js\")\n\n},{\"./lib/_stream_duplex.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_duplex.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_duplex.js\":[function(require,module,exports){\n(function (process){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\nmodule.exports = Duplex;\n\n/**/\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) keys.push(key);\n return keys;\n}\n/**/\n\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nvar Readable = require('./_stream_readable');\nvar Writable = require('./_stream_writable');\n\nutil.inherits(Duplex, Readable);\n\nforEach(objectKeys(Writable.prototype), function(method) {\n if (!Duplex.prototype[method])\n Duplex.prototype[method] = Writable.prototype[method];\n});\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex))\n return new Duplex(options);\n\n Readable.call(this, options);\n Writable.call(this, options);\n\n if (options && options.readable === false)\n this.readable = false;\n\n if (options && options.writable === false)\n this.writable = false;\n\n this.allowHalfOpen = true;\n if (options && options.allowHalfOpen === false)\n this.allowHalfOpen = false;\n\n this.once('end', onend);\n}\n\n// the no-half-open enforcer\nfunction onend() {\n // if we allow half-open state, or if the writable side ended,\n // then we're ok.\n if (this.allowHalfOpen || this._writableState.ended)\n return;\n\n // no more data can be written.\n // But allow more writes to happen in this tick.\n process.nextTick(this.end.bind(this));\n}\n\nfunction forEach (xs, f) {\n for (var i = 0, l = xs.length; i < l; i++) {\n f(xs[i], i);\n }\n}\n\n}).call(this,require('_process'))\n},{\"./_stream_readable\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_readable.js\",\"./_stream_writable\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_writable.js\",\"_process\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/process/browser.js\",\"core-util-is\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/node_modules/core-util-is/lib/util.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_passthrough.js\":[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\nmodule.exports = PassThrough;\n\nvar Transform = require('./_stream_transform');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(PassThrough, Transform);\n\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough))\n return new PassThrough(options);\n\n Transform.call(this, options);\n}\n\nPassThrough.prototype._transform = function(chunk, encoding, cb) {\n cb(null, chunk);\n};\n\n},{\"./_stream_transform\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_transform.js\",\"core-util-is\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/node_modules/core-util-is/lib/util.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_readable.js\":[function(require,module,exports){\n(function (process){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nmodule.exports = Readable;\n\n/**/\nvar isArray = require('isarray');\n/**/\n\n\n/**/\nvar Buffer = require('buffer').Buffer;\n/**/\n\nReadable.ReadableState = ReadableState;\n\nvar EE = require('events').EventEmitter;\n\n/**/\nif (!EE.listenerCount) EE.listenerCount = function(emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\nvar Stream = require('stream');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nvar StringDecoder;\n\n\n/**/\nvar debug = require('util');\nif (debug && debug.debuglog) {\n debug = debug.debuglog('stream');\n} else {\n debug = function () {};\n}\n/**/\n\n\nutil.inherits(Readable, Stream);\n\nfunction ReadableState(options, stream) {\n var Duplex = require('./_stream_duplex');\n\n options = options || {};\n\n // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n var hwm = options.highWaterMark;\n var defaultHwm = options.objectMode ? 16 : 16 * 1024;\n this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;\n\n // cast to ints.\n this.highWaterMark = ~~this.highWaterMark;\n\n this.buffer = [];\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n\n\n // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n this.objectMode = !!options.objectMode;\n\n if (stream instanceof Duplex)\n this.objectMode = this.objectMode || !!options.readableObjectMode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // when piping, we only care about 'readable' events that happen\n // after read()ing all the bytes and not getting any pushback.\n this.ranOut = false;\n\n // the number of writers that are awaiting a drain event in .pipe()s\n this.awaitDrain = 0;\n\n // if true, a maybeReadMore has been scheduled\n this.readingMore = false;\n\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder)\n StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nfunction Readable(options) {\n var Duplex = require('./_stream_duplex');\n\n if (!(this instanceof Readable))\n return new Readable(options);\n\n this._readableState = new ReadableState(options, this);\n\n // legacy\n this.readable = true;\n\n Stream.call(this);\n}\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function(chunk, encoding) {\n var state = this._readableState;\n\n if (util.isString(chunk) && !state.objectMode) {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = new Buffer(chunk, encoding);\n encoding = '';\n }\n }\n\n return readableAddChunk(this, state, chunk, encoding, false);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function(chunk) {\n var state = this._readableState;\n return readableAddChunk(this, state, chunk, '', true);\n};\n\nfunction readableAddChunk(stream, state, chunk, encoding, addToFront) {\n var er = chunkInvalid(state, chunk);\n if (er) {\n stream.emit('error', er);\n } else if (util.isNullOrUndefined(chunk)) {\n state.reading = false;\n if (!state.ended)\n onEofChunk(stream, state);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (state.ended && !addToFront) {\n var e = new Error('stream.push() after EOF');\n stream.emit('error', e);\n } else if (state.endEmitted && addToFront) {\n var e = new Error('stream.unshift() after end event');\n stream.emit('error', e);\n } else {\n if (state.decoder && !addToFront && !encoding)\n chunk = state.decoder.write(chunk);\n\n if (!addToFront)\n state.reading = false;\n\n // if we want the data now, just emit it.\n if (state.flowing && state.length === 0 && !state.sync) {\n stream.emit('data', chunk);\n stream.read(0);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront)\n state.buffer.unshift(chunk);\n else\n state.buffer.push(chunk);\n\n if (state.needReadable)\n emitReadable(stream);\n }\n\n maybeReadMore(stream, state);\n }\n } else if (!addToFront) {\n state.reading = false;\n }\n\n return needMoreData(state);\n}\n\n\n\n// if it's past the high water mark, we can push in some more.\n// Also, if we have no data yet, we can stand some\n// more bytes. This is to work around cases where hwm=0,\n// such as the repl. Also, if the push() triggered a\n// readable event, and the user called read(largeNumber) such that\n// needReadable was set, then we ought to push more, so that another\n// 'readable' event will be triggered.\nfunction needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function(enc) {\n if (!StringDecoder)\n StringDecoder = require('string_decoder/').StringDecoder;\n this._readableState.decoder = new StringDecoder(enc);\n this._readableState.encoding = enc;\n return this;\n};\n\n// Don't raise the hwm > 128MB\nvar MAX_HWM = 0x800000;\nfunction roundUpToNextPowerOf2(n) {\n if (n >= MAX_HWM) {\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2\n n--;\n for (var p = 1; p < 32; p <<= 1) n |= n >> p;\n n++;\n }\n return n;\n}\n\nfunction howMuchToRead(n, state) {\n if (state.length === 0 && state.ended)\n return 0;\n\n if (state.objectMode)\n return n === 0 ? 0 : 1;\n\n if (isNaN(n) || util.isNull(n)) {\n // only flow one buffer at a time\n if (state.flowing && state.buffer.length)\n return state.buffer[0].length;\n else\n return state.length;\n }\n\n if (n <= 0)\n return 0;\n\n // If we're asking for more than the target buffer level,\n // then raise the water mark. Bump up to the next highest\n // power of 2, to prevent increasing it excessively in tiny\n // amounts.\n if (n > state.highWaterMark)\n state.highWaterMark = roundUpToNextPowerOf2(n);\n\n // don't have that much. return null, unless we've ended.\n if (n > state.length) {\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n } else\n return state.length;\n }\n\n return n;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function(n) {\n debug('read', n);\n var state = this._readableState;\n var nOrig = n;\n\n if (!util.isNumber(n) || n > 0)\n state.emittedReadable = false;\n\n // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n if (n === 0 &&\n state.needReadable &&\n (state.length >= state.highWaterMark || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended)\n endReadable(this);\n else\n emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state);\n\n // if we've ended, and we're now clear, then finish it up.\n if (n === 0 && state.ended) {\n if (state.length === 0)\n endReadable(this);\n return null;\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n var doRead = state.needReadable;\n debug('need readable', doRead);\n\n // if we currently have less than the highWaterMark, then also read some\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n }\n\n // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n }\n\n if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true;\n // if the length is currently zero, then we *need* a readable event.\n if (state.length === 0)\n state.needReadable = true;\n // call internal read method\n this._read(state.highWaterMark);\n state.sync = false;\n }\n\n // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n if (doRead && !state.reading)\n n = howMuchToRead(nOrig, state);\n\n var ret;\n if (n > 0)\n ret = fromList(n, state);\n else\n ret = null;\n\n if (util.isNull(ret)) {\n state.needReadable = true;\n n = 0;\n }\n\n state.length -= n;\n\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (state.length === 0 && !state.ended)\n state.needReadable = true;\n\n // If we tried to read() past the EOF, then emit end on the next tick.\n if (nOrig !== n && state.ended && state.length === 0)\n endReadable(this);\n\n if (!util.isNull(ret))\n this.emit('data', ret);\n\n return ret;\n};\n\nfunction chunkInvalid(state, chunk) {\n var er = null;\n if (!util.isBuffer(chunk) &&\n !util.isString(chunk) &&\n !util.isNullOrUndefined(chunk) &&\n !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n return er;\n}\n\n\nfunction onEofChunk(stream, state) {\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n\n // emit 'readable' now to make sure it gets picked up.\n emitReadable(stream);\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n }\n}\n\nfunction emitReadable_(stream) {\n debug('emit readable');\n stream.emit('readable');\n flow(stream);\n}\n\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(function() {\n maybeReadMore_(stream, state);\n });\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n var len = state.length;\n while (!state.reading && !state.flowing && !state.ended &&\n state.length < state.highWaterMark) {\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length)\n // didn't get any data, stop spinning.\n break;\n else\n len = state.length;\n }\n state.readingMore = false;\n}\n\n// abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function(n) {\n this.emit('error', new Error('not implemented'));\n};\n\nReadable.prototype.pipe = function(dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n\n var doEnd = (!pipeOpts || pipeOpts.end !== false) &&\n dest !== process.stdout &&\n dest !== process.stderr;\n\n var endFn = doEnd ? onend : cleanup;\n if (state.endEmitted)\n process.nextTick(endFn);\n else\n src.once('end', endFn);\n\n dest.on('unpipe', onunpipe);\n function onunpipe(readable) {\n debug('onunpipe');\n if (readable === src) {\n cleanup();\n }\n }\n\n function onend() {\n debug('onend');\n dest.end();\n }\n\n // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n\n function cleanup() {\n debug('cleanup');\n // cleanup event handlers once the pipe is broken\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', cleanup);\n src.removeListener('data', ondata);\n\n // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n if (state.awaitDrain &&\n (!dest._writableState || dest._writableState.needDrain))\n ondrain();\n }\n\n src.on('data', ondata);\n function ondata(chunk) {\n debug('ondata');\n var ret = dest.write(chunk);\n if (false === ret) {\n debug('false write response, pause',\n src._readableState.awaitDrain);\n src._readableState.awaitDrain++;\n src.pause();\n }\n }\n\n // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }\n // This is a brutally ugly hack to make sure that our error handler\n // is attached before any userland ones. NEVER DO THIS.\n if (!dest._events || !dest._events.error)\n dest.on('error', onerror);\n else if (isArray(dest._events.error))\n dest._events.error.unshift(onerror);\n else\n dest._events.error = [onerror, dest._events.error];\n\n\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n dest.once('close', onclose);\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n dest.once('finish', onfinish);\n\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n }\n\n // tell the dest that it's being piped to\n dest.emit('pipe', src);\n\n // start the flow if it hasn't been started already.\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function() {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain)\n state.awaitDrain--;\n if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\n\n\nReadable.prototype.unpipe = function(dest) {\n var state = this._readableState;\n\n // if we're not piping anywhere, then do nothing.\n if (state.pipesCount === 0)\n return this;\n\n // just one destination. most common case.\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes)\n return this;\n\n if (!dest)\n dest = state.pipes;\n\n // got a match.\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest)\n dest.emit('unpipe', this);\n return this;\n }\n\n // slow case. multiple pipe destinations.\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n\n for (var i = 0; i < len; i++)\n dests[i].emit('unpipe', this);\n return this;\n }\n\n // try to find the right one.\n var i = indexOf(state.pipes, dest);\n if (i === -1)\n return this;\n\n state.pipes.splice(i, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1)\n state.pipes = state.pipes[0];\n\n dest.emit('unpipe', this);\n\n return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function(ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n\n // If listening to data, and it has not explicitly been paused,\n // then call resume to start the flow of data on the next tick.\n if (ev === 'data' && false !== this._readableState.flowing) {\n this.resume();\n }\n\n if (ev === 'readable' && this.readable) {\n var state = this._readableState;\n if (!state.readableListening) {\n state.readableListening = true;\n state.emittedReadable = false;\n state.needReadable = true;\n if (!state.reading) {\n var self = this;\n process.nextTick(function() {\n debug('readable nexttick read 0');\n self.read(0);\n });\n } else if (state.length) {\n emitReadable(this, state);\n }\n }\n }\n\n return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function() {\n var state = this._readableState;\n if (!state.flowing) {\n debug('resume');\n state.flowing = true;\n if (!state.reading) {\n debug('resume read 0');\n this.read(0);\n }\n resume(this, state);\n }\n return this;\n};\n\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n process.nextTick(function() {\n resume_(stream, state);\n });\n }\n}\n\nfunction resume_(stream, state) {\n state.resumeScheduled = false;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading)\n stream.read(0);\n}\n\nReadable.prototype.pause = function() {\n debug('call pause flowing=%j', this._readableState.flowing);\n if (false !== this._readableState.flowing) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n return this;\n};\n\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n if (state.flowing) {\n do {\n var chunk = stream.read();\n } while (null !== chunk && state.flowing);\n }\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function(stream) {\n var state = this._readableState;\n var paused = false;\n\n var self = this;\n stream.on('end', function() {\n debug('wrapped end');\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length)\n self.push(chunk);\n }\n\n self.push(null);\n });\n\n stream.on('data', function(chunk) {\n debug('wrapped data');\n if (state.decoder)\n chunk = state.decoder.write(chunk);\n if (!chunk || !state.objectMode && !chunk.length)\n return;\n\n var ret = self.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n\n // proxy all the other methods.\n // important when wrapping filters and duplexes.\n for (var i in stream) {\n if (util.isFunction(stream[i]) && util.isUndefined(this[i])) {\n this[i] = function(method) { return function() {\n return stream[method].apply(stream, arguments);\n }}(i);\n }\n }\n\n // proxy certain important events.\n var events = ['error', 'close', 'destroy', 'pause', 'resume'];\n forEach(events, function(ev) {\n stream.on(ev, self.emit.bind(self, ev));\n });\n\n // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n self._read = function(n) {\n debug('wrapped _read', n);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return self;\n};\n\n\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\nfunction fromList(n, state) {\n var list = state.buffer;\n var length = state.length;\n var stringMode = !!state.decoder;\n var objectMode = !!state.objectMode;\n var ret;\n\n // nothing in the list, definitely empty.\n if (list.length === 0)\n return null;\n\n if (length === 0)\n ret = null;\n else if (objectMode)\n ret = list.shift();\n else if (!n || n >= length) {\n // read it all, truncate the array.\n if (stringMode)\n ret = list.join('');\n else\n ret = Buffer.concat(list, length);\n list.length = 0;\n } else {\n // read just some of it.\n if (n < list[0].length) {\n // just take a part of the first list item.\n // slice is the same for buffers and strings.\n var buf = list[0];\n ret = buf.slice(0, n);\n list[0] = buf.slice(n);\n } else if (n === list[0].length) {\n // first list is a perfect match\n ret = list.shift();\n } else {\n // complex case.\n // we have enough to cover it, but it spans past the first buffer.\n if (stringMode)\n ret = '';\n else\n ret = new Buffer(n);\n\n var c = 0;\n for (var i = 0, l = list.length; i < l && c < n; i++) {\n var buf = list[0];\n var cpy = Math.min(n - c, buf.length);\n\n if (stringMode)\n ret += buf.slice(0, cpy);\n else\n buf.copy(ret, c, 0, cpy);\n\n if (cpy < buf.length)\n list[0] = buf.slice(cpy);\n else\n list.shift();\n\n c += cpy;\n }\n }\n }\n\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState;\n\n // If we get here before consuming all the bytes, then that is a\n // bug in node. Should never happen.\n if (state.length > 0)\n throw new Error('endReadable called on non-empty stream');\n\n if (!state.endEmitted) {\n state.ended = true;\n process.nextTick(function() {\n // Check that we didn't get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n }\n });\n }\n}\n\nfunction forEach (xs, f) {\n for (var i = 0, l = xs.length; i < l; i++) {\n f(xs[i], i);\n }\n}\n\nfunction indexOf (xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n return -1;\n}\n\n}).call(this,require('_process'))\n},{\"./_stream_duplex\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_duplex.js\",\"_process\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/process/browser.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"core-util-is\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/node_modules/core-util-is/lib/util.js\",\"events\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/events/events.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\",\"isarray\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/isarray/index.js\",\"stream\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/stream-browserify/index.js\",\"string_decoder/\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/string_decoder/index.js\",\"util\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/browser-resolve/empty.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_transform.js\":[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\nmodule.exports = Transform;\n\nvar Duplex = require('./_stream_duplex');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(Transform, Duplex);\n\n\nfunction TransformState(options, stream) {\n this.afterTransform = function(er, data) {\n return afterTransform(stream, er, data);\n };\n\n this.needTransform = false;\n this.transforming = false;\n this.writecb = null;\n this.writechunk = null;\n}\n\nfunction afterTransform(stream, er, data) {\n var ts = stream._transformState;\n ts.transforming = false;\n\n var cb = ts.writecb;\n\n if (!cb)\n return stream.emit('error', new Error('no writecb in Transform class'));\n\n ts.writechunk = null;\n ts.writecb = null;\n\n if (!util.isNullOrUndefined(data))\n stream.push(data);\n\n if (cb)\n cb(er);\n\n var rs = stream._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n stream._read(rs.highWaterMark);\n }\n}\n\n\nfunction Transform(options) {\n if (!(this instanceof Transform))\n return new Transform(options);\n\n Duplex.call(this, options);\n\n this._transformState = new TransformState(options, this);\n\n // when the writable side finishes, then flush out anything remaining.\n var stream = this;\n\n // start out asking for a readable event once data is transformed.\n this._readableState.needReadable = true;\n\n // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false;\n\n this.once('prefinish', function() {\n if (util.isFunction(this._flush))\n this._flush(function(er) {\n done(stream, er);\n });\n else\n done(stream);\n });\n}\n\nTransform.prototype.push = function(chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function(chunk, encoding, cb) {\n throw new Error('not implemented');\n};\n\nTransform.prototype._write = function(chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform ||\n rs.needReadable ||\n rs.length < rs.highWaterMark)\n this._read(rs.highWaterMark);\n }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function(n) {\n var ts = this._transformState;\n\n if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\n\nfunction done(stream, er) {\n if (er)\n return stream.emit('error', er);\n\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n var ws = stream._writableState;\n var ts = stream._transformState;\n\n if (ws.length)\n throw new Error('calling transform done when ws.length != 0');\n\n if (ts.transforming)\n throw new Error('calling transform done when still transforming');\n\n return stream.push(null);\n}\n\n},{\"./_stream_duplex\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_duplex.js\",\"core-util-is\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/node_modules/core-util-is/lib/util.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_writable.js\":[function(require,module,exports){\n(function (process){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, cb), and it'll handle all\n// the drain event emission and buffering.\n\nmodule.exports = Writable;\n\n/**/\nvar Buffer = require('buffer').Buffer;\n/**/\n\nWritable.WritableState = WritableState;\n\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nvar Stream = require('stream');\n\nutil.inherits(Writable, Stream);\n\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n}\n\nfunction WritableState(options, stream) {\n var Duplex = require('./_stream_duplex');\n\n options = options || {};\n\n // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n var hwm = options.highWaterMark;\n var defaultHwm = options.objectMode ? 16 : 16 * 1024;\n this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;\n\n // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!options.objectMode;\n\n if (stream instanceof Duplex)\n this.objectMode = this.objectMode || !!options.writableObjectMode;\n\n // cast to ints.\n this.highWaterMark = ~~this.highWaterMark;\n\n this.needDrain = false;\n // at the start of calling end()\n this.ending = false;\n // when end() has been called, and returned\n this.ended = false;\n // when 'finish' is emitted\n this.finished = false;\n\n // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n this.length = 0;\n\n // a flag to see when we're in the middle of a write.\n this.writing = false;\n\n // when true all writes will be buffered until .uncork() call\n this.corked = 0;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false;\n\n // the callback that's passed to _write(chunk,cb)\n this.onwrite = function(er) {\n onwrite(stream, er);\n };\n\n // the callback that the user supplies to write(chunk,encoding,cb)\n this.writecb = null;\n\n // the amount that is being written when _write is called.\n this.writelen = 0;\n\n this.buffer = [];\n\n // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n this.pendingcb = 0;\n\n // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n this.prefinished = false;\n\n // True if the error was already emitted and should not be thrown again\n this.errorEmitted = false;\n}\n\nfunction Writable(options) {\n var Duplex = require('./_stream_duplex');\n\n // Writable ctor is applied to Duplexes, though they're not\n // instanceof Writable, they're instanceof Readable.\n if (!(this instanceof Writable) && !(this instanceof Duplex))\n return new Writable(options);\n\n this._writableState = new WritableState(options, this);\n\n // legacy.\n this.writable = true;\n\n Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function() {\n this.emit('error', new Error('Cannot pipe. Not readable.'));\n};\n\n\nfunction writeAfterEnd(stream, state, cb) {\n var er = new Error('write after end');\n // TODO: defer error events consistently everywhere, not just the cb\n stream.emit('error', er);\n process.nextTick(function() {\n cb(er);\n });\n}\n\n// If we get something that is not a buffer, string, null, or undefined,\n// and we're not in objectMode, then that's an error.\n// Otherwise stream chunks are all considered to be of length=1, and the\n// watermarks determine how many objects to keep in the buffer, rather than\n// how many bytes or characters.\nfunction validChunk(stream, state, chunk, cb) {\n var valid = true;\n if (!util.isBuffer(chunk) &&\n !util.isString(chunk) &&\n !util.isNullOrUndefined(chunk) &&\n !state.objectMode) {\n var er = new TypeError('Invalid non-string/buffer chunk');\n stream.emit('error', er);\n process.nextTick(function() {\n cb(er);\n });\n valid = false;\n }\n return valid;\n}\n\nWritable.prototype.write = function(chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n\n if (util.isFunction(encoding)) {\n cb = encoding;\n encoding = null;\n }\n\n if (util.isBuffer(chunk))\n encoding = 'buffer';\n else if (!encoding)\n encoding = state.defaultEncoding;\n\n if (!util.isFunction(cb))\n cb = function() {};\n\n if (state.ended)\n writeAfterEnd(this, state, cb);\n else if (validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, chunk, encoding, cb);\n }\n\n return ret;\n};\n\nWritable.prototype.cork = function() {\n var state = this._writableState;\n\n state.corked++;\n};\n\nWritable.prototype.uncork = function() {\n var state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n\n if (!state.writing &&\n !state.corked &&\n !state.finished &&\n !state.bufferProcessing &&\n state.buffer.length)\n clearBuffer(this, state);\n }\n};\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode &&\n state.decodeStrings !== false &&\n util.isString(chunk)) {\n chunk = new Buffer(chunk, encoding);\n }\n return chunk;\n}\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, chunk, encoding, cb) {\n chunk = decodeChunk(state, chunk, encoding);\n if (util.isBuffer(chunk))\n encoding = 'buffer';\n var len = state.objectMode ? 1 : chunk.length;\n\n state.length += len;\n\n var ret = state.length < state.highWaterMark;\n // we must ensure that previous needDrain will not be reset to false.\n if (!ret)\n state.needDrain = true;\n\n if (state.writing || state.corked)\n state.buffer.push(new WriteReq(chunk, encoding, cb));\n else\n doWrite(stream, state, false, len, chunk, encoding, cb);\n\n return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (writev)\n stream._writev(chunk, state.onwrite);\n else\n stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n if (sync)\n process.nextTick(function() {\n state.pendingcb--;\n cb(er);\n });\n else {\n state.pendingcb--;\n cb(er);\n }\n\n stream._writableState.errorEmitted = true;\n stream.emit('error', er);\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n\n onwriteStateUpdate(state);\n\n if (er)\n onwriteError(stream, state, sync, er, cb);\n else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(stream, state);\n\n if (!finished &&\n !state.corked &&\n !state.bufferProcessing &&\n state.buffer.length) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n process.nextTick(function() {\n afterWrite(stream, state, finished, cb);\n });\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished)\n onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n}\n\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n\n if (stream._writev && state.buffer.length > 1) {\n // Fast case, write everything using _writev()\n var cbs = [];\n for (var c = 0; c < state.buffer.length; c++)\n cbs.push(state.buffer[c].callback);\n\n // count the one we are adding, as well.\n // TODO(isaacs) clean this up\n state.pendingcb++;\n doWrite(stream, state, true, state.length, state.buffer, '', function(err) {\n for (var i = 0; i < cbs.length; i++) {\n state.pendingcb--;\n cbs[i](err);\n }\n });\n\n // Clear buffer\n state.buffer = [];\n } else {\n // Slow case, write chunks one-by-one\n for (var c = 0; c < state.buffer.length; c++) {\n var entry = state.buffer[c];\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n\n doWrite(stream, state, false, len, chunk, encoding, cb);\n\n // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n if (state.writing) {\n c++;\n break;\n }\n }\n\n if (c < state.buffer.length)\n state.buffer = state.buffer.slice(c);\n else\n state.buffer.length = 0;\n }\n\n state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function(chunk, encoding, cb) {\n cb(new Error('not implemented'));\n\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function(chunk, encoding, cb) {\n var state = this._writableState;\n\n if (util.isFunction(chunk)) {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (util.isFunction(encoding)) {\n cb = encoding;\n encoding = null;\n }\n\n if (!util.isNullOrUndefined(chunk))\n this.write(chunk, encoding);\n\n // .end() fully uncorks\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n\n // ignore unnecessary end() calls.\n if (!state.ending && !state.finished)\n endWritable(this, state, cb);\n};\n\n\nfunction needFinish(stream, state) {\n return (state.ending &&\n state.length === 0 &&\n !state.finished &&\n !state.writing);\n}\n\nfunction prefinish(stream, state) {\n if (!state.prefinished) {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(stream, state);\n if (need) {\n if (state.pendingcb === 0) {\n prefinish(stream, state);\n state.finished = true;\n stream.emit('finish');\n } else\n prefinish(stream, state);\n }\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished)\n process.nextTick(cb);\n else\n stream.once('finish', cb);\n }\n state.ended = true;\n}\n\n}).call(this,require('_process'))\n},{\"./_stream_duplex\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_duplex.js\",\"_process\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/process/browser.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"core-util-is\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/node_modules/core-util-is/lib/util.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\",\"stream\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/stream-browserify/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/node_modules/core-util-is/lib/util.js\":[function(require,module,exports){\n(function (Buffer){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nfunction isBuffer(arg) {\n return Buffer.isBuffer(arg);\n}\nexports.isBuffer = isBuffer;\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/passthrough.js\":[function(require,module,exports){\nmodule.exports = require(\"./lib/_stream_passthrough.js\")\n\n},{\"./lib/_stream_passthrough.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_passthrough.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/readable.js\":[function(require,module,exports){\nexports = module.exports = require('./lib/_stream_readable.js');\nexports.Stream = require('stream');\nexports.Readable = exports;\nexports.Writable = require('./lib/_stream_writable.js');\nexports.Duplex = require('./lib/_stream_duplex.js');\nexports.Transform = require('./lib/_stream_transform.js');\nexports.PassThrough = require('./lib/_stream_passthrough.js');\n\n},{\"./lib/_stream_duplex.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_duplex.js\",\"./lib/_stream_passthrough.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_passthrough.js\",\"./lib/_stream_readable.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_readable.js\",\"./lib/_stream_transform.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_transform.js\",\"./lib/_stream_writable.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_writable.js\",\"stream\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/stream-browserify/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/transform.js\":[function(require,module,exports){\nmodule.exports = require(\"./lib/_stream_transform.js\")\n\n},{\"./lib/_stream_transform.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_transform.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/writable.js\":[function(require,module,exports){\nmodule.exports = require(\"./lib/_stream_writable.js\")\n\n},{\"./lib/_stream_writable.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_writable.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/stream-browserify/index.js\":[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nmodule.exports = Stream;\n\nvar EE = require('events').EventEmitter;\nvar inherits = require('inherits');\n\ninherits(Stream, EE);\nStream.Readable = require('readable-stream/readable.js');\nStream.Writable = require('readable-stream/writable.js');\nStream.Duplex = require('readable-stream/duplex.js');\nStream.Transform = require('readable-stream/transform.js');\nStream.PassThrough = require('readable-stream/passthrough.js');\n\n// Backwards-compat with node 0.4.x\nStream.Stream = Stream;\n\n\n\n// old-style streams. Note that the pipe method (the only relevant\n// part of this class) is overridden in the Readable class.\n\nfunction Stream() {\n EE.call(this);\n}\n\nStream.prototype.pipe = function(dest, options) {\n var source = this;\n\n function ondata(chunk) {\n if (dest.writable) {\n if (false === dest.write(chunk) && source.pause) {\n source.pause();\n }\n }\n }\n\n source.on('data', ondata);\n\n function ondrain() {\n if (source.readable && source.resume) {\n source.resume();\n }\n }\n\n dest.on('drain', ondrain);\n\n // If the 'end' option is not supplied, dest.end() will be called when\n // source gets the 'end' or 'close' events. Only dest.end() once.\n if (!dest._isStdio && (!options || options.end !== false)) {\n source.on('end', onend);\n source.on('close', onclose);\n }\n\n var didOnEnd = false;\n function onend() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n dest.end();\n }\n\n\n function onclose() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n if (typeof dest.destroy === 'function') dest.destroy();\n }\n\n // don't leave dangling pipes when there are errors.\n function onerror(er) {\n cleanup();\n if (EE.listenerCount(this, 'error') === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }\n\n source.on('error', onerror);\n dest.on('error', onerror);\n\n // remove all the event listeners that were added.\n function cleanup() {\n source.removeListener('data', ondata);\n dest.removeListener('drain', ondrain);\n\n source.removeListener('end', onend);\n source.removeListener('close', onclose);\n\n source.removeListener('error', onerror);\n dest.removeListener('error', onerror);\n\n source.removeListener('end', cleanup);\n source.removeListener('close', cleanup);\n\n dest.removeListener('close', cleanup);\n }\n\n source.on('end', cleanup);\n source.on('close', cleanup);\n\n dest.on('close', cleanup);\n\n dest.emit('pipe', source);\n\n // Allow for unix-like usage: A.pipe(B).pipe(C)\n return dest;\n};\n\n},{\"events\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/events/events.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\",\"readable-stream/duplex.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/duplex.js\",\"readable-stream/passthrough.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/passthrough.js\",\"readable-stream/readable.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/readable.js\",\"readable-stream/transform.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/transform.js\",\"readable-stream/writable.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/writable.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/string_decoder/index.js\":[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar Buffer = require('buffer').Buffer;\n\nvar isBufferEncoding = Buffer.isEncoding\n || function(encoding) {\n switch (encoding && encoding.toLowerCase()) {\n 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': return true;\n default: return false;\n }\n }\n\n\nfunction assertEncoding(encoding) {\n if (encoding && !isBufferEncoding(encoding)) {\n throw new Error('Unknown encoding: ' + encoding);\n }\n}\n\n// StringDecoder provides an interface for efficiently splitting a series of\n// buffers into a series of JS strings without breaking apart multi-byte\n// characters. CESU-8 is handled as part of the UTF-8 encoding.\n//\n// @TODO Handling all encodings inside a single object makes it very difficult\n// to reason about this code, so it should be split up in the future.\n// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code\n// points as used by CESU-8.\nvar StringDecoder = exports.StringDecoder = function(encoding) {\n this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');\n assertEncoding(encoding);\n switch (this.encoding) {\n case 'utf8':\n // CESU-8 represents each of Surrogate Pair by 3-bytes\n this.surrogateSize = 3;\n break;\n case 'ucs2':\n case 'utf16le':\n // UTF-16 represents each of Surrogate Pair by 2-bytes\n this.surrogateSize = 2;\n this.detectIncompleteChar = utf16DetectIncompleteChar;\n break;\n case 'base64':\n // Base-64 stores 3 bytes in 4 chars, and pads the remainder.\n this.surrogateSize = 3;\n this.detectIncompleteChar = base64DetectIncompleteChar;\n break;\n default:\n this.write = passThroughWrite;\n return;\n }\n\n // Enough space to store all bytes of a single character. UTF-8 needs 4\n // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).\n this.charBuffer = new Buffer(6);\n // Number of bytes received for the current incomplete multi-byte character.\n this.charReceived = 0;\n // Number of bytes expected for the current incomplete multi-byte character.\n this.charLength = 0;\n};\n\n\n// write decodes the given buffer and returns it as JS string that is\n// guaranteed to not contain any partial multi-byte characters. Any partial\n// character found at the end of the buffer is buffered up, and will be\n// returned when calling write again with the remaining bytes.\n//\n// Note: Converting a Buffer containing an orphan surrogate to a String\n// currently works, but converting a String to a Buffer (via `new Buffer`, or\n// Buffer#write) will replace incomplete surrogates with the unicode\n// replacement character. See https://codereview.chromium.org/121173009/ .\nStringDecoder.prototype.write = function(buffer) {\n var charStr = '';\n // if our last write ended with an incomplete multibyte character\n while (this.charLength) {\n // determine how many remaining bytes this buffer has to offer for this char\n var available = (buffer.length >= this.charLength - this.charReceived) ?\n this.charLength - this.charReceived :\n buffer.length;\n\n // add the new bytes to the char buffer\n buffer.copy(this.charBuffer, this.charReceived, 0, available);\n this.charReceived += available;\n\n if (this.charReceived < this.charLength) {\n // still not enough chars in this buffer? wait for more ...\n return '';\n }\n\n // remove bytes belonging to the current character from the buffer\n buffer = buffer.slice(available, buffer.length);\n\n // get the character that was split\n charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);\n\n // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character\n var charCode = charStr.charCodeAt(charStr.length - 1);\n if (charCode >= 0xD800 && charCode <= 0xDBFF) {\n this.charLength += this.surrogateSize;\n charStr = '';\n continue;\n }\n this.charReceived = this.charLength = 0;\n\n // if there are no more bytes in this buffer, just emit our char\n if (buffer.length === 0) {\n return charStr;\n }\n break;\n }\n\n // determine and set charLength / charReceived\n this.detectIncompleteChar(buffer);\n\n var end = buffer.length;\n if (this.charLength) {\n // buffer the incomplete character bytes we got\n buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);\n end -= this.charReceived;\n }\n\n charStr += buffer.toString(this.encoding, 0, end);\n\n var end = charStr.length - 1;\n var charCode = charStr.charCodeAt(end);\n // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character\n if (charCode >= 0xD800 && charCode <= 0xDBFF) {\n var size = this.surrogateSize;\n this.charLength += size;\n this.charReceived += size;\n this.charBuffer.copy(this.charBuffer, size, 0, size);\n buffer.copy(this.charBuffer, 0, 0, size);\n return charStr.substring(0, end);\n }\n\n // or just emit the charStr\n return charStr;\n};\n\n// detectIncompleteChar determines if there is an incomplete UTF-8 character at\n// the end of the given buffer. If so, it sets this.charLength to the byte\n// length that character, and sets this.charReceived to the number of bytes\n// that are available for this character.\nStringDecoder.prototype.detectIncompleteChar = function(buffer) {\n // determine how many bytes we have to check at the end of this buffer\n var i = (buffer.length >= 3) ? 3 : buffer.length;\n\n // Figure out if one of the last i bytes of our buffer announces an\n // incomplete char.\n for (; i > 0; i--) {\n var c = buffer[buffer.length - i];\n\n // See http://en.wikipedia.org/wiki/UTF-8#Description\n\n // 110XXXXX\n if (i == 1 && c >> 5 == 0x06) {\n this.charLength = 2;\n break;\n }\n\n // 1110XXXX\n if (i <= 2 && c >> 4 == 0x0E) {\n this.charLength = 3;\n break;\n }\n\n // 11110XXX\n if (i <= 3 && c >> 3 == 0x1E) {\n this.charLength = 4;\n break;\n }\n }\n this.charReceived = i;\n};\n\nStringDecoder.prototype.end = function(buffer) {\n var res = '';\n if (buffer && buffer.length)\n res = this.write(buffer);\n\n if (this.charReceived) {\n var cr = this.charReceived;\n var buf = this.charBuffer;\n var enc = this.encoding;\n res += buf.slice(0, cr).toString(enc);\n }\n\n return res;\n};\n\nfunction passThroughWrite(buffer) {\n return buffer.toString(this.encoding);\n}\n\nfunction utf16DetectIncompleteChar(buffer) {\n this.charReceived = buffer.length % 2;\n this.charLength = this.charReceived ? 2 : 0;\n}\n\nfunction base64DetectIncompleteChar(buffer) {\n this.charReceived = buffer.length % 3;\n this.charLength = this.charReceived ? 3 : 0;\n}\n\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/util/support/isBufferBrowser.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/assert/node_modules/util/support/isBufferBrowser.js\"][0].apply(exports,arguments)\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/util/util.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/assert/node_modules/util/util.js\"][0].apply(exports,arguments)\n},{\"./support/isBuffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/util/support/isBufferBrowser.js\",\"_process\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/process/browser.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/vm-browserify/index.js\":[function(require,module,exports){\nvar indexOf = require('indexof');\n\nvar Object_keys = function (obj) {\n if (Object.keys) return Object.keys(obj)\n else {\n var res = [];\n for (var key in obj) res.push(key)\n return res;\n }\n};\n\nvar forEach = function (xs, fn) {\n if (xs.forEach) return xs.forEach(fn)\n else for (var i = 0; i < xs.length; i++) {\n fn(xs[i], i, xs);\n }\n};\n\nvar defineProp = (function() {\n try {\n Object.defineProperty({}, '_', {});\n return function(obj, name, value) {\n Object.defineProperty(obj, name, {\n writable: true,\n enumerable: false,\n configurable: true,\n value: value\n })\n };\n } catch(e) {\n return function(obj, name, value) {\n obj[name] = value;\n };\n }\n}());\n\nvar globals = ['Array', 'Boolean', 'Date', 'Error', 'EvalError', 'Function',\n'Infinity', 'JSON', 'Math', 'NaN', 'Number', 'Object', 'RangeError',\n'ReferenceError', 'RegExp', 'String', 'SyntaxError', 'TypeError', 'URIError',\n'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'escape',\n'eval', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'undefined', 'unescape'];\n\nfunction Context() {}\nContext.prototype = {};\n\nvar Script = exports.Script = function NodeScript (code) {\n if (!(this instanceof Script)) return new Script(code);\n this.code = code;\n};\n\nScript.prototype.runInContext = function (context) {\n if (!(context instanceof Context)) {\n throw new TypeError(\"needs a 'context' argument.\");\n }\n \n var iframe = document.createElement('iframe');\n if (!iframe.style) iframe.style = {};\n iframe.style.display = 'none';\n \n document.body.appendChild(iframe);\n \n var win = iframe.contentWindow;\n var wEval = win.eval, wExecScript = win.execScript;\n\n if (!wEval && wExecScript) {\n // win.eval() magically appears when this is called in IE:\n wExecScript.call(win, 'null');\n wEval = win.eval;\n }\n \n forEach(Object_keys(context), function (key) {\n win[key] = context[key];\n });\n forEach(globals, function (key) {\n if (context[key]) {\n win[key] = context[key];\n }\n });\n \n var winKeys = Object_keys(win);\n\n var res = wEval.call(win, this.code);\n \n forEach(Object_keys(win), function (key) {\n // Avoid copying circular objects like `top` and `window` by only\n // updating existing context properties or new properties in the `win`\n // that was only introduced after the eval.\n if (key in context || indexOf(winKeys, key) === -1) {\n context[key] = win[key];\n }\n });\n\n forEach(globals, function (key) {\n if (!(key in context)) {\n defineProp(context, key, win[key]);\n }\n });\n \n document.body.removeChild(iframe);\n \n return res;\n};\n\nScript.prototype.runInThisContext = function () {\n return eval(this.code); // maybe...\n};\n\nScript.prototype.runInNewContext = function (context) {\n var ctx = Script.createContext(context);\n var res = this.runInContext(ctx);\n\n forEach(Object_keys(ctx), function (key) {\n context[key] = ctx[key];\n });\n\n return res;\n};\n\nforEach(Object_keys(Script.prototype), function (name) {\n exports[name] = Script[name] = function (code) {\n var s = Script(code);\n return s[name].apply(s, [].slice.call(arguments, 1));\n };\n});\n\nexports.createScript = function (code) {\n return exports.Script(code);\n};\n\nexports.createContext = Script.createContext = function (context) {\n var copy = new Context();\n if(typeof context === 'object') {\n forEach(Object_keys(context), function (key) {\n copy[key] = context[key];\n });\n }\n return copy;\n};\n\n},{\"indexof\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/vm-browserify/node_modules/indexof/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/vm-browserify/node_modules/indexof/index.js\":[function(require,module,exports){\n\nvar indexOf = [].indexOf;\n\nmodule.exports = function(arr, obj){\n if (indexOf) return arr.indexOf(obj);\n for (var i = 0; i < arr.length; ++i) {\n if (arr[i] === obj) return i;\n }\n return -1;\n};\n},{}],\"/home/itay/dev/pockets/node_modules/bs58/lib/bs58.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bs58check/node_modules/bs58/lib/bs58.js\"][0].apply(exports,arguments)\n},{}],\"/home/itay/dev/pockets/node_modules/ecurve/lib/curve.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/curve.js\"][0].apply(exports,arguments)\n},{\"./point\":\"/home/itay/dev/pockets/node_modules/ecurve/lib/point.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"bigi\":\"/home/itay/dev/pockets/node_modules/bigi/lib/index.js\"}],\"/home/itay/dev/pockets/node_modules/ecurve/lib/curves.json\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/curves.json\"][0].apply(exports,arguments)\n},{}],\"/home/itay/dev/pockets/node_modules/ecurve/lib/index.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/index.js\"][0].apply(exports,arguments)\n},{\"./curve\":\"/home/itay/dev/pockets/node_modules/ecurve/lib/curve.js\",\"./names\":\"/home/itay/dev/pockets/node_modules/ecurve/lib/names.js\",\"./point\":\"/home/itay/dev/pockets/node_modules/ecurve/lib/point.js\"}],\"/home/itay/dev/pockets/node_modules/ecurve/lib/names.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/names.js\"][0].apply(exports,arguments)\n},{\"./curve\":\"/home/itay/dev/pockets/node_modules/ecurve/lib/curve.js\",\"./curves\":\"/home/itay/dev/pockets/node_modules/ecurve/lib/curves.json\",\"bigi\":\"/home/itay/dev/pockets/node_modules/bigi/lib/index.js\"}],\"/home/itay/dev/pockets/node_modules/ecurve/lib/point.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/point.js\"][0].apply(exports,arguments)\n},{\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"bigi\":\"/home/itay/dev/pockets/node_modules/bigi/lib/index.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/eventemitter2/lib/eventemitter2.js\":[function(require,module,exports){\n/*!\n * EventEmitter2\n * https://github.com/hij1nx/EventEmitter2\n *\n * Copyright (c) 2013 hij1nx\n * Licensed under the MIT license.\n */\n;!function(undefined) {\n\n var isArray = Array.isArray ? Array.isArray : function _isArray(obj) {\n return Object.prototype.toString.call(obj) === \"[object Array]\";\n };\n var defaultMaxListeners = 10;\n\n function init() {\n this._events = {};\n if (this._conf) {\n configure.call(this, this._conf);\n }\n }\n\n function configure(conf) {\n if (conf) {\n\n this._conf = conf;\n\n conf.delimiter && (this.delimiter = conf.delimiter);\n conf.maxListeners && (this._events.maxListeners = conf.maxListeners);\n conf.wildcard && (this.wildcard = conf.wildcard);\n conf.newListener && (this.newListener = conf.newListener);\n\n if (this.wildcard) {\n this.listenerTree = {};\n }\n }\n }\n\n function EventEmitter(conf) {\n this._events = {};\n this.newListener = false;\n configure.call(this, conf);\n }\n\n //\n // Attention, function return type now is array, always !\n // It has zero elements if no any matches found and one or more\n // elements (leafs) if there are matches\n //\n function searchListenerTree(handlers, type, tree, i) {\n if (!tree) {\n return [];\n }\n var listeners=[], leaf, len, branch, xTree, xxTree, isolatedBranch, endReached,\n typeLength = type.length, currentType = type[i], nextType = type[i+1];\n if (i === typeLength && tree._listeners) {\n //\n // If at the end of the event(s) list and the tree has listeners\n // invoke those listeners.\n //\n if (typeof tree._listeners === 'function') {\n handlers && handlers.push(tree._listeners);\n return [tree];\n } else {\n for (leaf = 0, len = tree._listeners.length; leaf < len; leaf++) {\n handlers && handlers.push(tree._listeners[leaf]);\n }\n return [tree];\n }\n }\n\n if ((currentType === '*' || currentType === '**') || tree[currentType]) {\n //\n // If the event emitted is '*' at this part\n // or there is a concrete match at this patch\n //\n if (currentType === '*') {\n for (branch in tree) {\n if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {\n listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+1));\n }\n }\n return listeners;\n } else if(currentType === '**') {\n endReached = (i+1 === typeLength || (i+2 === typeLength && nextType === '*'));\n if(endReached && tree._listeners) {\n // The next element has a _listeners, add it to the handlers.\n listeners = listeners.concat(searchListenerTree(handlers, type, tree, typeLength));\n }\n\n for (branch in tree) {\n if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {\n if(branch === '*' || branch === '**') {\n if(tree[branch]._listeners && !endReached) {\n listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], typeLength));\n }\n listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i));\n } else if(branch === nextType) {\n listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+2));\n } else {\n // No match on this one, shift into the tree but not in the type array.\n listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i));\n }\n }\n }\n return listeners;\n }\n\n listeners = listeners.concat(searchListenerTree(handlers, type, tree[currentType], i+1));\n }\n\n xTree = tree['*'];\n if (xTree) {\n //\n // If the listener tree will allow any match for this part,\n // then recursively explore all branches of the tree\n //\n searchListenerTree(handlers, type, xTree, i+1);\n }\n\n xxTree = tree['**'];\n if(xxTree) {\n if(i < typeLength) {\n if(xxTree._listeners) {\n // If we have a listener on a '**', it will catch all, so add its handler.\n searchListenerTree(handlers, type, xxTree, typeLength);\n }\n\n // Build arrays of matching next branches and others.\n for(branch in xxTree) {\n if(branch !== '_listeners' && xxTree.hasOwnProperty(branch)) {\n if(branch === nextType) {\n // We know the next element will match, so jump twice.\n searchListenerTree(handlers, type, xxTree[branch], i+2);\n } else if(branch === currentType) {\n // Current node matches, move into the tree.\n searchListenerTree(handlers, type, xxTree[branch], i+1);\n } else {\n isolatedBranch = {};\n isolatedBranch[branch] = xxTree[branch];\n searchListenerTree(handlers, type, { '**': isolatedBranch }, i+1);\n }\n }\n }\n } else if(xxTree._listeners) {\n // We have reached the end and still on a '**'\n searchListenerTree(handlers, type, xxTree, typeLength);\n } else if(xxTree['*'] && xxTree['*']._listeners) {\n searchListenerTree(handlers, type, xxTree['*'], typeLength);\n }\n }\n\n return listeners;\n }\n\n function growListenerTree(type, listener) {\n\n type = typeof type === 'string' ? type.split(this.delimiter) : type.slice();\n\n //\n // Looks for two consecutive '**', if so, don't add the event at all.\n //\n for(var i = 0, len = type.length; i+1 < len; i++) {\n if(type[i] === '**' && type[i+1] === '**') {\n return;\n }\n }\n\n var tree = this.listenerTree;\n var name = type.shift();\n\n while (name) {\n\n if (!tree[name]) {\n tree[name] = {};\n }\n\n tree = tree[name];\n\n if (type.length === 0) {\n\n if (!tree._listeners) {\n tree._listeners = listener;\n }\n else if(typeof tree._listeners === 'function') {\n tree._listeners = [tree._listeners, listener];\n }\n else if (isArray(tree._listeners)) {\n\n tree._listeners.push(listener);\n\n if (!tree._listeners.warned) {\n\n var m = defaultMaxListeners;\n\n if (typeof this._events.maxListeners !== 'undefined') {\n m = this._events.maxListeners;\n }\n\n if (m > 0 && tree._listeners.length > m) {\n\n tree._listeners.warned = true;\n console.error('(node) warning: possible EventEmitter memory ' +\n 'leak detected. %d listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.',\n tree._listeners.length);\n console.trace();\n }\n }\n }\n return true;\n }\n name = type.shift();\n }\n return true;\n }\n\n // By default EventEmitters will print a warning if more than\n // 10 listeners are added to it. This is a useful default which\n // helps finding memory leaks.\n //\n // Obviously not all Emitters should be limited to 10. This function allows\n // that to be increased. Set to zero for unlimited.\n\n EventEmitter.prototype.delimiter = '.';\n\n EventEmitter.prototype.setMaxListeners = function(n) {\n this._events || init.call(this);\n this._events.maxListeners = n;\n if (!this._conf) this._conf = {};\n this._conf.maxListeners = n;\n };\n\n EventEmitter.prototype.event = '';\n\n EventEmitter.prototype.once = function(event, fn) {\n this.many(event, 1, fn);\n return this;\n };\n\n EventEmitter.prototype.many = function(event, ttl, fn) {\n var self = this;\n\n if (typeof fn !== 'function') {\n throw new Error('many only accepts instances of Function');\n }\n\n function listener() {\n if (--ttl === 0) {\n self.off(event, listener);\n }\n fn.apply(this, arguments);\n }\n\n listener._origin = fn;\n\n this.on(event, listener);\n\n return self;\n };\n\n EventEmitter.prototype.emit = function() {\n\n this._events || init.call(this);\n\n var type = arguments[0];\n\n if (type === 'newListener' && !this.newListener) {\n if (!this._events.newListener) { return false; }\n }\n\n // Loop through the *_all* functions and invoke them.\n if (this._all) {\n var l = arguments.length;\n var args = new Array(l - 1);\n for (var i = 1; i < l; i++) args[i - 1] = arguments[i];\n for (i = 0, l = this._all.length; i < l; i++) {\n this.event = type;\n this._all[i].apply(this, args);\n }\n }\n\n // If there is no 'error' event listener then throw.\n if (type === 'error') {\n\n if (!this._all &&\n !this._events.error &&\n !(this.wildcard && this.listenerTree.error)) {\n\n if (arguments[1] instanceof Error) {\n throw arguments[1]; // Unhandled 'error' event\n } else {\n throw new Error(\"Uncaught, unspecified 'error' event.\");\n }\n return false;\n }\n }\n\n var handler;\n\n if(this.wildcard) {\n handler = [];\n var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();\n searchListenerTree.call(this, handler, ns, this.listenerTree, 0);\n }\n else {\n handler = this._events[type];\n }\n\n if (typeof handler === 'function') {\n this.event = type;\n if (arguments.length === 1) {\n handler.call(this);\n }\n else if (arguments.length > 1)\n switch (arguments.length) {\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n default:\n var l = arguments.length;\n var args = new Array(l - 1);\n for (var i = 1; i < l; i++) args[i - 1] = arguments[i];\n handler.apply(this, args);\n }\n return true;\n }\n else if (handler) {\n var l = arguments.length;\n var args = new Array(l - 1);\n for (var i = 1; i < l; i++) args[i - 1] = arguments[i];\n\n var listeners = handler.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n this.event = type;\n listeners[i].apply(this, args);\n }\n return (listeners.length > 0) || !!this._all;\n }\n else {\n return !!this._all;\n }\n\n };\n\n EventEmitter.prototype.on = function(type, listener) {\n\n if (typeof type === 'function') {\n this.onAny(type);\n return this;\n }\n\n if (typeof listener !== 'function') {\n throw new Error('on only accepts instances of Function');\n }\n this._events || init.call(this);\n\n // To avoid recursion in the case that type == \"newListeners\"! Before\n // adding it to the listeners, first emit \"newListeners\".\n this.emit('newListener', type, listener);\n\n if(this.wildcard) {\n growListenerTree.call(this, type, listener);\n return this;\n }\n\n if (!this._events[type]) {\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n }\n else if(typeof this._events[type] === 'function') {\n // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener];\n }\n else if (isArray(this._events[type])) {\n // If we've already got an array, just append.\n this._events[type].push(listener);\n\n // Check for listener leak\n if (!this._events[type].warned) {\n\n var m = defaultMaxListeners;\n\n if (typeof this._events.maxListeners !== 'undefined') {\n m = this._events.maxListeners;\n }\n\n if (m > 0 && this._events[type].length > m) {\n\n this._events[type].warned = true;\n console.error('(node) warning: possible EventEmitter memory ' +\n 'leak detected. %d listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.',\n this._events[type].length);\n console.trace();\n }\n }\n }\n return this;\n };\n\n EventEmitter.prototype.onAny = function(fn) {\n\n if (typeof fn !== 'function') {\n throw new Error('onAny only accepts instances of Function');\n }\n\n if(!this._all) {\n this._all = [];\n }\n\n // Add the function to the event listener collection.\n this._all.push(fn);\n return this;\n };\n\n EventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n EventEmitter.prototype.off = function(type, listener) {\n if (typeof listener !== 'function') {\n throw new Error('removeListener only takes instances of Function');\n }\n\n var handlers,leafs=[];\n\n if(this.wildcard) {\n var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();\n leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0);\n }\n else {\n // does not use listeners(), so no side effect of creating _events[type]\n if (!this._events[type]) return this;\n handlers = this._events[type];\n leafs.push({_listeners:handlers});\n }\n\n for (var iLeaf=0; iLeaf 0) {\n fns = this._all;\n for(i = 0, l = fns.length; i < l; i++) {\n if(fn === fns[i]) {\n fns.splice(i, 1);\n return this;\n }\n }\n } else {\n this._all = [];\n }\n return this;\n };\n\n EventEmitter.prototype.removeListener = EventEmitter.prototype.off;\n\n EventEmitter.prototype.removeAllListeners = function(type) {\n if (arguments.length === 0) {\n !this._events || init.call(this);\n return this;\n }\n\n if(this.wildcard) {\n var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();\n var leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0);\n\n for (var iLeaf=0; iLeaf this.quota) {\n throw new QUOTA_EXCEEDED_ERR();\n }\n fs.writeFileSync(filename, valueString, 'utf8');\n if (!existsBeforeSet) {\n this.keys.push(key);\n this.length = this.keys.length;\n return this.bytesInUse += valueStringLength;\n }\n };\n\n LocalStorage.prototype.getItem = function(key) {\n var filename;\n key = key.toString();\n filename = path.join(this.location, encodeURIComponent(key));\n if (fs.existsSync(filename)) {\n return fs.readFileSync(filename, 'utf8');\n } else {\n return null;\n }\n };\n\n LocalStorage.prototype.getStat = function(key) {\n var filename;\n key = key.toString();\n filename = path.join(this.location, encodeURIComponent(key));\n if (fs.existsSync(filename)) {\n return fs.statSync(filename, 'utf8');\n } else {\n return null;\n }\n };\n\n LocalStorage.prototype.removeItem = function(key) {\n var filename;\n key = key.toString();\n filename = path.join(this.location, encodeURIComponent(key));\n if (fs.existsSync(filename)) {\n _rm(filename);\n }\n return this._init();\n };\n\n LocalStorage.prototype.key = function(n) {\n return this.keys[n];\n };\n\n LocalStorage.prototype.clear = function() {\n _emptyDirectory(this.location);\n this.keys = [];\n this.length = 0;\n return this.bytesInUse = 0;\n };\n\n LocalStorage.prototype.getBytesInUse = function() {\n return this.bytesInUse;\n };\n\n LocalStorage.prototype._deleteLocation = function() {\n _rm(this.location);\n this.keys = [];\n this.length = 0;\n return this.bytesInUse = 0;\n };\n\n return LocalStorage;\n\n })();\n\n JSONStorage = (function(_super) {\n __extends(JSONStorage, _super);\n\n function JSONStorage() {\n return JSONStorage.__super__.constructor.apply(this, arguments);\n }\n\n JSONStorage.prototype.setItem = function(key, value) {\n var newValue;\n newValue = JSON.stringify(value);\n return JSONStorage.__super__.setItem.call(this, key, newValue);\n };\n\n JSONStorage.prototype.getItem = function(key) {\n return JSON.parse(JSONStorage.__super__.getItem.call(this, key));\n };\n\n return JSONStorage;\n\n })(LocalStorage);\n\n exports.LocalStorage = LocalStorage;\n\n exports.JSONStorage = JSONStorage;\n\n exports.QUOTA_EXCEEDED_ERR = QUOTA_EXCEEDED_ERR;\n\n}).call(this);\n\n},{\"fs\":\"/home/itay/dev/pockets/node_modules/browserify/lib/_empty.js\",\"path\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/path-browserify/index.js\"}],\"/home/itay/dev/pockets/node_modules/thenify-all/index.js\":[function(require,module,exports){\n\nvar thenify = require('thenify')\n\nmodule.exports = thenifyAll\nthenifyAll.withCallback = withCallback\nthenifyAll.thenify = thenify\n\n/**\n * Promisifies all the selected functions in an object.\n *\n * @param {Object} source the source object for the async functions\n * @param {Object} [destination] the destination to set all the promisified methods\n * @param {Array} [methods] an array of method names of `source`\n * @return {Object}\n * @api public\n */\n\nfunction thenifyAll(source, destination, methods) {\n return promisifyAll(source, destination, methods, thenify)\n}\n\n/**\n * Promisifies all the selected functions in an object and backward compatible with callback.\n *\n * @param {Object} source the source object for the async functions\n * @param {Object} [destination] the destination to set all the promisified methods\n * @param {Array} [methods] an array of method names of `source`\n * @return {Object}\n * @api public\n */\n\nfunction withCallback(source, destination, methods) {\n return promisifyAll(source, destination, methods, thenify.withCallback)\n}\n\nfunction promisifyAll(source, destination, methods, promisify) {\n if (!destination) {\n destination = {};\n methods = Object.keys(source)\n }\n\n if (Array.isArray(destination)) {\n methods = destination\n destination = {}\n }\n\n if (!methods) {\n methods = Object.keys(source)\n }\n\n if (typeof source === 'function') destination = promisify(source)\n\n methods.forEach(function (name) {\n // promisify only if it's a function\n if (typeof source[name] === 'function') destination[name] = promisify(source[name])\n })\n\n // proxy the rest\n Object.keys(source).forEach(function (name) {\n if (deprecated(source, name)) return\n if (destination[name]) return\n destination[name] = source[name]\n })\n\n return destination\n}\n\nfunction deprecated(source, name) {\n var desc = Object.getOwnPropertyDescriptor(source, name)\n if (!desc || !desc.get) return false\n if (desc.get.name === 'deprecated') return true\n return false\n}\n\n},{\"thenify\":\"/home/itay/dev/pockets/node_modules/thenify-all/node_modules/thenify/index.js\"}],\"/home/itay/dev/pockets/node_modules/thenify-all/node_modules/thenify/index.js\":[function(require,module,exports){\n\nvar Promise = require('native-or-bluebird')\nvar assert = require('assert')\n\nmodule.exports = thenify\n\n/**\n * Turn async functions into promises\n *\n * @param {Function} $$__fn__$$\n * @return {Function}\n * @api public\n */\n\nfunction thenify($$__fn__$$) {\n assert(typeof $$__fn__$$ === 'function')\n return eval(createWraper($$__fn__$$.name))\n}\n\n/**\n * Turn async functions into promises and backward compatible with callback\n *\n * @param {Function} $$__fn__$$\n * @return {Function}\n * @api public\n */\n\nthenify.withCallback = function ($$__fn__$$) {\n assert(typeof $$__fn__$$ === 'function')\n return eval(createWraper($$__fn__$$.name, true))\n}\n\nfunction createCallback(resolve, reject) {\n return function(err, value) {\n if (err) return reject(err)\n var length = arguments.length\n if (length <= 2) return resolve(value)\n var values = new Array(length - 1)\n for (var i = 1; i < length; ++i) values[i - 1] = arguments[i]\n resolve(values)\n }\n}\n\nfunction createWraper(name, withCallback) {\n withCallback = withCallback ?\n 'var lastType = typeof arguments[len - 1]\\n'\n + 'if (lastType === \"function\") return $$__fn__$$.apply(self, arguments)\\n'\n : ''\n\n return '(function ' + (name || '') + '() {\\n'\n + 'var self = this\\n'\n + 'var len = arguments.length\\n'\n + withCallback\n + 'var args = new Array(len + 1)\\n'\n + 'for (var i = 0; i < len; ++i) args[i] = arguments[i]\\n'\n + 'var lastIndex = i\\n'\n + 'return new Promise(function (resolve, reject) {\\n'\n + 'args[lastIndex] = createCallback(resolve, reject)\\n'\n + '$$__fn__$$.apply(self, args)\\n'\n + '})\\n'\n + '})'\n}\n\n},{\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"native-or-bluebird\":\"/home/itay/dev/pockets/node_modules/thenify-all/node_modules/thenify/node_modules/native-or-bluebird/index.js\"}],\"/home/itay/dev/pockets/node_modules/thenify-all/node_modules/thenify/node_modules/native-or-bluebird/index.js\":[function(require,module,exports){\n(function (process){\n\nmodule.exports = require('./promise')\n\n/* istanbul ignore next */\nif (!module.exports) {\n console.error('The file \"%s\" requires `Promise`,', module.parent.filename)\n console.error('but neither `bluebird` nor the native `Promise` implementation were found.')\n console.error('Please install `bluebird` yourself.')\n process.exit(1)\n}\n\n}).call(this,require('_process'))\n},{\"./promise\":\"/home/itay/dev/pockets/node_modules/thenify-all/node_modules/thenify/node_modules/native-or-bluebird/promise.js\",\"_process\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/process/browser.js\"}],\"/home/itay/dev/pockets/node_modules/thenify-all/node_modules/thenify/node_modules/native-or-bluebird/promise.js\":[function(require,module,exports){\n(function (global){\n\ntry {\n module.exports = require('bluebird')\n} catch (_) {\n module.exports = global.Promise\n}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"bluebird\":\"/home/itay/dev/pockets/node_modules/bluebird/js/browser/bluebird.js\"}],\"/home/itay/dev/pockets/node_modules/traverse/index.js\":[function(require,module,exports){\nvar traverse = module.exports = function (obj) {\n return new Traverse(obj);\n};\n\nfunction Traverse (obj) {\n this.value = obj;\n}\n\nTraverse.prototype.get = function (ps) {\n var node = this.value;\n for (var i = 0; i < ps.length; i ++) {\n var key = ps[i];\n if (!node || !hasOwnProperty.call(node, key)) {\n node = undefined;\n break;\n }\n node = node[key];\n }\n return node;\n};\n\nTraverse.prototype.has = function (ps) {\n var node = this.value;\n for (var i = 0; i < ps.length; i ++) {\n var key = ps[i];\n if (!node || !hasOwnProperty.call(node, key)) {\n return false;\n }\n node = node[key];\n }\n return true;\n};\n\nTraverse.prototype.set = function (ps, value) {\n var node = this.value;\n for (var i = 0; i < ps.length - 1; i ++) {\n var key = ps[i];\n if (!hasOwnProperty.call(node, key)) node[key] = {};\n node = node[key];\n }\n node[ps[i]] = value;\n return value;\n};\n\nTraverse.prototype.map = function (cb) {\n return walk(this.value, cb, true);\n};\n\nTraverse.prototype.forEach = function (cb) {\n this.value = walk(this.value, cb, false);\n return this.value;\n};\n\nTraverse.prototype.reduce = function (cb, init) {\n var skip = arguments.length === 1;\n var acc = skip ? this.value : init;\n this.forEach(function (x) {\n if (!this.isRoot || !skip) {\n acc = cb.call(this, acc, x);\n }\n });\n return acc;\n};\n\nTraverse.prototype.paths = function () {\n var acc = [];\n this.forEach(function (x) {\n acc.push(this.path); \n });\n return acc;\n};\n\nTraverse.prototype.nodes = function () {\n var acc = [];\n this.forEach(function (x) {\n acc.push(this.node);\n });\n return acc;\n};\n\nTraverse.prototype.clone = function () {\n var parents = [], nodes = [];\n \n return (function clone (src) {\n for (var i = 0; i < parents.length; i++) {\n if (parents[i] === src) {\n return nodes[i];\n }\n }\n \n if (typeof src === 'object' && src !== null) {\n var dst = copy(src);\n \n parents.push(src);\n nodes.push(dst);\n \n forEach(objectKeys(src), function (key) {\n dst[key] = clone(src[key]);\n });\n \n parents.pop();\n nodes.pop();\n return dst;\n }\n else {\n return src;\n }\n })(this.value);\n};\n\nfunction walk (root, cb, immutable) {\n var path = [];\n var parents = [];\n var alive = true;\n \n return (function walker (node_) {\n var node = immutable ? copy(node_) : node_;\n var modifiers = {};\n \n var keepGoing = true;\n \n var state = {\n node : node,\n node_ : node_,\n path : [].concat(path),\n parent : parents[parents.length - 1],\n parents : parents,\n key : path.slice(-1)[0],\n isRoot : path.length === 0,\n level : path.length,\n circular : null,\n update : function (x, stopHere) {\n if (!state.isRoot) {\n state.parent.node[state.key] = x;\n }\n state.node = x;\n if (stopHere) keepGoing = false;\n },\n 'delete' : function (stopHere) {\n delete state.parent.node[state.key];\n if (stopHere) keepGoing = false;\n },\n remove : function (stopHere) {\n if (isArray(state.parent.node)) {\n state.parent.node.splice(state.key, 1);\n }\n else {\n delete state.parent.node[state.key];\n }\n if (stopHere) keepGoing = false;\n },\n keys : null,\n before : function (f) { modifiers.before = f },\n after : function (f) { modifiers.after = f },\n pre : function (f) { modifiers.pre = f },\n post : function (f) { modifiers.post = f },\n stop : function () { alive = false },\n block : function () { keepGoing = false }\n };\n \n if (!alive) return state;\n \n function updateState() {\n if (typeof state.node === 'object' && state.node !== null) {\n if (!state.keys || state.node_ !== state.node) {\n state.keys = objectKeys(state.node)\n }\n \n state.isLeaf = state.keys.length == 0;\n \n for (var i = 0; i < parents.length; i++) {\n if (parents[i].node_ === node_) {\n state.circular = parents[i];\n break;\n }\n }\n }\n else {\n state.isLeaf = true;\n state.keys = null;\n }\n \n state.notLeaf = !state.isLeaf;\n state.notRoot = !state.isRoot;\n }\n \n updateState();\n \n // use return values to update if defined\n var ret = cb.call(state, state.node);\n if (ret !== undefined && state.update) state.update(ret);\n \n if (modifiers.before) modifiers.before.call(state, state.node);\n \n if (!keepGoing) return state;\n \n if (typeof state.node == 'object'\n && state.node !== null && !state.circular) {\n parents.push(state);\n \n updateState();\n \n forEach(state.keys, function (key, i) {\n path.push(key);\n \n if (modifiers.pre) modifiers.pre.call(state, state.node[key], key);\n \n var child = walker(state.node[key]);\n if (immutable && hasOwnProperty.call(state.node, key)) {\n state.node[key] = child.node;\n }\n \n child.isLast = i == state.keys.length - 1;\n child.isFirst = i == 0;\n \n if (modifiers.post) modifiers.post.call(state, child);\n \n path.pop();\n });\n parents.pop();\n }\n \n if (modifiers.after) modifiers.after.call(state, state.node);\n \n return state;\n })(root).node;\n}\n\nfunction copy (src) {\n if (typeof src === 'object' && src !== null) {\n var dst;\n \n if (isArray(src)) {\n dst = [];\n }\n else if (isDate(src)) {\n dst = new Date(src.getTime ? src.getTime() : src);\n }\n else if (isRegExp(src)) {\n dst = new RegExp(src);\n }\n else if (isError(src)) {\n dst = { message: src.message };\n }\n else if (isBoolean(src)) {\n dst = new Boolean(src);\n }\n else if (isNumber(src)) {\n dst = new Number(src);\n }\n else if (isString(src)) {\n dst = new String(src);\n }\n else if (Object.create && Object.getPrototypeOf) {\n dst = Object.create(Object.getPrototypeOf(src));\n }\n else if (src.constructor === Object) {\n dst = {};\n }\n else {\n var proto =\n (src.constructor && src.constructor.prototype)\n || src.__proto__\n || {}\n ;\n var T = function () {};\n T.prototype = proto;\n dst = new T;\n }\n \n forEach(objectKeys(src), function (key) {\n dst[key] = src[key];\n });\n return dst;\n }\n else return src;\n}\n\nvar objectKeys = Object.keys || function keys (obj) {\n var res = [];\n for (var key in obj) res.push(key)\n return res;\n};\n\nfunction toS (obj) { return Object.prototype.toString.call(obj) }\nfunction isDate (obj) { return toS(obj) === '[object Date]' }\nfunction isRegExp (obj) { return toS(obj) === '[object RegExp]' }\nfunction isError (obj) { return toS(obj) === '[object Error]' }\nfunction isBoolean (obj) { return toS(obj) === '[object Boolean]' }\nfunction isNumber (obj) { return toS(obj) === '[object Number]' }\nfunction isString (obj) { return toS(obj) === '[object String]' }\n\nvar isArray = Array.isArray || function isArray (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};\n\nvar forEach = function (xs, fn) {\n if (xs.forEach) return xs.forEach(fn)\n else for (var i = 0; i < xs.length; i++) {\n fn(xs[i], i, xs);\n }\n};\n\nforEach(objectKeys(Traverse.prototype), function (key) {\n traverse[key] = function (obj) {\n var args = [].slice.call(arguments, 1);\n var t = new Traverse(obj);\n return t[key].apply(t, args);\n };\n});\n\nvar hasOwnProperty = Object.hasOwnProperty || function (obj, key) {\n return key in obj;\n};\n\n},{}],\"/home/itay/dev/pockets/package.json\":[function(require,module,exports){\nmodule.exports={\n \"name\": \"pockets\",\n \"version\": \"1.0.0\",\n \"description\": \"pockets: An Ionic project\",\n \"scripts\": {\n \"test\": \"mocha\",\n \"test:coverage\": \"istanbul cover ./node_modules/.bin/_mocha -- -R dot test\",\n \"coveralls\": \"cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js\",\n \"build\": \"gulp build\"\n },\n \"dependencies\": {\n \"bigi\": \"^1.4.0\",\n \"bitcoinjs-lib\": \"^1.5.1\",\n \"bluebird\": \"^2.9.14\",\n \"bs58\": \"^2.0.1\",\n \"buffer\": \"^3.1.1\",\n \"ecurve\": \"^1.0.1\",\n \"eventemitter2\": \"^0.4.14\",\n \"node-localstorage\": \"^0.5.0\",\n \"thenify-all\": \"^1.6.0\",\n \"traverse\": \"^0.6.6\",\n \"underscore\": \"^1.8.2\"\n },\n \"devDependencies\": {\n \"brfs\": \"^1.4.0\",\n \"browserify\": \"^9.0.3\",\n \"assert\": \"^1.3.0\",\n \"bower\": \"^1.3.3\",\n \"chai\": \"^2.1.1\",\n \"coveralls\": \"^2.11.2\",\n \"gulp\": \"^3.5.6\",\n \"gulp-concat\": \"^2.2.0\",\n \"gulp-minify-css\": \"^0.3.0\",\n \"gulp-rename\": \"^1.2.0\",\n \"gulp-sass\": \"^0.7.1\",\n \"gulp-sourcemaps\": \"^1.5.0\",\n \"gulp-util\": \"^2.2.14\",\n \"istanbul\": \"^0.3.7\",\n \"mocha\": \"^2.2.1\",\n \"shelljs\": \"^0.3.0\",\n \"should\": \"^5.2.0\",\n \"sinon\": \"^1.13.0\",\n \"sinon-chai\": \"^2.7.0\",\n \"watchify\": \"^2.4.0\",\n \"vinyl-buffer\": \"^1.0.0\",\n \"vinyl-source-stream\": \"^1.1.0\"\n }\n}\n\n},{}],\"/home/itay/dev/pockets/www/lib/pockets/common/config.js\":[function(require,module,exports){\nvar config = module.exports;\n\nconfig.get = function (\n key) {\n return engine.db.get(key);\n};\n\nconfig.set = function (key, value) {\n return engine.db.set(key, value);\n};\n},{}],\"/home/itay/dev/pockets/www/lib/pockets/common/db.js\":[function(require,module,exports){\n(function (global){\nvar db = module.exports;\nif (typeof global.localStorage === 'undefined') {\n var LocalStorage = require('node-localstorage').LocalStorage;\n db._localStorage = new LocalStorage('./scratch');\n}\nelse\n db._localStorage = global.localStroage;\n\ndb.get = function (key) {\n return db._localStorage.getItem(key);\n};\n\ndb.set = function (key, value) {\n return db._localStorage.setItem(key, value);\n};\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"node-localstorage\":\"/home/itay/dev/pockets/node_modules/node-localstorage/LocalStorage.js\"}],\"/home/itay/dev/pockets/www/lib/pockets/common/events.js\":[function(require,module,exports){\nvar\n EventEmitter2 = require('eventemitter2').EventEmitter2;\n\nvar _events = new EventEmitter2({wildcard: true, newListener: true});\n\nmodule.exports = exports = _events;\n},{\"eventemitter2\":\"/home/itay/dev/pockets/node_modules/eventemitter2/lib/eventemitter2.js\"}],\"/home/itay/dev/pockets/www/lib/pockets/common/globals.js\":[function(require,module,exports){\n(function (global){\nglobal.emptyfunc = function () {\n\n};\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],\"/home/itay/dev/pockets/www/lib/pockets/common/index.js\":[function(require,module,exports){\nvar util = require('util');\n\nvar common = module.exports;\n\ncommon.extend = util._extend;\n\ncommon.inspect = function (obj) {\n console.log(util.inspect(obj, {depth: null, colors: true}));\n};\n},{\"util\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/util/util.js\"}],\"/home/itay/dev/pockets/www/lib/pockets/common/logger.js\":[function(require,module,exports){\nvar logger = module.exports;\n\n['silly', 'trace', 'debug', 'info', 'warn', 'error'].forEach(function (level) {\n logger[level] = function (msg) {\n if (console[level])\n console[level](msg);\n }\n});\n},{}],\"/home/itay/dev/pockets/www/lib/pockets/services/bitcoin.js\":[function(require,module,exports){\nvar\n _bitcoin = require('bitcoinjs-lib'),\n base58 = require('bs58'),\n ecurve = require('ecurve'),\n BigInteger = require('bigi'),\n Buffer = require('buffer');\n\nvar bitcoin = module.exports;\n\n\nbitcoin.validateWallet = function (options, callback) {\n function isAddress(string) {\n try {\n _bitcoin.Address.fromBase58Check(string);\n } catch (e) {\n return false;\n }\n return true;\n }\n\n if (isAddress(options.address))\n return callback(null);\n return callback(new Error('Invalid wallet address [' + options.address + '].'))\n};\n},{\"bigi\":\"/home/itay/dev/pockets/node_modules/bigi/lib/index.js\",\"bitcoinjs-lib\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/index.js\",\"bs58\":\"/home/itay/dev/pockets/node_modules/bs58/lib/bs58.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"ecurve\":\"/home/itay/dev/pockets/node_modules/ecurve/lib/index.js\"}],\"/home/itay/dev/pockets/www/lib/pockets/services/pockets.js\":[function(require,module,exports){\nvar traverse = require('traverse');\n\nvar pockets = module.exports;\n\npockets.ROOT = null;\n\npockets.list = function (options, callback) {\n callback = callback || emptyfunc;\n\n return callback(null, pockets.ROOT);\n};\n\npockets.get = function (options, callback) {\n callback = callback || emptyfunc;\n\n var result = null;\n traverse.map(pockets.ROOT, function (x) {\n var point = this;\n if (x && typeof x === 'object' && x.name) { //we have a pocket\n if (x.name === options.name)\n result = point;\n }\n });\n if (!result)\n return callback(new Error('Pocket [' + options.name + '] cannot be found.'));\n result = traverse.get(pockets.ROOT, result.path);\n return callback(null, result);\n};\n\npockets.create = function (options, callback) {\n callback = callback || emptyfunc;\n\n if (!options.parent) {\n pockets.ROOT = options;\n return callback(null);\n }\n else {\n pockets.get({name: options.parent}, function (err, pocket) {\n if (err)\n return callback(err);\n\n pocket.pockets = pocket.pockets || {};\n pocket.pockets[options.name] = options;\n return callback(null);\n });\n }\n};\n\npockets.update = function (options, callback) {\n callback = callback || emptyfunc;\n\n pockets.get(options, function (err, _pocket) {\n _pocket = engine.common.extend(_pocket, options);\n return callback(null);\n });\n};\n\npockets.delete = function (options, callback) {\n callback = callback || emptyfunc;\n\n traverse.forEach(pockets.ROOT, function (x) {\n var point = this;\n if (x && typeof x === 'object' && x.name) { //we have a pocket\n if (x.name === options.name) {\n delete point.parent.parent.node.pockets[options.name];\n }\n }\n });\n\n return callback(null);\n};\n},{\"traverse\":\"/home/itay/dev/pockets/node_modules/traverse/index.js\"}]},{},[\"./www/lib/pockets/engine.js\"]);\n"],"file":"pockets.bundle.js","sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"names":[],"mappings":"","sources":["pockets.bundle.js"],"sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the 'Software'), to\n// deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n// sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// when used in node, this will actually load the util module we depend on\n// versus loading the builtin util module as happens otherwise\n// this is a bug in node module loading as far as I am concerned\nvar util = require('util/');\n\nvar pSlice = Array.prototype.slice;\nvar hasOwn = Object.prototype.hasOwnProperty;\n\n// 1. The assert module provides functions that throw\n// AssertionError's when particular conditions are not met. The\n// assert module must conform to the following interface.\n\nvar assert = module.exports = ok;\n\n// 2. The AssertionError is defined in assert.\n// new assert.AssertionError({ message: message,\n// actual: actual,\n// expected: expected })\n\nassert.AssertionError = function AssertionError(options) {\n this.name = 'AssertionError';\n this.actual = options.actual;\n this.expected = options.expected;\n this.operator = options.operator;\n if (options.message) {\n this.message = options.message;\n this.generatedMessage = false;\n } else {\n this.message = getMessage(this);\n this.generatedMessage = true;\n }\n var stackStartFunction = options.stackStartFunction || fail;\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, stackStartFunction);\n }\n else {\n // non v8 browsers so we can have a stacktrace\n var err = new Error();\n if (err.stack) {\n var out = err.stack;\n\n // try to strip useless frames\n var fn_name = stackStartFunction.name;\n var idx = out.indexOf('\\n' + fn_name);\n if (idx >= 0) {\n // once we have located the function frame\n // we need to strip out everything before it (and its line)\n var next_line = out.indexOf('\\n', idx + 1);\n out = out.substring(next_line + 1);\n }\n\n this.stack = out;\n }\n }\n};\n\n// assert.AssertionError instanceof Error\nutil.inherits(assert.AssertionError, Error);\n\nfunction replacer(key, value) {\n if (util.isUndefined(value)) {\n return '' + value;\n }\n if (util.isNumber(value) && !isFinite(value)) {\n return value.toString();\n }\n if (util.isFunction(value) || util.isRegExp(value)) {\n return value.toString();\n }\n return value;\n}\n\nfunction truncate(s, n) {\n if (util.isString(s)) {\n return s.length < n ? s : s.slice(0, n);\n } else {\n return s;\n }\n}\n\nfunction getMessage(self) {\n return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' +\n self.operator + ' ' +\n truncate(JSON.stringify(self.expected, replacer), 128);\n}\n\n// At present only the three keys mentioned above are used and\n// understood by the spec. Implementations or sub modules can pass\n// other keys to the AssertionError's constructor - they will be\n// ignored.\n\n// 3. All of the following functions must throw an AssertionError\n// when a corresponding condition is not met, with a message that\n// may be undefined if not provided. All assertion methods provide\n// both the actual and expected values to the assertion error for\n// display purposes.\n\nfunction fail(actual, expected, message, operator, stackStartFunction) {\n throw new assert.AssertionError({\n message: message,\n actual: actual,\n expected: expected,\n operator: operator,\n stackStartFunction: stackStartFunction\n });\n}\n\n// EXTENSION! allows for well behaved errors defined elsewhere.\nassert.fail = fail;\n\n// 4. Pure assertion tests whether a value is truthy, as determined\n// by !!guard.\n// assert.ok(guard, message_opt);\n// This statement is equivalent to assert.equal(true, !!guard,\n// message_opt);. To test strictly for the value true, use\n// assert.strictEqual(true, guard, message_opt);.\n\nfunction ok(value, message) {\n if (!value) fail(value, true, message, '==', assert.ok);\n}\nassert.ok = ok;\n\n// 5. The equality assertion tests shallow, coercive equality with\n// ==.\n// assert.equal(actual, expected, message_opt);\n\nassert.equal = function equal(actual, expected, message) {\n if (actual != expected) fail(actual, expected, message, '==', assert.equal);\n};\n\n// 6. The non-equality assertion tests for whether two objects are not equal\n// with != assert.notEqual(actual, expected, message_opt);\n\nassert.notEqual = function notEqual(actual, expected, message) {\n if (actual == expected) {\n fail(actual, expected, message, '!=', assert.notEqual);\n }\n};\n\n// 7. The equivalence assertion tests a deep equality relation.\n// assert.deepEqual(actual, expected, message_opt);\n\nassert.deepEqual = function deepEqual(actual, expected, message) {\n if (!_deepEqual(actual, expected)) {\n fail(actual, expected, message, 'deepEqual', assert.deepEqual);\n }\n};\n\nfunction _deepEqual(actual, expected) {\n // 7.1. All identical values are equivalent, as determined by ===.\n if (actual === expected) {\n return true;\n\n } else if (util.isBuffer(actual) && util.isBuffer(expected)) {\n if (actual.length != expected.length) return false;\n\n for (var i = 0; i < actual.length; i++) {\n if (actual[i] !== expected[i]) return false;\n }\n\n return true;\n\n // 7.2. If the expected value is a Date object, the actual value is\n // equivalent if it is also a Date object that refers to the same time.\n } else if (util.isDate(actual) && util.isDate(expected)) {\n return actual.getTime() === expected.getTime();\n\n // 7.3 If the expected value is a RegExp object, the actual value is\n // equivalent if it is also a RegExp object with the same source and\n // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).\n } else if (util.isRegExp(actual) && util.isRegExp(expected)) {\n return actual.source === expected.source &&\n actual.global === expected.global &&\n actual.multiline === expected.multiline &&\n actual.lastIndex === expected.lastIndex &&\n actual.ignoreCase === expected.ignoreCase;\n\n // 7.4. Other pairs that do not both pass typeof value == 'object',\n // equivalence is determined by ==.\n } else if (!util.isObject(actual) && !util.isObject(expected)) {\n return actual == expected;\n\n // 7.5 For all other Object pairs, including Array objects, equivalence is\n // determined by having the same number of owned properties (as verified\n // with Object.prototype.hasOwnProperty.call), the same set of keys\n // (although not necessarily the same order), equivalent values for every\n // corresponding key, and an identical 'prototype' property. Note: this\n // accounts for both named and indexed properties on Arrays.\n } else {\n return objEquiv(actual, expected);\n }\n}\n\nfunction isArguments(object) {\n return Object.prototype.toString.call(object) == '[object Arguments]';\n}\n\nfunction objEquiv(a, b) {\n if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b))\n return false;\n // an identical 'prototype' property.\n if (a.prototype !== b.prototype) return false;\n // if one is a primitive, the other must be same\n if (util.isPrimitive(a) || util.isPrimitive(b)) {\n return a === b;\n }\n var aIsArgs = isArguments(a),\n bIsArgs = isArguments(b);\n if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))\n return false;\n if (aIsArgs) {\n a = pSlice.call(a);\n b = pSlice.call(b);\n return _deepEqual(a, b);\n }\n var ka = objectKeys(a),\n kb = objectKeys(b),\n key, i;\n // having the same number of owned properties (keys incorporates\n // hasOwnProperty)\n if (ka.length != kb.length)\n return false;\n //the same set of keys (although not necessarily the same order),\n ka.sort();\n kb.sort();\n //~~~cheap key test\n for (i = ka.length - 1; i >= 0; i--) {\n if (ka[i] != kb[i])\n return false;\n }\n //equivalent values for every corresponding key, and\n //~~~possibly expensive deep test\n for (i = ka.length - 1; i >= 0; i--) {\n key = ka[i];\n if (!_deepEqual(a[key], b[key])) return false;\n }\n return true;\n}\n\n// 8. The non-equivalence assertion tests for any deep inequality.\n// assert.notDeepEqual(actual, expected, message_opt);\n\nassert.notDeepEqual = function notDeepEqual(actual, expected, message) {\n if (_deepEqual(actual, expected)) {\n fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);\n }\n};\n\n// 9. The strict equality assertion tests strict equality, as determined by ===.\n// assert.strictEqual(actual, expected, message_opt);\n\nassert.strictEqual = function strictEqual(actual, expected, message) {\n if (actual !== expected) {\n fail(actual, expected, message, '===', assert.strictEqual);\n }\n};\n\n// 10. The strict non-equality assertion tests for strict inequality, as\n// determined by !==. assert.notStrictEqual(actual, expected, message_opt);\n\nassert.notStrictEqual = function notStrictEqual(actual, expected, message) {\n if (actual === expected) {\n fail(actual, expected, message, '!==', assert.notStrictEqual);\n }\n};\n\nfunction expectedException(actual, expected) {\n if (!actual || !expected) {\n return false;\n }\n\n if (Object.prototype.toString.call(expected) == '[object RegExp]') {\n return expected.test(actual);\n } else if (actual instanceof expected) {\n return true;\n } else if (expected.call({}, actual) === true) {\n return true;\n }\n\n return false;\n}\n\nfunction _throws(shouldThrow, block, expected, message) {\n var actual;\n\n if (util.isString(expected)) {\n message = expected;\n expected = null;\n }\n\n try {\n block();\n } catch (e) {\n actual = e;\n }\n\n message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +\n (message ? ' ' + message : '.');\n\n if (shouldThrow && !actual) {\n fail(actual, expected, 'Missing expected exception' + message);\n }\n\n if (!shouldThrow && expectedException(actual, expected)) {\n fail(actual, expected, 'Got unwanted exception' + message);\n }\n\n if ((shouldThrow && actual && expected &&\n !expectedException(actual, expected)) || (!shouldThrow && actual)) {\n throw actual;\n }\n}\n\n// 11. Expected to throw an error:\n// assert.throws(block, Error_opt, message_opt);\n\nassert.throws = function(block, /*optional*/error, /*optional*/message) {\n _throws.apply(this, [true].concat(pSlice.call(arguments)));\n};\n\n// EXTENSION! This is annoying to write outside this module.\nassert.doesNotThrow = function(block, /*optional*/message) {\n _throws.apply(this, [false].concat(pSlice.call(arguments)));\n};\n\nassert.ifError = function(err) { if (err) {throw err;}};\n\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) {\n if (hasOwn.call(obj, key)) keys.push(key);\n }\n return keys;\n};\n\n},{\"util/\":\"/home/itay/dev/pockets/node_modules/assert/node_modules/util/util.js\"}],\"/home/itay/dev/pockets/node_modules/assert/node_modules/util/node_modules/inherits/inherits_browser.js\":[function(require,module,exports){\nif (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n\n},{}],\"/home/itay/dev/pockets/node_modules/assert/node_modules/util/support/isBufferBrowser.js\":[function(require,module,exports){\nmodule.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}\n},{}],\"/home/itay/dev/pockets/node_modules/assert/node_modules/util/util.js\":[function(require,module,exports){\n(function (process,global){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexports.debuglog = function(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\n}).call(this,require('_process'),typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"./support/isBuffer\":\"/home/itay/dev/pockets/node_modules/assert/node_modules/util/support/isBufferBrowser.js\",\"_process\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/process/browser.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/assert/node_modules/util/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/bigi/lib/bigi.js\":[function(require,module,exports){\n// (public) Constructor\nfunction BigInteger(a, b, c) {\n if (!(this instanceof BigInteger))\n return new BigInteger(a, b, c)\n\n if (a != null) {\n if (\"number\" == typeof a) this.fromNumber(a, b, c)\n else if (b == null && \"string\" != typeof a) this.fromString(a, 256)\n else this.fromString(a, b)\n }\n}\n\nvar proto = BigInteger.prototype\n\n// duck-typed isBigInteger\nproto.__bigi = require('../package.json').version\nBigInteger.isBigInteger = function (obj, check_ver) {\n return obj && obj.__bigi && (!check_ver || obj.__bigi === proto.__bigi)\n}\n\n// Bits per digit\nvar dbits\n\n// am: Compute w_j += (x*this_i), propagate carries,\n// c is initial carry, returns final carry.\n// c < 3*dvalue, x < 2*dvalue, this_i < dvalue\n// We need to select the fastest one that works in this environment.\n\n// am1: use a single mult and divide to get the high bits,\n// max digit bits should be 26 because\n// max internal value = 2*dvalue^2-2*dvalue (< 2^53)\nfunction am1(i, x, w, j, c, n) {\n while (--n >= 0) {\n var v = x * this[i++] + w[j] + c\n c = Math.floor(v / 0x4000000)\n w[j++] = v & 0x3ffffff\n }\n return c\n}\n// am2 avoids a big mult-and-extract completely.\n// Max digit bits should be <= 30 because we do bitwise ops\n// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)\nfunction am2(i, x, w, j, c, n) {\n var xl = x & 0x7fff,\n xh = x >> 15\n while (--n >= 0) {\n var l = this[i] & 0x7fff\n var h = this[i++] >> 15\n var m = xh * l + h * xl\n l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff)\n c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30)\n w[j++] = l & 0x3fffffff\n }\n return c\n}\n// Alternately, set max digit bits to 28 since some\n// browsers slow down when dealing with 32-bit numbers.\nfunction am3(i, x, w, j, c, n) {\n var xl = x & 0x3fff,\n xh = x >> 14\n while (--n >= 0) {\n var l = this[i] & 0x3fff\n var h = this[i++] >> 14\n var m = xh * l + h * xl\n l = xl * l + ((m & 0x3fff) << 14) + w[j] + c\n c = (l >> 28) + (m >> 14) + xh * h\n w[j++] = l & 0xfffffff\n }\n return c\n}\n\n// wtf?\nBigInteger.prototype.am = am1\ndbits = 26\n\nBigInteger.prototype.DB = dbits\nBigInteger.prototype.DM = ((1 << dbits) - 1)\nvar DV = BigInteger.prototype.DV = (1 << dbits)\n\nvar BI_FP = 52\nBigInteger.prototype.FV = Math.pow(2, BI_FP)\nBigInteger.prototype.F1 = BI_FP - dbits\nBigInteger.prototype.F2 = 2 * dbits - BI_FP\n\n// Digit conversions\nvar BI_RM = \"0123456789abcdefghijklmnopqrstuvwxyz\"\nvar BI_RC = new Array()\nvar rr, vv\nrr = \"0\".charCodeAt(0)\nfor (vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv\nrr = \"a\".charCodeAt(0)\nfor (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv\nrr = \"A\".charCodeAt(0)\nfor (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv\n\nfunction int2char(n) {\n return BI_RM.charAt(n)\n}\n\nfunction intAt(s, i) {\n var c = BI_RC[s.charCodeAt(i)]\n return (c == null) ? -1 : c\n}\n\n// (protected) copy this to r\nfunction bnpCopyTo(r) {\n for (var i = this.t - 1; i >= 0; --i) r[i] = this[i]\n r.t = this.t\n r.s = this.s\n}\n\n// (protected) set from integer value x, -DV <= x < DV\nfunction bnpFromInt(x) {\n this.t = 1\n this.s = (x < 0) ? -1 : 0\n if (x > 0) this[0] = x\n else if (x < -1) this[0] = x + DV\n else this.t = 0\n}\n\n// return bigint initialized to value\nfunction nbv(i) {\n var r = new BigInteger()\n r.fromInt(i)\n return r\n}\n\n// (protected) set from string and radix\nfunction bnpFromString(s, b) {\n var self = this\n\n var k\n if (b == 16) k = 4\n else if (b == 8) k = 3\n else if (b == 256) k = 8; // byte array\n else if (b == 2) k = 1\n else if (b == 32) k = 5\n else if (b == 4) k = 2\n else {\n self.fromRadix(s, b)\n return\n }\n self.t = 0\n self.s = 0\n var i = s.length,\n mi = false,\n sh = 0\n while (--i >= 0) {\n var x = (k == 8) ? s[i] & 0xff : intAt(s, i)\n if (x < 0) {\n if (s.charAt(i) == \"-\") mi = true\n continue\n }\n mi = false\n if (sh == 0)\n self[self.t++] = x\n else if (sh + k > self.DB) {\n self[self.t - 1] |= (x & ((1 << (self.DB - sh)) - 1)) << sh\n self[self.t++] = (x >> (self.DB - sh))\n } else\n self[self.t - 1] |= x << sh\n sh += k\n if (sh >= self.DB) sh -= self.DB\n }\n if (k == 8 && (s[0] & 0x80) != 0) {\n self.s = -1\n if (sh > 0) self[self.t - 1] |= ((1 << (self.DB - sh)) - 1) << sh\n }\n self.clamp()\n if (mi) BigInteger.ZERO.subTo(self, self)\n}\n\n// (protected) clamp off excess high words\nfunction bnpClamp() {\n var c = this.s & this.DM\n while (this.t > 0 && this[this.t - 1] == c)--this.t\n}\n\n// (public) return string representation in given radix\nfunction bnToString(b) {\n var self = this\n if (self.s < 0) return \"-\" + self.negate()\n .toString(b)\n var k\n if (b == 16) k = 4\n else if (b == 8) k = 3\n else if (b == 2) k = 1\n else if (b == 32) k = 5\n else if (b == 4) k = 2\n else return self.toRadix(b)\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = self.t\n var p = self.DB - (i * self.DB) % k\n if (i-- > 0) {\n if (p < self.DB && (d = self[i] >> p) > 0) {\n m = true\n r = int2char(d)\n }\n while (i >= 0) {\n if (p < k) {\n d = (self[i] & ((1 << p) - 1)) << (k - p)\n d |= self[--i] >> (p += self.DB - k)\n } else {\n d = (self[i] >> (p -= k)) & km\n if (p <= 0) {\n p += self.DB\n --i\n }\n }\n if (d > 0) m = true\n if (m) r += int2char(d)\n }\n }\n return m ? r : \"0\"\n}\n\n// (public) -this\nfunction bnNegate() {\n var r = new BigInteger()\n BigInteger.ZERO.subTo(this, r)\n return r\n}\n\n// (public) |this|\nfunction bnAbs() {\n return (this.s < 0) ? this.negate() : this\n}\n\n// (public) return + if this > a, - if this < a, 0 if equal\nfunction bnCompareTo(a) {\n var r = this.s - a.s\n if (r != 0) return r\n var i = this.t\n r = i - a.t\n if (r != 0) return (this.s < 0) ? -r : r\n while (--i >= 0)\n if ((r = this[i] - a[i]) != 0) return r\n return 0\n}\n\n// returns bit length of the integer x\nfunction nbits(x) {\n var r = 1,\n t\n if ((t = x >>> 16) != 0) {\n x = t\n r += 16\n }\n if ((t = x >> 8) != 0) {\n x = t\n r += 8\n }\n if ((t = x >> 4) != 0) {\n x = t\n r += 4\n }\n if ((t = x >> 2) != 0) {\n x = t\n r += 2\n }\n if ((t = x >> 1) != 0) {\n x = t\n r += 1\n }\n return r\n}\n\n// (public) return the number of bits in \"this\"\nfunction bnBitLength() {\n if (this.t <= 0) return 0\n return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM))\n}\n\n// (public) return the number of bytes in \"this\"\nfunction bnByteLength() {\n return this.bitLength() >> 3\n}\n\n// (protected) r = this << n*DB\nfunction bnpDLShiftTo(n, r) {\n var i\n for (i = this.t - 1; i >= 0; --i) r[i + n] = this[i]\n for (i = n - 1; i >= 0; --i) r[i] = 0\n r.t = this.t + n\n r.s = this.s\n}\n\n// (protected) r = this >> n*DB\nfunction bnpDRShiftTo(n, r) {\n for (var i = n; i < this.t; ++i) r[i - n] = this[i]\n r.t = Math.max(this.t - n, 0)\n r.s = this.s\n}\n\n// (protected) r = this << n\nfunction bnpLShiftTo(n, r) {\n var self = this\n var bs = n % self.DB\n var cbs = self.DB - bs\n var bm = (1 << cbs) - 1\n var ds = Math.floor(n / self.DB),\n c = (self.s << bs) & self.DM,\n i\n for (i = self.t - 1; i >= 0; --i) {\n r[i + ds + 1] = (self[i] >> cbs) | c\n c = (self[i] & bm) << bs\n }\n for (i = ds - 1; i >= 0; --i) r[i] = 0\n r[ds] = c\n r.t = self.t + ds + 1\n r.s = self.s\n r.clamp()\n}\n\n// (protected) r = this >> n\nfunction bnpRShiftTo(n, r) {\n var self = this\n r.s = self.s\n var ds = Math.floor(n / self.DB)\n if (ds >= self.t) {\n r.t = 0\n return\n }\n var bs = n % self.DB\n var cbs = self.DB - bs\n var bm = (1 << bs) - 1\n r[0] = self[ds] >> bs\n for (var i = ds + 1; i < self.t; ++i) {\n r[i - ds - 1] |= (self[i] & bm) << cbs\n r[i - ds] = self[i] >> bs\n }\n if (bs > 0) r[self.t - ds - 1] |= (self.s & bm) << cbs\n r.t = self.t - ds\n r.clamp()\n}\n\n// (protected) r = this - a\nfunction bnpSubTo(a, r) {\n var self = this\n var i = 0,\n c = 0,\n m = Math.min(a.t, self.t)\n while (i < m) {\n c += self[i] - a[i]\n r[i++] = c & self.DM\n c >>= self.DB\n }\n if (a.t < self.t) {\n c -= a.s\n while (i < self.t) {\n c += self[i]\n r[i++] = c & self.DM\n c >>= self.DB\n }\n c += self.s\n } else {\n c += self.s\n while (i < a.t) {\n c -= a[i]\n r[i++] = c & self.DM\n c >>= self.DB\n }\n c -= a.s\n }\n r.s = (c < 0) ? -1 : 0\n if (c < -1) r[i++] = self.DV + c\n else if (c > 0) r[i++] = c\n r.t = i\n r.clamp()\n}\n\n// (protected) r = this * a, r != this,a (HAC 14.12)\n// \"this\" should be the larger one if appropriate.\nfunction bnpMultiplyTo(a, r) {\n var x = this.abs(),\n y = a.abs()\n var i = x.t\n r.t = i + y.t\n while (--i >= 0) r[i] = 0\n for (i = 0; i < y.t; ++i) r[i + x.t] = x.am(0, y[i], r, i, 0, x.t)\n r.s = 0\n r.clamp()\n if (this.s != a.s) BigInteger.ZERO.subTo(r, r)\n}\n\n// (protected) r = this^2, r != this (HAC 14.16)\nfunction bnpSquareTo(r) {\n var x = this.abs()\n var i = r.t = 2 * x.t\n while (--i >= 0) r[i] = 0\n for (i = 0; i < x.t - 1; ++i) {\n var c = x.am(i, x[i], r, 2 * i, 0, 1)\n if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {\n r[i + x.t] -= x.DV\n r[i + x.t + 1] = 1\n }\n }\n if (r.t > 0) r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1)\n r.s = 0\n r.clamp()\n}\n\n// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)\n// r != q, this != m. q or r may be null.\nfunction bnpDivRemTo(m, q, r) {\n var self = this\n var pm = m.abs()\n if (pm.t <= 0) return\n var pt = self.abs()\n if (pt.t < pm.t) {\n if (q != null) q.fromInt(0)\n if (r != null) self.copyTo(r)\n return\n }\n if (r == null) r = new BigInteger()\n var y = new BigInteger(),\n ts = self.s,\n ms = m.s\n var nsh = self.DB - nbits(pm[pm.t - 1]); // normalize modulus\n if (nsh > 0) {\n pm.lShiftTo(nsh, y)\n pt.lShiftTo(nsh, r)\n } else {\n pm.copyTo(y)\n pt.copyTo(r)\n }\n var ys = y.t\n var y0 = y[ys - 1]\n if (y0 == 0) return\n var yt = y0 * (1 << self.F1) + ((ys > 1) ? y[ys - 2] >> self.F2 : 0)\n var d1 = self.FV / yt,\n d2 = (1 << self.F1) / yt,\n e = 1 << self.F2\n var i = r.t,\n j = i - ys,\n t = (q == null) ? new BigInteger() : q\n y.dlShiftTo(j, t)\n if (r.compareTo(t) >= 0) {\n r[r.t++] = 1\n r.subTo(t, r)\n }\n BigInteger.ONE.dlShiftTo(ys, t)\n t.subTo(y, y); // \"negative\" y so we can replace sub with am later\n while (y.t < ys) y[y.t++] = 0\n while (--j >= 0) {\n // Estimate quotient digit\n var qd = (r[--i] == y0) ? self.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2)\n if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) { // Try it out\n y.dlShiftTo(j, t)\n r.subTo(t, r)\n while (r[i] < --qd) r.subTo(t, r)\n }\n }\n if (q != null) {\n r.drShiftTo(ys, q)\n if (ts != ms) BigInteger.ZERO.subTo(q, q)\n }\n r.t = ys\n r.clamp()\n if (nsh > 0) r.rShiftTo(nsh, r); // Denormalize remainder\n if (ts < 0) BigInteger.ZERO.subTo(r, r)\n}\n\n// (public) this mod a\nfunction bnMod(a) {\n var r = new BigInteger()\n this.abs()\n .divRemTo(a, null, r)\n if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r, r)\n return r\n}\n\n// Modular reduction using \"classic\" algorithm\nfunction Classic(m) {\n this.m = m\n}\n\nfunction cConvert(x) {\n if (x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m)\n else return x\n}\n\nfunction cRevert(x) {\n return x\n}\n\nfunction cReduce(x) {\n x.divRemTo(this.m, null, x)\n}\n\nfunction cMulTo(x, y, r) {\n x.multiplyTo(y, r)\n this.reduce(r)\n}\n\nfunction cSqrTo(x, r) {\n x.squareTo(r)\n this.reduce(r)\n}\n\nClassic.prototype.convert = cConvert\nClassic.prototype.revert = cRevert\nClassic.prototype.reduce = cReduce\nClassic.prototype.mulTo = cMulTo\nClassic.prototype.sqrTo = cSqrTo\n\n// (protected) return \"-1/this % 2^DB\"; useful for Mont. reduction\n// justification:\n// xy == 1 (mod m)\n// xy = 1+km\n// xy(2-xy) = (1+km)(1-km)\n// x[y(2-xy)] = 1-k^2m^2\n// x[y(2-xy)] == 1 (mod m^2)\n// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2\n// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.\n// JS multiply \"overflows\" differently from C/C++, so care is needed here.\nfunction bnpInvDigit() {\n if (this.t < 1) return 0\n var x = this[0]\n if ((x & 1) == 0) return 0\n var y = x & 3; // y == 1/x mod 2^2\n y = (y * (2 - (x & 0xf) * y)) & 0xf; // y == 1/x mod 2^4\n y = (y * (2 - (x & 0xff) * y)) & 0xff; // y == 1/x mod 2^8\n y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff; // y == 1/x mod 2^16\n // last step - calculate inverse mod DV directly\n // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints\n y = (y * (2 - x * y % this.DV)) % this.DV; // y == 1/x mod 2^dbits\n // we really want the negative inverse, and -DV < y < DV\n return (y > 0) ? this.DV - y : -y\n}\n\n// Montgomery reduction\nfunction Montgomery(m) {\n this.m = m\n this.mp = m.invDigit()\n this.mpl = this.mp & 0x7fff\n this.mph = this.mp >> 15\n this.um = (1 << (m.DB - 15)) - 1\n this.mt2 = 2 * m.t\n}\n\n// xR mod m\nfunction montConvert(x) {\n var r = new BigInteger()\n x.abs()\n .dlShiftTo(this.m.t, r)\n r.divRemTo(this.m, null, r)\n if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r, r)\n return r\n}\n\n// x/R mod m\nfunction montRevert(x) {\n var r = new BigInteger()\n x.copyTo(r)\n this.reduce(r)\n return r\n}\n\n// x = x/R mod m (HAC 14.32)\nfunction montReduce(x) {\n while (x.t <= this.mt2) // pad x so am has enough room later\n x[x.t++] = 0\n for (var i = 0; i < this.m.t; ++i) {\n // faster way of calculating u0 = x[i]*mp mod DV\n var j = x[i] & 0x7fff\n var u0 = (j * this.mpl + (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) & x.DM\n // use am to combine the multiply-shift-add into one call\n j = i + this.m.t\n x[j] += this.m.am(0, u0, x, i, 0, this.m.t)\n // propagate carry\n while (x[j] >= x.DV) {\n x[j] -= x.DV\n x[++j]++\n }\n }\n x.clamp()\n x.drShiftTo(this.m.t, x)\n if (x.compareTo(this.m) >= 0) x.subTo(this.m, x)\n}\n\n// r = \"x^2/R mod m\"; x != r\nfunction montSqrTo(x, r) {\n x.squareTo(r)\n this.reduce(r)\n}\n\n// r = \"xy/R mod m\"; x,y != r\nfunction montMulTo(x, y, r) {\n x.multiplyTo(y, r)\n this.reduce(r)\n}\n\nMontgomery.prototype.convert = montConvert\nMontgomery.prototype.revert = montRevert\nMontgomery.prototype.reduce = montReduce\nMontgomery.prototype.mulTo = montMulTo\nMontgomery.prototype.sqrTo = montSqrTo\n\n// (protected) true iff this is even\nfunction bnpIsEven() {\n return ((this.t > 0) ? (this[0] & 1) : this.s) == 0\n}\n\n// (protected) this^e, e < 2^32, doing sqr and mul with \"r\" (HAC 14.79)\nfunction bnpExp(e, z) {\n if (e > 0xffffffff || e < 1) return BigInteger.ONE\n var r = new BigInteger(),\n r2 = new BigInteger(),\n g = z.convert(this),\n i = nbits(e) - 1\n g.copyTo(r)\n while (--i >= 0) {\n z.sqrTo(r, r2)\n if ((e & (1 << i)) > 0) z.mulTo(r2, g, r)\n else {\n var t = r\n r = r2\n r2 = t\n }\n }\n return z.revert(r)\n}\n\n// (public) this^e % m, 0 <= e < 2^32\nfunction bnModPowInt(e, m) {\n var z\n if (e < 256 || m.isEven()) z = new Classic(m)\n else z = new Montgomery(m)\n return this.exp(e, z)\n}\n\n// protected\nproto.copyTo = bnpCopyTo\nproto.fromInt = bnpFromInt\nproto.fromString = bnpFromString\nproto.clamp = bnpClamp\nproto.dlShiftTo = bnpDLShiftTo\nproto.drShiftTo = bnpDRShiftTo\nproto.lShiftTo = bnpLShiftTo\nproto.rShiftTo = bnpRShiftTo\nproto.subTo = bnpSubTo\nproto.multiplyTo = bnpMultiplyTo\nproto.squareTo = bnpSquareTo\nproto.divRemTo = bnpDivRemTo\nproto.invDigit = bnpInvDigit\nproto.isEven = bnpIsEven\nproto.exp = bnpExp\n\n// public\nproto.toString = bnToString\nproto.negate = bnNegate\nproto.abs = bnAbs\nproto.compareTo = bnCompareTo\nproto.bitLength = bnBitLength\nproto.byteLength = bnByteLength\nproto.mod = bnMod\nproto.modPowInt = bnModPowInt\n\n// (public)\nfunction bnClone() {\n var r = new BigInteger()\n this.copyTo(r)\n return r\n}\n\n// (public) return value as integer\nfunction bnIntValue() {\n if (this.s < 0) {\n if (this.t == 1) return this[0] - this.DV\n else if (this.t == 0) return -1\n } else if (this.t == 1) return this[0]\n else if (this.t == 0) return 0\n // assumes 16 < DB < 32\n return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0]\n}\n\n// (public) return value as byte\nfunction bnByteValue() {\n return (this.t == 0) ? this.s : (this[0] << 24) >> 24\n}\n\n// (public) return value as short (assumes DB>=16)\nfunction bnShortValue() {\n return (this.t == 0) ? this.s : (this[0] << 16) >> 16\n}\n\n// (protected) return x s.t. r^x < DV\nfunction bnpChunkSize(r) {\n return Math.floor(Math.LN2 * this.DB / Math.log(r))\n}\n\n// (public) 0 if this == 0, 1 if this > 0\nfunction bnSigNum() {\n if (this.s < 0) return -1\n else if (this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0\n else return 1\n}\n\n// (protected) convert to radix string\nfunction bnpToRadix(b) {\n if (b == null) b = 10\n if (this.signum() == 0 || b < 2 || b > 36) return \"0\"\n var cs = this.chunkSize(b)\n var a = Math.pow(b, cs)\n var d = nbv(a),\n y = new BigInteger(),\n z = new BigInteger(),\n r = \"\"\n this.divRemTo(d, y, z)\n while (y.signum() > 0) {\n r = (a + z.intValue())\n .toString(b)\n .substr(1) + r\n y.divRemTo(d, y, z)\n }\n return z.intValue()\n .toString(b) + r\n}\n\n// (protected) convert from radix string\nfunction bnpFromRadix(s, b) {\n var self = this\n self.fromInt(0)\n if (b == null) b = 10\n var cs = self.chunkSize(b)\n var d = Math.pow(b, cs),\n mi = false,\n j = 0,\n w = 0\n for (var i = 0; i < s.length; ++i) {\n var x = intAt(s, i)\n if (x < 0) {\n if (s.charAt(i) == \"-\" && self.signum() == 0) mi = true\n continue\n }\n w = b * w + x\n if (++j >= cs) {\n self.dMultiply(d)\n self.dAddOffset(w, 0)\n j = 0\n w = 0\n }\n }\n if (j > 0) {\n self.dMultiply(Math.pow(b, j))\n self.dAddOffset(w, 0)\n }\n if (mi) BigInteger.ZERO.subTo(self, self)\n}\n\n// (protected) alternate constructor\nfunction bnpFromNumber(a, b, c) {\n var self = this\n if (\"number\" == typeof b) {\n // new BigInteger(int,int,RNG)\n if (a < 2) self.fromInt(1)\n else {\n self.fromNumber(a, c)\n if (!self.testBit(a - 1)) // force MSB set\n self.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, self)\n if (self.isEven()) self.dAddOffset(1, 0); // force odd\n while (!self.isProbablePrime(b)) {\n self.dAddOffset(2, 0)\n if (self.bitLength() > a) self.subTo(BigInteger.ONE.shiftLeft(a - 1), self)\n }\n }\n } else {\n // new BigInteger(int,RNG)\n var x = new Array(),\n t = a & 7\n x.length = (a >> 3) + 1\n b.nextBytes(x)\n if (t > 0) x[0] &= ((1 << t) - 1)\n else x[0] = 0\n self.fromString(x, 256)\n }\n}\n\n// (public) convert to bigendian byte array\nfunction bnToByteArray() {\n var self = this\n var i = self.t,\n r = new Array()\n r[0] = self.s\n var p = self.DB - (i * self.DB) % 8,\n d, k = 0\n if (i-- > 0) {\n if (p < self.DB && (d = self[i] >> p) != (self.s & self.DM) >> p)\n r[k++] = d | (self.s << (self.DB - p))\n while (i >= 0) {\n if (p < 8) {\n d = (self[i] & ((1 << p) - 1)) << (8 - p)\n d |= self[--i] >> (p += self.DB - 8)\n } else {\n d = (self[i] >> (p -= 8)) & 0xff\n if (p <= 0) {\n p += self.DB\n --i\n }\n }\n if ((d & 0x80) != 0) d |= -256\n if (k === 0 && (self.s & 0x80) != (d & 0x80))++k\n if (k > 0 || d != self.s) r[k++] = d\n }\n }\n return r\n}\n\nfunction bnEquals(a) {\n return (this.compareTo(a) == 0)\n}\n\nfunction bnMin(a) {\n return (this.compareTo(a) < 0) ? this : a\n}\n\nfunction bnMax(a) {\n return (this.compareTo(a) > 0) ? this : a\n}\n\n// (protected) r = this op a (bitwise)\nfunction bnpBitwiseTo(a, op, r) {\n var self = this\n var i, f, m = Math.min(a.t, self.t)\n for (i = 0; i < m; ++i) r[i] = op(self[i], a[i])\n if (a.t < self.t) {\n f = a.s & self.DM\n for (i = m; i < self.t; ++i) r[i] = op(self[i], f)\n r.t = self.t\n } else {\n f = self.s & self.DM\n for (i = m; i < a.t; ++i) r[i] = op(f, a[i])\n r.t = a.t\n }\n r.s = op(self.s, a.s)\n r.clamp()\n}\n\n// (public) this & a\nfunction op_and(x, y) {\n return x & y\n}\n\nfunction bnAnd(a) {\n var r = new BigInteger()\n this.bitwiseTo(a, op_and, r)\n return r\n}\n\n// (public) this | a\nfunction op_or(x, y) {\n return x | y\n}\n\nfunction bnOr(a) {\n var r = new BigInteger()\n this.bitwiseTo(a, op_or, r)\n return r\n}\n\n// (public) this ^ a\nfunction op_xor(x, y) {\n return x ^ y\n}\n\nfunction bnXor(a) {\n var r = new BigInteger()\n this.bitwiseTo(a, op_xor, r)\n return r\n}\n\n// (public) this & ~a\nfunction op_andnot(x, y) {\n return x & ~y\n}\n\nfunction bnAndNot(a) {\n var r = new BigInteger()\n this.bitwiseTo(a, op_andnot, r)\n return r\n}\n\n// (public) ~this\nfunction bnNot() {\n var r = new BigInteger()\n for (var i = 0; i < this.t; ++i) r[i] = this.DM & ~this[i]\n r.t = this.t\n r.s = ~this.s\n return r\n}\n\n// (public) this << n\nfunction bnShiftLeft(n) {\n var r = new BigInteger()\n if (n < 0) this.rShiftTo(-n, r)\n else this.lShiftTo(n, r)\n return r\n}\n\n// (public) this >> n\nfunction bnShiftRight(n) {\n var r = new BigInteger()\n if (n < 0) this.lShiftTo(-n, r)\n else this.rShiftTo(n, r)\n return r\n}\n\n// return index of lowest 1-bit in x, x < 2^31\nfunction lbit(x) {\n if (x == 0) return -1\n var r = 0\n if ((x & 0xffff) == 0) {\n x >>= 16\n r += 16\n }\n if ((x & 0xff) == 0) {\n x >>= 8\n r += 8\n }\n if ((x & 0xf) == 0) {\n x >>= 4\n r += 4\n }\n if ((x & 3) == 0) {\n x >>= 2\n r += 2\n }\n if ((x & 1) == 0)++r\n return r\n}\n\n// (public) returns index of lowest 1-bit (or -1 if none)\nfunction bnGetLowestSetBit() {\n for (var i = 0; i < this.t; ++i)\n if (this[i] != 0) return i * this.DB + lbit(this[i])\n if (this.s < 0) return this.t * this.DB\n return -1\n}\n\n// return number of 1 bits in x\nfunction cbit(x) {\n var r = 0\n while (x != 0) {\n x &= x - 1\n ++r\n }\n return r\n}\n\n// (public) return number of set bits\nfunction bnBitCount() {\n var r = 0,\n x = this.s & this.DM\n for (var i = 0; i < this.t; ++i) r += cbit(this[i] ^ x)\n return r\n}\n\n// (public) true iff nth bit is set\nfunction bnTestBit(n) {\n var j = Math.floor(n / this.DB)\n if (j >= this.t) return (this.s != 0)\n return ((this[j] & (1 << (n % this.DB))) != 0)\n}\n\n// (protected) this op (1<>= self.DB\n }\n if (a.t < self.t) {\n c += a.s\n while (i < self.t) {\n c += self[i]\n r[i++] = c & self.DM\n c >>= self.DB\n }\n c += self.s\n } else {\n c += self.s\n while (i < a.t) {\n c += a[i]\n r[i++] = c & self.DM\n c >>= self.DB\n }\n c += a.s\n }\n r.s = (c < 0) ? -1 : 0\n if (c > 0) r[i++] = c\n else if (c < -1) r[i++] = self.DV + c\n r.t = i\n r.clamp()\n}\n\n// (public) this + a\nfunction bnAdd(a) {\n var r = new BigInteger()\n this.addTo(a, r)\n return r\n}\n\n// (public) this - a\nfunction bnSubtract(a) {\n var r = new BigInteger()\n this.subTo(a, r)\n return r\n}\n\n// (public) this * a\nfunction bnMultiply(a) {\n var r = new BigInteger()\n this.multiplyTo(a, r)\n return r\n}\n\n// (public) this^2\nfunction bnSquare() {\n var r = new BigInteger()\n this.squareTo(r)\n return r\n}\n\n// (public) this / a\nfunction bnDivide(a) {\n var r = new BigInteger()\n this.divRemTo(a, r, null)\n return r\n}\n\n// (public) this % a\nfunction bnRemainder(a) {\n var r = new BigInteger()\n this.divRemTo(a, null, r)\n return r\n}\n\n// (public) [this/a,this%a]\nfunction bnDivideAndRemainder(a) {\n var q = new BigInteger(),\n r = new BigInteger()\n this.divRemTo(a, q, r)\n return new Array(q, r)\n}\n\n// (protected) this *= n, this >= 0, 1 < n < DV\nfunction bnpDMultiply(n) {\n this[this.t] = this.am(0, n - 1, this, 0, 0, this.t)\n ++this.t\n this.clamp()\n}\n\n// (protected) this += n << w words, this >= 0\nfunction bnpDAddOffset(n, w) {\n if (n == 0) return\n while (this.t <= w) this[this.t++] = 0\n this[w] += n\n while (this[w] >= this.DV) {\n this[w] -= this.DV\n if (++w >= this.t) this[this.t++] = 0\n ++this[w]\n }\n}\n\n// A \"null\" reducer\nfunction NullExp() {}\n\nfunction nNop(x) {\n return x\n}\n\nfunction nMulTo(x, y, r) {\n x.multiplyTo(y, r)\n}\n\nfunction nSqrTo(x, r) {\n x.squareTo(r)\n}\n\nNullExp.prototype.convert = nNop\nNullExp.prototype.revert = nNop\nNullExp.prototype.mulTo = nMulTo\nNullExp.prototype.sqrTo = nSqrTo\n\n// (public) this^e\nfunction bnPow(e) {\n return this.exp(e, new NullExp())\n}\n\n// (protected) r = lower n words of \"this * a\", a.t <= n\n// \"this\" should be the larger one if appropriate.\nfunction bnpMultiplyLowerTo(a, n, r) {\n var i = Math.min(this.t + a.t, n)\n r.s = 0; // assumes a,this >= 0\n r.t = i\n while (i > 0) r[--i] = 0\n var j\n for (j = r.t - this.t; i < j; ++i) r[i + this.t] = this.am(0, a[i], r, i, 0, this.t)\n for (j = Math.min(a.t, n); i < j; ++i) this.am(0, a[i], r, i, 0, n - i)\n r.clamp()\n}\n\n// (protected) r = \"this * a\" without lower n words, n > 0\n// \"this\" should be the larger one if appropriate.\nfunction bnpMultiplyUpperTo(a, n, r) {\n --n\n var i = r.t = this.t + a.t - n\n r.s = 0; // assumes a,this >= 0\n while (--i >= 0) r[i] = 0\n for (i = Math.max(n - this.t, 0); i < a.t; ++i)\n r[this.t + i - n] = this.am(n - i, a[i], r, 0, 0, this.t + i - n)\n r.clamp()\n r.drShiftTo(1, r)\n}\n\n// Barrett modular reduction\nfunction Barrett(m) {\n // setup Barrett\n this.r2 = new BigInteger()\n this.q3 = new BigInteger()\n BigInteger.ONE.dlShiftTo(2 * m.t, this.r2)\n this.mu = this.r2.divide(m)\n this.m = m\n}\n\nfunction barrettConvert(x) {\n if (x.s < 0 || x.t > 2 * this.m.t) return x.mod(this.m)\n else if (x.compareTo(this.m) < 0) return x\n else {\n var r = new BigInteger()\n x.copyTo(r)\n this.reduce(r)\n return r\n }\n}\n\nfunction barrettRevert(x) {\n return x\n}\n\n// x = x mod m (HAC 14.42)\nfunction barrettReduce(x) {\n var self = this\n x.drShiftTo(self.m.t - 1, self.r2)\n if (x.t > self.m.t + 1) {\n x.t = self.m.t + 1\n x.clamp()\n }\n self.mu.multiplyUpperTo(self.r2, self.m.t + 1, self.q3)\n self.m.multiplyLowerTo(self.q3, self.m.t + 1, self.r2)\n while (x.compareTo(self.r2) < 0) x.dAddOffset(1, self.m.t + 1)\n x.subTo(self.r2, x)\n while (x.compareTo(self.m) >= 0) x.subTo(self.m, x)\n}\n\n// r = x^2 mod m; x != r\nfunction barrettSqrTo(x, r) {\n x.squareTo(r)\n this.reduce(r)\n}\n\n// r = x*y mod m; x,y != r\nfunction barrettMulTo(x, y, r) {\n x.multiplyTo(y, r)\n this.reduce(r)\n}\n\nBarrett.prototype.convert = barrettConvert\nBarrett.prototype.revert = barrettRevert\nBarrett.prototype.reduce = barrettReduce\nBarrett.prototype.mulTo = barrettMulTo\nBarrett.prototype.sqrTo = barrettSqrTo\n\n// (public) this^e % m (HAC 14.85)\nfunction bnModPow(e, m) {\n var i = e.bitLength(),\n k, r = nbv(1),\n z\n if (i <= 0) return r\n else if (i < 18) k = 1\n else if (i < 48) k = 3\n else if (i < 144) k = 4\n else if (i < 768) k = 5\n else k = 6\n if (i < 8)\n z = new Classic(m)\n else if (m.isEven())\n z = new Barrett(m)\n else\n z = new Montgomery(m)\n\n // precomputation\n var g = new Array(),\n n = 3,\n k1 = k - 1,\n km = (1 << k) - 1\n g[1] = z.convert(this)\n if (k > 1) {\n var g2 = new BigInteger()\n z.sqrTo(g[1], g2)\n while (n <= km) {\n g[n] = new BigInteger()\n z.mulTo(g2, g[n - 2], g[n])\n n += 2\n }\n }\n\n var j = e.t - 1,\n w, is1 = true,\n r2 = new BigInteger(),\n t\n i = nbits(e[j]) - 1\n while (j >= 0) {\n if (i >= k1) w = (e[j] >> (i - k1)) & km\n else {\n w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i)\n if (j > 0) w |= e[j - 1] >> (this.DB + i - k1)\n }\n\n n = k\n while ((w & 1) == 0) {\n w >>= 1\n --n\n }\n if ((i -= n) < 0) {\n i += this.DB\n --j\n }\n if (is1) { // ret == 1, don't bother squaring or multiplying it\n g[w].copyTo(r)\n is1 = false\n } else {\n while (n > 1) {\n z.sqrTo(r, r2)\n z.sqrTo(r2, r)\n n -= 2\n }\n if (n > 0) z.sqrTo(r, r2)\n else {\n t = r\n r = r2\n r2 = t\n }\n z.mulTo(r2, g[w], r)\n }\n\n while (j >= 0 && (e[j] & (1 << i)) == 0) {\n z.sqrTo(r, r2)\n t = r\n r = r2\n r2 = t\n if (--i < 0) {\n i = this.DB - 1\n --j\n }\n }\n }\n return z.revert(r)\n}\n\n// (public) gcd(this,a) (HAC 14.54)\nfunction bnGCD(a) {\n var x = (this.s < 0) ? this.negate() : this.clone()\n var y = (a.s < 0) ? a.negate() : a.clone()\n if (x.compareTo(y) < 0) {\n var t = x\n x = y\n y = t\n }\n var i = x.getLowestSetBit(),\n g = y.getLowestSetBit()\n if (g < 0) return x\n if (i < g) g = i\n if (g > 0) {\n x.rShiftTo(g, x)\n y.rShiftTo(g, y)\n }\n while (x.signum() > 0) {\n if ((i = x.getLowestSetBit()) > 0) x.rShiftTo(i, x)\n if ((i = y.getLowestSetBit()) > 0) y.rShiftTo(i, y)\n if (x.compareTo(y) >= 0) {\n x.subTo(y, x)\n x.rShiftTo(1, x)\n } else {\n y.subTo(x, y)\n y.rShiftTo(1, y)\n }\n }\n if (g > 0) y.lShiftTo(g, y)\n return y\n}\n\n// (protected) this % n, n < 2^26\nfunction bnpModInt(n) {\n if (n <= 0) return 0\n var d = this.DV % n,\n r = (this.s < 0) ? n - 1 : 0\n if (this.t > 0)\n if (d == 0) r = this[0] % n\n else\n for (var i = this.t - 1; i >= 0; --i) r = (d * r + this[i]) % n\n return r\n}\n\n// (public) 1/this % m (HAC 14.61)\nfunction bnModInverse(m) {\n var ac = m.isEven()\n if ((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO\n var u = m.clone(),\n v = this.clone()\n var a = nbv(1),\n b = nbv(0),\n c = nbv(0),\n d = nbv(1)\n while (u.signum() != 0) {\n while (u.isEven()) {\n u.rShiftTo(1, u)\n if (ac) {\n if (!a.isEven() || !b.isEven()) {\n a.addTo(this, a)\n b.subTo(m, b)\n }\n a.rShiftTo(1, a)\n } else if (!b.isEven()) b.subTo(m, b)\n b.rShiftTo(1, b)\n }\n while (v.isEven()) {\n v.rShiftTo(1, v)\n if (ac) {\n if (!c.isEven() || !d.isEven()) {\n c.addTo(this, c)\n d.subTo(m, d)\n }\n c.rShiftTo(1, c)\n } else if (!d.isEven()) d.subTo(m, d)\n d.rShiftTo(1, d)\n }\n if (u.compareTo(v) >= 0) {\n u.subTo(v, u)\n if (ac) a.subTo(c, a)\n b.subTo(d, b)\n } else {\n v.subTo(u, v)\n if (ac) c.subTo(a, c)\n d.subTo(b, d)\n }\n }\n if (v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO\n if (d.compareTo(m) >= 0) return d.subtract(m)\n if (d.signum() < 0) d.addTo(m, d)\n else return d\n if (d.signum() < 0) return d.add(m)\n else return d\n}\n\nvar lowprimes = [\n 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,\n 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151,\n 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233,\n 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317,\n 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419,\n 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503,\n 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607,\n 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701,\n 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811,\n 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911,\n 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997\n]\n\nvar lplim = (1 << 26) / lowprimes[lowprimes.length - 1]\n\n// (public) test primality with certainty >= 1-.5^t\nfunction bnIsProbablePrime(t) {\n var i, x = this.abs()\n if (x.t == 1 && x[0] <= lowprimes[lowprimes.length - 1]) {\n for (i = 0; i < lowprimes.length; ++i)\n if (x[0] == lowprimes[i]) return true\n return false\n }\n if (x.isEven()) return false\n i = 1\n while (i < lowprimes.length) {\n var m = lowprimes[i],\n j = i + 1\n while (j < lowprimes.length && m < lplim) m *= lowprimes[j++]\n m = x.modInt(m)\n while (i < j) if (m % lowprimes[i++] == 0) return false\n }\n return x.millerRabin(t)\n}\n\n// (protected) true if probably prime (HAC 4.24, Miller-Rabin)\nfunction bnpMillerRabin(t) {\n var n1 = this.subtract(BigInteger.ONE)\n var k = n1.getLowestSetBit()\n if (k <= 0) return false\n var r = n1.shiftRight(k)\n t = (t + 1) >> 1\n if (t > lowprimes.length) t = lowprimes.length\n var a = new BigInteger(null)\n var j, bases = []\n for (var i = 0; i < t; ++i) {\n for (;;) {\n j = lowprimes[Math.floor(Math.random() * lowprimes.length)]\n if (bases.indexOf(j) == -1) break\n }\n bases.push(j)\n a.fromInt(j)\n var y = a.modPow(r, this)\n if (y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {\n var j = 1\n while (j++ < k && y.compareTo(n1) != 0) {\n y = y.modPowInt(2, this)\n if (y.compareTo(BigInteger.ONE) == 0) return false\n }\n if (y.compareTo(n1) != 0) return false\n }\n }\n return true\n}\n\n// protected\nproto.chunkSize = bnpChunkSize\nproto.toRadix = bnpToRadix\nproto.fromRadix = bnpFromRadix\nproto.fromNumber = bnpFromNumber\nproto.bitwiseTo = bnpBitwiseTo\nproto.changeBit = bnpChangeBit\nproto.addTo = bnpAddTo\nproto.dMultiply = bnpDMultiply\nproto.dAddOffset = bnpDAddOffset\nproto.multiplyLowerTo = bnpMultiplyLowerTo\nproto.multiplyUpperTo = bnpMultiplyUpperTo\nproto.modInt = bnpModInt\nproto.millerRabin = bnpMillerRabin\n\n// public\nproto.clone = bnClone\nproto.intValue = bnIntValue\nproto.byteValue = bnByteValue\nproto.shortValue = bnShortValue\nproto.signum = bnSigNum\nproto.toByteArray = bnToByteArray\nproto.equals = bnEquals\nproto.min = bnMin\nproto.max = bnMax\nproto.and = bnAnd\nproto.or = bnOr\nproto.xor = bnXor\nproto.andNot = bnAndNot\nproto.not = bnNot\nproto.shiftLeft = bnShiftLeft\nproto.shiftRight = bnShiftRight\nproto.getLowestSetBit = bnGetLowestSetBit\nproto.bitCount = bnBitCount\nproto.testBit = bnTestBit\nproto.setBit = bnSetBit\nproto.clearBit = bnClearBit\nproto.flipBit = bnFlipBit\nproto.add = bnAdd\nproto.subtract = bnSubtract\nproto.multiply = bnMultiply\nproto.divide = bnDivide\nproto.remainder = bnRemainder\nproto.divideAndRemainder = bnDivideAndRemainder\nproto.modPow = bnModPow\nproto.modInverse = bnModInverse\nproto.pow = bnPow\nproto.gcd = bnGCD\nproto.isProbablePrime = bnIsProbablePrime\n\n// JSBN-specific extension\nproto.square = bnSquare\n\n// constants\nBigInteger.ZERO = nbv(0)\nBigInteger.ONE = nbv(1)\nBigInteger.valueOf = nbv\n\nmodule.exports = BigInteger\n\n},{\"../package.json\":\"/home/itay/dev/pockets/node_modules/bigi/package.json\"}],\"/home/itay/dev/pockets/node_modules/bigi/lib/convert.js\":[function(require,module,exports){\n(function (Buffer){\n// FIXME: Kind of a weird way to throw exceptions, consider removing\nvar assert = require('assert')\nvar BigInteger = require('./bigi')\n\n/**\n * Turns a byte array into a big integer.\n *\n * This function will interpret a byte array as a big integer in big\n * endian notation.\n */\nBigInteger.fromByteArrayUnsigned = function(byteArray) {\n // BigInteger expects a DER integer conformant byte array\n if (byteArray[0] & 0x80) {\n return new BigInteger([0].concat(byteArray))\n }\n\n return new BigInteger(byteArray)\n}\n\n/**\n * Returns a byte array representation of the big integer.\n *\n * This returns the absolute of the contained value in big endian\n * form. A value of zero results in an empty array.\n */\nBigInteger.prototype.toByteArrayUnsigned = function() {\n var byteArray = this.toByteArray()\n return byteArray[0] === 0 ? byteArray.slice(1) : byteArray\n}\n\nBigInteger.fromDERInteger = function(byteArray) {\n return new BigInteger(byteArray)\n}\n\n/*\n * Converts BigInteger to a DER integer representation.\n *\n * The format for this value uses the most significant bit as a sign\n * bit. If the most significant bit is already set and the integer is\n * positive, a 0x00 is prepended.\n *\n * Examples:\n *\n * 0 => 0x00\n * 1 => 0x01\n * -1 => 0xff\n * 127 => 0x7f\n * -127 => 0x81\n * 128 => 0x0080\n * -128 => 0x80\n * 255 => 0x00ff\n * -255 => 0xff01\n * 16300 => 0x3fac\n * -16300 => 0xc054\n * 62300 => 0x00f35c\n * -62300 => 0xff0ca4\n*/\nBigInteger.prototype.toDERInteger = BigInteger.prototype.toByteArray\n\nBigInteger.fromBuffer = function(buffer) {\n // BigInteger expects a DER integer conformant byte array\n if (buffer[0] & 0x80) {\n var byteArray = Array.prototype.slice.call(buffer)\n\n return new BigInteger([0].concat(byteArray))\n }\n\n return new BigInteger(buffer)\n}\n\nBigInteger.fromHex = function(hex) {\n if (hex === '') return BigInteger.ZERO\n\n assert.equal(hex, hex.match(/^[A-Fa-f0-9]+/), 'Invalid hex string')\n assert.equal(hex.length % 2, 0, 'Incomplete hex')\n return new BigInteger(hex, 16)\n}\n\nBigInteger.prototype.toBuffer = function(size) {\n var byteArray = this.toByteArrayUnsigned()\n var zeros = []\n\n var padding = size - byteArray.length\n while (zeros.length < padding) zeros.push(0)\n\n return new Buffer(zeros.concat(byteArray))\n}\n\nBigInteger.prototype.toHex = function(size) {\n return this.toBuffer(size).toString('hex')\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./bigi\":\"/home/itay/dev/pockets/node_modules/bigi/lib/bigi.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/bigi/lib/index.js\":[function(require,module,exports){\nvar BigInteger = require('./bigi')\n\n//addons\nrequire('./convert')\n\nmodule.exports = BigInteger\n},{\"./bigi\":\"/home/itay/dev/pockets/node_modules/bigi/lib/bigi.js\",\"./convert\":\"/home/itay/dev/pockets/node_modules/bigi/lib/convert.js\"}],\"/home/itay/dev/pockets/node_modules/bigi/package.json\":[function(require,module,exports){\nmodule.exports={\n \"name\": \"bigi\",\n \"version\": \"1.4.0\",\n \"description\": \"Big integers.\",\n \"keywords\": [\n \"cryptography\",\n \"math\",\n \"bitcoin\",\n \"arbitrary\",\n \"precision\",\n \"arithmetic\",\n \"big\",\n \"integer\",\n \"int\",\n \"number\",\n \"biginteger\",\n \"bigint\",\n \"bignumber\",\n \"decimal\",\n \"float\"\n ],\n \"devDependencies\": {\n \"mocha\": \"^1.20.1\",\n \"jshint\": \"^2.5.1\",\n \"coveralls\": \"^2.10.0\",\n \"istanbul\": \"^0.2.11\"\n },\n \"repository\": {\n \"url\": \"https://github.com/cryptocoinjs/bigi\",\n \"type\": \"git\"\n },\n \"main\": \"./lib/index.js\",\n \"scripts\": {\n \"test\": \"_mocha -- test/*.js\",\n \"jshint\": \"jshint --config jshint.json lib/*.js ; true\",\n \"unit\": \"mocha\",\n \"coverage\": \"istanbul cover ./node_modules/.bin/_mocha -- --reporter list test/*.js\",\n \"coveralls\": \"npm run-script coverage && node ./node_modules/.bin/coveralls < coverage/lcov.info\"\n },\n \"dependencies\": {},\n \"testling\": {\n \"files\": \"test/*.js\",\n \"harness\": \"mocha\",\n \"browsers\": [\n \"ie/9..latest\",\n \"firefox/latest\",\n \"chrome/latest\",\n \"safari/6.0..latest\",\n \"iphone/6.0..latest\",\n \"android-browser/4.2..latest\"\n ]\n },\n \"bugs\": {\n \"url\": \"https://github.com/cryptocoinjs/bigi/issues\"\n },\n \"homepage\": \"https://github.com/cryptocoinjs/bigi\",\n \"_id\": \"bigi@1.4.0\",\n \"dist\": {\n \"shasum\": \"90ac1aeac0a531216463bdb58f42c1e05c8407ac\",\n \"tarball\": \"http://registry.npmjs.org/bigi/-/bigi-1.4.0.tgz\"\n },\n \"_from\": \"bigi@\",\n \"_npmVersion\": \"1.4.3\",\n \"_npmUser\": {\n \"name\": \"jp\",\n \"email\": \"jprichardson@gmail.com\"\n },\n \"maintainers\": [\n {\n \"name\": \"jp\",\n \"email\": \"jprichardson@gmail.com\"\n },\n {\n \"name\": \"midnightlightning\",\n \"email\": \"boydb@midnightdesign.ws\"\n },\n {\n \"name\": \"sidazhang\",\n \"email\": \"sidazhang89@gmail.com\"\n },\n {\n \"name\": \"nadav\",\n \"email\": \"npm@shesek.info\"\n }\n ],\n \"directories\": {},\n \"_shasum\": \"90ac1aeac0a531216463bdb58f42c1e05c8407ac\",\n \"_resolved\": \"https://registry.npmjs.org/bigi/-/bigi-1.4.0.tgz\",\n \"readme\": \"ERROR: No README data found!\"\n}\n\n},{}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/bigi.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/bigi/lib/bigi.js\"][0].apply(exports,arguments)\n},{\"../package.json\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/package.json\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/convert.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/bigi/lib/convert.js\"][0].apply(exports,arguments)\n},{\"./bigi\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/bigi.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/index.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/bigi/lib/index.js\"][0].apply(exports,arguments)\n},{\"./bigi\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/bigi.js\",\"./convert\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/convert.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/package.json\":[function(require,module,exports){\nmodule.exports={\n \"name\": \"bigi\",\n \"version\": \"1.4.0\",\n \"description\": \"Big integers.\",\n \"keywords\": [\n \"cryptography\",\n \"math\",\n \"bitcoin\",\n \"arbitrary\",\n \"precision\",\n \"arithmetic\",\n \"big\",\n \"integer\",\n \"int\",\n \"number\",\n \"biginteger\",\n \"bigint\",\n \"bignumber\",\n \"decimal\",\n \"float\"\n ],\n \"devDependencies\": {\n \"mocha\": \"^1.20.1\",\n \"jshint\": \"^2.5.1\",\n \"coveralls\": \"^2.10.0\",\n \"istanbul\": \"^0.2.11\"\n },\n \"repository\": {\n \"url\": \"https://github.com/cryptocoinjs/bigi\",\n \"type\": \"git\"\n },\n \"main\": \"./lib/index.js\",\n \"scripts\": {\n \"test\": \"_mocha -- test/*.js\",\n \"jshint\": \"jshint --config jshint.json lib/*.js ; true\",\n \"unit\": \"mocha\",\n \"coverage\": \"istanbul cover ./node_modules/.bin/_mocha -- --reporter list test/*.js\",\n \"coveralls\": \"npm run-script coverage && node ./node_modules/.bin/coveralls < coverage/lcov.info\"\n },\n \"dependencies\": {},\n \"testling\": {\n \"files\": \"test/*.js\",\n \"harness\": \"mocha\",\n \"browsers\": [\n \"ie/9..latest\",\n \"firefox/latest\",\n \"chrome/latest\",\n \"safari/6.0..latest\",\n \"iphone/6.0..latest\",\n \"android-browser/4.2..latest\"\n ]\n },\n \"bugs\": {\n \"url\": \"https://github.com/cryptocoinjs/bigi/issues\"\n },\n \"homepage\": \"https://github.com/cryptocoinjs/bigi\",\n \"_id\": \"bigi@1.4.0\",\n \"dist\": {\n \"shasum\": \"90ac1aeac0a531216463bdb58f42c1e05c8407ac\",\n \"tarball\": \"http://registry.npmjs.org/bigi/-/bigi-1.4.0.tgz\"\n },\n \"_from\": \"bigi@^1.4.0\",\n \"_npmVersion\": \"1.4.3\",\n \"_npmUser\": {\n \"name\": \"jp\",\n \"email\": \"jprichardson@gmail.com\"\n },\n \"maintainers\": [\n {\n \"name\": \"jp\",\n \"email\": \"jprichardson@gmail.com\"\n },\n {\n \"name\": \"midnightlightning\",\n \"email\": \"boydb@midnightdesign.ws\"\n },\n {\n \"name\": \"sidazhang\",\n \"email\": \"sidazhang89@gmail.com\"\n },\n {\n \"name\": \"nadav\",\n \"email\": \"npm@shesek.info\"\n }\n ],\n \"directories\": {},\n \"_shasum\": \"90ac1aeac0a531216463bdb58f42c1e05c8407ac\",\n \"_resolved\": \"https://registry.npmjs.org/bigi/-/bigi-1.4.0.tgz\"\n}\n\n},{}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bs58check/node_modules/bs58/lib/bs58.js\":[function(require,module,exports){\n// Base58 encoding/decoding\n// Originally written by Mike Hearn for BitcoinJ\n// Copyright (c) 2011 Google Inc\n// Ported to JavaScript by Stefan Thomas\n// Merged Buffer refactorings from base58-native by Stephen Pair\n// Copyright (c) 2013 BitPay Inc\n\nvar ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'\nvar ALPHABET_MAP = {}\nfor(var i = 0; i < ALPHABET.length; i++) {\n ALPHABET_MAP[ALPHABET.charAt(i)] = i\n}\nvar BASE = 58\n\nfunction encode(buffer) {\n if (buffer.length === 0) return ''\n\n var i, j, digits = [0]\n for (i = 0; i < buffer.length; i++) {\n for (j = 0; j < digits.length; j++) digits[j] <<= 8\n\n digits[0] += buffer[i]\n\n var carry = 0\n for (j = 0; j < digits.length; ++j) {\n digits[j] += carry\n\n carry = (digits[j] / BASE) | 0\n digits[j] %= BASE\n }\n\n while (carry) {\n digits.push(carry % BASE)\n\n carry = (carry / BASE) | 0\n }\n }\n\n // deal with leading zeros\n for (i = 0; buffer[i] === 0 && i < buffer.length - 1; i++) digits.push(0)\n\n // convert digits to a string\n var stringOutput = \"\"\n for (var i = digits.length - 1; i >= 0; i--) {\n stringOutput = stringOutput + ALPHABET[digits[i]]\n }\n return stringOutput\n}\n\nfunction decode(string) {\n if (string.length === 0) return []\n\n var i, j, bytes = [0]\n for (i = 0; i < string.length; i++) {\n var c = string[i]\n if (!(c in ALPHABET_MAP)) throw new Error('Non-base58 character')\n\n for (j = 0; j < bytes.length; j++) bytes[j] *= BASE\n bytes[0] += ALPHABET_MAP[c]\n\n var carry = 0\n for (j = 0; j < bytes.length; ++j) {\n bytes[j] += carry\n\n carry = bytes[j] >> 8\n bytes[j] &= 0xff\n }\n\n while (carry) {\n bytes.push(carry & 0xff)\n\n carry >>= 8\n }\n }\n\n // deal with leading zeros\n for (i = 0; string[i] === '1' && i < string.length - 1; i++) bytes.push(0)\n\n return bytes.reverse()\n}\n\nmodule.exports = {\n encode: encode,\n decode: decode\n}\n\n},{}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bs58check/src/bs58check.js\":[function(require,module,exports){\n(function (Buffer){\n'use strict';\n\nvar assert = require('assert')\nvar base58 = require('bs58')\nvar crypto = require('crypto')\n\n// SHA256(SHA256(buffer))\nfunction sha256x2(buffer) {\n buffer = crypto.createHash('sha256').update(buffer).digest()\n return crypto.createHash('sha256').update(buffer).digest()\n}\n\n// Encode a buffer as a base58-check encoded string\nfunction encode(payload) {\n var checksum = sha256x2(payload).slice(0, 4)\n\n return base58.encode(Buffer.concat([\n payload,\n checksum\n ]))\n}\n\n// Decode a base58-check encoded string to a buffer\nfunction decode(string) {\n var buffer = new Buffer(base58.decode(string))\n\n var payload = buffer.slice(0, -4)\n var checksum = buffer.slice(-4)\n var newChecksum = sha256x2(payload).slice(0, 4)\n\n assert.deepEqual(newChecksum, checksum, 'Invalid checksum')\n\n return payload\n}\n\nmodule.exports = {\n encode: encode,\n decode: decode\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"bs58\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bs58check/node_modules/bs58/lib/bs58.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"crypto\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/curve.js\":[function(require,module,exports){\nvar assert = require('assert')\nvar BigInteger = require('bigi')\n\nvar Point = require('./point')\n\nfunction Curve(p, a, b, Gx, Gy, n, h) {\n this.p = p\n this.a = a\n this.b = b\n this.G = Point.fromAffine(this, Gx, Gy)\n this.n = n\n this.h = h\n\n this.infinity = new Point(this, null, null, BigInteger.ZERO)\n\n // result caching\n this.pOverFour = p.add(BigInteger.ONE).shiftRight(2)\n}\n\nCurve.prototype.pointFromX = function(isOdd, x) {\n var alpha = x.pow(3).add(this.a.multiply(x)).add(this.b).mod(this.p)\n var beta = alpha.modPow(this.pOverFour, this.p) // XXX: not compatible with all curves\n\n var y = beta\n if (beta.isEven() ^ !isOdd) {\n y = this.p.subtract(y) // -y % p\n }\n\n return Point.fromAffine(this, x, y)\n}\n\nCurve.prototype.isInfinity = function(Q) {\n if (Q === this.infinity) return true\n\n return Q.z.signum() === 0 && Q.y.signum() !== 0\n}\n\nCurve.prototype.isOnCurve = function(Q) {\n if (this.isInfinity(Q)) return true\n\n var x = Q.affineX\n var y = Q.affineY\n var a = this.a\n var b = this.b\n var p = this.p\n\n // Check that xQ and yQ are integers in the interval [0, p - 1]\n if (x.signum() < 0 || x.compareTo(p) >= 0) return false\n if (y.signum() < 0 || y.compareTo(p) >= 0) return false\n\n // and check that y^2 = x^3 + ax + b (mod p)\n var lhs = y.square().mod(p)\n var rhs = x.pow(3).add(a.multiply(x)).add(b).mod(p)\n return lhs.equals(rhs)\n}\n\n/**\n * Validate an elliptic curve point.\n *\n * See SEC 1, section 3.2.2.1: Elliptic Curve Public Key Validation Primitive\n */\nCurve.prototype.validate = function(Q) {\n // Check Q != O\n assert(!this.isInfinity(Q), 'Point is at infinity')\n assert(this.isOnCurve(Q), 'Point is not on the curve')\n\n // Check nQ = O (where Q is a scalar multiple of G)\n var nQ = Q.multiply(this.n)\n assert(this.isInfinity(nQ), 'Point is not a scalar multiple of G')\n\n return true\n}\n\nmodule.exports = Curve\n\n},{\"./point\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/point.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"bigi\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/curves.json\":[function(require,module,exports){\nmodule.exports={\n \"secp128r1\": {\n \"p\": \"fffffffdffffffffffffffffffffffff\",\n \"a\": \"fffffffdfffffffffffffffffffffffc\",\n \"b\": \"e87579c11079f43dd824993c2cee5ed3\",\n \"n\": \"fffffffe0000000075a30d1b9038a115\",\n \"h\": \"01\",\n \"Gx\": \"161ff7528b899b2d0c28607ca52c5b86\",\n \"Gy\": \"cf5ac8395bafeb13c02da292dded7a83\"\n },\n \"secp160k1\": {\n \"p\": \"fffffffffffffffffffffffffffffffeffffac73\",\n \"a\": \"00\",\n \"b\": \"07\",\n \"n\": \"0100000000000000000001b8fa16dfab9aca16b6b3\",\n \"h\": \"01\",\n \"Gx\": \"3b4c382ce37aa192a4019e763036f4f5dd4d7ebb\",\n \"Gy\": \"938cf935318fdced6bc28286531733c3f03c4fee\"\n },\n \"secp160r1\": {\n \"p\": \"ffffffffffffffffffffffffffffffff7fffffff\",\n \"a\": \"ffffffffffffffffffffffffffffffff7ffffffc\",\n \"b\": \"1c97befc54bd7a8b65acf89f81d4d4adc565fa45\",\n \"n\": \"0100000000000000000001f4c8f927aed3ca752257\",\n \"h\": \"01\",\n \"Gx\": \"4a96b5688ef573284664698968c38bb913cbfc82\",\n \"Gy\": \"23a628553168947d59dcc912042351377ac5fb32\"\n },\n \"secp192k1\": {\n \"p\": \"fffffffffffffffffffffffffffffffffffffffeffffee37\",\n \"a\": \"00\",\n \"b\": \"03\",\n \"n\": \"fffffffffffffffffffffffe26f2fc170f69466a74defd8d\",\n \"h\": \"01\",\n \"Gx\": \"db4ff10ec057e9ae26b07d0280b7f4341da5d1b1eae06c7d\",\n \"Gy\": \"9b2f2f6d9c5628a7844163d015be86344082aa88d95e2f9d\"\n },\n \"secp192r1\": {\n \"p\": \"fffffffffffffffffffffffffffffffeffffffffffffffff\",\n \"a\": \"fffffffffffffffffffffffffffffffefffffffffffffffc\",\n \"b\": \"64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1\",\n \"n\": \"ffffffffffffffffffffffff99def836146bc9b1b4d22831\",\n \"h\": \"01\",\n \"Gx\": \"188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012\",\n \"Gy\": \"07192b95ffc8da78631011ed6b24cdd573f977a11e794811\"\n },\n \"secp256k1\": {\n \"p\": \"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f\",\n \"a\": \"00\",\n \"b\": \"07\",\n \"n\": \"fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141\",\n \"h\": \"01\",\n \"Gx\": \"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798\",\n \"Gy\": \"483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8\"\n },\n \"secp256r1\": {\n \"p\": \"ffffffff00000001000000000000000000000000ffffffffffffffffffffffff\",\n \"a\": \"ffffffff00000001000000000000000000000000fffffffffffffffffffffffc\",\n \"b\": \"5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b\",\n \"n\": \"ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551\",\n \"h\": \"01\",\n \"Gx\": \"6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296\",\n \"Gy\": \"4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5\"\n }\n}\n\n},{}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/index.js\":[function(require,module,exports){\nvar Point = require('./point')\nvar Curve = require('./curve')\n\nvar getCurveByName = require('./names')\n\nmodule.exports = {\n Curve: Curve,\n Point: Point,\n getCurveByName: getCurveByName\n}\n\n},{\"./curve\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/curve.js\",\"./names\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/names.js\",\"./point\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/point.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/names.js\":[function(require,module,exports){\nvar BigInteger = require('bigi')\n\nvar curves = require('./curves')\nvar Curve = require('./curve')\n\nfunction getCurveByName(name) {\n var curve = curves[name]\n if (!curve) return null\n\n var p = new BigInteger(curve.p, 16)\n var a = new BigInteger(curve.a, 16)\n var b = new BigInteger(curve.b, 16)\n var n = new BigInteger(curve.n, 16)\n var h = new BigInteger(curve.h, 16)\n var Gx = new BigInteger(curve.Gx, 16)\n var Gy = new BigInteger(curve.Gy, 16)\n\n return new Curve(p, a, b, Gx, Gy, n, h)\n}\n\nmodule.exports = getCurveByName\n\n},{\"./curve\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/curve.js\",\"./curves\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/curves.json\",\"bigi\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/point.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar BigInteger = require('bigi')\n\nvar THREE = BigInteger.valueOf(3)\n\nfunction Point(curve, x, y, z) {\n assert.notStrictEqual(z, undefined, 'Missing Z coordinate')\n\n this.curve = curve\n this.x = x\n this.y = y\n this.z = z\n this._zInv = null\n\n this.compressed = true\n}\n\nObject.defineProperty(Point.prototype, 'zInv', {\n get: function() {\n if (this._zInv === null) {\n this._zInv = this.z.modInverse(this.curve.p)\n }\n\n return this._zInv\n }\n})\n\nObject.defineProperty(Point.prototype, 'affineX', {\n get: function() {\n return this.x.multiply(this.zInv).mod(this.curve.p)\n }\n})\n\nObject.defineProperty(Point.prototype, 'affineY', {\n get: function() {\n return this.y.multiply(this.zInv).mod(this.curve.p)\n }\n})\n\nPoint.fromAffine = function(curve, x, y) {\n return new Point(curve, x, y, BigInteger.ONE)\n}\n\nPoint.prototype.equals = function(other) {\n if (other === this) return true\n if (this.curve.isInfinity(this)) return this.curve.isInfinity(other)\n if (this.curve.isInfinity(other)) return this.curve.isInfinity(this)\n\n // u = Y2 * Z1 - Y1 * Z2\n var u = other.y.multiply(this.z).subtract(this.y.multiply(other.z)).mod(this.curve.p)\n\n if (u.signum() !== 0) return false\n\n // v = X2 * Z1 - X1 * Z2\n var v = other.x.multiply(this.z).subtract(this.x.multiply(other.z)).mod(this.curve.p)\n\n return v.signum() === 0\n}\n\nPoint.prototype.negate = function() {\n var y = this.curve.p.subtract(this.y)\n\n return new Point(this.curve, this.x, y, this.z)\n}\n\nPoint.prototype.add = function(b) {\n if (this.curve.isInfinity(this)) return b\n if (this.curve.isInfinity(b)) return this\n\n var x1 = this.x\n var y1 = this.y\n var x2 = b.x\n var y2 = b.y\n\n // u = Y2 * Z1 - Y1 * Z2\n var u = y2.multiply(this.z).subtract(y1.multiply(b.z)).mod(this.curve.p)\n // v = X2 * Z1 - X1 * Z2\n var v = x2.multiply(this.z).subtract(x1.multiply(b.z)).mod(this.curve.p)\n\n if (v.signum() === 0) {\n if (u.signum() === 0) {\n return this.twice() // this == b, so double\n }\n\n return this.curve.infinity // this = -b, so infinity\n }\n\n var v2 = v.square()\n var v3 = v2.multiply(v)\n var x1v2 = x1.multiply(v2)\n var zu2 = u.square().multiply(this.z)\n\n // x3 = v * (z2 * (z1 * u^2 - 2 * x1 * v^2) - v^3)\n var x3 = zu2.subtract(x1v2.shiftLeft(1)).multiply(b.z).subtract(v3).multiply(v).mod(this.curve.p)\n // y3 = z2 * (3 * x1 * u * v^2 - y1 * v^3 - z1 * u^3) + u * v^3\n 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)\n // z3 = v^3 * z1 * z2\n var z3 = v3.multiply(this.z).multiply(b.z).mod(this.curve.p)\n\n return new Point(this.curve, x3, y3, z3)\n}\n\nPoint.prototype.twice = function() {\n if (this.curve.isInfinity(this)) return this\n if (this.y.signum() === 0) return this.curve.infinity\n\n var x1 = this.x\n var y1 = this.y\n\n var y1z1 = y1.multiply(this.z)\n var y1sqz1 = y1z1.multiply(y1).mod(this.curve.p)\n var a = this.curve.a\n\n // w = 3 * x1^2 + a * z1^2\n var w = x1.square().multiply(THREE)\n\n if (a.signum() !== 0) {\n w = w.add(this.z.square().multiply(a))\n }\n\n w = w.mod(this.curve.p)\n // x3 = 2 * y1 * z1 * (w^2 - 8 * x1 * y1^2 * z1)\n var x3 = w.square().subtract(x1.shiftLeft(3).multiply(y1sqz1)).shiftLeft(1).multiply(y1z1).mod(this.curve.p)\n // y3 = 4 * y1^2 * z1 * (3 * w * x1 - 2 * y1^2 * z1) - w^3\n var y3 = w.multiply(THREE).multiply(x1).subtract(y1sqz1.shiftLeft(1)).shiftLeft(2).multiply(y1sqz1).subtract(w.pow(3)).mod(this.curve.p)\n // z3 = 8 * (y1 * z1)^3\n var z3 = y1z1.pow(3).shiftLeft(3).mod(this.curve.p)\n\n return new Point(this.curve, x3, y3, z3)\n}\n\n// Simple NAF (Non-Adjacent Form) multiplication algorithm\n// TODO: modularize the multiplication algorithm\nPoint.prototype.multiply = function(k) {\n if (this.curve.isInfinity(this)) return this\n if (k.signum() === 0) return this.curve.infinity\n\n var e = k\n var h = e.multiply(THREE)\n\n var neg = this.negate()\n var R = this\n\n for (var i = h.bitLength() - 2; i > 0; --i) {\n R = R.twice()\n\n var hBit = h.testBit(i)\n var eBit = e.testBit(i)\n\n if (hBit != eBit) {\n R = R.add(hBit ? this : neg)\n }\n }\n\n return R\n}\n\n// Compute this*j + x*k (simultaneous multiplication)\nPoint.prototype.multiplyTwo = function(j, x, k) {\n var i\n\n if (j.bitLength() > k.bitLength())\n i = j.bitLength() - 1\n else\n i = k.bitLength() - 1\n\n var R = this.curve.infinity\n var both = this.add(x)\n\n while (i >= 0) {\n R = R.twice()\n\n var jBit = j.testBit(i)\n var kBit = k.testBit(i)\n\n if (jBit) {\n if (kBit) {\n R = R.add(both)\n\n } else {\n R = R.add(this)\n }\n\n } else {\n if (kBit) {\n R = R.add(x)\n }\n }\n --i\n }\n\n return R\n}\n\nPoint.prototype.getEncoded = function(compressed) {\n if (compressed == undefined) compressed = this.compressed\n if (this.curve.isInfinity(this)) return new Buffer('00', 'hex') // Infinity point encoded is simply '00'\n\n var x = this.affineX\n var y = this.affineY\n\n var buffer\n\n // Determine size of q in bytes\n var byteLength = Math.floor((this.curve.p.bitLength() + 7) / 8)\n\n // 0x02/0x03 | X\n if (compressed) {\n buffer = new Buffer(1 + byteLength)\n buffer.writeUInt8(y.isEven() ? 0x02 : 0x03, 0)\n\n // 0x04 | X | Y\n } else {\n buffer = new Buffer(1 + byteLength + byteLength)\n buffer.writeUInt8(0x04, 0)\n\n y.toBuffer(byteLength).copy(buffer, 1 + byteLength)\n }\n\n x.toBuffer(byteLength).copy(buffer, 1)\n\n return buffer\n}\n\nPoint.decodeFrom = function(curve, buffer) {\n var type = buffer.readUInt8(0)\n var compressed = (type !== 4)\n\n var byteLength = Math.floor((curve.p.bitLength() + 7) / 8)\n var x = BigInteger.fromBuffer(buffer.slice(1, 1 + byteLength))\n\n var Q\n if (compressed) {\n assert.equal(buffer.length, byteLength + 1, 'Invalid sequence length')\n assert(type === 0x02 || type === 0x03, 'Invalid sequence tag')\n\n var isOdd = (type === 0x03)\n Q = curve.pointFromX(isOdd, x)\n\n } else {\n assert.equal(buffer.length, 1 + byteLength + byteLength, 'Invalid sequence length')\n\n var y = BigInteger.fromBuffer(buffer.slice(1 + byteLength))\n Q = Point.fromAffine(curve, x, y)\n }\n\n Q.compressed = compressed\n return Q\n}\n\nPoint.prototype.toString = function () {\n if (this.curve.isInfinity(this)) return '(INFINITY)'\n\n return '(' + this.affineX.toString() + ',' + this.affineY.toString() + ')'\n}\n\nmodule.exports = Point\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"bigi\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/index.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/typeforce/index.js\":[function(require,module,exports){\n(function (Buffer){\nfunction getName(value) {\n if (value === undefined) return ''\n if (value === null) return ''\n// if (value.constructor.name !== undefined) return fn.name\n\n // why not constructor.name: https://kangax.github.io/compat-table/es6/#function_name_property\n var match = value.constructor.toString().match(/function (.*?)\\(/)\n return match ? match[1] : null\n}\n\nmodule.exports = function enforce(type, value) {\n switch (type) {\n case 'Array': {\n if (Array.isArray(value)) return\n break\n }\n\n case 'Boolean': {\n if (typeof value === 'boolean') return\n break\n }\n\n case 'Buffer': {\n if (Buffer.isBuffer(value)) return\n break\n }\n\n case 'Function': {\n if (typeof value === 'function') return\n break\n }\n\n case 'Number': {\n if (typeof value === 'number') return\n break\n }\n\n case 'Object': {\n if (typeof value === 'object') return\n\n break\n }\n\n case 'String': {\n if (typeof value === 'string') return\n break\n }\n }\n\n switch (typeof type) {\n case 'string': {\n if (type === getName(value)) return\n\n break\n }\n\n // evaluate type templates\n case 'object': {\n if (Array.isArray(type)) {\n var subType = type[0]\n\n enforce('Array', value)\n value.forEach(enforce.bind(undefined, subType))\n\n return\n }\n\n enforce('Object', value)\n for (var propertyName in type) {\n var propertyType = type[propertyName]\n\n if (!(propertyName in value)) {\n throw new TypeError('Missing property \"' + propertyName + '\" of type ' + JSON.stringify(propertyType))\n }\n\n var propertyValue = value[propertyName]\n\n try {\n enforce(propertyType, propertyValue)\n } catch (e) {\n throw new TypeError('Expected property \"' + propertyName + '\" of type ' + JSON.stringify(propertyType) + ', got ' + getName(propertyValue) + ' ' + propertyValue)\n }\n }\n\n return\n }\n }\n\n throw new TypeError('Expected ' + type + ', got ' + getName(value) + ' ' + value)\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/address.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar base58check = require('bs58check')\nvar typeForce = require('typeforce')\nvar networks = require('./networks')\nvar scripts = require('./scripts')\n\nfunction findScriptTypeByVersion (version) {\n for (var networkName in networks) {\n var network = networks[networkName]\n\n if (version === network.pubKeyHash) return 'pubkeyhash'\n if (version === network.scriptHash) return 'scripthash'\n }\n}\n\nfunction Address (hash, version) {\n typeForce('Buffer', hash)\n\n assert.strictEqual(hash.length, 20, 'Invalid hash length')\n assert.strictEqual(version & 0xff, version, 'Invalid version byte')\n\n this.hash = hash\n this.version = version\n}\n\nAddress.fromBase58Check = function (string) {\n var payload = base58check.decode(string)\n var version = payload.readUInt8(0)\n var hash = payload.slice(1)\n\n return new Address(hash, version)\n}\n\nAddress.fromOutputScript = function (script, network) {\n network = network || networks.bitcoin\n\n if (scripts.isPubKeyHashOutput(script)) return new Address(script.chunks[2], network.pubKeyHash)\n if (scripts.isScriptHashOutput(script)) return new Address(script.chunks[1], network.scriptHash)\n\n assert(false, script.toASM() + ' has no matching Address')\n}\n\nAddress.prototype.toBase58Check = function () {\n var payload = new Buffer(21)\n payload.writeUInt8(this.version, 0)\n this.hash.copy(payload, 1)\n\n return base58check.encode(payload)\n}\n\nAddress.prototype.toOutputScript = function () {\n var scriptType = findScriptTypeByVersion(this.version)\n\n if (scriptType === 'pubkeyhash') return scripts.pubKeyHashOutput(this.hash)\n if (scriptType === 'scripthash') return scripts.scriptHashOutput(this.hash)\n\n assert(false, this.toString() + ' has no matching Script')\n}\n\nAddress.prototype.toString = Address.prototype.toBase58Check\n\nmodule.exports = Address\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./networks\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/networks.js\",\"./scripts\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/scripts.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"bs58check\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bs58check/src/bs58check.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"typeforce\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/typeforce/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/base58check.js\":[function(require,module,exports){\nvar bs58check = require('bs58check')\n\nfunction decode () {\n console.warn('bs58check will be removed in 2.0.0. require(\"bs58check\") instead.')\n\n return bs58check.decode.apply(undefined, arguments)\n}\n\nfunction encode () {\n console.warn('bs58check will be removed in 2.0.0. require(\"bs58check\") instead.')\n\n return bs58check.encode.apply(undefined, arguments)\n}\n\nmodule.exports = {\n decode: decode,\n encode: encode\n}\n\n},{\"bs58check\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bs58check/src/bs58check.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/block.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar bufferutils = require('./bufferutils')\nvar crypto = require('./crypto')\n\nvar Transaction = require('./transaction')\n\nfunction Block () {\n this.version = 1\n this.prevHash = null\n this.merkleRoot = null\n this.timestamp = 0\n this.bits = 0\n this.nonce = 0\n}\n\nBlock.fromBuffer = function (buffer) {\n assert(buffer.length >= 80, 'Buffer too small (< 80 bytes)')\n\n var offset = 0\n function readSlice (n) {\n offset += n\n return buffer.slice(offset - n, offset)\n }\n\n function readUInt32 () {\n var i = buffer.readUInt32LE(offset)\n offset += 4\n return i\n }\n\n var block = new Block()\n block.version = readUInt32()\n block.prevHash = readSlice(32)\n block.merkleRoot = readSlice(32)\n block.timestamp = readUInt32()\n block.bits = readUInt32()\n block.nonce = readUInt32()\n\n if (buffer.length === 80) return block\n\n function readVarInt () {\n var vi = bufferutils.readVarInt(buffer, offset)\n offset += vi.size\n return vi.number\n }\n\n // FIXME: poor performance\n function readTransaction () {\n var tx = Transaction.fromBuffer(buffer.slice(offset), true)\n\n offset += tx.toBuffer().length\n return tx\n }\n\n var nTransactions = readVarInt()\n block.transactions = []\n\n for (var i = 0; i < nTransactions; ++i) {\n var tx = readTransaction()\n block.transactions.push(tx)\n }\n\n return block\n}\n\nBlock.fromHex = function (hex) {\n return Block.fromBuffer(new Buffer(hex, 'hex'))\n}\n\nBlock.prototype.getHash = function () {\n return crypto.hash256(this.toBuffer(true))\n}\n\nBlock.prototype.getId = function () {\n return bufferutils.reverse(this.getHash()).toString('hex')\n}\n\nBlock.prototype.getUTCDate = function () {\n var date = new Date(0) // epoch\n date.setUTCSeconds(this.timestamp)\n\n return date\n}\n\nBlock.prototype.toBuffer = function (headersOnly) {\n var buffer = new Buffer(80)\n\n var offset = 0\n function writeSlice (slice) {\n slice.copy(buffer, offset)\n offset += slice.length\n }\n\n function writeUInt32 (i) {\n buffer.writeUInt32LE(i, offset)\n offset += 4\n }\n\n writeUInt32(this.version)\n writeSlice(this.prevHash)\n writeSlice(this.merkleRoot)\n writeUInt32(this.timestamp)\n writeUInt32(this.bits)\n writeUInt32(this.nonce)\n\n if (headersOnly || !this.transactions) return buffer\n\n var txLenBuffer = bufferutils.varIntBuffer(this.transactions.length)\n var txBuffers = this.transactions.map(function (tx) {\n return tx.toBuffer()\n })\n\n return Buffer.concat([buffer, txLenBuffer].concat(txBuffers))\n}\n\nBlock.prototype.toHex = function (headersOnly) {\n return this.toBuffer(headersOnly).toString('hex')\n}\n\nmodule.exports = Block\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./bufferutils\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/bufferutils.js\",\"./crypto\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/crypto.js\",\"./transaction\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/transaction.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/bufferutils.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar opcodes = require('./opcodes')\n\n// https://github.com/feross/buffer/blob/master/index.js#L1127\nfunction verifuint (value, max) {\n assert(typeof value === 'number', 'cannot write a non-number as a number')\n assert(value >= 0, 'specified a negative value for writing an unsigned value')\n assert(value <= max, 'value is larger than maximum value for type')\n assert(Math.floor(value) === value, 'value has a fractional component')\n}\n\nfunction pushDataSize (i) {\n return i < opcodes.OP_PUSHDATA1 ? 1\n : i < 0xff ? 2\n : i < 0xffff ? 3\n : 5\n}\n\nfunction readPushDataInt (buffer, offset) {\n var opcode = buffer.readUInt8(offset)\n var number, size\n\n // ~6 bit\n if (opcode < opcodes.OP_PUSHDATA1) {\n number = opcode\n size = 1\n\n // 8 bit\n } else if (opcode === opcodes.OP_PUSHDATA1) {\n if (offset + 2 > buffer.length) return null\n number = buffer.readUInt8(offset + 1)\n size = 2\n\n // 16 bit\n } else if (opcode === opcodes.OP_PUSHDATA2) {\n if (offset + 3 > buffer.length) return null\n number = buffer.readUInt16LE(offset + 1)\n size = 3\n\n // 32 bit\n } else {\n if (offset + 5 > buffer.length) return null\n assert.equal(opcode, opcodes.OP_PUSHDATA4, 'Unexpected opcode')\n\n number = buffer.readUInt32LE(offset + 1)\n size = 5\n }\n\n return {\n opcode: opcode,\n number: number,\n size: size\n }\n}\n\nfunction readUInt64LE (buffer, offset) {\n var a = buffer.readUInt32LE(offset)\n var b = buffer.readUInt32LE(offset + 4)\n b *= 0x100000000\n\n verifuint(b + a, 0x001fffffffffffff)\n\n return b + a\n}\n\nfunction readVarInt (buffer, offset) {\n var t = buffer.readUInt8(offset)\n var number, size\n\n // 8 bit\n if (t < 253) {\n number = t\n size = 1\n\n // 16 bit\n } else if (t < 254) {\n number = buffer.readUInt16LE(offset + 1)\n size = 3\n\n // 32 bit\n } else if (t < 255) {\n number = buffer.readUInt32LE(offset + 1)\n size = 5\n\n // 64 bit\n } else {\n number = readUInt64LE(buffer, offset + 1)\n size = 9\n }\n\n return {\n number: number,\n size: size\n }\n}\n\nfunction writePushDataInt (buffer, number, offset) {\n var size = pushDataSize(number)\n\n // ~6 bit\n if (size === 1) {\n buffer.writeUInt8(number, offset)\n\n // 8 bit\n } else if (size === 2) {\n buffer.writeUInt8(opcodes.OP_PUSHDATA1, offset)\n buffer.writeUInt8(number, offset + 1)\n\n // 16 bit\n } else if (size === 3) {\n buffer.writeUInt8(opcodes.OP_PUSHDATA2, offset)\n buffer.writeUInt16LE(number, offset + 1)\n\n // 32 bit\n } else {\n buffer.writeUInt8(opcodes.OP_PUSHDATA4, offset)\n buffer.writeUInt32LE(number, offset + 1)\n }\n\n return size\n}\n\nfunction writeUInt64LE (buffer, value, offset) {\n verifuint(value, 0x001fffffffffffff)\n\n buffer.writeInt32LE(value & -1, offset)\n buffer.writeUInt32LE(Math.floor(value / 0x100000000), offset + 4)\n}\n\nfunction varIntSize (i) {\n return i < 253 ? 1\n : i < 0x10000 ? 3\n : i < 0x100000000 ? 5\n : 9\n}\n\nfunction writeVarInt (buffer, number, offset) {\n var size = varIntSize(number)\n\n // 8 bit\n if (size === 1) {\n buffer.writeUInt8(number, offset)\n\n // 16 bit\n } else if (size === 3) {\n buffer.writeUInt8(253, offset)\n buffer.writeUInt16LE(number, offset + 1)\n\n // 32 bit\n } else if (size === 5) {\n buffer.writeUInt8(254, offset)\n buffer.writeUInt32LE(number, offset + 1)\n\n // 64 bit\n } else {\n buffer.writeUInt8(255, offset)\n writeUInt64LE(buffer, number, offset + 1)\n }\n\n return size\n}\n\nfunction varIntBuffer (i) {\n var size = varIntSize(i)\n var buffer = new Buffer(size)\n writeVarInt(buffer, i, 0)\n\n return buffer\n}\n\nfunction reverse (buffer) {\n var buffer2 = new Buffer(buffer)\n Array.prototype.reverse.call(buffer2)\n return buffer2\n}\n\nmodule.exports = {\n pushDataSize: pushDataSize,\n readPushDataInt: readPushDataInt,\n readUInt64LE: readUInt64LE,\n readVarInt: readVarInt,\n reverse: reverse,\n varIntBuffer: varIntBuffer,\n varIntSize: varIntSize,\n writePushDataInt: writePushDataInt,\n writeUInt64LE: writeUInt64LE,\n writeVarInt: writeVarInt\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./opcodes\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/opcodes.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/crypto.js\":[function(require,module,exports){\nvar crypto = require('crypto')\n\nfunction hash160 (buffer) {\n return ripemd160(sha256(buffer))\n}\n\nfunction hash256 (buffer) {\n return sha256(sha256(buffer))\n}\n\nfunction ripemd160 (buffer) {\n return crypto.createHash('rmd160').update(buffer).digest()\n}\n\nfunction sha1 (buffer) {\n return crypto.createHash('sha1').update(buffer).digest()\n}\n\nfunction sha256 (buffer) {\n return crypto.createHash('sha256').update(buffer).digest()\n}\n\n// FIXME: Name not consistent with others\nfunction HmacSHA256 (buffer, secret) {\n console.warn('Hmac* functions are deprecated for removal in 2.0.0, use node crypto instead')\n return crypto.createHmac('sha256', secret).update(buffer).digest()\n}\n\nfunction HmacSHA512 (buffer, secret) {\n console.warn('Hmac* functions are deprecated for removal in 2.0.0, use node crypto instead')\n return crypto.createHmac('sha512', secret).update(buffer).digest()\n}\n\nmodule.exports = {\n ripemd160: ripemd160,\n sha1: sha1,\n sha256: sha256,\n hash160: hash160,\n hash256: hash256,\n HmacSHA256: HmacSHA256,\n HmacSHA512: HmacSHA512\n}\n\n},{\"crypto\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecdsa.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar crypto = require('crypto')\nvar typeForce = require('typeforce')\n\nvar BigInteger = require('bigi')\nvar ECSignature = require('./ecsignature')\n\nvar ZERO = new Buffer([0])\nvar ONE = new Buffer([1])\n\n// https://tools.ietf.org/html/rfc6979#section-3.2\nfunction deterministicGenerateK (curve, hash, d, checkSig) {\n typeForce('Buffer', hash)\n typeForce('BigInteger', d)\n\n // FIXME: remove/uncomment for 2.0.0\n // typeForce('Function', checkSig)\n\n if (typeof checkSig !== 'function') {\n console.warn('deterministicGenerateK requires a checkSig callback in 2.0.0, see #337 for more information')\n\n checkSig = function (k) {\n var G = curve.G\n var n = curve.n\n var e = BigInteger.fromBuffer(hash)\n\n var Q = G.multiply(k)\n\n if (curve.isInfinity(Q))\n return false\n\n var r = Q.affineX.mod(n)\n if (r.signum() === 0)\n return false\n\n var s = k.modInverse(n).multiply(e.add(d.multiply(r))).mod(n)\n if (s.signum() === 0)\n return false\n\n return true\n }\n }\n\n // sanity check\n assert.equal(hash.length, 32, 'Hash must be 256 bit')\n\n var x = d.toBuffer(32)\n var k = new Buffer(32)\n var v = new Buffer(32)\n\n // Step A, ignored as hash already provided\n // Step B\n v.fill(1)\n\n // Step C\n k.fill(0)\n\n // Step D\n k = crypto.createHmac('sha256', k)\n .update(v)\n .update(ZERO)\n .update(x)\n .update(hash)\n .digest()\n\n // Step E\n v = crypto.createHmac('sha256', k).update(v).digest()\n\n // Step F\n k = crypto.createHmac('sha256', k)\n .update(v)\n .update(ONE)\n .update(x)\n .update(hash)\n .digest()\n\n // Step G\n v = crypto.createHmac('sha256', k).update(v).digest()\n\n // Step H1/H2a, ignored as tlen === qlen (256 bit)\n // Step H2b\n v = crypto.createHmac('sha256', k).update(v).digest()\n\n var T = BigInteger.fromBuffer(v)\n\n // Step H3, repeat until T is within the interval [1, n - 1] and is suitable for ECDSA\n while ((T.signum() <= 0) || (T.compareTo(curve.n) >= 0) || !checkSig(T)) {\n k = crypto.createHmac('sha256', k)\n .update(v)\n .update(ZERO)\n .digest()\n\n v = crypto.createHmac('sha256', k).update(v).digest()\n\n // Step H1/H2a, again, ignored as tlen === qlen (256 bit)\n // Step H2b again\n v = crypto.createHmac('sha256', k).update(v).digest()\n T = BigInteger.fromBuffer(v)\n }\n\n return T\n}\n\nfunction sign (curve, hash, d) {\n var r, s\n\n var e = BigInteger.fromBuffer(hash)\n var n = curve.n\n var G = curve.G\n\n deterministicGenerateK(curve, hash, d, function (k) {\n var Q = G.multiply(k)\n\n if (curve.isInfinity(Q))\n return false\n\n r = Q.affineX.mod(n)\n if (r.signum() === 0)\n return false\n\n s = k.modInverse(n).multiply(e.add(d.multiply(r))).mod(n)\n if (s.signum() === 0)\n return false\n\n return true\n })\n\n var N_OVER_TWO = n.shiftRight(1)\n\n // enforce low S values, see bip62: 'low s values in signatures'\n if (s.compareTo(N_OVER_TWO) > 0) {\n s = n.subtract(s)\n }\n\n return new ECSignature(r, s)\n}\n\nfunction verifyRaw (curve, e, signature, Q) {\n var n = curve.n\n var G = curve.G\n\n var r = signature.r\n var s = signature.s\n\n // 1.4.1 Enforce r and s are both integers in the interval [1, n − 1]\n if (r.signum() <= 0 || r.compareTo(n) >= 0) return false\n if (s.signum() <= 0 || s.compareTo(n) >= 0) return false\n\n // c = s^-1 mod n\n var c = s.modInverse(n)\n\n // 1.4.4 Compute u1 = es^−1 mod n\n // u2 = rs^−1 mod n\n var u1 = e.multiply(c).mod(n)\n var u2 = r.multiply(c).mod(n)\n\n // 1.4.5 Compute R = (xR, yR) = u1G + u2Q\n var R = G.multiplyTwo(u1, Q, u2)\n var v = R.affineX.mod(n)\n\n // 1.4.5 (cont.) Enforce R is not at infinity\n if (curve.isInfinity(R)) return false\n\n // 1.4.8 If v = r, output \"valid\", and if v != r, output \"invalid\"\n return v.equals(r)\n}\n\nfunction verify (curve, hash, signature, Q) {\n // 1.4.2 H = Hash(M), already done by the user\n // 1.4.3 e = H\n var e = BigInteger.fromBuffer(hash)\n\n return verifyRaw(curve, e, signature, Q)\n}\n\n/**\n * Recover a public key from a signature.\n *\n * See SEC 1: Elliptic Curve Cryptography, section 4.1.6, \"Public\n * Key Recovery Operation\".\n *\n * http://www.secg.org/download/aid-780/sec1-v2.pdf\n */\nfunction recoverPubKey (curve, e, signature, i) {\n assert.strictEqual(i & 3, i, 'Recovery param is more than two bits')\n\n var n = curve.n\n var G = curve.G\n\n var r = signature.r\n var s = signature.s\n\n assert(r.signum() > 0 && r.compareTo(n) < 0, 'Invalid r value')\n assert(s.signum() > 0 && s.compareTo(n) < 0, 'Invalid s value')\n\n // A set LSB signifies that the y-coordinate is odd\n var isYOdd = i & 1\n\n // The more significant bit specifies whether we should use the\n // first or second candidate key.\n var isSecondKey = i >> 1\n\n // 1.1 Let x = r + jn\n var x = isSecondKey ? r.add(n) : r\n var R = curve.pointFromX(isYOdd, x)\n\n // 1.4 Check that nR is at infinity\n var nR = R.multiply(n)\n assert(curve.isInfinity(nR), 'nR is not a valid curve point')\n\n // Compute -e from e\n var eNeg = e.negate().mod(n)\n\n // 1.6.1 Compute Q = r^-1 (sR - eG)\n // Q = r^-1 (sR + -eG)\n var rInv = r.modInverse(n)\n\n var Q = R.multiplyTwo(s, G, eNeg).multiply(rInv)\n curve.validate(Q)\n\n return Q\n}\n\n/**\n * Calculate pubkey extraction parameter.\n *\n * When extracting a pubkey from a signature, we have to\n * distinguish four different cases. Rather than putting this\n * burden on the verifier, Bitcoin includes a 2-bit value with the\n * signature.\n *\n * This function simply tries all four cases and returns the value\n * that resulted in a successful pubkey recovery.\n */\nfunction calcPubKeyRecoveryParam (curve, e, signature, Q) {\n for (var i = 0; i < 4; i++) {\n var Qprime = recoverPubKey(curve, e, signature, i)\n\n // 1.6.2 Verify Q\n if (Qprime.equals(Q)) {\n return i\n }\n }\n\n throw new Error('Unable to find valid recovery factor')\n}\n\nmodule.exports = {\n calcPubKeyRecoveryParam: calcPubKeyRecoveryParam,\n deterministicGenerateK: deterministicGenerateK,\n recoverPubKey: recoverPubKey,\n sign: sign,\n verify: verify,\n verifyRaw: verifyRaw\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./ecsignature\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecsignature.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"bigi\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/index.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"crypto\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/index.js\",\"typeforce\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/typeforce/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/eckey.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar base58check = require('bs58check')\nvar crypto = require('crypto')\nvar ecdsa = require('./ecdsa')\nvar typeForce = require('typeforce')\nvar networks = require('./networks')\n\nvar BigInteger = require('bigi')\nvar ECPubKey = require('./ecpubkey')\n\nvar ecurve = require('ecurve')\nvar secp256k1 = ecurve.getCurveByName('secp256k1')\n\nfunction ECKey (d, compressed) {\n assert(d.signum() > 0, 'Private key must be greater than 0')\n assert(d.compareTo(ECKey.curve.n) < 0, 'Private key must be less than the curve order')\n\n var Q = ECKey.curve.G.multiply(d)\n\n this.d = d\n this.pub = new ECPubKey(Q, compressed)\n}\n\n// Constants\nECKey.curve = secp256k1\n\n// Static constructors\nECKey.fromWIF = function (string) {\n var payload = base58check.decode(string)\n var compressed = false\n\n // Ignore the version byte\n payload = payload.slice(1)\n\n if (payload.length === 33) {\n assert.strictEqual(payload[32], 0x01, 'Invalid compression flag')\n\n // Truncate the compression flag\n payload = payload.slice(0, -1)\n compressed = true\n }\n\n assert.equal(payload.length, 32, 'Invalid WIF payload length')\n\n var d = BigInteger.fromBuffer(payload)\n return new ECKey(d, compressed)\n}\n\nECKey.makeRandom = function (compressed, rng) {\n rng = rng || crypto.randomBytes\n\n var buffer = rng(32)\n typeForce('Buffer', buffer)\n assert.equal(buffer.length, 32, 'Expected 256-bit Buffer from RNG')\n\n var d = BigInteger.fromBuffer(buffer)\n d = d.mod(ECKey.curve.n)\n\n return new ECKey(d, compressed)\n}\n\n// Export functions\nECKey.prototype.toWIF = function (network) {\n network = network || networks.bitcoin\n\n var bufferLen = this.pub.compressed ? 34 : 33\n var buffer = new Buffer(bufferLen)\n\n buffer.writeUInt8(network.wif, 0)\n this.d.toBuffer(32).copy(buffer, 1)\n\n if (this.pub.compressed) {\n buffer.writeUInt8(0x01, 33)\n }\n\n return base58check.encode(buffer)\n}\n\n// Operations\nECKey.prototype.sign = function (hash) {\n return ecdsa.sign(ECKey.curve, hash, this.d)\n}\n\nmodule.exports = ECKey\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./ecdsa\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecdsa.js\",\"./ecpubkey\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecpubkey.js\",\"./networks\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/networks.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"bigi\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/index.js\",\"bs58check\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bs58check/src/bs58check.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"crypto\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/index.js\",\"ecurve\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/index.js\",\"typeforce\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/typeforce/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecpubkey.js\":[function(require,module,exports){\n(function (Buffer){\nvar crypto = require('./crypto')\nvar ecdsa = require('./ecdsa')\nvar typeForce = require('typeforce')\nvar networks = require('./networks')\n\nvar Address = require('./address')\n\nvar ecurve = require('ecurve')\nvar secp256k1 = ecurve.getCurveByName('secp256k1')\n\nfunction ECPubKey (Q, compressed) {\n if (compressed === undefined) {\n compressed = true\n }\n\n typeForce('Point', Q)\n typeForce('Boolean', compressed)\n\n this.compressed = compressed\n this.Q = Q\n}\n\n// Constants\nECPubKey.curve = secp256k1\n\n// Static constructors\nECPubKey.fromBuffer = function (buffer) {\n var Q = ecurve.Point.decodeFrom(ECPubKey.curve, buffer)\n return new ECPubKey(Q, Q.compressed)\n}\n\nECPubKey.fromHex = function (hex) {\n return ECPubKey.fromBuffer(new Buffer(hex, 'hex'))\n}\n\n// Operations\nECPubKey.prototype.getAddress = function (network) {\n network = network || networks.bitcoin\n\n return new Address(crypto.hash160(this.toBuffer()), network.pubKeyHash)\n}\n\nECPubKey.prototype.verify = function (hash, signature) {\n return ecdsa.verify(ECPubKey.curve, hash, signature, this.Q)\n}\n\n// Export functions\nECPubKey.prototype.toBuffer = function () {\n return this.Q.getEncoded(this.compressed)\n}\n\nECPubKey.prototype.toHex = function () {\n return this.toBuffer().toString('hex')\n}\n\nmodule.exports = ECPubKey\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./address\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/address.js\",\"./crypto\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/crypto.js\",\"./ecdsa\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecdsa.js\",\"./networks\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/networks.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"ecurve\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/index.js\",\"typeforce\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/typeforce/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecsignature.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar typeForce = require('typeforce')\n\nvar BigInteger = require('bigi')\n\nfunction ECSignature (r, s) {\n typeForce('BigInteger', r)\n typeForce('BigInteger', s)\n\n this.r = r\n this.s = s\n}\n\nECSignature.parseCompact = function (buffer) {\n assert.equal(buffer.length, 65, 'Invalid signature length')\n var i = buffer.readUInt8(0) - 27\n\n // At most 3 bits\n assert.equal(i, i & 7, 'Invalid signature parameter')\n var compressed = !!(i & 4)\n\n // Recovery param only\n i = i & 3\n\n var r = BigInteger.fromBuffer(buffer.slice(1, 33))\n var s = BigInteger.fromBuffer(buffer.slice(33))\n\n return {\n compressed: compressed,\n i: i,\n signature: new ECSignature(r, s)\n }\n}\n\nECSignature.fromDER = function (buffer) {\n assert.equal(buffer.readUInt8(0), 0x30, 'Not a DER sequence')\n assert.equal(buffer.readUInt8(1), buffer.length - 2, 'Invalid sequence length')\n assert.equal(buffer.readUInt8(2), 0x02, 'Expected a DER integer')\n\n var rLen = buffer.readUInt8(3)\n assert(rLen > 0, 'R length is zero')\n\n var offset = 4 + rLen\n assert.equal(buffer.readUInt8(offset), 0x02, 'Expected a DER integer (2)')\n\n var sLen = buffer.readUInt8(offset + 1)\n assert(sLen > 0, 'S length is zero')\n\n var rB = buffer.slice(4, offset)\n var sB = buffer.slice(offset + 2)\n offset += 2 + sLen\n\n if (rLen > 1 && rB.readUInt8(0) === 0x00) {\n assert(rB.readUInt8(1) & 0x80, 'R value excessively padded')\n }\n\n if (sLen > 1 && sB.readUInt8(0) === 0x00) {\n assert(sB.readUInt8(1) & 0x80, 'S value excessively padded')\n }\n\n assert.equal(offset, buffer.length, 'Invalid DER encoding')\n var r = BigInteger.fromDERInteger(rB)\n var s = BigInteger.fromDERInteger(sB)\n\n assert(r.signum() >= 0, 'R value is negative')\n assert(s.signum() >= 0, 'S value is negative')\n\n return new ECSignature(r, s)\n}\n\n// BIP62: 1 byte hashType flag (only 0x01, 0x02, 0x03, 0x81, 0x82 and 0x83 are allowed)\nECSignature.parseScriptSignature = function (buffer) {\n var hashType = buffer.readUInt8(buffer.length - 1)\n var hashTypeMod = hashType & ~0x80\n\n assert(hashTypeMod > 0x00 && hashTypeMod < 0x04, 'Invalid hashType ' + hashType)\n\n return {\n signature: ECSignature.fromDER(buffer.slice(0, -1)),\n hashType: hashType\n }\n}\n\nECSignature.prototype.toCompact = function (i, compressed) {\n if (compressed) {\n i += 4\n }\n\n i += 27\n\n var buffer = new Buffer(65)\n buffer.writeUInt8(i, 0)\n\n this.r.toBuffer(32).copy(buffer, 1)\n this.s.toBuffer(32).copy(buffer, 33)\n\n return buffer\n}\n\nECSignature.prototype.toDER = function () {\n var rBa = this.r.toDERInteger()\n var sBa = this.s.toDERInteger()\n\n var sequence = []\n\n // INTEGER\n sequence.push(0x02, rBa.length)\n sequence = sequence.concat(rBa)\n\n // INTEGER\n sequence.push(0x02, sBa.length)\n sequence = sequence.concat(sBa)\n\n // SEQUENCE\n sequence.unshift(0x30, sequence.length)\n\n return new Buffer(sequence)\n}\n\nECSignature.prototype.toScriptSignature = function (hashType) {\n var hashTypeMod = hashType & ~0x80\n assert(hashTypeMod > 0x00 && hashTypeMod < 0x04, 'Invalid hashType ' + hashType)\n\n var hashTypeBuffer = new Buffer(1)\n hashTypeBuffer.writeUInt8(hashType, 0)\n\n return Buffer.concat([this.toDER(), hashTypeBuffer])\n}\n\nmodule.exports = ECSignature\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"bigi\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/index.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"typeforce\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/typeforce/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/hdnode.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar base58check = require('bs58check')\nvar bcrypto = require('./crypto')\nvar crypto = require('crypto')\nvar typeForce = require('typeforce')\nvar networks = require('./networks')\n\nvar BigInteger = require('bigi')\nvar ECKey = require('./eckey')\nvar ECPubKey = require('./ecpubkey')\n\nvar ecurve = require('ecurve')\nvar curve = ecurve.getCurveByName('secp256k1')\n\nfunction findBIP32NetworkByVersion (version) {\n for (var name in networks) {\n var network = networks[name]\n\n if (version === network.bip32.private || version === network.bip32.public) {\n return network\n }\n }\n\n assert(false, 'Could not find network for ' + version.toString(16))\n}\n\nfunction HDNode (K, chainCode, network) {\n network = network || networks.bitcoin\n\n typeForce('Buffer', chainCode)\n\n assert.equal(chainCode.length, 32, 'Expected chainCode length of 32, got ' + chainCode.length)\n assert(network.bip32, 'Unknown BIP32 constants for network')\n\n this.chainCode = chainCode\n this.depth = 0\n this.index = 0\n this.parentFingerprint = 0x00000000\n this.network = network\n\n if (K instanceof BigInteger) {\n this.privKey = new ECKey(K, true)\n this.pubKey = this.privKey.pub\n } else if (K instanceof ECKey) {\n assert(K.pub.compressed, 'ECKey must be compressed')\n this.privKey = K\n } else if (K instanceof ECPubKey) {\n assert(K.compressed, 'ECPubKey must be compressed')\n this.pubKey = K\n } else {\n this.pubKey = new ECPubKey(K, true)\n }\n}\n\nHDNode.MASTER_SECRET = new Buffer('Bitcoin seed')\nHDNode.HIGHEST_BIT = 0x80000000\nHDNode.LENGTH = 78\n\nHDNode.fromSeedBuffer = function (seed, network) {\n typeForce('Buffer', seed)\n\n assert(seed.length >= 16, 'Seed should be at least 128 bits')\n assert(seed.length <= 64, 'Seed should be at most 512 bits')\n\n var I = crypto.createHmac('sha512', HDNode.MASTER_SECRET).update(seed).digest()\n var IL = I.slice(0, 32)\n var IR = I.slice(32)\n\n // In case IL is 0 or >= n, the master key is invalid\n // This is handled by `new ECKey` in the HDNode constructor\n var pIL = BigInteger.fromBuffer(IL)\n\n return new HDNode(pIL, IR, network)\n}\n\nHDNode.fromSeedHex = function (hex, network) {\n return HDNode.fromSeedBuffer(new Buffer(hex, 'hex'), network)\n}\n\nHDNode.fromBase58 = function (string, network) {\n return HDNode.fromBuffer(base58check.decode(string), network, true)\n}\n\n// FIXME: remove in 2.x.y\nHDNode.fromBuffer = function (buffer, network, __ignoreDeprecation) {\n if (!__ignoreDeprecation) {\n console.warn('HDNode.fromBuffer() is deprecated for removal in 2.x.y, use fromBase58 instead')\n }\n\n assert.strictEqual(buffer.length, HDNode.LENGTH, 'Invalid buffer length')\n\n // 4 byte: version bytes\n var version = buffer.readUInt32BE(0)\n\n if (network) {\n assert(version === network.bip32.private || version === network.bip32.public, \"Network doesn't match\")\n\n // auto-detect\n } else {\n network = findBIP32NetworkByVersion(version)\n }\n\n // 1 byte: depth: 0x00 for master nodes, 0x01 for level-1 descendants, ...\n var depth = buffer.readUInt8(4)\n\n // 4 bytes: the fingerprint of the parent's key (0x00000000 if master key)\n var parentFingerprint = buffer.readUInt32BE(5)\n if (depth === 0) {\n assert.strictEqual(parentFingerprint, 0x00000000, 'Invalid parent fingerprint')\n }\n\n // 4 bytes: child number. This is the number i in xi = xpar/i, with xi the key being serialized.\n // This is encoded in MSB order. (0x00000000 if master key)\n var index = buffer.readUInt32BE(9)\n assert(depth > 0 || index === 0, 'Invalid index')\n\n // 32 bytes: the chain code\n var chainCode = buffer.slice(13, 45)\n var data, hd\n\n // 33 bytes: private key data (0x00 + k)\n if (version === network.bip32.private) {\n assert.strictEqual(buffer.readUInt8(45), 0x00, 'Invalid private key')\n data = buffer.slice(46, 78)\n var d = BigInteger.fromBuffer(data)\n hd = new HDNode(d, chainCode, network)\n\n // 33 bytes: public key data (0x02 + X or 0x03 + X)\n } else {\n data = buffer.slice(45, 78)\n var Q = ecurve.Point.decodeFrom(curve, data)\n assert.equal(Q.compressed, true, 'Invalid public key')\n\n // Verify that the X coordinate in the public point corresponds to a point on the curve.\n // If not, the extended public key is invalid.\n curve.validate(Q)\n\n hd = new HDNode(Q, chainCode, network)\n }\n\n hd.depth = depth\n hd.index = index\n hd.parentFingerprint = parentFingerprint\n\n return hd\n}\n\n// FIXME: remove in 2.x.y\nHDNode.fromHex = function (hex, network) {\n return HDNode.fromBuffer(new Buffer(hex, 'hex'), network)\n}\n\nHDNode.prototype.getIdentifier = function () {\n return bcrypto.hash160(this.pubKey.toBuffer())\n}\n\nHDNode.prototype.getFingerprint = function () {\n return this.getIdentifier().slice(0, 4)\n}\n\nHDNode.prototype.getAddress = function () {\n return this.pubKey.getAddress(this.network)\n}\n\nHDNode.prototype.neutered = function () {\n var neutered = new HDNode(this.pubKey.Q, this.chainCode, this.network)\n neutered.depth = this.depth\n neutered.index = this.index\n neutered.parentFingerprint = this.parentFingerprint\n\n return neutered\n}\n\nHDNode.prototype.toBase58 = function (isPrivate) {\n return base58check.encode(this.toBuffer(isPrivate, true))\n}\n\n// FIXME: remove in 2.x.y\nHDNode.prototype.toBuffer = function (isPrivate, __ignoreDeprecation) {\n if (isPrivate === undefined) {\n isPrivate = !!this.privKey\n\n // FIXME: remove in 2.x.y\n } else {\n console.warn('isPrivate flag is deprecated, please use the .neutered() method instead')\n }\n\n if (!__ignoreDeprecation) {\n console.warn('HDNode.toBuffer() is deprecated for removal in 2.x.y, use toBase58 instead')\n }\n\n // Version\n var version = isPrivate ? this.network.bip32.private : this.network.bip32.public\n var buffer = new Buffer(HDNode.LENGTH)\n\n // 4 bytes: version bytes\n buffer.writeUInt32BE(version, 0)\n\n // Depth\n // 1 byte: depth: 0x00 for master nodes, 0x01 for level-1 descendants, ....\n buffer.writeUInt8(this.depth, 4)\n\n // 4 bytes: the fingerprint of the parent's key (0x00000000 if master key)\n buffer.writeUInt32BE(this.parentFingerprint, 5)\n\n // 4 bytes: child number. This is the number i in xi = xpar/i, with xi the key being serialized.\n // This is encoded in Big endian. (0x00000000 if master key)\n buffer.writeUInt32BE(this.index, 9)\n\n // 32 bytes: the chain code\n this.chainCode.copy(buffer, 13)\n\n // 33 bytes: the public key or private key data\n if (isPrivate) {\n // FIXME: remove in 2.x.y\n assert(this.privKey, 'Missing private key')\n\n // 0x00 + k for private keys\n buffer.writeUInt8(0, 45)\n this.privKey.d.toBuffer(32).copy(buffer, 46)\n } else {\n // X9.62 encoding for public keys\n this.pubKey.toBuffer().copy(buffer, 45)\n }\n\n return buffer\n}\n\n// FIXME: remove in 2.x.y\nHDNode.prototype.toHex = function (isPrivate) {\n return this.toBuffer(isPrivate).toString('hex')\n}\n\n// https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#child-key-derivation-ckd-functions\nHDNode.prototype.derive = function (index) {\n var isHardened = index >= HDNode.HIGHEST_BIT\n var indexBuffer = new Buffer(4)\n indexBuffer.writeUInt32BE(index, 0)\n\n var data\n\n // Hardened child\n if (isHardened) {\n assert(this.privKey, 'Could not derive hardened child key')\n\n // data = 0x00 || ser256(kpar) || ser32(index)\n data = Buffer.concat([\n this.privKey.d.toBuffer(33),\n indexBuffer\n ])\n\n // Normal child\n } else {\n // data = serP(point(kpar)) || ser32(index)\n // = serP(Kpar) || ser32(index)\n data = Buffer.concat([\n this.pubKey.toBuffer(),\n indexBuffer\n ])\n }\n\n var I = crypto.createHmac('sha512', this.chainCode).update(data).digest()\n var IL = I.slice(0, 32)\n var IR = I.slice(32)\n\n var pIL = BigInteger.fromBuffer(IL)\n\n // In case parse256(IL) >= n, proceed with the next value for i\n if (pIL.compareTo(curve.n) >= 0) {\n return this.derive(index + 1)\n }\n\n // Private parent key -> private child key\n var hd\n if (this.privKey) {\n // ki = parse256(IL) + kpar (mod n)\n var ki = pIL.add(this.privKey.d).mod(curve.n)\n\n // In case ki == 0, proceed with the next value for i\n if (ki.signum() === 0) {\n return this.derive(index + 1)\n }\n\n hd = new HDNode(ki, IR, this.network)\n\n // Public parent key -> public child key\n } else {\n // Ki = point(parse256(IL)) + Kpar\n // = G*IL + Kpar\n var Ki = curve.G.multiply(pIL).add(this.pubKey.Q)\n\n // In case Ki is the point at infinity, proceed with the next value for i\n if (curve.isInfinity(Ki)) {\n return this.derive(index + 1)\n }\n\n hd = new HDNode(Ki, IR, this.network)\n }\n\n hd.depth = this.depth + 1\n hd.index = index\n hd.parentFingerprint = this.getFingerprint().readUInt32BE(0)\n\n return hd\n}\n\nHDNode.prototype.deriveHardened = function (index) {\n // Only derives hardened private keys by default\n return this.derive(index + HDNode.HIGHEST_BIT)\n}\n\nHDNode.prototype.toString = HDNode.prototype.toBase58\n\nmodule.exports = HDNode\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./crypto\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/crypto.js\",\"./eckey\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/eckey.js\",\"./ecpubkey\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecpubkey.js\",\"./networks\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/networks.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"bigi\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/index.js\",\"bs58check\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bs58check/src/bs58check.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"crypto\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/index.js\",\"ecurve\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/index.js\",\"typeforce\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/typeforce/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/index.js\":[function(require,module,exports){\nmodule.exports = {\n Address: require('./address'),\n base58check: require('./base58check'),\n Block: require('./block'),\n bufferutils: require('./bufferutils'),\n crypto: require('./crypto'),\n ecdsa: require('./ecdsa'),\n ECKey: require('./eckey'),\n ECPubKey: require('./ecpubkey'),\n ECSignature: require('./ecsignature'),\n Message: require('./message'),\n opcodes: require('./opcodes'),\n HDNode: require('./hdnode'),\n Script: require('./script'),\n scripts: require('./scripts'),\n Transaction: require('./transaction'),\n TransactionBuilder: require('./transaction_builder'),\n networks: require('./networks'),\n Wallet: require('./wallet')\n}\n\n},{\"./address\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/address.js\",\"./base58check\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/base58check.js\",\"./block\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/block.js\",\"./bufferutils\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/bufferutils.js\",\"./crypto\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/crypto.js\",\"./ecdsa\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecdsa.js\",\"./eckey\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/eckey.js\",\"./ecpubkey\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecpubkey.js\",\"./ecsignature\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecsignature.js\",\"./hdnode\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/hdnode.js\",\"./message\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/message.js\",\"./networks\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/networks.js\",\"./opcodes\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/opcodes.js\",\"./script\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/script.js\",\"./scripts\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/scripts.js\",\"./transaction\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/transaction.js\",\"./transaction_builder\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/transaction_builder.js\",\"./wallet\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/wallet.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/message.js\":[function(require,module,exports){\n(function (Buffer){\nvar bufferutils = require('./bufferutils')\nvar crypto = require('./crypto')\nvar ecdsa = require('./ecdsa')\nvar networks = require('./networks')\n\nvar BigInteger = require('bigi')\nvar ECPubKey = require('./ecpubkey')\nvar ECSignature = require('./ecsignature')\n\nvar ecurve = require('ecurve')\nvar ecparams = ecurve.getCurveByName('secp256k1')\n\nfunction magicHash (message, network) {\n var magicPrefix = new Buffer(network.magicPrefix)\n var messageBuffer = new Buffer(message)\n var lengthBuffer = bufferutils.varIntBuffer(messageBuffer.length)\n\n var buffer = Buffer.concat([magicPrefix, lengthBuffer, messageBuffer])\n return crypto.hash256(buffer)\n}\n\nfunction sign (privKey, message, network) {\n network = network || networks.bitcoin\n\n var hash = magicHash(message, network)\n var signature = privKey.sign(hash)\n var e = BigInteger.fromBuffer(hash)\n var i = ecdsa.calcPubKeyRecoveryParam(ecparams, e, signature, privKey.pub.Q)\n\n return signature.toCompact(i, privKey.pub.compressed)\n}\n\n// TODO: network could be implied from address\nfunction verify (address, signature, message, network) {\n if (!Buffer.isBuffer(signature)) {\n signature = new Buffer(signature, 'base64')\n }\n\n network = network || networks.bitcoin\n\n var hash = magicHash(message, network)\n var parsed = ECSignature.parseCompact(signature)\n var e = BigInteger.fromBuffer(hash)\n var Q = ecdsa.recoverPubKey(ecparams, e, parsed.signature, parsed.i)\n\n var pubKey = new ECPubKey(Q, parsed.compressed)\n return pubKey.getAddress(network).toString() === address.toString()\n}\n\nmodule.exports = {\n magicHash: magicHash,\n sign: sign,\n verify: verify\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./bufferutils\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/bufferutils.js\",\"./crypto\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/crypto.js\",\"./ecdsa\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecdsa.js\",\"./ecpubkey\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecpubkey.js\",\"./ecsignature\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecsignature.js\",\"./networks\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/networks.js\",\"bigi\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bigi/lib/index.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"ecurve\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/networks.js\":[function(require,module,exports){\n// https://en.bitcoin.it/wiki/List_of_address_prefixes\n// Dogecoin BIP32 is a proposed standard: https://bitcointalk.org/index.php?topic=409731\n\nvar networks = {\n bitcoin: {\n magicPrefix: '\\x18Bitcoin Signed Message:\\n',\n bip32: {\n public: 0x0488b21e,\n private: 0x0488ade4\n },\n pubKeyHash: 0x00,\n scriptHash: 0x05,\n wif: 0x80,\n dustThreshold: 546, // https://github.com/bitcoin/bitcoin/blob/v0.9.2/src/core.h#L151-L162\n feePerKb: 10000, // https://github.com/bitcoin/bitcoin/blob/v0.9.2/src/main.cpp#L53\n estimateFee: estimateFee('bitcoin')\n },\n testnet: {\n magicPrefix: '\\x18Bitcoin Signed Message:\\n',\n bip32: {\n public: 0x043587cf,\n private: 0x04358394\n },\n pubKeyHash: 0x6f,\n scriptHash: 0xc4,\n wif: 0xef,\n dustThreshold: 546,\n feePerKb: 10000,\n estimateFee: estimateFee('testnet')\n },\n litecoin: {\n magicPrefix: '\\x19Litecoin Signed Message:\\n',\n bip32: {\n public: 0x019da462,\n private: 0x019d9cfe\n },\n pubKeyHash: 0x30,\n scriptHash: 0x05,\n wif: 0xb0,\n dustThreshold: 0, // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.cpp#L360-L365\n dustSoftThreshold: 100000, // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.h#L53\n feePerKb: 100000, // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.cpp#L56\n estimateFee: estimateFee('litecoin')\n },\n dogecoin: {\n magicPrefix: '\\x19Dogecoin Signed Message:\\n',\n bip32: {\n public: 0x02facafd,\n private: 0x02fac398\n },\n pubKeyHash: 0x1e,\n scriptHash: 0x16,\n wif: 0x9e,\n dustThreshold: 0, // https://github.com/dogecoin/dogecoin/blob/v1.7.1/src/core.h#L155-L160\n dustSoftThreshold: 100000000, // https://github.com/dogecoin/dogecoin/blob/v1.7.1/src/main.h#L62\n feePerKb: 100000000, // https://github.com/dogecoin/dogecoin/blob/v1.7.1/src/main.cpp#L58\n estimateFee: estimateFee('dogecoin')\n },\n viacoin: {\n magicPrefix: '\\x18Viacoin Signed Message:\\n',\n bip32: {\n public: 0x0488b21e,\n private: 0x0488ade4\n },\n pubKeyHash: 0x47,\n scriptHash: 0x21,\n wif: 0xc7,\n dustThreshold: 560,\n dustSoftThreshold: 100000,\n feePerKb: 100000, //\n estimateFee: estimateFee('viacoin')\n },\n viacointestnet: {\n magicPrefix: '\\x18Viacoin Signed Message:\\n',\n bip32: {\n public: 0x043587cf,\n private: 0x04358394\n },\n pubKeyHash: 0x7f,\n scriptHash: 0xc4,\n wif: 0xff,\n dustThreshold: 560,\n dustSoftThreshold: 100000,\n feePerKb: 100000,\n estimateFee: estimateFee('viacointestnet')\n },\n gamerscoin: {\n magicPrefix: '\\x19Gamerscoin Signed Message:\\n',\n bip32: {\n public: 0x019da462,\n private: 0x019d9cfe\n },\n pubKeyHash: 0x26,\n scriptHash: 0x05,\n wif: 0xA6,\n dustThreshold: 0, // https://github.com/gamers-coin/gamers-coinv3/blob/master/src/main.cpp#L358-L363\n dustSoftThreshold: 100000, // https://github.com/gamers-coin/gamers-coinv3/blob/master/src/main.cpp#L51\n feePerKb: 100000, // https://github.com/gamers-coin/gamers-coinv3/blob/master/src/main.cpp#L54\n estimateFee: estimateFee('gamerscoin')\n },\n jumbucks: {\n magicPrefix: '\\x19Jumbucks Signed Message:\\n',\n bip32: {\n public: 0x037a689a,\n private: 0x037a6460\n },\n pubKeyHash: 0x2b,\n scriptHash: 0x05,\n wif: 0xab,\n dustThreshold: 0,\n dustSoftThreshold: 10000,\n feePerKb: 10000,\n estimateFee: estimateFee('jumbucks')\n },\n zetacoin: {\n magicPrefix: '\\x18Zetacoin Signed Message:\\n',\n bip32: {\n public: 0x0488b21e,\n private: 0x0488ade4\n },\n pubKeyHash: 0x50,\n scriptHash: 0x09,\n wif: 0xe0,\n dustThreshold: 546, // https://github.com/zetacoin/zetacoin/blob/master/src/core.h#L159\n feePerKb: 10000, // https://github.com/zetacoin/zetacoin/blob/master/src/main.cpp#L54\n estimateFee: estimateFee('zetacoin')\n }\n}\n\nfunction estimateFee (type) {\n return function (tx) {\n var network = networks[type]\n var baseFee = network.feePerKb\n var byteSize = tx.toBuffer().length\n\n var fee = baseFee * Math.ceil(byteSize / 1000)\n if (network.dustSoftThreshold === undefined) return fee\n\n tx.outs.forEach(function (e) {\n if (e.value < network.dustSoftThreshold) {\n fee += baseFee\n }\n })\n\n return fee\n }\n}\n\nmodule.exports = networks\n\n},{}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/opcodes.js\":[function(require,module,exports){\nmodule.exports = {\n // push value\n OP_FALSE: 0,\n OP_0: 0,\n OP_PUSHDATA1: 76,\n OP_PUSHDATA2: 77,\n OP_PUSHDATA4: 78,\n OP_1NEGATE: 79,\n OP_RESERVED: 80,\n OP_1: 81,\n OP_TRUE: 81,\n OP_2: 82,\n OP_3: 83,\n OP_4: 84,\n OP_5: 85,\n OP_6: 86,\n OP_7: 87,\n OP_8: 88,\n OP_9: 89,\n OP_10: 90,\n OP_11: 91,\n OP_12: 92,\n OP_13: 93,\n OP_14: 94,\n OP_15: 95,\n OP_16: 96,\n\n // control\n OP_NOP: 97,\n OP_VER: 98,\n OP_IF: 99,\n OP_NOTIF: 100,\n OP_VERIF: 101,\n OP_VERNOTIF: 102,\n OP_ELSE: 103,\n OP_ENDIF: 104,\n OP_VERIFY: 105,\n OP_RETURN: 106,\n\n // stack ops\n OP_TOALTSTACK: 107,\n OP_FROMALTSTACK: 108,\n OP_2DROP: 109,\n OP_2DUP: 110,\n OP_3DUP: 111,\n OP_2OVER: 112,\n OP_2ROT: 113,\n OP_2SWAP: 114,\n OP_IFDUP: 115,\n OP_DEPTH: 116,\n OP_DROP: 117,\n OP_DUP: 118,\n OP_NIP: 119,\n OP_OVER: 120,\n OP_PICK: 121,\n OP_ROLL: 122,\n OP_ROT: 123,\n OP_SWAP: 124,\n OP_TUCK: 125,\n\n // splice ops\n OP_CAT: 126,\n OP_SUBSTR: 127,\n OP_LEFT: 128,\n OP_RIGHT: 129,\n OP_SIZE: 130,\n\n // bit logic\n OP_INVERT: 131,\n OP_AND: 132,\n OP_OR: 133,\n OP_XOR: 134,\n OP_EQUAL: 135,\n OP_EQUALVERIFY: 136,\n OP_RESERVED1: 137,\n OP_RESERVED2: 138,\n\n // numeric\n OP_1ADD: 139,\n OP_1SUB: 140,\n OP_2MUL: 141,\n OP_2DIV: 142,\n OP_NEGATE: 143,\n OP_ABS: 144,\n OP_NOT: 145,\n OP_0NOTEQUAL: 146,\n\n OP_ADD: 147,\n OP_SUB: 148,\n OP_MUL: 149,\n OP_DIV: 150,\n OP_MOD: 151,\n OP_LSHIFT: 152,\n OP_RSHIFT: 153,\n\n OP_BOOLAND: 154,\n OP_BOOLOR: 155,\n OP_NUMEQUAL: 156,\n OP_NUMEQUALVERIFY: 157,\n OP_NUMNOTEQUAL: 158,\n OP_LESSTHAN: 159,\n OP_GREATERTHAN: 160,\n OP_LESSTHANOREQUAL: 161,\n OP_GREATERTHANOREQUAL: 162,\n OP_MIN: 163,\n OP_MAX: 164,\n\n OP_WITHIN: 165,\n\n // crypto\n OP_RIPEMD160: 166,\n OP_SHA1: 167,\n OP_SHA256: 168,\n OP_HASH160: 169,\n OP_HASH256: 170,\n OP_CODESEPARATOR: 171,\n OP_CHECKSIG: 172,\n OP_CHECKSIGVERIFY: 173,\n OP_CHECKMULTISIG: 174,\n OP_CHECKMULTISIGVERIFY: 175,\n\n // expansion\n OP_NOP1: 176,\n OP_NOP2: 177,\n OP_NOP3: 178,\n OP_NOP4: 179,\n OP_NOP5: 180,\n OP_NOP6: 181,\n OP_NOP7: 182,\n OP_NOP8: 183,\n OP_NOP9: 184,\n OP_NOP10: 185,\n\n // template matching params\n OP_PUBKEYHASH: 253,\n OP_PUBKEY: 254,\n OP_INVALIDOPCODE: 255\n}\n\n},{}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/script.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar bufferutils = require('./bufferutils')\nvar crypto = require('./crypto')\nvar typeForce = require('typeforce')\nvar opcodes = require('./opcodes')\n\nfunction Script (buffer, chunks) {\n typeForce('Buffer', buffer)\n typeForce('Array', chunks)\n\n this.buffer = buffer\n this.chunks = chunks\n}\n\nScript.fromASM = function (asm) {\n var strChunks = asm.split(' ')\n var chunks = strChunks.map(function (strChunk) {\n // opcode\n if (strChunk in opcodes) {\n return opcodes[strChunk]\n\n // data chunk\n } else {\n return new Buffer(strChunk, 'hex')\n }\n })\n\n return Script.fromChunks(chunks)\n}\n\nScript.fromBuffer = function (buffer) {\n var chunks = []\n var i = 0\n\n while (i < buffer.length) {\n var opcode = buffer.readUInt8(i)\n\n // data chunk\n if ((opcode > opcodes.OP_0) && (opcode <= opcodes.OP_PUSHDATA4)) {\n var d = bufferutils.readPushDataInt(buffer, i)\n\n // did reading a pushDataInt fail? return non-chunked script\n if (d === null) return new Script(buffer, [])\n i += d.size\n\n // attempt to read too much data?\n if (i + d.number > buffer.length) return new Script(buffer, [])\n\n var data = buffer.slice(i, i + d.number)\n i += d.number\n\n chunks.push(data)\n\n // opcode\n } else {\n chunks.push(opcode)\n\n i += 1\n }\n }\n\n return new Script(buffer, chunks)\n}\n\nScript.fromChunks = function (chunks) {\n typeForce('Array', chunks)\n\n var bufferSize = chunks.reduce(function (accum, chunk) {\n // data chunk\n if (Buffer.isBuffer(chunk)) {\n return accum + bufferutils.pushDataSize(chunk.length) + chunk.length\n }\n\n // opcode\n return accum + 1\n }, 0.0)\n\n var buffer = new Buffer(bufferSize)\n var offset = 0\n\n chunks.forEach(function (chunk) {\n // data chunk\n if (Buffer.isBuffer(chunk)) {\n offset += bufferutils.writePushDataInt(buffer, chunk.length, offset)\n\n chunk.copy(buffer, offset)\n offset += chunk.length\n\n // opcode\n } else {\n buffer.writeUInt8(chunk, offset)\n offset += 1\n }\n })\n\n assert.equal(offset, buffer.length, 'Could not decode chunks')\n return new Script(buffer, chunks)\n}\n\nScript.fromHex = function (hex) {\n return Script.fromBuffer(new Buffer(hex, 'hex'))\n}\n\nScript.EMPTY = Script.fromChunks([])\n\nScript.prototype.getHash = function () {\n return crypto.hash160(this.buffer)\n}\n\n// FIXME: doesn't work for data chunks, maybe time to use buffertools.compare...\nScript.prototype.without = function (needle) {\n return Script.fromChunks(this.chunks.filter(function (op) {\n return op !== needle\n }))\n}\n\nvar reverseOps = []\nfor (var op in opcodes) {\n var code = opcodes[op]\n reverseOps[code] = op\n}\n\nScript.prototype.toASM = function () {\n return this.chunks.map(function (chunk) {\n // data chunk\n if (Buffer.isBuffer(chunk)) {\n return chunk.toString('hex')\n\n // opcode\n } else {\n return reverseOps[chunk]\n }\n }).join(' ')\n}\n\nScript.prototype.toBuffer = function () {\n return this.buffer\n}\n\nScript.prototype.toHex = function () {\n return this.toBuffer().toString('hex')\n}\n\nmodule.exports = Script\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./bufferutils\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/bufferutils.js\",\"./crypto\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/crypto.js\",\"./opcodes\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/opcodes.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"typeforce\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/typeforce/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/scripts.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar ops = require('./opcodes')\nvar typeForce = require('typeforce')\n\nvar ecurve = require('ecurve')\nvar curve = ecurve.getCurveByName('secp256k1')\n\nvar ECSignature = require('./ecsignature')\nvar Script = require('./script')\n\nfunction isCanonicalPubKey (buffer) {\n if (!Buffer.isBuffer(buffer)) return false\n\n try {\n ecurve.Point.decodeFrom(curve, buffer)\n } catch (e) {\n if (!(e.message.match(/Invalid sequence (length|tag)/)))\n throw e\n\n return false\n }\n\n return true\n}\n\nfunction isCanonicalSignature (buffer) {\n if (!Buffer.isBuffer(buffer)) return false\n\n try {\n ECSignature.parseScriptSignature(buffer)\n } catch (e) {\n if (!(e.message.match(/Not a DER sequence|Invalid sequence length|Expected a DER integer|R length is zero|S length is zero|R value excessively padded|S value excessively padded|R value is negative|S value is negative|Invalid hashType/))) {\n throw e\n }\n\n return false\n }\n\n return true\n}\n\nfunction isPubKeyHashInput (script) {\n return script.chunks.length === 2 &&\n isCanonicalSignature(script.chunks[0]) &&\n isCanonicalPubKey(script.chunks[1])\n}\n\nfunction isPubKeyHashOutput (script) {\n return script.chunks.length === 5 &&\n script.chunks[0] === ops.OP_DUP &&\n script.chunks[1] === ops.OP_HASH160 &&\n Buffer.isBuffer(script.chunks[2]) &&\n script.chunks[2].length === 20 &&\n script.chunks[3] === ops.OP_EQUALVERIFY &&\n script.chunks[4] === ops.OP_CHECKSIG\n}\n\nfunction isPubKeyInput (script) {\n return script.chunks.length === 1 &&\n isCanonicalSignature(script.chunks[0])\n}\n\nfunction isPubKeyOutput (script) {\n return script.chunks.length === 2 &&\n isCanonicalPubKey(script.chunks[0]) &&\n script.chunks[1] === ops.OP_CHECKSIG\n}\n\nfunction isScriptHashInput (script, allowIncomplete) {\n if (script.chunks.length < 2) return false\n\n var lastChunk = script.chunks[script.chunks.length - 1]\n if (!Buffer.isBuffer(lastChunk)) return false\n\n var scriptSig = Script.fromChunks(script.chunks.slice(0, -1))\n var redeemScript = Script.fromBuffer(lastChunk)\n\n // is redeemScript a valid script?\n if (redeemScript.chunks.length === 0) return false\n\n return classifyInput(scriptSig, allowIncomplete) === classifyOutput(redeemScript)\n}\n\nfunction isScriptHashOutput (script) {\n return script.chunks.length === 3 &&\n script.chunks[0] === ops.OP_HASH160 &&\n Buffer.isBuffer(script.chunks[1]) &&\n script.chunks[1].length === 20 &&\n script.chunks[2] === ops.OP_EQUAL\n}\n\n// allowIncomplete is to account for combining signatures\n// See https://github.com/bitcoin/bitcoin/blob/f425050546644a36b0b8e0eb2f6934a3e0f6f80f/src/script/sign.cpp#L195-L197\nfunction isMultisigInput (script, allowIncomplete) {\n if (script.chunks.length < 2) return false\n if (script.chunks[0] !== ops.OP_0) return false\n\n if (allowIncomplete) {\n return script.chunks.slice(1).every(function (chunk) {\n return chunk === ops.OP_0 || isCanonicalSignature(chunk)\n })\n }\n\n return script.chunks.slice(1).every(isCanonicalSignature)\n}\n\nfunction isMultisigOutput (script) {\n if (script.chunks.length < 4) return false\n if (script.chunks[script.chunks.length - 1] !== ops.OP_CHECKMULTISIG) return false\n\n var mOp = script.chunks[0]\n if (mOp === ops.OP_0) return false\n if (mOp < ops.OP_1) return false\n if (mOp > ops.OP_16) return false\n\n var nOp = script.chunks[script.chunks.length - 2]\n if (nOp === ops.OP_0) return false\n if (nOp < ops.OP_1) return false\n if (nOp > ops.OP_16) return false\n\n var m = mOp - (ops.OP_1 - 1)\n var n = nOp - (ops.OP_1 - 1)\n if (n < m) return false\n\n var pubKeys = script.chunks.slice(1, -2)\n if (n < pubKeys.length) return false\n\n return pubKeys.every(isCanonicalPubKey)\n}\n\nfunction isNullDataOutput (script) {\n return script.chunks[0] === ops.OP_RETURN\n}\n\nfunction classifyOutput (script) {\n typeForce('Script', script)\n\n if (isPubKeyHashOutput(script)) {\n return 'pubkeyhash'\n } else if (isScriptHashOutput(script)) {\n return 'scripthash'\n } else if (isMultisigOutput(script)) {\n return 'multisig'\n } else if (isPubKeyOutput(script)) {\n return 'pubkey'\n } else if (isNullDataOutput(script)) {\n return 'nulldata'\n }\n\n return 'nonstandard'\n}\n\nfunction classifyInput (script, allowIncomplete) {\n typeForce('Script', script)\n\n if (isPubKeyHashInput(script)) {\n return 'pubkeyhash'\n } else if (isMultisigInput(script, allowIncomplete)) {\n return 'multisig'\n } else if (isScriptHashInput(script, allowIncomplete)) {\n return 'scripthash'\n } else if (isPubKeyInput(script)) {\n return 'pubkey'\n }\n\n return 'nonstandard'\n}\n\n// Standard Script Templates\n// {pubKey} OP_CHECKSIG\nfunction pubKeyOutput (pubKey) {\n return Script.fromChunks([\n pubKey.toBuffer(),\n ops.OP_CHECKSIG\n ])\n}\n\n// OP_DUP OP_HASH160 {pubKeyHash} OP_EQUALVERIFY OP_CHECKSIG\nfunction pubKeyHashOutput (hash) {\n typeForce('Buffer', hash)\n\n return Script.fromChunks([\n ops.OP_DUP,\n ops.OP_HASH160,\n hash,\n ops.OP_EQUALVERIFY,\n ops.OP_CHECKSIG\n ])\n}\n\n// OP_HASH160 {scriptHash} OP_EQUAL\nfunction scriptHashOutput (hash) {\n typeForce('Buffer', hash)\n\n return Script.fromChunks([\n ops.OP_HASH160,\n hash,\n ops.OP_EQUAL\n ])\n}\n\n// m [pubKeys ...] n OP_CHECKMULTISIG\nfunction multisigOutput (m, pubKeys) {\n typeForce(['ECPubKey'], pubKeys)\n\n assert(pubKeys.length >= m, 'Not enough pubKeys provided')\n\n var pubKeyBuffers = pubKeys.map(function (pubKey) {\n return pubKey.toBuffer()\n })\n var n = pubKeys.length\n\n return Script.fromChunks([].concat(\n (ops.OP_1 - 1) + m,\n pubKeyBuffers,\n (ops.OP_1 - 1) + n,\n ops.OP_CHECKMULTISIG\n ))\n}\n\n// {signature}\nfunction pubKeyInput (signature) {\n typeForce('Buffer', signature)\n\n return Script.fromChunks([signature])\n}\n\n// {signature} {pubKey}\nfunction pubKeyHashInput (signature, pubKey) {\n typeForce('Buffer', signature)\n\n return Script.fromChunks([signature, pubKey.toBuffer()])\n}\n\n// {serialized scriptPubKey script}\nfunction scriptHashInput (scriptSig, scriptPubKey) {\n return Script.fromChunks([].concat(\n scriptSig.chunks,\n scriptPubKey.toBuffer()\n ))\n}\n\n// OP_0 [signatures ...]\nfunction multisigInput (signatures, scriptPubKey) {\n if (scriptPubKey) {\n assert(isMultisigOutput(scriptPubKey))\n\n var mOp = scriptPubKey.chunks[0]\n var nOp = scriptPubKey.chunks[scriptPubKey.chunks.length - 2]\n var m = mOp - (ops.OP_1 - 1)\n var n = nOp - (ops.OP_1 - 1)\n\n assert(signatures.length >= m, 'Not enough signatures provided')\n assert(signatures.length <= n, 'Too many signatures provided')\n }\n\n return Script.fromChunks([].concat(ops.OP_0, signatures))\n}\n\nfunction nullDataOutput (data) {\n return Script.fromChunks([ops.OP_RETURN, data])\n}\n\nmodule.exports = {\n isCanonicalPubKey: isCanonicalPubKey,\n isCanonicalSignature: isCanonicalSignature,\n isPubKeyHashInput: isPubKeyHashInput,\n isPubKeyHashOutput: isPubKeyHashOutput,\n isPubKeyInput: isPubKeyInput,\n isPubKeyOutput: isPubKeyOutput,\n isScriptHashInput: isScriptHashInput,\n isScriptHashOutput: isScriptHashOutput,\n isMultisigInput: isMultisigInput,\n isMultisigOutput: isMultisigOutput,\n isNullDataOutput: isNullDataOutput,\n classifyOutput: classifyOutput,\n classifyInput: classifyInput,\n pubKeyOutput: pubKeyOutput,\n pubKeyHashOutput: pubKeyHashOutput,\n scriptHashOutput: scriptHashOutput,\n multisigOutput: multisigOutput,\n pubKeyInput: pubKeyInput,\n pubKeyHashInput: pubKeyHashInput,\n scriptHashInput: scriptHashInput,\n multisigInput: multisigInput,\n dataOutput: function (data) {\n console.warn('dataOutput is deprecated, use nullDataOutput by 2.0.0')\n return nullDataOutput(data)\n },\n nullDataOutput: nullDataOutput\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./ecsignature\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecsignature.js\",\"./opcodes\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/opcodes.js\",\"./script\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/script.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"ecurve\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/index.js\",\"typeforce\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/typeforce/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/transaction.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar bufferutils = require('./bufferutils')\nvar crypto = require('./crypto')\nvar typeForce = require('typeforce')\nvar opcodes = require('./opcodes')\nvar scripts = require('./scripts')\n\nvar Address = require('./address')\nvar ECSignature = require('./ecsignature')\nvar Script = require('./script')\n\nfunction Transaction () {\n this.version = 1\n this.locktime = 0\n this.ins = []\n this.outs = []\n}\n\nTransaction.DEFAULT_SEQUENCE = 0xffffffff\nTransaction.SIGHASH_ALL = 0x01\nTransaction.SIGHASH_NONE = 0x02\nTransaction.SIGHASH_SINGLE = 0x03\nTransaction.SIGHASH_ANYONECANPAY = 0x80\n\nTransaction.fromBuffer = function (buffer, __disableAssert) {\n var offset = 0\n function readSlice (n) {\n offset += n\n return buffer.slice(offset - n, offset)\n }\n\n function readUInt32 () {\n var i = buffer.readUInt32LE(offset)\n offset += 4\n return i\n }\n\n function readUInt64 () {\n var i = bufferutils.readUInt64LE(buffer, offset)\n offset += 8\n return i\n }\n\n function readVarInt () {\n var vi = bufferutils.readVarInt(buffer, offset)\n offset += vi.size\n return vi.number\n }\n\n function readScript () {\n return Script.fromBuffer(readSlice(readVarInt()))\n }\n\n function readGenerationScript () {\n return new Script(readSlice(readVarInt()), [])\n }\n\n var tx = new Transaction()\n tx.version = readUInt32()\n\n var vinLen = readVarInt()\n for (var i = 0; i < vinLen; ++i) {\n var hash = readSlice(32)\n\n if (Transaction.isCoinbaseHash(hash)) {\n tx.ins.push({\n hash: hash,\n index: readUInt32(),\n script: readGenerationScript(),\n sequence: readUInt32()\n })\n } else {\n tx.ins.push({\n hash: hash,\n index: readUInt32(),\n script: readScript(),\n sequence: readUInt32()\n })\n }\n }\n\n var voutLen = readVarInt()\n for (i = 0; i < voutLen; ++i) {\n tx.outs.push({\n value: readUInt64(),\n script: readScript()\n })\n }\n\n tx.locktime = readUInt32()\n\n if (!__disableAssert) {\n assert.equal(offset, buffer.length, 'Transaction has unexpected data')\n }\n\n return tx\n}\n\nTransaction.fromHex = function (hex) {\n return Transaction.fromBuffer(new Buffer(hex, 'hex'))\n}\n\nTransaction.isCoinbaseHash = function (buffer) {\n return Array.prototype.every.call(buffer, function (x) {\n return x === 0\n })\n}\n\n/**\n * Create a new txIn.\n *\n * Can be called with any of:\n *\n * - A transaction and an index\n * - A transaction hash and an index\n *\n * Note that this method does not sign the created input.\n */\nTransaction.prototype.addInput = function (hash, index, sequence, script) {\n if (sequence === undefined || sequence === null) {\n sequence = Transaction.DEFAULT_SEQUENCE\n }\n\n script = script || Script.EMPTY\n\n if (typeof hash === 'string') {\n // TxId hex is big-endian, we need little-endian\n hash = bufferutils.reverse(new Buffer(hash, 'hex'))\n } else if (hash instanceof Transaction) {\n hash = hash.getHash()\n }\n\n typeForce('Buffer', hash)\n typeForce('Number', index)\n typeForce('Number', sequence)\n typeForce('Script', script)\n\n assert.equal(hash.length, 32, 'Expected hash length of 32, got ' + hash.length)\n\n // Add the input and return the input's index\n return (this.ins.push({\n hash: hash,\n index: index,\n script: script,\n sequence: sequence\n }) - 1)\n}\n\n/**\n * Create a new txOut.\n *\n * Can be called with:\n *\n * - A base58 address string and a value\n * - An Address object and a value\n * - A scriptPubKey Script and a value\n */\nTransaction.prototype.addOutput = function (scriptPubKey, value) {\n // Attempt to get a valid address if it's a base58 address string\n if (typeof scriptPubKey === 'string') {\n scriptPubKey = Address.fromBase58Check(scriptPubKey)\n }\n\n // Attempt to get a valid script if it's an Address object\n if (scriptPubKey instanceof Address) {\n scriptPubKey = scriptPubKey.toOutputScript()\n }\n\n typeForce('Script', scriptPubKey)\n typeForce('Number', value)\n\n // Add the output and return the output's index\n return (this.outs.push({\n script: scriptPubKey,\n value: value\n }) - 1)\n}\n\nTransaction.prototype.clone = function () {\n var newTx = new Transaction()\n newTx.version = this.version\n newTx.locktime = this.locktime\n\n newTx.ins = this.ins.map(function (txIn) {\n return {\n hash: txIn.hash,\n index: txIn.index,\n script: txIn.script,\n sequence: txIn.sequence\n }\n })\n\n newTx.outs = this.outs.map(function (txOut) {\n return {\n script: txOut.script,\n value: txOut.value\n }\n })\n\n return newTx\n}\n\n/**\n * Hash transaction for signing a specific input.\n *\n * Bitcoin uses a different hash for each signed transaction input. This\n * method copies the transaction, makes the necessary changes based on the\n * hashType, serializes and finally hashes the result. This hash can then be\n * used to sign the transaction input in question.\n */\nTransaction.prototype.hashForSignature = function (inIndex, prevOutScript, hashType) {\n // FIXME: remove in 2.x.y\n if (arguments[0] instanceof Script) {\n console.warn('hashForSignature(prevOutScript, inIndex, ...) has been deprecated. Use hashForSignature(inIndex, prevOutScript, ...)')\n\n // swap the arguments (must be stored in tmp, arguments is special)\n var tmp = arguments[0]\n inIndex = arguments[1]\n prevOutScript = tmp\n }\n\n typeForce('Number', inIndex)\n typeForce('Script', prevOutScript)\n typeForce('Number', hashType)\n\n assert(inIndex >= 0, 'Invalid vin index')\n assert(inIndex < this.ins.length, 'Invalid vin index')\n\n var txTmp = this.clone()\n var hashScript = prevOutScript.without(opcodes.OP_CODESEPARATOR)\n\n // Blank out other inputs' signatures\n txTmp.ins.forEach(function (txIn) {\n txIn.script = Script.EMPTY\n })\n txTmp.ins[inIndex].script = hashScript\n\n var hashTypeModifier = hashType & 0x1f\n\n if (hashTypeModifier === Transaction.SIGHASH_NONE) {\n assert(false, 'SIGHASH_NONE not yet supported')\n } else if (hashTypeModifier === Transaction.SIGHASH_SINGLE) {\n assert(false, 'SIGHASH_SINGLE not yet supported')\n }\n\n if (hashType & Transaction.SIGHASH_ANYONECANPAY) {\n assert(false, 'SIGHASH_ANYONECANPAY not yet supported')\n }\n\n var hashTypeBuffer = new Buffer(4)\n hashTypeBuffer.writeInt32LE(hashType, 0)\n\n var buffer = Buffer.concat([txTmp.toBuffer(), hashTypeBuffer])\n return crypto.hash256(buffer)\n}\n\nTransaction.prototype.getHash = function () {\n return crypto.hash256(this.toBuffer())\n}\n\nTransaction.prototype.getId = function () {\n // TxHash is little-endian, we need big-endian\n return bufferutils.reverse(this.getHash()).toString('hex')\n}\n\nTransaction.prototype.toBuffer = function () {\n function scriptSize (script) {\n var length = script.buffer.length\n\n return bufferutils.varIntSize(length) + length\n }\n\n var buffer = new Buffer(\n 8 +\n bufferutils.varIntSize(this.ins.length) +\n bufferutils.varIntSize(this.outs.length) +\n this.ins.reduce(function (sum, input) { return sum + 40 + scriptSize(input.script) }, 0) +\n this.outs.reduce(function (sum, output) { return sum + 8 + scriptSize(output.script) }, 0)\n )\n\n var offset = 0\n function writeSlice (slice) {\n slice.copy(buffer, offset)\n offset += slice.length\n }\n\n function writeUInt32 (i) {\n buffer.writeUInt32LE(i, offset)\n offset += 4\n }\n\n function writeUInt64 (i) {\n bufferutils.writeUInt64LE(buffer, i, offset)\n offset += 8\n }\n\n function writeVarInt (i) {\n var n = bufferutils.writeVarInt(buffer, i, offset)\n offset += n\n }\n\n writeUInt32(this.version)\n writeVarInt(this.ins.length)\n\n this.ins.forEach(function (txIn) {\n writeSlice(txIn.hash)\n writeUInt32(txIn.index)\n writeVarInt(txIn.script.buffer.length)\n writeSlice(txIn.script.buffer)\n writeUInt32(txIn.sequence)\n })\n\n writeVarInt(this.outs.length)\n this.outs.forEach(function (txOut) {\n writeUInt64(txOut.value)\n writeVarInt(txOut.script.buffer.length)\n writeSlice(txOut.script.buffer)\n })\n\n writeUInt32(this.locktime)\n\n return buffer\n}\n\nTransaction.prototype.toHex = function () {\n return this.toBuffer().toString('hex')\n}\n\nTransaction.prototype.setInputScript = function (index, script) {\n typeForce('Number', index)\n typeForce('Script', script)\n\n this.ins[index].script = script\n}\n\n// FIXME: remove in 2.x.y\nTransaction.prototype.sign = function (index, privKey, hashType) {\n console.warn('Transaction.prototype.sign is deprecated. Use TransactionBuilder instead.')\n\n var prevOutScript = privKey.pub.getAddress().toOutputScript()\n var signature = this.signInput(index, prevOutScript, privKey, hashType)\n\n var scriptSig = scripts.pubKeyHashInput(signature, privKey.pub)\n this.setInputScript(index, scriptSig)\n}\n\n// FIXME: remove in 2.x.y\nTransaction.prototype.signInput = function (index, prevOutScript, privKey, hashType) {\n console.warn('Transaction.prototype.signInput is deprecated. Use TransactionBuilder instead.')\n\n hashType = hashType || Transaction.SIGHASH_ALL\n\n var hash = this.hashForSignature(index, prevOutScript, hashType)\n var signature = privKey.sign(hash)\n\n return signature.toScriptSignature(hashType)\n}\n\n// FIXME: remove in 2.x.y\nTransaction.prototype.validateInput = function (index, prevOutScript, pubKey, buffer) {\n console.warn('Transaction.prototype.validateInput is deprecated. Use TransactionBuilder instead.')\n\n var parsed = ECSignature.parseScriptSignature(buffer)\n var hash = this.hashForSignature(index, prevOutScript, parsed.hashType)\n\n return pubKey.verify(hash, parsed.signature)\n}\n\nmodule.exports = Transaction\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./address\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/address.js\",\"./bufferutils\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/bufferutils.js\",\"./crypto\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/crypto.js\",\"./ecsignature\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecsignature.js\",\"./opcodes\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/opcodes.js\",\"./script\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/script.js\",\"./scripts\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/scripts.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"typeforce\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/typeforce/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/transaction_builder.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar ops = require('./opcodes')\nvar scripts = require('./scripts')\n\nvar ECPubKey = require('./ecpubkey')\nvar ECSignature = require('./ecsignature')\nvar Script = require('./script')\nvar Transaction = require('./transaction')\n\nfunction extractInput (txIn) {\n var redeemScript\n var scriptSig = txIn.script\n var prevOutScript\n var prevOutType = scripts.classifyInput(scriptSig, true)\n var scriptType\n\n // Re-classify if scriptHash\n if (prevOutType === 'scripthash') {\n redeemScript = Script.fromBuffer(scriptSig.chunks.slice(-1)[0])\n prevOutScript = scripts.scriptHashOutput(redeemScript.getHash())\n\n scriptSig = Script.fromChunks(scriptSig.chunks.slice(0, -1))\n scriptType = scripts.classifyInput(scriptSig, true)\n } else {\n scriptType = prevOutType\n }\n\n // Extract hashType, pubKeys and signatures\n var hashType, parsed, pubKeys, signatures\n\n switch (scriptType) {\n case 'pubkeyhash': {\n parsed = ECSignature.parseScriptSignature(scriptSig.chunks[0])\n hashType = parsed.hashType\n pubKeys = [ECPubKey.fromBuffer(scriptSig.chunks[1])]\n signatures = [parsed.signature]\n prevOutScript = pubKeys[0].getAddress().toOutputScript()\n\n break\n }\n\n case 'pubkey': {\n parsed = ECSignature.parseScriptSignature(scriptSig.chunks[0])\n hashType = parsed.hashType\n signatures = [parsed.signature]\n\n if (redeemScript) {\n pubKeys = [ECPubKey.fromBuffer(redeemScript.chunks[0])]\n }\n\n break\n }\n\n case 'multisig': {\n signatures = scriptSig.chunks.slice(1).map(function (chunk) {\n if (chunk === ops.OP_0) return chunk\n\n var parsed = ECSignature.parseScriptSignature(chunk)\n hashType = parsed.hashType\n\n return parsed.signature\n })\n\n if (redeemScript) {\n pubKeys = redeemScript.chunks.slice(1, -2).map(ECPubKey.fromBuffer)\n }\n\n break\n }\n }\n\n return {\n hashType: hashType,\n prevOutScript: prevOutScript,\n prevOutType: prevOutType,\n pubKeys: pubKeys,\n redeemScript: redeemScript,\n scriptType: scriptType,\n signatures: signatures\n }\n}\n\nfunction TransactionBuilder () {\n this.prevTxMap = {}\n this.prevOutScripts = {}\n this.prevOutTypes = {}\n\n this.inputs = []\n this.tx = new Transaction()\n}\n\nTransactionBuilder.fromTransaction = function (transaction) {\n var txb = new TransactionBuilder()\n\n // Copy other transaction fields\n txb.tx.version = transaction.version\n txb.tx.locktime = transaction.locktime\n\n // Extract/add inputs\n transaction.ins.forEach(function (txIn) {\n txb.addInput(txIn.hash, txIn.index, txIn.sequence)\n })\n\n // Extract/add outputs\n transaction.outs.forEach(function (txOut) {\n txb.addOutput(txOut.script, txOut.value)\n })\n\n // Extract/add signatures\n txb.inputs = transaction.ins.map(function (txIn) {\n // TODO: remove me after testcase added\n assert(!Transaction.isCoinbaseHash(txIn.hash), 'coinbase inputs not supported')\n\n // Ignore empty scripts\n if (txIn.script.buffer.length === 0) return\n\n return extractInput(txIn)\n })\n\n return txb\n}\n\nTransactionBuilder.prototype.addInput = function (prevTx, index, sequence, prevOutScript) {\n var prevOutHash\n\n // txId\n if (typeof prevTx === 'string') {\n prevOutHash = new Buffer(prevTx, 'hex')\n\n // TxId hex is big-endian, we want little-endian hash\n Array.prototype.reverse.call(prevOutHash)\n\n // Transaction\n } else if (prevTx instanceof Transaction) {\n prevOutHash = prevTx.getHash()\n prevOutScript = prevTx.outs[index].script\n\n // txHash\n } else {\n prevOutHash = prevTx\n }\n\n var input = {}\n if (prevOutScript) {\n var prevOutType = scripts.classifyOutput(prevOutScript)\n\n // if we can, extract pubKey information\n switch (prevOutType) {\n case 'multisig': {\n input.pubKeys = prevOutScript.chunks.slice(1, -2).map(ECPubKey.fromBuffer)\n break\n }\n\n case 'pubkey': {\n input.pubKeys = prevOutScript.chunks.slice(0, 1).map(ECPubKey.fromBuffer)\n break\n }\n }\n\n if (prevOutType !== 'scripthash') {\n input.scriptType = prevOutType\n }\n\n input.prevOutScript = prevOutScript\n input.prevOutType = prevOutType\n }\n\n assert(this.inputs.every(function (input2) {\n if (input2.hashType === undefined) return true\n\n return input2.hashType & Transaction.SIGHASH_ANYONECANPAY\n }), 'No, this would invalidate signatures')\n\n var prevOut = prevOutHash.toString('hex') + ':' + index\n assert(!(prevOut in this.prevTxMap), 'Transaction is already an input')\n\n var vin = this.tx.addInput(prevOutHash, index, sequence)\n this.inputs[vin] = input\n this.prevTxMap[prevOut] = vin\n\n return vin\n}\n\nTransactionBuilder.prototype.addOutput = function (scriptPubKey, value) {\n assert(this.inputs.every(function (input) {\n if (input.hashType === undefined) return true\n\n return (input.hashType & 0x1f) === Transaction.SIGHASH_SINGLE\n }), 'No, this would invalidate signatures')\n\n return this.tx.addOutput(scriptPubKey, value)\n}\n\nTransactionBuilder.prototype.build = function () {\n return this.__build(false)\n}\nTransactionBuilder.prototype.buildIncomplete = function () {\n return this.__build(true)\n}\n\nvar canSignTypes = {\n 'pubkeyhash': true,\n 'multisig': true,\n 'pubkey': true\n}\n\nTransactionBuilder.prototype.__build = function (allowIncomplete) {\n if (!allowIncomplete) {\n assert(this.tx.ins.length > 0, 'Transaction has no inputs')\n assert(this.tx.outs.length > 0, 'Transaction has no outputs')\n }\n\n var tx = this.tx.clone()\n\n // Create script signatures from signature meta-data\n this.inputs.forEach(function (input, index) {\n var scriptType = input.scriptType\n var scriptSig\n\n if (!allowIncomplete) {\n assert(!!scriptType, 'Transaction is not complete')\n assert(scriptType in canSignTypes, scriptType + ' not supported')\n assert(input.signatures, 'Transaction is missing signatures')\n }\n\n if (input.signatures) {\n switch (scriptType) {\n case 'pubkeyhash': {\n var pkhSignature = input.signatures[0].toScriptSignature(input.hashType)\n scriptSig = scripts.pubKeyHashInput(pkhSignature, input.pubKeys[0])\n break\n }\n\n case 'multisig': {\n // Array.prototype.map is sparse-compatible\n var msSignatures = input.signatures.map(function (signature) {\n return signature.toScriptSignature(input.hashType)\n })\n\n // fill in blanks with OP_0\n if (allowIncomplete) {\n for (var i = 0; i < msSignatures.length; ++i) {\n if (msSignatures[i]) continue\n\n msSignatures[i] = ops.OP_0\n }\n } else {\n // Array.prototype.filter returns non-sparse array\n msSignatures = msSignatures.filter(function (x) { return x })\n }\n\n var redeemScript = allowIncomplete ? undefined : input.redeemScript\n scriptSig = scripts.multisigInput(msSignatures, redeemScript)\n break\n }\n\n case 'pubkey': {\n var pkSignature = input.signatures[0].toScriptSignature(input.hashType)\n scriptSig = scripts.pubKeyInput(pkSignature)\n break\n }\n }\n }\n\n // did we build a scriptSig?\n if (scriptSig) {\n // wrap as scriptHash if necessary\n if (input.prevOutType === 'scripthash') {\n scriptSig = scripts.scriptHashInput(scriptSig, input.redeemScript)\n }\n\n tx.setInputScript(index, scriptSig)\n }\n })\n\n return tx\n}\n\nTransactionBuilder.prototype.sign = function (index, privKey, redeemScript, hashType) {\n assert(index in this.inputs, 'No input at index: ' + index)\n hashType = hashType || Transaction.SIGHASH_ALL\n\n var input = this.inputs[index]\n var canSign = input.hashType &&\n input.prevOutScript &&\n input.prevOutType &&\n input.pubKeys &&\n input.scriptType &&\n input.signatures\n\n // are we almost ready to sign?\n if (canSign) {\n // if redeemScript was provided, enforce consistency\n if (redeemScript) {\n assert.deepEqual(input.redeemScript, redeemScript, 'Inconsistent redeemScript')\n }\n\n assert.equal(input.hashType, hashType, 'Inconsistent hashType')\n\n // no? prepare\n } else {\n // must be pay-to-scriptHash?\n if (redeemScript) {\n // if we have a prevOutScript, enforce scriptHash equality to the redeemScript\n if (input.prevOutScript) {\n assert.equal(input.prevOutType, 'scripthash', 'PrevOutScript must be P2SH')\n\n var scriptHash = input.prevOutScript.chunks[1]\n assert.deepEqual(scriptHash, redeemScript.getHash(), 'RedeemScript does not match ' + scriptHash.toString('hex'))\n }\n\n var scriptType = scripts.classifyOutput(redeemScript)\n assert(scriptType in canSignTypes, 'RedeemScript not supported (' + scriptType + ')')\n\n var pubKeys = []\n switch (scriptType) {\n case 'multisig': {\n pubKeys = redeemScript.chunks.slice(1, -2).map(ECPubKey.fromBuffer)\n break\n }\n\n case 'pubkeyhash': {\n var pkh1 = redeemScript.chunks[2]\n var pkh2 = privKey.pub.getAddress().hash\n\n assert.deepEqual(pkh1, pkh2, 'privateKey cannot sign for this input')\n pubKeys = [privKey.pub]\n break\n }\n\n case 'pubkey': {\n pubKeys = redeemScript.chunks.slice(0, 1).map(ECPubKey.fromBuffer)\n break\n }\n }\n\n if (!input.prevOutScript) {\n input.prevOutScript = scripts.scriptHashOutput(redeemScript.getHash())\n input.prevOutType = 'scripthash'\n }\n\n input.pubKeys = pubKeys\n input.redeemScript = redeemScript\n input.scriptType = scriptType\n\n // cannot be pay-to-scriptHash\n } else {\n assert.notEqual(input.prevOutType, 'scripthash', 'PrevOutScript is P2SH, missing redeemScript')\n\n // can we otherwise sign this?\n if (input.scriptType) {\n assert(input.pubKeys, input.scriptType + ' not supported')\n\n // we know nothin' Jon Snow, assume pubKeyHash\n } else {\n input.prevOutScript = privKey.pub.getAddress().toOutputScript()\n input.prevOutType = 'pubkeyhash'\n input.pubKeys = [privKey.pub]\n input.scriptType = input.prevOutType\n }\n }\n\n input.hashType = hashType\n input.signatures = input.signatures || []\n }\n\n // enforce in order signing of public keys\n assert(input.pubKeys.some(function (pubKey, i) {\n if (!privKey.pub.Q.equals(pubKey.Q)) return false\n\n assert(!input.signatures[i], 'Signature already exists')\n var signatureScript = input.redeemScript || input.prevOutScript\n var signatureHash = this.tx.hashForSignature(index, signatureScript, hashType)\n var signature = privKey.sign(signatureHash)\n input.signatures[i] = signature\n\n return true\n }, this), 'privateKey cannot sign for this input')\n}\n\nmodule.exports = TransactionBuilder\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./ecpubkey\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecpubkey.js\",\"./ecsignature\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/ecsignature.js\",\"./opcodes\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/opcodes.js\",\"./script\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/script.js\",\"./scripts\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/scripts.js\",\"./transaction\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/transaction.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/wallet.js\":[function(require,module,exports){\n(function (Buffer){\nvar assert = require('assert')\nvar bufferutils = require('./bufferutils')\nvar crypto = require('crypto')\nvar typeForce = require('typeforce')\nvar networks = require('./networks')\n\nvar Address = require('./address')\nvar HDNode = require('./hdnode')\nvar TransactionBuilder = require('./transaction_builder')\nvar Script = require('./script')\n\nfunction Wallet (seed, network) {\n console.warn('Wallet is deprecated and will be removed in 2.0.0, see #296')\n\n seed = seed || crypto.randomBytes(32)\n network = network || networks.bitcoin\n\n // Stored in a closure to make accidental serialization less likely\n var masterKey = HDNode.fromSeedBuffer(seed, network)\n\n // HD first-level child derivation method should be hardened\n // See https://bitcointalk.org/index.php?topic=405179.msg4415254#msg4415254\n var accountZero = masterKey.deriveHardened(0)\n var externalAccount = accountZero.derive(0)\n var internalAccount = accountZero.derive(1)\n\n this.addresses = []\n this.changeAddresses = []\n this.network = network\n this.unspents = []\n\n // FIXME: remove in 2.0.0\n this.unspentMap = {}\n\n // FIXME: remove in 2.0.0\n var me = this\n this.newMasterKey = function (seed) {\n console.warn('newMasterKey is deprecated, please make a new Wallet instance instead')\n\n seed = seed || crypto.randomBytes(32)\n masterKey = HDNode.fromSeedBuffer(seed, network)\n\n accountZero = masterKey.deriveHardened(0)\n externalAccount = accountZero.derive(0)\n internalAccount = accountZero.derive(1)\n\n me.addresses = []\n me.changeAddresses = []\n\n me.unspents = []\n me.unspentMap = {}\n }\n\n this.getMasterKey = function () {\n return masterKey\n }\n this.getAccountZero = function () {\n return accountZero\n }\n this.getExternalAccount = function () {\n return externalAccount\n }\n this.getInternalAccount = function () {\n return internalAccount\n }\n}\n\nWallet.prototype.createTransaction = function (to, value, options) {\n // FIXME: remove in 2.0.0\n if (typeof options !== 'object') {\n if (options !== undefined) {\n console.warn('Non options object parameters are deprecated, use options object instead')\n\n options = {\n fixedFee: arguments[2],\n changeAddress: arguments[3]\n }\n }\n }\n\n options = options || {}\n\n assert(value > this.network.dustThreshold, value + ' must be above dust threshold (' + this.network.dustThreshold + ' Satoshis)')\n\n var changeAddress = options.changeAddress\n var fixedFee = options.fixedFee\n var minConf = options.minConf === undefined ? 0 : options.minConf // FIXME: change minConf:1 by default in 2.0.0\n\n // filter by minConf, then pending and sort by descending value\n var unspents = this.unspents.filter(function (unspent) {\n return unspent.confirmations >= minConf\n }).filter(function (unspent) {\n return !unspent.pending\n }).sort(function (o1, o2) {\n return o2.value - o1.value\n })\n\n var accum = 0\n var addresses = []\n var subTotal = value\n\n var txb = new TransactionBuilder()\n txb.addOutput(to, value)\n\n for (var i = 0; i < unspents.length; ++i) {\n var unspent = unspents[i]\n addresses.push(unspent.address)\n\n txb.addInput(unspent.txHash, unspent.index)\n\n var fee = fixedFee === undefined ? estimatePaddedFee(txb.buildIncomplete(), this.network) : fixedFee\n\n accum += unspent.value\n subTotal = value + fee\n\n if (accum >= subTotal) {\n var change = accum - subTotal\n\n if (change > this.network.dustThreshold) {\n txb.addOutput(changeAddress || this.getChangeAddress(), change)\n }\n\n break\n }\n }\n\n assert(accum >= subTotal, 'Not enough funds (incl. fee): ' + accum + ' < ' + subTotal)\n\n return this.signWith(txb, addresses).build()\n}\n\n// FIXME: remove in 2.0.0\nWallet.prototype.processPendingTx = function (tx) {\n this.__processTx(tx, true)\n}\n\n// FIXME: remove in 2.0.0\nWallet.prototype.processConfirmedTx = function (tx) {\n this.__processTx(tx, false)\n}\n\n// FIXME: remove in 2.0.0\nWallet.prototype.__processTx = function (tx, isPending) {\n console.warn('processTransaction is considered harmful, see issue #260 for more information')\n\n var txId = tx.getId()\n var txHash = tx.getHash()\n\n tx.outs.forEach(function (txOut, i) {\n var address\n\n try {\n address = Address.fromOutputScript(txOut.script, this.network).toString()\n } catch (e) {\n if (!(e.message.match(/has no matching Address/)))\n throw e\n }\n\n var myAddresses = this.addresses.concat(this.changeAddresses)\n if (myAddresses.indexOf(address) > -1) {\n var lookup = txId + ':' + i\n if (lookup in this.unspentMap) return\n\n // its unique, add it\n var unspent = {\n address: address,\n confirmations: 0, // no way to determine this without more information\n index: i,\n txHash: txHash,\n txId: txId,\n value: txOut.value,\n pending: isPending\n }\n\n this.unspentMap[lookup] = unspent\n this.unspents.push(unspent)\n }\n }, this)\n\n tx.ins.forEach(function (txIn) {\n // copy and convert to big-endian hex\n var txInId = bufferutils.reverse(txIn.hash).toString('hex')\n\n var lookup = txInId + ':' + txIn.index\n if (!(lookup in this.unspentMap)) return\n\n var unspent = this.unspentMap[lookup]\n\n if (isPending) {\n unspent.pending = true\n unspent.spent = true\n } else {\n delete this.unspentMap[lookup]\n\n this.unspents = this.unspents.filter(function (unspent2) {\n return unspent !== unspent2\n })\n }\n }, this)\n}\n\nWallet.prototype.generateAddress = function () {\n var k = this.addresses.length\n var address = this.getExternalAccount().derive(k).getAddress()\n\n this.addresses.push(address.toString())\n\n return this.getReceiveAddress()\n}\n\nWallet.prototype.generateChangeAddress = function () {\n var k = this.changeAddresses.length\n var address = this.getInternalAccount().derive(k).getAddress()\n\n this.changeAddresses.push(address.toString())\n\n return this.getChangeAddress()\n}\n\nWallet.prototype.getAddress = function () {\n if (this.addresses.length === 0) {\n this.generateAddress()\n }\n\n return this.addresses[this.addresses.length - 1]\n}\n\nWallet.prototype.getBalance = function (minConf) {\n minConf = minConf || 0\n\n return this.unspents.filter(function (unspent) {\n return unspent.confirmations >= minConf\n\n // FIXME: remove spent filter in 2.0.0\n }).filter(function (unspent) {\n return !unspent.spent\n }).reduce(function (accum, unspent) {\n return accum + unspent.value\n }, 0)\n}\n\nWallet.prototype.getChangeAddress = function () {\n if (this.changeAddresses.length === 0) {\n this.generateChangeAddress()\n }\n\n return this.changeAddresses[this.changeAddresses.length - 1]\n}\n\nWallet.prototype.getInternalPrivateKey = function (index) {\n return this.getInternalAccount().derive(index).privKey\n}\n\nWallet.prototype.getPrivateKey = function (index) {\n return this.getExternalAccount().derive(index).privKey\n}\n\nWallet.prototype.getPrivateKeyForAddress = function (address) {\n var index\n\n if ((index = this.addresses.indexOf(address)) > -1) {\n return this.getPrivateKey(index)\n }\n\n if ((index = this.changeAddresses.indexOf(address)) > -1) {\n return this.getInternalPrivateKey(index)\n }\n\n assert(false, 'Unknown address. Make sure the address is from the keychain and has been generated')\n}\n\nWallet.prototype.getUnspentOutputs = function (minConf) {\n minConf = minConf || 0\n\n return this.unspents.filter(function (unspent) {\n return unspent.confirmations >= minConf\n\n // FIXME: remove spent filter in 2.0.0\n }).filter(function (unspent) {\n return !unspent.spent\n }).map(function (unspent) {\n return {\n address: unspent.address,\n confirmations: unspent.confirmations,\n index: unspent.index,\n txId: unspent.txId,\n value: unspent.value,\n\n // FIXME: remove in 2.0.0\n hash: unspent.txId,\n pending: unspent.pending\n }\n })\n}\n\nWallet.prototype.setUnspentOutputs = function (unspents) {\n this.unspentMap = {}\n this.unspents = unspents.map(function (unspent) {\n // FIXME: remove unspent.hash in 2.0.0\n var txId = unspent.txId || unspent.hash\n var index = unspent.index\n\n // FIXME: remove in 2.0.0\n if (unspent.hash !== undefined) {\n console.warn('unspent.hash is deprecated, use unspent.txId instead')\n }\n\n // FIXME: remove in 2.0.0\n if (index === undefined) {\n console.warn('unspent.outputIndex is deprecated, use unspent.index instead')\n index = unspent.outputIndex\n }\n\n typeForce('String', txId)\n typeForce('Number', index)\n typeForce('Number', unspent.value)\n\n assert.equal(txId.length, 64, 'Expected valid txId, got ' + txId)\n assert.doesNotThrow(function () {\n Address.fromBase58Check(unspent.address)\n }, 'Expected Base58 Address, got ' + unspent.address)\n assert(isFinite(index), 'Expected finite index, got ' + index)\n\n // FIXME: remove branch in 2.0.0\n if (unspent.confirmations !== undefined) {\n typeForce('Number', unspent.confirmations)\n }\n\n var txHash = bufferutils.reverse(new Buffer(txId, 'hex'))\n\n unspent = {\n address: unspent.address,\n confirmations: unspent.confirmations || 0,\n index: index,\n txHash: txHash,\n txId: txId,\n value: unspent.value,\n\n // FIXME: remove in 2.0.0\n pending: unspent.pending || false\n }\n\n // FIXME: remove in 2.0.0\n this.unspentMap[txId + ':' + index] = unspent\n\n return unspent\n }, this)\n}\n\nWallet.prototype.signWith = function (tx, addresses) {\n addresses.forEach(function (address, i) {\n var privKey = this.getPrivateKeyForAddress(address)\n\n tx.sign(i, privKey)\n }, this)\n\n return tx\n}\n\nfunction estimatePaddedFee (tx, network) {\n var tmpTx = tx.clone()\n tmpTx.addOutput(Script.EMPTY, network.dustSoftThreshold || 0)\n\n return network.estimateFee(tmpTx)\n}\n\n// FIXME: 1.0.0 shims, remove in 2.0.0\nWallet.prototype.getReceiveAddress = Wallet.prototype.getAddress\nWallet.prototype.createTx = Wallet.prototype.createTransaction\n\nmodule.exports = Wallet\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./address\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/address.js\",\"./bufferutils\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/bufferutils.js\",\"./hdnode\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/hdnode.js\",\"./networks\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/networks.js\",\"./script\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/script.js\",\"./transaction_builder\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/transaction_builder.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"crypto\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/index.js\",\"typeforce\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/typeforce/index.js\"}],\"/home/itay/dev/pockets/node_modules/bluebird/js/browser/bluebird.js\":[function(require,module,exports){\n(function (process,global){\n/* @preserve\n * The MIT License (MIT)\n * \n * Copyright (c) 2014 Petka Antonov\n * \n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:

\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n * \n */\n/**\n * bluebird build version 2.9.14\n * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, progress, cancel, using, filter, any, each, timers\n*/\n!function(e){if(\"object\"==typeof exports&&\"undefined\"!=typeof module)module.exports=e();else if(\"function\"==typeof define&&define.amd)define([],e);else{var f;\"undefined\"!=typeof window?f=window:\"undefined\"!=typeof global?f=global:\"undefined\"!=typeof self&&(f=self),f.Promise=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_==\"function\"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_==\"function\"&&_dereq_;for(var o=0;o 0;\n};\n\nAsync.prototype._withDomain = function(fn) {\n if (_process !== undefined &&\n _process.domain != null &&\n !fn.domain) {\n fn = _process.domain.bind(fn);\n }\n return fn;\n};\n\nAsync.prototype.throwLater = function(fn, arg) {\n if (arguments.length === 1) {\n arg = fn;\n fn = function () { throw arg; };\n }\n fn = this._withDomain(fn);\n if (typeof setTimeout !== \"undefined\") {\n setTimeout(function() {\n fn(arg);\n }, 0);\n } else try {\n this._schedule(function() {\n fn(arg);\n });\n } catch (e) {\n throw new Error(\"No async scheduler available\\u000a\\u000a See http://goo.gl/m3OTXk\\u000a\");\n }\n};\n\nAsync.prototype.invokeLater = function (fn, receiver, arg) {\n fn = this._withDomain(fn);\n this._lateQueue.push(fn, receiver, arg);\n this._queueTick();\n};\n\nAsync.prototype.invokeFirst = function (fn, receiver, arg) {\n fn = this._withDomain(fn);\n this._normalQueue.unshift(fn, receiver, arg);\n this._queueTick();\n};\n\nAsync.prototype.invoke = function (fn, receiver, arg) {\n fn = this._withDomain(fn);\n this._normalQueue.push(fn, receiver, arg);\n this._queueTick();\n};\n\nAsync.prototype.settlePromises = function(promise) {\n this._normalQueue._pushOne(promise);\n this._queueTick();\n};\n\nAsync.prototype._drainQueue = function(queue) {\n while (queue.length() > 0) {\n var fn = queue.shift();\n if (typeof fn !== \"function\") {\n fn._settlePromises();\n continue;\n }\n var receiver = queue.shift();\n var arg = queue.shift();\n fn.call(receiver, arg);\n }\n};\n\nAsync.prototype._drainQueues = function () {\n this._drainQueue(this._normalQueue);\n this._reset();\n this._drainQueue(this._lateQueue);\n};\n\nAsync.prototype._queueTick = function () {\n if (!this._isTickUsed) {\n this._isTickUsed = true;\n this._schedule(this.drainQueues);\n }\n};\n\nAsync.prototype._reset = function () {\n this._isTickUsed = false;\n};\n\nmodule.exports = new Async();\nmodule.exports.firstLineError = firstLineError;\n\n},{\"./queue.js\":28,\"./schedule.js\":31}],3:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL, tryConvertToPromise) {\nvar rejectThis = function(_, e) {\n this._reject(e);\n};\n\nvar targetRejected = function(e, context) {\n context.promiseRejectionQueued = true;\n context.bindingPromise._then(rejectThis, rejectThis, null, this, e);\n};\n\nvar bindingResolved = function(thisArg, context) {\n this._setBoundTo(thisArg);\n if (this._isPending()) {\n this._resolveCallback(context.target);\n }\n};\n\nvar bindingRejected = function(e, context) {\n if (!context.promiseRejectionQueued) this._reject(e);\n};\n\nPromise.prototype.bind = function (thisArg) {\n var maybePromise = tryConvertToPromise(thisArg);\n var ret = new Promise(INTERNAL);\n ret._propagateFrom(this, 1);\n var target = this._target();\n if (maybePromise instanceof Promise) {\n var context = {\n promiseRejectionQueued: false,\n promise: ret,\n target: target,\n bindingPromise: maybePromise\n };\n target._then(INTERNAL, targetRejected, ret._progress, ret, context);\n maybePromise._then(\n bindingResolved, bindingRejected, ret._progress, ret, context);\n } else {\n ret._setBoundTo(thisArg);\n ret._resolveCallback(target);\n }\n return ret;\n};\n\nPromise.prototype._setBoundTo = function (obj) {\n if (obj !== undefined) {\n this._bitField = this._bitField | 131072;\n this._boundTo = obj;\n } else {\n this._bitField = this._bitField & (~131072);\n }\n};\n\nPromise.prototype._isBound = function () {\n return (this._bitField & 131072) === 131072;\n};\n\nPromise.bind = function (thisArg, value) {\n var maybePromise = tryConvertToPromise(thisArg);\n var ret = new Promise(INTERNAL);\n\n if (maybePromise instanceof Promise) {\n maybePromise._then(function(thisArg) {\n ret._setBoundTo(thisArg);\n ret._resolveCallback(value);\n }, ret._reject, ret._progress, ret, null);\n } else {\n ret._setBoundTo(thisArg);\n ret._resolveCallback(value);\n }\n return ret;\n};\n};\n\n},{}],4:[function(_dereq_,module,exports){\n\"use strict\";\nvar old;\nif (typeof Promise !== \"undefined\") old = Promise;\nfunction noConflict() {\n try { if (Promise === bluebird) Promise = old; }\n catch (e) {}\n return bluebird;\n}\nvar bluebird = _dereq_(\"./promise.js\")();\nbluebird.noConflict = noConflict;\nmodule.exports = bluebird;\n\n},{\"./promise.js\":23}],5:[function(_dereq_,module,exports){\n\"use strict\";\nvar cr = Object.create;\nif (cr) {\n var callerCache = cr(null);\n var getterCache = cr(null);\n callerCache[\" size\"] = getterCache[\" size\"] = 0;\n}\n\nmodule.exports = function(Promise) {\nvar util = _dereq_(\"./util.js\");\nvar canEvaluate = util.canEvaluate;\nvar isIdentifier = util.isIdentifier;\n\nvar getMethodCaller;\nvar getGetter;\nif (!true) {\nvar makeMethodCaller = function (methodName) {\n return new Function(\"ensureMethod\", \" \\n\\\n return function(obj) { \\n\\\n 'use strict' \\n\\\n var len = this.length; \\n\\\n ensureMethod(obj, 'methodName'); \\n\\\n switch(len) { \\n\\\n case 1: return obj.methodName(this[0]); \\n\\\n case 2: return obj.methodName(this[0], this[1]); \\n\\\n case 3: return obj.methodName(this[0], this[1], this[2]); \\n\\\n case 0: return obj.methodName(); \\n\\\n default: \\n\\\n return obj.methodName.apply(obj, this); \\n\\\n } \\n\\\n }; \\n\\\n \".replace(/methodName/g, methodName))(ensureMethod);\n};\n\nvar makeGetter = function (propertyName) {\n return new Function(\"obj\", \" \\n\\\n 'use strict'; \\n\\\n return obj.propertyName; \\n\\\n \".replace(\"propertyName\", propertyName));\n};\n\nvar getCompiled = function(name, compiler, cache) {\n var ret = cache[name];\n if (typeof ret !== \"function\") {\n if (!isIdentifier(name)) {\n return null;\n }\n ret = compiler(name);\n cache[name] = ret;\n cache[\" size\"]++;\n if (cache[\" size\"] > 512) {\n var keys = Object.keys(cache);\n for (var i = 0; i < 256; ++i) delete cache[keys[i]];\n cache[\" size\"] = keys.length - 256;\n }\n }\n return ret;\n};\n\ngetMethodCaller = function(name) {\n return getCompiled(name, makeMethodCaller, callerCache);\n};\n\ngetGetter = function(name) {\n return getCompiled(name, makeGetter, getterCache);\n};\n}\n\nfunction ensureMethod(obj, methodName) {\n var fn;\n if (obj != null) fn = obj[methodName];\n if (typeof fn !== \"function\") {\n var message = \"Object \" + util.classString(obj) + \" has no method '\" +\n util.toString(methodName) + \"'\";\n throw new Promise.TypeError(message);\n }\n return fn;\n}\n\nfunction caller(obj) {\n var methodName = this.pop();\n var fn = ensureMethod(obj, methodName);\n return fn.apply(obj, this);\n}\nPromise.prototype.call = function (methodName) {\n var $_len = arguments.length;var args = new Array($_len - 1); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];}\n if (!true) {\n if (canEvaluate) {\n var maybeCaller = getMethodCaller(methodName);\n if (maybeCaller !== null) {\n return this._then(\n maybeCaller, undefined, undefined, args, undefined);\n }\n }\n }\n args.push(methodName);\n return this._then(caller, undefined, undefined, args, undefined);\n};\n\nfunction namedGetter(obj) {\n return obj[this];\n}\nfunction indexedGetter(obj) {\n var index = +this;\n if (index < 0) index = Math.max(0, index + obj.length);\n return obj[index];\n}\nPromise.prototype.get = function (propertyName) {\n var isIndex = (typeof propertyName === \"number\");\n var getter;\n if (!isIndex) {\n if (canEvaluate) {\n var maybeGetter = getGetter(propertyName);\n getter = maybeGetter !== null ? maybeGetter : namedGetter;\n } else {\n getter = namedGetter;\n }\n } else {\n getter = indexedGetter;\n }\n return this._then(getter, undefined, undefined, propertyName, undefined);\n};\n};\n\n},{\"./util.js\":38}],6:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise) {\nvar errors = _dereq_(\"./errors.js\");\nvar async = _dereq_(\"./async.js\");\nvar CancellationError = errors.CancellationError;\n\nPromise.prototype._cancel = function (reason) {\n if (!this.isCancellable()) return this;\n var parent;\n var promiseToReject = this;\n while ((parent = promiseToReject._cancellationParent) !== undefined &&\n parent.isCancellable()) {\n promiseToReject = parent;\n }\n this._unsetCancellable();\n promiseToReject._target()._rejectCallback(reason, false, true);\n};\n\nPromise.prototype.cancel = function (reason) {\n if (!this.isCancellable()) return this;\n if (reason === undefined) reason = new CancellationError();\n async.invokeLater(this._cancel, this, reason);\n return this;\n};\n\nPromise.prototype.cancellable = function () {\n if (this._cancellable()) return this;\n this._setCancellable();\n this._cancellationParent = undefined;\n return this;\n};\n\nPromise.prototype.uncancellable = function () {\n var ret = this.then();\n ret._unsetCancellable();\n return ret;\n};\n\nPromise.prototype.fork = function (didFulfill, didReject, didProgress) {\n var ret = this._then(didFulfill, didReject, didProgress,\n undefined, undefined);\n\n ret._setCancellable();\n ret._cancellationParent = undefined;\n return ret;\n};\n};\n\n},{\"./async.js\":2,\"./errors.js\":13}],7:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function() {\nvar async = _dereq_(\"./async.js\");\nvar util = _dereq_(\"./util.js\");\nvar bluebirdFramePattern =\n /[\\\\\\/]bluebird[\\\\\\/]js[\\\\\\/](main|debug|zalgo|instrumented)/;\nvar stackFramePattern = null;\nvar formatStack = null;\nvar indentStackFrames = false;\nvar warn;\n\nfunction CapturedTrace(parent) {\n this._parent = parent;\n var length = this._length = 1 + (parent === undefined ? 0 : parent._length);\n captureStackTrace(this, CapturedTrace);\n if (length > 32) this.uncycle();\n}\nutil.inherits(CapturedTrace, Error);\n\nCapturedTrace.prototype.uncycle = function() {\n var length = this._length;\n if (length < 2) return;\n var nodes = [];\n var stackToIndex = {};\n\n for (var i = 0, node = this; node !== undefined; ++i) {\n nodes.push(node);\n node = node._parent;\n }\n length = this._length = i;\n for (var i = length - 1; i >= 0; --i) {\n var stack = nodes[i].stack;\n if (stackToIndex[stack] === undefined) {\n stackToIndex[stack] = i;\n }\n }\n for (var i = 0; i < length; ++i) {\n var currentStack = nodes[i].stack;\n var index = stackToIndex[currentStack];\n if (index !== undefined && index !== i) {\n if (index > 0) {\n nodes[index - 1]._parent = undefined;\n nodes[index - 1]._length = 1;\n }\n nodes[i]._parent = undefined;\n nodes[i]._length = 1;\n var cycleEdgeNode = i > 0 ? nodes[i - 1] : this;\n\n if (index < length - 1) {\n cycleEdgeNode._parent = nodes[index + 1];\n cycleEdgeNode._parent.uncycle();\n cycleEdgeNode._length =\n cycleEdgeNode._parent._length + 1;\n } else {\n cycleEdgeNode._parent = undefined;\n cycleEdgeNode._length = 1;\n }\n var currentChildLength = cycleEdgeNode._length + 1;\n for (var j = i - 2; j >= 0; --j) {\n nodes[j]._length = currentChildLength;\n currentChildLength++;\n }\n return;\n }\n }\n};\n\nCapturedTrace.prototype.parent = function() {\n return this._parent;\n};\n\nCapturedTrace.prototype.hasParent = function() {\n return this._parent !== undefined;\n};\n\nCapturedTrace.prototype.attachExtraTrace = function(error) {\n if (error.__stackCleaned__) return;\n this.uncycle();\n var parsed = CapturedTrace.parseStackAndMessage(error);\n var message = parsed.message;\n var stacks = [parsed.stack];\n\n var trace = this;\n while (trace !== undefined) {\n stacks.push(cleanStack(trace.stack.split(\"\\n\")));\n trace = trace._parent;\n }\n removeCommonRoots(stacks);\n removeDuplicateOrEmptyJumps(stacks);\n error.stack = reconstructStack(message, stacks);\n util.notEnumerableProp(error, \"__stackCleaned__\", true);\n};\n\nfunction reconstructStack(message, stacks) {\n for (var i = 0; i < stacks.length - 1; ++i) {\n stacks[i].push(\"From previous event:\");\n stacks[i] = stacks[i].join(\"\\n\");\n }\n if (i < stacks.length) {\n stacks[i] = stacks[i].join(\"\\n\");\n }\n return message + \"\\n\" + stacks.join(\"\\n\");\n}\n\nfunction removeDuplicateOrEmptyJumps(stacks) {\n for (var i = 0; i < stacks.length; ++i) {\n if (stacks[i].length === 0 ||\n ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) {\n stacks.splice(i, 1);\n i--;\n }\n }\n}\n\nfunction removeCommonRoots(stacks) {\n var current = stacks[0];\n for (var i = 1; i < stacks.length; ++i) {\n var prev = stacks[i];\n var currentLastIndex = current.length - 1;\n var currentLastLine = current[currentLastIndex];\n var commonRootMeetPoint = -1;\n\n for (var j = prev.length - 1; j >= 0; --j) {\n if (prev[j] === currentLastLine) {\n commonRootMeetPoint = j;\n break;\n }\n }\n\n for (var j = commonRootMeetPoint; j >= 0; --j) {\n var line = prev[j];\n if (current[currentLastIndex] === line) {\n current.pop();\n currentLastIndex--;\n } else {\n break;\n }\n }\n current = prev;\n }\n}\n\nfunction cleanStack(stack) {\n var ret = [];\n for (var i = 0; i < stack.length; ++i) {\n var line = stack[i];\n var isTraceLine = stackFramePattern.test(line) ||\n \" (No stack trace)\" === line;\n var isInternalFrame = isTraceLine && shouldIgnore(line);\n if (isTraceLine && !isInternalFrame) {\n if (indentStackFrames && line.charAt(0) !== \" \") {\n line = \" \" + line;\n }\n ret.push(line);\n }\n }\n return ret;\n}\n\nfunction stackFramesAsArray(error) {\n var stack = error.stack.replace(/\\s+$/g, \"\").split(\"\\n\");\n for (var i = 0; i < stack.length; ++i) {\n var line = stack[i];\n if (\" (No stack trace)\" === line || stackFramePattern.test(line)) {\n break;\n }\n }\n if (i > 0) {\n stack = stack.slice(i);\n }\n return stack;\n}\n\nCapturedTrace.parseStackAndMessage = function(error) {\n var stack = error.stack;\n var message = error.toString();\n stack = typeof stack === \"string\" && stack.length > 0\n ? stackFramesAsArray(error) : [\" (No stack trace)\"];\n return {\n message: message,\n stack: cleanStack(stack)\n };\n};\n\nCapturedTrace.formatAndLogError = function(error, title) {\n if (typeof console !== \"undefined\") {\n var message;\n if (typeof error === \"object\" || typeof error === \"function\") {\n var stack = error.stack;\n message = title + formatStack(stack, error);\n } else {\n message = title + String(error);\n }\n if (typeof warn === \"function\") {\n warn(message);\n } else if (typeof console.log === \"function\" ||\n typeof console.log === \"object\") {\n console.log(message);\n }\n }\n};\n\nCapturedTrace.unhandledRejection = function (reason) {\n CapturedTrace.formatAndLogError(reason, \"^--- With additional stack trace: \");\n};\n\nCapturedTrace.isSupported = function () {\n return typeof captureStackTrace === \"function\";\n};\n\nCapturedTrace.fireRejectionEvent =\nfunction(name, localHandler, reason, promise) {\n var localEventFired = false;\n try {\n if (typeof localHandler === \"function\") {\n localEventFired = true;\n if (name === \"rejectionHandled\") {\n localHandler(promise);\n } else {\n localHandler(reason, promise);\n }\n }\n } catch (e) {\n async.throwLater(e);\n }\n\n var globalEventFired = false;\n try {\n globalEventFired = fireGlobalEvent(name, reason, promise);\n } catch (e) {\n globalEventFired = true;\n async.throwLater(e);\n }\n\n var domEventFired = false;\n if (fireDomEvent) {\n try {\n domEventFired = fireDomEvent(name.toLowerCase(), {\n reason: reason,\n promise: promise\n });\n } catch (e) {\n domEventFired = true;\n async.throwLater(e);\n }\n }\n\n if (!globalEventFired && !localEventFired && !domEventFired &&\n name === \"unhandledRejection\") {\n CapturedTrace.formatAndLogError(reason, \"Unhandled rejection \");\n }\n};\n\nfunction formatNonError(obj) {\n var str;\n if (typeof obj === \"function\") {\n str = \"[function \" +\n (obj.name || \"anonymous\") +\n \"]\";\n } else {\n str = obj.toString();\n var ruselessToString = /\\[object [a-zA-Z0-9$_]+\\]/;\n if (ruselessToString.test(str)) {\n try {\n var newStr = JSON.stringify(obj);\n str = newStr;\n }\n catch(e) {\n\n }\n }\n if (str.length === 0) {\n str = \"(empty array)\";\n }\n }\n return (\"(<\" + snip(str) + \">, no stack trace)\");\n}\n\nfunction snip(str) {\n var maxChars = 41;\n if (str.length < maxChars) {\n return str;\n }\n return str.substr(0, maxChars - 3) + \"...\";\n}\n\nvar shouldIgnore = function() { return false; };\nvar parseLineInfoRegex = /[\\/<\\(]([^:\\/]+):(\\d+):(?:\\d+)\\)?\\s*$/;\nfunction parseLineInfo(line) {\n var matches = line.match(parseLineInfoRegex);\n if (matches) {\n return {\n fileName: matches[1],\n line: parseInt(matches[2], 10)\n };\n }\n}\nCapturedTrace.setBounds = function(firstLineError, lastLineError) {\n if (!CapturedTrace.isSupported()) return;\n var firstStackLines = firstLineError.stack.split(\"\\n\");\n var lastStackLines = lastLineError.stack.split(\"\\n\");\n var firstIndex = -1;\n var lastIndex = -1;\n var firstFileName;\n var lastFileName;\n for (var i = 0; i < firstStackLines.length; ++i) {\n var result = parseLineInfo(firstStackLines[i]);\n if (result) {\n firstFileName = result.fileName;\n firstIndex = result.line;\n break;\n }\n }\n for (var i = 0; i < lastStackLines.length; ++i) {\n var result = parseLineInfo(lastStackLines[i]);\n if (result) {\n lastFileName = result.fileName;\n lastIndex = result.line;\n break;\n }\n }\n if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName ||\n firstFileName !== lastFileName || firstIndex >= lastIndex) {\n return;\n }\n\n shouldIgnore = function(line) {\n if (bluebirdFramePattern.test(line)) return true;\n var info = parseLineInfo(line);\n if (info) {\n if (info.fileName === firstFileName &&\n (firstIndex <= info.line && info.line <= lastIndex)) {\n return true;\n }\n }\n return false;\n };\n};\n\nvar captureStackTrace = (function stackDetection() {\n var v8stackFramePattern = /^\\s*at\\s*/;\n var v8stackFormatter = function(stack, error) {\n if (typeof stack === \"string\") return stack;\n\n if (error.name !== undefined &&\n error.message !== undefined) {\n return error.toString();\n }\n return formatNonError(error);\n };\n\n if (typeof Error.stackTraceLimit === \"number\" &&\n typeof Error.captureStackTrace === \"function\") {\n Error.stackTraceLimit = Error.stackTraceLimit + 6;\n stackFramePattern = v8stackFramePattern;\n formatStack = v8stackFormatter;\n var captureStackTrace = Error.captureStackTrace;\n\n shouldIgnore = function(line) {\n return bluebirdFramePattern.test(line);\n };\n return function(receiver, ignoreUntil) {\n Error.stackTraceLimit = Error.stackTraceLimit + 6;\n captureStackTrace(receiver, ignoreUntil);\n Error.stackTraceLimit = Error.stackTraceLimit - 6;\n };\n }\n var err = new Error();\n\n if (typeof err.stack === \"string\" &&\n err.stack.split(\"\\n\")[0].indexOf(\"stackDetection@\") >= 0) {\n stackFramePattern = /@/;\n formatStack = v8stackFormatter;\n indentStackFrames = true;\n return function captureStackTrace(o) {\n o.stack = new Error().stack;\n };\n }\n\n var hasStackAfterThrow;\n try { throw new Error(); }\n catch(e) {\n hasStackAfterThrow = (\"stack\" in e);\n }\n if (!(\"stack\" in err) && hasStackAfterThrow) {\n stackFramePattern = v8stackFramePattern;\n formatStack = v8stackFormatter;\n return function captureStackTrace(o) {\n Error.stackTraceLimit = Error.stackTraceLimit + 6;\n try { throw new Error(); }\n catch(e) { o.stack = e.stack; }\n Error.stackTraceLimit = Error.stackTraceLimit - 6;\n };\n }\n\n formatStack = function(stack, error) {\n if (typeof stack === \"string\") return stack;\n\n if ((typeof error === \"object\" ||\n typeof error === \"function\") &&\n error.name !== undefined &&\n error.message !== undefined) {\n return error.toString();\n }\n return formatNonError(error);\n };\n\n return null;\n\n})([]);\n\nvar fireDomEvent;\nvar fireGlobalEvent = (function() {\n if (util.isNode) {\n return function(name, reason, promise) {\n if (name === \"rejectionHandled\") {\n return process.emit(name, promise);\n } else {\n return process.emit(name, reason, promise);\n }\n };\n } else {\n var customEventWorks = false;\n var anyEventWorks = true;\n try {\n var ev = new self.CustomEvent(\"test\");\n customEventWorks = ev instanceof CustomEvent;\n } catch (e) {}\n if (!customEventWorks) {\n try {\n var event = document.createEvent(\"CustomEvent\");\n event.initCustomEvent(\"testingtheevent\", false, true, {});\n self.dispatchEvent(event);\n } catch (e) {\n anyEventWorks = false;\n }\n }\n if (anyEventWorks) {\n fireDomEvent = function(type, detail) {\n var event;\n if (customEventWorks) {\n event = new self.CustomEvent(type, {\n detail: detail,\n bubbles: false,\n cancelable: true\n });\n } else if (self.dispatchEvent) {\n event = document.createEvent(\"CustomEvent\");\n event.initCustomEvent(type, false, true, detail);\n }\n\n return event ? !self.dispatchEvent(event) : false;\n };\n }\n\n var toWindowMethodNameMap = {};\n toWindowMethodNameMap[\"unhandledRejection\"] = (\"on\" +\n \"unhandledRejection\").toLowerCase();\n toWindowMethodNameMap[\"rejectionHandled\"] = (\"on\" +\n \"rejectionHandled\").toLowerCase();\n\n return function(name, reason, promise) {\n var methodName = toWindowMethodNameMap[name];\n var method = self[methodName];\n if (!method) return false;\n if (name === \"rejectionHandled\") {\n method.call(self, promise);\n } else {\n method.call(self, reason, promise);\n }\n return true;\n };\n }\n})();\n\nif (typeof console !== \"undefined\" && typeof console.warn !== \"undefined\") {\n warn = function (message) {\n console.warn(message);\n };\n if (util.isNode && process.stderr.isTTY) {\n warn = function(message) {\n process.stderr.write(\"\\u001b[31m\" + message + \"\\u001b[39m\\n\");\n };\n } else if (!util.isNode && typeof (new Error().stack) === \"string\") {\n warn = function(message) {\n console.warn(\"%c\" + message, \"color: red\");\n };\n }\n}\n\nreturn CapturedTrace;\n};\n\n},{\"./async.js\":2,\"./util.js\":38}],8:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(NEXT_FILTER) {\nvar util = _dereq_(\"./util.js\");\nvar errors = _dereq_(\"./errors.js\");\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\nvar keys = _dereq_(\"./es5.js\").keys;\nvar TypeError = errors.TypeError;\n\nfunction CatchFilter(instances, callback, promise) {\n this._instances = instances;\n this._callback = callback;\n this._promise = promise;\n}\n\nfunction safePredicate(predicate, e) {\n var safeObject = {};\n var retfilter = tryCatch(predicate).call(safeObject, e);\n\n if (retfilter === errorObj) return retfilter;\n\n var safeKeys = keys(safeObject);\n if (safeKeys.length) {\n errorObj.e = new TypeError(\"Catch filter must inherit from Error or be a simple predicate function\\u000a\\u000a See http://goo.gl/o84o68\\u000a\");\n return errorObj;\n }\n return retfilter;\n}\n\nCatchFilter.prototype.doFilter = function (e) {\n var cb = this._callback;\n var promise = this._promise;\n var boundTo = promise._boundTo;\n for (var i = 0, len = this._instances.length; i < len; ++i) {\n var item = this._instances[i];\n var itemIsErrorType = item === Error ||\n (item != null && item.prototype instanceof Error);\n\n if (itemIsErrorType && e instanceof item) {\n var ret = tryCatch(cb).call(boundTo, e);\n if (ret === errorObj) {\n NEXT_FILTER.e = ret.e;\n return NEXT_FILTER;\n }\n return ret;\n } else if (typeof item === \"function\" && !itemIsErrorType) {\n var shouldHandle = safePredicate(item, e);\n if (shouldHandle === errorObj) {\n e = errorObj.e;\n break;\n } else if (shouldHandle) {\n var ret = tryCatch(cb).call(boundTo, e);\n if (ret === errorObj) {\n NEXT_FILTER.e = ret.e;\n return NEXT_FILTER;\n }\n return ret;\n }\n }\n }\n NEXT_FILTER.e = e;\n return NEXT_FILTER;\n};\n\nreturn CatchFilter;\n};\n\n},{\"./errors.js\":13,\"./es5.js\":14,\"./util.js\":38}],9:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, CapturedTrace, isDebugging) {\nvar contextStack = [];\nfunction Context() {\n this._trace = new CapturedTrace(peekContext());\n}\nContext.prototype._pushContext = function () {\n if (!isDebugging()) return;\n if (this._trace !== undefined) {\n contextStack.push(this._trace);\n }\n};\n\nContext.prototype._popContext = function () {\n if (!isDebugging()) return;\n if (this._trace !== undefined) {\n contextStack.pop();\n }\n};\n\nfunction createContext() {\n if (isDebugging()) return new Context();\n}\n\nfunction peekContext() {\n var lastIndex = contextStack.length - 1;\n if (lastIndex >= 0) {\n return contextStack[lastIndex];\n }\n return undefined;\n}\n\nPromise.prototype._peekContext = peekContext;\nPromise.prototype._pushContext = Context.prototype._pushContext;\nPromise.prototype._popContext = Context.prototype._popContext;\n\nreturn createContext;\n};\n\n},{}],10:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, CapturedTrace) {\nvar async = _dereq_(\"./async.js\");\nvar Warning = _dereq_(\"./errors.js\").Warning;\nvar util = _dereq_(\"./util.js\");\nvar canAttachTrace = util.canAttachTrace;\nvar unhandledRejectionHandled;\nvar possiblyUnhandledRejection;\nvar debugging = false || (util.isNode &&\n (!!process.env[\"BLUEBIRD_DEBUG\"] ||\n process.env[\"NODE_ENV\"] === \"development\"));\n\nPromise.prototype._ensurePossibleRejectionHandled = function () {\n this._setRejectionIsUnhandled();\n async.invokeLater(this._notifyUnhandledRejection, this, undefined);\n};\n\nPromise.prototype._notifyUnhandledRejectionIsHandled = function () {\n CapturedTrace.fireRejectionEvent(\"rejectionHandled\",\n unhandledRejectionHandled, undefined, this);\n};\n\nPromise.prototype._notifyUnhandledRejection = function () {\n if (this._isRejectionUnhandled()) {\n var reason = this._getCarriedStackTrace() || this._settledValue;\n this._setUnhandledRejectionIsNotified();\n CapturedTrace.fireRejectionEvent(\"unhandledRejection\",\n possiblyUnhandledRejection, reason, this);\n }\n};\n\nPromise.prototype._setUnhandledRejectionIsNotified = function () {\n this._bitField = this._bitField | 524288;\n};\n\nPromise.prototype._unsetUnhandledRejectionIsNotified = function () {\n this._bitField = this._bitField & (~524288);\n};\n\nPromise.prototype._isUnhandledRejectionNotified = function () {\n return (this._bitField & 524288) > 0;\n};\n\nPromise.prototype._setRejectionIsUnhandled = function () {\n this._bitField = this._bitField | 2097152;\n};\n\nPromise.prototype._unsetRejectionIsUnhandled = function () {\n this._bitField = this._bitField & (~2097152);\n if (this._isUnhandledRejectionNotified()) {\n this._unsetUnhandledRejectionIsNotified();\n this._notifyUnhandledRejectionIsHandled();\n }\n};\n\nPromise.prototype._isRejectionUnhandled = function () {\n return (this._bitField & 2097152) > 0;\n};\n\nPromise.prototype._setCarriedStackTrace = function (capturedTrace) {\n this._bitField = this._bitField | 1048576;\n this._fulfillmentHandler0 = capturedTrace;\n};\n\nPromise.prototype._isCarryingStackTrace = function () {\n return (this._bitField & 1048576) > 0;\n};\n\nPromise.prototype._getCarriedStackTrace = function () {\n return this._isCarryingStackTrace()\n ? this._fulfillmentHandler0\n : undefined;\n};\n\nPromise.prototype._captureStackTrace = function () {\n if (debugging) {\n this._trace = new CapturedTrace(this._peekContext());\n }\n return this;\n};\n\nPromise.prototype._attachExtraTrace = function (error, ignoreSelf) {\n if (debugging && canAttachTrace(error)) {\n var trace = this._trace;\n if (trace !== undefined) {\n if (ignoreSelf) trace = trace._parent;\n }\n if (trace !== undefined) {\n trace.attachExtraTrace(error);\n } else if (!error.__stackCleaned__) {\n var parsed = CapturedTrace.parseStackAndMessage(error);\n error.stack = parsed.message + \"\\n\" + parsed.stack.join(\"\\n\");\n util.notEnumerableProp(error, \"__stackCleaned__\", true);\n }\n }\n};\n\nPromise.prototype._warn = function(message) {\n var warning = new Warning(message);\n var ctx = this._peekContext();\n if (ctx) {\n ctx.attachExtraTrace(warning);\n } else {\n var parsed = CapturedTrace.parseStackAndMessage(warning);\n warning.stack = parsed.message + \"\\n\" + parsed.stack.join(\"\\n\");\n }\n CapturedTrace.formatAndLogError(warning, \"\");\n};\n\nPromise.onPossiblyUnhandledRejection = function (fn) {\n possiblyUnhandledRejection = typeof fn === \"function\" ? fn : undefined;\n};\n\nPromise.onUnhandledRejectionHandled = function (fn) {\n unhandledRejectionHandled = typeof fn === \"function\" ? fn : undefined;\n};\n\nPromise.longStackTraces = function () {\n if (async.haveItemsQueued() &&\n debugging === false\n ) {\n throw new Error(\"cannot enable long stack traces after promises have been created\\u000a\\u000a See http://goo.gl/DT1qyG\\u000a\");\n }\n debugging = CapturedTrace.isSupported();\n};\n\nPromise.hasLongStackTraces = function () {\n return debugging && CapturedTrace.isSupported();\n};\n\nif (!CapturedTrace.isSupported()) {\n Promise.longStackTraces = function(){};\n debugging = false;\n}\n\nreturn function() {\n return debugging;\n};\n};\n\n},{\"./async.js\":2,\"./errors.js\":13,\"./util.js\":38}],11:[function(_dereq_,module,exports){\n\"use strict\";\nvar util = _dereq_(\"./util.js\");\nvar isPrimitive = util.isPrimitive;\nvar wrapsPrimitiveReceiver = util.wrapsPrimitiveReceiver;\n\nmodule.exports = function(Promise) {\nvar returner = function () {\n return this;\n};\nvar thrower = function () {\n throw this;\n};\n\nvar wrapper = function (value, action) {\n if (action === 1) {\n return function () {\n throw value;\n };\n } else if (action === 2) {\n return function () {\n return value;\n };\n }\n};\n\n\nPromise.prototype[\"return\"] =\nPromise.prototype.thenReturn = function (value) {\n if (wrapsPrimitiveReceiver && isPrimitive(value)) {\n return this._then(\n wrapper(value, 2),\n undefined,\n undefined,\n undefined,\n undefined\n );\n }\n return this._then(returner, undefined, undefined, value, undefined);\n};\n\nPromise.prototype[\"throw\"] =\nPromise.prototype.thenThrow = function (reason) {\n if (wrapsPrimitiveReceiver && isPrimitive(reason)) {\n return this._then(\n wrapper(reason, 1),\n undefined,\n undefined,\n undefined,\n undefined\n );\n }\n return this._then(thrower, undefined, undefined, reason, undefined);\n};\n};\n\n},{\"./util.js\":38}],12:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL) {\nvar PromiseReduce = Promise.reduce;\n\nPromise.prototype.each = function (fn) {\n return PromiseReduce(this, fn, null, INTERNAL);\n};\n\nPromise.each = function (promises, fn) {\n return PromiseReduce(promises, fn, null, INTERNAL);\n};\n};\n\n},{}],13:[function(_dereq_,module,exports){\n\"use strict\";\nvar es5 = _dereq_(\"./es5.js\");\nvar Objectfreeze = es5.freeze;\nvar util = _dereq_(\"./util.js\");\nvar inherits = util.inherits;\nvar notEnumerableProp = util.notEnumerableProp;\n\nfunction subError(nameProperty, defaultMessage) {\n function SubError(message) {\n if (!(this instanceof SubError)) return new SubError(message);\n notEnumerableProp(this, \"message\",\n typeof message === \"string\" ? message : defaultMessage);\n notEnumerableProp(this, \"name\", nameProperty);\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n Error.call(this);\n }\n }\n inherits(SubError, Error);\n return SubError;\n}\n\nvar _TypeError, _RangeError;\nvar Warning = subError(\"Warning\", \"warning\");\nvar CancellationError = subError(\"CancellationError\", \"cancellation error\");\nvar TimeoutError = subError(\"TimeoutError\", \"timeout error\");\nvar AggregateError = subError(\"AggregateError\", \"aggregate error\");\ntry {\n _TypeError = TypeError;\n _RangeError = RangeError;\n} catch(e) {\n _TypeError = subError(\"TypeError\", \"type error\");\n _RangeError = subError(\"RangeError\", \"range error\");\n}\n\nvar methods = (\"join pop push shift unshift slice filter forEach some \" +\n \"every map indexOf lastIndexOf reduce reduceRight sort reverse\").split(\" \");\n\nfor (var i = 0; i < methods.length; ++i) {\n if (typeof Array.prototype[methods[i]] === \"function\") {\n AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];\n }\n}\n\nes5.defineProperty(AggregateError.prototype, \"length\", {\n value: 0,\n configurable: false,\n writable: true,\n enumerable: true\n});\nAggregateError.prototype[\"isOperational\"] = true;\nvar level = 0;\nAggregateError.prototype.toString = function() {\n var indent = Array(level * 4 + 1).join(\" \");\n var ret = \"\\n\" + indent + \"AggregateError of:\" + \"\\n\";\n level++;\n indent = Array(level * 4 + 1).join(\" \");\n for (var i = 0; i < this.length; ++i) {\n var str = this[i] === this ? \"[Circular AggregateError]\" : this[i] + \"\";\n var lines = str.split(\"\\n\");\n for (var j = 0; j < lines.length; ++j) {\n lines[j] = indent + lines[j];\n }\n str = lines.join(\"\\n\");\n ret += str + \"\\n\";\n }\n level--;\n return ret;\n};\n\nfunction OperationalError(message) {\n if (!(this instanceof OperationalError))\n return new OperationalError(message);\n notEnumerableProp(this, \"name\", \"OperationalError\");\n notEnumerableProp(this, \"message\", message);\n this.cause = message;\n this[\"isOperational\"] = true;\n\n if (message instanceof Error) {\n notEnumerableProp(this, \"message\", message.message);\n notEnumerableProp(this, \"stack\", message.stack);\n } else if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n\n}\ninherits(OperationalError, Error);\n\nvar errorTypes = Error[\"__BluebirdErrorTypes__\"];\nif (!errorTypes) {\n errorTypes = Objectfreeze({\n CancellationError: CancellationError,\n TimeoutError: TimeoutError,\n OperationalError: OperationalError,\n RejectionError: OperationalError,\n AggregateError: AggregateError\n });\n notEnumerableProp(Error, \"__BluebirdErrorTypes__\", errorTypes);\n}\n\nmodule.exports = {\n Error: Error,\n TypeError: _TypeError,\n RangeError: _RangeError,\n CancellationError: errorTypes.CancellationError,\n OperationalError: errorTypes.OperationalError,\n TimeoutError: errorTypes.TimeoutError,\n AggregateError: errorTypes.AggregateError,\n Warning: Warning\n};\n\n},{\"./es5.js\":14,\"./util.js\":38}],14:[function(_dereq_,module,exports){\nvar isES5 = (function(){\n \"use strict\";\n return this === undefined;\n})();\n\nif (isES5) {\n module.exports = {\n freeze: Object.freeze,\n defineProperty: Object.defineProperty,\n getDescriptor: Object.getOwnPropertyDescriptor,\n keys: Object.keys,\n names: Object.getOwnPropertyNames,\n getPrototypeOf: Object.getPrototypeOf,\n isArray: Array.isArray,\n isES5: isES5,\n propertyIsWritable: function(obj, prop) {\n var descriptor = Object.getOwnPropertyDescriptor(obj, prop);\n return !!(!descriptor || descriptor.writable || descriptor.set);\n }\n };\n} else {\n var has = {}.hasOwnProperty;\n var str = {}.toString;\n var proto = {}.constructor.prototype;\n\n var ObjectKeys = function (o) {\n var ret = [];\n for (var key in o) {\n if (has.call(o, key)) {\n ret.push(key);\n }\n }\n return ret;\n };\n\n var ObjectGetDescriptor = function(o, key) {\n return {value: o[key]};\n };\n\n var ObjectDefineProperty = function (o, key, desc) {\n o[key] = desc.value;\n return o;\n };\n\n var ObjectFreeze = function (obj) {\n return obj;\n };\n\n var ObjectGetPrototypeOf = function (obj) {\n try {\n return Object(obj).constructor.prototype;\n }\n catch (e) {\n return proto;\n }\n };\n\n var ArrayIsArray = function (obj) {\n try {\n return str.call(obj) === \"[object Array]\";\n }\n catch(e) {\n return false;\n }\n };\n\n module.exports = {\n isArray: ArrayIsArray,\n keys: ObjectKeys,\n names: ObjectKeys,\n defineProperty: ObjectDefineProperty,\n getDescriptor: ObjectGetDescriptor,\n freeze: ObjectFreeze,\n getPrototypeOf: ObjectGetPrototypeOf,\n isES5: isES5,\n propertyIsWritable: function() {\n return true;\n }\n };\n}\n\n},{}],15:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL) {\nvar PromiseMap = Promise.map;\n\nPromise.prototype.filter = function (fn, options) {\n return PromiseMap(this, fn, options, INTERNAL);\n};\n\nPromise.filter = function (promises, fn, options) {\n return PromiseMap(promises, fn, options, INTERNAL);\n};\n};\n\n},{}],16:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, NEXT_FILTER, tryConvertToPromise) {\nvar util = _dereq_(\"./util.js\");\nvar wrapsPrimitiveReceiver = util.wrapsPrimitiveReceiver;\nvar isPrimitive = util.isPrimitive;\nvar thrower = util.thrower;\n\nfunction returnThis() {\n return this;\n}\nfunction throwThis() {\n throw this;\n}\nfunction return$(r) {\n return function() {\n return r;\n };\n}\nfunction throw$(r) {\n return function() {\n throw r;\n };\n}\nfunction promisedFinally(ret, reasonOrValue, isFulfilled) {\n var then;\n if (wrapsPrimitiveReceiver && isPrimitive(reasonOrValue)) {\n then = isFulfilled ? return$(reasonOrValue) : throw$(reasonOrValue);\n } else {\n then = isFulfilled ? returnThis : throwThis;\n }\n return ret._then(then, thrower, undefined, reasonOrValue, undefined);\n}\n\nfunction finallyHandler(reasonOrValue) {\n var promise = this.promise;\n var handler = this.handler;\n\n var ret = promise._isBound()\n ? handler.call(promise._boundTo)\n : handler();\n\n if (ret !== undefined) {\n var maybePromise = tryConvertToPromise(ret, promise);\n if (maybePromise instanceof Promise) {\n maybePromise = maybePromise._target();\n return promisedFinally(maybePromise, reasonOrValue,\n promise.isFulfilled());\n }\n }\n\n if (promise.isRejected()) {\n NEXT_FILTER.e = reasonOrValue;\n return NEXT_FILTER;\n } else {\n return reasonOrValue;\n }\n}\n\nfunction tapHandler(value) {\n var promise = this.promise;\n var handler = this.handler;\n\n var ret = promise._isBound()\n ? handler.call(promise._boundTo, value)\n : handler(value);\n\n if (ret !== undefined) {\n var maybePromise = tryConvertToPromise(ret, promise);\n if (maybePromise instanceof Promise) {\n maybePromise = maybePromise._target();\n return promisedFinally(maybePromise, value, true);\n }\n }\n return value;\n}\n\nPromise.prototype._passThroughHandler = function (handler, isFinally) {\n if (typeof handler !== \"function\") return this.then();\n\n var promiseAndHandler = {\n promise: this,\n handler: handler\n };\n\n return this._then(\n isFinally ? finallyHandler : tapHandler,\n isFinally ? finallyHandler : undefined, undefined,\n promiseAndHandler, undefined);\n};\n\nPromise.prototype.lastly =\nPromise.prototype[\"finally\"] = function (handler) {\n return this._passThroughHandler(handler, true);\n};\n\nPromise.prototype.tap = function (handler) {\n return this._passThroughHandler(handler, false);\n};\n};\n\n},{\"./util.js\":38}],17:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise,\n apiRejection,\n INTERNAL,\n tryConvertToPromise) {\nvar errors = _dereq_(\"./errors.js\");\nvar TypeError = errors.TypeError;\nvar util = _dereq_(\"./util.js\");\nvar errorObj = util.errorObj;\nvar tryCatch = util.tryCatch;\nvar yieldHandlers = [];\n\nfunction promiseFromYieldHandler(value, yieldHandlers, traceParent) {\n for (var i = 0; i < yieldHandlers.length; ++i) {\n traceParent._pushContext();\n var result = tryCatch(yieldHandlers[i])(value);\n traceParent._popContext();\n if (result === errorObj) {\n traceParent._pushContext();\n var ret = Promise.reject(errorObj.e);\n traceParent._popContext();\n return ret;\n }\n var maybePromise = tryConvertToPromise(result, traceParent);\n if (maybePromise instanceof Promise) return maybePromise;\n }\n return null;\n}\n\nfunction PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) {\n var promise = this._promise = new Promise(INTERNAL);\n promise._captureStackTrace();\n this._stack = stack;\n this._generatorFunction = generatorFunction;\n this._receiver = receiver;\n this._generator = undefined;\n this._yieldHandlers = typeof yieldHandler === \"function\"\n ? [yieldHandler].concat(yieldHandlers)\n : yieldHandlers;\n}\n\nPromiseSpawn.prototype.promise = function () {\n return this._promise;\n};\n\nPromiseSpawn.prototype._run = function () {\n this._generator = this._generatorFunction.call(this._receiver);\n this._receiver =\n this._generatorFunction = undefined;\n this._next(undefined);\n};\n\nPromiseSpawn.prototype._continue = function (result) {\n if (result === errorObj) {\n return this._promise._rejectCallback(result.e, false, true);\n }\n\n var value = result.value;\n if (result.done === true) {\n this._promise._resolveCallback(value);\n } else {\n var maybePromise = tryConvertToPromise(value, this._promise);\n if (!(maybePromise instanceof Promise)) {\n maybePromise =\n promiseFromYieldHandler(maybePromise,\n this._yieldHandlers,\n this._promise);\n if (maybePromise === null) {\n this._throw(\n new TypeError(\n \"A value %s was yielded that could not be treated as a promise\\u000a\\u000a See http://goo.gl/4Y4pDk\\u000a\\u000a\".replace(\"%s\", value) +\n \"From coroutine:\\u000a\" +\n this._stack.split(\"\\n\").slice(1, -7).join(\"\\n\")\n )\n );\n return;\n }\n }\n maybePromise._then(\n this._next,\n this._throw,\n undefined,\n this,\n null\n );\n }\n};\n\nPromiseSpawn.prototype._throw = function (reason) {\n this._promise._attachExtraTrace(reason);\n this._promise._pushContext();\n var result = tryCatch(this._generator[\"throw\"])\n .call(this._generator, reason);\n this._promise._popContext();\n this._continue(result);\n};\n\nPromiseSpawn.prototype._next = function (value) {\n this._promise._pushContext();\n var result = tryCatch(this._generator.next).call(this._generator, value);\n this._promise._popContext();\n this._continue(result);\n};\n\nPromise.coroutine = function (generatorFunction, options) {\n if (typeof generatorFunction !== \"function\") {\n throw new TypeError(\"generatorFunction must be a function\\u000a\\u000a See http://goo.gl/6Vqhm0\\u000a\");\n }\n var yieldHandler = Object(options).yieldHandler;\n var PromiseSpawn$ = PromiseSpawn;\n var stack = new Error().stack;\n return function () {\n var generator = generatorFunction.apply(this, arguments);\n var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler,\n stack);\n spawn._generator = generator;\n spawn._next(undefined);\n return spawn.promise();\n };\n};\n\nPromise.coroutine.addYieldHandler = function(fn) {\n if (typeof fn !== \"function\") throw new TypeError(\"fn must be a function\\u000a\\u000a See http://goo.gl/916lJJ\\u000a\");\n yieldHandlers.push(fn);\n};\n\nPromise.spawn = function (generatorFunction) {\n if (typeof generatorFunction !== \"function\") {\n return apiRejection(\"generatorFunction must be a function\\u000a\\u000a See http://goo.gl/6Vqhm0\\u000a\");\n }\n var spawn = new PromiseSpawn(generatorFunction, this);\n var ret = spawn.promise();\n spawn._run(Promise.spawn);\n return ret;\n};\n};\n\n},{\"./errors.js\":13,\"./util.js\":38}],18:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports =\nfunction(Promise, PromiseArray, tryConvertToPromise, INTERNAL) {\nvar util = _dereq_(\"./util.js\");\nvar canEvaluate = util.canEvaluate;\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\nvar reject;\n\nif (!true) {\nif (canEvaluate) {\n var thenCallback = function(i) {\n return new Function(\"value\", \"holder\", \" \\n\\\n 'use strict'; \\n\\\n holder.pIndex = value; \\n\\\n holder.checkFulfillment(this); \\n\\\n \".replace(/Index/g, i));\n };\n\n var caller = function(count) {\n var values = [];\n for (var i = 1; i <= count; ++i) values.push(\"holder.p\" + i);\n return new Function(\"holder\", \" \\n\\\n 'use strict'; \\n\\\n var callback = holder.fn; \\n\\\n return callback(values); \\n\\\n \".replace(/values/g, values.join(\", \")));\n };\n var thenCallbacks = [];\n var callers = [undefined];\n for (var i = 1; i <= 5; ++i) {\n thenCallbacks.push(thenCallback(i));\n callers.push(caller(i));\n }\n\n var Holder = function(total, fn) {\n this.p1 = this.p2 = this.p3 = this.p4 = this.p5 = null;\n this.fn = fn;\n this.total = total;\n this.now = 0;\n };\n\n Holder.prototype.callers = callers;\n Holder.prototype.checkFulfillment = function(promise) {\n var now = this.now;\n now++;\n var total = this.total;\n if (now >= total) {\n var handler = this.callers[total];\n promise._pushContext();\n var ret = tryCatch(handler)(this);\n promise._popContext();\n if (ret === errorObj) {\n promise._rejectCallback(ret.e, false, true);\n } else {\n promise._resolveCallback(ret);\n }\n } else {\n this.now = now;\n }\n };\n\n var reject = function (reason) {\n this._reject(reason);\n };\n}\n}\n\nPromise.join = function () {\n var last = arguments.length - 1;\n var fn;\n if (last > 0 && typeof arguments[last] === \"function\") {\n fn = arguments[last];\n if (!true) {\n if (last < 6 && canEvaluate) {\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n var holder = new Holder(last, fn);\n var callbacks = thenCallbacks;\n for (var i = 0; i < last; ++i) {\n var maybePromise = tryConvertToPromise(arguments[i], ret);\n if (maybePromise instanceof Promise) {\n maybePromise = maybePromise._target();\n if (maybePromise._isPending()) {\n maybePromise._then(callbacks[i], reject,\n undefined, ret, holder);\n } else if (maybePromise._isFulfilled()) {\n callbacks[i].call(ret,\n maybePromise._value(), holder);\n } else {\n ret._reject(maybePromise._reason());\n }\n } else {\n callbacks[i].call(ret, maybePromise, holder);\n }\n }\n return ret;\n }\n }\n }\n var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];}\n if (fn) args.pop();\n var ret = new PromiseArray(args).promise();\n return fn !== undefined ? ret.spread(fn) : ret;\n};\n\n};\n\n},{\"./util.js\":38}],19:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise,\n PromiseArray,\n apiRejection,\n tryConvertToPromise,\n INTERNAL) {\nvar async = _dereq_(\"./async.js\");\nvar util = _dereq_(\"./util.js\");\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\nvar PENDING = {};\nvar EMPTY_ARRAY = [];\n\nfunction MappingPromiseArray(promises, fn, limit, _filter) {\n this.constructor$(promises);\n this._promise._captureStackTrace();\n this._callback = fn;\n this._preservedValues = _filter === INTERNAL\n ? new Array(this.length())\n : null;\n this._limit = limit;\n this._inFlight = 0;\n this._queue = limit >= 1 ? [] : EMPTY_ARRAY;\n async.invoke(init, this, undefined);\n}\nutil.inherits(MappingPromiseArray, PromiseArray);\nfunction init() {this._init$(undefined, -2);}\n\nMappingPromiseArray.prototype._init = function () {};\n\nMappingPromiseArray.prototype._promiseFulfilled = function (value, index) {\n var values = this._values;\n var length = this.length();\n var preservedValues = this._preservedValues;\n var limit = this._limit;\n if (values[index] === PENDING) {\n values[index] = value;\n if (limit >= 1) {\n this._inFlight--;\n this._drainQueue();\n if (this._isResolved()) return;\n }\n } else {\n if (limit >= 1 && this._inFlight >= limit) {\n values[index] = value;\n this._queue.push(index);\n return;\n }\n if (preservedValues !== null) preservedValues[index] = value;\n\n var callback = this._callback;\n var receiver = this._promise._boundTo;\n this._promise._pushContext();\n var ret = tryCatch(callback).call(receiver, value, index, length);\n this._promise._popContext();\n if (ret === errorObj) return this._reject(ret.e);\n\n var maybePromise = tryConvertToPromise(ret, this._promise);\n if (maybePromise instanceof Promise) {\n maybePromise = maybePromise._target();\n if (maybePromise._isPending()) {\n if (limit >= 1) this._inFlight++;\n values[index] = PENDING;\n return maybePromise._proxyPromiseArray(this, index);\n } else if (maybePromise._isFulfilled()) {\n ret = maybePromise._value();\n } else {\n return this._reject(maybePromise._reason());\n }\n }\n values[index] = ret;\n }\n var totalResolved = ++this._totalResolved;\n if (totalResolved >= length) {\n if (preservedValues !== null) {\n this._filter(values, preservedValues);\n } else {\n this._resolve(values);\n }\n\n }\n};\n\nMappingPromiseArray.prototype._drainQueue = function () {\n var queue = this._queue;\n var limit = this._limit;\n var values = this._values;\n while (queue.length > 0 && this._inFlight < limit) {\n if (this._isResolved()) return;\n var index = queue.pop();\n this._promiseFulfilled(values[index], index);\n }\n};\n\nMappingPromiseArray.prototype._filter = function (booleans, values) {\n var len = values.length;\n var ret = new Array(len);\n var j = 0;\n for (var i = 0; i < len; ++i) {\n if (booleans[i]) ret[j++] = values[i];\n }\n ret.length = j;\n this._resolve(ret);\n};\n\nMappingPromiseArray.prototype.preservedValues = function () {\n return this._preservedValues;\n};\n\nfunction map(promises, fn, options, _filter) {\n var limit = typeof options === \"object\" && options !== null\n ? options.concurrency\n : 0;\n limit = typeof limit === \"number\" &&\n isFinite(limit) && limit >= 1 ? limit : 0;\n return new MappingPromiseArray(promises, fn, limit, _filter);\n}\n\nPromise.prototype.map = function (fn, options) {\n if (typeof fn !== \"function\") return apiRejection(\"fn must be a function\\u000a\\u000a See http://goo.gl/916lJJ\\u000a\");\n\n return map(this, fn, options, null).promise();\n};\n\nPromise.map = function (promises, fn, options, _filter) {\n if (typeof fn !== \"function\") return apiRejection(\"fn must be a function\\u000a\\u000a See http://goo.gl/916lJJ\\u000a\");\n return map(promises, fn, options, _filter).promise();\n};\n\n\n};\n\n},{\"./async.js\":2,\"./util.js\":38}],20:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports =\nfunction(Promise, INTERNAL, tryConvertToPromise, apiRejection) {\nvar util = _dereq_(\"./util.js\");\nvar tryCatch = util.tryCatch;\n\nPromise.method = function (fn) {\n if (typeof fn !== \"function\") {\n throw new Promise.TypeError(\"fn must be a function\\u000a\\u000a See http://goo.gl/916lJJ\\u000a\");\n }\n return function () {\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n ret._pushContext();\n var value = tryCatch(fn).apply(this, arguments);\n ret._popContext();\n ret._resolveFromSyncValue(value);\n return ret;\n };\n};\n\nPromise.attempt = Promise[\"try\"] = function (fn, args, ctx) {\n if (typeof fn !== \"function\") {\n return apiRejection(\"fn must be a function\\u000a\\u000a See http://goo.gl/916lJJ\\u000a\");\n }\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n ret._pushContext();\n var value = util.isArray(args)\n ? tryCatch(fn).apply(ctx, args)\n : tryCatch(fn).call(ctx, args);\n ret._popContext();\n ret._resolveFromSyncValue(value);\n return ret;\n};\n\nPromise.prototype._resolveFromSyncValue = function (value) {\n if (value === util.errorObj) {\n this._rejectCallback(value.e, false, true);\n } else {\n this._resolveCallback(value, true);\n }\n};\n};\n\n},{\"./util.js\":38}],21:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise) {\nvar util = _dereq_(\"./util.js\");\nvar async = _dereq_(\"./async.js\");\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\n\nfunction spreadAdapter(val, nodeback) {\n var promise = this;\n if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback);\n var ret = tryCatch(nodeback).apply(promise._boundTo, [null].concat(val));\n if (ret === errorObj) {\n async.throwLater(ret.e);\n }\n}\n\nfunction successAdapter(val, nodeback) {\n var promise = this;\n var receiver = promise._boundTo;\n var ret = val === undefined\n ? tryCatch(nodeback).call(receiver, null)\n : tryCatch(nodeback).call(receiver, null, val);\n if (ret === errorObj) {\n async.throwLater(ret.e);\n }\n}\nfunction errorAdapter(reason, nodeback) {\n var promise = this;\n if (!reason) {\n var target = promise._target();\n var newReason = target._getCarriedStackTrace();\n newReason.cause = reason;\n reason = newReason;\n }\n var ret = tryCatch(nodeback).call(promise._boundTo, reason);\n if (ret === errorObj) {\n async.throwLater(ret.e);\n }\n}\n\nPromise.prototype.nodeify = function (nodeback, options) {\n if (typeof nodeback == \"function\") {\n var adapter = successAdapter;\n if (options !== undefined && Object(options).spread) {\n adapter = spreadAdapter;\n }\n this._then(\n adapter,\n errorAdapter,\n undefined,\n this,\n nodeback\n );\n }\n return this;\n};\n};\n\n},{\"./async.js\":2,\"./util.js\":38}],22:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, PromiseArray) {\nvar util = _dereq_(\"./util.js\");\nvar async = _dereq_(\"./async.js\");\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\n\nPromise.prototype.progressed = function (handler) {\n return this._then(undefined, undefined, handler, undefined, undefined);\n};\n\nPromise.prototype._progress = function (progressValue) {\n if (this._isFollowingOrFulfilledOrRejected()) return;\n this._target()._progressUnchecked(progressValue);\n\n};\n\nPromise.prototype._progressHandlerAt = function (index) {\n return index === 0\n ? this._progressHandler0\n : this[(index << 2) + index - 5 + 2];\n};\n\nPromise.prototype._doProgressWith = function (progression) {\n var progressValue = progression.value;\n var handler = progression.handler;\n var promise = progression.promise;\n var receiver = progression.receiver;\n\n var ret = tryCatch(handler).call(receiver, progressValue);\n if (ret === errorObj) {\n if (ret.e != null &&\n ret.e.name !== \"StopProgressPropagation\") {\n var trace = util.canAttachTrace(ret.e)\n ? ret.e : new Error(util.toString(ret.e));\n promise._attachExtraTrace(trace);\n promise._progress(ret.e);\n }\n } else if (ret instanceof Promise) {\n ret._then(promise._progress, null, null, promise, undefined);\n } else {\n promise._progress(ret);\n }\n};\n\n\nPromise.prototype._progressUnchecked = function (progressValue) {\n var len = this._length();\n var progress = this._progress;\n for (var i = 0; i < len; i++) {\n var handler = this._progressHandlerAt(i);\n var promise = this._promiseAt(i);\n if (!(promise instanceof Promise)) {\n var receiver = this._receiverAt(i);\n if (typeof handler === \"function\") {\n handler.call(receiver, progressValue, promise);\n } else if (receiver instanceof PromiseArray &&\n !receiver._isResolved()) {\n receiver._promiseProgressed(progressValue, promise);\n }\n continue;\n }\n\n if (typeof handler === \"function\") {\n async.invoke(this._doProgressWith, this, {\n handler: handler,\n promise: promise,\n receiver: this._receiverAt(i),\n value: progressValue\n });\n } else {\n async.invoke(progress, promise, progressValue);\n }\n }\n};\n};\n\n},{\"./async.js\":2,\"./util.js\":38}],23:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function() {\nvar makeSelfResolutionError = function () {\n return new TypeError(\"circular promise resolution chain\\u000a\\u000a See http://goo.gl/LhFpo0\\u000a\");\n};\nvar reflect = function() {\n return new Promise.PromiseInspection(this._target());\n};\nvar apiRejection = function(msg) {\n return Promise.reject(new TypeError(msg));\n};\nvar util = _dereq_(\"./util.js\");\nvar async = _dereq_(\"./async.js\");\nvar errors = _dereq_(\"./errors.js\");\nvar TypeError = Promise.TypeError = errors.TypeError;\nPromise.RangeError = errors.RangeError;\nPromise.CancellationError = errors.CancellationError;\nPromise.TimeoutError = errors.TimeoutError;\nPromise.OperationalError = errors.OperationalError;\nPromise.RejectionError = errors.OperationalError;\nPromise.AggregateError = errors.AggregateError;\nvar INTERNAL = function(){};\nvar APPLY = {};\nvar NEXT_FILTER = {e: null};\nvar tryConvertToPromise = _dereq_(\"./thenables.js\")(Promise, INTERNAL);\nvar PromiseArray =\n _dereq_(\"./promise_array.js\")(Promise, INTERNAL,\n tryConvertToPromise, apiRejection);\nvar CapturedTrace = _dereq_(\"./captured_trace.js\")();\nvar isDebugging = _dereq_(\"./debuggability.js\")(Promise, CapturedTrace);\n /*jshint unused:false*/\nvar createContext =\n _dereq_(\"./context.js\")(Promise, CapturedTrace, isDebugging);\nvar CatchFilter = _dereq_(\"./catch_filter.js\")(NEXT_FILTER);\nvar PromiseResolver = _dereq_(\"./promise_resolver.js\");\nvar nodebackForPromise = PromiseResolver._nodebackForPromise;\nvar errorObj = util.errorObj;\nvar tryCatch = util.tryCatch;\nfunction Promise(resolver) {\n if (typeof resolver !== \"function\") {\n throw new TypeError(\"the promise constructor requires a resolver function\\u000a\\u000a See http://goo.gl/EC22Yn\\u000a\");\n }\n if (this.constructor !== Promise) {\n throw new TypeError(\"the promise constructor cannot be invoked directly\\u000a\\u000a See http://goo.gl/KsIlge\\u000a\");\n }\n this._bitField = 0;\n this._fulfillmentHandler0 = undefined;\n this._rejectionHandler0 = undefined;\n this._progressHandler0 = undefined;\n this._promise0 = undefined;\n this._receiver0 = undefined;\n this._settledValue = undefined;\n if (resolver !== INTERNAL) this._resolveFromResolver(resolver);\n}\n\nPromise.prototype.toString = function () {\n return \"[object Promise]\";\n};\n\nPromise.prototype.caught = Promise.prototype[\"catch\"] = function (fn) {\n var len = arguments.length;\n if (len > 1) {\n var catchInstances = new Array(len - 1),\n j = 0, i;\n for (i = 0; i < len - 1; ++i) {\n var item = arguments[i];\n if (typeof item === \"function\") {\n catchInstances[j++] = item;\n } else {\n return Promise.reject(\n new TypeError(\"Catch filter must inherit from Error or be a simple predicate function\\u000a\\u000a See http://goo.gl/o84o68\\u000a\"));\n }\n }\n catchInstances.length = j;\n fn = arguments[i];\n var catchFilter = new CatchFilter(catchInstances, fn, this);\n return this._then(undefined, catchFilter.doFilter, undefined,\n catchFilter, undefined);\n }\n return this._then(undefined, fn, undefined, undefined, undefined);\n};\n\nPromise.prototype.reflect = function () {\n return this._then(reflect, reflect, undefined, this, undefined);\n};\n\nPromise.prototype.then = function (didFulfill, didReject, didProgress) {\n if (isDebugging() && arguments.length > 0 &&\n typeof didFulfill !== \"function\" &&\n typeof didReject !== \"function\") {\n var msg = \".then() only accepts functions but was passed: \" +\n util.classString(didFulfill);\n if (arguments.length > 1) {\n msg += \", \" + util.classString(didReject);\n }\n this._warn(msg);\n }\n return this._then(didFulfill, didReject, didProgress,\n undefined, undefined);\n};\n\nPromise.prototype.done = function (didFulfill, didReject, didProgress) {\n var promise = this._then(didFulfill, didReject, didProgress,\n undefined, undefined);\n promise._setIsFinal();\n};\n\nPromise.prototype.spread = function (didFulfill, didReject) {\n return this.all()._then(didFulfill, didReject, undefined, APPLY, undefined);\n};\n\nPromise.prototype.isCancellable = function () {\n return !this.isResolved() &&\n this._cancellable();\n};\n\nPromise.prototype.toJSON = function () {\n var ret = {\n isFulfilled: false,\n isRejected: false,\n fulfillmentValue: undefined,\n rejectionReason: undefined\n };\n if (this.isFulfilled()) {\n ret.fulfillmentValue = this.value();\n ret.isFulfilled = true;\n } else if (this.isRejected()) {\n ret.rejectionReason = this.reason();\n ret.isRejected = true;\n }\n return ret;\n};\n\nPromise.prototype.all = function () {\n return new PromiseArray(this).promise();\n};\n\nPromise.prototype.error = function (fn) {\n return this.caught(util.originatesFromRejection, fn);\n};\n\nPromise.is = function (val) {\n return val instanceof Promise;\n};\n\nPromise.fromNode = function(fn) {\n var ret = new Promise(INTERNAL);\n var result = tryCatch(fn)(nodebackForPromise(ret));\n if (result === errorObj) {\n ret._rejectCallback(result.e, true, true);\n }\n return ret;\n};\n\nPromise.all = function (promises) {\n return new PromiseArray(promises).promise();\n};\n\nPromise.defer = Promise.pending = function () {\n var promise = new Promise(INTERNAL);\n return new PromiseResolver(promise);\n};\n\nPromise.cast = function (obj) {\n var ret = tryConvertToPromise(obj);\n if (!(ret instanceof Promise)) {\n var val = ret;\n ret = new Promise(INTERNAL);\n ret._fulfillUnchecked(val);\n }\n return ret;\n};\n\nPromise.resolve = Promise.fulfilled = Promise.cast;\n\nPromise.reject = Promise.rejected = function (reason) {\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n ret._rejectCallback(reason, true);\n return ret;\n};\n\nPromise.setScheduler = function(fn) {\n if (typeof fn !== \"function\") throw new TypeError(\"fn must be a function\\u000a\\u000a See http://goo.gl/916lJJ\\u000a\");\n var prev = async._schedule;\n async._schedule = fn;\n return prev;\n};\n\nPromise.prototype._then = function (\n didFulfill,\n didReject,\n didProgress,\n receiver,\n internalData\n) {\n var haveInternalData = internalData !== undefined;\n var ret = haveInternalData ? internalData : new Promise(INTERNAL);\n\n if (!haveInternalData) {\n ret._propagateFrom(this, 4 | 1);\n ret._captureStackTrace();\n }\n\n var target = this._target();\n if (target !== this) {\n if (receiver === undefined) receiver = this._boundTo;\n if (!haveInternalData) ret._setIsMigrated();\n }\n\n var callbackIndex =\n target._addCallbacks(didFulfill, didReject, didProgress, ret, receiver);\n\n if (target._isResolved() && !target._isSettlePromisesQueued()) {\n async.invoke(\n target._settlePromiseAtPostResolution, target, callbackIndex);\n }\n\n return ret;\n};\n\nPromise.prototype._settlePromiseAtPostResolution = function (index) {\n if (this._isRejectionUnhandled()) this._unsetRejectionIsUnhandled();\n this._settlePromiseAt(index);\n};\n\nPromise.prototype._length = function () {\n return this._bitField & 131071;\n};\n\nPromise.prototype._isFollowingOrFulfilledOrRejected = function () {\n return (this._bitField & 939524096) > 0;\n};\n\nPromise.prototype._isFollowing = function () {\n return (this._bitField & 536870912) === 536870912;\n};\n\nPromise.prototype._setLength = function (len) {\n this._bitField = (this._bitField & -131072) |\n (len & 131071);\n};\n\nPromise.prototype._setFulfilled = function () {\n this._bitField = this._bitField | 268435456;\n};\n\nPromise.prototype._setRejected = function () {\n this._bitField = this._bitField | 134217728;\n};\n\nPromise.prototype._setFollowing = function () {\n this._bitField = this._bitField | 536870912;\n};\n\nPromise.prototype._setIsFinal = function () {\n this._bitField = this._bitField | 33554432;\n};\n\nPromise.prototype._isFinal = function () {\n return (this._bitField & 33554432) > 0;\n};\n\nPromise.prototype._cancellable = function () {\n return (this._bitField & 67108864) > 0;\n};\n\nPromise.prototype._setCancellable = function () {\n this._bitField = this._bitField | 67108864;\n};\n\nPromise.prototype._unsetCancellable = function () {\n this._bitField = this._bitField & (~67108864);\n};\n\nPromise.prototype._setIsMigrated = function () {\n this._bitField = this._bitField | 4194304;\n};\n\nPromise.prototype._unsetIsMigrated = function () {\n this._bitField = this._bitField & (~4194304);\n};\n\nPromise.prototype._isMigrated = function () {\n return (this._bitField & 4194304) > 0;\n};\n\nPromise.prototype._receiverAt = function (index) {\n var ret = index === 0\n ? this._receiver0\n : this[\n index * 5 - 5 + 4];\n if (ret === undefined && this._isBound()) {\n return this._boundTo;\n }\n return ret;\n};\n\nPromise.prototype._promiseAt = function (index) {\n return index === 0\n ? this._promise0\n : this[index * 5 - 5 + 3];\n};\n\nPromise.prototype._fulfillmentHandlerAt = function (index) {\n return index === 0\n ? this._fulfillmentHandler0\n : this[index * 5 - 5 + 0];\n};\n\nPromise.prototype._rejectionHandlerAt = function (index) {\n return index === 0\n ? this._rejectionHandler0\n : this[index * 5 - 5 + 1];\n};\n\nPromise.prototype._migrateCallbacks = function (follower, index) {\n var fulfill = follower._fulfillmentHandlerAt(index);\n var reject = follower._rejectionHandlerAt(index);\n var progress = follower._progressHandlerAt(index);\n var promise = follower._promiseAt(index);\n var receiver = follower._receiverAt(index);\n if (promise instanceof Promise) promise._setIsMigrated();\n this._addCallbacks(fulfill, reject, progress, promise, receiver);\n};\n\nPromise.prototype._addCallbacks = function (\n fulfill,\n reject,\n progress,\n promise,\n receiver\n) {\n var index = this._length();\n\n if (index >= 131071 - 5) {\n index = 0;\n this._setLength(0);\n }\n\n if (index === 0) {\n this._promise0 = promise;\n if (receiver !== undefined) this._receiver0 = receiver;\n if (typeof fulfill === \"function\" && !this._isCarryingStackTrace())\n this._fulfillmentHandler0 = fulfill;\n if (typeof reject === \"function\") this._rejectionHandler0 = reject;\n if (typeof progress === \"function\") this._progressHandler0 = progress;\n } else {\n var base = index * 5 - 5;\n this[base + 3] = promise;\n this[base + 4] = receiver;\n if (typeof fulfill === \"function\")\n this[base + 0] = fulfill;\n if (typeof reject === \"function\")\n this[base + 1] = reject;\n if (typeof progress === \"function\")\n this[base + 2] = progress;\n }\n this._setLength(index + 1);\n return index;\n};\n\nPromise.prototype._setProxyHandlers = function (receiver, promiseSlotValue) {\n var index = this._length();\n\n if (index >= 131071 - 5) {\n index = 0;\n this._setLength(0);\n }\n if (index === 0) {\n this._promise0 = promiseSlotValue;\n this._receiver0 = receiver;\n } else {\n var base = index * 5 - 5;\n this[base + 3] = promiseSlotValue;\n this[base + 4] = receiver;\n }\n this._setLength(index + 1);\n};\n\nPromise.prototype._proxyPromiseArray = function (promiseArray, index) {\n this._setProxyHandlers(promiseArray, index);\n};\n\nPromise.prototype._resolveCallback = function(value, shouldBind) {\n if (this._isFollowingOrFulfilledOrRejected()) return;\n if (value === this)\n return this._rejectCallback(makeSelfResolutionError(), false, true);\n var maybePromise = tryConvertToPromise(value, this);\n if (!(maybePromise instanceof Promise)) return this._fulfill(value);\n\n var propagationFlags = 1 | (shouldBind ? 4 : 0);\n this._propagateFrom(maybePromise, propagationFlags);\n var promise = maybePromise._target();\n if (promise._isPending()) {\n var len = this._length();\n for (var i = 0; i < len; ++i) {\n promise._migrateCallbacks(this, i);\n }\n this._setFollowing();\n this._setLength(0);\n this._setFollowee(promise);\n } else if (promise._isFulfilled()) {\n this._fulfillUnchecked(promise._value());\n } else {\n this._rejectUnchecked(promise._reason(),\n promise._getCarriedStackTrace());\n }\n};\n\nPromise.prototype._rejectCallback =\nfunction(reason, synchronous, shouldNotMarkOriginatingFromRejection) {\n if (!shouldNotMarkOriginatingFromRejection) {\n util.markAsOriginatingFromRejection(reason);\n }\n var trace = util.ensureErrorObject(reason);\n var hasStack = trace === reason;\n this._attachExtraTrace(trace, synchronous ? hasStack : false);\n this._reject(reason, hasStack ? undefined : trace);\n};\n\nPromise.prototype._resolveFromResolver = function (resolver) {\n var promise = this;\n this._captureStackTrace();\n this._pushContext();\n var synchronous = true;\n var r = tryCatch(resolver)(function(value) {\n if (promise === null) return;\n promise._resolveCallback(value);\n promise = null;\n }, function (reason) {\n if (promise === null) return;\n promise._rejectCallback(reason, synchronous);\n promise = null;\n });\n synchronous = false;\n this._popContext();\n\n if (r !== undefined && r === errorObj && promise !== null) {\n promise._rejectCallback(r.e, true, true);\n promise = null;\n }\n};\n\nPromise.prototype._settlePromiseFromHandler = function (\n handler, receiver, value, promise\n) {\n if (promise._isRejected()) return;\n promise._pushContext();\n var x;\n if (receiver === APPLY && !this._isRejected()) {\n x = tryCatch(handler).apply(this._boundTo, value);\n } else {\n x = tryCatch(handler).call(receiver, value);\n }\n promise._popContext();\n\n if (x === errorObj || x === promise || x === NEXT_FILTER) {\n var err = x === promise ? makeSelfResolutionError() : x.e;\n promise._rejectCallback(err, false, true);\n } else {\n promise._resolveCallback(x);\n }\n};\n\nPromise.prototype._target = function() {\n var ret = this;\n while (ret._isFollowing()) ret = ret._followee();\n return ret;\n};\n\nPromise.prototype._followee = function() {\n return this._rejectionHandler0;\n};\n\nPromise.prototype._setFollowee = function(promise) {\n this._rejectionHandler0 = promise;\n};\n\nPromise.prototype._cleanValues = function () {\n if (this._cancellable()) {\n this._cancellationParent = undefined;\n }\n};\n\nPromise.prototype._propagateFrom = function (parent, flags) {\n if ((flags & 1) > 0 && parent._cancellable()) {\n this._setCancellable();\n this._cancellationParent = parent;\n }\n if ((flags & 4) > 0 && parent._isBound()) {\n this._setBoundTo(parent._boundTo);\n }\n};\n\nPromise.prototype._fulfill = function (value) {\n if (this._isFollowingOrFulfilledOrRejected()) return;\n this._fulfillUnchecked(value);\n};\n\nPromise.prototype._reject = function (reason, carriedStackTrace) {\n if (this._isFollowingOrFulfilledOrRejected()) return;\n this._rejectUnchecked(reason, carriedStackTrace);\n};\n\nPromise.prototype._settlePromiseAt = function (index) {\n var promise = this._promiseAt(index);\n var isPromise = promise instanceof Promise;\n\n if (isPromise && promise._isMigrated()) {\n promise._unsetIsMigrated();\n return async.invoke(this._settlePromiseAt, this, index);\n }\n var handler = this._isFulfilled()\n ? this._fulfillmentHandlerAt(index)\n : this._rejectionHandlerAt(index);\n\n var carriedStackTrace =\n this._isCarryingStackTrace() ? this._getCarriedStackTrace() : undefined;\n var value = this._settledValue;\n var receiver = this._receiverAt(index);\n\n\n this._clearCallbackDataAtIndex(index);\n\n if (typeof handler === \"function\") {\n if (!isPromise) {\n handler.call(receiver, value, promise);\n } else {\n this._settlePromiseFromHandler(handler, receiver, value, promise);\n }\n } else if (receiver instanceof PromiseArray) {\n if (!receiver._isResolved()) {\n if (this._isFulfilled()) {\n receiver._promiseFulfilled(value, promise);\n }\n else {\n receiver._promiseRejected(value, promise);\n }\n }\n } else if (isPromise) {\n if (this._isFulfilled()) {\n promise._fulfill(value);\n } else {\n promise._reject(value, carriedStackTrace);\n }\n }\n\n if (index >= 4 && (index & 31) === 4)\n async.invokeLater(this._setLength, this, 0);\n};\n\nPromise.prototype._clearCallbackDataAtIndex = function(index) {\n if (index === 0) {\n if (!this._isCarryingStackTrace()) {\n this._fulfillmentHandler0 = undefined;\n }\n this._rejectionHandler0 =\n this._progressHandler0 =\n this._receiver0 =\n this._promise0 = undefined;\n } else {\n var base = index * 5 - 5;\n this[base + 3] =\n this[base + 4] =\n this[base + 0] =\n this[base + 1] =\n this[base + 2] = undefined;\n }\n};\n\nPromise.prototype._isSettlePromisesQueued = function () {\n return (this._bitField &\n -1073741824) === -1073741824;\n};\n\nPromise.prototype._setSettlePromisesQueued = function () {\n this._bitField = this._bitField | -1073741824;\n};\n\nPromise.prototype._unsetSettlePromisesQueued = function () {\n this._bitField = this._bitField & (~-1073741824);\n};\n\nPromise.prototype._queueSettlePromises = function() {\n async.settlePromises(this);\n this._setSettlePromisesQueued();\n};\n\nPromise.prototype._fulfillUnchecked = function (value) {\n if (value === this) {\n var err = makeSelfResolutionError();\n this._attachExtraTrace(err);\n return this._rejectUnchecked(err, undefined);\n }\n this._setFulfilled();\n this._settledValue = value;\n this._cleanValues();\n\n if (this._length() > 0) {\n this._queueSettlePromises();\n }\n};\n\nPromise.prototype._rejectUncheckedCheckError = function (reason) {\n var trace = util.ensureErrorObject(reason);\n this._rejectUnchecked(reason, trace === reason ? undefined : trace);\n};\n\nPromise.prototype._rejectUnchecked = function (reason, trace) {\n if (reason === this) {\n var err = makeSelfResolutionError();\n this._attachExtraTrace(err);\n return this._rejectUnchecked(err);\n }\n this._setRejected();\n this._settledValue = reason;\n this._cleanValues();\n\n if (this._isFinal()) {\n async.throwLater(function(e) {\n if (\"stack\" in e) {\n async.invokeFirst(\n CapturedTrace.unhandledRejection, undefined, e);\n }\n throw e;\n }, trace === undefined ? reason : trace);\n return;\n }\n\n if (trace !== undefined && trace !== reason) {\n this._setCarriedStackTrace(trace);\n }\n\n if (this._length() > 0) {\n this._queueSettlePromises();\n } else {\n this._ensurePossibleRejectionHandled();\n }\n};\n\nPromise.prototype._settlePromises = function () {\n this._unsetSettlePromisesQueued();\n var len = this._length();\n for (var i = 0; i < len; i++) {\n this._settlePromiseAt(i);\n }\n};\n\nPromise._makeSelfResolutionError = makeSelfResolutionError;\n_dereq_(\"./method.js\")(Promise, INTERNAL, tryConvertToPromise, apiRejection);\n_dereq_(\"./bind.js\")(Promise, INTERNAL, tryConvertToPromise);\n_dereq_(\"./finally.js\")(Promise, NEXT_FILTER, tryConvertToPromise);\n_dereq_(\"./direct_resolve.js\")(Promise);\n_dereq_(\"./synchronous_inspection.js\")(Promise);\n_dereq_(\"./join.js\")(Promise, PromiseArray, tryConvertToPromise, INTERNAL);\nPromise.Promise = Promise;\n_dereq_('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL);\n_dereq_('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext);\n_dereq_('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise);\n_dereq_('./nodeify.js')(Promise);\n_dereq_('./cancel.js')(Promise);\n_dereq_('./promisify.js')(Promise, INTERNAL);\n_dereq_('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection);\n_dereq_('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection);\n_dereq_('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL);\n_dereq_('./settle.js')(Promise, PromiseArray);\n_dereq_('./call_get.js')(Promise);\n_dereq_('./some.js')(Promise, PromiseArray, apiRejection);\n_dereq_('./progress.js')(Promise, PromiseArray);\n_dereq_('./any.js')(Promise);\n_dereq_('./each.js')(Promise, INTERNAL);\n_dereq_('./timers.js')(Promise, INTERNAL);\n_dereq_('./filter.js')(Promise, INTERNAL);\n \n util.toFastProperties(Promise); \n util.toFastProperties(Promise.prototype); \n function fillTypes(value) { \n var p = new Promise(INTERNAL); \n p._fulfillmentHandler0 = value; \n p._rejectionHandler0 = value; \n p._progressHandler0 = value; \n p._promise0 = value; \n p._receiver0 = value; \n p._settledValue = value; \n } \n // Complete slack tracking, opt out of field-type tracking and \n // stabilize map \n fillTypes({a: 1}); \n fillTypes({b: 2}); \n fillTypes({c: 3}); \n fillTypes(1); \n fillTypes(function(){}); \n fillTypes(undefined); \n fillTypes(false); \n fillTypes(new Promise(INTERNAL)); \n CapturedTrace.setBounds(async.firstLineError, util.lastLineError); \n return Promise; \n\n};\n\n},{\"./any.js\":1,\"./async.js\":2,\"./bind.js\":3,\"./call_get.js\":5,\"./cancel.js\":6,\"./captured_trace.js\":7,\"./catch_filter.js\":8,\"./context.js\":9,\"./debuggability.js\":10,\"./direct_resolve.js\":11,\"./each.js\":12,\"./errors.js\":13,\"./filter.js\":15,\"./finally.js\":16,\"./generators.js\":17,\"./join.js\":18,\"./map.js\":19,\"./method.js\":20,\"./nodeify.js\":21,\"./progress.js\":22,\"./promise_array.js\":24,\"./promise_resolver.js\":25,\"./promisify.js\":26,\"./props.js\":27,\"./race.js\":29,\"./reduce.js\":30,\"./settle.js\":32,\"./some.js\":33,\"./synchronous_inspection.js\":34,\"./thenables.js\":35,\"./timers.js\":36,\"./using.js\":37,\"./util.js\":38}],24:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL, tryConvertToPromise,\n apiRejection) {\nvar util = _dereq_(\"./util.js\");\nvar isArray = util.isArray;\n\nfunction toResolutionValue(val) {\n switch(val) {\n case -2: return [];\n case -3: return {};\n }\n}\n\nfunction PromiseArray(values) {\n var promise = this._promise = new Promise(INTERNAL);\n var parent;\n if (values instanceof Promise) {\n parent = values;\n promise._propagateFrom(parent, 1 | 4);\n }\n this._values = values;\n this._length = 0;\n this._totalResolved = 0;\n this._init(undefined, -2);\n}\nPromiseArray.prototype.length = function () {\n return this._length;\n};\n\nPromiseArray.prototype.promise = function () {\n return this._promise;\n};\n\nPromiseArray.prototype._init = function init(_, resolveValueIfEmpty) {\n var values = tryConvertToPromise(this._values, this._promise);\n if (values instanceof Promise) {\n values = values._target();\n this._values = values;\n if (values._isFulfilled()) {\n values = values._value();\n if (!isArray(values)) {\n var err = new Promise.TypeError(\"expecting an array, a promise or a thenable\\u000a\\u000a See http://goo.gl/s8MMhc\\u000a\");\n this.__hardReject__(err);\n return;\n }\n } else if (values._isPending()) {\n values._then(\n init,\n this._reject,\n undefined,\n this,\n resolveValueIfEmpty\n );\n return;\n } else {\n this._reject(values._reason());\n return;\n }\n } else if (!isArray(values)) {\n this._promise._reject(apiRejection(\"expecting an array, a promise or a thenable\\u000a\\u000a See http://goo.gl/s8MMhc\\u000a\")._reason());\n return;\n }\n\n if (values.length === 0) {\n if (resolveValueIfEmpty === -5) {\n this._resolveEmptyArray();\n }\n else {\n this._resolve(toResolutionValue(resolveValueIfEmpty));\n }\n return;\n }\n var len = this.getActualLength(values.length);\n this._length = len;\n this._values = this.shouldCopyValues() ? new Array(len) : this._values;\n var promise = this._promise;\n for (var i = 0; i < len; ++i) {\n var isResolved = this._isResolved();\n var maybePromise = tryConvertToPromise(values[i], promise);\n if (maybePromise instanceof Promise) {\n maybePromise = maybePromise._target();\n if (isResolved) {\n maybePromise._unsetRejectionIsUnhandled();\n } else if (maybePromise._isPending()) {\n maybePromise._proxyPromiseArray(this, i);\n } else if (maybePromise._isFulfilled()) {\n this._promiseFulfilled(maybePromise._value(), i);\n } else {\n this._promiseRejected(maybePromise._reason(), i);\n }\n } else if (!isResolved) {\n this._promiseFulfilled(maybePromise, i);\n }\n }\n};\n\nPromiseArray.prototype._isResolved = function () {\n return this._values === null;\n};\n\nPromiseArray.prototype._resolve = function (value) {\n this._values = null;\n this._promise._fulfill(value);\n};\n\nPromiseArray.prototype.__hardReject__ =\nPromiseArray.prototype._reject = function (reason) {\n this._values = null;\n this._promise._rejectCallback(reason, false, true);\n};\n\nPromiseArray.prototype._promiseProgressed = function (progressValue, index) {\n this._promise._progress({\n index: index,\n value: progressValue\n });\n};\n\n\nPromiseArray.prototype._promiseFulfilled = function (value, index) {\n this._values[index] = value;\n var totalResolved = ++this._totalResolved;\n if (totalResolved >= this._length) {\n this._resolve(this._values);\n }\n};\n\nPromiseArray.prototype._promiseRejected = function (reason, index) {\n this._totalResolved++;\n this._reject(reason);\n};\n\nPromiseArray.prototype.shouldCopyValues = function () {\n return true;\n};\n\nPromiseArray.prototype.getActualLength = function (len) {\n return len;\n};\n\nreturn PromiseArray;\n};\n\n},{\"./util.js\":38}],25:[function(_dereq_,module,exports){\n\"use strict\";\nvar util = _dereq_(\"./util.js\");\nvar maybeWrapAsError = util.maybeWrapAsError;\nvar errors = _dereq_(\"./errors.js\");\nvar TimeoutError = errors.TimeoutError;\nvar OperationalError = errors.OperationalError;\nvar haveGetters = util.haveGetters;\nvar es5 = _dereq_(\"./es5.js\");\n\nfunction isUntypedError(obj) {\n return obj instanceof Error &&\n es5.getPrototypeOf(obj) === Error.prototype;\n}\n\nvar rErrorKey = /^(?:name|message|stack|cause)$/;\nfunction wrapAsOperationalError(obj) {\n var ret;\n if (isUntypedError(obj)) {\n ret = new OperationalError(obj);\n ret.name = obj.name;\n ret.message = obj.message;\n ret.stack = obj.stack;\n var keys = es5.keys(obj);\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n if (!rErrorKey.test(key)) {\n ret[key] = obj[key];\n }\n }\n return ret;\n }\n util.markAsOriginatingFromRejection(obj);\n return obj;\n}\n\nfunction nodebackForPromise(promise) {\n return function(err, value) {\n if (promise === null) return;\n\n if (err) {\n var wrapped = wrapAsOperationalError(maybeWrapAsError(err));\n promise._attachExtraTrace(wrapped);\n promise._reject(wrapped);\n } else if (arguments.length > 2) {\n var $_len = arguments.length;var args = new Array($_len - 1); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];}\n promise._fulfill(args);\n } else {\n promise._fulfill(value);\n }\n\n promise = null;\n };\n}\n\n\nvar PromiseResolver;\nif (!haveGetters) {\n PromiseResolver = function (promise) {\n this.promise = promise;\n this.asCallback = nodebackForPromise(promise);\n this.callback = this.asCallback;\n };\n}\nelse {\n PromiseResolver = function (promise) {\n this.promise = promise;\n };\n}\nif (haveGetters) {\n var prop = {\n get: function() {\n return nodebackForPromise(this.promise);\n }\n };\n es5.defineProperty(PromiseResolver.prototype, \"asCallback\", prop);\n es5.defineProperty(PromiseResolver.prototype, \"callback\", prop);\n}\n\nPromiseResolver._nodebackForPromise = nodebackForPromise;\n\nPromiseResolver.prototype.toString = function () {\n return \"[object PromiseResolver]\";\n};\n\nPromiseResolver.prototype.resolve =\nPromiseResolver.prototype.fulfill = function (value) {\n if (!(this instanceof PromiseResolver)) {\n throw new TypeError(\"Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\\u000a\\u000a See http://goo.gl/sdkXL9\\u000a\");\n }\n this.promise._resolveCallback(value);\n};\n\nPromiseResolver.prototype.reject = function (reason) {\n if (!(this instanceof PromiseResolver)) {\n throw new TypeError(\"Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\\u000a\\u000a See http://goo.gl/sdkXL9\\u000a\");\n }\n this.promise._rejectCallback(reason);\n};\n\nPromiseResolver.prototype.progress = function (value) {\n if (!(this instanceof PromiseResolver)) {\n throw new TypeError(\"Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\\u000a\\u000a See http://goo.gl/sdkXL9\\u000a\");\n }\n this.promise._progress(value);\n};\n\nPromiseResolver.prototype.cancel = function (err) {\n this.promise.cancel(err);\n};\n\nPromiseResolver.prototype.timeout = function () {\n this.reject(new TimeoutError(\"timeout\"));\n};\n\nPromiseResolver.prototype.isResolved = function () {\n return this.promise.isResolved();\n};\n\nPromiseResolver.prototype.toJSON = function () {\n return this.promise.toJSON();\n};\n\nmodule.exports = PromiseResolver;\n\n},{\"./errors.js\":13,\"./es5.js\":14,\"./util.js\":38}],26:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL) {\nvar THIS = {};\nvar util = _dereq_(\"./util.js\");\nvar nodebackForPromise = _dereq_(\"./promise_resolver.js\")\n ._nodebackForPromise;\nvar withAppended = util.withAppended;\nvar maybeWrapAsError = util.maybeWrapAsError;\nvar canEvaluate = util.canEvaluate;\nvar TypeError = _dereq_(\"./errors\").TypeError;\nvar defaultSuffix = \"Async\";\nvar defaultPromisified = {__isPromisified__: true};\nvar noCopyPropsPattern =\n /^(?:length|name|arguments|caller|prototype|__isPromisified__)$/;\nvar defaultFilter = function(name, func) {\n return util.isIdentifier(name) &&\n name.charAt(0) !== \"_\" &&\n !util.isClass(func);\n};\n\nfunction propsFilter(key) {\n return !noCopyPropsPattern.test(key);\n}\n\nfunction isPromisified(fn) {\n try {\n return fn.__isPromisified__ === true;\n }\n catch (e) {\n return false;\n }\n}\n\nfunction hasPromisified(obj, key, suffix) {\n var val = util.getDataPropertyOrDefault(obj, key + suffix,\n defaultPromisified);\n return val ? isPromisified(val) : false;\n}\nfunction checkValid(ret, suffix, suffixRegexp) {\n for (var i = 0; i < ret.length; i += 2) {\n var key = ret[i];\n if (suffixRegexp.test(key)) {\n var keyWithoutAsyncSuffix = key.replace(suffixRegexp, \"\");\n for (var j = 0; j < ret.length; j += 2) {\n if (ret[j] === keyWithoutAsyncSuffix) {\n throw new TypeError(\"Cannot promisify an API that has normal methods with '%s'-suffix\\u000a\\u000a See http://goo.gl/iWrZbw\\u000a\"\n .replace(\"%s\", suffix));\n }\n }\n }\n }\n}\n\nfunction promisifiableMethods(obj, suffix, suffixRegexp, filter) {\n var keys = util.inheritedDataKeys(obj);\n var ret = [];\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n var value = obj[key];\n var passesDefaultFilter = filter === defaultFilter\n ? true : defaultFilter(key, value, obj);\n if (typeof value === \"function\" &&\n !isPromisified(value) &&\n !hasPromisified(obj, key, suffix) &&\n filter(key, value, obj, passesDefaultFilter)) {\n ret.push(key, value);\n }\n }\n checkValid(ret, suffix, suffixRegexp);\n return ret;\n}\n\nvar escapeIdentRegex = function(str) {\n return str.replace(/([$])/, \"\\\\$\");\n};\n\nvar makeNodePromisifiedEval;\nif (!true) {\nvar switchCaseArgumentOrder = function(likelyArgumentCount) {\n var ret = [likelyArgumentCount];\n var min = Math.max(0, likelyArgumentCount - 1 - 3);\n for(var i = likelyArgumentCount - 1; i >= min; --i) {\n ret.push(i);\n }\n for(var i = likelyArgumentCount + 1; i <= 3; ++i) {\n ret.push(i);\n }\n return ret;\n};\n\nvar argumentSequence = function(argumentCount) {\n return util.filledRange(argumentCount, \"_arg\", \"\");\n};\n\nvar parameterDeclaration = function(parameterCount) {\n return util.filledRange(\n Math.max(parameterCount, 3), \"_arg\", \"\");\n};\n\nvar parameterCount = function(fn) {\n if (typeof fn.length === \"number\") {\n return Math.max(Math.min(fn.length, 1023 + 1), 0);\n }\n return 0;\n};\n\nmakeNodePromisifiedEval =\nfunction(callback, receiver, originalName, fn) {\n var newParameterCount = Math.max(0, parameterCount(fn) - 1);\n var argumentOrder = switchCaseArgumentOrder(newParameterCount);\n var shouldProxyThis = typeof callback === \"string\" || receiver === THIS;\n\n function generateCallForArgumentCount(count) {\n var args = argumentSequence(count).join(\", \");\n var comma = count > 0 ? \", \" : \"\";\n var ret;\n if (shouldProxyThis) {\n ret = \"ret = callback.call(this, {{args}}, nodeback); break;\\n\";\n } else {\n ret = receiver === undefined\n ? \"ret = callback({{args}}, nodeback); break;\\n\"\n : \"ret = callback.call(receiver, {{args}}, nodeback); break;\\n\";\n }\n return ret.replace(\"{{args}}\", args).replace(\", \", comma);\n }\n\n function generateArgumentSwitchCase() {\n var ret = \"\";\n for (var i = 0; i < argumentOrder.length; ++i) {\n ret += \"case \" + argumentOrder[i] +\":\" +\n generateCallForArgumentCount(argumentOrder[i]);\n }\n\n ret += \" \\n\\\n default: \\n\\\n var args = new Array(len + 1); \\n\\\n var i = 0; \\n\\\n for (var i = 0; i < len; ++i) { \\n\\\n args[i] = arguments[i]; \\n\\\n } \\n\\\n args[i] = nodeback; \\n\\\n [CodeForCall] \\n\\\n break; \\n\\\n \".replace(\"[CodeForCall]\", (shouldProxyThis\n ? \"ret = callback.apply(this, args);\\n\"\n : \"ret = callback.apply(receiver, args);\\n\"));\n return ret;\n }\n\n var getFunctionCode = typeof callback === \"string\"\n ? (\"this != null ? this['\"+callback+\"'] : fn\")\n : \"fn\";\n\n return new Function(\"Promise\",\n \"fn\",\n \"receiver\",\n \"withAppended\",\n \"maybeWrapAsError\",\n \"nodebackForPromise\",\n \"tryCatch\",\n \"errorObj\",\n \"INTERNAL\",\"'use strict'; \\n\\\n var ret = function (Parameters) { \\n\\\n 'use strict'; \\n\\\n var len = arguments.length; \\n\\\n var promise = new Promise(INTERNAL); \\n\\\n promise._captureStackTrace(); \\n\\\n var nodeback = nodebackForPromise(promise); \\n\\\n var ret; \\n\\\n var callback = tryCatch([GetFunctionCode]); \\n\\\n switch(len) { \\n\\\n [CodeForSwitchCase] \\n\\\n } \\n\\\n if (ret === errorObj) { \\n\\\n promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\\n\\\n } \\n\\\n return promise; \\n\\\n }; \\n\\\n ret.__isPromisified__ = true; \\n\\\n return ret; \\n\\\n \"\n .replace(\"Parameters\", parameterDeclaration(newParameterCount))\n .replace(\"[CodeForSwitchCase]\", generateArgumentSwitchCase())\n .replace(\"[GetFunctionCode]\", getFunctionCode))(\n Promise,\n fn,\n receiver,\n withAppended,\n maybeWrapAsError,\n nodebackForPromise,\n util.tryCatch,\n util.errorObj,\n INTERNAL\n );\n};\n}\n\nfunction makeNodePromisifiedClosure(callback, receiver, _, fn) {\n var defaultThis = (function() {return this;})();\n var method = callback;\n if (typeof method === \"string\") {\n callback = fn;\n }\n function promisified() {\n var _receiver = receiver;\n if (receiver === THIS) _receiver = this;\n var promise = new Promise(INTERNAL);\n promise._captureStackTrace();\n var cb = typeof method === \"string\" && this !== defaultThis\n ? this[method] : callback;\n var fn = nodebackForPromise(promise);\n try {\n cb.apply(_receiver, withAppended(arguments, fn));\n } catch(e) {\n promise._rejectCallback(maybeWrapAsError(e), true, true);\n }\n return promise;\n }\n promisified.__isPromisified__ = true;\n return promisified;\n}\n\nvar makeNodePromisified = canEvaluate\n ? makeNodePromisifiedEval\n : makeNodePromisifiedClosure;\n\nfunction promisifyAll(obj, suffix, filter, promisifier) {\n var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + \"$\");\n var methods =\n promisifiableMethods(obj, suffix, suffixRegexp, filter);\n\n for (var i = 0, len = methods.length; i < len; i+= 2) {\n var key = methods[i];\n var fn = methods[i+1];\n var promisifiedKey = key + suffix;\n obj[promisifiedKey] = promisifier === makeNodePromisified\n ? makeNodePromisified(key, THIS, key, fn, suffix)\n : promisifier(fn, function() {\n return makeNodePromisified(key, THIS, key, fn, suffix);\n });\n }\n util.toFastProperties(obj);\n return obj;\n}\n\nfunction promisify(callback, receiver) {\n return makeNodePromisified(callback, receiver, undefined, callback);\n}\n\nPromise.promisify = function (fn, receiver) {\n if (typeof fn !== \"function\") {\n throw new TypeError(\"fn must be a function\\u000a\\u000a See http://goo.gl/916lJJ\\u000a\");\n }\n if (isPromisified(fn)) {\n return fn;\n }\n var ret = promisify(fn, arguments.length < 2 ? THIS : receiver);\n util.copyDescriptors(fn, ret, propsFilter);\n return ret;\n};\n\nPromise.promisifyAll = function (target, options) {\n if (typeof target !== \"function\" && typeof target !== \"object\") {\n throw new TypeError(\"the target of promisifyAll must be an object or a function\\u000a\\u000a See http://goo.gl/9ITlV0\\u000a\");\n }\n options = Object(options);\n var suffix = options.suffix;\n if (typeof suffix !== \"string\") suffix = defaultSuffix;\n var filter = options.filter;\n if (typeof filter !== \"function\") filter = defaultFilter;\n var promisifier = options.promisifier;\n if (typeof promisifier !== \"function\") promisifier = makeNodePromisified;\n\n if (!util.isIdentifier(suffix)) {\n throw new RangeError(\"suffix must be a valid identifier\\u000a\\u000a See http://goo.gl/8FZo5V\\u000a\");\n }\n\n var keys = util.inheritedDataKeys(target);\n for (var i = 0; i < keys.length; ++i) {\n var value = target[keys[i]];\n if (keys[i] !== \"constructor\" &&\n util.isClass(value)) {\n promisifyAll(value.prototype, suffix, filter, promisifier);\n promisifyAll(value, suffix, filter, promisifier);\n }\n }\n\n return promisifyAll(target, suffix, filter, promisifier);\n};\n};\n\n\n},{\"./errors\":13,\"./promise_resolver.js\":25,\"./util.js\":38}],27:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(\n Promise, PromiseArray, tryConvertToPromise, apiRejection) {\nvar util = _dereq_(\"./util.js\");\nvar isObject = util.isObject;\nvar es5 = _dereq_(\"./es5.js\");\n\nfunction PropertiesPromiseArray(obj) {\n var keys = es5.keys(obj);\n var len = keys.length;\n var values = new Array(len * 2);\n for (var i = 0; i < len; ++i) {\n var key = keys[i];\n values[i] = obj[key];\n values[i + len] = key;\n }\n this.constructor$(values);\n}\nutil.inherits(PropertiesPromiseArray, PromiseArray);\n\nPropertiesPromiseArray.prototype._init = function () {\n this._init$(undefined, -3) ;\n};\n\nPropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) {\n this._values[index] = value;\n var totalResolved = ++this._totalResolved;\n if (totalResolved >= this._length) {\n var val = {};\n var keyOffset = this.length();\n for (var i = 0, len = this.length(); i < len; ++i) {\n val[this._values[i + keyOffset]] = this._values[i];\n }\n this._resolve(val);\n }\n};\n\nPropertiesPromiseArray.prototype._promiseProgressed = function (value, index) {\n this._promise._progress({\n key: this._values[index + this.length()],\n value: value\n });\n};\n\nPropertiesPromiseArray.prototype.shouldCopyValues = function () {\n return false;\n};\n\nPropertiesPromiseArray.prototype.getActualLength = function (len) {\n return len >> 1;\n};\n\nfunction props(promises) {\n var ret;\n var castValue = tryConvertToPromise(promises);\n\n if (!isObject(castValue)) {\n return apiRejection(\"cannot await properties of a non-object\\u000a\\u000a See http://goo.gl/OsFKC8\\u000a\");\n } else if (castValue instanceof Promise) {\n ret = castValue._then(\n Promise.props, undefined, undefined, undefined, undefined);\n } else {\n ret = new PropertiesPromiseArray(castValue).promise();\n }\n\n if (castValue instanceof Promise) {\n ret._propagateFrom(castValue, 4);\n }\n return ret;\n}\n\nPromise.prototype.props = function () {\n return props(this);\n};\n\nPromise.props = function (promises) {\n return props(promises);\n};\n};\n\n},{\"./es5.js\":14,\"./util.js\":38}],28:[function(_dereq_,module,exports){\n\"use strict\";\nfunction arrayMove(src, srcIndex, dst, dstIndex, len) {\n for (var j = 0; j < len; ++j) {\n dst[j + dstIndex] = src[j + srcIndex];\n src[j + srcIndex] = void 0;\n }\n}\n\nfunction Queue(capacity) {\n this._capacity = capacity;\n this._length = 0;\n this._front = 0;\n}\n\nQueue.prototype._willBeOverCapacity = function (size) {\n return this._capacity < size;\n};\n\nQueue.prototype._pushOne = function (arg) {\n var length = this.length();\n this._checkCapacity(length + 1);\n var i = (this._front + length) & (this._capacity - 1);\n this[i] = arg;\n this._length = length + 1;\n};\n\nQueue.prototype._unshiftOne = function(value) {\n var capacity = this._capacity;\n this._checkCapacity(this.length() + 1);\n var front = this._front;\n var i = (((( front - 1 ) &\n ( capacity - 1) ) ^ capacity ) - capacity );\n this[i] = value;\n this._front = i;\n this._length = this.length() + 1;\n};\n\nQueue.prototype.unshift = function(fn, receiver, arg) {\n this._unshiftOne(arg);\n this._unshiftOne(receiver);\n this._unshiftOne(fn);\n};\n\nQueue.prototype.push = function (fn, receiver, arg) {\n var length = this.length() + 3;\n if (this._willBeOverCapacity(length)) {\n this._pushOne(fn);\n this._pushOne(receiver);\n this._pushOne(arg);\n return;\n }\n var j = this._front + length - 3;\n this._checkCapacity(length);\n var wrapMask = this._capacity - 1;\n this[(j + 0) & wrapMask] = fn;\n this[(j + 1) & wrapMask] = receiver;\n this[(j + 2) & wrapMask] = arg;\n this._length = length;\n};\n\nQueue.prototype.shift = function () {\n var front = this._front,\n ret = this[front];\n\n this[front] = undefined;\n this._front = (front + 1) & (this._capacity - 1);\n this._length--;\n return ret;\n};\n\nQueue.prototype.length = function () {\n return this._length;\n};\n\nQueue.prototype._checkCapacity = function (size) {\n if (this._capacity < size) {\n this._resizeTo(this._capacity << 1);\n }\n};\n\nQueue.prototype._resizeTo = function (capacity) {\n var oldCapacity = this._capacity;\n this._capacity = capacity;\n var front = this._front;\n var length = this._length;\n var moveItemsCount = (front + length) & (oldCapacity - 1);\n arrayMove(this, 0, this, oldCapacity, moveItemsCount);\n};\n\nmodule.exports = Queue;\n\n},{}],29:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(\n Promise, INTERNAL, tryConvertToPromise, apiRejection) {\nvar isArray = _dereq_(\"./util.js\").isArray;\n\nvar raceLater = function (promise) {\n return promise.then(function(array) {\n return race(array, promise);\n });\n};\n\nfunction race(promises, parent) {\n var maybePromise = tryConvertToPromise(promises);\n\n if (maybePromise instanceof Promise) {\n return raceLater(maybePromise);\n } else if (!isArray(promises)) {\n return apiRejection(\"expecting an array, a promise or a thenable\\u000a\\u000a See http://goo.gl/s8MMhc\\u000a\");\n }\n\n var ret = new Promise(INTERNAL);\n if (parent !== undefined) {\n ret._propagateFrom(parent, 4 | 1);\n }\n var fulfill = ret._fulfill;\n var reject = ret._reject;\n for (var i = 0, len = promises.length; i < len; ++i) {\n var val = promises[i];\n\n if (val === undefined && !(i in promises)) {\n continue;\n }\n\n Promise.cast(val)._then(fulfill, reject, undefined, ret, null);\n }\n return ret;\n}\n\nPromise.race = function (promises) {\n return race(promises, undefined);\n};\n\nPromise.prototype.race = function () {\n return race(this, undefined);\n};\n\n};\n\n},{\"./util.js\":38}],30:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise,\n PromiseArray,\n apiRejection,\n tryConvertToPromise,\n INTERNAL) {\nvar async = _dereq_(\"./async.js\");\nvar util = _dereq_(\"./util.js\");\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\nfunction ReductionPromiseArray(promises, fn, accum, _each) {\n this.constructor$(promises);\n this._promise._captureStackTrace();\n this._preservedValues = _each === INTERNAL ? [] : null;\n this._zerothIsAccum = (accum === undefined);\n this._gotAccum = false;\n this._reducingIndex = (this._zerothIsAccum ? 1 : 0);\n this._valuesPhase = undefined;\n var maybePromise = tryConvertToPromise(accum, this._promise);\n var rejected = false;\n var isPromise = maybePromise instanceof Promise;\n if (isPromise) {\n maybePromise = maybePromise._target();\n if (maybePromise._isPending()) {\n maybePromise._proxyPromiseArray(this, -1);\n } else if (maybePromise._isFulfilled()) {\n accum = maybePromise._value();\n this._gotAccum = true;\n } else {\n this._reject(maybePromise._reason());\n rejected = true;\n }\n }\n if (!(isPromise || this._zerothIsAccum)) this._gotAccum = true;\n this._callback = fn;\n this._accum = accum;\n if (!rejected) async.invoke(init, this, undefined);\n}\nfunction init() {\n this._init$(undefined, -5);\n}\nutil.inherits(ReductionPromiseArray, PromiseArray);\n\nReductionPromiseArray.prototype._init = function () {};\n\nReductionPromiseArray.prototype._resolveEmptyArray = function () {\n if (this._gotAccum || this._zerothIsAccum) {\n this._resolve(this._preservedValues !== null\n ? [] : this._accum);\n }\n};\n\nReductionPromiseArray.prototype._promiseFulfilled = function (value, index) {\n var values = this._values;\n values[index] = value;\n var length = this.length();\n var preservedValues = this._preservedValues;\n var isEach = preservedValues !== null;\n var gotAccum = this._gotAccum;\n var valuesPhase = this._valuesPhase;\n var valuesPhaseIndex;\n if (!valuesPhase) {\n valuesPhase = this._valuesPhase = new Array(length);\n for (valuesPhaseIndex=0; valuesPhaseIndex= this._length) {\n this._resolve(this._values);\n }\n};\n\nSettledPromiseArray.prototype._promiseFulfilled = function (value, index) {\n var ret = new PromiseInspection();\n ret._bitField = 268435456;\n ret._settledValue = value;\n this._promiseResolved(index, ret);\n};\nSettledPromiseArray.prototype._promiseRejected = function (reason, index) {\n var ret = new PromiseInspection();\n ret._bitField = 134217728;\n ret._settledValue = reason;\n this._promiseResolved(index, ret);\n};\n\nPromise.settle = function (promises) {\n return new SettledPromiseArray(promises).promise();\n};\n\nPromise.prototype.settle = function () {\n return new SettledPromiseArray(this).promise();\n};\n};\n\n},{\"./util.js\":38}],33:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports =\nfunction(Promise, PromiseArray, apiRejection) {\nvar util = _dereq_(\"./util.js\");\nvar RangeError = _dereq_(\"./errors.js\").RangeError;\nvar AggregateError = _dereq_(\"./errors.js\").AggregateError;\nvar isArray = util.isArray;\n\n\nfunction SomePromiseArray(values) {\n this.constructor$(values);\n this._howMany = 0;\n this._unwrap = false;\n this._initialized = false;\n}\nutil.inherits(SomePromiseArray, PromiseArray);\n\nSomePromiseArray.prototype._init = function () {\n if (!this._initialized) {\n return;\n }\n if (this._howMany === 0) {\n this._resolve([]);\n return;\n }\n this._init$(undefined, -5);\n var isArrayResolved = isArray(this._values);\n if (!this._isResolved() &&\n isArrayResolved &&\n this._howMany > this._canPossiblyFulfill()) {\n this._reject(this._getRangeError(this.length()));\n }\n};\n\nSomePromiseArray.prototype.init = function () {\n this._initialized = true;\n this._init();\n};\n\nSomePromiseArray.prototype.setUnwrap = function () {\n this._unwrap = true;\n};\n\nSomePromiseArray.prototype.howMany = function () {\n return this._howMany;\n};\n\nSomePromiseArray.prototype.setHowMany = function (count) {\n this._howMany = count;\n};\n\nSomePromiseArray.prototype._promiseFulfilled = function (value) {\n this._addFulfilled(value);\n if (this._fulfilled() === this.howMany()) {\n this._values.length = this.howMany();\n if (this.howMany() === 1 && this._unwrap) {\n this._resolve(this._values[0]);\n } else {\n this._resolve(this._values);\n }\n }\n\n};\nSomePromiseArray.prototype._promiseRejected = function (reason) {\n this._addRejected(reason);\n if (this.howMany() > this._canPossiblyFulfill()) {\n var e = new AggregateError();\n for (var i = this.length(); i < this._values.length; ++i) {\n e.push(this._values[i]);\n }\n this._reject(e);\n }\n};\n\nSomePromiseArray.prototype._fulfilled = function () {\n return this._totalResolved;\n};\n\nSomePromiseArray.prototype._rejected = function () {\n return this._values.length - this.length();\n};\n\nSomePromiseArray.prototype._addRejected = function (reason) {\n this._values.push(reason);\n};\n\nSomePromiseArray.prototype._addFulfilled = function (value) {\n this._values[this._totalResolved++] = value;\n};\n\nSomePromiseArray.prototype._canPossiblyFulfill = function () {\n return this.length() - this._rejected();\n};\n\nSomePromiseArray.prototype._getRangeError = function (count) {\n var message = \"Input array must contain at least \" +\n this._howMany + \" items but contains only \" + count + \" items\";\n return new RangeError(message);\n};\n\nSomePromiseArray.prototype._resolveEmptyArray = function () {\n this._reject(this._getRangeError(0));\n};\n\nfunction some(promises, howMany) {\n if ((howMany | 0) !== howMany || howMany < 0) {\n return apiRejection(\"expecting a positive integer\\u000a\\u000a See http://goo.gl/1wAmHx\\u000a\");\n }\n var ret = new SomePromiseArray(promises);\n var promise = ret.promise();\n ret.setHowMany(howMany);\n ret.init();\n return promise;\n}\n\nPromise.some = function (promises, howMany) {\n return some(promises, howMany);\n};\n\nPromise.prototype.some = function (howMany) {\n return some(this, howMany);\n};\n\nPromise._SomePromiseArray = SomePromiseArray;\n};\n\n},{\"./errors.js\":13,\"./util.js\":38}],34:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise) {\nfunction PromiseInspection(promise) {\n if (promise !== undefined) {\n promise = promise._target();\n this._bitField = promise._bitField;\n this._settledValue = promise._settledValue;\n }\n else {\n this._bitField = 0;\n this._settledValue = undefined;\n }\n}\n\nPromiseInspection.prototype.value = function () {\n if (!this.isFulfilled()) {\n throw new TypeError(\"cannot get fulfillment value of a non-fulfilled promise\\u000a\\u000a See http://goo.gl/hc1DLj\\u000a\");\n }\n return this._settledValue;\n};\n\nPromiseInspection.prototype.error =\nPromiseInspection.prototype.reason = function () {\n if (!this.isRejected()) {\n throw new TypeError(\"cannot get rejection reason of a non-rejected promise\\u000a\\u000a See http://goo.gl/hPuiwB\\u000a\");\n }\n return this._settledValue;\n};\n\nPromiseInspection.prototype.isFulfilled =\nPromise.prototype._isFulfilled = function () {\n return (this._bitField & 268435456) > 0;\n};\n\nPromiseInspection.prototype.isRejected =\nPromise.prototype._isRejected = function () {\n return (this._bitField & 134217728) > 0;\n};\n\nPromiseInspection.prototype.isPending =\nPromise.prototype._isPending = function () {\n return (this._bitField & 402653184) === 0;\n};\n\nPromiseInspection.prototype.isResolved =\nPromise.prototype._isResolved = function () {\n return (this._bitField & 402653184) > 0;\n};\n\nPromise.prototype.isPending = function() {\n return this._target()._isPending();\n};\n\nPromise.prototype.isRejected = function() {\n return this._target()._isRejected();\n};\n\nPromise.prototype.isFulfilled = function() {\n return this._target()._isFulfilled();\n};\n\nPromise.prototype.isResolved = function() {\n return this._target()._isResolved();\n};\n\nPromise.prototype._value = function() {\n return this._settledValue;\n};\n\nPromise.prototype._reason = function() {\n this._unsetRejectionIsUnhandled();\n return this._settledValue;\n};\n\nPromise.prototype.value = function() {\n var target = this._target();\n if (!target.isFulfilled()) {\n throw new TypeError(\"cannot get fulfillment value of a non-fulfilled promise\\u000a\\u000a See http://goo.gl/hc1DLj\\u000a\");\n }\n return target._settledValue;\n};\n\nPromise.prototype.reason = function() {\n var target = this._target();\n if (!target.isRejected()) {\n throw new TypeError(\"cannot get rejection reason of a non-rejected promise\\u000a\\u000a See http://goo.gl/hPuiwB\\u000a\");\n }\n target._unsetRejectionIsUnhandled();\n return target._settledValue;\n};\n\n\nPromise.PromiseInspection = PromiseInspection;\n};\n\n},{}],35:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL) {\nvar util = _dereq_(\"./util.js\");\nvar errorObj = util.errorObj;\nvar isObject = util.isObject;\n\nfunction tryConvertToPromise(obj, context) {\n if (isObject(obj)) {\n if (obj instanceof Promise) {\n return obj;\n }\n else if (isAnyBluebirdPromise(obj)) {\n var ret = new Promise(INTERNAL);\n obj._then(\n ret._fulfillUnchecked,\n ret._rejectUncheckedCheckError,\n ret._progressUnchecked,\n ret,\n null\n );\n return ret;\n }\n var then = util.tryCatch(getThen)(obj);\n if (then === errorObj) {\n if (context) context._pushContext();\n var ret = Promise.reject(then.e);\n if (context) context._popContext();\n return ret;\n } else if (typeof then === \"function\") {\n return doThenable(obj, then, context);\n }\n }\n return obj;\n}\n\nfunction getThen(obj) {\n return obj.then;\n}\n\nvar hasProp = {}.hasOwnProperty;\nfunction isAnyBluebirdPromise(obj) {\n return hasProp.call(obj, \"_promise0\");\n}\n\nfunction doThenable(x, then, context) {\n var promise = new Promise(INTERNAL);\n var ret = promise;\n if (context) context._pushContext();\n promise._captureStackTrace();\n if (context) context._popContext();\n var synchronous = true;\n var result = util.tryCatch(then).call(x,\n resolveFromThenable,\n rejectFromThenable,\n progressFromThenable);\n synchronous = false;\n if (promise && result === errorObj) {\n promise._rejectCallback(result.e, true, true);\n promise = null;\n }\n\n function resolveFromThenable(value) {\n if (!promise) return;\n if (x === value) {\n promise._rejectCallback(\n Promise._makeSelfResolutionError(), false, true);\n } else {\n promise._resolveCallback(value);\n }\n promise = null;\n }\n\n function rejectFromThenable(reason) {\n if (!promise) return;\n promise._rejectCallback(reason, synchronous, true);\n promise = null;\n }\n\n function progressFromThenable(value) {\n if (!promise) return;\n if (typeof promise._progress === \"function\") {\n promise._progress(value);\n }\n }\n return ret;\n}\n\nreturn tryConvertToPromise;\n};\n\n},{\"./util.js\":38}],36:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL) {\nvar util = _dereq_(\"./util.js\");\nvar TimeoutError = Promise.TimeoutError;\n\nvar afterTimeout = function (promise, message) {\n if (!promise.isPending()) return;\n if (typeof message !== \"string\") {\n message = \"operation timed out\";\n }\n var err = new TimeoutError(message);\n util.markAsOriginatingFromRejection(err);\n promise._attachExtraTrace(err);\n promise._cancel(err);\n};\n\nvar afterValue = function(value) { return delay(+this).thenReturn(value); };\nvar delay = Promise.delay = function (value, ms) {\n if (ms === undefined) {\n ms = value;\n value = undefined;\n var ret = new Promise(INTERNAL);\n setTimeout(function() { ret._fulfill(); }, ms);\n return ret;\n }\n ms = +ms;\n return Promise.resolve(value)._then(afterValue, null, null, ms, undefined);\n};\n\nPromise.prototype.delay = function (ms) {\n return delay(this, ms);\n};\n\nfunction successClear(value) {\n var handle = this;\n if (handle instanceof Number) handle = +handle;\n clearTimeout(handle);\n return value;\n}\n\nfunction failureClear(reason) {\n var handle = this;\n if (handle instanceof Number) handle = +handle;\n clearTimeout(handle);\n throw reason;\n}\n\nPromise.prototype.timeout = function (ms, message) {\n ms = +ms;\n var ret = this.then().cancellable();\n ret._cancellationParent = this;\n var handle = setTimeout(function timeoutTimeout() {\n afterTimeout(ret, message);\n }, ms);\n return ret._then(successClear, failureClear, undefined, handle, undefined);\n};\n\n};\n\n},{\"./util.js\":38}],37:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function (Promise, apiRejection, tryConvertToPromise,\n createContext) {\n var TypeError = _dereq_(\"./errors.js\").TypeError;\n var inherits = _dereq_(\"./util.js\").inherits;\n var PromiseInspection = Promise.PromiseInspection;\n\n function inspectionMapper(inspections) {\n var len = inspections.length;\n for (var i = 0; i < len; ++i) {\n var inspection = inspections[i];\n if (inspection.isRejected()) {\n return Promise.reject(inspection.error());\n }\n inspections[i] = inspection._settledValue;\n }\n return inspections;\n }\n\n function thrower(e) {\n setTimeout(function(){throw e;}, 0);\n }\n\n function castPreservingDisposable(thenable) {\n var maybePromise = tryConvertToPromise(thenable);\n if (maybePromise !== thenable &&\n typeof thenable._isDisposable === \"function\" &&\n typeof thenable._getDisposer === \"function\" &&\n thenable._isDisposable()) {\n maybePromise._setDisposable(thenable._getDisposer());\n }\n return maybePromise;\n }\n function dispose(resources, inspection) {\n var i = 0;\n var len = resources.length;\n var ret = Promise.defer();\n function iterator() {\n if (i >= len) return ret.resolve();\n var maybePromise = castPreservingDisposable(resources[i++]);\n if (maybePromise instanceof Promise &&\n maybePromise._isDisposable()) {\n try {\n maybePromise = tryConvertToPromise(\n maybePromise._getDisposer().tryDispose(inspection),\n resources.promise);\n } catch (e) {\n return thrower(e);\n }\n if (maybePromise instanceof Promise) {\n return maybePromise._then(iterator, thrower,\n null, null, null);\n }\n }\n iterator();\n }\n iterator();\n return ret.promise;\n }\n\n function disposerSuccess(value) {\n var inspection = new PromiseInspection();\n inspection._settledValue = value;\n inspection._bitField = 268435456;\n return dispose(this, inspection).thenReturn(value);\n }\n\n function disposerFail(reason) {\n var inspection = new PromiseInspection();\n inspection._settledValue = reason;\n inspection._bitField = 134217728;\n return dispose(this, inspection).thenThrow(reason);\n }\n\n function Disposer(data, promise, context) {\n this._data = data;\n this._promise = promise;\n this._context = context;\n }\n\n Disposer.prototype.data = function () {\n return this._data;\n };\n\n Disposer.prototype.promise = function () {\n return this._promise;\n };\n\n Disposer.prototype.resource = function () {\n if (this.promise().isFulfilled()) {\n return this.promise().value();\n }\n return null;\n };\n\n Disposer.prototype.tryDispose = function(inspection) {\n var resource = this.resource();\n var context = this._context;\n if (context !== undefined) context._pushContext();\n var ret = resource !== null\n ? this.doDispose(resource, inspection) : null;\n if (context !== undefined) context._popContext();\n this._promise._unsetDisposable();\n this._data = null;\n return ret;\n };\n\n Disposer.isDisposer = function (d) {\n return (d != null &&\n typeof d.resource === \"function\" &&\n typeof d.tryDispose === \"function\");\n };\n\n function FunctionDisposer(fn, promise, context) {\n this.constructor$(fn, promise, context);\n }\n inherits(FunctionDisposer, Disposer);\n\n FunctionDisposer.prototype.doDispose = function (resource, inspection) {\n var fn = this.data();\n return fn.call(resource, resource, inspection);\n };\n\n function maybeUnwrapDisposer(value) {\n if (Disposer.isDisposer(value)) {\n this.resources[this.index]._setDisposable(value);\n return value.promise();\n }\n return value;\n }\n\n Promise.using = function () {\n var len = arguments.length;\n if (len < 2) return apiRejection(\n \"you must pass at least 2 arguments to Promise.using\");\n var fn = arguments[len - 1];\n if (typeof fn !== \"function\") return apiRejection(\"fn must be a function\\u000a\\u000a See http://goo.gl/916lJJ\\u000a\");\n len--;\n var resources = new Array(len);\n for (var i = 0; i < len; ++i) {\n var resource = arguments[i];\n if (Disposer.isDisposer(resource)) {\n var disposer = resource;\n resource = resource.promise();\n resource._setDisposable(disposer);\n } else {\n var maybePromise = tryConvertToPromise(resource);\n if (maybePromise instanceof Promise) {\n resource =\n maybePromise._then(maybeUnwrapDisposer, null, null, {\n resources: resources,\n index: i\n }, undefined);\n }\n }\n resources[i] = resource;\n }\n\n var promise = Promise.settle(resources)\n .then(inspectionMapper)\n .then(function(vals) {\n promise._pushContext();\n var ret;\n try {\n ret = fn.apply(undefined, vals);\n } finally {\n promise._popContext();\n }\n return ret;\n })\n ._then(\n disposerSuccess, disposerFail, undefined, resources, undefined);\n resources.promise = promise;\n return promise;\n };\n\n Promise.prototype._setDisposable = function (disposer) {\n this._bitField = this._bitField | 262144;\n this._disposer = disposer;\n };\n\n Promise.prototype._isDisposable = function () {\n return (this._bitField & 262144) > 0;\n };\n\n Promise.prototype._getDisposer = function () {\n return this._disposer;\n };\n\n Promise.prototype._unsetDisposable = function () {\n this._bitField = this._bitField & (~262144);\n this._disposer = undefined;\n };\n\n Promise.prototype.disposer = function (fn) {\n if (typeof fn === \"function\") {\n return new FunctionDisposer(fn, this, createContext());\n }\n throw new TypeError();\n };\n\n};\n\n},{\"./errors.js\":13,\"./util.js\":38}],38:[function(_dereq_,module,exports){\n\"use strict\";\nvar es5 = _dereq_(\"./es5.js\");\nvar canEvaluate = typeof navigator == \"undefined\";\nvar haveGetters = (function(){\n try {\n var o = {};\n es5.defineProperty(o, \"f\", {\n get: function () {\n return 3;\n }\n });\n return o.f === 3;\n }\n catch (e) {\n return false;\n }\n\n})();\n\nvar errorObj = {e: {}};\nvar tryCatchTarget;\nfunction tryCatcher() {\n try {\n return tryCatchTarget.apply(this, arguments);\n } catch (e) {\n errorObj.e = e;\n return errorObj;\n }\n}\nfunction tryCatch(fn) {\n tryCatchTarget = fn;\n return tryCatcher;\n}\n\nvar inherits = function(Child, Parent) {\n var hasProp = {}.hasOwnProperty;\n\n function T() {\n this.constructor = Child;\n this.constructor$ = Parent;\n for (var propertyName in Parent.prototype) {\n if (hasProp.call(Parent.prototype, propertyName) &&\n propertyName.charAt(propertyName.length-1) !== \"$\"\n ) {\n this[propertyName + \"$\"] = Parent.prototype[propertyName];\n }\n }\n }\n T.prototype = Parent.prototype;\n Child.prototype = new T();\n return Child.prototype;\n};\n\n\nfunction isPrimitive(val) {\n return val == null || val === true || val === false ||\n typeof val === \"string\" || typeof val === \"number\";\n\n}\n\nfunction isObject(value) {\n return !isPrimitive(value);\n}\n\nfunction maybeWrapAsError(maybeError) {\n if (!isPrimitive(maybeError)) return maybeError;\n\n return new Error(safeToString(maybeError));\n}\n\nfunction withAppended(target, appendee) {\n var len = target.length;\n var ret = new Array(len + 1);\n var i;\n for (i = 0; i < len; ++i) {\n ret[i] = target[i];\n }\n ret[i] = appendee;\n return ret;\n}\n\nfunction getDataPropertyOrDefault(obj, key, defaultValue) {\n if (es5.isES5) {\n var desc = Object.getOwnPropertyDescriptor(obj, key);\n if (desc != null) {\n return desc.get == null && desc.set == null\n ? desc.value\n : defaultValue;\n }\n } else {\n return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined;\n }\n}\n\nfunction notEnumerableProp(obj, name, value) {\n if (isPrimitive(obj)) return obj;\n var descriptor = {\n value: value,\n configurable: true,\n enumerable: false,\n writable: true\n };\n es5.defineProperty(obj, name, descriptor);\n return obj;\n}\n\n\nvar wrapsPrimitiveReceiver = (function() {\n return this !== \"string\";\n}).call(\"string\");\n\nfunction thrower(r) {\n throw r;\n}\n\nvar inheritedDataKeys = (function() {\n if (es5.isES5) {\n var oProto = Object.prototype;\n var getKeys = Object.getOwnPropertyNames;\n return function(obj) {\n var ret = [];\n var visitedKeys = Object.create(null);\n while (obj != null && obj !== oProto) {\n var keys;\n try {\n keys = getKeys(obj);\n } catch (e) {\n return ret;\n }\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n if (visitedKeys[key]) continue;\n visitedKeys[key] = true;\n var desc = Object.getOwnPropertyDescriptor(obj, key);\n if (desc != null && desc.get == null && desc.set == null) {\n ret.push(key);\n }\n }\n obj = es5.getPrototypeOf(obj);\n }\n return ret;\n };\n } else {\n return function(obj) {\n var ret = [];\n /*jshint forin:false */\n for (var key in obj) {\n ret.push(key);\n }\n return ret;\n };\n }\n\n})();\n\nfunction isClass(fn) {\n try {\n if (typeof fn === \"function\") {\n var keys = es5.names(fn.prototype);\n if (es5.isES5) return keys.length > 1;\n return keys.length > 0 &&\n !(keys.length === 1 && keys[0] === \"constructor\");\n }\n return false;\n } catch (e) {\n return false;\n }\n}\n\nfunction toFastProperties(obj) {\n /*jshint -W027*/\n function f() {}\n f.prototype = obj;\n return f;\n eval(obj);\n}\n\nvar rident = /^[a-z$_][a-z$_0-9]*$/i;\nfunction isIdentifier(str) {\n return rident.test(str);\n}\n\nfunction filledRange(count, prefix, suffix) {\n var ret = new Array(count);\n for(var i = 0; i < count; ++i) {\n ret[i] = prefix + i + suffix;\n }\n return ret;\n}\n\nfunction safeToString(obj) {\n try {\n return obj + \"\";\n } catch (e) {\n return \"[no string representation]\";\n }\n}\n\nfunction markAsOriginatingFromRejection(e) {\n try {\n notEnumerableProp(e, \"isOperational\", true);\n }\n catch(ignore) {}\n}\n\nfunction originatesFromRejection(e) {\n if (e == null) return false;\n return ((e instanceof Error[\"__BluebirdErrorTypes__\"].OperationalError) ||\n e[\"isOperational\"] === true);\n}\n\nfunction canAttachTrace(obj) {\n return obj instanceof Error && es5.propertyIsWritable(obj, \"stack\");\n}\n\nvar ensureErrorObject = (function() {\n if (!(\"stack\" in new Error())) {\n return function(value) {\n if (canAttachTrace(value)) return value;\n try {throw new Error(safeToString(value));}\n catch(err) {return err;}\n };\n } else {\n return function(value) {\n if (canAttachTrace(value)) return value;\n return new Error(safeToString(value));\n };\n }\n})();\n\nfunction classString(obj) {\n return {}.toString.call(obj);\n}\n\nfunction copyDescriptors(from, to, filter) {\n var keys = es5.names(from);\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n if (filter(key)) {\n es5.defineProperty(to, key, es5.getDescriptor(from, key));\n }\n }\n}\n\nvar ret = {\n isClass: isClass,\n isIdentifier: isIdentifier,\n inheritedDataKeys: inheritedDataKeys,\n getDataPropertyOrDefault: getDataPropertyOrDefault,\n thrower: thrower,\n isArray: es5.isArray,\n haveGetters: haveGetters,\n notEnumerableProp: notEnumerableProp,\n isPrimitive: isPrimitive,\n isObject: isObject,\n canEvaluate: canEvaluate,\n errorObj: errorObj,\n tryCatch: tryCatch,\n inherits: inherits,\n withAppended: withAppended,\n maybeWrapAsError: maybeWrapAsError,\n wrapsPrimitiveReceiver: wrapsPrimitiveReceiver,\n toFastProperties: toFastProperties,\n filledRange: filledRange,\n toString: safeToString,\n canAttachTrace: canAttachTrace,\n ensureErrorObject: ensureErrorObject,\n originatesFromRejection: originatesFromRejection,\n markAsOriginatingFromRejection: markAsOriginatingFromRejection,\n classString: classString,\n copyDescriptors: copyDescriptors,\n isNode: typeof process !== \"undefined\" &&\n classString(process).toLowerCase() === \"[object process]\"\n};\ntry {throw new Error(); } catch (e) {ret.lastLineError = e;}\nmodule.exports = ret;\n\n},{\"./es5.js\":14}]},{},[4])(4)\n}); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; }\n}).call(this,require('_process'),typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"_process\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/process/browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/lib/_empty.js\":[function(require,module,exports){\n\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/browser-resolve/empty.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/lib/_empty.js\"][0].apply(exports,arguments)\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\":[function(require,module,exports){\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('is-array')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\nBuffer.poolSize = 8192 // not used by this implementation\n\nvar kMaxLength = 0x3fffffff\nvar rootParent = {}\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Note:\n *\n * - Implementation must support adding new properties to `Uint8Array` instances.\n * Firefox 4-29 lacked support, fixed in Firefox 30+.\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n *\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they will\n * get the Object implementation, which is slower but will work correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = (function () {\n try {\n var buf = new ArrayBuffer(0)\n var arr = new Uint8Array(buf)\n arr.foo = function () { return 42 }\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n new Uint8Array(1).subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n})()\n\n/**\n * Class: Buffer\n * =============\n *\n * The Buffer constructor returns instances of `Uint8Array` that are augmented\n * with function properties for all the node `Buffer` API functions. We use\n * `Uint8Array` so that square bracket notation works as expected -- it returns\n * a single octet.\n *\n * By augmenting the instances, we can avoid modifying the `Uint8Array`\n * prototype.\n */\nfunction Buffer (subject, encoding) {\n var self = this\n if (!(self instanceof Buffer)) return new Buffer(subject, encoding)\n\n var type = typeof subject\n var length\n\n if (type === 'number') {\n length = +subject\n } else if (type === 'string') {\n length = Buffer.byteLength(subject, encoding)\n } else if (type === 'object' && subject !== null) {\n // assume object is array-like\n if (subject.type === 'Buffer' && isArray(subject.data)) subject = subject.data\n length = +subject.length\n } else {\n throw new TypeError('must start with number, buffer, array or string')\n }\n\n if (length > kMaxLength) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum size: 0x' +\n kMaxLength.toString(16) + ' bytes')\n }\n\n if (length < 0) length = 0\n else length >>>= 0 // coerce to uint32\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Preferred: Return an augmented `Uint8Array` instance for best performance\n self = Buffer._augment(new Uint8Array(length)) // eslint-disable-line consistent-this\n } else {\n // Fallback: Return THIS instance of Buffer (created by `new`)\n self.length = length\n self._isBuffer = true\n }\n\n var i\n if (Buffer.TYPED_ARRAY_SUPPORT && typeof subject.byteLength === 'number') {\n // Speed optimization -- use set if we're copying from a typed array\n self._set(subject)\n } else if (isArrayish(subject)) {\n // Treat array-ish objects as a byte array\n if (Buffer.isBuffer(subject)) {\n for (i = 0; i < length; i++) {\n self[i] = subject.readUInt8(i)\n }\n } else {\n for (i = 0; i < length; i++) {\n self[i] = ((subject[i] % 256) + 256) % 256\n }\n }\n } else if (type === 'string') {\n self.write(subject, 0, encoding)\n } else if (type === 'number' && !Buffer.TYPED_ARRAY_SUPPORT) {\n for (i = 0; i < length; i++) {\n self[i] = 0\n }\n }\n\n if (length > 0 && length <= Buffer.poolSize) self.parent = rootParent\n\n return self\n}\n\nfunction SlowBuffer (subject, encoding) {\n if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding)\n\n var buf = new Buffer(subject, encoding)\n delete buf.parent\n return buf\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n for (var i = 0, len = Math.min(x, y); i < len && a[i] === b[i]; i++) {}\n if (i !== len) {\n x = a[i]\n y = b[i]\n }\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'binary':\n case 'base64':\n case 'raw':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, totalLength) {\n if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.')\n\n if (list.length === 0) {\n return new Buffer(0)\n } else if (list.length === 1) {\n return list[0]\n }\n\n var i\n if (totalLength === undefined) {\n totalLength = 0\n for (i = 0; i < list.length; i++) {\n totalLength += list[i].length\n }\n }\n\n var buf = new Buffer(totalLength)\n var pos = 0\n for (i = 0; i < list.length; i++) {\n var item = list[i]\n item.copy(buf, pos)\n pos += item.length\n }\n return buf\n}\n\nBuffer.byteLength = function byteLength (str, encoding) {\n var ret\n str = str + ''\n switch (encoding || 'utf8') {\n case 'ascii':\n case 'binary':\n case 'raw':\n ret = str.length\n break\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n ret = str.length * 2\n break\n case 'hex':\n ret = str.length >>> 1\n break\n case 'utf8':\n case 'utf-8':\n ret = utf8ToBytes(str).length\n break\n case 'base64':\n ret = base64ToBytes(str).length\n break\n default:\n ret = str.length\n }\n return ret\n}\n\n// pre-set for values that may exist in the future\nBuffer.prototype.length = undefined\nBuffer.prototype.parent = undefined\n\n// toString(encoding, start=0, end=buffer.length)\nBuffer.prototype.toString = function toString (encoding, start, end) {\n var loweredCase = false\n\n start = start >>> 0\n end = end === undefined || end === Infinity ? this.length : end >>> 0\n\n if (!encoding) encoding = 'utf8'\n if (start < 0) start = 0\n if (end > this.length) end = this.length\n if (end <= start) return ''\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'binary':\n return binarySlice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return 0\n return Buffer.compare(this, b)\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset) {\n if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff\n else if (byteOffset < -0x80000000) byteOffset = -0x80000000\n byteOffset >>= 0\n\n if (this.length === 0) return -1\n if (byteOffset >= this.length) return -1\n\n // Negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)\n\n if (typeof val === 'string') {\n if (val.length === 0) return -1 // special case: looking for empty string always fails\n return String.prototype.indexOf.call(this, val, byteOffset)\n }\n if (Buffer.isBuffer(val)) {\n return arrayIndexOf(this, val, byteOffset)\n }\n if (typeof val === 'number') {\n if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {\n return Uint8Array.prototype.indexOf.call(this, val, byteOffset)\n }\n return arrayIndexOf(this, [ val ], byteOffset)\n }\n\n function arrayIndexOf (arr, val, byteOffset) {\n var foundIndex = -1\n for (var i = 0; byteOffset + i < arr.length; i++) {\n if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex\n } else {\n foundIndex = -1\n }\n }\n return -1\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\n// `get` will be removed in Node 0.13+\nBuffer.prototype.get = function get (offset) {\n console.log('.get() is deprecated. Access using array indexes instead.')\n return this.readUInt8(offset)\n}\n\n// `set` will be removed in Node 0.13+\nBuffer.prototype.set = function set (v, offset) {\n console.log('.set() is deprecated. Access using array indexes instead.')\n return this.writeUInt8(v, offset)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new Error('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; i++) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) throw new Error('Invalid hex string')\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n var charsWritten = blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n return charsWritten\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n var charsWritten = blitBuffer(asciiToBytes(string), buf, offset, length)\n return charsWritten\n}\n\nfunction binaryWrite (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n var charsWritten = blitBuffer(base64ToBytes(string), buf, offset, length)\n return charsWritten\n}\n\nfunction utf16leWrite (buf, string, offset, length) {\n var charsWritten = blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n return charsWritten\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Support both (string, offset, length, encoding)\n // and the legacy (string, encoding, offset, length)\n if (isFinite(offset)) {\n if (!isFinite(length)) {\n encoding = length\n length = undefined\n }\n } else { // legacy\n var swap = encoding\n encoding = offset\n offset = length\n length = swap\n }\n\n offset = Number(offset) || 0\n\n if (length < 0 || offset < 0 || offset > this.length) {\n throw new RangeError('attempt to write outside buffer bounds')\n }\n\n var remaining = this.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n encoding = String(encoding || 'utf8').toLowerCase()\n\n var ret\n switch (encoding) {\n case 'hex':\n ret = hexWrite(this, string, offset, length)\n break\n case 'utf8':\n case 'utf-8':\n ret = utf8Write(this, string, offset, length)\n break\n case 'ascii':\n ret = asciiWrite(this, string, offset, length)\n break\n case 'binary':\n ret = binaryWrite(this, string, offset, length)\n break\n case 'base64':\n ret = base64Write(this, string, offset, length)\n break\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n ret = utf16leWrite(this, string, offset, length)\n break\n default:\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n return ret\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n var res = ''\n var tmp = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; i++) {\n if (buf[i] <= 0x7F) {\n res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i])\n tmp = ''\n } else {\n tmp += '%' + buf[i].toString(16)\n }\n }\n\n return res + decodeUtf8Char(tmp)\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; i++) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction binarySlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; i++) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; i++) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = Buffer._augment(this.subarray(start, end))\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; i++) {\n newBuf[i] = this[i + start]\n }\n }\n\n if (newBuf.length) newBuf.parent = this.parent || this\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('value is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) >>> 0 & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) >>> 0 & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = value\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = value\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = value\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = value\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = value\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkInt(\n this, value, offset, byteLength,\n Math.pow(2, 8 * byteLength - 1) - 1,\n -Math.pow(2, 8 * byteLength - 1)\n )\n }\n\n var i = 0\n var mul = 1\n var sub = value < 0 ? 1 : 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkInt(\n this, value, offset, byteLength,\n Math.pow(2, 8 * byteLength - 1) - 1,\n -Math.pow(2, 8 * byteLength - 1)\n )\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = value < 0 ? 1 : 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = value\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = value\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = value\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = value\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = value\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (value > max || value < min) throw new RangeError('value is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('index out of range')\n if (offset < 0) throw new RangeError('index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, target_start, start, end) {\n var self = this // source\n\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (target_start >= target.length) target_start = target.length\n if (!target_start) target_start = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || self.length === 0) return 0\n\n // Fatal error conditions\n if (target_start < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= self.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - target_start < end - start) {\n end = target.length - target_start + start\n }\n\n var len = end - start\n\n if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < len; i++) {\n target[i + target_start] = this[i + start]\n }\n } else {\n target._set(this.subarray(start, start + len), target_start)\n }\n\n return len\n}\n\n// fill(value, start=0, end=buffer.length)\nBuffer.prototype.fill = function fill (value, start, end) {\n if (!value) value = 0\n if (!start) start = 0\n if (!end) end = this.length\n\n if (end < start) throw new RangeError('end < start')\n\n // Fill 0 bytes; we're done\n if (end === start) return\n if (this.length === 0) return\n\n if (start < 0 || start >= this.length) throw new RangeError('start out of bounds')\n if (end < 0 || end > this.length) throw new RangeError('end out of bounds')\n\n var i\n if (typeof value === 'number') {\n for (i = start; i < end; i++) {\n this[i] = value\n }\n } else {\n var bytes = utf8ToBytes(value.toString())\n var len = bytes.length\n for (i = start; i < end; i++) {\n this[i] = bytes[i % len]\n }\n }\n\n return this\n}\n\n/**\n * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.\n * Added in Node 0.12. Only available in browsers that support ArrayBuffer.\n */\nBuffer.prototype.toArrayBuffer = function toArrayBuffer () {\n if (typeof Uint8Array !== 'undefined') {\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n return (new Buffer(this)).buffer\n } else {\n var buf = new Uint8Array(this.length)\n for (var i = 0, len = buf.length; i < len; i += 1) {\n buf[i] = this[i]\n }\n return buf.buffer\n }\n } else {\n throw new TypeError('Buffer.toArrayBuffer not supported in this browser')\n }\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar BP = Buffer.prototype\n\n/**\n * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods\n */\nBuffer._augment = function _augment (arr) {\n arr.constructor = Buffer\n arr._isBuffer = true\n\n // save reference to original Uint8Array get/set methods before overwriting\n arr._get = arr.get\n arr._set = arr.set\n\n // deprecated, will be removed in node 0.13+\n arr.get = BP.get\n arr.set = BP.set\n\n arr.write = BP.write\n arr.toString = BP.toString\n arr.toLocaleString = BP.toString\n arr.toJSON = BP.toJSON\n arr.equals = BP.equals\n arr.compare = BP.compare\n arr.indexOf = BP.indexOf\n arr.copy = BP.copy\n arr.slice = BP.slice\n arr.readUIntLE = BP.readUIntLE\n arr.readUIntBE = BP.readUIntBE\n arr.readUInt8 = BP.readUInt8\n arr.readUInt16LE = BP.readUInt16LE\n arr.readUInt16BE = BP.readUInt16BE\n arr.readUInt32LE = BP.readUInt32LE\n arr.readUInt32BE = BP.readUInt32BE\n arr.readIntLE = BP.readIntLE\n arr.readIntBE = BP.readIntBE\n arr.readInt8 = BP.readInt8\n arr.readInt16LE = BP.readInt16LE\n arr.readInt16BE = BP.readInt16BE\n arr.readInt32LE = BP.readInt32LE\n arr.readInt32BE = BP.readInt32BE\n arr.readFloatLE = BP.readFloatLE\n arr.readFloatBE = BP.readFloatBE\n arr.readDoubleLE = BP.readDoubleLE\n arr.readDoubleBE = BP.readDoubleBE\n arr.writeUInt8 = BP.writeUInt8\n arr.writeUIntLE = BP.writeUIntLE\n arr.writeUIntBE = BP.writeUIntBE\n arr.writeUInt16LE = BP.writeUInt16LE\n arr.writeUInt16BE = BP.writeUInt16BE\n arr.writeUInt32LE = BP.writeUInt32LE\n arr.writeUInt32BE = BP.writeUInt32BE\n arr.writeIntLE = BP.writeIntLE\n arr.writeIntBE = BP.writeIntBE\n arr.writeInt8 = BP.writeInt8\n arr.writeInt16LE = BP.writeInt16LE\n arr.writeInt16BE = BP.writeInt16BE\n arr.writeInt32LE = BP.writeInt32LE\n arr.writeInt32BE = BP.writeInt32BE\n arr.writeFloatLE = BP.writeFloatLE\n arr.writeFloatBE = BP.writeFloatBE\n arr.writeDoubleLE = BP.writeDoubleLE\n arr.writeDoubleBE = BP.writeDoubleBE\n arr.fill = BP.fill\n arr.inspect = BP.inspect\n arr.toArrayBuffer = BP.toArrayBuffer\n\n return arr\n}\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-z\\-]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction isArrayish (subject) {\n return isArray(subject) || Buffer.isBuffer(subject) ||\n subject && typeof subject === 'object' &&\n typeof subject.length === 'number'\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n var i = 0\n\n for (; i < length; i++) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (leadSurrogate) {\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n } else {\n // valid surrogate pair\n codePoint = leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00 | 0x10000\n leadSurrogate = null\n }\n } else {\n // no lead yet\n\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else {\n // valid lead\n leadSurrogate = codePoint\n continue\n }\n }\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = null\n }\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x200000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; i++) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; i++) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; i++) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction decodeUtf8Char (str) {\n try {\n return decodeURIComponent(str)\n } catch (err) {\n return String.fromCharCode(0xFFFD) // UTF 8 invalid char\n }\n}\n\n},{\"base64-js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/node_modules/base64-js/lib/b64.js\",\"ieee754\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/node_modules/ieee754/index.js\",\"is-array\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/node_modules/is-array/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/node_modules/base64-js/lib/b64.js\":[function(require,module,exports){\nvar lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n;(function (exports) {\n\t'use strict';\n\n var Arr = (typeof Uint8Array !== 'undefined')\n ? Uint8Array\n : Array\n\n\tvar PLUS = '+'.charCodeAt(0)\n\tvar SLASH = '/'.charCodeAt(0)\n\tvar NUMBER = '0'.charCodeAt(0)\n\tvar LOWER = 'a'.charCodeAt(0)\n\tvar UPPER = 'A'.charCodeAt(0)\n\tvar PLUS_URL_SAFE = '-'.charCodeAt(0)\n\tvar SLASH_URL_SAFE = '_'.charCodeAt(0)\n\n\tfunction decode (elt) {\n\t\tvar code = elt.charCodeAt(0)\n\t\tif (code === PLUS ||\n\t\t code === PLUS_URL_SAFE)\n\t\t\treturn 62 // '+'\n\t\tif (code === SLASH ||\n\t\t code === SLASH_URL_SAFE)\n\t\t\treturn 63 // '/'\n\t\tif (code < NUMBER)\n\t\t\treturn -1 //no match\n\t\tif (code < NUMBER + 10)\n\t\t\treturn code - NUMBER + 26 + 26\n\t\tif (code < UPPER + 26)\n\t\t\treturn code - UPPER\n\t\tif (code < LOWER + 26)\n\t\t\treturn code - LOWER + 26\n\t}\n\n\tfunction b64ToByteArray (b64) {\n\t\tvar i, j, l, tmp, placeHolders, arr\n\n\t\tif (b64.length % 4 > 0) {\n\t\t\tthrow new Error('Invalid string. Length must be a multiple of 4')\n\t\t}\n\n\t\t// the number of equal signs (place holders)\n\t\t// if there are two placeholders, than the two characters before it\n\t\t// represent one byte\n\t\t// if there is only one, then the three characters before it represent 2 bytes\n\t\t// this is just a cheap hack to not do indexOf twice\n\t\tvar len = b64.length\n\t\tplaceHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0\n\n\t\t// base64 is 4/3 + up to two characters of the original data\n\t\tarr = new Arr(b64.length * 3 / 4 - placeHolders)\n\n\t\t// if there are placeholders, only get up to the last complete 4 chars\n\t\tl = placeHolders > 0 ? b64.length - 4 : b64.length\n\n\t\tvar L = 0\n\n\t\tfunction push (v) {\n\t\t\tarr[L++] = v\n\t\t}\n\n\t\tfor (i = 0, j = 0; i < l; i += 4, j += 3) {\n\t\t\ttmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))\n\t\t\tpush((tmp & 0xFF0000) >> 16)\n\t\t\tpush((tmp & 0xFF00) >> 8)\n\t\t\tpush(tmp & 0xFF)\n\t\t}\n\n\t\tif (placeHolders === 2) {\n\t\t\ttmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)\n\t\t\tpush(tmp & 0xFF)\n\t\t} else if (placeHolders === 1) {\n\t\t\ttmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)\n\t\t\tpush((tmp >> 8) & 0xFF)\n\t\t\tpush(tmp & 0xFF)\n\t\t}\n\n\t\treturn arr\n\t}\n\n\tfunction uint8ToBase64 (uint8) {\n\t\tvar i,\n\t\t\textraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes\n\t\t\toutput = \"\",\n\t\t\ttemp, length\n\n\t\tfunction encode (num) {\n\t\t\treturn lookup.charAt(num)\n\t\t}\n\n\t\tfunction tripletToBase64 (num) {\n\t\t\treturn encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)\n\t\t}\n\n\t\t// go through the array every three bytes, we'll deal with trailing stuff later\n\t\tfor (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {\n\t\t\ttemp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\n\t\t\toutput += tripletToBase64(temp)\n\t\t}\n\n\t\t// pad the end with zeros, but make sure to not forget the extra bytes\n\t\tswitch (extraBytes) {\n\t\t\tcase 1:\n\t\t\t\ttemp = uint8[uint8.length - 1]\n\t\t\t\toutput += encode(temp >> 2)\n\t\t\t\toutput += encode((temp << 4) & 0x3F)\n\t\t\t\toutput += '=='\n\t\t\t\tbreak\n\t\t\tcase 2:\n\t\t\t\ttemp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])\n\t\t\t\toutput += encode(temp >> 10)\n\t\t\t\toutput += encode((temp >> 4) & 0x3F)\n\t\t\t\toutput += encode((temp << 2) & 0x3F)\n\t\t\t\toutput += '='\n\t\t\t\tbreak\n\t\t}\n\n\t\treturn output\n\t}\n\n\texports.toByteArray = b64ToByteArray\n\texports.fromByteArray = uint8ToBase64\n}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))\n\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/node_modules/ieee754/index.js\":[function(require,module,exports){\nexports.read = function(buffer, offset, isLE, mLen, nBytes) {\n var e, m,\n eLen = nBytes * 8 - mLen - 1,\n eMax = (1 << eLen) - 1,\n eBias = eMax >> 1,\n nBits = -7,\n i = isLE ? (nBytes - 1) : 0,\n d = isLE ? -1 : 1,\n s = buffer[offset + i];\n\n i += d;\n\n e = s & ((1 << (-nBits)) - 1);\n s >>= (-nBits);\n nBits += eLen;\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8);\n\n m = e & ((1 << (-nBits)) - 1);\n e >>= (-nBits);\n nBits += mLen;\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8);\n\n if (e === 0) {\n e = 1 - eBias;\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity);\n } else {\n m = m + Math.pow(2, mLen);\n e = e - eBias;\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen);\n};\n\nexports.write = function(buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c,\n eLen = nBytes * 8 - mLen - 1,\n eMax = (1 << eLen) - 1,\n eBias = eMax >> 1,\n rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),\n i = isLE ? 0 : (nBytes - 1),\n d = isLE ? 1 : -1,\n s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;\n\n value = Math.abs(value);\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0;\n e = eMax;\n } else {\n e = Math.floor(Math.log(value) / Math.LN2);\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--;\n c *= 2;\n }\n if (e + eBias >= 1) {\n value += rt / c;\n } else {\n value += rt * Math.pow(2, 1 - eBias);\n }\n if (value * c >= 2) {\n e++;\n c /= 2;\n }\n\n if (e + eBias >= eMax) {\n m = 0;\n e = eMax;\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen);\n e = e + eBias;\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);\n e = 0;\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8);\n\n e = (e << mLen) | m;\n eLen += mLen;\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8);\n\n buffer[offset + i - d] |= s * 128;\n};\n\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/node_modules/is-array/index.js\":[function(require,module,exports){\n\n/**\n * isArray\n */\n\nvar isArray = Array.isArray;\n\n/**\n * toString\n */\n\nvar str = Object.prototype.toString;\n\n/**\n * Whether or not the given `val`\n * is an array.\n *\n * example:\n *\n * isArray([]);\n * // > true\n * isArray(arguments);\n * // > false\n * isArray('');\n * // > false\n *\n * @param {mixed} val\n * @return {bool}\n */\n\nmodule.exports = isArray || function (val) {\n return !! val && '[object Array]' == str.call(val);\n};\n\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/index.js\":[function(require,module,exports){\n'use strict';\n\nexports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require('randombytes')\n\nexports.createHash = exports.Hash = require('create-hash')\n\nexports.createHmac = exports.Hmac = require('create-hmac')\n\nvar hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(Object.keys(require('browserify-sign/algos')))\nexports.getHashes = function () {\n return hashes;\n}\n\nvar p = require('pbkdf2-compat')\nexports.pbkdf2 = p.pbkdf2\nexports.pbkdf2Sync = p.pbkdf2Sync\n\nvar aes = require('browserify-aes');\n[\n 'Cipher',\n 'createCipher',\n 'Cipheriv',\n 'createCipheriv',\n 'Decipher',\n 'createDecipher',\n 'Decipheriv',\n 'createDecipheriv',\n 'getCiphers',\n 'listCiphers'\n].forEach(function (key) {\n exports[key] = aes[key];\n})\n\nvar dh = require('diffie-hellman');\n[\n 'DiffieHellmanGroup',\n 'createDiffieHellmanGroup',\n 'getDiffieHellman',\n 'createDiffieHellman',\n 'DiffieHellman'\n].forEach(function (key) {\n exports[key] = dh[key];\n})\n\nrequire('browserify-sign/inject')(module.exports, exports);\n\nexports.createECDH = require('create-ecdh')\n\nvar publicEncrypt = require('public-encrypt');\n\n[\n 'publicEncrypt',\n 'privateEncrypt',\n 'publicDecrypt',\n 'privateDecrypt'\n].forEach(function (key) {\n exports[key] = publicEncrypt[key];\n})\n\n// the least I can do is make error messages for the rest of the node.js/crypto api.\n;[\n 'createCredentials'\n].forEach(function (name) {\n exports[name] = function () {\n throw new Error([\n 'sorry, ' + name + ' is not implemented yet',\n 'we accept pull requests',\n 'https://github.com/crypto-browserify/crypto-browserify'\n ].join('\\n'));\n }\n})\n\n},{\"browserify-aes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/browser.js\",\"browserify-sign/algos\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/algos.js\",\"browserify-sign/inject\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/inject.js\",\"create-ecdh\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/index.js\",\"create-hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/browser.js\",\"create-hmac\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hmac/browser.js\",\"diffie-hellman\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/browser.js\",\"pbkdf2-compat\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/pbkdf2-compat/browser.js\",\"public-encrypt\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/browser.js\",\"randombytes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/randombytes/browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/EVP_BytesToKey.js\":[function(require,module,exports){\n(function (Buffer){\nvar md5 = require('create-hash/md5');\nmodule.exports = EVP_BytesToKey;\nfunction EVP_BytesToKey(password, keyLen, ivLen) {\n if (!Buffer.isBuffer(password)) {\n password = new Buffer(password, 'binary');\n }\n keyLen = keyLen/8;\n ivLen = ivLen || 0;\n var ki = 0;\n var ii = 0;\n var key = new Buffer(keyLen);\n var iv = new Buffer(ivLen);\n var addmd = 0;\n var md_buf;\n var i;\n var bufs = [];\n while (true) {\n if(addmd++ > 0) {\n bufs.push(md_buf);\n }\n bufs.push(password);\n md_buf = md5(Buffer.concat(bufs));\n bufs = [];\n i = 0;\n if(keyLen > 0) {\n while(true) {\n if(keyLen === 0) {\n break;\n }\n if(i === md_buf.length) {\n break;\n }\n key[ki++] = md_buf[i];\n keyLen--;\n i++;\n }\n }\n if(ivLen > 0 && i !== md_buf.length) {\n while(true) {\n if(ivLen === 0) {\n break;\n }\n if(i === md_buf.length) {\n break;\n }\n iv[ii++] = md_buf[i];\n ivLen--;\n i++;\n }\n }\n if(keyLen === 0 && ivLen === 0) {\n break;\n }\n }\n for(i=0;i uint_max || x < 0 ? (x_pos = Math.abs(x) % uint_max, x < 0 ? uint_max - x_pos : x_pos) : x;\n return ret;\n}\nfunction scrub_vec(v) {\n var i, _i, _ref;\n for (i = _i = 0, _ref = v.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {\n v[i] = 0;\n }\n return false;\n}\n\nfunction Global() {\n var i;\n this.SBOX = [];\n this.INV_SBOX = [];\n this.SUB_MIX = (function() {\n var _i, _results;\n _results = [];\n for (i = _i = 0; _i < 4; i = ++_i) {\n _results.push([]);\n }\n return _results;\n })();\n this.INV_SUB_MIX = (function() {\n var _i, _results;\n _results = [];\n for (i = _i = 0; _i < 4; i = ++_i) {\n _results.push([]);\n }\n return _results;\n })();\n this.init();\n this.RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];\n}\n\nGlobal.prototype.init = function() {\n var d, i, sx, t, x, x2, x4, x8, xi, _i;\n d = (function() {\n var _i, _results;\n _results = [];\n for (i = _i = 0; _i < 256; i = ++_i) {\n if (i < 128) {\n _results.push(i << 1);\n } else {\n _results.push((i << 1) ^ 0x11b);\n }\n }\n return _results;\n })();\n x = 0;\n xi = 0;\n for (i = _i = 0; _i < 256; i = ++_i) {\n sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);\n sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;\n this.SBOX[x] = sx;\n this.INV_SBOX[sx] = x;\n x2 = d[x];\n x4 = d[x2];\n x8 = d[x4];\n t = (d[sx] * 0x101) ^ (sx * 0x1010100);\n this.SUB_MIX[0][x] = (t << 24) | (t >>> 8);\n this.SUB_MIX[1][x] = (t << 16) | (t >>> 16);\n this.SUB_MIX[2][x] = (t << 8) | (t >>> 24);\n this.SUB_MIX[3][x] = t;\n t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);\n this.INV_SUB_MIX[0][sx] = (t << 24) | (t >>> 8);\n this.INV_SUB_MIX[1][sx] = (t << 16) | (t >>> 16);\n this.INV_SUB_MIX[2][sx] = (t << 8) | (t >>> 24);\n this.INV_SUB_MIX[3][sx] = t;\n if (x === 0) {\n x = xi = 1;\n } else {\n x = x2 ^ d[d[d[x8 ^ x2]]];\n xi ^= d[d[xi]];\n }\n }\n return true;\n};\n\nvar G = new Global();\n\n\nAES.blockSize = 4 * 4;\n\nAES.prototype.blockSize = AES.blockSize;\n\nAES.keySize = 256 / 8;\n\nAES.prototype.keySize = AES.keySize;\n\n function bufferToArray(buf) {\n var len = buf.length/4;\n var out = new Array(len);\n var i = -1;\n while (++i < len) {\n out[i] = buf.readUInt32BE(i * 4);\n }\n return out;\n }\nfunction AES(key) {\n this._key = bufferToArray(key);\n this._doReset();\n}\n\nAES.prototype._doReset = function() {\n var invKsRow, keySize, keyWords, ksRow, ksRows, t, _i, _j;\n keyWords = this._key;\n keySize = keyWords.length;\n this._nRounds = keySize + 6;\n ksRows = (this._nRounds + 1) * 4;\n this._keySchedule = [];\n for (ksRow = _i = 0; 0 <= ksRows ? _i < ksRows : _i > ksRows; ksRow = 0 <= ksRows ? ++_i : --_i) {\n this._keySchedule[ksRow] = ksRow < keySize ? keyWords[ksRow] : (t = this._keySchedule[ksRow - 1], (ksRow % keySize) === 0 ? (t = (t << 8) | (t >>> 24), t = (G.SBOX[t >>> 24] << 24) | (G.SBOX[(t >>> 16) & 0xff] << 16) | (G.SBOX[(t >>> 8) & 0xff] << 8) | G.SBOX[t & 0xff], t ^= G.RCON[(ksRow / keySize) | 0] << 24) : keySize > 6 && ksRow % keySize === 4 ? t = (G.SBOX[t >>> 24] << 24) | (G.SBOX[(t >>> 16) & 0xff] << 16) | (G.SBOX[(t >>> 8) & 0xff] << 8) | G.SBOX[t & 0xff] : void 0, this._keySchedule[ksRow - keySize] ^ t);\n }\n this._invKeySchedule = [];\n for (invKsRow = _j = 0; 0 <= ksRows ? _j < ksRows : _j > ksRows; invKsRow = 0 <= ksRows ? ++_j : --_j) {\n ksRow = ksRows - invKsRow;\n t = this._keySchedule[ksRow - (invKsRow % 4 ? 0 : 4)];\n this._invKeySchedule[invKsRow] = invKsRow < 4 || ksRow <= 4 ? t : G.INV_SUB_MIX[0][G.SBOX[t >>> 24]] ^ G.INV_SUB_MIX[1][G.SBOX[(t >>> 16) & 0xff]] ^ G.INV_SUB_MIX[2][G.SBOX[(t >>> 8) & 0xff]] ^ G.INV_SUB_MIX[3][G.SBOX[t & 0xff]];\n }\n return true;\n};\n\nAES.prototype.encryptBlock = function(M) {\n M = bufferToArray(new Buffer(M));\n var out = this._doCryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX);\n var buf = new Buffer(16);\n buf.writeUInt32BE(out[0], 0);\n buf.writeUInt32BE(out[1], 4);\n buf.writeUInt32BE(out[2], 8);\n buf.writeUInt32BE(out[3], 12);\n return buf;\n};\n\nAES.prototype.decryptBlock = function(M) {\n M = bufferToArray(new Buffer(M));\n var temp = [M[3], M[1]];\n M[1] = temp[0];\n M[3] = temp[1];\n var out = this._doCryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX);\n var buf = new Buffer(16);\n buf.writeUInt32BE(out[0], 0);\n buf.writeUInt32BE(out[3], 4);\n buf.writeUInt32BE(out[2], 8);\n buf.writeUInt32BE(out[1], 12);\n return buf;\n};\n\nAES.prototype.scrub = function() {\n scrub_vec(this._keySchedule);\n scrub_vec(this._invKeySchedule);\n scrub_vec(this._key);\n};\n\nAES.prototype._doCryptBlock = function(M, keySchedule, SUB_MIX, SBOX) {\n var ksRow, round, s0, s1, s2, s3, t0, t1, t2, t3, _i, _ref;\n\n s0 = M[0] ^ keySchedule[0];\n s1 = M[1] ^ keySchedule[1];\n s2 = M[2] ^ keySchedule[2];\n s3 = M[3] ^ keySchedule[3];\n ksRow = 4;\n for (round = _i = 1, _ref = this._nRounds; 1 <= _ref ? _i < _ref : _i > _ref; round = 1 <= _ref ? ++_i : --_i) {\n t0 = SUB_MIX[0][s0 >>> 24] ^ SUB_MIX[1][(s1 >>> 16) & 0xff] ^ SUB_MIX[2][(s2 >>> 8) & 0xff] ^ SUB_MIX[3][s3 & 0xff] ^ keySchedule[ksRow++];\n t1 = SUB_MIX[0][s1 >>> 24] ^ SUB_MIX[1][(s2 >>> 16) & 0xff] ^ SUB_MIX[2][(s3 >>> 8) & 0xff] ^ SUB_MIX[3][s0 & 0xff] ^ keySchedule[ksRow++];\n t2 = SUB_MIX[0][s2 >>> 24] ^ SUB_MIX[1][(s3 >>> 16) & 0xff] ^ SUB_MIX[2][(s0 >>> 8) & 0xff] ^ SUB_MIX[3][s1 & 0xff] ^ keySchedule[ksRow++];\n t3 = SUB_MIX[0][s3 >>> 24] ^ SUB_MIX[1][(s0 >>> 16) & 0xff] ^ SUB_MIX[2][(s1 >>> 8) & 0xff] ^ SUB_MIX[3][s2 & 0xff] ^ keySchedule[ksRow++];\n s0 = t0;\n s1 = t1;\n s2 = t2;\n s3 = t3;\n }\n t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];\n t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];\n t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];\n t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];\n return [\n fixup_uint32(t0),\n fixup_uint32(t1),\n fixup_uint32(t2),\n fixup_uint32(t3)\n ];\n\n};\n\n\n\n\n exports.AES = AES;\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/authCipher.js\":[function(require,module,exports){\n(function (Buffer){\nvar aes = require('./aes');\nvar Transform = require('./cipherBase');\nvar inherits = require('inherits');\nvar GHASH = require('./ghash');\nvar xor = require('./xor');\ninherits(StreamCipher, Transform);\nmodule.exports = StreamCipher;\n\nfunction StreamCipher(mode, key, iv, decrypt) {\n if (!(this instanceof StreamCipher)) {\n return new StreamCipher(mode, key, iv);\n }\n Transform.call(this);\n this._finID = Buffer.concat([iv, new Buffer([0, 0, 0, 1])]);\n iv = Buffer.concat([iv, new Buffer([0, 0, 0, 2])]);\n this._cipher = new aes.AES(key);\n this._prev = new Buffer(iv.length);\n this._cache = new Buffer('');\n this._secCache = new Buffer('');\n this._decrypt = decrypt;\n this._alen = 0;\n this._len = 0;\n iv.copy(this._prev);\n this._mode = mode;\n var h = new Buffer(4);\n h.fill(0);\n this._ghash = new GHASH(this._cipher.encryptBlock(h));\n this._authTag = null;\n this._called = false;\n}\nStreamCipher.prototype._update = function (chunk) {\n if (!this._called && this._alen) {\n var rump = 16 - (this._alen % 16);\n if (rump <16) {\n rump = new Buffer(rump);\n rump.fill(0);\n this._ghash.update(rump);\n }\n }\n this._called = true;\n var out = this._mode.encrypt(this, chunk);\n if (this._decrypt) {\n this._ghash.update(chunk);\n } else {\n this._ghash.update(out);\n }\n this._len += chunk.length;\n return out;\n};\nStreamCipher.prototype._final = function () {\n if (this._decrypt && !this._authTag) {\n throw new Error('Unsupported state or unable to authenticate data');\n }\n var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID));\n if (this._decrypt) {\n if (xorTest(tag, this._authTag)) {\n throw new Error('Unsupported state or unable to authenticate data');\n }\n } else {\n this._authTag = tag;\n }\n this._cipher.scrub();\n};\nStreamCipher.prototype.getAuthTag = function getAuthTag () {\n if (!this._decrypt && Buffer.isBuffer(this._authTag)) {\n return this._authTag;\n } else {\n throw new Error('Attempting to get auth tag in unsupported state');\n }\n};\nStreamCipher.prototype.setAuthTag = function setAuthTag (tag) {\n if (this._decrypt) {\n this._authTag = tag;\n } else {\n throw new Error('Attempting to set auth tag in unsupported state');\n }\n};\nStreamCipher.prototype.setAAD = function setAAD (buf) {\n if (!this._called) {\n this._ghash.update(buf);\n this._alen += buf.length;\n } else {\n throw new Error('Attempting to set AAD in unsupported state');\n }\n};\nfunction xorTest(a, b) {\n var out = 0;\n if (a.length !== b.length) {\n out++;\n }\n var len = Math.min(a.length, b.length);\n var i = -1;\n while (++i < len) {\n out += (a[i] ^ b[i]);\n }\n return out;\n}\n\n\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./aes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/aes.js\",\"./cipherBase\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/cipherBase.js\",\"./ghash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/ghash.js\",\"./xor\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/xor.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/browser.js\":[function(require,module,exports){\nvar ciphers = require('./encrypter');\nexports.createCipher = exports.Cipher = ciphers.createCipher;\nexports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv;\nvar deciphers = require('./decrypter');\nexports.createDecipher = exports.Decipher = deciphers.createDecipher;\nexports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv;\nvar modes = require('./modes');\nfunction getCiphers () {\n return Object.keys(modes);\n}\nexports.listCiphers = exports.getCiphers = getCiphers;\n\n},{\"./decrypter\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/decrypter.js\",\"./encrypter\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/encrypter.js\",\"./modes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/cipherBase.js\":[function(require,module,exports){\n(function (Buffer){\nvar Transform = require('stream').Transform;\nvar inherits = require('inherits');\n\nmodule.exports = CipherBase;\ninherits(CipherBase, Transform);\nfunction CipherBase() {\n Transform.call(this);\n}\nCipherBase.prototype.update = function (data, inputEnc, outputEnc) {\n if (typeof data === 'string') {\n data = new Buffer(data, inputEnc);\n }\n var outData = this._update(data);\n if (outputEnc) {\n outData = outData.toString(outputEnc);\n }\n return outData;\n};\nCipherBase.prototype._transform = function (data, _, next) {\n this.push(this._update(data));\n next();\n};\nCipherBase.prototype._flush = function (next) {\n try {\n this.push(this._final());\n } catch(e) {\n return next(e);\n }\n next();\n};\nCipherBase.prototype.final = function (outputEnc) {\n var outData = this._final() || new Buffer('');\n if (outputEnc) {\n outData = outData.toString(outputEnc);\n }\n return outData;\n};\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\",\"stream\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/stream-browserify/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/decrypter.js\":[function(require,module,exports){\n(function (Buffer){\nvar aes = require('./aes');\nvar Transform = require('./cipherBase');\nvar inherits = require('inherits');\nvar modes = require('./modes');\nvar StreamCipher = require('./streamCipher');\nvar AuthCipher = require('./authCipher');\nvar ebtk = require('./EVP_BytesToKey');\n\ninherits(Decipher, Transform);\nfunction Decipher(mode, key, iv) {\n if (!(this instanceof Decipher)) {\n return new Decipher(mode, key, iv);\n }\n Transform.call(this);\n this._cache = new Splitter();\n this._last = void 0;\n this._cipher = new aes.AES(key);\n this._prev = new Buffer(iv.length);\n iv.copy(this._prev);\n this._mode = mode;\n this._autopadding = true;\n}\nDecipher.prototype._update = function (data) {\n this._cache.add(data);\n var chunk;\n var thing;\n var out = [];\n while ((chunk = this._cache.get(this._autopadding))) {\n thing = this._mode.decrypt(this, chunk);\n out.push(thing);\n }\n return Buffer.concat(out);\n};\nDecipher.prototype._final = function () {\n var chunk = this._cache.flush();\n if (this._autopadding) {\n return unpad(this._mode.decrypt(this, chunk));\n } else if (chunk) {\n throw new Error('data not multiple of block length');\n }\n};\nDecipher.prototype.setAutoPadding = function (setTo) {\n this._autopadding = !!setTo;\n};\nfunction Splitter() {\n if (!(this instanceof Splitter)) {\n return new Splitter();\n }\n this.cache = new Buffer('');\n}\nSplitter.prototype.add = function (data) {\n this.cache = Buffer.concat([this.cache, data]);\n};\n\nSplitter.prototype.get = function (autoPadding) {\n var out;\n if (autoPadding) {\n if (this.cache.length > 16) {\n out = this.cache.slice(0, 16);\n this.cache = this.cache.slice(16);\n return out;\n }\n } else {\n if (this.cache.length >= 16) {\n out = this.cache.slice(0, 16);\n this.cache = this.cache.slice(16);\n return out;\n }\n }\n return null;\n};\nSplitter.prototype.flush = function () {\n if (this.cache.length) {\n return this.cache;\n }\n};\nfunction unpad(last) {\n var padded = last[15];\n var i = -1;\n while (++i < padded) {\n if (last[(i + (16 - padded))] !== padded) {\n throw new Error('unable to decrypt data');\n }\n }\n if (padded === 16) {\n return;\n }\n return last.slice(0, 16 - padded);\n}\n\nvar modelist = {\n ECB: require('./modes/ecb'),\n CBC: require('./modes/cbc'),\n CFB: require('./modes/cfb'),\n CFB8: require('./modes/cfb8'),\n CFB1: require('./modes/cfb1'),\n OFB: require('./modes/ofb'),\n CTR: require('./modes/ctr'),\n GCM: require('./modes/ctr')\n};\n\n\nfunction createDecipheriv(suite, password, iv) {\n var config = modes[suite.toLowerCase()];\n if (!config) {\n throw new TypeError('invalid suite type');\n }\n if (typeof iv === 'string') {\n iv = new Buffer(iv);\n }\n if (typeof password === 'string') {\n password = new Buffer(password);\n }\n if (password.length !== config.key/8) {\n throw new TypeError('invalid key length ' + password.length);\n }\n if (iv.length !== config.iv) {\n throw new TypeError('invalid iv length ' + iv.length);\n }\n if (config.type === 'stream') {\n return new StreamCipher(modelist[config.mode], password, iv, true);\n } else if (config.type === 'auth') {\n return new AuthCipher(modelist[config.mode], password, iv, true);\n }\n return new Decipher(modelist[config.mode], password, iv);\n}\n\nfunction createDecipher (suite, password) {\n var config = modes[suite.toLowerCase()];\n if (!config) {\n throw new TypeError('invalid suite type');\n }\n var keys = ebtk(password, config.key, config.iv);\n return createDecipheriv(suite, keys.key, keys.iv);\n}\nexports.createDecipher = createDecipher;\nexports.createDecipheriv = createDecipheriv;\n}).call(this,require(\"buffer\").Buffer)\n},{\"./EVP_BytesToKey\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/EVP_BytesToKey.js\",\"./aes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/aes.js\",\"./authCipher\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/authCipher.js\",\"./cipherBase\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/cipherBase.js\",\"./modes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes.js\",\"./modes/cbc\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cbc.js\",\"./modes/cfb\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb.js\",\"./modes/cfb1\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb1.js\",\"./modes/cfb8\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb8.js\",\"./modes/ctr\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ctr.js\",\"./modes/ecb\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ecb.js\",\"./modes/ofb\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ofb.js\",\"./streamCipher\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/streamCipher.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/encrypter.js\":[function(require,module,exports){\n(function (Buffer){\nvar aes = require('./aes');\nvar Transform = require('./cipherBase');\nvar inherits = require('inherits');\nvar modes = require('./modes');\nvar ebtk = require('./EVP_BytesToKey');\nvar StreamCipher = require('./streamCipher');\nvar AuthCipher = require('./authCipher');\ninherits(Cipher, Transform);\nfunction Cipher(mode, key, iv) {\n if (!(this instanceof Cipher)) {\n return new Cipher(mode, key, iv);\n }\n Transform.call(this);\n this._cache = new Splitter();\n this._cipher = new aes.AES(key);\n this._prev = new Buffer(iv.length);\n iv.copy(this._prev);\n this._mode = mode;\n this._autopadding = true;\n}\nCipher.prototype._update = function (data) {\n this._cache.add(data);\n var chunk;\n var thing;\n var out = [];\n while ((chunk = this._cache.get())) {\n thing = this._mode.encrypt(this, chunk);\n out.push(thing);\n }\n return Buffer.concat(out);\n};\nCipher.prototype._final = function () {\n var chunk = this._cache.flush();\n if (this._autopadding) {\n chunk = this._mode.encrypt(this, chunk);\n this._cipher.scrub();\n return chunk;\n } else if (chunk.toString('hex') !== '10101010101010101010101010101010') {\n this._cipher.scrub();\n throw new Error('data not multiple of block length');\n }\n};\nCipher.prototype.setAutoPadding = function (setTo) {\n this._autopadding = !!setTo;\n};\n\nfunction Splitter() {\n if (!(this instanceof Splitter)) {\n return new Splitter();\n }\n this.cache = new Buffer('');\n}\nSplitter.prototype.add = function (data) {\n this.cache = Buffer.concat([this.cache, data]);\n};\n\nSplitter.prototype.get = function () {\n if (this.cache.length > 15) {\n var out = this.cache.slice(0, 16);\n this.cache = this.cache.slice(16);\n return out;\n }\n return null;\n};\nSplitter.prototype.flush = function () {\n var len = 16 - this.cache.length;\n var padBuff = new Buffer(len);\n\n var i = -1;\n while (++i < len) {\n padBuff.writeUInt8(len, i);\n }\n var out = Buffer.concat([this.cache, padBuff]);\n return out;\n};\nvar modelist = {\n ECB: require('./modes/ecb'),\n CBC: require('./modes/cbc'),\n CFB: require('./modes/cfb'),\n CFB8: require('./modes/cfb8'),\n CFB1: require('./modes/cfb1'),\n OFB: require('./modes/ofb'),\n CTR: require('./modes/ctr'),\n GCM: require('./modes/ctr')\n};\n\nfunction createCipheriv(suite, password, iv) {\n var config = modes[suite.toLowerCase()];\n if (!config) {\n throw new TypeError('invalid suite type');\n }\n if (typeof iv === 'string') {\n iv = new Buffer(iv);\n }\n if (typeof password === 'string') {\n password = new Buffer(password);\n }\n if (password.length !== config.key/8) {\n throw new TypeError('invalid key length ' + password.length);\n }\n if (iv.length !== config.iv) {\n throw new TypeError('invalid iv length ' + iv.length);\n }\n if (config.type === 'stream') {\n return new StreamCipher(modelist[config.mode], password, iv);\n } else if (config.type === 'auth') {\n return new AuthCipher(modelist[config.mode], password, iv);\n }\n return new Cipher(modelist[config.mode], password, iv);\n}\nfunction createCipher (suite, password) {\n var config = modes[suite.toLowerCase()];\n if (!config) {\n throw new TypeError('invalid suite type');\n }\n var keys = ebtk(password, config.key, config.iv);\n return createCipheriv(suite, keys.key, keys.iv);\n}\n\nexports.createCipheriv = createCipheriv;\nexports.createCipher = createCipher;\n}).call(this,require(\"buffer\").Buffer)\n},{\"./EVP_BytesToKey\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/EVP_BytesToKey.js\",\"./aes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/aes.js\",\"./authCipher\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/authCipher.js\",\"./cipherBase\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/cipherBase.js\",\"./modes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes.js\",\"./modes/cbc\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cbc.js\",\"./modes/cfb\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb.js\",\"./modes/cfb1\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb1.js\",\"./modes/cfb8\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb8.js\",\"./modes/ctr\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ctr.js\",\"./modes/ecb\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ecb.js\",\"./modes/ofb\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ofb.js\",\"./streamCipher\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/streamCipher.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/ghash.js\":[function(require,module,exports){\n(function (Buffer){\nvar zeros = new Buffer(16);\nzeros.fill(0);\nmodule.exports = GHASH;\nfunction GHASH(key){\n this.h = key;\n this.state = new Buffer(16);\n this.state.fill(0);\n this.cache = new Buffer('');\n}\n// from http://bitwiseshiftleft.github.io/sjcl/doc/symbols/src/core_gcm.js.html\n// by Juho Vähä-Herttua\nGHASH.prototype.ghash = function (block) {\n var i = -1;\n while (++i < block.length) {\n this.state[i] ^= block[i];\n }\n this._multiply();\n};\n\nGHASH.prototype._multiply = function () {\n var Vi = toArray(this.h);\n var Zi = [0, 0, 0, 0];\n var j, xi, lsb_Vi;\n var i = -1;\n while (++i < 128) {\n xi = (this.state[~~(i/8)] & (1 << (7-i%8))) !== 0;\n if (xi) {\n // Z_i+1 = Z_i ^ V_i\n Zi = xor(Zi, Vi);\n }\n\n // Store the value of LSB(V_i)\n lsb_Vi = (Vi[3] & 1) !== 0;\n\n // V_i+1 = V_i >> 1\n for (j=3; j>0; j--) {\n Vi[j] = (Vi[j] >>> 1) | ((Vi[j-1]&1) << 31);\n }\n Vi[0] = Vi[0] >>> 1;\n\n // If LSB(V_i) is 1, V_i+1 = (V_i >> 1) ^ R\n if (lsb_Vi) {\n Vi[0] = Vi[0] ^ (0xe1 << 24);\n }\n }\n this.state = fromArray(Zi);\n};\nGHASH.prototype.update = function (buf) {\n this.cache = Buffer.concat([this.cache, buf]);\n var chunk;\n while (this.cache.length >= 16) {\n chunk = this.cache.slice(0, 16);\n this.cache = this.cache.slice(16);\n this.ghash(chunk);\n }\n};\nGHASH.prototype.final = function (abl, bl) {\n if (this.cache.length) {\n this.ghash(Buffer.concat([this.cache, zeros], 16));\n }\n this.ghash(fromArray([\n 0, abl,\n 0, bl\n ]));\n return this.state;\n};\n\nfunction toArray(buf) {\n return [\n buf.readUInt32BE(0),\n buf.readUInt32BE(4),\n buf.readUInt32BE(8),\n buf.readUInt32BE(12)\n ];\n}\nfunction fromArray(out) {\n out = out.map(fixup_uint32);\n var buf = new Buffer(16);\n buf.writeUInt32BE(out[0], 0);\n buf.writeUInt32BE(out[1], 4);\n buf.writeUInt32BE(out[2], 8);\n buf.writeUInt32BE(out[3], 12);\n return buf;\n}\nvar uint_max = Math.pow(2, 32);\nfunction fixup_uint32(x) {\n var ret, x_pos;\n ret = x > uint_max || x < 0 ? (x_pos = Math.abs(x) % uint_max, x < 0 ? uint_max - x_pos : x_pos) : x;\n return ret;\n}\nfunction xor(a, b) {\n return [\n a[0] ^ b[0],\n a[1] ^ b[1],\n a[2] ^ b[2],\n a[3] ^ b[3],\n ];\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes.js\":[function(require,module,exports){\nexports['aes-128-ecb'] = {\n cipher: 'AES',\n key: 128,\n iv: 0,\n mode: 'ECB',\n type: 'block'\n};\nexports['aes-192-ecb'] = {\n cipher: 'AES',\n key: 192,\n iv: 0,\n mode: 'ECB',\n type: 'block'\n};\nexports['aes-256-ecb'] = {\n cipher: 'AES',\n key: 256,\n iv: 0,\n mode: 'ECB',\n type: 'block'\n};\nexports['aes-128-cbc'] = {\n cipher: 'AES',\n key: 128,\n iv: 16,\n mode: 'CBC',\n type: 'block'\n};\nexports['aes-192-cbc'] = {\n cipher: 'AES',\n key: 192,\n iv: 16,\n mode: 'CBC',\n type: 'block'\n};\nexports['aes-256-cbc'] = {\n cipher: 'AES',\n key: 256,\n iv: 16,\n mode: 'CBC',\n type: 'block'\n};\nexports['aes128'] = exports['aes-128-cbc'];\nexports['aes192'] = exports['aes-192-cbc'];\nexports['aes256'] = exports['aes-256-cbc'];\nexports['aes-128-cfb'] = {\n cipher: 'AES',\n key: 128,\n iv: 16,\n mode: 'CFB',\n type: 'stream'\n};\nexports['aes-192-cfb'] = {\n cipher: 'AES',\n key: 192,\n iv: 16,\n mode: 'CFB',\n type: 'stream'\n};\nexports['aes-256-cfb'] = {\n cipher: 'AES',\n key: 256,\n iv: 16,\n mode: 'CFB',\n type: 'stream'\n};\nexports['aes-128-cfb8'] = {\n cipher: 'AES',\n key: 128,\n iv: 16,\n mode: 'CFB8',\n type: 'stream'\n};\nexports['aes-192-cfb8'] = {\n cipher: 'AES',\n key: 192,\n iv: 16,\n mode: 'CFB8',\n type: 'stream'\n};\nexports['aes-256-cfb8'] = {\n cipher: 'AES',\n key: 256,\n iv: 16,\n mode: 'CFB8',\n type: 'stream'\n};\nexports['aes-128-cfb1'] = {\n cipher: 'AES',\n key: 128,\n iv: 16,\n mode: 'CFB1',\n type: 'stream'\n};\nexports['aes-192-cfb1'] = {\n cipher: 'AES',\n key: 192,\n iv: 16,\n mode: 'CFB1',\n type: 'stream'\n};\nexports['aes-256-cfb1'] = {\n cipher: 'AES',\n key: 256,\n iv: 16,\n mode: 'CFB1',\n type: 'stream'\n};\nexports['aes-128-ofb'] = {\n cipher: 'AES',\n key: 128,\n iv: 16,\n mode: 'OFB',\n type: 'stream'\n};\nexports['aes-192-ofb'] = {\n cipher: 'AES',\n key: 192,\n iv: 16,\n mode: 'OFB',\n type: 'stream'\n};\nexports['aes-256-ofb'] = {\n cipher: 'AES',\n key: 256,\n iv: 16,\n mode: 'OFB',\n type: 'stream'\n};\nexports['aes-128-ctr'] = {\n cipher: 'AES',\n key: 128,\n iv: 16,\n mode: 'CTR',\n type: 'stream'\n};\nexports['aes-192-ctr'] = {\n cipher: 'AES',\n key: 192,\n iv: 16,\n mode: 'CTR',\n type: 'stream'\n};\nexports['aes-256-ctr'] = {\n cipher: 'AES',\n key: 256,\n iv: 16,\n mode: 'CTR',\n type: 'stream'\n};\nexports['aes-128-gcm'] = {\n cipher: 'AES',\n key: 128,\n iv: 12,\n mode: 'GCM',\n type: 'auth'\n};\nexports['aes-192-gcm'] = {\n cipher: 'AES',\n key: 192,\n iv: 12,\n mode: 'GCM',\n type: 'auth'\n};\nexports['aes-256-gcm'] = {\n cipher: 'AES',\n key: 256,\n iv: 12,\n mode: 'GCM',\n type: 'auth'\n};\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cbc.js\":[function(require,module,exports){\nvar xor = require('../xor');\nexports.encrypt = function (self, block) {\n var data = xor(block, self._prev);\n self._prev = self._cipher.encryptBlock(data);\n return self._prev;\n};\nexports.decrypt = function (self, block) {\n var pad = self._prev;\n self._prev = block;\n var out = self._cipher.decryptBlock(block);\n return xor(out, pad);\n};\n},{\"../xor\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/xor.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb.js\":[function(require,module,exports){\n(function (Buffer){\nvar xor = require('../xor');\nexports.encrypt = function (self, data, decrypt) {\n var out = new Buffer('');\n var len;\n while (data.length) {\n if (self._cache.length === 0) {\n self._cache = self._cipher.encryptBlock(self._prev);\n self._prev = new Buffer('');\n }\n if (self._cache.length <= data.length) {\n len = self._cache.length;\n out = Buffer.concat([out, encryptStart(self, data.slice(0, len), decrypt)]);\n data = data.slice(len);\n } else {\n out = Buffer.concat([out, encryptStart(self, data, decrypt)]);\n break;\n }\n }\n return out;\n};\nfunction encryptStart(self, data, decrypt) {\n var len = data.length;\n var out = xor(data, self._cache);\n self._cache = self._cache.slice(len);\n self._prev = Buffer.concat([self._prev, decrypt?data:out]);\n return out;\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"../xor\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/xor.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb1.js\":[function(require,module,exports){\n(function (Buffer){\n\nfunction encryptByte(self, byte, decrypt) {\n var pad;\n var i = -1;\n var len = 8;\n var out = 0;\n var bit, value;\n while (++i < len) {\n pad = self._cipher.encryptBlock(self._prev);\n bit = (byte & (1 << (7-i))) ? 0x80:0;\n value = pad[0] ^ bit;\n out += ((value&0x80) >> (i%8));\n self._prev = shiftIn(self._prev, decrypt?bit:value);\n }\n return out;\n}\nexports.encrypt = function (self, chunk, decrypt) {\n var len = chunk.length;\n var out = new Buffer(len);\n var i = -1;\n while (++i < len) {\n out[i] = encryptByte(self, chunk[i], decrypt);\n }\n return out;\n};\nfunction shiftIn(buffer, value) {\n var len = buffer.length;\n var i = -1;\n var out = new Buffer(buffer.length);\n buffer = Buffer.concat([buffer, new Buffer([value])]);\n while(++i < len) {\n out[i] = buffer[i]<<1 | buffer[i+1]>>(7);\n }\n return out;\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb8.js\":[function(require,module,exports){\n(function (Buffer){\nfunction encryptByte(self, byte, decrypt) {\n var pad = self._cipher.encryptBlock(self._prev);\n var out = pad[0] ^ byte;\n self._prev = Buffer.concat([self._prev.slice(1), new Buffer([decrypt?byte:out])]);\n return out;\n}\nexports.encrypt = function (self, chunk, decrypt) {\n var len = chunk.length;\n var out = new Buffer(len);\n var i = -1;\n while (++i < len) {\n out[i] = encryptByte(self, chunk[i], decrypt);\n }\n return out;\n};\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ctr.js\":[function(require,module,exports){\n(function (Buffer){\nvar xor = require('../xor');\nfunction getBlock(self) {\n var out = self._cipher.encryptBlock(self._prev);\n incr32(self._prev);\n return out;\n}\nexports.encrypt = function (self, chunk) {\n while (self._cache.length < chunk.length) {\n self._cache = Buffer.concat([self._cache, getBlock(self)]);\n }\n var pad = self._cache.slice(0, chunk.length);\n self._cache = self._cache.slice(chunk.length);\n return xor(chunk, pad);\n};\nfunction incr32(iv) {\n var len = iv.length;\n var item;\n while (len--) {\n item = iv.readUInt8(len);\n if (item === 255) {\n iv.writeUInt8(0, len);\n } else {\n item++;\n iv.writeUInt8(item, len);\n break;\n }\n }\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"../xor\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/xor.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ecb.js\":[function(require,module,exports){\nexports.encrypt = function (self, block) {\n return self._cipher.encryptBlock(block);\n};\nexports.decrypt = function (self, block) {\n return self._cipher.decryptBlock(block);\n};\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ofb.js\":[function(require,module,exports){\n(function (Buffer){\nvar xor = require('../xor');\nfunction getBlock(self) {\n self._prev = self._cipher.encryptBlock(self._prev);\n return self._prev;\n}\nexports.encrypt = function (self, chunk) {\n while (self._cache.length < chunk.length) {\n self._cache = Buffer.concat([self._cache, getBlock(self)]);\n }\n var pad = self._cache.slice(0, chunk.length);\n self._cache = self._cache.slice(chunk.length);\n return xor(chunk, pad);\n};\n}).call(this,require(\"buffer\").Buffer)\n},{\"../xor\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/xor.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/streamCipher.js\":[function(require,module,exports){\n(function (Buffer){\nvar aes = require('./aes');\nvar Transform = require('./cipherBase');\nvar inherits = require('inherits');\n\ninherits(StreamCipher, Transform);\nmodule.exports = StreamCipher;\nfunction StreamCipher(mode, key, iv, decrypt) {\n if (!(this instanceof StreamCipher)) {\n return new StreamCipher(mode, key, iv);\n }\n Transform.call(this);\n this._cipher = new aes.AES(key);\n this._prev = new Buffer(iv.length);\n this._cache = new Buffer('');\n this._secCache = new Buffer('');\n this._decrypt = decrypt;\n iv.copy(this._prev);\n this._mode = mode;\n}\nStreamCipher.prototype._update = function (chunk) {\n return this._mode.encrypt(this, chunk, this._decrypt);\n};\nStreamCipher.prototype._final = function () {\n this._cipher.scrub();\n};\n}).call(this,require(\"buffer\").Buffer)\n},{\"./aes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/aes.js\",\"./cipherBase\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/cipherBase.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-aes/xor.js\":[function(require,module,exports){\n(function (Buffer){\nmodule.exports = xor;\nfunction xor(a, b) {\n var len = Math.min(a.length, b.length);\n var out = new Buffer(len);\n var i = -1;\n while (++i < len) {\n out.writeUInt8(a[i] ^ b[i], i);\n }\n return out;\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/algos.js\":[function(require,module,exports){\n(function (Buffer){\nexports['RSA-SHA224'] = exports.sha224WithRSAEncryption = {\n sign: 'rsa',\n hash: 'sha224',\n id: new Buffer('302d300d06096086480165030402040500041c', 'hex')\n};\nexports['RSA-SHA256'] = exports.sha256WithRSAEncryption = {\n sign: 'rsa',\n hash: 'sha256',\n id: new Buffer('3031300d060960864801650304020105000420', 'hex')\n};\nexports['RSA-SHA384'] = exports.sha384WithRSAEncryption = {\n sign: 'rsa',\n hash: 'sha384',\n id: new Buffer('3041300d060960864801650304020205000430', 'hex')\n};\nexports['RSA-SHA512'] = exports.sha512WithRSAEncryption = {\n sign: 'rsa',\n hash: 'sha512',\n id: new Buffer('3051300d060960864801650304020305000440', 'hex')\n};\nexports['RSA-SHA1'] = {\n\tsign: 'rsa',\n\thash: 'sha1',\n\tid: new Buffer('3021300906052b0e03021a05000414', 'hex')\n};\nexports['ecdsa-with-SHA1'] = {\n\tsign: 'ecdsa',\n\thash: 'sha1',\n\tid: new Buffer('', 'hex')\n};\nexports.DSA = exports['DSA-SHA1'] = exports['DSA-SHA'] = {\n sign: 'dsa',\n hash: 'sha1',\n id: new Buffer('', 'hex')\n};\nexports['DSA-SHA224'] = exports['DSA-WITH-SHA224'] = {\n sign: 'dsa',\n hash: 'sha224',\n id: new Buffer('', 'hex')\n};\nexports['DSA-SHA256'] = exports['DSA-WITH-SHA256'] = {\n sign: 'dsa',\n hash: 'sha256',\n id: new Buffer('', 'hex')\n};\nexports['DSA-SHA384'] = exports['DSA-WITH-SHA384'] = {\n sign: 'dsa',\n hash: 'sha384',\n id: new Buffer('', 'hex')\n};\nexports['DSA-SHA512'] = exports['DSA-WITH-SHA512'] = {\n sign: 'dsa',\n hash: 'sha512',\n id: new Buffer('', 'hex')\n};\nexports['DSA-RIPEMD160'] = {\n sign: 'dsa',\n hash: 'rmd160',\n id: new Buffer('', 'hex')\n};\nexports['RSA-RIPEMD160'] = exports.ripemd160WithRSA = {\n sign: 'rsa',\n hash: 'rmd160',\n id: new Buffer('3021300906052b2403020105000414', 'hex')\n};\nexports['RSA-MD5'] = exports.md5WithRSAEncryption = {\n sign: 'rsa',\n hash: 'md5',\n id: new Buffer('3020300c06082a864886f70d020505000410', 'hex')\n};\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/inject.js\":[function(require,module,exports){\n(function (Buffer){\nvar sign = require('./sign');\nvar verify = require('./verify');\nvar stream = require('stream');\nvar inherits = require('inherits');\nvar _algos = require('./algos');\nvar algos = {};\nObject.keys(_algos).forEach(function (key) {\n\talgos[key] = algos[key.toLowerCase()] = _algos[key];\n});\n'use strict';\nmodule.exports = function (exports, crypto) {\n\texports.createSign = exports.Sign = createSign;\n\tfunction createSign(algorithm) {\n\n\t\treturn new Sign(algorithm, crypto);\n\t}\n\texports.createVerify = exports.Verify = createVerify;\n\tfunction createVerify(algorithm) {\n\t\treturn new Verify(algorithm, crypto);\n\t}\n};\ninherits(Sign, stream.Writable);\nfunction Sign(algorithm, crypto) {\n\tstream.Writable.call(this);\n\tvar data = algos[algorithm];\n\tif (!data) {\n\t\tthrow new Error('Unknown message digest');\n\t}\n\tthis._hashType = data.hash;\n\tthis._hash = crypto.createHash(data.hash);\n\tthis._tag = data.id;\n\tthis._crypto = crypto;\n}\nSign.prototype._write = function _write(data, _, done) {\n\tthis._hash.update(data);\n\tdone();\n};\nSign.prototype.update = function update(data) {\n\tthis.write(data);\n\treturn this;\n};\n\nSign.prototype.sign = function signMethod(key, enc) {\n\tthis.end();\n\tvar hash = this._hash.digest();\n\tvar sig = sign(Buffer.concat([this._tag, hash]), key, this._hashType, this._crypto);\n\tif (enc) {\n\t\tsig = sig.toString(enc);\n\t}\n\treturn sig;\n};\n\ninherits(Verify, stream.Writable);\nfunction Verify(algorithm, crypto) {\n\tstream.Writable.call(this);\n\tvar data = algos[algorithm];\n\tif (!data) {\n\t\tthrow new Error('Unknown message digest');\n\t}\n\tthis._hash = crypto.createHash(data.hash);\n\tthis._tag = data.id;\n}\nVerify.prototype._write = function _write(data, _, done) {\n\tthis._hash.update(data);\n\tdone();\n};\nVerify.prototype.update = function update(data) {\n\tthis.write(data);\n\treturn this;\n};\n\nVerify.prototype.verify = function verifyMethod(key, sig, enc) {\n\tthis.end();\n\tvar hash = this._hash.digest();\n\tif (!Buffer.isBuffer(sig)) {\n\t\tsig = new Buffer(sig, enc);\n\t}\n\treturn verify(sig, Buffer.concat([this._tag, hash]), key);\n};\n}).call(this,require(\"buffer\").Buffer)\n},{\"./algos\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/algos.js\",\"./sign\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/sign.js\",\"./verify\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/verify.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\",\"stream\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/stream-browserify/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\":[function(require,module,exports){\n(function(module, exports) {\n\n'use strict';\n\n// Utils\n\nfunction assert(val, msg) {\n if (!val)\n throw new Error(msg || 'Assertion failed');\n}\n\n// Could use `inherits` module, but don't want to move from single file\n// architecture yet.\nfunction inherits(ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n}\n\n// BN\n\nfunction BN(number, base, endian) {\n // May be `new BN(bn)` ?\n if (number !== null &&\n typeof number === 'object' &&\n Array.isArray(number.words)) {\n return number;\n }\n\n this.sign = false;\n this.words = null;\n this.length = 0;\n\n // Reduction context\n this.red = null;\n\n if (base === 'le' || base === 'be') {\n endian = base;\n base = 10;\n }\n\n if (number !== null)\n this._init(number || 0, base || 10, endian || 'be');\n}\nif (typeof module === 'object')\n module.exports = BN;\nelse\n exports.BN = BN;\n\nBN.BN = BN;\nBN.wordSize = 26;\n\nBN.prototype._init = function init(number, base, endian) {\n if (typeof number === 'number') {\n if (number < 0) {\n this.sign = true;\n number = -number;\n }\n if (number < 0x4000000) {\n this.words = [ number & 0x3ffffff ];\n this.length = 1;\n } else {\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff\n ];\n this.length = 2;\n }\n return;\n } else if (typeof number === 'object') {\n return this._initArray(number, base, endian);\n }\n if (base === 'hex')\n base = 16;\n assert(base === (base | 0) && base >= 2 && base <= 36);\n\n number = number.toString().replace(/\\s+/g, '');\n var start = 0;\n if (number[0] === '-')\n start++;\n\n if (base === 16)\n this._parseHex(number, start);\n else\n this._parseBase(number, base, start);\n\n if (number[0] === '-')\n this.sign = true;\n\n this.strip();\n};\n\nBN.prototype._initArray = function _initArray(number, base, endian) {\n // Perhaps a Uint8Array\n assert(typeof number.length === 'number');\n this.length = Math.ceil(number.length / 3);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++)\n this.words[i] = 0;\n\n var off = 0;\n if (endian === 'be') {\n for (var i = number.length - 1, j = 0; i >= 0; i -= 3) {\n var w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n } else if (endian === 'le') {\n for (var i = 0, j = 0; i < number.length; i += 3) {\n var w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n }\n return this.strip();\n};\n\nfunction parseHex(str, start, end) {\n var r = 0;\n var len = Math.min(str.length, end);\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n\n r <<= 4;\n\n // 'a' - 'f'\n if (c >= 49 && c <= 54)\n r |= c - 49 + 0xa;\n\n // 'A' - 'F'\n else if (c >= 17 && c <= 22)\n r |= c - 17 + 0xa;\n\n // '0' - '9'\n else\n r |= c & 0xf;\n }\n return r;\n}\n\nBN.prototype._parseHex = function _parseHex(number, start) {\n // Create possibly bigger array to ensure that it fits the number\n this.length = Math.ceil((number.length - start) / 6);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++)\n this.words[i] = 0;\n\n // Scan 24-bit chunks and add them to the number\n var off = 0;\n for (var i = number.length - 6, j = 0; i >= start; i -= 6) {\n var w = parseHex(number, i, i + 6);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n if (i + 6 !== start) {\n var w = parseHex(number, start, i + 6);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;\n }\n this.strip();\n};\n\nfunction parseBase(str, start, end, mul) {\n var r = 0;\n var len = Math.min(str.length, end);\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n\n r *= mul;\n\n // 'a'\n if (c >= 49)\n r += c - 49 + 0xa;\n\n // 'A'\n else if (c >= 17)\n r += c - 17 + 0xa;\n\n // '0' - '9'\n else\n r += c;\n }\n return r;\n}\n\nBN.prototype._parseBase = function _parseBase(number, base, start) {\n // Initialize as zero\n this.words = [ 0 ];\n this.length = 1;\n\n // Find length of limb in base\n for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base)\n limbLen++;\n limbLen--;\n limbPow = (limbPow / base) | 0;\n\n var total = number.length - start;\n var mod = total % limbLen;\n var end = Math.min(total, total - mod) + start;\n\n var word = 0;\n for (var i = start; i < end; i += limbLen) {\n word = parseBase(number, i, i + limbLen, base);\n\n this.imuln(limbPow);\n if (this.words[0] + word < 0x4000000)\n this.words[0] += word;\n else\n this._iaddn(word);\n }\n\n if (mod !== 0) {\n var pow = 1;\n var word = parseBase(number, i, number.length, base);\n\n for (var i = 0; i < mod; i++)\n pow *= base;\n this.imuln(pow);\n if (this.words[0] + word < 0x4000000)\n this.words[0] += word;\n else\n this._iaddn(word);\n }\n};\n\nBN.prototype.copy = function copy(dest) {\n dest.words = new Array(this.length);\n for (var i = 0; i < this.length; i++)\n dest.words[i] = this.words[i];\n dest.length = this.length;\n dest.sign = this.sign;\n dest.red = this.red;\n};\n\nBN.prototype.clone = function clone() {\n var r = new BN(null);\n this.copy(r);\n return r;\n};\n\n// Remove leading `0` from `this`\nBN.prototype.strip = function strip() {\n while (this.length > 1 && this.words[this.length - 1] === 0)\n this.length--;\n return this._normSign();\n};\n\nBN.prototype._normSign = function _normSign() {\n // -0 = 0\n if (this.length === 1 && this.words[0] === 0)\n this.sign = false;\n return this;\n};\n\nBN.prototype.inspect = function inspect() {\n return (this.red ? '';\n};\n\n/*\n\nvar zeros = [];\nvar groupSizes = [];\nvar groupBases = [];\n\nvar s = '';\nvar i = -1;\nwhile (++i < BN.wordSize) {\n zeros[i] = s;\n s += '0';\n}\ngroupSizes[0] = 0;\ngroupSizes[1] = 0;\ngroupBases[0] = 0;\ngroupBases[1] = 0;\nvar base = 2 - 1;\nwhile (++base < 36 + 1) {\n var groupSize = 0;\n var groupBase = 1;\n while (groupBase < (1 << BN.wordSize) / base) {\n groupBase *= base;\n groupSize += 1;\n }\n groupSizes[base] = groupSize;\n groupBases[base] = groupBase;\n}\n\n*/\n\nvar zeros = [\n '',\n '0',\n '00',\n '000',\n '0000',\n '00000',\n '000000',\n '0000000',\n '00000000',\n '000000000',\n '0000000000',\n '00000000000',\n '000000000000',\n '0000000000000',\n '00000000000000',\n '000000000000000',\n '0000000000000000',\n '00000000000000000',\n '000000000000000000',\n '0000000000000000000',\n '00000000000000000000',\n '000000000000000000000',\n '0000000000000000000000',\n '00000000000000000000000',\n '000000000000000000000000',\n '0000000000000000000000000'\n];\n\nvar groupSizes = [\n 0, 0,\n 25, 16, 12, 11, 10, 9, 8,\n 8, 7, 7, 7, 7, 6, 6,\n 6, 6, 6, 6, 6, 5, 5,\n 5, 5, 5, 5, 5, 5, 5,\n 5, 5, 5, 5, 5, 5, 5\n];\n\nvar groupBases = [\n 0, 0,\n 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,\n 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,\n 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,\n 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,\n 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176\n];\n\nBN.prototype.toString = function toString(base, padding) {\n base = base || 10;\n if (base === 16 || base === 'hex') {\n var out = '';\n var off = 0;\n var padding = padding | 0 || 1;\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i];\n var word = (((w << off) | carry) & 0xffffff).toString(16);\n carry = (w >>> (24 - off)) & 0xffffff;\n if (carry !== 0 || i !== this.length - 1)\n out = zeros[6 - word.length] + word + out;\n else\n out = word + out;\n off += 2;\n if (off >= 26) {\n off -= 26;\n i--;\n }\n }\n if (carry !== 0)\n out = carry.toString(16) + out;\n while (out.length % padding !== 0)\n out = '0' + out;\n if (this.sign)\n out = '-' + out;\n return out;\n } else if (base === (base | 0) && base >= 2 && base <= 36) {\n // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));\n var groupSize = groupSizes[base];\n // var groupBase = Math.pow(base, groupSize);\n var groupBase = groupBases[base];\n var out = '';\n var c = this.clone();\n c.sign = false;\n while (c.cmpn(0) !== 0) {\n var r = c.modn(groupBase).toString(base);\n c = c.idivn(groupBase);\n\n if (c.cmpn(0) !== 0)\n out = zeros[groupSize - r.length] + r + out;\n else\n out = r + out;\n }\n if (this.cmpn(0) === 0)\n out = '0' + out;\n if (this.sign)\n out = '-' + out;\n return out;\n } else {\n assert(false, 'Base should be between 2 and 36');\n }\n};\n\nBN.prototype.toJSON = function toJSON() {\n return this.toString(16);\n};\n\nBN.prototype.toArray = function toArray() {\n this.strip();\n var res = new Array(this.byteLength());\n res[0] = 0;\n\n var q = this.clone();\n for (var i = 0; q.cmpn(0) !== 0; i++) {\n var b = q.andln(0xff);\n q.ishrn(8);\n\n // Assume big-endian\n res[res.length - i - 1] = b;\n }\n\n return res;\n};\n\n/*\nfunction genCountBits(bits) {\n var arr = [];\n\n for (var i = bits - 1; i >= 0; i--) {\n var bit = '0x' + (1 << i).toString(16);\n arr.push('w >= ' + bit + ' ? ' + (i + 1));\n }\n\n return new Function('w', 'return ' + arr.join(' :\\n') + ' :\\n0;');\n};\n\nBN.prototype._countBits = genCountBits(26);\n*/\n\n// Sadly chrome apps could not contain `new Function()` calls\nBN.prototype._countBits = function _countBits(w) {\n return w >= 0x2000000 ? 26 :\n w >= 0x1000000 ? 25 :\n w >= 0x800000 ? 24 :\n w >= 0x400000 ? 23 :\n w >= 0x200000 ? 22 :\n w >= 0x100000 ? 21 :\n w >= 0x80000 ? 20 :\n w >= 0x40000 ? 19 :\n w >= 0x20000 ? 18 :\n w >= 0x10000 ? 17 :\n w >= 0x8000 ? 16 :\n w >= 0x4000 ? 15 :\n w >= 0x2000 ? 14 :\n w >= 0x1000 ? 13 :\n w >= 0x800 ? 12 :\n w >= 0x400 ? 11 :\n w >= 0x200 ? 10 :\n w >= 0x100 ? 9 :\n w >= 0x80 ? 8 :\n w >= 0x40 ? 7 :\n w >= 0x20 ? 6 :\n w >= 0x10 ? 5 :\n w >= 0x8 ? 4 :\n w >= 0x4 ? 3 :\n w >= 0x2 ? 2 :\n w >= 0x1 ? 1 :\n 0;\n};\n\n// Return number of used bits in a BN\nBN.prototype.bitLength = function bitLength() {\n var hi = 0;\n var w = this.words[this.length - 1];\n var hi = this._countBits(w);\n return (this.length - 1) * 26 + hi;\n};\n\nBN.prototype.byteLength = function byteLength() {\n return Math.ceil(this.bitLength() / 8);\n};\n\n// Return negative clone of `this`\nBN.prototype.neg = function neg() {\n if (this.cmpn(0) === 0)\n return this.clone();\n\n var r = this.clone();\n r.sign = !this.sign;\n return r;\n};\n\n\n// Or `num` with `this` in-place\nBN.prototype.ior = function ior(num) {\n this.sign = this.sign || num.sign;\n\n while (this.length < num.length)\n this.words[this.length++] = 0;\n\n for (var i = 0; i < num.length; i++)\n this.words[i] = this.words[i] | num.words[i];\n\n return this.strip();\n};\n\n\n// Or `num` with `this`\nBN.prototype.or = function or(num) {\n if (this.length > num.length)\n return this.clone().ior(num);\n else\n return num.clone().ior(this);\n};\n\n\n// And `num` with `this` in-place\nBN.prototype.iand = function iand(num) {\n this.sign = this.sign && num.sign;\n\n // b = min-length(num, this)\n var b;\n if (this.length > num.length)\n b = num;\n else\n b = this;\n\n for (var i = 0; i < b.length; i++)\n this.words[i] = this.words[i] & num.words[i];\n\n this.length = b.length;\n\n return this.strip();\n};\n\n\n// And `num` with `this`\nBN.prototype.and = function and(num) {\n if (this.length > num.length)\n return this.clone().iand(num);\n else\n return num.clone().iand(this);\n};\n\n\n// Xor `num` with `this` in-place\nBN.prototype.ixor = function ixor(num) {\n this.sign = this.sign || num.sign;\n\n // a.length > b.length\n var a;\n var b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n for (var i = 0; i < b.length; i++)\n this.words[i] = a.words[i] ^ b.words[i];\n\n if (this !== a)\n for (; i < a.length; i++)\n this.words[i] = a.words[i];\n\n this.length = a.length;\n\n return this.strip();\n};\n\n\n// Xor `num` with `this`\nBN.prototype.xor = function xor(num) {\n if (this.length > num.length)\n return this.clone().ixor(num);\n else\n return num.clone().ixor(this);\n};\n\n\n// Set `bit` of `this`\nBN.prototype.setn = function setn(bit, val) {\n assert(typeof bit === 'number' && bit >= 0);\n\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n while (this.length <= off)\n this.words[this.length++] = 0;\n\n if (val)\n this.words[off] = this.words[off] | (1 << wbit);\n else\n this.words[off] = this.words[off] & ~(1 << wbit);\n\n return this.strip();\n};\n\n\n// Add `num` to `this` in-place\nBN.prototype.iadd = function iadd(num) {\n // negative + positive\n if (this.sign && !num.sign) {\n this.sign = false;\n var r = this.isub(num);\n this.sign = !this.sign;\n return this._normSign();\n\n // positive + negative\n } else if (!this.sign && num.sign) {\n num.sign = false;\n var r = this.isub(num);\n num.sign = true;\n return r._normSign();\n }\n\n // a.length > b.length\n var a;\n var b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n var r = a.words[i] + b.words[i] + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n for (; carry !== 0 && i < a.length; i++) {\n var r = a.words[i] + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n this.length = a.length;\n if (carry !== 0) {\n this.words[this.length] = carry;\n this.length++;\n // Copy the rest of the words\n } else if (a !== this) {\n for (; i < a.length; i++)\n this.words[i] = a.words[i];\n }\n\n return this;\n};\n\n// Add `num` to `this`\nBN.prototype.add = function add(num) {\n if (num.sign && !this.sign) {\n num.sign = false;\n var res = this.sub(num);\n num.sign = true;\n return res;\n } else if (!num.sign && this.sign) {\n this.sign = false;\n var res = num.sub(this);\n this.sign = true;\n return res;\n }\n\n if (this.length > num.length)\n return this.clone().iadd(num);\n else\n return num.clone().iadd(this);\n};\n\n// Subtract `num` from `this` in-place\nBN.prototype.isub = function isub(num) {\n // this - (-num) = this + num\n if (num.sign) {\n num.sign = false;\n var r = this.iadd(num);\n num.sign = true;\n return r._normSign();\n\n // -this - num = -(this + num)\n } else if (this.sign) {\n this.sign = false;\n this.iadd(num);\n this.sign = true;\n return this._normSign();\n }\n\n // At this point both numbers are positive\n var cmp = this.cmp(num);\n\n // Optimization - zeroify\n if (cmp === 0) {\n this.sign = false;\n this.length = 1;\n this.words[0] = 0;\n return this;\n }\n\n // a > b\n var a;\n var b;\n if (cmp > 0) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n var r = a.words[i] - b.words[i] + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n for (; carry !== 0 && i < a.length; i++) {\n var r = a.words[i] + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n\n // Copy rest of the words\n if (carry === 0 && i < a.length && a !== this)\n for (; i < a.length; i++)\n this.words[i] = a.words[i];\n this.length = Math.max(this.length, i);\n\n if (a !== this)\n this.sign = true;\n\n return this.strip();\n};\n\n// Subtract `num` from `this`\nBN.prototype.sub = function sub(num) {\n return this.clone().isub(num);\n};\n\n/*\n// NOTE: This could be potentionally used to generate loop-less multiplications\nfunction _genCombMulTo(alen, blen) {\n var len = alen + blen - 1;\n var src = [\n 'var a = this.words, b = num.words, o = out.words, c = 0, w, ' +\n 'mask = 0x3ffffff, shift = 0x4000000;',\n 'out.length = ' + len + ';'\n ];\n for (var k = 0; k < len; k++) {\n var minJ = Math.max(0, k - alen + 1);\n var maxJ = Math.min(k, blen - 1);\n\n for (var j = minJ; j <= maxJ; j++) {\n var i = k - j;\n var mul = 'a[' + i + '] * b[' + j + ']';\n\n if (j === minJ) {\n src.push('w = ' + mul + ' + c;');\n src.push('c = (w / shift) | 0;');\n } else {\n src.push('w += ' + mul + ';');\n src.push('c += (w / shift) | 0;');\n }\n src.push('w &= mask;');\n }\n src.push('o[' + k + '] = w;');\n }\n src.push('if (c !== 0) {',\n ' o[' + k + '] = c;',\n ' out.length++;',\n '}',\n 'return out;');\n\n return src.join('\\n');\n}\n*/\n\nBN.prototype._smallMulTo = function _smallMulTo(num, out) {\n out.sign = num.sign !== this.sign;\n out.length = this.length + num.length;\n\n var carry = 0;\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = carry >>> 26;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - this.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = this.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;\n lo = (lo + rword) | 0;\n rword = lo & 0x3ffffff;\n ncarry = (ncarry + (lo >>> 26)) | 0;\n }\n out.words[k] = rword;\n carry = ncarry;\n }\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out.strip();\n};\n\nBN.prototype._bigMulTo = function _bigMulTo(num, out) {\n out.sign = num.sign !== this.sign;\n out.length = this.length + num.length;\n\n var carry = 0;\n var hncarry = 0;\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = hncarry;\n hncarry = 0;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - this.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = this.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;\n lo = (lo + rword) | 0;\n rword = lo & 0x3ffffff;\n ncarry = (ncarry + (lo >>> 26)) | 0;\n\n hncarry += ncarry >>> 26;\n ncarry &= 0x3ffffff;\n }\n out.words[k] = rword;\n carry = ncarry;\n ncarry = hncarry;\n }\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out.strip();\n};\n\nBN.prototype.mulTo = function mulTo(num, out) {\n var res;\n if (this.length + num.length < 63)\n res = this._smallMulTo(num, out);\n else\n res = this._bigMulTo(num, out);\n return res;\n};\n\n// Multiply `this` by `num`\nBN.prototype.mul = function mul(num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return this.mulTo(num, out);\n};\n\n// In-place Multiplication\nBN.prototype.imul = function imul(num) {\n if (this.cmpn(0) === 0 || num.cmpn(0) === 0) {\n this.words[0] = 0;\n this.length = 1;\n return this;\n }\n\n var tlen = this.length;\n var nlen = num.length;\n\n this.sign = num.sign !== this.sign;\n this.length = this.length + num.length;\n this.words[this.length - 1] = 0;\n\n for (var k = this.length - 2; k >= 0; k--) {\n // Sum all words with the same `i + j = k` and accumulate `carry`,\n // note that carry could be >= 0x3ffffff\n var carry = 0;\n var rword = 0;\n var maxJ = Math.min(k, nlen - 1);\n for (var j = Math.max(0, k - tlen + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = this.words[i];\n var b = num.words[j];\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n carry += (r / 0x4000000) | 0;\n lo += rword;\n rword = lo & 0x3ffffff;\n carry += lo >>> 26;\n }\n this.words[k] = rword;\n this.words[k + 1] += carry;\n carry = 0;\n }\n\n // Propagate overflows\n var carry = 0;\n for (var i = 1; i < this.length; i++) {\n var w = this.words[i] + carry;\n this.words[i] = w & 0x3ffffff;\n carry = w >>> 26;\n }\n\n return this.strip();\n};\n\nBN.prototype.imuln = function imuln(num) {\n assert(typeof num === 'number');\n\n // Carry\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i] * num;\n var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);\n carry >>= 26;\n carry += (w / 0x4000000) | 0;\n // NOTE: lo is 27bit maximum\n carry += lo >>> 26;\n this.words[i] = lo & 0x3ffffff;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return this;\n};\n\n// `this` * `this`\nBN.prototype.sqr = function sqr() {\n return this.mul(this);\n};\n\n// `this` * `this` in-place\nBN.prototype.isqr = function isqr() {\n return this.mul(this);\n};\n\n// Shift-left in-place\nBN.prototype.ishln = function ishln(bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);\n\n if (r !== 0) {\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var newCarry = this.words[i] & carryMask;\n var c = (this.words[i] - newCarry) << r;\n this.words[i] = c | carry;\n carry = newCarry >>> (26 - r);\n }\n if (carry) {\n this.words[i] = carry;\n this.length++;\n }\n }\n\n if (s !== 0) {\n for (var i = this.length - 1; i >= 0; i--)\n this.words[i + s] = this.words[i];\n for (var i = 0; i < s; i++)\n this.words[i] = 0;\n this.length += s;\n }\n\n return this.strip();\n};\n\n// Shift-right in-place\n// NOTE: `hint` is a lowest bit before trailing zeroes\n// NOTE: if `extended` is true - { lo: ..., hi: } object will be returned\nBN.prototype.ishrn = function ishrn(bits, hint, extended) {\n assert(typeof bits === 'number' && bits >= 0);\n if (hint)\n hint = (hint - (hint % 26)) / 26;\n else\n hint = 0;\n\n var r = bits % 26;\n var s = Math.min((bits - r) / 26, this.length);\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n var maskedWords = extended;\n\n hint -= s;\n hint = Math.max(0, hint);\n\n // Extended mode, copy masked part\n if (maskedWords) {\n for (var i = 0; i < s; i++)\n maskedWords.words[i] = this.words[i];\n maskedWords.length = s;\n }\n\n if (s === 0) {\n // No-op, we should not move anything at all\n } else if (this.length > s) {\n this.length -= s;\n for (var i = 0; i < this.length; i++)\n this.words[i] = this.words[i + s];\n } else {\n this.words[0] = 0;\n this.length = 1;\n }\n\n var carry = 0;\n for (var i = this.length - 1; i >= 0 && (carry !== 0 || i >= hint); i--) {\n var word = this.words[i];\n this.words[i] = (carry << (26 - r)) | (word >>> r);\n carry = word & mask;\n }\n\n // Push carried bits as a mask\n if (maskedWords && carry !== 0)\n maskedWords.words[maskedWords.length++] = carry;\n\n if (this.length === 0) {\n this.words[0] = 0;\n this.length = 1;\n }\n\n this.strip();\n if (extended)\n return { hi: this, lo: maskedWords };\n\n return this;\n};\n\n// Shift-left\nBN.prototype.shln = function shln(bits) {\n return this.clone().ishln(bits);\n};\n\n// Shift-right\nBN.prototype.shrn = function shrn(bits) {\n return this.clone().ishrn(bits);\n};\n\n// Test if n bit is set\nBN.prototype.testn = function testn(bit) {\n assert(typeof bit === 'number' && bit >= 0);\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) {\n return false;\n }\n\n // Check bit and return\n var w = this.words[s];\n\n return !!(w & q);\n};\n\n// Return only lowers bits of number (in-place)\nBN.prototype.imaskn = function imaskn(bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n\n assert(!this.sign, 'imaskn works only with positive numbers');\n\n if (r !== 0)\n s++;\n this.length = Math.min(s, this.length);\n\n if (r !== 0) {\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n this.words[this.length - 1] &= mask;\n }\n\n return this.strip();\n};\n\n// Return only lowers bits of number\nBN.prototype.maskn = function maskn(bits) {\n return this.clone().imaskn(bits);\n};\n\n// Add plain number `num` to `this`\nBN.prototype.iaddn = function iaddn(num) {\n assert(typeof num === 'number');\n if (num < 0)\n return this.isubn(-num);\n\n // Possible sign change\n if (this.sign) {\n if (this.length === 1 && this.words[0] < num) {\n this.words[0] = num - this.words[0];\n this.sign = false;\n return this;\n }\n\n this.sign = false;\n this.isubn(num);\n this.sign = true;\n return this;\n }\n\n // Add without checks\n return this._iaddn(num);\n};\n\nBN.prototype._iaddn = function _iaddn(num) {\n this.words[0] += num;\n\n // Carry\n for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {\n this.words[i] -= 0x4000000;\n if (i === this.length - 1)\n this.words[i + 1] = 1;\n else\n this.words[i + 1]++;\n }\n this.length = Math.max(this.length, i + 1);\n\n return this;\n};\n\n// Subtract plain number `num` from `this`\nBN.prototype.isubn = function isubn(num) {\n assert(typeof num === 'number');\n if (num < 0)\n return this.iaddn(-num);\n\n if (this.sign) {\n this.sign = false;\n this.iaddn(num);\n this.sign = true;\n return this;\n }\n\n this.words[0] -= num;\n\n // Carry\n for (var i = 0; i < this.length && this.words[i] < 0; i++) {\n this.words[i] += 0x4000000;\n this.words[i + 1] -= 1;\n }\n\n return this.strip();\n};\n\nBN.prototype.addn = function addn(num) {\n return this.clone().iaddn(num);\n};\n\nBN.prototype.subn = function subn(num) {\n return this.clone().isubn(num);\n};\n\nBN.prototype.iabs = function iabs() {\n this.sign = false;\n\n return this;\n};\n\nBN.prototype.abs = function abs() {\n return this.clone().iabs();\n};\n\nBN.prototype._ishlnsubmul = function _ishlnsubmul(num, mul, shift) {\n // Bigger storage is needed\n var len = num.length + shift;\n var i;\n if (this.words.length < len) {\n var t = new Array(len);\n for (var i = 0; i < this.length; i++)\n t[i] = this.words[i];\n this.words = t;\n } else {\n i = this.length;\n }\n\n // Zeroify rest\n this.length = Math.max(this.length, len);\n for (; i < this.length; i++)\n this.words[i] = 0;\n\n var carry = 0;\n for (var i = 0; i < num.length; i++) {\n var w = this.words[i + shift] + carry;\n var right = num.words[i] * mul;\n w -= right & 0x3ffffff;\n carry = (w >> 26) - ((right / 0x4000000) | 0);\n this.words[i + shift] = w & 0x3ffffff;\n }\n for (; i < this.length - shift; i++) {\n var w = this.words[i + shift] + carry;\n carry = w >> 26;\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n if (carry === 0)\n return this.strip();\n\n // Subtraction overflow\n assert(carry === -1);\n carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = -this.words[i] + carry;\n carry = w >> 26;\n this.words[i] = w & 0x3ffffff;\n }\n this.sign = true;\n\n return this.strip();\n};\n\nBN.prototype._wordDiv = function _wordDiv(num, mode) {\n var shift = this.length - num.length;\n\n var a = this.clone();\n var b = num;\n\n // Normalize\n var bhi = b.words[b.length - 1];\n for (var shift = 0; bhi < 0x2000000; shift++)\n bhi <<= 1;\n if (shift !== 0) {\n b = b.shln(shift);\n a.ishln(shift);\n bhi = b.words[b.length - 1];\n }\n\n // Initialize quotient\n var m = a.length - b.length;\n var q;\n\n if (mode !== 'mod') {\n q = new BN(null);\n q.length = m + 1;\n q.words = new Array(q.length);\n for (var i = 0; i < q.length; i++)\n q.words[i] = 0;\n }\n\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n if (!diff.sign) {\n a = diff;\n if (q)\n q.words[m] = 1;\n }\n\n for (var j = m - 1; j >= 0; j--) {\n var qj = a.words[b.length + j] * 0x4000000 + a.words[b.length + j - 1];\n\n // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max\n // (0x7ffffff)\n qj = Math.min((qj / bhi) | 0, 0x3ffffff);\n\n a._ishlnsubmul(b, qj, j);\n while (a.sign) {\n qj--;\n a.sign = false;\n a._ishlnsubmul(b, 1, j);\n a.sign = !a.sign;\n }\n if (q)\n q.words[j] = qj;\n }\n if (q)\n q.strip();\n a.strip();\n\n // Denormalize\n if (mode !== 'div' && shift !== 0)\n a.ishrn(shift);\n return { div: q ? q : null, mod: a };\n};\n\nBN.prototype.divmod = function divmod(num, mode) {\n assert(num.cmpn(0) !== 0);\n\n if (this.sign && !num.sign) {\n var res = this.neg().divmod(num, mode);\n var div;\n var mod;\n if (mode !== 'mod')\n div = res.div.neg();\n if (mode !== 'div')\n mod = res.mod.cmpn(0) === 0 ? res.mod : num.sub(res.mod);\n return {\n div: div,\n mod: mod\n };\n } else if (!this.sign && num.sign) {\n var res = this.divmod(num.neg(), mode);\n var div;\n if (mode !== 'mod')\n div = res.div.neg();\n return { div: div, mod: res.mod };\n } else if (this.sign && num.sign) {\n return this.neg().divmod(num.neg(), mode);\n }\n\n // Both numbers are positive at this point\n\n // Strip both numbers to approximate shift value\n if (num.length > this.length || this.cmp(num) < 0)\n return { div: new BN(0), mod: this };\n\n // Very short reduction\n if (num.length === 1) {\n if (mode === 'div')\n return { div: this.divn(num.words[0]), mod: null };\n else if (mode === 'mod')\n return { div: null, mod: new BN(this.modn(num.words[0])) };\n return {\n div: this.divn(num.words[0]),\n mod: new BN(this.modn(num.words[0]))\n };\n }\n\n return this._wordDiv(num, mode);\n};\n\n// Find `this` / `num`\nBN.prototype.div = function div(num) {\n return this.divmod(num, 'div').div;\n};\n\n// Find `this` % `num`\nBN.prototype.mod = function mod(num) {\n return this.divmod(num, 'mod').mod;\n};\n\n// Find Round(`this` / `num`)\nBN.prototype.divRound = function divRound(num) {\n var dm = this.divmod(num);\n\n // Fast case - exact division\n if (dm.mod.cmpn(0) === 0)\n return dm.div;\n\n var mod = dm.div.sign ? dm.mod.isub(num) : dm.mod;\n\n var half = num.shrn(1);\n var r2 = num.andln(1);\n var cmp = mod.cmp(half);\n\n // Round down\n if (cmp < 0 || r2 === 1 && cmp === 0)\n return dm.div;\n\n // Round up\n return dm.div.sign ? dm.div.isubn(1) : dm.div.iaddn(1);\n};\n\nBN.prototype.modn = function modn(num) {\n assert(num <= 0x3ffffff);\n var p = (1 << 26) % num;\n\n var acc = 0;\n for (var i = this.length - 1; i >= 0; i--)\n acc = (p * acc + this.words[i]) % num;\n\n return acc;\n};\n\n// In-place division by number\nBN.prototype.idivn = function idivn(num) {\n assert(num <= 0x3ffffff);\n\n var carry = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var w = this.words[i] + carry * 0x4000000;\n this.words[i] = (w / num) | 0;\n carry = w % num;\n }\n\n return this.strip();\n};\n\nBN.prototype.divn = function divn(num) {\n return this.clone().idivn(num);\n};\n\nBN.prototype._egcd = function _egcd(x1, p) {\n assert(!p.sign);\n assert(p.cmpn(0) !== 0);\n\n var a = this;\n var b = p.clone();\n\n if (a.sign)\n a = a.mod(p);\n else\n a = a.clone();\n\n var x2 = new BN(0);\n while (b.isEven())\n b.ishrn(1);\n var delta = b.clone();\n while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {\n while (a.isEven()) {\n a.ishrn(1);\n if (x1.isEven())\n x1.ishrn(1);\n else\n x1.iadd(delta).ishrn(1);\n }\n while (b.isEven()) {\n b.ishrn(1);\n if (x2.isEven())\n x2.ishrn(1);\n else\n x2.iadd(delta).ishrn(1);\n }\n if (a.cmp(b) >= 0) {\n a.isub(b);\n x1.isub(x2);\n } else {\n b.isub(a);\n x2.isub(x1);\n }\n }\n if (a.cmpn(1) === 0)\n return x1;\n else\n return x2;\n};\n\nBN.prototype.gcd = function gcd(num) {\n if (this.cmpn(0) === 0)\n return num.clone();\n if (num.cmpn(0) === 0)\n return this.clone();\n\n var a = this.clone();\n var b = num.clone();\n a.sign = false;\n b.sign = false;\n\n // Remove common factor of two\n for (var shift = 0; a.isEven() && b.isEven(); shift++) {\n a.ishrn(1);\n b.ishrn(1);\n }\n\n while (a.isEven())\n a.ishrn(1);\n\n do {\n while (b.isEven())\n b.ishrn(1);\n\n // Swap `a` and `b` to make `a` always bigger than `b`\n if (a.cmp(b) < 0) {\n var t = a;\n a = b;\n b = t;\n }\n a.isub(a.div(b).mul(b));\n } while (a.cmpn(0) !== 0 && b.cmpn(0) !== 0);\n if (a.cmpn(0) === 0)\n return b.ishln(shift);\n else\n return a.ishln(shift);\n};\n\n// Invert number in the field F(num)\nBN.prototype.invm = function invm(num) {\n return this._egcd(new BN(1), num).mod(num);\n};\n\nBN.prototype.isEven = function isEven() {\n return (this.words[0] & 1) === 0;\n};\n\nBN.prototype.isOdd = function isOdd() {\n return (this.words[0] & 1) === 1;\n};\n\n// And first word and num\nBN.prototype.andln = function andln(num) {\n return this.words[0] & num;\n};\n\n// Increment at the bit position in-line\nBN.prototype.bincn = function bincn(bit) {\n assert(typeof bit === 'number');\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) {\n for (var i = this.length; i < s + 1; i++)\n this.words[i] = 0;\n this.words[s] |= q;\n this.length = s + 1;\n return this;\n }\n\n // Add bit and propagate, if needed\n var carry = q;\n for (var i = s; carry !== 0 && i < this.length; i++) {\n var w = this.words[i];\n w += carry;\n carry = w >>> 26;\n w &= 0x3ffffff;\n this.words[i] = w;\n }\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n return this;\n};\n\nBN.prototype.cmpn = function cmpn(num) {\n var sign = num < 0;\n if (sign)\n num = -num;\n\n if (this.sign && !sign)\n return -1;\n else if (!this.sign && sign)\n return 1;\n\n num &= 0x3ffffff;\n this.strip();\n\n var res;\n if (this.length > 1) {\n res = 1;\n } else {\n var w = this.words[0];\n res = w === num ? 0 : w < num ? -1 : 1;\n }\n if (this.sign)\n res = -res;\n return res;\n};\n\n// Compare two numbers and return:\n// 1 - if `this` > `num`\n// 0 - if `this` == `num`\n// -1 - if `this` < `num`\nBN.prototype.cmp = function cmp(num) {\n if (this.sign && !num.sign)\n return -1;\n else if (!this.sign && num.sign)\n return 1;\n\n var res = this.ucmp(num);\n if (this.sign)\n return -res;\n else\n return res;\n};\n\n// Unsigned comparison\nBN.prototype.ucmp = function ucmp(num) {\n // At this point both numbers have the same sign\n if (this.length > num.length)\n return 1;\n else if (this.length < num.length)\n return -1;\n\n var res = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var a = this.words[i];\n var b = num.words[i];\n\n if (a === b)\n continue;\n if (a < b)\n res = -1;\n else if (a > b)\n res = 1;\n break;\n }\n return res;\n};\n\n//\n// A reduce context, could be using montgomery or something better, depending\n// on the `m` itself.\n//\nBN.red = function red(num) {\n return new Red(num);\n};\n\nBN.prototype.toRed = function toRed(ctx) {\n assert(!this.red, 'Already a number in reduction context');\n assert(!this.sign, 'red works only with positives');\n return ctx.convertTo(this)._forceRed(ctx);\n};\n\nBN.prototype.fromRed = function fromRed() {\n assert(this.red, 'fromRed works only with numbers in reduction context');\n return this.red.convertFrom(this);\n};\n\nBN.prototype._forceRed = function _forceRed(ctx) {\n this.red = ctx;\n return this;\n};\n\nBN.prototype.forceRed = function forceRed(ctx) {\n assert(!this.red, 'Already a number in reduction context');\n return this._forceRed(ctx);\n};\n\nBN.prototype.redAdd = function redAdd(num) {\n assert(this.red, 'redAdd works only with red numbers');\n return this.red.add(this, num);\n};\n\nBN.prototype.redIAdd = function redIAdd(num) {\n assert(this.red, 'redIAdd works only with red numbers');\n return this.red.iadd(this, num);\n};\n\nBN.prototype.redSub = function redSub(num) {\n assert(this.red, 'redSub works only with red numbers');\n return this.red.sub(this, num);\n};\n\nBN.prototype.redISub = function redISub(num) {\n assert(this.red, 'redISub works only with red numbers');\n return this.red.isub(this, num);\n};\n\nBN.prototype.redShl = function redShl(num) {\n assert(this.red, 'redShl works only with red numbers');\n return this.red.shl(this, num);\n};\n\nBN.prototype.redMul = function redMul(num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.mul(this, num);\n};\n\nBN.prototype.redIMul = function redIMul(num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.imul(this, num);\n};\n\nBN.prototype.redSqr = function redSqr() {\n assert(this.red, 'redSqr works only with red numbers');\n this.red._verify1(this);\n return this.red.sqr(this);\n};\n\nBN.prototype.redISqr = function redISqr() {\n assert(this.red, 'redISqr works only with red numbers');\n this.red._verify1(this);\n return this.red.isqr(this);\n};\n\n// Square root over p\nBN.prototype.redSqrt = function redSqrt() {\n assert(this.red, 'redSqrt works only with red numbers');\n this.red._verify1(this);\n return this.red.sqrt(this);\n};\n\nBN.prototype.redInvm = function redInvm() {\n assert(this.red, 'redInvm works only with red numbers');\n this.red._verify1(this);\n return this.red.invm(this);\n};\n\n// Return negative clone of `this` % `red modulo`\nBN.prototype.redNeg = function redNeg() {\n assert(this.red, 'redNeg works only with red numbers');\n this.red._verify1(this);\n return this.red.neg(this);\n};\n\nBN.prototype.redPow = function redPow(num) {\n assert(this.red && !num.red, 'redPow(normalNum)');\n this.red._verify1(this);\n return this.red.pow(this, num);\n};\n\n// Prime numbers with efficient reduction\nvar primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n};\n\n// Pseudo-Mersenne prime\nfunction MPrime(name, p) {\n // P = 2 ^ N - K\n this.name = name;\n this.p = new BN(p, 16);\n this.n = this.p.bitLength();\n this.k = new BN(1).ishln(this.n).isub(this.p);\n\n this.tmp = this._tmp();\n}\n\nMPrime.prototype._tmp = function _tmp() {\n var tmp = new BN(null);\n tmp.words = new Array(Math.ceil(this.n / 13));\n return tmp;\n};\n\nMPrime.prototype.ireduce = function ireduce(num) {\n // Assumes that `num` is less than `P^2`\n // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)\n var r = num;\n var rlen;\n\n do {\n var pair = r.ishrn(this.n, 0, this.tmp);\n r = this.imulK(pair.hi);\n r = r.iadd(pair.lo);\n rlen = r.bitLength();\n } while (rlen > this.n);\n\n var cmp = rlen < this.n ? -1 : r.cmp(this.p);\n if (cmp === 0) {\n r.words[0] = 0;\n r.length = 1;\n } else if (cmp > 0) {\n r.isub(this.p);\n } else {\n r.strip();\n }\n\n return r;\n};\n\nMPrime.prototype.imulK = function imulK(num) {\n return num.imul(this.k);\n};\n\nfunction K256() {\n MPrime.call(\n this,\n 'k256',\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');\n}\ninherits(K256, MPrime);\n\nK256.prototype.imulK = function imulK(num) {\n // K = 0x1000003d1 = [ 0x40, 0x3d1 ]\n num.words[num.length] = 0;\n num.words[num.length + 1] = 0;\n num.length += 2;\n\n // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390\n var hi;\n var lo = 0;\n for (var i = 0; i < num.length; i++) {\n var w = num.words[i];\n hi = w * 0x40;\n lo += w * 0x3d1;\n hi += (lo / 0x4000000) | 0;\n lo &= 0x3ffffff;\n\n num.words[i] = lo;\n\n lo = hi;\n }\n\n // Fast length reduction\n if (num.words[num.length - 1] === 0) {\n num.length--;\n if (num.words[num.length - 1] === 0)\n num.length--;\n }\n return num;\n};\n\nfunction P224() {\n MPrime.call(\n this,\n 'p224',\n 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');\n}\ninherits(P224, MPrime);\n\nfunction P192() {\n MPrime.call(\n this,\n 'p192',\n 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');\n}\ninherits(P192, MPrime);\n\nfunction P25519() {\n // 2 ^ 255 - 19\n MPrime.call(\n this,\n '25519',\n '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');\n}\ninherits(P25519, MPrime);\n\nP25519.prototype.imulK = function imulK(num) {\n // K = 0x13\n var carry = 0;\n for (var i = 0; i < num.length; i++) {\n var hi = num.words[i] * 0x13 + carry;\n var lo = hi & 0x3ffffff;\n hi >>>= 26;\n\n num.words[i] = lo;\n carry = hi;\n }\n if (carry !== 0)\n num.words[num.length++] = carry;\n return num;\n};\n\n// Exported mostly for testing purposes, use plain name instead\nBN._prime = function prime(name) {\n // Cached version of prime\n if (primes[name])\n return primes[name];\n\n var prime;\n if (name === 'k256')\n prime = new K256();\n else if (name === 'p224')\n prime = new P224();\n else if (name === 'p192')\n prime = new P192();\n else if (name === 'p25519')\n prime = new P25519();\n else\n throw new Error('Unknown prime ' + name);\n primes[name] = prime;\n\n return prime;\n};\n\n//\n// Base reduction engine\n//\nfunction Red(m) {\n if (typeof m === 'string') {\n var prime = BN._prime(m);\n this.m = prime.p;\n this.prime = prime;\n } else {\n this.m = m;\n this.prime = null;\n }\n}\n\nRed.prototype._verify1 = function _verify1(a) {\n assert(!a.sign, 'red works only with positives');\n assert(a.red, 'red works only with red numbers');\n};\n\nRed.prototype._verify2 = function _verify2(a, b) {\n assert(!a.sign && !b.sign, 'red works only with positives');\n assert(a.red && a.red === b.red,\n 'red works only with red numbers');\n};\n\nRed.prototype.imod = function imod(a) {\n if (this.prime)\n return this.prime.ireduce(a)._forceRed(this);\n return a.mod(this.m)._forceRed(this);\n};\n\nRed.prototype.neg = function neg(a) {\n var r = a.clone();\n r.sign = !r.sign;\n return r.iadd(this.m)._forceRed(this);\n};\n\nRed.prototype.add = function add(a, b) {\n this._verify2(a, b);\n\n var res = a.add(b);\n if (res.cmp(this.m) >= 0)\n res.isub(this.m);\n return res._forceRed(this);\n};\n\nRed.prototype.iadd = function iadd(a, b) {\n this._verify2(a, b);\n\n var res = a.iadd(b);\n if (res.cmp(this.m) >= 0)\n res.isub(this.m);\n return res;\n};\n\nRed.prototype.sub = function sub(a, b) {\n this._verify2(a, b);\n\n var res = a.sub(b);\n if (res.cmpn(0) < 0)\n res.iadd(this.m);\n return res._forceRed(this);\n};\n\nRed.prototype.isub = function isub(a, b) {\n this._verify2(a, b);\n\n var res = a.isub(b);\n if (res.cmpn(0) < 0)\n res.iadd(this.m);\n return res;\n};\n\nRed.prototype.shl = function shl(a, num) {\n this._verify1(a);\n return this.imod(a.shln(num));\n};\n\nRed.prototype.imul = function imul(a, b) {\n this._verify2(a, b);\n return this.imod(a.imul(b));\n};\n\nRed.prototype.mul = function mul(a, b) {\n this._verify2(a, b);\n return this.imod(a.mul(b));\n};\n\nRed.prototype.isqr = function isqr(a) {\n return this.imul(a, a);\n};\n\nRed.prototype.sqr = function sqr(a) {\n return this.mul(a, a);\n};\n\nRed.prototype.sqrt = function sqrt(a) {\n if (a.cmpn(0) === 0)\n return a.clone();\n\n var mod3 = this.m.andln(3);\n assert(mod3 % 2 === 1);\n\n // Fast case\n if (mod3 === 3) {\n var pow = this.m.add(new BN(1)).ishrn(2);\n var r = this.pow(a, pow);\n return r;\n }\n\n // Tonelli-Shanks algorithm (Totally unoptimized and slow)\n //\n // Find Q and S, that Q * 2 ^ S = (P - 1)\n var q = this.m.subn(1);\n var s = 0;\n while (q.cmpn(0) !== 0 && q.andln(1) === 0) {\n s++;\n q.ishrn(1);\n }\n assert(q.cmpn(0) !== 0);\n\n var one = new BN(1).toRed(this);\n var nOne = one.redNeg();\n\n // Find quadratic non-residue\n // NOTE: Max is such because of generalized Riemann hypothesis.\n var lpow = this.m.subn(1).ishrn(1);\n var z = this.m.bitLength();\n z = new BN(2 * z * z).toRed(this);\n while (this.pow(z, lpow).cmp(nOne) !== 0)\n z.redIAdd(nOne);\n\n var c = this.pow(z, q);\n var r = this.pow(a, q.addn(1).ishrn(1));\n var t = this.pow(a, q);\n var m = s;\n while (t.cmp(one) !== 0) {\n var tmp = t;\n for (var i = 0; tmp.cmp(one) !== 0; i++)\n tmp = tmp.redSqr();\n assert(i < m);\n var b = this.pow(c, new BN(1).ishln(m - i - 1));\n\n r = r.redMul(b);\n c = b.redSqr();\n t = t.redMul(c);\n m = i;\n }\n\n return r;\n};\n\nRed.prototype.invm = function invm(a) {\n var inv = a._egcd(new BN(1), this.m);\n if (inv.sign) {\n inv.sign = false;\n return this.imod(inv).redNeg();\n } else {\n return this.imod(inv);\n }\n};\n\nRed.prototype.pow = function pow(a, num) {\n var w = [];\n var q = num.clone();\n while (q.cmpn(0) !== 0) {\n w.push(q.andln(1));\n q.ishrn(1);\n }\n\n // Skip leading zeroes\n var res = a;\n for (var i = 0; i < w.length; i++, res = this.sqr(res))\n if (w[i] !== 0)\n break;\n\n if (++i < w.length) {\n for (var q = this.sqr(res); i < w.length; i++, q = this.sqr(q)) {\n if (w[i] === 0)\n continue;\n res = this.mul(res, q);\n }\n }\n\n return res;\n};\n\nRed.prototype.convertTo = function convertTo(num) {\n return num.clone();\n};\n\nRed.prototype.convertFrom = function convertFrom(num) {\n var res = num.clone();\n res.red = null;\n return res;\n};\n\n//\n// Montgomery method engine\n//\n\nBN.mont = function mont(num) {\n return new Mont(num);\n};\n\nfunction Mont(m) {\n Red.call(this, m);\n\n this.shift = this.m.bitLength();\n if (this.shift % 26 !== 0)\n this.shift += 26 - (this.shift % 26);\n this.r = new BN(1).ishln(this.shift);\n this.r2 = this.imod(this.r.sqr());\n this.rinv = this.r.invm(this.m);\n\n this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);\n this.minv.sign = true;\n this.minv = this.minv.mod(this.r);\n}\ninherits(Mont, Red);\n\nMont.prototype.convertTo = function convertTo(num) {\n return this.imod(num.shln(this.shift));\n};\n\nMont.prototype.convertFrom = function convertFrom(num) {\n var r = this.imod(num.mul(this.rinv));\n r.red = null;\n return r;\n};\n\nMont.prototype.imul = function imul(a, b) {\n if (a.cmpn(0) === 0 || b.cmpn(0) === 0) {\n a.words[0] = 0;\n a.length = 1;\n return a;\n }\n\n var t = a.imul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).ishrn(this.shift);\n var res = u;\n if (u.cmp(this.m) >= 0)\n res = u.isub(this.m);\n else if (u.cmpn(0) < 0)\n res = u.iadd(this.m);\n\n return res._forceRed(this);\n};\n\nMont.prototype.mul = function mul(a, b) {\n if (a.cmpn(0) === 0 || b.cmpn(0) === 0)\n return new BN(0)._forceRed(this);\n\n var t = a.mul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).ishrn(this.shift);\n var res = u;\n if (u.cmp(this.m) >= 0)\n res = u.isub(this.m);\n else if (u.cmpn(0) < 0)\n res = u.iadd(this.m);\n\n return res._forceRed(this);\n};\n\nMont.prototype.invm = function invm(a) {\n // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R\n var res = this.imod(a.invm(this.m).mul(this.r2));\n return res._forceRed(this);\n};\n\n})(typeof module === 'undefined' || module, this);\n\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/browserify-rsa/index.js\":[function(require,module,exports){\n(function (Buffer){\nvar bn = require('bn.js');\nmodule.exports = crt;\nfunction blind(priv, crypto) {\n var r = getr(priv, crypto);\n var blinder = r.toRed(bn.mont(priv.modulus))\n .redPow(new bn(priv.publicExponent)).fromRed();\n return {\n blinder: blinder,\n unblinder:r.invm(priv.modulus)\n };\n}\nfunction crt(msg, priv, crypto) {\n var blinds = blind(priv, crypto);\n var len = priv.modulus.byteLength();\n var mod = bn.mont(priv.modulus);\n var blinded = new bn(msg).mul(blinds.blinder).mod(priv.modulus);\n var c1 = blinded.toRed(bn.mont(priv.prime1));\n var c2 = blinded.toRed(bn.mont(priv.prime2));\n var qinv = priv.coefficient;\n var p = priv.prime1;\n var q = priv.prime2;\n var m1 = c1.redPow(priv.exponent1);\n var m2 = c2.redPow(priv.exponent2);\n m1 = m1.fromRed();\n m2 = m2.fromRed();\n var h = m1.isub(m2).imul(qinv).mod(p);\n h.imul(q);\n m2.iadd(h);\n var out = new Buffer(m2.imul(blinds.unblinder).mod(priv.modulus).toArray());\n if (out.length < len) {\n var prefix = new Buffer(len - out.length);\n prefix.fill(0);\n out = Buffer.concat([prefix, out], len);\n }\n return out;\n}\ncrt.getr = getr;\nfunction getr(priv, crypto) {\n var len = priv.modulus.byteLength();\n var r = new bn(crypto.randomBytes(len));\n while (r.cmp(priv.modulus) >= 0 || !r.mod(priv.prime1) || !r.mod(priv.prime2)) {\n r = new bn(crypto.randomBytes(len));\n }\n return r;\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\":[function(require,module,exports){\nvar elliptic = exports;\n\nelliptic.version = require('../package.json').version;\nelliptic.utils = require('./elliptic/utils');\nelliptic.rand = require('brorand');\nelliptic.hmacDRBG = require('./elliptic/hmac-drbg');\nelliptic.curve = require('./elliptic/curve');\nelliptic.curves = require('./elliptic/curves');\n\n// Protocols\nelliptic.ec = require('./elliptic/ec');\n\n},{\"../package.json\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/package.json\",\"./elliptic/curve\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/index.js\",\"./elliptic/curves\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curves.js\",\"./elliptic/ec\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/index.js\",\"./elliptic/hmac-drbg\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/hmac-drbg.js\",\"./elliptic/utils\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/utils.js\",\"brorand\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/base.js\":[function(require,module,exports){\nvar bn = require('bn.js');\nvar elliptic = require('../../elliptic');\n\nvar getNAF = elliptic.utils.getNAF;\nvar getJSF = elliptic.utils.getJSF;\nvar assert = elliptic.utils.assert;\n\nfunction BaseCurve(type, conf) {\n this.type = type;\n this.p = new bn(conf.p, 16);\n\n // Use Montgomery, when there is no fast reduction for the prime\n this.red = conf.prime ? bn.red(conf.prime) : bn.mont(this.p);\n\n // Useful for many curves\n this.zero = new bn(0).toRed(this.red);\n this.one = new bn(1).toRed(this.red);\n this.two = new bn(2).toRed(this.red);\n\n // Curve configuration, optional\n this.n = conf.n && new bn(conf.n, 16);\n this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed);\n\n // Temporary arrays\n this._wnafT1 = new Array(4);\n this._wnafT2 = new Array(4);\n this._wnafT3 = new Array(4);\n this._wnafT4 = new Array(4);\n}\nmodule.exports = BaseCurve;\n\nBaseCurve.prototype.point = function point() {\n throw new Error('Not implemented');\n};\n\nBaseCurve.prototype.validate = function validate(point) {\n throw new Error('Not implemented');\n};\n\nBaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {\n var doubles = p._getDoubles();\n\n var naf = getNAF(k, 1);\n var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1);\n I /= 3;\n\n // Translate into more windowed form\n var repr = [];\n for (var j = 0; j < naf.length; j += doubles.step) {\n var nafW = 0;\n for (var k = j + doubles.step - 1; k >= j; k--)\n nafW = (nafW << 1) + naf[k];\n repr.push(nafW);\n }\n\n var a = this.jpoint(null, null, null);\n var b = this.jpoint(null, null, null);\n for (var i = I; i > 0; i--) {\n for (var j = 0; j < repr.length; j++) {\n var nafW = repr[j];\n if (nafW === i)\n b = b.mixedAdd(doubles.points[j]);\n else if (nafW === -i)\n b = b.mixedAdd(doubles.points[j].neg());\n }\n a = a.add(b);\n }\n return a.toP();\n};\n\nBaseCurve.prototype._wnafMul = function _wnafMul(p, k) {\n var w = 4;\n\n // Precompute window\n var nafPoints = p._getNAFPoints(w);\n w = nafPoints.wnd;\n var wnd = nafPoints.points;\n\n // Get NAF form\n var naf = getNAF(k, w);\n\n // Add `this`*(N+1) for every w-NAF index\n var acc = this.jpoint(null, null, null);\n for (var i = naf.length - 1; i >= 0; i--) {\n // Count zeroes\n for (var k = 0; i >= 0 && naf[i] === 0; i--)\n k++;\n if (i >= 0)\n k++;\n acc = acc.dblp(k);\n\n if (i < 0)\n break;\n var z = naf[i];\n assert(z !== 0);\n if (p.type === 'affine') {\n // J +- P\n if (z > 0)\n acc = acc.mixedAdd(wnd[(z - 1) >> 1]);\n else\n acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg());\n } else {\n // J +- J\n if (z > 0)\n acc = acc.add(wnd[(z - 1) >> 1]);\n else\n acc = acc.add(wnd[(-z - 1) >> 1].neg());\n }\n }\n return p.type === 'affine' ? acc.toP() : acc;\n};\n\nBaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,\n points,\n coeffs,\n len) {\n var wndWidth = this._wnafT1;\n var wnd = this._wnafT2;\n var naf = this._wnafT3;\n\n // Fill all arrays\n var max = 0;\n for (var i = 0; i < len; i++) {\n var p = points[i];\n var nafPoints = p._getNAFPoints(defW);\n wndWidth[i] = nafPoints.wnd;\n wnd[i] = nafPoints.points;\n }\n\n // Comb small window NAFs\n for (var i = len - 1; i >= 1; i -= 2) {\n var a = i - 1;\n var b = i;\n if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {\n naf[a] = getNAF(coeffs[a], wndWidth[a]);\n naf[b] = getNAF(coeffs[b], wndWidth[b]);\n max = Math.max(naf[a].length, max);\n max = Math.max(naf[b].length, max);\n continue;\n }\n\n var comb = [\n points[a], /* 1 */\n null, /* 3 */\n null, /* 5 */\n points[b] /* 7 */\n ];\n\n // Try to avoid Projective points, if possible\n if (points[a].y.cmp(points[b].y) === 0) {\n comb[1] = points[a].add(points[b]);\n comb[2] = points[a].toJ().mixedAdd(points[b].neg());\n } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) {\n comb[1] = points[a].toJ().mixedAdd(points[b]);\n comb[2] = points[a].add(points[b].neg());\n } else {\n comb[1] = points[a].toJ().mixedAdd(points[b]);\n comb[2] = points[a].toJ().mixedAdd(points[b].neg());\n }\n\n var index = [\n -3, /* -1 -1 */\n -1, /* -1 0 */\n -5, /* -1 1 */\n -7, /* 0 -1 */\n 0, /* 0 0 */\n 7, /* 0 1 */\n 5, /* 1 -1 */\n 1, /* 1 0 */\n 3 /* 1 1 */\n ];\n\n var jsf = getJSF(coeffs[a], coeffs[b]);\n max = Math.max(jsf[0].length, max);\n naf[a] = new Array(max);\n naf[b] = new Array(max);\n for (var j = 0; j < max; j++) {\n var ja = jsf[0][j] | 0;\n var jb = jsf[1][j] | 0;\n\n naf[a][j] = index[(ja + 1) * 3 + (jb + 1)];\n naf[b][j] = 0;\n wnd[a] = comb;\n }\n }\n\n var acc = this.jpoint(null, null, null);\n var tmp = this._wnafT4;\n for (var i = max; i >= 0; i--) {\n var k = 0;\n\n while (i >= 0) {\n var zero = true;\n for (var j = 0; j < len; j++) {\n tmp[j] = naf[j][i] | 0;\n if (tmp[j] !== 0)\n zero = false;\n }\n if (!zero)\n break;\n k++;\n i--;\n }\n if (i >= 0)\n k++;\n acc = acc.dblp(k);\n if (i < 0)\n break;\n\n for (var j = 0; j < len; j++) {\n var z = tmp[j];\n var p;\n if (z === 0)\n continue;\n else if (z > 0)\n p = wnd[j][(z - 1) >> 1];\n else if (z < 0)\n p = wnd[j][(-z - 1) >> 1].neg();\n\n if (p.type === 'affine')\n acc = acc.mixedAdd(p);\n else\n acc = acc.add(p);\n }\n }\n // Zeroify references\n for (var i = 0; i < len; i++)\n wnd[i] = null;\n return acc.toP();\n};\n\nBaseCurve.BasePoint = BasePoint;\n\nfunction BasePoint(curve, type) {\n this.curve = curve;\n this.type = type;\n this.precomputed = null;\n}\n\nBasePoint.prototype.validate = function validate() {\n return this.curve.validate(this);\n};\n\nBasePoint.prototype.precompute = function precompute(power, _beta) {\n if (this.precomputed)\n return this;\n\n var precomputed = {\n doubles: null,\n naf: null,\n beta: null\n };\n precomputed.naf = this._getNAFPoints(8);\n precomputed.doubles = this._getDoubles(4, power);\n precomputed.beta = this._getBeta();\n this.precomputed = precomputed;\n\n return this;\n};\n\nBasePoint.prototype._getDoubles = function _getDoubles(step, power) {\n if (this.precomputed && this.precomputed.doubles)\n return this.precomputed.doubles;\n\n var doubles = [ this ];\n var acc = this;\n for (var i = 0; i < power; i += step) {\n for (var j = 0; j < step; j++)\n acc = acc.dbl();\n doubles.push(acc);\n }\n return {\n step: step,\n points: doubles\n };\n};\n\nBasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {\n if (this.precomputed && this.precomputed.naf)\n return this.precomputed.naf;\n\n var res = [ this ];\n var max = (1 << wnd) - 1;\n var dbl = max === 1 ? null : this.dbl();\n for (var i = 1; i < max; i++)\n res[i] = res[i - 1].add(dbl);\n return {\n wnd: wnd,\n points: res\n };\n};\n\nBasePoint.prototype._getBeta = function _getBeta() {\n return null;\n};\n\nBasePoint.prototype.dblp = function dblp(k) {\n var r = this;\n for (var i = 0; i < k; i++)\n r = r.dbl();\n return r;\n};\n\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/edwards.js\":[function(require,module,exports){\nvar curve = require('../curve');\nvar elliptic = require('../../elliptic');\nvar bn = require('bn.js');\nvar inherits = require('inherits');\nvar Base = curve.base;\n\nvar getNAF = elliptic.utils.getNAF;\nvar assert = elliptic.utils.assert;\n\nfunction EdwardsCurve(conf) {\n // NOTE: Important as we are creating point in Base.call()\n this.twisted = conf.a != 1;\n this.mOneA = this.twisted && conf.a == -1;\n this.extended = this.mOneA;\n\n Base.call(this, 'mont', conf);\n\n this.a = new bn(conf.a, 16).mod(this.red.m).toRed(this.red);\n this.c = new bn(conf.c, 16).toRed(this.red);\n this.c2 = this.c.redSqr();\n this.d = new bn(conf.d, 16).toRed(this.red);\n this.dd = this.d.redAdd(this.d);\n\n assert(!this.twisted || this.c.fromRed().cmpn(1) === 0);\n this.oneC = conf.c == 1;\n}\ninherits(EdwardsCurve, Base);\nmodule.exports = EdwardsCurve;\n\nEdwardsCurve.prototype._mulA = function _mulA(num) {\n if (this.mOneA)\n return num.redNeg();\n else\n return this.a.redMul(num);\n};\n\nEdwardsCurve.prototype._mulC = function _mulC(num) {\n if (this.oneC)\n return num;\n else\n return this.c.redMul(num);\n};\n\nEdwardsCurve.prototype.point = function point(x, y, z, t) {\n return new Point(this, x, y, z, t);\n};\n\n// Just for compatibility with Short curve\nEdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) {\n return this.point(x, y, z, t);\n};\n\nEdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) {\n return Point.fromJSON(this, obj);\n};\n\nEdwardsCurve.prototype.pointFromX = function pointFromX(odd, x) {\n x = new bn(x, 16);\n if (!x.red)\n x = x.toRed(this.red);\n\n var x2 = x.redSqr();\n var rhs = this.c2.redSub(this.a.redMul(x2));\n var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2));\n\n var y = rhs.redMul(lhs.redInvm()).redSqrt();\n var isOdd = y.fromRed().isOdd();\n if (odd && !isOdd || !odd && isOdd)\n y = y.redNeg();\n\n return this.point(x, y, curve.one);\n};\n\nEdwardsCurve.prototype.validate = function validate(point) {\n if (point.isInfinity())\n return true;\n\n // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2)\n point.normalize();\n\n var x2 = point.x.redSqr();\n var y2 = point.y.redSqr();\n var lhs = x2.redMul(this.a).redAdd(y2);\n var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));\n\n return lhs.cmp(rhs) === 0;\n};\n\nfunction Point(curve, x, y, z, t) {\n Base.BasePoint.call(this, curve, 'projective');\n if (x === null && y === null && z === null) {\n this.x = this.curve.zero;\n this.y = this.curve.one;\n this.z = this.curve.one;\n this.t = this.curve.zero;\n this.zOne = true;\n } else {\n this.x = new bn(x, 16);\n this.y = new bn(y, 16);\n this.z = z ? new bn(z, 16) : this.curve.one;\n this.t = t && new bn(t, 16);\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.y.red)\n this.y = this.y.toRed(this.curve.red);\n if (!this.z.red)\n this.z = this.z.toRed(this.curve.red);\n if (this.t && !this.t.red)\n this.t = this.t.toRed(this.curve.red);\n this.zOne = this.z === this.curve.one;\n\n // Use extended coordinates\n if (this.curve.extended && !this.t) {\n this.t = this.x.redMul(this.y);\n if (!this.zOne)\n this.t = this.t.redMul(this.z.redInvm());\n }\n }\n}\ninherits(Point, Base.BasePoint);\n\nPoint.fromJSON = function fromJSON(curve, obj) {\n return new Point(curve, obj[0], obj[1], obj[2]);\n};\n\nPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nPoint.prototype.isInfinity = function isInfinity() {\n // XXX This code assumes that zero is always zero in red\n return this.x.cmpn(0) === 0 &&\n this.y.cmp(this.z) === 0;\n};\n\nPoint.prototype._extDbl = function _extDbl() {\n // http://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#doubling-dbl-2008-hwcd\n // 4M + 4S\n\n // A = X1^2\n var a = this.x.redSqr();\n // B = Y1^2\n var b = this.y.redSqr();\n // C = 2 * Z1^2\n var c = this.z.redSqr();\n c = c.redIAdd(c);\n // D = a * A\n var d = this.curve._mulA(a);\n // E = (X1 + Y1)^2 - A - B\n var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b);\n // G = D + B\n var g = d.redAdd(b);\n // F = G - C\n var f = g.redSub(c);\n // H = D - B\n var h = d.redSub(b);\n // X3 = E * F\n var nx = e.redMul(f);\n // Y3 = G * H\n var ny = g.redMul(h);\n // T3 = E * H\n var nt = e.redMul(h);\n // Z3 = F * G\n var nz = f.redMul(g);\n return this.curve.point(nx, ny, nz, nt);\n};\n\nPoint.prototype._projDbl = function _projDbl() {\n // http://hyperelliptic.org/EFD/g1p/auto-twisted-projective.html#doubling-dbl-2008-bbjlp\n // http://hyperelliptic.org/EFD/g1p/auto-edwards-projective.html#doubling-dbl-2007-bl\n // and others\n // Generally 3M + 4S or 2M + 4S\n\n // B = (X1 + Y1)^2\n var b = this.x.redAdd(this.y).redSqr();\n // C = X1^2\n var c = this.x.redSqr();\n // D = Y1^2\n var d = this.y.redSqr();\n\n if (this.curve.twisted) {\n // E = a * C\n var e = this.curve._mulA(c);\n // F = E + D\n var f = e.redAdd(d);\n if (this.zOne) {\n // X3 = (B - C - D) * (F - 2)\n var nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two));\n // Y3 = F * (E - D)\n var ny = f.redMul(e.redSub(d));\n // Z3 = F^2 - 2 * F\n var nz = f.redSqr().redSub(f).redSub(f);\n } else {\n // H = Z1^2\n var h = this.z.redSqr();\n // J = F - 2 * H\n var j = f.redSub(h).redISub(h);\n // X3 = (B-C-D)*J\n var nx = b.redSub(c).redISub(d).redMul(j);\n // Y3 = F * (E - D)\n var ny = f.redMul(e.redSub(d));\n // Z3 = F * J\n var nz = f.redMul(j);\n }\n } else {\n // E = C + D\n var e = c.redAdd(d);\n // H = (c * Z1)^2\n var h = this.curve._mulC(redMul(this.z)).redSqr();\n // J = E - 2 * H\n var j = e.redSub(h).redSub(h);\n // X3 = c * (B - E) * J\n var nx = this.curve._mulC(b.redISub(e)).redMul(j);\n // Y3 = c * E * (C - D)\n var ny = this.curve._mulC(e).redMul(c.redISub(d));\n // Z3 = E * J\n var nz = e.redMul(j);\n }\n return this.curve.point(nx, ny, nz);\n};\n\nPoint.prototype.dbl = function dbl() {\n if (this.isInfinity())\n return this;\n\n // Double in extended coordinates\n if (this.curve.extended)\n return this._extDbl();\n else\n return this._projDbl();\n};\n\nPoint.prototype._extAdd = function _extAdd(p) {\n // http://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#addition-add-2008-hwcd-3\n // 8M\n\n // A = (Y1 - X1) * (Y2 - X2)\n var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x));\n // B = (Y1 + X1) * (Y2 + X2)\n var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x));\n // C = T1 * k * T2\n var c = this.t.redMul(this.curve.dd).redMul(p.t);\n // D = Z1 * 2 * Z2\n var d = this.z.redMul(p.z.redAdd(p.z));\n // E = B - A\n var e = b.redSub(a);\n // F = D - C\n var f = d.redSub(c);\n // G = D + C\n var g = d.redAdd(c);\n // H = B + A\n var h = b.redAdd(a);\n // X3 = E * F\n var nx = e.redMul(f);\n // Y3 = G * H\n var ny = g.redMul(h);\n // T3 = E * H\n var nt = e.redMul(h);\n // Z3 = F * G\n var nz = f.redMul(g);\n return this.curve.point(nx, ny, nz, nt);\n};\n\nPoint.prototype._projAdd = function _projAdd(p) {\n // http://hyperelliptic.org/EFD/g1p/auto-twisted-projective.html#addition-add-2008-bbjlp\n // http://hyperelliptic.org/EFD/g1p/auto-edwards-projective.html#addition-add-2007-bl\n // 10M + 1S\n\n // A = Z1 * Z2\n var a = this.z.redMul(p.z);\n // B = A^2\n var b = a.redSqr();\n // C = X1 * X2\n var c = this.x.redMul(p.x);\n // D = Y1 * Y2\n var d = this.y.redMul(p.y);\n // E = d * C * D\n var e = this.curve.d.redMul(c).redMul(d);\n // F = B - E\n var f = b.redSub(e);\n // G = B + E\n var g = b.redAdd(e);\n // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D)\n var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d);\n var nx = a.redMul(f).redMul(tmp);\n if (this.curve.twisted) {\n // Y3 = A * G * (D - a * C)\n var ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c)));\n // Z3 = F * G\n var nz = f.redMul(g);\n } else {\n // Y3 = A * G * (D - C)\n var ny = a.redMul(g).redMul(d.redSub(c));\n // Z3 = c * F * G\n var nz = this.curve._mulC(f).redMul(g);\n }\n return this.curve.point(nx, ny, nz);\n};\n\nPoint.prototype.add = function add(p) {\n if (this.isInfinity())\n return p;\n if (p.isInfinity())\n return this;\n\n if (this.curve.extended)\n return this._extAdd(p);\n else\n return this._projAdd(p);\n};\n\nPoint.prototype.mul = function mul(k) {\n if (this.precomputed && this.precomputed.doubles)\n return this.curve._fixedNafMul(this, k);\n else\n return this.curve._wnafMul(this, k);\n};\n\nPoint.prototype.mulAdd = function mulAdd(k1, p, k2) {\n return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2);\n};\n\nPoint.prototype.normalize = function normalize() {\n if (this.zOne)\n return this;\n\n // Normalize coordinates\n var zi = this.z.redInvm();\n this.x = this.x.redMul(zi);\n this.y = this.y.redMul(zi);\n if (this.t)\n this.t = this.t.redMul(zi);\n this.z = this.curve.one;\n this.zOne = true;\n return this;\n};\n\nPoint.prototype.neg = function neg() {\n return this.curve.point(this.x.redNeg(),\n this.y,\n this.z,\n this.t && this.t.redNeg());\n};\n\nPoint.prototype.getX = function getX() {\n this.normalize();\n return this.x.fromRed();\n};\n\nPoint.prototype.getY = function getY() {\n this.normalize();\n return this.y.fromRed();\n};\n\n// Compatibility with BaseCurve\nPoint.prototype.toP = Point.prototype.normalize;\nPoint.prototype.mixedAdd = Point.prototype.add;\n\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\",\"../curve\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/index.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/index.js\":[function(require,module,exports){\nvar curve = exports;\n\ncurve.base = require('./base');\ncurve.short = require('./short');\ncurve.mont = require('./mont');\ncurve.edwards = require('./edwards');\n\n},{\"./base\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/base.js\",\"./edwards\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/edwards.js\",\"./mont\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/mont.js\",\"./short\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/short.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/mont.js\":[function(require,module,exports){\nvar curve = require('../curve');\nvar elliptic = require('../../elliptic');\nvar bn = require('bn.js');\nvar inherits = require('inherits');\nvar Base = curve.base;\n\nvar getNAF = elliptic.utils.getNAF;\nvar assert = elliptic.utils.assert;\n\nfunction MontCurve(conf) {\n Base.call(this, 'mont', conf);\n\n this.a = new bn(conf.a, 16).toRed(this.red);\n this.b = new bn(conf.b, 16).toRed(this.red);\n this.i4 = new bn(4).toRed(this.red).redInvm();\n this.two = new bn(2).toRed(this.red);\n this.a24 = this.i4.redMul(this.a.redAdd(this.two));\n}\ninherits(MontCurve, Base);\nmodule.exports = MontCurve;\n\nMontCurve.prototype.point = function point(x, z) {\n return new Point(this, x, z);\n};\n\nMontCurve.prototype.pointFromJSON = function pointFromJSON(obj) {\n return Point.fromJSON(this, obj);\n}\n\nMontCurve.prototype.validate = function validate(point) {\n var x = point.normalize().x;\n var x2 = x.redSqr();\n var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);\n var y = rhs.redSqrt();\n\n return y.redSqr().cmp(rhs) === 0;\n};\n\nfunction Point(curve, x, z) {\n Base.BasePoint.call(this, curve, 'projective');\n if (x === null && z === null) {\n this.x = this.curve.one;\n this.z = this.curve.zero;\n } else {\n this.x = new bn(x, 16);\n this.z = new bn(z, 16);\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.z.red)\n this.z = this.z.toRed(this.curve.red);\n }\n}\ninherits(Point, Base.BasePoint);\n\nPoint.prototype.precompute = function precompute() {\n // No-op\n};\n\nPoint.fromJSON = function fromJSON(curve, obj) {\n return new Point(curve, obj[0], obj[1] || curve.one);\n};\n\nPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nPoint.prototype.isInfinity = function isInfinity() {\n // XXX This code assumes that zero is always zero in red\n return this.z.cmpn(0) === 0;\n};\n\nPoint.prototype.dbl = function dbl() {\n // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3\n // 2M + 2S + 4A\n\n // A = X1 + Z1\n var a = this.x.redAdd(this.z);\n // AA = A^2\n var aa = a.redSqr();\n // B = X1 - Z1\n var b = this.x.redSub(this.z);\n // BB = B^2\n var bb = b.redSqr();\n // C = AA - BB\n var c = aa.redSub(bb);\n // X3 = AA * BB\n var nx = aa.redMul(bb);\n // Z3 = C * (BB + A24 * C)\n var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c)));\n return this.curve.point(nx, nz);\n};\n\nPoint.prototype.add = function add(p) {\n throw new Error('Not supported on Montgomery curve');\n};\n\nPoint.prototype.diffAdd = function diffAdd(p, diff) {\n // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3\n // 4M + 2S + 6A\n\n // A = X2 + Z2\n var a = this.x.redAdd(this.z);\n // B = X2 - Z2\n var b = this.x.redSub(this.z);\n // C = X3 + Z3\n var c = p.x.redAdd(p.z);\n // D = X3 - Z3\n var d = p.x.redSub(p.z);\n // DA = D * A\n var da = d.redMul(a);\n // CB = C * B\n var cb = c.redMul(b);\n // X5 = Z1 * (DA + CB)^2\n var nx = diff.z.redMul(da.redAdd(cb).redSqr());\n // Z5 = X1 * (DA - CB)^2\n var nz = diff.x.redMul(da.redISub(cb).redSqr());\n return this.curve.point(nx, nz);\n};\n\nPoint.prototype.mul = function mul(k) {\n var t = k.clone();\n var a = this; // (N / 2) * Q + Q\n var b = this.curve.point(null, null); // (N / 2) * Q\n var c = this; // Q\n\n for (var bits = []; t.cmpn(0) !== 0; t.ishrn(1))\n bits.push(t.andln(1));\n\n for (var i = bits.length - 1; i >= 0; i--) {\n if (bits[i] === 0) {\n // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q\n a = a.diffAdd(b, c);\n // N * Q = 2 * ((N / 2) * Q + Q))\n b = b.dbl();\n } else {\n // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q)\n b = a.diffAdd(b, c);\n // N * Q + Q = 2 * ((N / 2) * Q + Q)\n a = a.dbl();\n }\n }\n return b;\n};\n\nPoint.prototype.mulAdd = function mulAdd() {\n throw new Error('Not supported on Montgomery curve');\n};\n\nPoint.prototype.normalize = function normalize() {\n this.x = this.x.redMul(this.z.redInvm());\n this.z = this.curve.one;\n return this;\n};\n\nPoint.prototype.getX = function getX() {\n // Normalize coordinates\n this.normalize();\n\n return this.x.fromRed();\n};\n\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\",\"../curve\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/index.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/short.js\":[function(require,module,exports){\nvar curve = require('../curve');\nvar elliptic = require('../../elliptic');\nvar bn = require('bn.js');\nvar inherits = require('inherits');\nvar Base = curve.base;\n\nvar getNAF = elliptic.utils.getNAF;\nvar assert = elliptic.utils.assert;\n\nfunction ShortCurve(conf) {\n Base.call(this, 'short', conf);\n\n this.a = new bn(conf.a, 16).toRed(this.red);\n this.b = new bn(conf.b, 16).toRed(this.red);\n this.tinv = this.two.redInvm();\n\n this.zeroA = this.a.fromRed().cmpn(0) === 0;\n this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0;\n\n // If the curve is endomorphic, precalculate beta and lambda\n this.endo = this._getEndomorphism(conf);\n this._endoWnafT1 = new Array(4);\n this._endoWnafT2 = new Array(4);\n}\ninherits(ShortCurve, Base);\nmodule.exports = ShortCurve;\n\nShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {\n // No efficient endomorphism\n if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)\n return;\n\n // Compute beta and lambda, that lambda * P = (beta * Px; Py)\n var beta;\n var lambda;\n if (conf.beta) {\n beta = new bn(conf.beta, 16).toRed(this.red);\n } else {\n var betas = this._getEndoRoots(this.p);\n // Choose the smallest beta\n beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1];\n beta = beta.toRed(this.red);\n }\n if (conf.lambda) {\n lambda = new bn(conf.lambda, 16);\n } else {\n // Choose the lambda that is matching selected beta\n var lambdas = this._getEndoRoots(this.n);\n if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) {\n lambda = lambdas[0];\n } else {\n lambda = lambdas[1];\n assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);\n }\n }\n\n // Get basis vectors, used for balanced length-two representation\n var basis;\n if (conf.basis) {\n basis = conf.basis.map(function(vec) {\n return {\n a: new bn(vec.a, 16),\n b: new bn(vec.b, 16),\n };\n });\n } else {\n basis = this._getEndoBasis(lambda);\n }\n\n return {\n beta: beta,\n lambda: lambda,\n basis: basis\n };\n};\n\nShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) {\n // Find roots of for x^2 + x + 1 in F\n // Root = (-1 +- Sqrt(-3)) / 2\n //\n var red = num === this.p ? this.red : bn.mont(num);\n var tinv = new bn(2).toRed(red).redInvm();\n var ntinv = tinv.redNeg();\n var one = new bn(1).toRed(red);\n\n var s = new bn(3).toRed(red).redNeg().redSqrt().redMul(tinv);\n\n var l1 = ntinv.redAdd(s).fromRed();\n var l2 = ntinv.redSub(s).fromRed();\n return [ l1, l2 ];\n};\n\nShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) {\n // aprxSqrt >= sqrt(this.n)\n var aprxSqrt = this.n.shrn(Math.floor(this.n.bitLength() / 2));\n\n // 3.74\n // Run EGCD, until r(L + 1) < aprxSqrt\n var u = lambda;\n var v = this.n.clone();\n var x1 = new bn(1);\n var y1 = new bn(0);\n var x2 = new bn(0);\n var y2 = new bn(1);\n\n // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n)\n var a0;\n var b0;\n // First vector\n var a1;\n var b1;\n // Second vector\n var a2;\n var b2;\n\n var prevR;\n var i = 0;\n while (u.cmpn(0) !== 0) {\n var q = v.div(u);\n var r = v.sub(q.mul(u));\n var x = x2.sub(q.mul(x1));\n var y = y2.sub(q.mul(y1));\n\n if (!a1 && r.cmp(aprxSqrt) < 0) {\n a0 = prevR.neg();\n b0 = x1;\n a1 = r.neg();\n b1 = x;\n } else if (a1 && ++i === 2) {\n break;\n }\n prevR = r;\n\n v = u;\n u = r;\n x2 = x1;\n x1 = x;\n y2 = y1;\n y1 = y;\n }\n a2 = r.neg();\n b2 = x;\n\n var len1 = a1.sqr().add(b1.sqr());\n var len2 = a2.sqr().add(b2.sqr());\n if (len2.cmp(len1) >= 0) {\n a2 = a0;\n b2 = b0;\n }\n\n // Normalize signs\n if (a1.sign) {\n a1 = a1.neg();\n b1 = b1.neg();\n }\n if (a2.sign) {\n a2 = a2.neg();\n b2 = b2.neg();\n }\n\n return [\n { a: a1, b: b1 },\n { a: a2, b: b2 }\n ];\n};\n\nShortCurve.prototype._endoSplit = function _endoSplit(k) {\n var basis = this.endo.basis;\n var v1 = basis[0];\n var v2 = basis[1];\n\n var c1 = v2.b.mul(k).divRound(this.n);\n var c2 = v1.b.neg().mul(k).divRound(this.n);\n\n var p1 = c1.mul(v1.a);\n var p2 = c2.mul(v2.a);\n var q1 = c1.mul(v1.b);\n var q2 = c2.mul(v2.b);\n\n // Calculate answer\n var k1 = k.sub(p1).sub(p2);\n var k2 = q1.add(q2).neg();\n return { k1: k1, k2: k2 };\n};\n\nShortCurve.prototype.point = function point(x, y, isRed) {\n return new Point(this, x, y, isRed);\n};\n\nShortCurve.prototype.pointFromX = function pointFromX(odd, x) {\n x = new bn(x, 16);\n if (!x.red)\n x = x.toRed(this.red);\n\n var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);\n var y = y2.redSqrt();\n\n // XXX Is there any way to tell if the number is odd without converting it\n // to non-red form?\n var isOdd = y.fromRed().isOdd();\n if (odd && !isOdd || !odd && isOdd)\n y = y.redNeg();\n\n return this.point(x, y);\n};\n\nShortCurve.prototype.jpoint = function jpoint(x, y, z) {\n return new JPoint(this, x, y, z);\n};\n\nShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) {\n return Point.fromJSON(this, obj, red);\n};\n\nShortCurve.prototype.validate = function validate(point) {\n if (point.inf)\n return true;\n\n var x = point.x;\n var y = point.y;\n\n var ax = this.a.redMul(x);\n var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);\n return y.redSqr().redISub(rhs).cmpn(0) === 0;\n};\n\nShortCurve.prototype._endoWnafMulAdd = function _endoWnafMulAdd(points, coeffs) {\n var npoints = this._endoWnafT1;\n var ncoeffs = this._endoWnafT2;\n for (var i = 0; i < points.length; i++) {\n var split = this._endoSplit(coeffs[i]);\n var p = points[i];\n var beta = p._getBeta();\n\n if (split.k1.sign) {\n split.k1.sign = !split.k1.sign;\n p = p.neg(true);\n }\n if (split.k2.sign) {\n split.k2.sign = !split.k2.sign;\n beta = beta.neg(true);\n }\n\n npoints[i * 2] = p;\n npoints[i * 2 + 1] = beta;\n ncoeffs[i * 2] = split.k1;\n ncoeffs[i * 2 + 1] = split.k2;\n }\n var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2);\n\n // Clean-up references to points and coefficients\n for (var j = 0; j < i * 2; j++) {\n npoints[j] = null;\n ncoeffs[j] = null;\n }\n return res;\n};\n\nfunction Point(curve, x, y, isRed) {\n Base.BasePoint.call(this, curve, 'affine');\n if (x === null && y === null) {\n this.x = null;\n this.y = null;\n this.inf = true;\n } else {\n this.x = new bn(x, 16);\n this.y = new bn(y, 16);\n // Force redgomery representation when loading from JSON\n if (isRed) {\n this.x.forceRed(this.curve.red);\n this.y.forceRed(this.curve.red);\n }\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.y.red)\n this.y = this.y.toRed(this.curve.red);\n this.inf = false;\n }\n}\ninherits(Point, Base.BasePoint);\n\nPoint.prototype._getBeta = function _getBeta() {\n if (!this.curve.endo)\n return;\n\n var pre = this.precomputed;\n if (pre && pre.beta)\n return pre.beta;\n\n var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);\n if (pre) {\n var curve = this.curve;\n function endoMul(p) {\n return curve.point(p.x.redMul(curve.endo.beta), p.y);\n }\n pre.beta = beta;\n beta.precomputed = {\n beta: null,\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(endoMul)\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(endoMul)\n }\n };\n }\n return beta;\n};\n\nPoint.prototype.toJSON = function toJSON() {\n if (!this.precomputed)\n return [ this.x, this.y ];\n\n return [ this.x, this.y, this.precomputed && {\n doubles: this.precomputed.doubles && {\n step: this.precomputed.doubles.step,\n points: this.precomputed.doubles.points.slice(1)\n },\n naf: this.precomputed.naf && {\n wnd: this.precomputed.naf.wnd,\n points: this.precomputed.naf.points.slice(1)\n }\n }];\n};\n\nPoint.fromJSON = function fromJSON(curve, obj, red) {\n if (typeof obj === 'string')\n obj = JSON.parse(obj);\n var res = curve.point(obj[0], obj[1], red);\n if (!obj[2])\n return res;\n\n function obj2point(obj) {\n return curve.point(obj[0], obj[1], red);\n }\n\n var pre = obj[2];\n res.precomputed = {\n beta: null,\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: [ res ].concat(pre.doubles.points.map(obj2point))\n },\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: [ res ].concat(pre.naf.points.map(obj2point))\n }\n };\n return res;\n};\n\nPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nPoint.prototype.isInfinity = function isInfinity() {\n return this.inf;\n};\n\nPoint.prototype.add = function add(p) {\n // O + P = P\n if (this.inf)\n return p;\n\n // P + O = P\n if (p.inf)\n return this;\n\n // P + P = 2P\n if (this.eq(p))\n return this.dbl();\n\n // P + (-P) = O\n if (this.neg().eq(p))\n return this.curve.point(null, null);\n\n // P + Q = O\n if (this.x.cmp(p.x) === 0)\n return this.curve.point(null, null);\n\n var c = this.y.redSub(p.y);\n if (c.cmpn(0) !== 0)\n c = c.redMul(this.x.redSub(p.x).redInvm());\n var nx = c.redSqr().redISub(this.x).redISub(p.x);\n var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n};\n\nPoint.prototype.dbl = function dbl() {\n if (this.inf)\n return this;\n\n // 2P = O\n var ys1 = this.y.redAdd(this.y);\n if (ys1.cmpn(0) === 0)\n return this.curve.point(null, null);\n\n var a = this.curve.a;\n\n var x2 = this.x.redSqr();\n var dyinv = ys1.redInvm();\n var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);\n\n var nx = c.redSqr().redISub(this.x.redAdd(this.x));\n var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n};\n\nPoint.prototype.getX = function getX() {\n return this.x.fromRed();\n};\n\nPoint.prototype.getY = function getY() {\n return this.y.fromRed();\n};\n\nPoint.prototype.mul = function mul(k) {\n k = new bn(k, 16);\n\n if (this.precomputed && this.precomputed.doubles)\n return this.curve._fixedNafMul(this, k);\n else if (this.curve.endo)\n return this.curve._endoWnafMulAdd([ this ], [ k ]);\n else\n return this.curve._wnafMul(this, k);\n};\n\nPoint.prototype.mulAdd = function mulAdd(k1, p2, k2) {\n var points = [ this, p2 ];\n var coeffs = [ k1, k2 ];\n if (this.curve.endo)\n return this.curve._endoWnafMulAdd(points, coeffs);\n else\n return this.curve._wnafMulAdd(1, points, coeffs, 2);\n};\n\nPoint.prototype.eq = function eq(p) {\n return this === p ||\n this.inf === p.inf &&\n (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);\n};\n\nPoint.prototype.neg = function neg(_precompute) {\n if (this.inf)\n return this;\n\n var res = this.curve.point(this.x, this.y.redNeg());\n if (_precompute && this.precomputed) {\n var pre = this.precomputed;\n function negate(p) {\n return p.neg();\n }\n res.precomputed = {\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(negate)\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(negate)\n }\n };\n }\n return res;\n};\n\nPoint.prototype.toJ = function toJ() {\n if (this.inf)\n return this.curve.jpoint(null, null, null);\n\n var res = this.curve.jpoint(this.x, this.y, this.curve.one);\n return res;\n};\n\nfunction JPoint(curve, x, y, z) {\n Base.BasePoint.call(this, curve, 'jacobian');\n if (x === null && y === null && z === null) {\n this.x = this.curve.one;\n this.y = this.curve.one;\n this.z = new bn(0);\n } else {\n this.x = new bn(x, 16);\n this.y = new bn(y, 16);\n this.z = new bn(z, 16);\n }\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.y.red)\n this.y = this.y.toRed(this.curve.red);\n if (!this.z.red)\n this.z = this.z.toRed(this.curve.red);\n\n this.zOne = this.z === this.curve.one;\n}\ninherits(JPoint, Base.BasePoint);\n\nJPoint.prototype.toP = function toP() {\n if (this.isInfinity())\n return this.curve.point(null, null);\n\n var zinv = this.z.redInvm();\n var zinv2 = zinv.redSqr();\n var ax = this.x.redMul(zinv2);\n var ay = this.y.redMul(zinv2).redMul(zinv);\n\n return this.curve.point(ax, ay);\n};\n\nJPoint.prototype.neg = function neg() {\n return this.curve.jpoint(this.x, this.y.redNeg(), this.z);\n};\n\nJPoint.prototype.add = function add(p) {\n // O + P = P\n if (this.isInfinity())\n return p;\n\n // P + O = P\n if (p.isInfinity())\n return this;\n\n // 12M + 4S + 7A\n var pz2 = p.z.redSqr();\n var z2 = this.z.redSqr();\n var u1 = this.x.redMul(pz2);\n var u2 = p.x.redMul(z2);\n var s1 = this.y.redMul(pz2.redMul(p.z));\n var s2 = p.y.redMul(z2.redMul(this.z));\n\n var h = u1.redSub(u2);\n var r = s1.redSub(s2);\n if (h.cmpn(0) === 0) {\n if (r.cmpn(0) !== 0)\n return this.curve.jpoint(null, null, null);\n else\n return this.dbl();\n }\n\n var h2 = h.redSqr();\n var h3 = h2.redMul(h);\n var v = u1.redMul(h2);\n\n var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);\n var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));\n var nz = this.z.redMul(p.z).redMul(h);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.mixedAdd = function mixedAdd(p) {\n // O + P = P\n if (this.isInfinity())\n return p.toJ();\n\n // P + O = P\n if (p.isInfinity())\n return this;\n\n // 8M + 3S + 7A\n var z2 = this.z.redSqr();\n var u1 = this.x;\n var u2 = p.x.redMul(z2);\n var s1 = this.y;\n var s2 = p.y.redMul(z2).redMul(this.z);\n\n var h = u1.redSub(u2);\n var r = s1.redSub(s2);\n if (h.cmpn(0) === 0) {\n if (r.cmpn(0) !== 0)\n return this.curve.jpoint(null, null, null);\n else\n return this.dbl();\n }\n\n var h2 = h.redSqr();\n var h3 = h2.redMul(h);\n var v = u1.redMul(h2);\n\n var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);\n var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));\n var nz = this.z.redMul(h);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.dblp = function dblp(pow) {\n if (pow === 0)\n return this;\n if (this.isInfinity())\n return this;\n if (!pow)\n return this.dbl();\n\n if (this.curve.zeroA || this.curve.threeA) {\n var r = this;\n for (var i = 0; i < pow; i++)\n r = r.dbl();\n return r;\n }\n\n // 1M + 2S + 1A + N * (4S + 5M + 8A)\n // N = 1 => 6M + 6S + 9A\n var a = this.curve.a;\n var tinv = this.curve.tinv;\n\n var jx = this.x;\n var jy = this.y;\n var jz = this.z;\n var jz4 = jz.redSqr().redSqr();\n\n // Reuse results\n var jyd = jy.redAdd(jy);\n for (var i = 0; i < pow; i++) {\n var jx2 = jx.redSqr();\n var jyd2 = jyd.redSqr();\n var jyd4 = jyd2.redSqr();\n var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));\n\n var t1 = jx.redMul(jyd2);\n var nx = c.redSqr().redISub(t1.redAdd(t1));\n var t2 = t1.redISub(nx);\n var dny = c.redMul(t2);\n dny = dny.redIAdd(dny).redISub(jyd4);\n var nz = jyd.redMul(jz);\n if (i + 1 < pow)\n jz4 = jz4.redMul(jyd4);\n\n jx = nx;\n jz = nz;\n jyd = dny;\n }\n\n return this.curve.jpoint(jx, jyd.redMul(tinv), jz);\n};\n\nJPoint.prototype.dbl = function dbl() {\n if (this.isInfinity())\n return this;\n\n if (this.curve.zeroA)\n return this._zeroDbl();\n else if (this.curve.threeA)\n return this._threeDbl();\n else\n return this._dbl();\n};\n\nJPoint.prototype._zeroDbl = function _zeroDbl() {\n // Z = 1\n if (this.zOne) {\n // http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-mdbl-2007-bl\n // 1M + 5S + 14A\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // S = 2 * ((X1 + YY)^2 - XX - YYYY)\n var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s);\n // M = 3 * XX + a; a = 0\n var m = xx.redAdd(xx).redIAdd(xx);\n // T = M ^ 2 - 2*S\n var t = m.redSqr().redISub(s).redISub(s);\n\n // 8 * YYYY\n var yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n\n // X3 = T\n var nx = t;\n // Y3 = M * (S - T) - 8 * YYYY\n var ny = m.redMul(s.redISub(t)).redISub(yyyy8);\n // Z3 = 2*Y1\n var nz = this.y.redAdd(this.y);\n } else {\n // http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l\n // 2M + 5S + 13A\n\n // A = X1^2\n var a = this.x.redSqr();\n // B = Y1^2\n var b = this.y.redSqr();\n // C = B^2\n var c = b.redSqr();\n // D = 2 * ((X1 + B)^2 - A - C)\n var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);\n d = d.redIAdd(d);\n // E = 3 * A\n var e = a.redAdd(a).redIAdd(a);\n // F = E^2\n var f = e.redSqr();\n\n // 8 * C\n var c8 = c.redIAdd(c);\n c8 = c8.redIAdd(c8);\n c8 = c8.redIAdd(c8);\n\n // X3 = F - 2 * D\n var nx = f.redISub(d).redISub(d);\n // Y3 = E * (D - X3) - 8 * C\n var ny = e.redMul(d.redISub(nx)).redISub(c8);\n // Z3 = 2 * Y1 * Z1\n var nz = this.y.redMul(this.z);\n nz = nz.redIAdd(nz);\n }\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype._threeDbl = function _threeDbl() {\n // Z = 1\n if (this.zOne) {\n // http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-mdbl-2007-bl\n // 1M + 5S + 15A\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // S = 2 * ((X1 + YY)^2 - XX - YYYY)\n var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s);\n // M = 3 * XX + a\n var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a);\n // T = M^2 - 2 * S\n var t = m.redSqr().redISub(s).redISub(s);\n // X3 = T\n var nx = t;\n // Y3 = M * (S - T) - 8 * YYYY\n var yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n var ny = m.redMul(s.redISub(t)).redISub(yyyy8);\n // Z3 = 2 * Y1\n var nz = this.y.redAdd(this.y);\n } else {\n // http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b\n // 3M + 5S\n\n // delta = Z1^2\n var delta = this.z.redSqr();\n // gamma = Y1^2\n var gamma = this.y.redSqr();\n // beta = X1 * gamma\n var beta = this.x.redMul(gamma);\n // alpha = 3 * (X1 - delta) * (X1 + delta)\n var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));\n alpha = alpha.redAdd(alpha).redIAdd(alpha);\n // X3 = alpha^2 - 8 * beta\n var beta4 = beta.redIAdd(beta);\n beta4 = beta4.redIAdd(beta4);\n var beta8 = beta4.redAdd(beta4);\n var nx = alpha.redSqr().redISub(beta8);\n // Z3 = (Y1 + Z1)^2 - gamma - delta\n var nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);\n // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2\n var ggamma8 = gamma.redSqr();\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ggamma8 = ggamma8.redIAdd(ggamma8);\n var ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);\n }\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype._dbl = function _dbl() {\n var a = this.curve.a;\n var tinv = this.curve.tinv;\n\n // 4M + 6S + 10A\n var jx = this.x;\n var jy = this.y;\n var jz = this.z;\n var jz4 = jz.redSqr().redSqr();\n\n var jx2 = jx.redSqr();\n var jy2 = jy.redSqr();\n\n var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));\n\n var jxd4 = jx.redAdd(jx);\n jxd4 = jxd4.redIAdd(jxd4);\n var t1 = jxd4.redMul(jy2);\n var nx = c.redSqr().redISub(t1.redAdd(t1));\n var t2 = t1.redISub(nx);\n\n var jyd8 = jy2.redSqr();\n jyd8 = jyd8.redIAdd(jyd8);\n jyd8 = jyd8.redIAdd(jyd8);\n jyd8 = jyd8.redIAdd(jyd8);\n var ny = c.redMul(t2).redISub(jyd8);\n var nz = jy.redAdd(jy).redMul(jz);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.trpl = function trpl() {\n if (!this.curve.zeroA)\n return this.dbl().add(this);\n\n // http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl\n // 5M + 10S + ...\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // ZZ = Z1^2\n var zz = this.z.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // M = 3 * XX + a * ZZ2; a = 0\n var m = xx.redAdd(xx).redIAdd(xx);\n // MM = M^2\n var mm = m.redSqr();\n // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM\n var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n e = e.redIAdd(e);\n e = e.redAdd(e).redIAdd(e);\n e = e.redISub(mm);\n // EE = E^2\n var ee = e.redSqr();\n // T = 16*YYYY\n var t = yyyy.redIAdd(yyyy);\n t = t.redIAdd(t);\n t = t.redIAdd(t);\n t = t.redIAdd(t);\n // U = (M + E)^2 - MM - EE - T\n var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t);\n // X3 = 4 * (X1 * EE - 4 * YY * U)\n var yyu4 = yy.redMul(u);\n yyu4 = yyu4.redIAdd(yyu4);\n yyu4 = yyu4.redIAdd(yyu4);\n var nx = this.x.redMul(ee).redISub(yyu4);\n nx = nx.redIAdd(nx);\n nx = nx.redIAdd(nx);\n // Y3 = 8 * Y1 * (U * (T - U) - E * EE)\n var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));\n ny = ny.redIAdd(ny);\n ny = ny.redIAdd(ny);\n ny = ny.redIAdd(ny);\n // Z3 = (Z1 + E)^2 - ZZ - EE\n var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.mul = function mul(k, kbase) {\n k = new bn(k, kbase);\n\n return this.curve._wnafMul(this, k);\n};\n\nJPoint.prototype.eq = function eq(p) {\n if (p.type === 'affine')\n return this.eq(p.toJ());\n\n if (this === p)\n return true;\n\n // x1 * z2^2 == x2 * z1^2\n var z2 = this.z.redSqr();\n var pz2 = p.z.redSqr();\n if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0)\n return false;\n\n // y1 * z2^3 == y2 * z1^3\n var z3 = z2.redMul(this.z);\n var pz3 = pz2.redMul(p.z);\n return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;\n};\n\nJPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nJPoint.prototype.isInfinity = function isInfinity() {\n // XXX This code assumes that zero is always zero in red\n return this.z.cmpn(0) === 0;\n};\n\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\",\"../curve\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/index.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curves.js\":[function(require,module,exports){\nvar curves = exports;\n\nvar hash = require('hash.js');\nvar bn = require('bn.js');\nvar elliptic = require('../elliptic');\n\nvar assert = elliptic.utils.assert;\n\nfunction PresetCurve(options) {\n if (options.type === 'short')\n this.curve = new elliptic.curve.short(options);\n else if (options.type === 'edwards')\n this.curve = new elliptic.curve.edwards(options);\n else\n this.curve = new elliptic.curve.mont(options);\n this.g = this.curve.g;\n this.n = this.curve.n;\n this.hash = options.hash;\n\n assert(this.g.validate(), 'Invalid curve');\n assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');\n}\ncurves.PresetCurve = PresetCurve;\n\nfunction defineCurve(name, options) {\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n get: function() {\n var curve = new PresetCurve(options);\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n value: curve\n });\n return curve;\n }\n });\n}\n\ndefineCurve('p192', {\n type: 'short',\n prime: 'p192',\n p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',\n b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',\n n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',\n hash: hash.sha256,\n gRed: false,\n g: [\n '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012',\n '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811'\n ],\n});\n\ndefineCurve('p224', {\n type: 'short',\n prime: 'p224',\n p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',\n b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',\n n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',\n hash: hash.sha256,\n gRed: false,\n g: [\n 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21',\n 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34'\n ],\n});\n\ndefineCurve('p256', {\n type: 'short',\n prime: null,\n p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',\n a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',\n b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',\n n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',\n hash: hash.sha256,\n gRed: false,\n g: [\n '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296',\n '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5'\n ],\n});\n\ndefineCurve('curve25519', {\n type: 'mont',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '76d06',\n b: '0',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: hash.sha256,\n gRed: false,\n g: [\n '9'\n ]\n});\n\ndefineCurve('ed25519', {\n type: 'edwards',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '-1',\n c: '1',\n // -121665 * (121666^(-1)) (mod P)\n d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: hash.sha256,\n gRed: false,\n g: [\n '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a',\n\n // 4/5\n '6666666666666666666666666666666666666666666666666666666666666658'\n ]\n});\n\ndefineCurve('secp256k1', {\n type: 'short',\n prime: 'k256',\n p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',\n a: '0',\n b: '7',\n n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',\n h: '1',\n hash: hash.sha256,\n\n // Precomputed endomorphism\n beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',\n lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',\n basis: [\n {\n a: '3086d221a7d46bcde86c90e49284eb15',\n b: '-e4437ed6010e88286f547fa90abfe4c3'\n },\n {\n a: '114ca50f7a8e2f3f657c1108d9d44cfd8',\n b: '3086d221a7d46bcde86c90e49284eb15'\n }\n ],\n\n gRed: false,\n g: [\n '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',\n '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',\n {\n 'doubles': {\n 'step': 4,\n 'points': [\n [\n 'e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a',\n 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821'\n ],\n [\n '8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508',\n '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf'\n ],\n [\n '175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739',\n 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695'\n ],\n [\n '363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640',\n '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9'\n ],\n [\n '8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c',\n '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36'\n ],\n [\n '723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda',\n '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f'\n ],\n [\n 'eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa',\n '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999'\n ],\n [\n '100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0',\n 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09'\n ],\n [\n 'e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d',\n '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d'\n ],\n [\n 'feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d',\n 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088'\n ],\n [\n 'da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1',\n '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d'\n ],\n [\n '53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0',\n '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8'\n ],\n [\n '8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047',\n '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a'\n ],\n [\n '385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862',\n '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453'\n ],\n [\n '6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7',\n '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160'\n ],\n [\n '3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd',\n '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0'\n ],\n [\n '85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83',\n '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6'\n ],\n [\n '948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a',\n '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589'\n ],\n [\n '6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8',\n 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17'\n ],\n [\n 'e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d',\n '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda'\n ],\n [\n 'e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725',\n '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd'\n ],\n [\n '213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754',\n '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2'\n ],\n [\n '4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c',\n '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6'\n ],\n [\n 'fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6',\n '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f'\n ],\n [\n '76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39',\n 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01'\n ],\n [\n 'c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891',\n '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3'\n ],\n [\n 'd895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b',\n 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f'\n ],\n [\n 'b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03',\n '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7'\n ],\n [\n 'e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d',\n 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78'\n ],\n [\n 'a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070',\n '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1'\n ],\n [\n '90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4',\n 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150'\n ],\n [\n '8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da',\n '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82'\n ],\n [\n 'e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11',\n '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc'\n ],\n [\n '8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e',\n 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b'\n ],\n [\n 'e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41',\n '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51'\n ],\n [\n 'b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef',\n '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45'\n ],\n [\n 'd68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8',\n 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120'\n ],\n [\n '324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d',\n '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84'\n ],\n [\n '4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96',\n '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d'\n ],\n [\n '9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd',\n 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d'\n ],\n [\n '6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5',\n '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8'\n ],\n [\n 'a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266',\n '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8'\n ],\n [\n '7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71',\n '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac'\n ],\n [\n '928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac',\n 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f'\n ],\n [\n '85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751',\n '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962'\n ],\n [\n 'ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e',\n '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907'\n ],\n [\n '827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241',\n 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec'\n ],\n [\n 'eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3',\n 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d'\n ],\n [\n 'e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f',\n '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414'\n ],\n [\n '1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19',\n 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd'\n ],\n [\n '146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be',\n 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0'\n ],\n [\n 'fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9',\n '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811'\n ],\n [\n 'da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2',\n '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1'\n ],\n [\n 'a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13',\n '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c'\n ],\n [\n '174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c',\n 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73'\n ],\n [\n '959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba',\n '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd'\n ],\n [\n 'd2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151',\n 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405'\n ],\n [\n '64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073',\n 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589'\n ],\n [\n '8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458',\n '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e'\n ],\n [\n '13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b',\n '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27'\n ],\n [\n 'bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366',\n 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1'\n ],\n [\n '8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa',\n '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482'\n ],\n [\n '8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0',\n '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945'\n ],\n [\n 'dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787',\n '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573'\n ],\n [\n 'f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e',\n 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82'\n ]\n ]\n },\n 'naf': {\n 'wnd': 7,\n 'points': [\n [\n 'f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9',\n '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672'\n ],\n [\n '2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4',\n 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6'\n ],\n [\n '5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc',\n '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da'\n ],\n [\n 'acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe',\n 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37'\n ],\n [\n '774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb',\n 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b'\n ],\n [\n 'f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8',\n 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81'\n ],\n [\n 'd7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e',\n '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58'\n ],\n [\n 'defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34',\n '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77'\n ],\n [\n '2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c',\n '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a'\n ],\n [\n '352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5',\n '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c'\n ],\n [\n '2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f',\n '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67'\n ],\n [\n '9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714',\n '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402'\n ],\n [\n 'daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729',\n 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55'\n ],\n [\n 'c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db',\n '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482'\n ],\n [\n '6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4',\n 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82'\n ],\n [\n '1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5',\n 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396'\n ],\n [\n '605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479',\n '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49'\n ],\n [\n '62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d',\n '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf'\n ],\n [\n '80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f',\n '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a'\n ],\n [\n '7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb',\n 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7'\n ],\n [\n 'd528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9',\n 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933'\n ],\n [\n '49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963',\n '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a'\n ],\n [\n '77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74',\n '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6'\n ],\n [\n 'f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530',\n 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37'\n ],\n [\n '463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b',\n '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e'\n ],\n [\n 'f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247',\n 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6'\n ],\n [\n 'caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1',\n 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476'\n ],\n [\n '2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120',\n '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40'\n ],\n [\n '7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435',\n '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61'\n ],\n [\n '754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18',\n '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683'\n ],\n [\n 'e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8',\n '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5'\n ],\n [\n '186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb',\n '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b'\n ],\n [\n 'df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f',\n '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417'\n ],\n [\n '5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143',\n 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868'\n ],\n [\n '290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba',\n 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a'\n ],\n [\n 'af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45',\n 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6'\n ],\n [\n '766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a',\n '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996'\n ],\n [\n '59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e',\n 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e'\n ],\n [\n 'f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8',\n 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d'\n ],\n [\n '7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c',\n '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2'\n ],\n [\n '948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519',\n 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e'\n ],\n [\n '7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab',\n '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437'\n ],\n [\n '3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca',\n 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311'\n ],\n [\n 'd3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf',\n '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4'\n ],\n [\n '1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610',\n '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575'\n ],\n [\n '733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4',\n 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d'\n ],\n [\n '15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c',\n 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d'\n ],\n [\n 'a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940',\n 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629'\n ],\n [\n 'e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980',\n 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06'\n ],\n [\n '311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3',\n '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374'\n ],\n [\n '34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf',\n '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee'\n ],\n [\n 'f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63',\n '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1'\n ],\n [\n 'd7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448',\n 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b'\n ],\n [\n '32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf',\n '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661'\n ],\n [\n '7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5',\n '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6'\n ],\n [\n 'ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6',\n '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e'\n ],\n [\n '16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5',\n '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d'\n ],\n [\n 'eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99',\n 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc'\n ],\n [\n '78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51',\n 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4'\n ],\n [\n '494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5',\n '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c'\n ],\n [\n 'a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5',\n '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b'\n ],\n [\n 'c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997',\n '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913'\n ],\n [\n '841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881',\n '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154'\n ],\n [\n '5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5',\n '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865'\n ],\n [\n '36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66',\n 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc'\n ],\n [\n '336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726',\n 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224'\n ],\n [\n '8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede',\n '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e'\n ],\n [\n '1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94',\n '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6'\n ],\n [\n '85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31',\n '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511'\n ],\n [\n '29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51',\n 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b'\n ],\n [\n 'a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252',\n 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2'\n ],\n [\n '4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5',\n 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c'\n ],\n [\n 'd24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b',\n '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3'\n ],\n [\n 'ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4',\n '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d'\n ],\n [\n 'af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f',\n '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700'\n ],\n [\n 'e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889',\n '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4'\n ],\n [\n '591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246',\n 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196'\n ],\n [\n '11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984',\n '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4'\n ],\n [\n '3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a',\n 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257'\n ],\n [\n 'cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030',\n 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13'\n ],\n [\n 'c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197',\n '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096'\n ],\n [\n 'c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593',\n 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38'\n ],\n [\n 'a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef',\n '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f'\n ],\n [\n '347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38',\n '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448'\n ],\n [\n 'da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a',\n '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a'\n ],\n [\n 'c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111',\n '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4'\n ],\n [\n '4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502',\n '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437'\n ],\n [\n '3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea',\n 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7'\n ],\n [\n 'cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26',\n '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d'\n ],\n [\n 'b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986',\n '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a'\n ],\n [\n 'd4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e',\n '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54'\n ],\n [\n '48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4',\n '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77'\n ],\n [\n 'dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda',\n 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517'\n ],\n [\n '6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859',\n 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10'\n ],\n [\n 'e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f',\n 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125'\n ],\n [\n 'eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c',\n '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e'\n ],\n [\n '13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942',\n 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1'\n ],\n [\n 'ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a',\n '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2'\n ],\n [\n 'b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80',\n '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423'\n ],\n [\n 'ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d',\n '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8'\n ],\n [\n '8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1',\n 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758'\n ],\n [\n '52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63',\n 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375'\n ],\n [\n 'e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352',\n '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d'\n ],\n [\n '7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193',\n 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec'\n ],\n [\n '5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00',\n '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0'\n ],\n [\n '32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58',\n 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c'\n ],\n [\n 'e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7',\n 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4'\n ],\n [\n '8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8',\n 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f'\n ],\n [\n '4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e',\n '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649'\n ],\n [\n '3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d',\n 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826'\n ],\n [\n '674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b',\n '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5'\n ],\n [\n 'd32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f',\n 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87'\n ],\n [\n '30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6',\n '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b'\n ],\n [\n 'be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297',\n '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc'\n ],\n [\n '93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a',\n '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c'\n ],\n [\n 'b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c',\n 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f'\n ],\n [\n 'd5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52',\n '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a'\n ],\n [\n 'd3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb',\n 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46'\n ],\n [\n '463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065',\n 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f'\n ],\n [\n '7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917',\n '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03'\n ],\n [\n '74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9',\n 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08'\n ],\n [\n '30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3',\n '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8'\n ],\n [\n '9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57',\n '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373'\n ],\n [\n '176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66',\n 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3'\n ],\n [\n '75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8',\n '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8'\n ],\n [\n '809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721',\n '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1'\n ],\n [\n '1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180',\n '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9'\n ]\n ]\n }\n }\n ]\n});\n\n},{\"../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\",\"hash.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/index.js\":[function(require,module,exports){\nvar bn = require('bn.js');\nvar elliptic = require('../../elliptic');\nvar utils = elliptic.utils;\nvar assert = utils.assert;\n\nvar KeyPair = require('./key');\nvar Signature = require('./signature');\n\nfunction EC(options) {\n if (!(this instanceof EC))\n return new EC(options);\n\n // Shortcut `elliptic.ec(curve-name)`\n if (typeof options === 'string') {\n assert(elliptic.curves.hasOwnProperty(options), 'Unknown curve ' + options);\n\n options = elliptic.curves[options];\n }\n\n // Shortcut for `elliptic.ec(elliptic.curves.curveName)`\n if (options instanceof elliptic.curves.PresetCurve)\n options = { curve: options };\n\n this.curve = options.curve.curve;\n this.n = this.curve.n;\n this.nh = this.n.shrn(1);\n this.g = this.curve.g;\n\n // Point on curve\n this.g = options.curve.g;\n this.g.precompute(options.curve.n.bitLength() + 1);\n\n // Hash for function for DRBG\n this.hash = options.hash || options.curve.hash;\n}\nmodule.exports = EC;\n\nEC.prototype.keyPair = function keyPair(priv, pub) {\n return new KeyPair(this, priv, pub);\n};\n\nEC.prototype.genKeyPair = function genKeyPair(options) {\n if (!options)\n options = {};\n\n // Instantiate Hmac_DRBG\n var drbg = new elliptic.hmacDRBG({\n hash: this.hash,\n pers: options.pers,\n entropy: options.entropy || elliptic.rand(this.hash.hmacStrength),\n nonce: this.n.toArray()\n });\n\n var bytes = this.n.byteLength();\n var ns2 = this.n.sub(new bn(2));\n do {\n var priv = new bn(drbg.generate(bytes));\n if (priv.cmp(ns2) > 0)\n continue;\n\n priv.iaddn(1);\n return this.keyPair(priv);\n } while (true);\n};\n\nEC.prototype._truncateToN = function truncateToN(msg, truncOnly) {\n var delta = msg.byteLength() * 8 - this.n.bitLength();\n if (delta > 0)\n msg = msg.shrn(delta);\n if (!truncOnly && msg.cmp(this.n) >= 0)\n return msg.sub(this.n);\n else\n return msg;\n};\n\nEC.prototype.sign = function sign(msg, key, options) {\n key = this.keyPair(key, 'hex');\n msg = this._truncateToN(new bn(msg, 16));\n if (!options)\n options = {};\n\n // Zero-extend key to provide enough entropy\n var bytes = this.n.byteLength();\n var bkey = key.getPrivate().toArray();\n for (var i = bkey.length; i < 21; i++)\n bkey.unshift(0);\n\n // Zero-extend nonce to have the same byte size as N\n var nonce = msg.toArray();\n for (var i = nonce.length; i < bytes; i++)\n nonce.unshift(0);\n\n // Instantiate Hmac_DRBG\n var drbg = new elliptic.hmacDRBG({\n hash: this.hash,\n entropy: bkey,\n nonce: nonce\n });\n\n // Number of bytes to generate\n var ns1 = this.n.sub(new bn(1));\n do {\n var k = new bn(drbg.generate(this.n.byteLength()));\n k = this._truncateToN(k, true);\n if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0)\n continue;\n\n var kp = this.g.mul(k);\n if (kp.isInfinity())\n continue;\n\n var r = kp.getX().mod(this.n);\n if (r.cmpn(0) === 0)\n continue;\n\n var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg)).mod(this.n);\n if (s.cmpn(0) === 0)\n continue;\n\n // Use complement of `s`, if it is > `n / 2`\n if (options.canonical && s.cmp(this.nh) > 0)\n s = this.n.sub(s);\n\n return new Signature(r, s);\n } while (true);\n};\n\nEC.prototype.verify = function verify(msg, signature, key) {\n msg = this._truncateToN(new bn(msg, 16));\n key = this.keyPair(key, 'hex');\n signature = new Signature(signature, 'hex');\n\n // Perform primitive values validation\n var r = signature.r;\n var s = signature.s;\n if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0)\n return false;\n if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0)\n return false;\n\n // Validate signature\n var sinv = s.invm(this.n);\n var u1 = sinv.mul(msg).mod(this.n);\n var u2 = sinv.mul(r).mod(this.n);\n\n var p = this.g.mulAdd(u1, key.getPublic(), u2);\n if (p.isInfinity())\n return false;\n\n return p.getX().mod(this.n).cmp(r) === 0;\n};\n\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\",\"./key\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/key.js\",\"./signature\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/signature.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/key.js\":[function(require,module,exports){\nvar bn = require('bn.js');\n\nvar elliptic = require('../../elliptic');\nvar utils = elliptic.utils;\nvar assert = utils.assert;\n\nfunction KeyPair(ec, priv, pub) {\n if (priv instanceof KeyPair)\n return priv;\n if (pub instanceof KeyPair)\n return pub;\n\n if (!priv) {\n priv = pub;\n pub = null;\n }\n if (priv !== null && typeof priv === 'object') {\n if (priv.x) {\n // KeyPair(public)\n pub = priv;\n priv = null;\n } else if (priv.priv || priv.pub) {\n // KeyPair({ priv: ..., pub: ... })\n pub = priv.pub;\n priv = priv.priv;\n }\n }\n\n this.ec = ec;\n this.priv = null;\n this.pub = null;\n\n // KeyPair(public, 'hex')\n if (this._importPublicHex(priv, pub))\n return;\n\n if (pub === 'hex')\n pub = null;\n\n // KeyPair(priv, pub)\n if (priv)\n this._importPrivate(priv);\n if (pub)\n this._importPublic(pub);\n}\nmodule.exports = KeyPair;\n\nKeyPair.prototype.validate = function validate() {\n var pub = this.getPublic();\n\n if (pub.isInfinity())\n return { result: false, reason: 'Invalid public key' };\n if (!pub.validate())\n return { result: false, reason: 'Public key is not a point' };\n if (!pub.mul(this.ec.curve.n).isInfinity())\n return { result: false, reason: 'Public key * N != O' };\n\n return { result: true, reason: null };\n};\n\nKeyPair.prototype.getPublic = function getPublic(compact, enc) {\n if (!this.pub)\n this.pub = this.ec.g.mul(this.priv);\n\n // compact is optional argument\n if (typeof compact === 'string') {\n enc = compact;\n compact = null;\n }\n\n if (!enc)\n return this.pub;\n\n var len = this.ec.curve.p.byteLength();\n var x = this.pub.getX().toArray();\n\n for (var i = x.length; i < len; i++)\n x.unshift(0);\n\n if (compact) {\n var res = [ this.pub.getY().isEven() ? 0x02 : 0x03 ].concat(x);\n } else {\n var y = this.pub.getY().toArray();\n for (var i = y.length; i < len; i++)\n y.unshift(0);\n var res = [ 0x04 ].concat(x, y);\n }\n return utils.encode(res, enc);\n};\n\nKeyPair.prototype.getPrivate = function getPrivate(enc) {\n if (enc === 'hex')\n return this.priv.toString(16, 2);\n else\n return this.priv;\n};\n\nKeyPair.prototype._importPrivate = function _importPrivate(key) {\n this.priv = new bn(key, 16);\n\n // Ensure that the priv won't be bigger than n, otherwise we may fail\n // in fixed multiplication method\n this.priv = this.priv.mod(this.ec.curve.n);\n};\n\nKeyPair.prototype._importPublic = function _importPublic(key) {\n this.pub = this.ec.curve.point(key.x, key.y);\n};\n\nKeyPair.prototype._importPublicHex = function _importPublic(key, enc) {\n key = utils.toArray(key, enc);\n var len = this.ec.curve.p.byteLength();\n if (key[0] === 0x04 && key.length - 1 === 2 * len) {\n this.pub = this.ec.curve.point(\n key.slice(1, 1 + len),\n key.slice(1 + len, 1 + 2 * len));\n } else if ((key[0] === 0x02 || key[0] === 0x03) && key.length - 1 === len) {\n this.pub = this.ec.curve.pointFromX(key[0] === 0x03,\n key.slice(1, 1 +len));\n } else {\n return false;\n }\n\n return true;\n};\n\n// ECDH\nKeyPair.prototype.derive = function derive(pub) {\n return pub.mul(this.priv).getX();\n};\n\n// ECDSA\nKeyPair.prototype.sign = function sign(msg) {\n return this.ec.sign(msg, this);\n};\n\nKeyPair.prototype.verify = function verify(msg, signature) {\n return this.ec.verify(msg, signature, this);\n};\n\nKeyPair.prototype.inspect = function inspect() {\n return '';\n};\n\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/signature.js\":[function(require,module,exports){\nvar bn = require('bn.js');\n\nvar elliptic = require('../../elliptic');\nvar utils = elliptic.utils;\nvar assert = utils.assert;\n\nfunction Signature(r, s) {\n if (r instanceof Signature)\n return r;\n\n if (this._importDER(r, s))\n return;\n\n assert(r && s, 'Signature without r or s');\n this.r = new bn(r, 16);\n this.s = new bn(s, 16);\n}\nmodule.exports = Signature;\n\nSignature.prototype._importDER = function _importDER(data, enc) {\n data = utils.toArray(data, enc);\n if (data.length < 6 || data[0] !== 0x30 || data[2] !== 0x02)\n return false;\n var total = data[1];\n if (1 + total > data.length)\n return false;\n var rlen = data[3];\n // Short length notation\n if (rlen >= 0x80)\n return false;\n if (4 + rlen + 2 >= data.length)\n return false;\n if (data[4 + rlen] !== 0x02)\n return false;\n var slen = data[5 + rlen];\n // Short length notation\n if (slen >= 0x80)\n return false;\n if (4 + rlen + 2 + slen > data.length)\n return false;\n\n this.r = new bn(data.slice(4, 4 + rlen));\n this.s = new bn(data.slice(4 + rlen + 2, 4 + rlen + 2 + slen));\n\n return true;\n};\n\nSignature.prototype.toDER = function toDER(enc) {\n var r = this.r.toArray();\n var s = this.s.toArray();\n\n // Pad values\n if (r[0] & 0x80)\n r = [ 0 ].concat(r);\n // Pad values\n if (s[0] & 0x80)\n s = [ 0 ].concat(s);\n\n var total = r.length + s.length + 4;\n var res = [ 0x30, total, 0x02, r.length ];\n res = res.concat(r, [ 0x02, s.length ], s);\n return utils.encode(res, enc);\n};\n\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/hmac-drbg.js\":[function(require,module,exports){\nvar hash = require('hash.js');\nvar elliptic = require('../elliptic');\nvar utils = elliptic.utils;\nvar assert = utils.assert;\n\nfunction HmacDRBG(options) {\n if (!(this instanceof HmacDRBG))\n return new HmacDRBG(options);\n this.hash = options.hash;\n this.predResist = !!options.predResist;\n\n this.outLen = this.hash.outSize;\n this.minEntropy = options.minEntropy || this.hash.hmacStrength;\n\n this.reseed = null;\n this.reseedInterval = null;\n this.K = null;\n this.V = null;\n\n var entropy = utils.toArray(options.entropy, options.entropyEnc);\n var nonce = utils.toArray(options.nonce, options.nonceEnc);\n var pers = utils.toArray(options.pers, options.persEnc);\n assert(entropy.length >= (this.minEntropy / 8),\n 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');\n this._init(entropy, nonce, pers);\n}\nmodule.exports = HmacDRBG;\n\nHmacDRBG.prototype._init = function init(entropy, nonce, pers) {\n var seed = entropy.concat(nonce).concat(pers);\n\n this.K = new Array(this.outLen / 8);\n this.V = new Array(this.outLen / 8);\n for (var i = 0; i < this.V.length; i++) {\n this.K[i] = 0x00;\n this.V[i] = 0x01;\n }\n\n this._update(seed);\n this.reseed = 1;\n this.reseedInterval = 0x1000000000000; // 2^48\n};\n\nHmacDRBG.prototype._hmac = function hmac() {\n return new hash.hmac(this.hash, this.K);\n};\n\nHmacDRBG.prototype._update = function update(seed) {\n var kmac = this._hmac()\n .update(this.V)\n .update([ 0x00 ]);\n if (seed)\n kmac = kmac.update(seed);\n this.K = kmac.digest();\n this.V = this._hmac().update(this.V).digest();\n if (!seed)\n return;\n\n this.K = this._hmac()\n .update(this.V)\n .update([ 0x01 ])\n .update(seed)\n .digest();\n this.V = this._hmac().update(this.V).digest();\n};\n\nHmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) {\n // Optional entropy enc\n if (typeof entropyEnc !== 'string') {\n addEnc = add;\n add = entropyEnc;\n entropyEnc = null;\n }\n\n entropy = utils.toBuffer(entropy, entropyEnc);\n add = utils.toBuffer(add, addEnc);\n\n assert(entropy.length >= (this.minEntropy / 8),\n 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');\n\n this._update(entropy.concat(add || []));\n this.reseed = 1;\n};\n\nHmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) {\n if (this.reseed > this.reseedInterval)\n throw new Error('Reseed is required');\n\n // Optional encoding\n if (typeof enc !== 'string') {\n addEnc = add;\n add = enc;\n enc = null;\n }\n\n // Optional additional data\n if (add) {\n add = utils.toArray(add, addEnc);\n this._update(add);\n }\n\n var temp = [];\n while (temp.length < len) {\n this.V = this._hmac().update(this.V).digest();\n temp = temp.concat(this.V);\n }\n\n var res = temp.slice(0, len);\n this._update(add);\n this.reseed++;\n return utils.encode(res, enc);\n};\n\n},{\"../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\",\"hash.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/utils.js\":[function(require,module,exports){\nvar bn = require('bn.js');\n\nvar utils = exports;\n\nutils.assert = function assert(val, msg) {\n if (!val)\n throw new Error(msg || 'Assertion failed');\n};\n\nfunction toArray(msg, enc) {\n if (Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg === 'string') {\n if (!enc) {\n for (var i = 0; i < msg.length; i++) {\n var c = msg.charCodeAt(i);\n var hi = c >> 8;\n var lo = c & 0xff;\n if (hi)\n res.push(hi, lo);\n else\n res.push(lo);\n }\n } else if (enc === 'hex') {\n msg = msg.replace(/[^a-z0-9]+/ig, '');\n if (msg.length % 2 !== 0)\n msg = '0' + msg;\n for (var i = 0; i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n }\n } else {\n for (var i = 0; i < msg.length; i++)\n res[i] = msg[i] | 0;\n }\n return res;\n}\nutils.toArray = toArray;\n\nfunction toHex(msg) {\n var res = '';\n for (var i = 0; i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n}\nutils.toHex = toHex;\n\nutils.encode = function encode(arr, enc) {\n if (enc === 'hex')\n return toHex(arr);\n else\n return arr;\n};\n\nfunction zero2(word) {\n if (word.length === 1)\n return '0' + word;\n else\n return word;\n}\nutils.zero2 = zero2;\n\n// Represent num in a w-NAF form\nfunction getNAF(num, w) {\n var naf = [];\n var ws = 1 << (w + 1);\n var k = num.clone();\n while (k.cmpn(1) >= 0) {\n var z;\n if (k.isOdd()) {\n var mod = k.andln(ws - 1);\n if (mod > (ws >> 1) - 1)\n z = (ws >> 1) - mod;\n else\n z = mod;\n k.isubn(z);\n } else {\n z = 0;\n }\n naf.push(z);\n\n // Optimization, shift by word if possible\n var shift = (k.cmpn(0) !== 0 && k.andln(ws - 1) === 0) ? (w + 1) : 1;\n for (var i = 1; i < shift; i++)\n naf.push(0);\n k.ishrn(shift);\n }\n\n return naf;\n}\nutils.getNAF = getNAF;\n\n// Represent k1, k2 in a Joint Sparse Form\nfunction getJSF(k1, k2) {\n var jsf = [\n [],\n []\n ];\n\n k1 = k1.clone();\n k2 = k2.clone();\n var d1 = 0;\n var d2 = 0;\n while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) {\n\n // First phase\n var m14 = (k1.andln(3) + d1) & 3;\n var m24 = (k2.andln(3) + d2) & 3;\n if (m14 === 3)\n m14 = -1;\n if (m24 === 3)\n m24 = -1;\n var u1;\n if ((m14 & 1) === 0) {\n u1 = 0;\n } else {\n var m8 = (k1.andln(7) + d1) & 7;\n if ((m8 === 3 || m8 === 5) && m24 === 2)\n u1 = -m14;\n else\n u1 = m14;\n }\n jsf[0].push(u1);\n\n var u2;\n if ((m24 & 1) === 0) {\n u2 = 0;\n } else {\n var m8 = (k2.andln(7) + d2) & 7;\n if ((m8 === 3 || m8 === 5) && m14 === 2)\n u2 = -m24;\n else\n u2 = m24;\n }\n jsf[1].push(u2);\n\n // Second phase\n if (2 * d1 === u1 + 1)\n d1 = 1 - d1;\n if (2 * d2 === u2 + 1)\n d2 = 1 - d2;\n k1.ishrn(1);\n k2.ishrn(1);\n }\n\n return jsf;\n}\nutils.getJSF = getJSF;\n\n},{\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/index.js\":[function(require,module,exports){\nvar r;\n\nmodule.exports = function rand(len) {\n if (!r)\n r = new Rand(null);\n\n return r.generate(len);\n};\n\nfunction Rand(rand) {\n this.rand = rand;\n}\nmodule.exports.Rand = Rand;\n\nRand.prototype.generate = function generate(len) {\n return this._rand(len);\n};\n\nif (typeof window === 'object') {\n if (window.crypto && window.crypto.getRandomValues) {\n // Modern browsers\n Rand.prototype._rand = function _rand(n) {\n var arr = new Uint8Array(n);\n window.crypto.getRandomValues(arr);\n return arr;\n };\n } else if (window.msCrypto && window.msCrypto.getRandomValues) {\n // IE\n Rand.prototype._rand = function _rand(n) {\n var arr = new Uint8Array(n);\n window.msCrypto.getRandomValues(arr);\n return arr;\n };\n } else {\n // Old junk\n Rand.prototype._rand = function() {\n throw new Error('Not implemented yet');\n };\n }\n} else {\n // Node.js or Web worker\n try {\n var crypto = require('cry' + 'pto');\n\n Rand.prototype._rand = function _rand(n) {\n return crypto.randomBytes(n);\n };\n } catch (e) {\n // Emulate crypto API using randy\n Rand.prototype._rand = function _rand(n) {\n var res = new Uint8Array(n);\n for (var i = 0; i < res.length; i++)\n res[i] = this.rand.getByte();\n return res;\n };\n }\n}\n\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash.js\":[function(require,module,exports){\nvar hash = exports;\n\nhash.utils = require('./hash/utils');\nhash.common = require('./hash/common');\nhash.sha = require('./hash/sha');\nhash.ripemd = require('./hash/ripemd');\nhash.hmac = require('./hash/hmac');\n\n// Proxy hash functions to the main object\nhash.sha1 = hash.sha.sha1;\nhash.sha256 = hash.sha.sha256;\nhash.sha224 = hash.sha.sha224;\nhash.sha384 = hash.sha.sha384;\nhash.sha512 = hash.sha.sha512;\nhash.ripemd160 = hash.ripemd.ripemd160;\n\n},{\"./hash/common\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/common.js\",\"./hash/hmac\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/hmac.js\",\"./hash/ripemd\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/ripemd.js\",\"./hash/sha\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/sha.js\",\"./hash/utils\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/utils.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/common.js\":[function(require,module,exports){\nvar hash = require('../hash');\nvar utils = hash.utils;\nvar assert = utils.assert;\n\nfunction BlockHash() {\n this.pending = null;\n this.pendingTotal = 0;\n this.blockSize = this.constructor.blockSize;\n this.outSize = this.constructor.outSize;\n this.hmacStrength = this.constructor.hmacStrength;\n this.padLength = this.constructor.padLength / 8;\n this.endian = 'big';\n\n this._delta8 = this.blockSize / 8;\n this._delta32 = this.blockSize / 32;\n}\nexports.BlockHash = BlockHash;\n\nBlockHash.prototype.update = function update(msg, enc) {\n // Convert message to array, pad it, and join into 32bit blocks\n msg = utils.toArray(msg, enc);\n if (!this.pending)\n this.pending = msg;\n else\n this.pending = this.pending.concat(msg);\n this.pendingTotal += msg.length;\n\n // Enough data, try updating\n if (this.pending.length >= this._delta8) {\n msg = this.pending;\n\n // Process pending data in blocks\n var r = msg.length % this._delta8;\n this.pending = msg.slice(msg.length - r, msg.length);\n if (this.pending.length === 0)\n this.pending = null;\n\n msg = utils.join32(msg, 0, msg.length - r, this.endian);\n for (var i = 0; i < msg.length; i += this._delta32)\n this._update(msg, i, i + this._delta32);\n }\n\n return this;\n};\n\nBlockHash.prototype.digest = function digest(enc) {\n this.update(this._pad());\n assert(this.pending === null);\n\n return this._digest(enc);\n};\n\nBlockHash.prototype._pad = function pad() {\n var len = this.pendingTotal;\n var bytes = this._delta8;\n var k = bytes - ((len + this.padLength) % bytes);\n var res = new Array(k + this.padLength);\n res[0] = 0x80;\n for (var i = 1; i < k; i++)\n res[i] = 0;\n\n // Append length\n len <<= 3;\n if (this.endian === 'big') {\n for (var t = 8; t < this.padLength; t++)\n res[i++] = 0;\n\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = (len >>> 24) & 0xff;\n res[i++] = (len >>> 16) & 0xff;\n res[i++] = (len >>> 8) & 0xff;\n res[i++] = len & 0xff;\n } else {\n res[i++] = len & 0xff;\n res[i++] = (len >>> 8) & 0xff;\n res[i++] = (len >>> 16) & 0xff;\n res[i++] = (len >>> 24) & 0xff;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n\n for (var t = 8; t < this.padLength; t++)\n res[i++] = 0;\n }\n\n return res;\n};\n\n},{\"../hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/hmac.js\":[function(require,module,exports){\nvar hmac = exports;\n\nvar hash = require('../hash');\nvar utils = hash.utils;\nvar assert = utils.assert;\n\nfunction Hmac(hash, key, enc) {\n if (!(this instanceof Hmac))\n return new Hmac(hash, key, enc);\n this.Hash = hash;\n this.blockSize = hash.blockSize / 8;\n this.outSize = hash.outSize / 8;\n this.inner = null;\n this.outer = null;\n\n this._init(utils.toArray(key, enc));\n}\nmodule.exports = Hmac;\n\nHmac.prototype._init = function init(key) {\n // Shorten key, if needed\n if (key.length > this.blockSize)\n key = new this.Hash().update(key).digest();\n assert(key.length <= this.blockSize);\n\n // Add padding to key\n for (var i = key.length; i < this.blockSize; i++)\n key.push(0);\n\n for (var i = 0; i < key.length; i++)\n key[i] ^= 0x36;\n this.inner = new this.Hash().update(key);\n\n // 0x36 ^ 0x5c = 0x6a\n for (var i = 0; i < key.length; i++)\n key[i] ^= 0x6a;\n this.outer = new this.Hash().update(key);\n};\n\nHmac.prototype.update = function update(msg, enc) {\n this.inner.update(msg, enc);\n return this;\n};\n\nHmac.prototype.digest = function digest(enc) {\n this.outer.update(this.inner.digest());\n return this.outer.digest(enc);\n};\n\n},{\"../hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/ripemd.js\":[function(require,module,exports){\nvar hash = require('../hash');\nvar utils = hash.utils;\n\nvar rotl32 = utils.rotl32;\nvar sum32 = utils.sum32;\nvar sum32_3 = utils.sum32_3;\nvar sum32_4 = utils.sum32_4;\nvar BlockHash = hash.common.BlockHash;\n\nfunction RIPEMD160() {\n if (!(this instanceof RIPEMD160))\n return new RIPEMD160();\n\n BlockHash.call(this);\n\n this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ];\n this.endian = 'little';\n}\nutils.inherits(RIPEMD160, BlockHash);\nexports.ripemd160 = RIPEMD160;\n\nRIPEMD160.blockSize = 512;\nRIPEMD160.outSize = 160;\nRIPEMD160.hmacStrength = 192;\nRIPEMD160.padLength = 64;\n\nRIPEMD160.prototype._update = function update(msg, start) {\n var A = this.h[0];\n var B = this.h[1];\n var C = this.h[2];\n var D = this.h[3];\n var E = this.h[4];\n var Ah = A;\n var Bh = B;\n var Ch = C;\n var Dh = D;\n var Eh = E;\n for (var j = 0; j < 80; j++) {\n var T = sum32(\n rotl32(\n sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)),\n s[j]),\n E);\n A = E;\n E = D;\n D = rotl32(C, 10);\n C = B;\n B = T;\n T = sum32(\n rotl32(\n sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)),\n sh[j]),\n Eh);\n Ah = Eh;\n Eh = Dh;\n Dh = rotl32(Ch, 10);\n Ch = Bh;\n Bh = T;\n }\n T = sum32_3(this.h[1], C, Dh);\n this.h[1] = sum32_3(this.h[2], D, Eh);\n this.h[2] = sum32_3(this.h[3], E, Ah);\n this.h[3] = sum32_3(this.h[4], A, Bh);\n this.h[4] = sum32_3(this.h[0], B, Ch);\n this.h[0] = T;\n};\n\nRIPEMD160.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'little');\n else\n return utils.split32(this.h, 'little');\n};\n\nfunction f(j, x, y, z) {\n if (j <= 15)\n return x ^ y ^ z;\n else if (j <= 31)\n return (x & y) | ((~x) & z);\n else if (j <= 47)\n return (x | (~y)) ^ z;\n else if (j <= 63)\n return (x & z) | (y & (~z));\n else\n return x ^ (y | (~z));\n}\n\nfunction K(j) {\n if (j <= 15)\n return 0x00000000;\n else if (j <= 31)\n return 0x5a827999;\n else if (j <= 47)\n return 0x6ed9eba1;\n else if (j <= 63)\n return 0x8f1bbcdc;\n else\n return 0xa953fd4e;\n}\n\nfunction Kh(j) {\n if (j <= 15)\n return 0x50a28be6;\n else if (j <= 31)\n return 0x5c4dd124;\n else if (j <= 47)\n return 0x6d703ef3;\n else if (j <= 63)\n return 0x7a6d76e9;\n else\n return 0x00000000;\n}\n\nvar r = [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,\n 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,\n 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,\n 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13,\n];\n\nvar rh = [\n 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,\n 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,\n 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,\n 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,\n 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11\n];\n\nvar s = [\n 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,\n 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,\n 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,\n 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,\n 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6,\n];\n\nvar sh = [\n 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,\n 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,\n 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,\n 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,\n 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11\n];\n\n},{\"../hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/sha.js\":[function(require,module,exports){\nvar hash = require('../hash');\nvar utils = hash.utils;\nvar assert = utils.assert;\n\nvar rotr32 = utils.rotr32;\nvar rotl32 = utils.rotl32;\nvar sum32 = utils.sum32;\nvar sum32_4 = utils.sum32_4;\nvar sum32_5 = utils.sum32_5;\nvar rotr64_hi = utils.rotr64_hi;\nvar rotr64_lo = utils.rotr64_lo;\nvar shr64_hi = utils.shr64_hi;\nvar shr64_lo = utils.shr64_lo;\nvar sum64 = utils.sum64;\nvar sum64_hi = utils.sum64_hi;\nvar sum64_lo = utils.sum64_lo;\nvar sum64_4_hi = utils.sum64_4_hi;\nvar sum64_4_lo = utils.sum64_4_lo;\nvar sum64_5_hi = utils.sum64_5_hi;\nvar sum64_5_lo = utils.sum64_5_lo;\nvar BlockHash = hash.common.BlockHash;\n\nvar sha256_K = [\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,\n 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,\n 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,\n 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,\n 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,\n 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,\n 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n];\n\nvar sha512_K = [\n 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,\n 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,\n 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,\n 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,\n 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,\n 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,\n 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,\n 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,\n 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,\n 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,\n 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,\n 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,\n 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,\n 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,\n 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,\n 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,\n 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,\n 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,\n 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,\n 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,\n 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,\n 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,\n 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,\n 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,\n 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,\n 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,\n 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,\n 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,\n 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,\n 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,\n 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,\n 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,\n 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,\n 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,\n 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,\n 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,\n 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,\n 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,\n 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,\n 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817\n];\n\nvar sha1_K = [\n 0x5A827999, 0x6ED9EBA1,\n 0x8F1BBCDC, 0xCA62C1D6\n];\n\nfunction SHA256() {\n if (!(this instanceof SHA256))\n return new SHA256();\n\n BlockHash.call(this);\n this.h = [ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,\n 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 ];\n this.k = sha256_K;\n this.W = new Array(64);\n}\nutils.inherits(SHA256, BlockHash);\nexports.sha256 = SHA256;\n\nSHA256.blockSize = 512;\nSHA256.outSize = 256;\nSHA256.hmacStrength = 192;\nSHA256.padLength = 64;\n\nSHA256.prototype._update = function _update(msg, start) {\n var W = this.W;\n\n for (var i = 0; i < 16; i++)\n W[i] = msg[start + i];\n for (; i < W.length; i++)\n W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);\n\n var a = this.h[0];\n var b = this.h[1];\n var c = this.h[2];\n var d = this.h[3];\n var e = this.h[4];\n var f = this.h[5];\n var g = this.h[6];\n var h = this.h[7];\n\n assert(this.k.length === W.length);\n for (var i = 0; i < W.length; i++) {\n var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);\n var T2 = sum32(s0_256(a), maj32(a, b, c));\n h = g;\n g = f;\n f = e;\n e = sum32(d, T1);\n d = c;\n c = b;\n b = a;\n a = sum32(T1, T2);\n }\n\n this.h[0] = sum32(this.h[0], a);\n this.h[1] = sum32(this.h[1], b);\n this.h[2] = sum32(this.h[2], c);\n this.h[3] = sum32(this.h[3], d);\n this.h[4] = sum32(this.h[4], e);\n this.h[5] = sum32(this.h[5], f);\n this.h[6] = sum32(this.h[6], g);\n this.h[7] = sum32(this.h[7], h);\n};\n\nSHA256.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'big');\n else\n return utils.split32(this.h, 'big');\n};\n\nfunction SHA224() {\n if (!(this instanceof SHA224))\n return new SHA224();\n\n SHA256.call(this);\n this.h = [ 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,\n 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ];\n}\nutils.inherits(SHA224, SHA256);\nexports.sha224 = SHA224;\n\nSHA224.blockSize = 512;\nSHA224.outSize = 224;\nSHA224.hmacStrength = 192;\nSHA224.padLength = 64;\n\nSHA224.prototype._digest = function digest(enc) {\n // Just truncate output\n if (enc === 'hex')\n return utils.toHex32(this.h.slice(0, 7), 'big');\n else\n return utils.split32(this.h.slice(0, 7), 'big');\n};\n\nfunction SHA512() {\n if (!(this instanceof SHA512))\n return new SHA512();\n\n BlockHash.call(this);\n this.h = [ 0x6a09e667, 0xf3bcc908,\n 0xbb67ae85, 0x84caa73b,\n 0x3c6ef372, 0xfe94f82b,\n 0xa54ff53a, 0x5f1d36f1,\n 0x510e527f, 0xade682d1,\n 0x9b05688c, 0x2b3e6c1f,\n 0x1f83d9ab, 0xfb41bd6b,\n 0x5be0cd19, 0x137e2179 ];\n this.k = sha512_K;\n this.W = new Array(160);\n}\nutils.inherits(SHA512, BlockHash);\nexports.sha512 = SHA512;\n\nSHA512.blockSize = 1024;\nSHA512.outSize = 512;\nSHA512.hmacStrength = 192;\nSHA512.padLength = 128;\n\nSHA512.prototype._prepareBlock = function _prepareBlock(msg, start) {\n var W = this.W;\n\n // 32 x 32bit words\n for (var i = 0; i < 32; i++)\n W[i] = msg[start + i];\n for (; i < W.length; i += 2) {\n var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2\n var c0_lo = g1_512_lo(W[i - 4], W[i - 3]);\n var c1_hi = W[i - 14]; // i - 7\n var c1_lo = W[i - 13];\n var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15\n var c2_lo = g0_512_lo(W[i - 30], W[i - 29]);\n var c3_hi = W[i - 32]; // i - 16\n var c3_lo = W[i - 31];\n\n W[i] = sum64_4_hi(c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo);\n W[i + 1] = sum64_4_lo(c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo);\n }\n};\n\nSHA512.prototype._update = function _update(msg, start) {\n this._prepareBlock(msg, start);\n\n var W = this.W;\n\n var ah = this.h[0];\n var al = this.h[1];\n var bh = this.h[2];\n var bl = this.h[3];\n var ch = this.h[4];\n var cl = this.h[5];\n var dh = this.h[6];\n var dl = this.h[7];\n var eh = this.h[8];\n var el = this.h[9];\n var fh = this.h[10];\n var fl = this.h[11];\n var gh = this.h[12];\n var gl = this.h[13];\n var hh = this.h[14];\n var hl = this.h[15];\n\n assert(this.k.length === W.length);\n for (var i = 0; i < W.length; i += 2) {\n var c0_hi = hh;\n var c0_lo = hl;\n var c1_hi = s1_512_hi(eh, el);\n var c1_lo = s1_512_lo(eh, el);\n var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl);\n var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);\n var c3_hi = this.k[i];\n var c3_lo = this.k[i + 1];\n var c4_hi = W[i];\n var c4_lo = W[i + 1];\n\n var T1_hi = sum64_5_hi(c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo,\n c4_hi, c4_lo);\n var T1_lo = sum64_5_lo(c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo,\n c4_hi, c4_lo);\n\n var c0_hi = s0_512_hi(ah, al);\n var c0_lo = s0_512_lo(ah, al);\n var c1_hi = maj64_hi(ah, al, bh, bl, ch, cl);\n var c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);\n\n var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);\n var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);\n\n hh = gh;\n hl = gl;\n\n gh = fh;\n gl = fl;\n\n fh = eh;\n fl = el;\n\n eh = sum64_hi(dh, dl, T1_hi, T1_lo);\n el = sum64_lo(dl, dl, T1_hi, T1_lo);\n\n dh = ch;\n dl = cl;\n\n ch = bh;\n cl = bl;\n\n bh = ah;\n bl = al;\n\n ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo);\n al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);\n }\n\n sum64(this.h, 0, ah, al);\n sum64(this.h, 2, bh, bl);\n sum64(this.h, 4, ch, cl);\n sum64(this.h, 6, dh, dl);\n sum64(this.h, 8, eh, el);\n sum64(this.h, 10, fh, fl);\n sum64(this.h, 12, gh, gl);\n sum64(this.h, 14, hh, hl);\n};\n\nSHA512.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'big');\n else\n return utils.split32(this.h, 'big');\n};\n\nfunction SHA384() {\n if (!(this instanceof SHA384))\n return new SHA384();\n\n SHA512.call(this);\n this.h = [ 0xcbbb9d5d, 0xc1059ed8,\n 0x629a292a, 0x367cd507,\n 0x9159015a, 0x3070dd17,\n 0x152fecd8, 0xf70e5939,\n 0x67332667, 0xffc00b31,\n 0x8eb44a87, 0x68581511,\n 0xdb0c2e0d, 0x64f98fa7,\n 0x47b5481d, 0xbefa4fa4 ];\n}\nutils.inherits(SHA384, SHA512);\nexports.sha384 = SHA384;\n\nSHA384.blockSize = 1024;\nSHA384.outSize = 384;\nSHA384.hmacStrength = 192;\nSHA384.padLength = 128;\n\nSHA384.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h.slice(0, 12), 'big');\n else\n return utils.split32(this.h.slice(0, 12), 'big');\n};\n\nfunction SHA1() {\n if (!(this instanceof SHA1))\n return new SHA1();\n\n BlockHash.call(this);\n this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe,\n 0x10325476, 0xc3d2e1f0 ];\n this.W = new Array(80);\n}\n\nutils.inherits(SHA1, BlockHash);\nexports.sha1 = SHA1;\n\nSHA1.blockSize = 512;\nSHA1.outSize = 160;\nSHA1.hmacStrength = 80;\nSHA1.padLength = 64;\n\nSHA1.prototype._update = function _update(msg, start) {\n var W = this.W;\n\n for (var i = 0; i < 16; i++)\n W[i] = msg[start + i];\n\n for(; i < W.length; i++)\n W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);\n\n var a = this.h[0];\n var b = this.h[1];\n var c = this.h[2];\n var d = this.h[3];\n var e = this.h[4];\n\n for (var i = 0; i < W.length; i++) {\n var s = ~~(i / 20);\n var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);\n e = d;\n d = c;\n c = rotl32(b, 30);\n b = a;\n a = t;\n }\n\n this.h[0] = sum32(this.h[0], a);\n this.h[1] = sum32(this.h[1], b);\n this.h[2] = sum32(this.h[2], c);\n this.h[3] = sum32(this.h[3], d);\n this.h[4] = sum32(this.h[4], e);\n};\n\nSHA1.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'big');\n else\n return utils.split32(this.h, 'big');\n};\n\nfunction ch32(x, y, z) {\n return (x & y) ^ ((~x) & z);\n}\n\nfunction maj32(x, y, z) {\n return (x & y) ^ (x & z) ^ (y & z);\n}\n\nfunction p32(x, y, z) {\n return x ^ y ^ z;\n}\n\nfunction s0_256(x) {\n return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);\n}\n\nfunction s1_256(x) {\n return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);\n}\n\nfunction g0_256(x) {\n return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3);\n}\n\nfunction g1_256(x) {\n return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10);\n}\n\nfunction ft_1(s, x, y, z) {\n if (s === 0)\n return ch32(x, y, z);\n if (s === 1 || s === 3)\n return p32(x, y, z);\n if (s === 2)\n return maj32(x, y, z);\n}\n\nfunction ch64_hi(xh, xl, yh, yl, zh, zl) {\n var r = (xh & yh) ^ ((~xh) & zh);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction ch64_lo(xh, xl, yh, yl, zh, zl) {\n var r = (xl & yl) ^ ((~xl) & zl);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction maj64_hi(xh, xl, yh, yl, zh, zl) {\n var r = (xh & yh) ^ (xh & zh) ^ (yh & zh);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction maj64_lo(xh, xl, yh, yl, zh, zl) {\n var r = (xl & yl) ^ (xl & zl) ^ (yl & zl);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 28);\n var c1_hi = rotr64_hi(xl, xh, 2); // 34\n var c2_hi = rotr64_hi(xl, xh, 7); // 39\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 28);\n var c1_lo = rotr64_lo(xl, xh, 2); // 34\n var c2_lo = rotr64_lo(xl, xh, 7); // 39\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 14);\n var c1_hi = rotr64_hi(xh, xl, 18);\n var c2_hi = rotr64_hi(xl, xh, 9); // 41\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 14);\n var c1_lo = rotr64_lo(xh, xl, 18);\n var c2_lo = rotr64_lo(xl, xh, 9); // 41\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 1);\n var c1_hi = rotr64_hi(xh, xl, 8);\n var c2_hi = shr64_hi(xh, xl, 7);\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 1);\n var c1_lo = rotr64_lo(xh, xl, 8);\n var c2_lo = shr64_lo(xh, xl, 7);\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 19);\n var c1_hi = rotr64_hi(xl, xh, 29); // 61\n var c2_hi = shr64_hi(xh, xl, 6);\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 19);\n var c1_lo = rotr64_lo(xl, xh, 29); // 61\n var c2_lo = shr64_lo(xh, xl, 6);\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\n},{\"../hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/utils.js\":[function(require,module,exports){\nvar utils = exports;\nvar inherits = require('inherits');\n\nfunction toArray(msg, enc) {\n if (Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg === 'string') {\n if (!enc) {\n for (var i = 0; i < msg.length; i++) {\n var c = msg.charCodeAt(i);\n var hi = c >> 8;\n var lo = c & 0xff;\n if (hi)\n res.push(hi, lo);\n else\n res.push(lo);\n }\n } else if (enc === 'hex') {\n msg = msg.replace(/[^a-z0-9]+/ig, '');\n if (msg.length % 2 !== 0)\n msg = '0' + msg;\n for (var i = 0; i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n }\n } else {\n for (var i = 0; i < msg.length; i++)\n res[i] = msg[i] | 0;\n }\n return res;\n}\nutils.toArray = toArray;\n\nfunction toHex(msg) {\n var res = '';\n for (var i = 0; i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n}\nutils.toHex = toHex;\n\nfunction htonl(w) {\n var res = (w >>> 24) |\n ((w >>> 8) & 0xff00) |\n ((w << 8) & 0xff0000) |\n ((w & 0xff) << 24);\n return res >>> 0;\n}\nutils.htonl = htonl;\n\nfunction toHex32(msg, endian) {\n var res = '';\n for (var i = 0; i < msg.length; i++) {\n var w = msg[i];\n if (endian === 'little')\n w = htonl(w);\n res += zero8(w.toString(16));\n }\n return res;\n}\nutils.toHex32 = toHex32;\n\nfunction zero2(word) {\n if (word.length === 1)\n return '0' + word;\n else\n return word;\n}\nutils.zero2 = zero2;\n\nfunction zero8(word) {\n if (word.length === 7)\n return '0' + word;\n else if (word.length === 6)\n return '00' + word;\n else if (word.length === 5)\n return '000' + word;\n else if (word.length === 4)\n return '0000' + word;\n else if (word.length === 3)\n return '00000' + word;\n else if (word.length === 2)\n return '000000' + word;\n else if (word.length === 1)\n return '0000000' + word;\n else\n return word;\n}\nutils.zero8 = zero8;\n\nfunction join32(msg, start, end, endian) {\n var len = end - start;\n assert(len % 4 === 0);\n var res = new Array(len / 4);\n for (var i = 0, k = start; i < res.length; i++, k += 4) {\n var w;\n if (endian === 'big')\n w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3];\n else\n w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k];\n res[i] = w >>> 0;\n }\n return res;\n}\nutils.join32 = join32;\n\nfunction split32(msg, endian) {\n var res = new Array(msg.length * 4);\n for (var i = 0, k = 0; i < msg.length; i++, k += 4) {\n var m = msg[i];\n if (endian === 'big') {\n res[k] = m >>> 24;\n res[k + 1] = (m >>> 16) & 0xff;\n res[k + 2] = (m >>> 8) & 0xff;\n res[k + 3] = m & 0xff;\n } else {\n res[k + 3] = m >>> 24;\n res[k + 2] = (m >>> 16) & 0xff;\n res[k + 1] = (m >>> 8) & 0xff;\n res[k] = m & 0xff;\n }\n }\n return res;\n}\nutils.split32 = split32;\n\nfunction rotr32(w, b) {\n return (w >>> b) | (w << (32 - b));\n}\nutils.rotr32 = rotr32;\n\nfunction rotl32(w, b) {\n return (w << b) | (w >>> (32 - b));\n}\nutils.rotl32 = rotl32;\n\nfunction sum32(a, b) {\n return (a + b) >>> 0;\n}\nutils.sum32 = sum32;\n\nfunction sum32_3(a, b, c) {\n return (a + b + c) >>> 0;\n}\nutils.sum32_3 = sum32_3;\n\nfunction sum32_4(a, b, c, d) {\n return (a + b + c + d) >>> 0;\n}\nutils.sum32_4 = sum32_4;\n\nfunction sum32_5(a, b, c, d, e) {\n return (a + b + c + d + e) >>> 0;\n}\nutils.sum32_5 = sum32_5;\n\nfunction assert(cond, msg) {\n if (!cond)\n throw new Error(msg || 'Assertion failed');\n}\nutils.assert = assert;\n\nutils.inherits = inherits;\n\nfunction sum64(buf, pos, ah, al) {\n var bh = buf[pos];\n var bl = buf[pos + 1];\n\n var lo = (al + bl) >>> 0;\n var hi = (lo < al ? 1 : 0) + ah + bh;\n buf[pos] = hi >>> 0;\n buf[pos + 1] = lo;\n}\nexports.sum64 = sum64;\n\nfunction sum64_hi(ah, al, bh, bl) {\n var lo = (al + bl) >>> 0;\n var hi = (lo < al ? 1 : 0) + ah + bh;\n return hi >>> 0;\n};\nexports.sum64_hi = sum64_hi;\n\nfunction sum64_lo(ah, al, bh, bl) {\n var lo = al + bl;\n return lo >>> 0;\n};\nexports.sum64_lo = sum64_lo;\n\nfunction sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {\n var carry = 0;\n var lo = al;\n lo = (lo + bl) >>> 0;\n carry += lo < al ? 1 : 0;\n lo = (lo + cl) >>> 0;\n carry += lo < cl ? 1 : 0;\n lo = (lo + dl) >>> 0;\n carry += lo < dl ? 1 : 0;\n\n var hi = ah + bh + ch + dh + carry;\n return hi >>> 0;\n};\nexports.sum64_4_hi = sum64_4_hi;\n\nfunction sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {\n var lo = al + bl + cl + dl;\n return lo >>> 0;\n};\nexports.sum64_4_lo = sum64_4_lo;\n\nfunction sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {\n var carry = 0;\n var lo = al;\n lo = (lo + bl) >>> 0;\n carry += lo < al ? 1 : 0;\n lo = (lo + cl) >>> 0;\n carry += lo < cl ? 1 : 0;\n lo = (lo + dl) >>> 0;\n carry += lo < dl ? 1 : 0;\n lo = (lo + el) >>> 0;\n carry += lo < el ? 1 : 0;\n\n var hi = ah + bh + ch + dh + eh + carry;\n return hi >>> 0;\n};\nexports.sum64_5_hi = sum64_5_hi;\n\nfunction sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {\n var lo = al + bl + cl + dl + el;\n\n return lo >>> 0;\n};\nexports.sum64_5_lo = sum64_5_lo;\n\nfunction rotr64_hi(ah, al, num) {\n var r = (al << (32 - num)) | (ah >>> num);\n return r >>> 0;\n};\nexports.rotr64_hi = rotr64_hi;\n\nfunction rotr64_lo(ah, al, num) {\n var r = (ah << (32 - num)) | (al >>> num);\n return r >>> 0;\n};\nexports.rotr64_lo = rotr64_lo;\n\nfunction shr64_hi(ah, al, num) {\n return ah >>> num;\n};\nexports.shr64_hi = shr64_hi;\n\nfunction shr64_lo(ah, al, num) {\n var r = (ah << (32 - num)) | (al >>> num);\n return r >>> 0;\n};\nexports.shr64_lo = shr64_lo;\n\n},{\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/package.json\":[function(require,module,exports){\nmodule.exports={\n \"name\": \"elliptic\",\n \"version\": \"1.0.1\",\n \"description\": \"EC cryptography\",\n \"main\": \"lib/elliptic.js\",\n \"scripts\": {\n \"test\": \"mocha --reporter=spec test/*-test.js\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git@github.com:indutny/elliptic\"\n },\n \"keywords\": [\n \"EC\",\n \"Elliptic\",\n \"curve\",\n \"Cryptography\"\n ],\n \"author\": {\n \"name\": \"Fedor Indutny\",\n \"email\": \"fedor@indutny.com\"\n },\n \"license\": \"MIT\",\n \"bugs\": {\n \"url\": \"https://github.com/indutny/elliptic/issues\"\n },\n \"homepage\": \"https://github.com/indutny/elliptic\",\n \"devDependencies\": {\n \"browserify\": \"^3.44.2\",\n \"mocha\": \"^1.18.2\",\n \"uglify-js\": \"^2.4.13\"\n },\n \"dependencies\": {\n \"bn.js\": \"^1.0.0\",\n \"brorand\": \"^1.0.1\",\n \"hash.js\": \"^1.0.0\",\n \"inherits\": \"^2.0.1\"\n },\n \"gitHead\": \"17dc013761dd1efcfb868e2b06b0b897627b40be\",\n \"_id\": \"elliptic@1.0.1\",\n \"_shasum\": \"d180376b66a17d74995c837796362ac4d22aefe3\",\n \"_from\": \"elliptic@^1.0.0\",\n \"_npmVersion\": \"1.4.28\",\n \"_npmUser\": {\n \"name\": \"indutny\",\n \"email\": \"fedor@indutny.com\"\n },\n \"maintainers\": [\n {\n \"name\": \"indutny\",\n \"email\": \"fedor@indutny.com\"\n }\n ],\n \"dist\": {\n \"shasum\": \"d180376b66a17d74995c837796362ac4d22aefe3\",\n \"tarball\": \"http://registry.npmjs.org/elliptic/-/elliptic-1.0.1.tgz\"\n },\n \"directories\": {},\n \"_resolved\": \"https://registry.npmjs.org/elliptic/-/elliptic-1.0.1.tgz\",\n \"readme\": \"ERROR: No README data found!\"\n}\n\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/EVP_BytesToKey.js\":[function(require,module,exports){\n(function (Buffer){\n\nmodule.exports = function evp(crypto, password, salt, keyLen) {\n keyLen = keyLen/8;\n var ki = 0;\n var ii = 0;\n var key = new Buffer(keyLen);\n var addmd = 0;\n var md, md_buf;\n var i;\n while (true) {\n md = crypto.createHash('md5');\n if(addmd++ > 0) {\n md.update(md_buf);\n }\n md.update(password);\n md.update(salt);\n md_buf = md.digest();\n i = 0;\n if(keyLen > 0) {\n while(true) {\n if(keyLen === 0) {\n break;\n }\n if(i === md_buf.length) {\n break;\n }\n key[ki++] = md_buf[i++];\n keyLen--;\n }\n }\n if(keyLen === 0) {\n break;\n }\n }\n for(i=0;i 3)\n return new bignum(raw);\n\n while (!buffer.isEmpty()) {\n res <<= 8;\n var i = buffer.readUInt8();\n if (buffer.isError(i))\n return i;\n res |= i;\n }\n\n if (values)\n res = values[res] || res;\n\n return res;\n};\n\nDERNode.prototype._use = function use(entity, obj) {\n if (typeof entity === 'function')\n entity = entity(obj);\n return entity._getDecoder('der').tree;\n};\n\n// Utility methods\n\nfunction derDecodeTag(buf, fail) {\n var tag = buf.readUInt8(fail);\n if (buf.isError(tag))\n return tag;\n\n var cls = der.tagClass[tag >> 6];\n var primitive = (tag & 0x20) === 0;\n\n // Multi-octet tag - load\n if ((tag & 0x1f) === 0x1f) {\n var oct = tag;\n tag = 0;\n while ((oct & 0x80) === 0x80) {\n oct = buf.readUInt8(fail);\n if (buf.isError(oct))\n return oct;\n\n tag <<= 7;\n tag |= oct & 0x7f;\n }\n } else {\n tag &= 0x1f;\n }\n var tagStr = der.tag[tag];\n\n return {\n cls: cls,\n primitive: primitive,\n tag: tag,\n tagStr: tagStr\n };\n}\n\nfunction derDecodeLen(buf, primitive, fail) {\n var len = buf.readUInt8(fail);\n if (buf.isError(len))\n return len;\n\n // Indefinite form\n if (!primitive && len === 0x80)\n return null;\n\n // Definite form\n if ((len & 0x80) === 0) {\n // Short form\n return len;\n }\n\n // Long form\n var num = len & 0x7f;\n if (num >= 4)\n return buf.error('length octect is too long');\n\n len = 0;\n for (var i = 0; i < num; i++) {\n len <<= 8;\n var j = buf.readUInt8(fail);\n if (buf.isError(j))\n return j;\n len |= j;\n }\n\n return len;\n}\n\n},{\"../../asn1\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/decoders/index.js\":[function(require,module,exports){\nvar decoders = exports;\n\ndecoders.der = require('./der');\n\n},{\"./der\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/decoders/der.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/encoders/der.js\":[function(require,module,exports){\nvar inherits = require('inherits');\nvar Buffer = require('buffer').Buffer;\n\nvar asn1 = require('../../asn1');\nvar base = asn1.base;\nvar bignum = asn1.bignum;\n\n// Import DER constants\nvar der = asn1.constants.der;\n\nfunction DEREncoder(entity) {\n this.enc = 'der';\n this.name = entity.name;\n this.entity = entity;\n\n // Construct base tree\n this.tree = new DERNode();\n this.tree._init(entity.body);\n};\nmodule.exports = DEREncoder;\n\nDEREncoder.prototype.encode = function encode(data, reporter) {\n return this.tree._encode(data, reporter).join();\n};\n\n// Tree methods\n\nfunction DERNode(parent) {\n base.Node.call(this, 'der', parent);\n}\ninherits(DERNode, base.Node);\n\nDERNode.prototype._encodeComposite = function encodeComposite(tag,\n primitive,\n cls,\n content) {\n var encodedTag = encodeTag(tag, primitive, cls, this.reporter);\n\n // Short form\n if (content.length < 0x80) {\n var header = new Buffer(2);\n header[0] = encodedTag;\n header[1] = content.length;\n return this._createEncoderBuffer([ header, content ]);\n }\n\n // Long form\n // Count octets required to store length\n var lenOctets = 1;\n for (var i = content.length; i >= 0x100; i >>= 8)\n lenOctets++;\n\n var header = new Buffer(1 + 1 + lenOctets);\n header[0] = encodedTag;\n header[1] = 0x80 | lenOctets;\n\n for (var i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8)\n header[i] = j & 0xff;\n\n return this._createEncoderBuffer([ header, content ]);\n};\n\nDERNode.prototype._encodeStr = function encodeStr(str, tag) {\n if (tag === 'octstr')\n return this._createEncoderBuffer(str);\n else if (tag === 'bitstr')\n return this._createEncoderBuffer([ str.unused | 0, str.data ]);\n else if (tag === 'ia5str')\n return this._createEncoderBuffer(str);\n return this.reporter.error('Encoding of string type: ' + tag +\n ' unsupported');\n};\n\nDERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) {\n if (typeof id === 'string') {\n if (!values)\n return this.reporter.error('string objid given, but no values map found');\n if (!values.hasOwnProperty(id))\n return this.reporter.error('objid not found in values map');\n id = values[id].split(/\\s+/g);\n for (var i = 0; i < id.length; i++)\n id[i] |= 0;\n } else if (Array.isArray(id)) {\n id = id.slice();\n }\n\n if (!Array.isArray(id)) {\n return this.reporter.error('objid() should be either array or string, ' +\n 'got: ' + JSON.stringify(id));\n }\n\n if (!relative) {\n if (id[1] >= 40)\n return this.reporter.error('Second objid identifier OOB');\n id.splice(0, 2, id[0] * 40 + id[1]);\n }\n\n // Count number of octets\n var size = 0;\n for (var i = 0; i < id.length; i++) {\n var ident = id[i];\n for (size++; ident >= 0x80; ident >>= 7)\n size++;\n }\n\n var objid = new Buffer(size);\n var offset = objid.length - 1;\n for (var i = id.length - 1; i >= 0; i--) {\n var ident = id[i];\n objid[offset--] = ident & 0x7f;\n while ((ident >>= 7) > 0)\n objid[offset--] = 0x80 | (ident & 0x7f);\n }\n\n return this._createEncoderBuffer(objid);\n};\n\nfunction two(num) {\n if (num <= 10)\n return '0' + num;\n else\n return num;\n}\n\nDERNode.prototype._encodeTime = function encodeTime(time, tag) {\n var str;\n var date = new Date(time);\n\n if (tag === 'gentime') {\n str = [\n date.getFullYear(),\n two(date.getUTCMonth() + 1),\n two(date.getUTCDate()),\n two(date.getUTCHours()),\n two(date.getUTCMinutes()),\n two(date.getUTCSeconds()),\n 'Z'\n ].join('');\n } else if (tag === 'utctime') {\n str = [\n date.getFullYear() % 100,\n two(date.getUTCMonth() + 1),\n two(date.getUTCDate()),\n two(date.getUTCHours()),\n two(date.getUTCMinutes()),\n two(date.getUTCSeconds()),\n 'Z'\n ].join('');\n } else {\n this.reporter.error('Encoding ' + tag + ' time is not supported yet');\n }\n\n return this._encodeStr(str, 'octstr');\n};\n\nDERNode.prototype._encodeNull = function encodeNull() {\n return this._createEncoderBuffer('');\n};\n\nDERNode.prototype._encodeInt = function encodeInt(num, values) {\n if (typeof num === 'string') {\n if (!values)\n return this.reporter.error('String int or enum given, but no values map');\n if (!values.hasOwnProperty(num)) {\n return this.reporter.error('Values map doesn\\'t contain: ' +\n JSON.stringify(num));\n }\n num = values[num];\n }\n\n // Bignum, assume big endian\n if (bignum !== null && num instanceof bignum) {\n var numArray = num.toArray();\n if(num.sign === false && numArray[0] & 0x80) {\n numArray.unshift(0);\n }\n num = new Buffer(numArray);\n }\n\n if (Buffer.isBuffer(num)) {\n var size = num.length;\n if (num.length === 0)\n size++;\n\n var out = new Buffer(size);\n num.copy(out);\n if (num.length === 0)\n out[0] = 0\n return this._createEncoderBuffer(out);\n }\n\n if (num < 0x80)\n return this._createEncoderBuffer(num);\n\n if (num < 0x100)\n return this._createEncoderBuffer([0, num]);\n\n var size = 1;\n for (var i = num; i >= 0x100; i >>= 8)\n size++;\n\n var out = new Array(size);\n for (var i = out.length - 1; i >= 0; i--) {\n out[i] = num & 0xff;\n num >>= 8;\n }\n if(out[0] & 0x80) {\n out.unshift(0);\n }\n\n return this._createEncoderBuffer(new Buffer(out));\n};\n\nDERNode.prototype._encodeBool = function encodeBool(value) {\n return this._createEncoderBuffer(value ? 0xff : 0);\n};\n\nDERNode.prototype._use = function use(entity, obj) {\n if (typeof entity === 'function')\n entity = entity(obj);\n return entity._getEncoder('der').tree;\n};\n\nDERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) {\n var state = this._baseState;\n var i;\n if (state['default'] === null)\n return false;\n\n var data = dataBuffer.join();\n if (state.defaultBuffer === undefined)\n state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join();\n\n if (data.length !== state.defaultBuffer.length)\n return false;\n\n for (i=0; i < data.length; i++)\n if (data[i] !== state.defaultBuffer[i])\n return false;\n\n return true;\n};\n\n// Utility methods\n\nfunction encodeTag(tag, primitive, cls, reporter) {\n var res;\n\n if (tag === 'seqof')\n tag = 'seq';\n else if (tag === 'setof')\n tag = 'set';\n\n if (der.tagByName.hasOwnProperty(tag))\n res = der.tagByName[tag];\n else if (typeof tag === 'number' && (tag | 0) === tag)\n res = tag;\n else\n return reporter.error('Unknown tag: ' + tag);\n\n if (res >= 0x1f)\n return reporter.error('Multi-octet tag encoding unsupported');\n\n if (!primitive)\n res |= 0x20;\n\n res |= (der.tagClassByName[cls || 'universal'] << 6);\n\n return res;\n}\n\n},{\"../../asn1\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/encoders/index.js\":[function(require,module,exports){\nvar encoders = exports;\n\nencoders.der = require('./der');\n\n},{\"./der\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/encoders/der.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/node_modules/minimalistic-assert/index.js\":[function(require,module,exports){\nmodule.exports = assert;\n\nfunction assert(val, msg) {\n if (!val)\n throw new Error(msg || 'Assertion failed');\n}\n\nassert.equal = function assertEqual(l, r, msg) {\n if (l != r)\n throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));\n};\n\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pemstrip/index.js\":[function(require,module,exports){\nexports.strip = function strip(artifact) {\n artifact = artifact.toString()\n var startRegex = /^-----BEGIN (.*)-----\\n/;\n var match = startRegex.exec(artifact);\n var tag = match[1];\n var endRegex = new RegExp(\"\\n-----END \" + tag + \"-----(\\n*)$\");\n var base64 = artifact.slice(match[0].length).replace(endRegex, \"\").replace(/\\n/g, \"\");\n return {tag: tag, base64: base64};\n};\n\n// http://stackoverflow.com/a/7033705\nvar wrap = function wrap(str, l) {\n var chunks = [];\n while (str) {\n if (str.length < l) {\n chunks.push(str);\n break;\n }\n else {\n chunks.push(str.substr(0, l));\n str = str.substr(l);\n }\n }\n return chunks.join(\"\\n\");\n}\n\nexports.assemble = function assemble(info) {\n var tag = info.tag;\n var base64 = info.base64;\n var startLine = \"-----BEGIN \" + tag + \"-----\";\n var endLine = \"-----END \" + tag + \"-----\";\n return startLine + \"\\n\" + wrap(base64, 64) + \"\\n\" + endLine + \"\\n\";\n}\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/sign.js\":[function(require,module,exports){\n(function (Buffer){\n// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js\nvar parseKeys = require('parse-asn1');\nvar bn = require('bn.js');\nvar elliptic = require('elliptic');\nvar crt = require(\"browserify-rsa\");\nmodule.exports = sign;\nfunction sign(hash, key, hashType, crypto) {\n var priv = parseKeys(key, crypto);\n if (priv.curve) {\n return ecSign(hash, priv, crypto);\n } else if (priv.type === 'dsa') {\n return dsaSign(hash, priv, hashType, crypto);\n }\n var len = priv.modulus.byteLength();\n var pad = [ 0, 1 ];\n while (hash.length + pad.length + 1 < len) {\n pad.push(0xff);\n }\n pad.push(0x00);\n var i = -1;\n while (++i < hash.length) {\n pad.push(hash[i]);\n }\n \n var out = crt(pad, priv, crypto);\n return out;\n}\nfunction ecSign(hash, priv, crypto) {\n elliptic.rand = crypto.randomBytes;\n var curve;\n if (priv.curve.join('.') === '1.3.132.0.10') {\n curve = new elliptic.ec('secp256k1');\n }\n var key = curve.genKeyPair();\n key._importPrivate(priv.privateKey);\n var out = key.sign(hash);\n return new Buffer(out.toDER());\n}\nfunction dsaSign(hash, priv, algo, crypto) {\n var x = priv.params.priv_key;\n var p = priv.params.p;\n var q = priv.params.q;\n var montq = bn.mont(q);\n var g = priv.params.g;\n var r = new bn(0);\n var k;\n var H = bits2int(hash, q).mod(q);\n var s = false;\n var kv = getKay(x, q, hash, algo, crypto);\n while (s === false) {\n k = makeKey(q, kv, algo, crypto);\n r = makeR(g, k, p, q);\n s = k.invm(q).imul(H.add(x.mul(r))).mod(q);\n if (!s.cmpn(0)) {\n s = false;\n r = new bn(0);\n }\n }\n return toDER(r,s);\n}\nfunction toDER(r, s) {\n r = r.toArray();\n s = s.toArray();\n\n // Pad values\n if (r[0] & 0x80)\n r = [ 0 ].concat(r);\n // Pad values\n if (s[0] & 0x80)\n s = [0].concat(s);\n\n var total = r.length + s.length + 4;\n var res = [ 0x30, total, 0x02, r.length ];\n res = res.concat(r, [ 0x02, s.length ], s);\n return new Buffer(res);\n}\nmodule.exports.getKay = getKay;\nfunction getKay(x, q, hash, algo, crypto) {\n x = new Buffer(x.toArray());\n if (x.length < q.byteLength()) {\n var zeros = new Buffer(q.byteLength() - x.length);\n zeros.fill(0);\n x = Buffer.concat([zeros, x]);\n }\n var hlen = hash.length;\n var hbits = bits2octets(hash, q);\n var v = new Buffer(hlen);\n v.fill(1);\n var k = new Buffer(hlen);\n k.fill(0);\n k = crypto.createHmac(algo, k)\n .update(v)\n .update(new Buffer([0]))\n .update(x)\n .update(hbits)\n .digest();\n v = crypto.createHmac(algo, k)\n .update(v)\n .digest();\n k = crypto.createHmac(algo, k)\n .update(v)\n .update(new Buffer([1]))\n .update(x)\n .update(hbits)\n .digest();\n v = crypto.createHmac(algo, k)\n .update(v)\n .digest();\n return {\n k:k,\n v:v\n };\n}\nfunction bits2int(obits, q) {\n bits = new bn(obits);\n var shift = obits.length * 8 - q.bitLength();\n if (shift > 0) {\n bits.ishrn(shift);\n }\n return bits;\n}\nfunction bits2octets (bits, q) {\n bits = bits2int(bits, q);\n bits = bits.mod(q);\n var out = new Buffer(bits.toArray());\n if (out.length < q.byteLength()) {\n var zeros = new Buffer(q.byteLength() - out.length);\n zeros.fill(0);\n out = Buffer.concat([zeros, out]);\n }\n return out;\n}\nmodule.exports.makeKey = makeKey;\nfunction makeKey(q, kv, algo, crypto) {\n var t;\n var k;\n while (true) {\n t = new Buffer('');\n while (t.length * 8 < q.bitLength()) {\n kv.v = crypto.createHmac(algo, kv.k)\n .update(kv.v)\n .digest();\n t = Buffer.concat([t, kv.v]);\n }\n k = bits2int(t, q);\n kv.k = crypto.createHmac(algo, kv.k)\n .update(kv.v)\n .update(new Buffer([0]))\n .digest();\n kv.v = crypto.createHmac(algo, kv.k)\n .update(kv.v)\n .digest();\n if (k.cmp(q) === -1) {\n return k;\n }\n }\n}\nfunction makeR(g, k, p, q) {\n return g.toRed(bn.mont(p)).redPow(k).fromRed().mod(q);\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\",\"browserify-rsa\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/browserify-rsa/index.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\",\"parse-asn1\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/verify.js\":[function(require,module,exports){\n(function (Buffer){\n// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js\nvar parseKeys = require('parse-asn1');\nvar elliptic = require('elliptic');\nvar bn = require('bn.js');\nmodule.exports = verify;\nfunction verify(sig, hash, key) {\n var pub = parseKeys(key);\n if (pub.type === 'ec') {\n return ecVerify(sig, hash, pub);\n } else if (pub.type === 'dsa') {\n return dsaVerify(sig, hash, pub);\n }\n var len = pub.modulus.byteLength();\n var pad = [ 0, 1 ];\n while (hash.length + pad.length + 1 < len) {\n pad.push(0xff);\n }\n pad.push(0x00);\n var i = -1;\n while (++i < hash.length) {\n pad.push(hash[i]);\n }\n pad = hash;\n var red = bn.mont(pub.modulus);\n sig = new bn(sig).toRed(red);\n\n sig = sig.redPow(new bn(pub.publicExponent));\n\n sig = new Buffer(sig.fromRed().toArray());\n sig = sig.slice(sig.length - hash.length);\n var out = 0;\n len = sig.length;\n i = -1;\n while (++i < len) {\n out += (sig[i] ^ hash[i]);\n }\n return !out;\n}\nfunction ecVerify(sig, hash, pub) {\n var curve;\n if (pub.data.algorithm.curve.join('.') === '1.3.132.0.10') {\n curve = new elliptic.ec('secp256k1');\n }\n var pubkey = pub.data.subjectPrivateKey.data;\n return curve.verify(hash.toString('hex'), sig.toString('hex'), pubkey.toString('hex'));\n}\nfunction dsaVerify(sig, hash, pub) {\n var p = pub.data.p;\n var q = pub.data.q;\n var g = pub.data.g;\n var y = pub.data.pub_key;\n var unpacked = parseKeys.signature.decode(sig, 'der');\n var s = unpacked.s;\n var r = unpacked.r;\n checkValue(s, q);\n checkValue(r, q);\n var montq = bn.mont(q);\n var montp = bn.mont(p);\n var w = s.invm(q);\n var v = g.toRed(montp)\n .redPow(new bn(hash).mul(w).mod(q))\n .fromRed()\n .mul(\n y.toRed(montp)\n .redPow(r.mul(w).mod(q))\n .fromRed()\n ).mod(p).mod(q);\n return !v.cmp(r);\n}\nfunction checkValue(b, q) {\n if (b.cmpn(0) <= 0) {\n throw new Error('invalid sig');\n }\n if (b.cmp(q) >= q) {\n throw new Error('invalid sig');\n }\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\",\"parse-asn1\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/browser.js\":[function(require,module,exports){\n(function (Buffer){\nvar elliptic = require('elliptic');\nvar BN = require('bn.js');\n\nmodule.exports = function createECDH(curve) {\n\treturn new ECDH(curve);\n};\n\nvar aliases = {\n\tsecp256k1: {\n\t\tname: 'secp256k1',\n\t\tbyteLength: 32\n\t},\n\tsecp224r1: {\n\t\tname: 'p224',\n\t\tbyteLength: 28\n\t},\n\tprime256v1: {\n\t\tname: 'p256',\n\t\tbyteLength: 32\n\t},\n\tprime192v1: {\n\t\tname: 'p192',\n\t\tbyteLength: 24\n\t},\n\ted25519: {\n\t\tname: 'ed25519',\n\t\tbyteLength: 32\n\t}\n};\n\naliases.p224 = aliases.secp224r1;\naliases.p256 = aliases.secp256r1 = aliases.prime256v1;\naliases.p192 = aliases.secp192r1 = aliases.prime192v1;\n\nfunction ECDH(curve) {\n\tthis.curveType = aliases[curve];\n\tif (!this.curveType ) {\n\t\tthis.curveType = {\n\t\t\tname: curve\n\t\t};\n\t}\n\tthis.curve = new elliptic.ec(this.curveType.name);\n\tthis.keys = void 0;\n}\n\nECDH.prototype.generateKeys = function (enc, format) {\n\tthis.keys = this.curve.genKeyPair();\n\treturn this.getPublicKey(enc, format);\n};\n\nECDH.prototype.computeSecret = function (other, inenc, enc) {\n\tinenc = inenc || 'utf8';\n\tif (!Buffer.isBuffer(other)) {\n\t\tother = new Buffer(other, inenc);\n\t}\n\tother = new BN(other);\n\tother = other.toString(16);\n\tvar otherPub = this.curve.keyPair(other, 'hex').getPublic();\n\tvar out = otherPub.mul(this.keys.getPrivate()).getX();\n\treturn formatReturnValue(out, enc, this.curveType.byteLength);\n};\n\nECDH.prototype.getPublicKey = function (enc, format) {\n\tvar key = this.keys.getPublic(format === 'compressed', true);\n\tif (format === 'hybrid') {\n\t\tif (key[key.length - 1] % 2) {\n\t\t\tkey[0] = 7;\n\t\t} else {\n\t\t\tkey [0] = 6;\n\t\t}\n\t}\n\treturn formatReturnValue(key, enc);\n};\n\nECDH.prototype.getPrivateKey = function (enc) {\n\treturn formatReturnValue(this.keys.getPrivate(), enc);\n};\n\nECDH.prototype.setPublicKey = function (pub, enc) {\n\tenc = enc || 'utf8';\n\tif (!Buffer.isBuffer(pub)) {\n\t\tpub = new Buffer(pub, enc);\n\t}\n\tvar pkey = new BN(pub);\n\tpkey = pkey.toArray();\n\tthis.keys._importPublicHex(pkey);\n\treturn this;\n};\n\nECDH.prototype.setPrivateKey = function (priv, enc) {\n\tenc = enc || 'utf8';\n\tif (!Buffer.isBuffer(priv)) {\n\t\tpriv = new Buffer(priv, enc);\n\t}\n\tvar _priv = new BN(priv);\n\t_priv = _priv.toString(16);\n\tthis.keys._importPrivate(_priv);\n\treturn this;\n};\n\nfunction formatReturnValue(bn, enc, len) {\n\tif (!Array.isArray(bn)) {\n\t\tbn = bn.toArray();\n\t}\n\tvar buf = new Buffer(bn);\n\tif (len && buf.length < len) {\n\t\tvar zeros = new Buffer(len - buf.length);\n\t\tzeros.fill(0);\n\t\tbuf = Buffer.concat([zeros, buf]);\n\t}\n\tif (!enc) {\n\t\treturn buf;\n\t} else {\n\t\treturn buf.toString(enc);\n\t}\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/index.js\":[function(require,module,exports){\nvar createECDH = require('crypto').createECDH;\n\nmodule.exports = createECDH || require('./browser');\n},{\"./browser\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/browser.js\",\"crypto\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\"][0].apply(exports,arguments)\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js\"][0].apply(exports,arguments)\n},{\"../package.json\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/package.json\",\"./elliptic/curve\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/index.js\",\"./elliptic/curves\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curves.js\",\"./elliptic/ec\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/ec/index.js\",\"./elliptic/hmac-drbg\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/hmac-drbg.js\",\"./elliptic/utils\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/utils.js\",\"brorand\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/brorand/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/base.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/base.js\"][0].apply(exports,arguments)\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/edwards.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/edwards.js\"][0].apply(exports,arguments)\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js\",\"../curve\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/index.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/index.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/index.js\"][0].apply(exports,arguments)\n},{\"./base\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/base.js\",\"./edwards\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/edwards.js\",\"./mont\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/mont.js\",\"./short\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/short.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/mont.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/mont.js\"][0].apply(exports,arguments)\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js\",\"../curve\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/index.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/short.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/short.js\"][0].apply(exports,arguments)\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js\",\"../curve\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/index.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curves.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curves.js\"][0].apply(exports,arguments)\n},{\"../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js\",\"hash.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/ec/index.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/index.js\"][0].apply(exports,arguments)\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js\",\"./key\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/ec/key.js\",\"./signature\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/ec/signature.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/ec/key.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/key.js\"][0].apply(exports,arguments)\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/ec/signature.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/signature.js\"][0].apply(exports,arguments)\n},{\"../../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/hmac-drbg.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/hmac-drbg.js\"][0].apply(exports,arguments)\n},{\"../elliptic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js\",\"hash.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/utils.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/utils.js\"][0].apply(exports,arguments)\n},{\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/brorand/index.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/index.js\"][0].apply(exports,arguments)\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"][0].apply(exports,arguments)\n},{\"./hash/common\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/common.js\",\"./hash/hmac\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/hmac.js\",\"./hash/ripemd\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/ripemd.js\",\"./hash/sha\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/sha.js\",\"./hash/utils\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/utils.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/common.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/common.js\"][0].apply(exports,arguments)\n},{\"../hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/hmac.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/hmac.js\"][0].apply(exports,arguments)\n},{\"../hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/ripemd.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/ripemd.js\"][0].apply(exports,arguments)\n},{\"../hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/sha.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/sha.js\"][0].apply(exports,arguments)\n},{\"../hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/utils.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/utils.js\"][0].apply(exports,arguments)\n},{\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/package.json\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/package.json\"][0].apply(exports,arguments)\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/browser.js\":[function(require,module,exports){\n(function (Buffer){\n'use strict';\nvar createHash = require('sha.js')\n\nvar md5 = require('./md5')\nvar rmd160 = require('ripemd160')\nvar Transform = require('stream').Transform;\nvar inherits = require('inherits')\n\nmodule.exports = function (alg) {\n if('md5' === alg) return new HashNoConstructor(md5)\n if('rmd160' === alg) return new HashNoConstructor(rmd160)\n return new Hash(createHash(alg))\n}\ninherits(HashNoConstructor, Transform)\n\nfunction HashNoConstructor(hash) {\n Transform.call(this);\n this._hash = hash\n this.buffers = []\n}\n\nHashNoConstructor.prototype._transform = function (data, _, done) {\n this.buffers.push(data)\n done()\n}\nHashNoConstructor.prototype._flush = function (done) {\n var buf = Buffer.concat(this.buffers)\n var r = this._hash(buf)\n this.buffers = null\n this.push(r)\n done()\n}\nHashNoConstructor.prototype.update = function (data, enc) {\n this.write(data, enc)\n return this\n}\n\nHashNoConstructor.prototype.digest = function (enc) {\n this.end()\n var outData = new Buffer('')\n var chunk\n while ((chunk = this.read())) {\n outData = Buffer.concat([outData, chunk])\n }\n if (enc) {\n outData = outData.toString(enc)\n }\n return outData\n}\n\ninherits(Hash, Transform)\n\nfunction Hash(hash) {\n Transform.call(this);\n this._hash = hash\n}\n\nHash.prototype._transform = function (data, _, done) {\n this._hash.update(data)\n done()\n}\nHash.prototype._flush = function (done) {\n this.push(this._hash.digest())\n this._hash = null\n done()\n}\nHash.prototype.update = function (data, enc) {\n this.write(data, enc)\n return this\n}\n\nHash.prototype.digest = function (enc) {\n this.end()\n var outData = new Buffer('')\n var chunk\n while ((chunk = this.read())) {\n outData = Buffer.concat([outData, chunk])\n }\n if (enc) {\n outData = outData.toString(enc)\n }\n return outData\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"./md5\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/md5.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\",\"ripemd160\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/ripemd160/lib/ripemd160.js\",\"sha.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/index.js\",\"stream\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/stream-browserify/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/helpers.js\":[function(require,module,exports){\n(function (Buffer){\n'use strict';\nvar intSize = 4;\nvar zeroBuffer = new Buffer(intSize); zeroBuffer.fill(0);\nvar chrsz = 8;\n\nfunction toArray(buf, bigEndian) {\n if ((buf.length % intSize) !== 0) {\n var len = buf.length + (intSize - (buf.length % intSize));\n buf = Buffer.concat([buf, zeroBuffer], len);\n }\n\n var arr = [];\n var fn = bigEndian ? buf.readInt32BE : buf.readInt32LE;\n for (var i = 0; i < buf.length; i += intSize) {\n arr.push(fn.call(buf, i));\n }\n return arr;\n}\n\nfunction toBuffer(arr, size, bigEndian) {\n var buf = new Buffer(size);\n var fn = bigEndian ? buf.writeInt32BE : buf.writeInt32LE;\n for (var i = 0; i < arr.length; i++) {\n fn.call(buf, arr[i], i * 4, true);\n }\n return buf;\n}\n\nfunction hash(buf, fn, hashSize, bigEndian) {\n if (!Buffer.isBuffer(buf)) buf = new Buffer(buf);\n var arr = fn(toArray(buf, bigEndian), buf.length * chrsz);\n return toBuffer(arr, hashSize, bigEndian);\n}\nexports.hash = hash;\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/md5.js\":[function(require,module,exports){\n'use strict';\n/*\n * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\n * Digest Algorithm, as defined in RFC 1321.\n * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for more info.\n */\n\nvar helpers = require('./helpers');\n\n/*\n * Calculate the MD5 of an array of little-endian words, and a bit length\n */\nfunction core_md5(x, len)\n{\n /* append padding */\n x[len >> 5] |= 0x80 << ((len) % 32);\n x[(((len + 64) >>> 9) << 4) + 14] = len;\n\n var a = 1732584193;\n var b = -271733879;\n var c = -1732584194;\n var d = 271733878;\n\n for(var i = 0; i < x.length; i += 16)\n {\n var olda = a;\n var oldb = b;\n var oldc = c;\n var oldd = d;\n\n a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);\n d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);\n c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819);\n b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);\n a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);\n d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426);\n c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);\n b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);\n a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416);\n d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);\n c = md5_ff(c, d, a, b, x[i+10], 17, -42063);\n b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);\n a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682);\n d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);\n c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);\n b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329);\n\n a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);\n d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);\n c = md5_gg(c, d, a, b, x[i+11], 14, 643717713);\n b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);\n a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);\n d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083);\n c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);\n b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);\n a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438);\n d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);\n c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);\n b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501);\n a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);\n d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);\n c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473);\n b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);\n\n a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);\n d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);\n c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562);\n b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);\n a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);\n d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353);\n c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);\n b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);\n a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174);\n d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);\n c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);\n b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189);\n a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);\n d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);\n c = md5_hh(c, d, a, b, x[i+15], 16, 530742520);\n b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);\n\n a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);\n d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415);\n c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);\n b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);\n a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571);\n d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);\n c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);\n b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);\n a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359);\n d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);\n c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);\n b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649);\n a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);\n d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);\n c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259);\n b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);\n\n a = safe_add(a, olda);\n b = safe_add(b, oldb);\n c = safe_add(c, oldc);\n d = safe_add(d, oldd);\n }\n return Array(a, b, c, d);\n\n}\n\n/*\n * These functions implement the four basic operations the algorithm uses.\n */\nfunction md5_cmn(q, a, b, x, s, t)\n{\n return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);\n}\nfunction md5_ff(a, b, c, d, x, s, t)\n{\n return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);\n}\nfunction md5_gg(a, b, c, d, x, s, t)\n{\n return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);\n}\nfunction md5_hh(a, b, c, d, x, s, t)\n{\n return md5_cmn(b ^ c ^ d, a, b, x, s, t);\n}\nfunction md5_ii(a, b, c, d, x, s, t)\n{\n return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);\n}\n\n/*\n * Add integers, wrapping at 2^32. This uses 16-bit operations internally\n * to work around bugs in some JS interpreters.\n */\nfunction safe_add(x, y)\n{\n var lsw = (x & 0xFFFF) + (y & 0xFFFF);\n var msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n return (msw << 16) | (lsw & 0xFFFF);\n}\n\n/*\n * Bitwise rotate a 32-bit number to the left.\n */\nfunction bit_rol(num, cnt)\n{\n return (num << cnt) | (num >>> (32 - cnt));\n}\n\nmodule.exports = function md5(buf) {\n return helpers.hash(buf, core_md5, 16);\n};\n},{\"./helpers\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/helpers.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/ripemd160/lib/ripemd160.js\":[function(require,module,exports){\n(function (Buffer){\n/*\nCryptoJS v3.1.2\ncode.google.com/p/crypto-js\n(c) 2009-2013 by Jeff Mott. All rights reserved.\ncode.google.com/p/crypto-js/wiki/License\n*/\n/** @preserve\n(c) 2012 by Cédric Mesnil. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n - 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.\n\nTHIS 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.\n*/\n\n// constants table\nvar zl = [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,\n 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,\n 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,\n 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]\n\nvar zr = [\n 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,\n 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,\n 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,\n 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,\n 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]\n\nvar sl = [\n 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,\n 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,\n 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,\n 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,\n 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]\n\nvar sr = [\n 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,\n 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,\n 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,\n 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,\n 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]\n\n\nvar hl = [0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]\nvar hr = [0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]\n\nfunction bytesToWords(bytes) {\n var words = []\n for (var i = 0, b = 0; i < bytes.length; i++, b += 8) {\n words[b >>> 5] |= bytes[i] << (24 - b % 32)\n }\n return words\n}\n\nfunction wordsToBytes(words) {\n var bytes = []\n for (var b = 0; b < words.length * 32; b += 8) {\n bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF)\n }\n return bytes\n}\n\nfunction processBlock(H, M, offset) {\n // swap endian\n for (var i = 0; i < 16; i++) {\n var offset_i = offset + i;\n var M_offset_i = M[offset_i]\n\n // Swap\n M[offset_i] = (\n (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |\n (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)\n )\n }\n\n // Working variables\n var al, bl, cl, dl, el\n var ar, br, cr, dr, er\n\n ar = al = H[0]\n br = bl = H[1]\n cr = cl = H[2]\n dr = dl = H[3]\n er = el = H[4]\n\n // computation\n var t\n for (var i = 0; i < 80; i += 1) {\n t = (al + M[offset+zl[i]])|0\n if (i<16){\n t += f1(bl,cl,dl) + hl[0]\n } else if (i<32) {\n t += f2(bl,cl,dl) + hl[1]\n } else if (i<48) {\n t += f3(bl,cl,dl) + hl[2]\n } else if (i<64) {\n t += f4(bl,cl,dl) + hl[3]\n } else {// if (i<80) {\n t += f5(bl,cl,dl) + hl[4]\n }\n t = t|0\n t = rotl(t,sl[i])\n t = (t+el)|0\n al = el\n el = dl\n dl = rotl(cl, 10)\n cl = bl\n bl = t\n\n t = (ar + M[offset+zr[i]])|0\n if (i<16) {\n t += f5(br,cr,dr) + hr[0]\n } else if (i<32) {\n t += f4(br,cr,dr) + hr[1]\n } else if (i<48) {\n t += f3(br,cr,dr) + hr[2]\n } else if (i<64) {\n t += f2(br,cr,dr) + hr[3]\n } else {// if (i<80) {\n t += f1(br,cr,dr) + hr[4]\n }\n\n t = t|0\n t = rotl(t,sr[i]) \n t = (t+er)|0\n ar = er\n er = dr\n dr = rotl(cr, 10)\n cr = br\n br = t\n }\n\n // intermediate hash value\n t = (H[1] + cl + dr)|0\n H[1] = (H[2] + dl + er)|0\n H[2] = (H[3] + el + ar)|0\n H[3] = (H[4] + al + br)|0\n H[4] = (H[0] + bl + cr)|0\n H[0] = t\n}\n\nfunction f1(x, y, z) {\n return ((x) ^ (y) ^ (z))\n}\n\nfunction f2(x, y, z) {\n return (((x)&(y)) | ((~x)&(z)))\n}\n\nfunction f3(x, y, z) {\n return (((x) | (~(y))) ^ (z))\n}\n\nfunction f4(x, y, z) {\n return (((x) & (z)) | ((y)&(~(z))))\n}\n\nfunction f5(x, y, z) {\n return ((x) ^ ((y) |(~(z))))\n}\n\nfunction rotl(x,n) {\n return (x<>>(32-n))\n}\n\nfunction ripemd160(message) {\n var H = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]\n\n if (typeof message == 'string')\n message = new Buffer(message, 'utf8')\n\n var m = bytesToWords(message)\n\n var nBitsLeft = message.length * 8\n var nBitsTotal = message.length * 8\n\n // Add padding\n m[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32)\n m[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (\n (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) |\n (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00)\n )\n\n for (var i=0 ; i>> 24)) & 0x00ff00ff) |\n (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00)\n }\n\n var digestbytes = wordsToBytes(H)\n return new Buffer(digestbytes)\n}\n\nmodule.exports = ripemd160\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/hash.js\":[function(require,module,exports){\n(function (Buffer){\n//prototype class for hash functions\nfunction Hash (blockSize, finalSize) {\n this._block = new Buffer(blockSize) //new Uint32Array(blockSize/4)\n this._finalSize = finalSize\n this._blockSize = blockSize\n this._len = 0\n this._s = 0\n}\n\nHash.prototype.update = function (data, enc) {\n if (\"string\" === typeof data) {\n enc = enc || \"utf8\"\n data = new Buffer(data, enc)\n }\n\n var l = this._len += data.length\n var s = this._s || 0\n var f = 0\n var buffer = this._block\n\n while (s < l) {\n var t = Math.min(data.length, f + this._blockSize - (s % this._blockSize))\n var ch = (t - f)\n\n for (var i = 0; i < ch; i++) {\n buffer[(s % this._blockSize) + i] = data[i + f]\n }\n\n s += ch\n f += ch\n\n if ((s % this._blockSize) === 0) {\n this._update(buffer)\n }\n }\n this._s = s\n\n return this\n}\n\nHash.prototype.digest = function (enc) {\n // Suppose the length of the message M, in bits, is l\n var l = this._len * 8\n\n // Append the bit 1 to the end of the message\n this._block[this._len % this._blockSize] = 0x80\n\n // and then k zero bits, where k is the smallest non-negative solution to the equation (l + 1 + k) === finalSize mod blockSize\n this._block.fill(0, this._len % this._blockSize + 1)\n\n if (l % (this._blockSize * 8) >= this._finalSize * 8) {\n this._update(this._block)\n this._block.fill(0)\n }\n\n // to this append the block which is equal to the number l written in binary\n // TODO: handle case where l is > Math.pow(2, 29)\n this._block.writeInt32BE(l, this._blockSize - 4)\n\n var hash = this._update(this._block) || this._hash()\n\n return enc ? hash.toString(enc) : hash\n}\n\nHash.prototype._update = function () {\n throw new Error('_update must be implemented by subclass')\n}\n\nmodule.exports = Hash\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/index.js\":[function(require,module,exports){\nvar exports = module.exports = function (alg) {\n var Alg = exports[alg.toLowerCase()]\n if(!Alg) throw new Error(alg + ' is not supported (we accept pull requests)')\n return new Alg()\n}\n\n\nexports.sha1 = require('./sha1')\nexports.sha224 = require('./sha224')\nexports.sha256 = require('./sha256')\nexports.sha384 = require('./sha384')\nexports.sha512 = require('./sha512')\n\n},{\"./sha1\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha1.js\",\"./sha224\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha224.js\",\"./sha256\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha256.js\",\"./sha384\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha384.js\",\"./sha512\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha512.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha1.js\":[function(require,module,exports){\n(function (Buffer){\n/*\n * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined\n * in FIPS PUB 180-1\n * Version 2.1a Copyright Paul Johnston 2000 - 2002.\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for details.\n */\n\nvar inherits = require('inherits')\nvar Hash = require('./hash')\n\nvar W = new Array(80)\n\nfunction Sha1() {\n this.init()\n this._w = W\n\n Hash.call(this, 64, 56)\n}\n\ninherits(Sha1, Hash)\n\nSha1.prototype.init = function () {\n this._a = 0x67452301\n this._b = 0xefcdab89\n this._c = 0x98badcfe\n this._d = 0x10325476\n this._e = 0xc3d2e1f0\n\n return this\n}\n\n/*\n * Bitwise rotate a 32-bit number to the left.\n */\nfunction rol(num, cnt) {\n return (num << cnt) | (num >>> (32 - cnt));\n}\n\nSha1.prototype._update = function (M) {\n var W = this._w\n\n var a = this._a\n var b = this._b\n var c = this._c\n var d = this._d\n var e = this._e\n\n var j = 0, k\n\n function calcW() { return rol(W[j - 3] ^ W[j - 8] ^ W[j - 14] ^ W[j - 16], 1) }\n function loop(w, f) {\n W[j] = w\n\n var t = rol(a, 5) + f + e + w + k\n\n e = d\n d = c\n c = rol(b, 30)\n b = a\n a = t\n j++\n }\n\n k = 1518500249\n while (j < 16) loop(M.readInt32BE(j * 4), (b & c) | ((~b) & d))\n while (j < 20) loop(calcW(), (b & c) | ((~b) & d))\n k = 1859775393\n while (j < 40) loop(calcW(), b ^ c ^ d)\n k = -1894007588\n while (j < 60) loop(calcW(), (b & c) | (b & d) | (c & d))\n k = -899497514\n while (j < 80) loop(calcW(), b ^ c ^ d)\n\n this._a = (a + this._a) | 0\n this._b = (b + this._b) | 0\n this._c = (c + this._c) | 0\n this._d = (d + this._d) | 0\n this._e = (e + this._e) | 0\n}\n\nSha1.prototype._hash = function () {\n var H = new Buffer(20)\n\n H.writeInt32BE(this._a|0, 0)\n H.writeInt32BE(this._b|0, 4)\n H.writeInt32BE(this._c|0, 8)\n H.writeInt32BE(this._d|0, 12)\n H.writeInt32BE(this._e|0, 16)\n\n return H\n}\n\nmodule.exports = Sha1\n\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/hash.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha224.js\":[function(require,module,exports){\n(function (Buffer){\n/**\n * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined\n * in FIPS 180-2\n * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n *\n */\n\nvar inherits = require('inherits')\nvar SHA256 = require('./sha256')\nvar Hash = require('./hash')\n\nvar W = new Array(64)\n\nfunction Sha224() {\n this.init()\n\n this._w = W // new Array(64)\n\n Hash.call(this, 64, 56)\n}\n\ninherits(Sha224, SHA256)\n\nSha224.prototype.init = function () {\n this._a = 0xc1059ed8|0\n this._b = 0x367cd507|0\n this._c = 0x3070dd17|0\n this._d = 0xf70e5939|0\n this._e = 0xffc00b31|0\n this._f = 0x68581511|0\n this._g = 0x64f98fa7|0\n this._h = 0xbefa4fa4|0\n\n return this\n}\n\nSha224.prototype._hash = function () {\n var H = new Buffer(28)\n\n H.writeInt32BE(this._a, 0)\n H.writeInt32BE(this._b, 4)\n H.writeInt32BE(this._c, 8)\n H.writeInt32BE(this._d, 12)\n H.writeInt32BE(this._e, 16)\n H.writeInt32BE(this._f, 20)\n H.writeInt32BE(this._g, 24)\n\n return H\n}\n\nmodule.exports = Sha224\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/hash.js\",\"./sha256\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha256.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha256.js\":[function(require,module,exports){\n(function (Buffer){\n/**\n * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined\n * in FIPS 180-2\n * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n *\n */\n\nvar inherits = require('inherits')\nvar Hash = require('./hash')\n\nvar K = [\n 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,\n 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,\n 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,\n 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,\n 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,\n 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,\n 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,\n 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,\n 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,\n 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,\n 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,\n 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,\n 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,\n 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,\n 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,\n 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2\n]\n\nvar W = new Array(64)\n\nfunction Sha256() {\n this.init()\n\n this._w = W // new Array(64)\n\n Hash.call(this, 64, 56)\n}\n\ninherits(Sha256, Hash)\n\nSha256.prototype.init = function () {\n this._a = 0x6a09e667|0\n this._b = 0xbb67ae85|0\n this._c = 0x3c6ef372|0\n this._d = 0xa54ff53a|0\n this._e = 0x510e527f|0\n this._f = 0x9b05688c|0\n this._g = 0x1f83d9ab|0\n this._h = 0x5be0cd19|0\n\n return this\n}\n\nfunction S (X, n) {\n return (X >>> n) | (X << (32 - n));\n}\n\nfunction R (X, n) {\n return (X >>> n);\n}\n\nfunction Ch (x, y, z) {\n return ((x & y) ^ ((~x) & z));\n}\n\nfunction Maj (x, y, z) {\n return ((x & y) ^ (x & z) ^ (y & z));\n}\n\nfunction Sigma0256 (x) {\n return (S(x, 2) ^ S(x, 13) ^ S(x, 22));\n}\n\nfunction Sigma1256 (x) {\n return (S(x, 6) ^ S(x, 11) ^ S(x, 25));\n}\n\nfunction Gamma0256 (x) {\n return (S(x, 7) ^ S(x, 18) ^ R(x, 3));\n}\n\nfunction Gamma1256 (x) {\n return (S(x, 17) ^ S(x, 19) ^ R(x, 10));\n}\n\nSha256.prototype._update = function(M) {\n var W = this._w\n\n var a = this._a | 0\n var b = this._b | 0\n var c = this._c | 0\n var d = this._d | 0\n var e = this._e | 0\n var f = this._f | 0\n var g = this._g | 0\n var h = this._h | 0\n\n var j = 0\n\n function calcW() { return Gamma1256(W[j - 2]) + W[j - 7] + Gamma0256(W[j - 15]) + W[j - 16] }\n function loop(w) {\n W[j] = w\n\n var T1 = h + Sigma1256(e) + Ch(e, f, g) + K[j] + w\n var T2 = Sigma0256(a) + Maj(a, b, c);\n\n h = g;\n g = f;\n f = e;\n e = d + T1;\n d = c;\n c = b;\n b = a;\n a = T1 + T2;\n\n j++\n }\n\n while (j < 16) loop(M.readInt32BE(j * 4))\n while (j < 64) loop(calcW())\n\n this._a = (a + this._a) | 0\n this._b = (b + this._b) | 0\n this._c = (c + this._c) | 0\n this._d = (d + this._d) | 0\n this._e = (e + this._e) | 0\n this._f = (f + this._f) | 0\n this._g = (g + this._g) | 0\n this._h = (h + this._h) | 0\n};\n\nSha256.prototype._hash = function () {\n var H = new Buffer(32)\n\n H.writeInt32BE(this._a, 0)\n H.writeInt32BE(this._b, 4)\n H.writeInt32BE(this._c, 8)\n H.writeInt32BE(this._d, 12)\n H.writeInt32BE(this._e, 16)\n H.writeInt32BE(this._f, 20)\n H.writeInt32BE(this._g, 24)\n H.writeInt32BE(this._h, 28)\n\n return H\n}\n\nmodule.exports = Sha256\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/hash.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha384.js\":[function(require,module,exports){\n(function (Buffer){\nvar inherits = require('inherits')\nvar SHA512 = require('./sha512');\nvar Hash = require('./hash')\n\nvar W = new Array(160)\n\nfunction Sha384() {\n this.init()\n this._w = W\n\n Hash.call(this, 128, 112)\n}\n\ninherits(Sha384, SHA512)\n\nSha384.prototype.init = function () {\n this._a = 0xcbbb9d5d|0\n this._b = 0x629a292a|0\n this._c = 0x9159015a|0\n this._d = 0x152fecd8|0\n this._e = 0x67332667|0\n this._f = 0x8eb44a87|0\n this._g = 0xdb0c2e0d|0\n this._h = 0x47b5481d|0\n\n this._al = 0xc1059ed8|0\n this._bl = 0x367cd507|0\n this._cl = 0x3070dd17|0\n this._dl = 0xf70e5939|0\n this._el = 0xffc00b31|0\n this._fl = 0x68581511|0\n this._gl = 0x64f98fa7|0\n this._hl = 0xbefa4fa4|0\n\n return this\n}\n\nSha384.prototype._hash = function () {\n var H = new Buffer(48)\n\n function writeInt64BE(h, l, offset) {\n H.writeInt32BE(h, offset)\n H.writeInt32BE(l, offset + 4)\n }\n\n writeInt64BE(this._a, this._al, 0)\n writeInt64BE(this._b, this._bl, 8)\n writeInt64BE(this._c, this._cl, 16)\n writeInt64BE(this._d, this._dl, 24)\n writeInt64BE(this._e, this._el, 32)\n writeInt64BE(this._f, this._fl, 40)\n\n return H\n}\n\nmodule.exports = Sha384\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/hash.js\",\"./sha512\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha512.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha512.js\":[function(require,module,exports){\n(function (Buffer){\nvar inherits = require('inherits')\nvar Hash = require('./hash')\n\nvar K = [\n 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,\n 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,\n 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,\n 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,\n 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,\n 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,\n 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,\n 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,\n 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,\n 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,\n 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,\n 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,\n 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,\n 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,\n 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,\n 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,\n 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,\n 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,\n 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,\n 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,\n 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,\n 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,\n 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,\n 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,\n 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,\n 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,\n 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,\n 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,\n 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,\n 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,\n 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,\n 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,\n 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,\n 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,\n 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,\n 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,\n 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,\n 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,\n 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,\n 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817\n]\n\nvar W = new Array(160)\n\nfunction Sha512() {\n this.init()\n this._w = W\n\n Hash.call(this, 128, 112)\n}\n\ninherits(Sha512, Hash)\n\nSha512.prototype.init = function () {\n this._a = 0x6a09e667|0\n this._b = 0xbb67ae85|0\n this._c = 0x3c6ef372|0\n this._d = 0xa54ff53a|0\n this._e = 0x510e527f|0\n this._f = 0x9b05688c|0\n this._g = 0x1f83d9ab|0\n this._h = 0x5be0cd19|0\n\n this._al = 0xf3bcc908|0\n this._bl = 0x84caa73b|0\n this._cl = 0xfe94f82b|0\n this._dl = 0x5f1d36f1|0\n this._el = 0xade682d1|0\n this._fl = 0x2b3e6c1f|0\n this._gl = 0xfb41bd6b|0\n this._hl = 0x137e2179|0\n\n return this\n}\n\nfunction S (X, Xl, n) {\n return (X >>> n) | (Xl << (32 - n))\n}\n\nfunction Ch (x, y, z) {\n return ((x & y) ^ ((~x) & z));\n}\n\nfunction Maj (x, y, z) {\n return ((x & y) ^ (x & z) ^ (y & z));\n}\n\nSha512.prototype._update = function(M) {\n var W = this._w\n\n var a = this._a | 0\n var b = this._b | 0\n var c = this._c | 0\n var d = this._d | 0\n var e = this._e | 0\n var f = this._f | 0\n var g = this._g | 0\n var h = this._h | 0\n\n var al = this._al | 0\n var bl = this._bl | 0\n var cl = this._cl | 0\n var dl = this._dl | 0\n var el = this._el | 0\n var fl = this._fl | 0\n var gl = this._gl | 0\n var hl = this._hl | 0\n\n var i = 0, j = 0\n var Wi, Wil\n function calcW() {\n var x = W[j - 15*2]\n var xl = W[j - 15*2 + 1]\n var gamma0 = S(x, xl, 1) ^ S(x, xl, 8) ^ (x >>> 7)\n var gamma0l = S(xl, x, 1) ^ S(xl, x, 8) ^ S(xl, x, 7)\n\n x = W[j - 2*2]\n xl = W[j - 2*2 + 1]\n var gamma1 = S(x, xl, 19) ^ S(xl, x, 29) ^ (x >>> 6)\n var gamma1l = S(xl, x, 19) ^ S(x, xl, 29) ^ S(xl, x, 6)\n\n // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]\n var Wi7 = W[j - 7*2]\n var Wi7l = W[j - 7*2 + 1]\n\n var Wi16 = W[j - 16*2]\n var Wi16l = W[j - 16*2 + 1]\n\n Wil = gamma0l + Wi7l\n Wi = gamma0 + Wi7 + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0)\n Wil = Wil + gamma1l\n Wi = Wi + gamma1 + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0)\n Wil = Wil + Wi16l\n Wi = Wi + Wi16 + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0)\n }\n\n function loop() {\n W[j] = Wi\n W[j + 1] = Wil\n\n var maj = Maj(a, b, c)\n var majl = Maj(al, bl, cl)\n\n var sigma0h = S(a, al, 28) ^ S(al, a, 2) ^ S(al, a, 7)\n var sigma0l = S(al, a, 28) ^ S(a, al, 2) ^ S(a, al, 7)\n var sigma1h = S(e, el, 14) ^ S(e, el, 18) ^ S(el, e, 9)\n var sigma1l = S(el, e, 14) ^ S(el, e, 18) ^ S(e, el, 9)\n\n // t1 = h + sigma1 + ch + K[i] + W[i]\n var Ki = K[j]\n var Kil = K[j + 1]\n\n var ch = Ch(e, f, g)\n var chl = Ch(el, fl, gl)\n\n var t1l = hl + sigma1l\n var t1 = h + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0)\n t1l = t1l + chl\n t1 = t1 + ch + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0)\n t1l = t1l + Kil\n t1 = t1 + Ki + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0)\n t1l = t1l + Wil\n t1 = t1 + Wi + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0)\n\n // t2 = sigma0 + maj\n var t2l = sigma0l + majl\n var t2 = sigma0h + maj + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0)\n\n h = g\n hl = gl\n g = f\n gl = fl\n f = e\n fl = el\n el = (dl + t1l) | 0\n e = (d + t1 + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0\n d = c\n dl = cl\n c = b\n cl = bl\n b = a\n bl = al\n al = (t1l + t2l) | 0\n a = (t1 + t2 + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0\n\n i++\n j += 2\n }\n\n while (i < 16) {\n Wi = M.readInt32BE(j * 4)\n Wil = M.readInt32BE(j * 4 + 4)\n\n loop()\n }\n\n while (i < 80) {\n calcW()\n loop()\n }\n\n this._al = (this._al + al) | 0\n this._bl = (this._bl + bl) | 0\n this._cl = (this._cl + cl) | 0\n this._dl = (this._dl + dl) | 0\n this._el = (this._el + el) | 0\n this._fl = (this._fl + fl) | 0\n this._gl = (this._gl + gl) | 0\n this._hl = (this._hl + hl) | 0\n\n this._a = (this._a + a + ((this._al >>> 0) < (al >>> 0) ? 1 : 0)) | 0\n this._b = (this._b + b + ((this._bl >>> 0) < (bl >>> 0) ? 1 : 0)) | 0\n this._c = (this._c + c + ((this._cl >>> 0) < (cl >>> 0) ? 1 : 0)) | 0\n this._d = (this._d + d + ((this._dl >>> 0) < (dl >>> 0) ? 1 : 0)) | 0\n this._e = (this._e + e + ((this._el >>> 0) < (el >>> 0) ? 1 : 0)) | 0\n this._f = (this._f + f + ((this._fl >>> 0) < (fl >>> 0) ? 1 : 0)) | 0\n this._g = (this._g + g + ((this._gl >>> 0) < (gl >>> 0) ? 1 : 0)) | 0\n this._h = (this._h + h + ((this._hl >>> 0) < (hl >>> 0) ? 1 : 0)) | 0\n}\n\nSha512.prototype._hash = function () {\n var H = new Buffer(64)\n\n function writeInt64BE(h, l, offset) {\n H.writeInt32BE(h, offset)\n H.writeInt32BE(l, offset + 4)\n }\n\n writeInt64BE(this._a, this._al, 0)\n writeInt64BE(this._b, this._bl, 8)\n writeInt64BE(this._c, this._cl, 16)\n writeInt64BE(this._d, this._dl, 24)\n writeInt64BE(this._e, this._el, 32)\n writeInt64BE(this._f, this._fl, 40)\n writeInt64BE(this._g, this._gl, 48)\n writeInt64BE(this._h, this._hl, 56)\n\n return H\n}\n\nmodule.exports = Sha512\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/hash.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hmac/browser.js\":[function(require,module,exports){\n(function (Buffer){\n'use strict';\nvar createHash = require('create-hash/browser');\nvar inherits = require('inherits')\n\nvar Transform = require('stream').Transform\n\nvar ZEROS = new Buffer(128)\nZEROS.fill(0)\n\nfunction Hmac(alg, key) {\n Transform.call(this)\n\n if (typeof key === 'string') {\n key = new Buffer(key)\n }\n\n var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64\n\n this._alg = alg\n this._key = key\n\n if (key.length > blocksize) {\n key = createHash(alg).update(key).digest()\n\n } else if (key.length < blocksize) {\n key = Buffer.concat([key, ZEROS], blocksize)\n }\n\n var ipad = this._ipad = new Buffer(blocksize)\n var opad = this._opad = new Buffer(blocksize)\n\n for (var i = 0; i < blocksize; i++) {\n ipad[i] = key[i] ^ 0x36\n opad[i] = key[i] ^ 0x5C\n }\n\n this._hash = createHash(alg).update(ipad)\n}\n\ninherits(Hmac, Transform)\n\nHmac.prototype.update = function (data, enc) {\n this._hash.update(data, enc)\n\n return this\n}\n\nHmac.prototype._transform = function (data, _, next) {\n this._hash.update(data)\n\n next()\n}\n\nHmac.prototype._flush = function (next) {\n this.push(this.digest())\n\n next()\n}\n\nHmac.prototype.digest = function (enc) {\n var h = this._hash.digest()\n\n return createHash(this._alg).update(this._opad).update(h).digest(enc)\n}\n\nmodule.exports = function createHmac(alg, key) {\n return new Hmac(alg, key)\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"create-hash/browser\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/browser.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\",\"stream\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/stream-browserify/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/browser.js\":[function(require,module,exports){\n(function (Buffer){\nvar generatePrime = require('./lib/generatePrime');\nvar primes = require('./lib/primes');\n\nvar DH = require('./lib/dh');\n\nfunction getDiffieHellman(mod) {\n var prime = new Buffer(primes[mod].prime, 'hex');\n var gen = new Buffer(primes[mod].gen, 'hex');\n\n return new DH(prime, gen);\n}\n\nfunction createDiffieHellman(prime, enc, generator, genc) {\n if (Buffer.isBuffer(enc) || (typeof enc === 'string' && ['hex', 'binary', 'base64'].indexOf(enc) === -1)) {\n genc = generator;\n generator = enc;\n enc = undefined;\n }\n\n enc = enc || 'binary';\n genc = genc || 'binary';\n generator = generator || new Buffer([2]);\n\n if (!Buffer.isBuffer(generator)) {\n generator = new Buffer(generator, genc);\n }\n\n if (typeof prime === 'number') {\n return new DH(generatePrime(prime, generator), generator, true);\n }\n\n if (!Buffer.isBuffer(prime)) {\n prime = new Buffer(prime, enc);\n }\n\n return new DH(prime, generator, true);\n}\n\nexports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman;\nexports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman;\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./lib/dh\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/dh.js\",\"./lib/generatePrime\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/generatePrime.js\",\"./lib/primes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/primes.json\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/dh.js\":[function(require,module,exports){\n(function (Buffer){\nvar BN = require('bn.js');\nvar MillerRabin = require('miller-rabin');\nvar millerRabin = new MillerRabin();\nvar TWENTYFOUR = new BN(24);\nvar ELEVEN = new BN(11);\nvar TEN = new BN(10);\nvar THREE = new BN(3);\nvar SEVEN = new BN(7);\nvar primes = require('./generatePrime');\nvar randomBytes = require('randombytes');\nmodule.exports = DH;\n\nfunction setPublicKey(pub, enc) {\n enc = enc || 'utf8';\n if (!Buffer.isBuffer(pub)) {\n pub = new Buffer(pub, enc);\n }\n this._pub = new BN(pub);\n return this;\n}\n\nfunction setPrivateKey(priv, enc) {\n enc = enc || 'utf8';\n if (!Buffer.isBuffer(priv)) {\n priv = new Buffer(priv, enc);\n }\n this._priv = new BN(priv);\n return this;\n}\n\nvar primeCache = {};\nfunction checkPrime(prime, generator) {\n var gen = generator.toString('hex');\n var hex = [gen, prime.toString(16)].join('_');\n if (hex in primeCache) {\n return primeCache[hex];\n }\n var error = 0;\n \n if (prime.isEven() ||\n !primes.simpleSieve ||\n !primes.fermatTest(prime) ||\n !millerRabin.test(prime)) {\n //not a prime so +1\n error += 1;\n \n if (gen === '02' || gen === '05') {\n // we'd be able to check the generator\n // it would fail so +8\n error += 8;\n } else {\n //we wouldn't be able to test the generator\n // so +4\n error += 4;\n }\n primeCache[hex] = error;\n return error;\n }\n if (!millerRabin.test(prime.shrn(1))) {\n //not a safe prime\n error += 2;\n }\n var rem;\n switch (gen) {\n case '02':\n if (prime.mod(TWENTYFOUR).cmp(ELEVEN)) {\n // unsuidable generator\n error += 8;\n }\n break;\n case '05':\n rem = prime.mod(TEN);\n if (rem.cmp(THREE) && rem.cmp(SEVEN)) {\n // prime mod 10 needs to equal 3 or 7\n error += 8;\n } \n break;\n default: \n error += 4;\n }\n primeCache[hex] = error;\n return error;\n}\n\nfunction defineError (self, error) {\n try {\n Object.defineProperty(self, 'verifyError', {\n enumerable: true,\n value: error,\n writable: false\n });\n } catch(e) {\n self.verifyError = error;\n }\n}\nfunction DH(prime, generator, malleable) {\n this.setGenerator(generator);\n this.__prime = new BN(prime);\n this._prime = BN.mont(this.__prime);\n this._primeLen = prime.length;\n this._pub = void 0;\n this._priv = void 0;\n \n if (malleable) {\n this.setPublicKey = setPublicKey;\n this.setPrivateKey = setPrivateKey;\n defineError(this, checkPrime(this.__prime, generator));\n } else {\n defineError(this, 8);\n }\n}\n\nDH.prototype.generateKeys = function () {\n if (!this._priv) {\n this._priv = new BN(randomBytes(this._primeLen));\n }\n this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed();\n return this.getPublicKey();\n};\n\nDH.prototype.computeSecret = function (other) {\n other = new BN(other);\n other = other.toRed(this._prime);\n var secret = other.redPow(this._priv).fromRed();\n var out = new Buffer(secret.toArray());\n var prime = this.getPrime();\n if (out.length < prime.length) {\n var front = new Buffer(prime.length - out.length);\n front.fill(0);\n out = Buffer.concat([front, out]);\n }\n return out;\n};\n\nDH.prototype.getPublicKey = function getPublicKey(enc) {\n return formatReturnValue(this._pub, enc);\n};\n\nDH.prototype.getPrivateKey = function getPrivateKey(enc) {\n return formatReturnValue(this._priv, enc);\n};\n\nDH.prototype.getPrime = function (enc) {\n return formatReturnValue(this.__prime, enc);\n};\n\nDH.prototype.getGenerator = function (enc) {\n return formatReturnValue(this._gen, enc);\n};\n\nDH.prototype.setGenerator = function (gen, enc) {\n enc = enc || 'utf8';\n if (!Buffer.isBuffer(gen)) {\n gen = new Buffer(gen, enc);\n }\n this._gen = new BN(gen);\n return this;\n};\n\nfunction formatReturnValue(bn, enc) {\n var buf = new Buffer(bn.toArray());\n if (!enc) {\n return buf;\n } else {\n return buf.toString(enc);\n }\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"./generatePrime\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/generatePrime.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"miller-rabin\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/lib/mr.js\",\"randombytes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/randombytes/browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/generatePrime.js\":[function(require,module,exports){\nvar randomBytes = require('randombytes');\nmodule.exports = findPrime;\nfindPrime.simpleSieve = simpleSieve;\nfindPrime.fermatTest = fermatTest;\nvar BN = require('bn.js');\nvar TWENTYFOUR = new BN(24);\nvar MillerRabin = require('miller-rabin');\nvar millerRabin = new MillerRabin();\nvar ONE = new BN(1);\nvar TWO = new BN(2);\nvar FIVE = new BN(5);\nvar SIXTEEN = new BN(16);\nvar EIGHT = new BN(8);\nvar TEN = new BN(10);\nvar THREE = new BN(3);\nvar SEVEN = new BN(7);\nvar ELEVEN = new BN(11);\nvar FOUR = new BN(4);\nvar TWELVE = new BN(12);\nvar primes = null;\n\nfunction _getPrimes() {\n if (primes !== null)\n return primes;\n\n var limit = 0x100000;\n var res = [];\n res[0] = 2;\n for (var i = 1, k = 3; k < limit; k += 2) {\n var sqrt = Math.ceil(Math.sqrt(k));\n for (var j = 0; j < i && res[j] <= sqrt; j++)\n if (k % res[j] === 0)\n break;\n\n if (i !== j && res[j] <= sqrt)\n continue;\n\n res[i++] = k;\n }\n primes = res;\n return res;\n}\n\nfunction simpleSieve(p) {\n var primes = _getPrimes();\n\n for (var i = 0; i < primes.length; i++)\n if (p.modn(primes[i]) === 0) {\n if (p.cmpn(primes[i]) === 0) {\n return true;\n } else {\n return false;\n }\n }\n\n return true;\n}\n\nfunction fermatTest(p) {\n var red = BN.mont(p);\n return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0;\n}\n\nfunction findPrime(bits, gen) {\n if (bits < 16) {\n // this is what openssl does\n if (gen === 2 || gen === 5) {\n return new BN([0x8c, 0x7b]);\n } else {\n return new BN([0x8c, 0x27]);\n }\n }\n gen = new BN(gen);\n var runs, comp;\n function generateRandom(bits) {\n runs = -1;\n var out = new BN(randomBytes(Math.ceil(bits / 8)));\n while (out.bitLength() > bits) {\n out.ishrn(1);\n }\n if (out.isEven()) {\n out.iadd(ONE);\n }\n if (!out.testn(1)) {\n out.iadd(TWO);\n }\n if (!gen.cmp(TWO)) {\n while (out.mod(TWENTYFOUR).cmp(ELEVEN)) {\n out.iadd(FOUR);\n }\n comp = {\n major: [TWENTYFOUR],\n minor: [TWELVE]\n };\n } else if (!gen.cmp(FIVE)) {\n rem = out.mod(TEN);\n while (rem.cmp(THREE)) {\n out.iadd(FOUR);\n rem = out.mod(TEN);\n }\n comp = {\n major: [FOUR, SIXTEEN],\n minor: [TWO, EIGHT]\n };\n } else {\n comp = {\n major: [FOUR],\n minor: [TWO]\n };\n }\n return out;\n }\n var num = generateRandom(bits);\n\n var n2 = num.shrn(1);\n\n while (true) {\n while (num.bitLength() > bits) {\n num = generateRandom(bits);\n n2 = num.shrn(1);\n }\n runs++;\n if (simpleSieve(n2) && simpleSieve(num) &&\n fermatTest(n2) && fermatTest(num) &&\n millerRabin.test(n2) && millerRabin.test(num)) {\n return num;\n }\n num.iadd(comp.major[runs%comp.major.length]);\n n2.iadd(comp.minor[runs%comp.minor.length]);\n }\n\n}\n},{\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js\",\"miller-rabin\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/lib/mr.js\",\"randombytes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/randombytes/browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/primes.json\":[function(require,module,exports){\nmodule.exports={\n \"modp1\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff\"\n },\n \"modp2\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff\"\n },\n \"modp5\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff\"\n },\n \"modp14\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff\"\n },\n \"modp15\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff\"\n },\n \"modp16\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff\"\n },\n \"modp17\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff\"\n },\n \"modp18\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff\"\n }\n}\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\"][0].apply(exports,arguments)\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/lib/mr.js\":[function(require,module,exports){\nvar bn = require('bn.js');\nvar brorand = require('brorand');\n\nfunction MillerRabin(rand) {\n this.rand = rand || new brorand.Rand();\n}\nmodule.exports = MillerRabin;\n\nMillerRabin.create = function create(rand) {\n return new MillerRabin(rand);\n};\n\nMillerRabin.prototype._rand = function _rand(n) {\n var len = n.bitLength();\n var buf = this.rand.generate(Math.ceil(len / 8));\n\n // Set low bits\n buf[0] |= 3;\n\n // Mask high bits\n var mask = len & 0x7;\n if (mask !== 0)\n buf[buf.length - 1] >>= 7 - mask;\n\n return new bn(buf);\n}\n\nMillerRabin.prototype.test = function test(n, k, cb) {\n var len = n.bitLength();\n var red = bn.mont(n);\n var rone = new bn(1).toRed(red);\n\n if (!k)\n k = Math.max(1, (len / 48) | 0);\n\n // Find d and s, (n - 1) = (2 ^ s) * d;\n var n1 = n.subn(1);\n var n2 = n1.subn(1);\n for (var s = 0; !n1.testn(s); s++) {}\n var d = n.shrn(s);\n\n var rn1 = n1.toRed(red);\n\n var prime = true;\n for (; k > 0; k--) {\n var a = this._rand(n2);\n if (cb)\n cb(a);\n\n var x = a.toRed(red).redPow(d);\n if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)\n continue;\n\n for (var i = 1; i < s; i++) {\n x = x.redSqr();\n\n if (x.cmp(rone) === 0)\n return false;\n if (x.cmp(rn1) === 0)\n break;\n }\n\n if (i === s)\n return false;\n }\n\n return prime;\n};\n\nMillerRabin.prototype.getDivisor = function getDivisor(n, k) {\n var len = n.bitLength();\n var red = bn.mont(n);\n var rone = new bn(1).toRed(red);\n\n if (!k)\n k = Math.max(1, (len / 48) | 0);\n\n // Find d and s, (n - 1) = (2 ^ s) * d;\n var n1 = n.subn(1);\n var n2 = n1.subn(1);\n for (var s = 0; !n1.testn(s); s++) {}\n var d = n.shrn(s);\n\n var rn1 = n1.toRed(red);\n\n var prime = true;\n for (; k > 0; k--) {\n var a = this._rand(n2);\n\n var g = n.gcd(a);\n if (g.cmpn(1) !== 0)\n return g;\n\n var x = a.toRed(red).redPow(d);\n if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)\n continue;\n\n for (var i = 1; i < s; i++) {\n x = x.redSqr();\n\n if (x.cmp(rone) === 0)\n return x.fromRed().subn(1).gcd(n);\n if (x.cmp(rn1) === 0)\n break;\n }\n\n if (i === s) {\n x = x.redSqr();\n return x.fromRed().subn(1).gcd(n);\n }\n }\n\n return prime;\n};\n\n},{\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js\",\"brorand\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/node_modules/brorand/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/node_modules/brorand/index.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/index.js\"][0].apply(exports,arguments)\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/pbkdf2-compat/browser.js\":[function(require,module,exports){\n(function (Buffer){\nvar createHmac = require('create-hmac')\n\nexports.pbkdf2 = pbkdf2\nfunction pbkdf2 (password, salt, iterations, keylen, digest, callback) {\n if (typeof digest === 'function') {\n callback = digest\n digest = undefined\n }\n\n if (typeof callback !== 'function') {\n throw new Error('No callback provided to pbkdf2')\n }\n\n var result = pbkdf2Sync(password, salt, iterations, keylen, digest)\n setTimeout(function () {\n callback(undefined, result)\n })\n}\n\nexports.pbkdf2Sync = pbkdf2Sync\nfunction pbkdf2Sync (password, salt, iterations, keylen, digest) {\n if (typeof iterations !== 'number')\n throw new TypeError('Iterations not a number')\n\n if (iterations < 0)\n throw new TypeError('Bad iterations')\n\n if (typeof keylen !== 'number')\n throw new TypeError('Key length not a number')\n\n if (keylen < 0)\n throw new TypeError('Bad key length')\n\n digest = digest || 'sha1'\n\n if (!Buffer.isBuffer(password)) password = new Buffer(password)\n if (!Buffer.isBuffer(salt)) salt = new Buffer(salt)\n\n var hLen\n var l = 1\n var DK = new Buffer(keylen)\n var block1 = new Buffer(salt.length + 4)\n salt.copy(block1, 0, 0, salt.length)\n\n var r\n var T\n\n for (var i = 1; i <= l; i++) {\n block1.writeUInt32BE(i, salt.length)\n var U = createHmac(digest, password).update(block1).digest()\n\n if (!hLen) {\n hLen = U.length\n T = new Buffer(hLen)\n l = Math.ceil(keylen / hLen)\n r = keylen - (l - 1) * hLen\n\n if (keylen > (Math.pow(2, 32) - 1) * hLen)\n throw new TypeError('keylen exceeds maximum length')\n }\n\n U.copy(T, 0, 0, hLen)\n\n for (var j = 1; j < iterations; j++) {\n U = createHmac(digest, password).update(U).digest()\n\n for (var k = 0; k < hLen; k++) {\n T[k] ^= U[k]\n }\n }\n\n var destPos = (i - 1) * hLen\n var len = (i === l ? r : hLen)\n T.copy(DK, destPos, 0, len)\n }\n\n return DK\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"create-hmac\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hmac/browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/browser.js\":[function(require,module,exports){\nexports.publicEncrypt = require('./publicEncrypt');\nexports.privateDecrypt = require('./privateDecrypt');\n\nexports.privateEncrypt = function privateEncrypt(key, buf) {\n return exports.publicEncrypt(key, buf, true);\n};\n\nexports.publicDecrypt = function publicDecrypt(key, buf) {\n return exports.privateDecrypt(key, buf, true);\n};\n},{\"./privateDecrypt\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/privateDecrypt.js\",\"./publicEncrypt\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/publicEncrypt.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/mgf.js\":[function(require,module,exports){\n(function (Buffer){\nvar createHash = require('create-hash');\nmodule.exports = function (seed, len) {\n var t = new Buffer('');\n var i = 0, c;\n while (t.length < len) {\n c = i2ops(i++);\n t = Buffer.concat([t, createHash('sha1').update(seed).update(c).digest()]);\n }\n return t.slice(0, len);\n};\n\nfunction i2ops(c) {\n var out = new Buffer(4);\n out.writeUInt32BE(c,0);\n return out;\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"create-hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/lib/bn.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\"][0].apply(exports,arguments)\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/browserify-rsa/index.js\":[function(require,module,exports){\n(function (Buffer){\nvar bn = require('bn.js');\nvar randomBytes = require('randombytes');\nmodule.exports = crt;\nfunction blind(priv) {\n var r = getr(priv);\n var blinder = r.toRed(bn.mont(priv.modulus))\n .redPow(new bn(priv.publicExponent)).fromRed();\n return {\n blinder: blinder,\n unblinder:r.invm(priv.modulus)\n };\n}\nfunction crt(msg, priv) {\n var blinds = blind(priv);\n var len = priv.modulus.byteLength();\n var mod = bn.mont(priv.modulus);\n var blinded = new bn(msg).mul(blinds.blinder).mod(priv.modulus);\n var c1 = blinded.toRed(bn.mont(priv.prime1));\n var c2 = blinded.toRed(bn.mont(priv.prime2));\n var qinv = priv.coefficient;\n var p = priv.prime1;\n var q = priv.prime2;\n var m1 = c1.redPow(priv.exponent1);\n var m2 = c2.redPow(priv.exponent2);\n m1 = m1.fromRed();\n m2 = m2.fromRed();\n var h = m1.isub(m2).imul(qinv).mod(p);\n h.imul(q);\n m2.iadd(h);\n var out = new Buffer(m2.imul(blinds.unblinder).mod(priv.modulus).toArray());\n if (out.length < len) {\n var prefix = new Buffer(len - out.length);\n prefix.fill(0);\n out = Buffer.concat([prefix, out], len);\n }\n return out;\n}\ncrt.getr = getr;\nfunction getr(priv) {\n var len = priv.modulus.byteLength();\n var r = new bn(randomBytes(len));\n while (r.cmp(priv.modulus) >= 0 || !r.mod(priv.prime1) || !r.mod(priv.prime2)) {\n r = new bn(randomBytes(len));\n }\n return r;\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/lib/bn.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"randombytes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/randombytes/browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/EVP_BytesToKey.js\":[function(require,module,exports){\n(function (Buffer){\nvar createHash = require('create-hash');\nmodule.exports = function evp(password, salt, keyLen) {\n keyLen = keyLen/8;\n var ki = 0;\n var ii = 0;\n var key = new Buffer(keyLen);\n var addmd = 0;\n var md, md_buf;\n var i;\n while (true) {\n md = createHash('md5');\n if(addmd++ > 0) {\n md.update(md_buf);\n }\n md.update(password);\n md.update(salt);\n md_buf = md.digest();\n i = 0;\n if(keyLen > 0) {\n while(true) {\n if(keyLen === 0) {\n break;\n }\n if(i === md_buf.length) {\n break;\n }\n key[ki++] = md_buf[i++];\n keyLen--;\n }\n }\n if(keyLen === 0) {\n break;\n }\n }\n for(i=0;i k || new bn(enc).cmp(key.modulus) >= 0) {\n throw new Error('decryption error');\n }\n var msg;\n if (reverse) {\n msg = withPublic(new bn(enc), key);\n } else {\n msg = crt(enc, key);\n }\n var zBuffer = new Buffer(k - msg.length);\n zBuffer.fill(0);\n msg = Buffer.concat([zBuffer, msg], k);\n if (padding === 4) {\n return oaep(key, msg);\n } else if (padding === 1) {\n return pkcs1(key, msg, reverse);\n } else if (padding === 3) {\n return msg;\n } else {\n throw new Error('unknown padding');\n }\n};\n\nfunction oaep(key, msg){\n var n = key.modulus;\n var k = key.modulus.byteLength();\n var mLen = msg.length;\n var iHash = createHash('sha1').update(new Buffer('')).digest();\n var hLen = iHash.length;\n var hLen2 = 2 * hLen;\n if (msg[0] !== 0) {\n throw new Error('decryption error');\n }\n var maskedSeed = msg.slice(1, hLen + 1);\n var maskedDb = msg.slice(hLen + 1);\n var seed = xor(maskedSeed, mgf(maskedDb, hLen));\n var db = xor(maskedDb, mgf(seed, k - hLen - 1));\n if (compare(iHash, db.slice(0, hLen))) {\n throw new Error('decryption error');\n }\n var i = hLen;\n while (db[i] === 0) {\n i++;\n }\n if (db[i++] !== 1) {\n throw new Error('decryption error');\n }\n return db.slice(i);\n}\n\nfunction pkcs1(key, msg, reverse){\n var p1 = msg.slice(0, 2);\n var i = 2;\n var status = 0;\n while (msg[i++] !== 0) {\n if (i >= msg.length) {\n status++;\n break;\n }\n }\n var ps = msg.slice(2, i - 1);\n var p2 = msg.slice(i - 1, i);\n\n if ((p1.toString('hex') !== '0002' && !reverse) || (p1.toString('hex') !== '0001' && reverse)){\n status++;\n }\n if (ps.length < 8) {\n status++;\n }\n if (status) {\n throw new Error('decryption error');\n }\n return msg.slice(i);\n}\nfunction compare(a, b){\n a = new Buffer(a);\n b = new Buffer(b);\n var dif = 0;\n var len = a.length;\n if (a.length !== b.length) {\n dif++;\n len = Math.min(a.length, b.length);\n }\n var i = -1;\n while (++i < len) {\n dif += (a[i] ^ b[i]);\n }\n return dif;\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"./mgf\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/mgf.js\",\"./withPublic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/withPublic.js\",\"./xor\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/xor.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/lib/bn.js\",\"browserify-rsa\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/browserify-rsa/index.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"create-hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/browser.js\",\"parse-asn1\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/publicEncrypt.js\":[function(require,module,exports){\n(function (Buffer){\nvar parseKeys = require('parse-asn1');\nvar randomBytes = require('randombytes');\nvar createHash = require('create-hash');\nvar mgf = require('./mgf');\nvar xor = require('./xor');\nvar bn = require('bn.js');\nvar withPublic = require('./withPublic');\nvar crt = require('browserify-rsa');\n\nvar constants = {\n RSA_PKCS1_OAEP_PADDING: 4,\n RSA_PKCS1_PADDIN: 1,\n RSA_NO_PADDING: 3\n};\n\nmodule.exports = function publicEncrypt(public_key, msg, reverse) {\n var padding;\n if (public_key.padding) {\n padding = public_key.padding;\n } else if (reverse) {\n padding = 1;\n } else {\n padding = 4;\n }\n var key = parseKeys(public_key);\n var paddedMsg;\n if (padding === 4) {\n paddedMsg = oaep(key, msg);\n } else if (padding === 1) {\n paddedMsg = pkcs1(key, msg, reverse);\n } else if (padding === 3) {\n paddedMsg = new bn(msg);\n if (paddedMsg.cmp(key.modulus) >= 0) {\n throw new Error('data too long for modulus');\n }\n } else {\n throw new Error('unknown padding');\n }\n if (reverse) {\n return crt(paddedMsg, key);\n } else {\n return withPublic(paddedMsg, key);\n }\n};\n\nfunction oaep(key, msg){\n var k = key.modulus.byteLength();\n var mLen = msg.length;\n var iHash = createHash('sha1').update(new Buffer('')).digest();\n var hLen = iHash.length;\n var hLen2 = 2 * hLen;\n if (mLen > k - hLen2 - 2) {\n throw new Error('message too long');\n }\n var ps = new Buffer(k - mLen - hLen2 - 2);\n ps.fill(0);\n var dblen = k - hLen - 1;\n var seed = randomBytes(hLen);\n var maskedDb = xor(Buffer.concat([iHash, ps, new Buffer([1]), msg], dblen), mgf(seed, dblen));\n var maskedSeed = xor(seed, mgf(maskedDb, hLen));\n return new bn(Buffer.concat([new Buffer([0]), maskedSeed, maskedDb], k));\n}\nfunction pkcs1(key, msg, reverse){\n var mLen = msg.length;\n var k = key.modulus.byteLength();\n if (mLen > k - 11) {\n throw new Error('message too long');\n }\n var ps;\n if (reverse) {\n ps = new Buffer(k - mLen - 3);\n ps.fill(0xff);\n } else {\n ps = nonZero(k - mLen - 3);\n }\n return new bn(Buffer.concat([new Buffer([0, reverse?1:2]), ps, new Buffer([0]), msg], k));\n}\nfunction nonZero(len, crypto) {\n var out = new Buffer(len);\n var i = 0;\n var cache = randomBytes(len*2);\n var cur = 0;\n var num;\n while (i < len) {\n if (cur === cache.length) {\n cache = randomBytes(len*2);\n cur = 0;\n }\n num = cache[cur++];\n if (num) {\n out[i++] = num;\n }\n }\n return out;\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"./mgf\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/mgf.js\",\"./withPublic\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/withPublic.js\",\"./xor\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/xor.js\",\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/lib/bn.js\",\"browserify-rsa\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/browserify-rsa/index.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"create-hash\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/create-hash/browser.js\",\"parse-asn1\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/index.js\",\"randombytes\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/randombytes/browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/withPublic.js\":[function(require,module,exports){\n(function (Buffer){\nvar bn = require('bn.js');\nfunction withPublic(paddedMsg, key) {\n return new Buffer(paddedMsg\n .toRed(bn.mont(key.modulus))\n .redPow(new bn(key.publicExponent))\n .fromRed()\n .toArray());\n}\n\nmodule.exports = withPublic;\n}).call(this,require(\"buffer\").Buffer)\n},{\"bn.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/lib/bn.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/xor.js\":[function(require,module,exports){\nmodule.exports = function xor(a, b) {\n var len = a.length;\n var i = -1;\n while (++i < len) {\n a[i] ^= b[i];\n }\n return a\n};\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/crypto-browserify/node_modules/randombytes/browser.js\":[function(require,module,exports){\n(function (process,global,Buffer){\n'use strict';\n\nvar crypto = global.crypto || global.msCrypto\nif(crypto && crypto.getRandomValues) {\n module.exports = randomBytes;\n} else {\n module.exports = oldBrowser;\n}\nfunction randomBytes(size, cb) {\n var bytes = new Buffer(size); //in browserify, this is an extended Uint8Array\n /* This will not work in older browsers.\n * See https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues\n */\n\n crypto.getRandomValues(bytes);\n if (typeof cb === 'function') {\n return process.nextTick(function () {\n cb(null, bytes);\n });\n }\n return bytes;\n}\nfunction oldBrowser() {\n throw new Error(\n 'secure random number generation not supported by this browser\\n'+\n 'use chrome, FireFox or Internet Explorer 11'\n )\n}\n\n}).call(this,require('_process'),typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {},require(\"buffer\").Buffer)\n},{\"_process\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/process/browser.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/events/events.js\":[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfunction EventEmitter() {\n this._events = this._events || {};\n this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nEventEmitter.defaultMaxListeners = 10;\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function(n) {\n if (!isNumber(n) || n < 0 || isNaN(n))\n throw TypeError('n must be a positive number');\n this._maxListeners = n;\n return this;\n};\n\nEventEmitter.prototype.emit = function(type) {\n var er, handler, len, args, i, listeners;\n\n if (!this._events)\n this._events = {};\n\n // If there is no 'error' event listener then throw.\n if (type === 'error') {\n if (!this._events.error ||\n (isObject(this._events.error) && !this._events.error.length)) {\n er = arguments[1];\n if (er instanceof Error) {\n throw er; // Unhandled 'error' event\n }\n throw TypeError('Uncaught, unspecified \"error\" event.');\n }\n }\n\n handler = this._events[type];\n\n if (isUndefined(handler))\n return false;\n\n if (isFunction(handler)) {\n switch (arguments.length) {\n // fast cases\n case 1:\n handler.call(this);\n break;\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n default:\n len = arguments.length;\n args = new Array(len - 1);\n for (i = 1; i < len; i++)\n args[i - 1] = arguments[i];\n handler.apply(this, args);\n }\n } else if (isObject(handler)) {\n len = arguments.length;\n args = new Array(len - 1);\n for (i = 1; i < len; i++)\n args[i - 1] = arguments[i];\n\n listeners = handler.slice();\n len = listeners.length;\n for (i = 0; i < len; i++)\n listeners[i].apply(this, args);\n }\n\n return true;\n};\n\nEventEmitter.prototype.addListener = function(type, listener) {\n var m;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events)\n this._events = {};\n\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (this._events.newListener)\n this.emit('newListener', type,\n isFunction(listener.listener) ?\n listener.listener : listener);\n\n if (!this._events[type])\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n else if (isObject(this._events[type]))\n // If we've already got an array, just append.\n this._events[type].push(listener);\n else\n // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener];\n\n // Check for listener leak\n if (isObject(this._events[type]) && !this._events[type].warned) {\n var m;\n if (!isUndefined(this._maxListeners)) {\n m = this._maxListeners;\n } else {\n m = EventEmitter.defaultMaxListeners;\n }\n\n if (m && m > 0 && this._events[type].length > m) {\n this._events[type].warned = true;\n console.error('(node) warning: possible EventEmitter memory ' +\n 'leak detected. %d listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.',\n this._events[type].length);\n if (typeof console.trace === 'function') {\n // not supported in IE 10\n console.trace();\n }\n }\n }\n\n return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n var fired = false;\n\n function g() {\n this.removeListener(type, g);\n\n if (!fired) {\n fired = true;\n listener.apply(this, arguments);\n }\n }\n\n g.listener = listener;\n this.on(type, g);\n\n return this;\n};\n\n// emits a 'removeListener' event iff the listener was removed\nEventEmitter.prototype.removeListener = function(type, listener) {\n var list, position, length, i;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events || !this._events[type])\n return this;\n\n list = this._events[type];\n length = list.length;\n position = -1;\n\n if (list === listener ||\n (isFunction(list.listener) && list.listener === listener)) {\n delete this._events[type];\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n\n } else if (isObject(list)) {\n for (i = length; i-- > 0;) {\n if (list[i] === listener ||\n (list[i].listener && list[i].listener === listener)) {\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (list.length === 1) {\n list.length = 0;\n delete this._events[type];\n } else {\n list.splice(position, 1);\n }\n\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n }\n\n return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n var key, listeners;\n\n if (!this._events)\n return this;\n\n // not listening for removeListener, no need to emit\n if (!this._events.removeListener) {\n if (arguments.length === 0)\n this._events = {};\n else if (this._events[type])\n delete this._events[type];\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n for (key in this._events) {\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = {};\n return this;\n }\n\n listeners = this._events[type];\n\n if (isFunction(listeners)) {\n this.removeListener(type, listeners);\n } else {\n // LIFO order\n while (listeners.length)\n this.removeListener(type, listeners[listeners.length - 1]);\n }\n delete this._events[type];\n\n return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n var ret;\n if (!this._events || !this._events[type])\n ret = [];\n else if (isFunction(this._events[type]))\n ret = [this._events[type]];\n else\n ret = this._events[type].slice();\n return ret;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n var ret;\n if (!emitter._events || !emitter._events[type])\n ret = 0;\n else if (isFunction(emitter._events[type]))\n ret = 1;\n else\n ret = emitter._events[type].length;\n return ret;\n};\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\n\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/assert/node_modules/util/node_modules/inherits/inherits_browser.js\"][0].apply(exports,arguments)\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/isarray/index.js\":[function(require,module,exports){\nmodule.exports = Array.isArray || function (arr) {\n return Object.prototype.toString.call(arr) == '[object Array]';\n};\n\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/path-browserify/index.js\":[function(require,module,exports){\n(function (process){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n}\n\n// Split a filename into [root, dir, basename, ext], unix version\n// 'root' is just a slash, or nothing.\nvar splitPathRe =\n /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;\nvar splitPath = function(filename) {\n return splitPathRe.exec(filename).slice(1);\n};\n\n// path.resolve([from ...], to)\n// posix version\nexports.resolve = function() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : process.cwd();\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n};\n\n// path.normalize(path)\n// posix version\nexports.normalize = function(path) {\n var isAbsolute = exports.isAbsolute(path),\n trailingSlash = substr(path, -1) === '/';\n\n // Normalize the path\n path = normalizeArray(filter(path.split('/'), function(p) {\n return !!p;\n }), !isAbsolute).join('/');\n\n if (!path && !isAbsolute) {\n path = '.';\n }\n if (path && trailingSlash) {\n path += '/';\n }\n\n return (isAbsolute ? '/' : '') + path;\n};\n\n// posix version\nexports.isAbsolute = function(path) {\n return path.charAt(0) === '/';\n};\n\n// posix version\nexports.join = function() {\n var paths = Array.prototype.slice.call(arguments, 0);\n return exports.normalize(filter(paths, function(p, index) {\n if (typeof p !== 'string') {\n throw new TypeError('Arguments to path.join must be strings');\n }\n return p;\n }).join('/'));\n};\n\n\n// path.relative(from, to)\n// posix version\nexports.relative = function(from, to) {\n from = exports.resolve(from).substr(1);\n to = exports.resolve(to).substr(1);\n\n function trim(arr) {\n var start = 0;\n for (; start < arr.length; start++) {\n if (arr[start] !== '') break;\n }\n\n var end = arr.length - 1;\n for (; end >= 0; end--) {\n if (arr[end] !== '') break;\n }\n\n if (start > end) return [];\n return arr.slice(start, end - start + 1);\n }\n\n var fromParts = trim(from.split('/'));\n var toParts = trim(to.split('/'));\n\n var length = Math.min(fromParts.length, toParts.length);\n var samePartsLength = length;\n for (var i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i;\n break;\n }\n }\n\n var outputParts = [];\n for (var i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..');\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n return outputParts.join('/');\n};\n\nexports.sep = '/';\nexports.delimiter = ':';\n\nexports.dirname = function(path) {\n var result = splitPath(path),\n root = result[0],\n dir = result[1];\n\n if (!root && !dir) {\n // No dirname whatsoever\n return '.';\n }\n\n if (dir) {\n // It has a dirname, strip trailing slash\n dir = dir.substr(0, dir.length - 1);\n }\n\n return root + dir;\n};\n\n\nexports.basename = function(path, ext) {\n var f = splitPath(path)[2];\n // TODO: make this comparison case-insensitive on windows?\n if (ext && f.substr(-1 * ext.length) === ext) {\n f = f.substr(0, f.length - ext.length);\n }\n return f;\n};\n\n\nexports.extname = function(path) {\n return splitPath(path)[3];\n};\n\nfunction filter (xs, f) {\n if (xs.filter) return xs.filter(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n if (f(xs[i], i, xs)) res.push(xs[i]);\n }\n return res;\n}\n\n// String.prototype.substr - negative index don't work in IE8\nvar substr = 'ab'.substr(-1) === 'b'\n ? function (str, start, len) { return str.substr(start, len) }\n : function (str, start, len) {\n if (start < 0) start = str.length + start;\n return str.substr(start, len);\n }\n;\n\n}).call(this,require('_process'))\n},{\"_process\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/process/browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/process/browser.js\":[function(require,module,exports){\n// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n draining = true;\n var currentQueue;\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n var i = -1;\n while (++i < len) {\n currentQueue[i]();\n }\n len = queue.length;\n }\n draining = false;\n}\nprocess.nextTick = function (fun) {\n queue.push(fun);\n if (!draining) {\n setTimeout(drainQueue, 0);\n }\n};\n\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\n// TODO(shtylman)\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/duplex.js\":[function(require,module,exports){\nmodule.exports = require(\"./lib/_stream_duplex.js\")\n\n},{\"./lib/_stream_duplex.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_duplex.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_duplex.js\":[function(require,module,exports){\n(function (process){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\nmodule.exports = Duplex;\n\n/**/\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) keys.push(key);\n return keys;\n}\n/**/\n\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nvar Readable = require('./_stream_readable');\nvar Writable = require('./_stream_writable');\n\nutil.inherits(Duplex, Readable);\n\nforEach(objectKeys(Writable.prototype), function(method) {\n if (!Duplex.prototype[method])\n Duplex.prototype[method] = Writable.prototype[method];\n});\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex))\n return new Duplex(options);\n\n Readable.call(this, options);\n Writable.call(this, options);\n\n if (options && options.readable === false)\n this.readable = false;\n\n if (options && options.writable === false)\n this.writable = false;\n\n this.allowHalfOpen = true;\n if (options && options.allowHalfOpen === false)\n this.allowHalfOpen = false;\n\n this.once('end', onend);\n}\n\n// the no-half-open enforcer\nfunction onend() {\n // if we allow half-open state, or if the writable side ended,\n // then we're ok.\n if (this.allowHalfOpen || this._writableState.ended)\n return;\n\n // no more data can be written.\n // But allow more writes to happen in this tick.\n process.nextTick(this.end.bind(this));\n}\n\nfunction forEach (xs, f) {\n for (var i = 0, l = xs.length; i < l; i++) {\n f(xs[i], i);\n }\n}\n\n}).call(this,require('_process'))\n},{\"./_stream_readable\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_readable.js\",\"./_stream_writable\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_writable.js\",\"_process\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/process/browser.js\",\"core-util-is\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/node_modules/core-util-is/lib/util.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_passthrough.js\":[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\nmodule.exports = PassThrough;\n\nvar Transform = require('./_stream_transform');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(PassThrough, Transform);\n\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough))\n return new PassThrough(options);\n\n Transform.call(this, options);\n}\n\nPassThrough.prototype._transform = function(chunk, encoding, cb) {\n cb(null, chunk);\n};\n\n},{\"./_stream_transform\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_transform.js\",\"core-util-is\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/node_modules/core-util-is/lib/util.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_readable.js\":[function(require,module,exports){\n(function (process){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nmodule.exports = Readable;\n\n/**/\nvar isArray = require('isarray');\n/**/\n\n\n/**/\nvar Buffer = require('buffer').Buffer;\n/**/\n\nReadable.ReadableState = ReadableState;\n\nvar EE = require('events').EventEmitter;\n\n/**/\nif (!EE.listenerCount) EE.listenerCount = function(emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\nvar Stream = require('stream');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nvar StringDecoder;\n\n\n/**/\nvar debug = require('util');\nif (debug && debug.debuglog) {\n debug = debug.debuglog('stream');\n} else {\n debug = function () {};\n}\n/**/\n\n\nutil.inherits(Readable, Stream);\n\nfunction ReadableState(options, stream) {\n var Duplex = require('./_stream_duplex');\n\n options = options || {};\n\n // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n var hwm = options.highWaterMark;\n var defaultHwm = options.objectMode ? 16 : 16 * 1024;\n this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;\n\n // cast to ints.\n this.highWaterMark = ~~this.highWaterMark;\n\n this.buffer = [];\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n\n\n // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n this.objectMode = !!options.objectMode;\n\n if (stream instanceof Duplex)\n this.objectMode = this.objectMode || !!options.readableObjectMode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // when piping, we only care about 'readable' events that happen\n // after read()ing all the bytes and not getting any pushback.\n this.ranOut = false;\n\n // the number of writers that are awaiting a drain event in .pipe()s\n this.awaitDrain = 0;\n\n // if true, a maybeReadMore has been scheduled\n this.readingMore = false;\n\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder)\n StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nfunction Readable(options) {\n var Duplex = require('./_stream_duplex');\n\n if (!(this instanceof Readable))\n return new Readable(options);\n\n this._readableState = new ReadableState(options, this);\n\n // legacy\n this.readable = true;\n\n Stream.call(this);\n}\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function(chunk, encoding) {\n var state = this._readableState;\n\n if (util.isString(chunk) && !state.objectMode) {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = new Buffer(chunk, encoding);\n encoding = '';\n }\n }\n\n return readableAddChunk(this, state, chunk, encoding, false);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function(chunk) {\n var state = this._readableState;\n return readableAddChunk(this, state, chunk, '', true);\n};\n\nfunction readableAddChunk(stream, state, chunk, encoding, addToFront) {\n var er = chunkInvalid(state, chunk);\n if (er) {\n stream.emit('error', er);\n } else if (util.isNullOrUndefined(chunk)) {\n state.reading = false;\n if (!state.ended)\n onEofChunk(stream, state);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (state.ended && !addToFront) {\n var e = new Error('stream.push() after EOF');\n stream.emit('error', e);\n } else if (state.endEmitted && addToFront) {\n var e = new Error('stream.unshift() after end event');\n stream.emit('error', e);\n } else {\n if (state.decoder && !addToFront && !encoding)\n chunk = state.decoder.write(chunk);\n\n if (!addToFront)\n state.reading = false;\n\n // if we want the data now, just emit it.\n if (state.flowing && state.length === 0 && !state.sync) {\n stream.emit('data', chunk);\n stream.read(0);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront)\n state.buffer.unshift(chunk);\n else\n state.buffer.push(chunk);\n\n if (state.needReadable)\n emitReadable(stream);\n }\n\n maybeReadMore(stream, state);\n }\n } else if (!addToFront) {\n state.reading = false;\n }\n\n return needMoreData(state);\n}\n\n\n\n// if it's past the high water mark, we can push in some more.\n// Also, if we have no data yet, we can stand some\n// more bytes. This is to work around cases where hwm=0,\n// such as the repl. Also, if the push() triggered a\n// readable event, and the user called read(largeNumber) such that\n// needReadable was set, then we ought to push more, so that another\n// 'readable' event will be triggered.\nfunction needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function(enc) {\n if (!StringDecoder)\n StringDecoder = require('string_decoder/').StringDecoder;\n this._readableState.decoder = new StringDecoder(enc);\n this._readableState.encoding = enc;\n return this;\n};\n\n// Don't raise the hwm > 128MB\nvar MAX_HWM = 0x800000;\nfunction roundUpToNextPowerOf2(n) {\n if (n >= MAX_HWM) {\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2\n n--;\n for (var p = 1; p < 32; p <<= 1) n |= n >> p;\n n++;\n }\n return n;\n}\n\nfunction howMuchToRead(n, state) {\n if (state.length === 0 && state.ended)\n return 0;\n\n if (state.objectMode)\n return n === 0 ? 0 : 1;\n\n if (isNaN(n) || util.isNull(n)) {\n // only flow one buffer at a time\n if (state.flowing && state.buffer.length)\n return state.buffer[0].length;\n else\n return state.length;\n }\n\n if (n <= 0)\n return 0;\n\n // If we're asking for more than the target buffer level,\n // then raise the water mark. Bump up to the next highest\n // power of 2, to prevent increasing it excessively in tiny\n // amounts.\n if (n > state.highWaterMark)\n state.highWaterMark = roundUpToNextPowerOf2(n);\n\n // don't have that much. return null, unless we've ended.\n if (n > state.length) {\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n } else\n return state.length;\n }\n\n return n;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function(n) {\n debug('read', n);\n var state = this._readableState;\n var nOrig = n;\n\n if (!util.isNumber(n) || n > 0)\n state.emittedReadable = false;\n\n // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n if (n === 0 &&\n state.needReadable &&\n (state.length >= state.highWaterMark || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended)\n endReadable(this);\n else\n emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state);\n\n // if we've ended, and we're now clear, then finish it up.\n if (n === 0 && state.ended) {\n if (state.length === 0)\n endReadable(this);\n return null;\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n var doRead = state.needReadable;\n debug('need readable', doRead);\n\n // if we currently have less than the highWaterMark, then also read some\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n }\n\n // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n }\n\n if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true;\n // if the length is currently zero, then we *need* a readable event.\n if (state.length === 0)\n state.needReadable = true;\n // call internal read method\n this._read(state.highWaterMark);\n state.sync = false;\n }\n\n // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n if (doRead && !state.reading)\n n = howMuchToRead(nOrig, state);\n\n var ret;\n if (n > 0)\n ret = fromList(n, state);\n else\n ret = null;\n\n if (util.isNull(ret)) {\n state.needReadable = true;\n n = 0;\n }\n\n state.length -= n;\n\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (state.length === 0 && !state.ended)\n state.needReadable = true;\n\n // If we tried to read() past the EOF, then emit end on the next tick.\n if (nOrig !== n && state.ended && state.length === 0)\n endReadable(this);\n\n if (!util.isNull(ret))\n this.emit('data', ret);\n\n return ret;\n};\n\nfunction chunkInvalid(state, chunk) {\n var er = null;\n if (!util.isBuffer(chunk) &&\n !util.isString(chunk) &&\n !util.isNullOrUndefined(chunk) &&\n !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n return er;\n}\n\n\nfunction onEofChunk(stream, state) {\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n\n // emit 'readable' now to make sure it gets picked up.\n emitReadable(stream);\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n }\n}\n\nfunction emitReadable_(stream) {\n debug('emit readable');\n stream.emit('readable');\n flow(stream);\n}\n\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(function() {\n maybeReadMore_(stream, state);\n });\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n var len = state.length;\n while (!state.reading && !state.flowing && !state.ended &&\n state.length < state.highWaterMark) {\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length)\n // didn't get any data, stop spinning.\n break;\n else\n len = state.length;\n }\n state.readingMore = false;\n}\n\n// abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function(n) {\n this.emit('error', new Error('not implemented'));\n};\n\nReadable.prototype.pipe = function(dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n\n var doEnd = (!pipeOpts || pipeOpts.end !== false) &&\n dest !== process.stdout &&\n dest !== process.stderr;\n\n var endFn = doEnd ? onend : cleanup;\n if (state.endEmitted)\n process.nextTick(endFn);\n else\n src.once('end', endFn);\n\n dest.on('unpipe', onunpipe);\n function onunpipe(readable) {\n debug('onunpipe');\n if (readable === src) {\n cleanup();\n }\n }\n\n function onend() {\n debug('onend');\n dest.end();\n }\n\n // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n\n function cleanup() {\n debug('cleanup');\n // cleanup event handlers once the pipe is broken\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', cleanup);\n src.removeListener('data', ondata);\n\n // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n if (state.awaitDrain &&\n (!dest._writableState || dest._writableState.needDrain))\n ondrain();\n }\n\n src.on('data', ondata);\n function ondata(chunk) {\n debug('ondata');\n var ret = dest.write(chunk);\n if (false === ret) {\n debug('false write response, pause',\n src._readableState.awaitDrain);\n src._readableState.awaitDrain++;\n src.pause();\n }\n }\n\n // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }\n // This is a brutally ugly hack to make sure that our error handler\n // is attached before any userland ones. NEVER DO THIS.\n if (!dest._events || !dest._events.error)\n dest.on('error', onerror);\n else if (isArray(dest._events.error))\n dest._events.error.unshift(onerror);\n else\n dest._events.error = [onerror, dest._events.error];\n\n\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n dest.once('close', onclose);\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n dest.once('finish', onfinish);\n\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n }\n\n // tell the dest that it's being piped to\n dest.emit('pipe', src);\n\n // start the flow if it hasn't been started already.\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function() {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain)\n state.awaitDrain--;\n if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\n\n\nReadable.prototype.unpipe = function(dest) {\n var state = this._readableState;\n\n // if we're not piping anywhere, then do nothing.\n if (state.pipesCount === 0)\n return this;\n\n // just one destination. most common case.\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes)\n return this;\n\n if (!dest)\n dest = state.pipes;\n\n // got a match.\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest)\n dest.emit('unpipe', this);\n return this;\n }\n\n // slow case. multiple pipe destinations.\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n\n for (var i = 0; i < len; i++)\n dests[i].emit('unpipe', this);\n return this;\n }\n\n // try to find the right one.\n var i = indexOf(state.pipes, dest);\n if (i === -1)\n return this;\n\n state.pipes.splice(i, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1)\n state.pipes = state.pipes[0];\n\n dest.emit('unpipe', this);\n\n return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function(ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n\n // If listening to data, and it has not explicitly been paused,\n // then call resume to start the flow of data on the next tick.\n if (ev === 'data' && false !== this._readableState.flowing) {\n this.resume();\n }\n\n if (ev === 'readable' && this.readable) {\n var state = this._readableState;\n if (!state.readableListening) {\n state.readableListening = true;\n state.emittedReadable = false;\n state.needReadable = true;\n if (!state.reading) {\n var self = this;\n process.nextTick(function() {\n debug('readable nexttick read 0');\n self.read(0);\n });\n } else if (state.length) {\n emitReadable(this, state);\n }\n }\n }\n\n return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function() {\n var state = this._readableState;\n if (!state.flowing) {\n debug('resume');\n state.flowing = true;\n if (!state.reading) {\n debug('resume read 0');\n this.read(0);\n }\n resume(this, state);\n }\n return this;\n};\n\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n process.nextTick(function() {\n resume_(stream, state);\n });\n }\n}\n\nfunction resume_(stream, state) {\n state.resumeScheduled = false;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading)\n stream.read(0);\n}\n\nReadable.prototype.pause = function() {\n debug('call pause flowing=%j', this._readableState.flowing);\n if (false !== this._readableState.flowing) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n return this;\n};\n\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n if (state.flowing) {\n do {\n var chunk = stream.read();\n } while (null !== chunk && state.flowing);\n }\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function(stream) {\n var state = this._readableState;\n var paused = false;\n\n var self = this;\n stream.on('end', function() {\n debug('wrapped end');\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length)\n self.push(chunk);\n }\n\n self.push(null);\n });\n\n stream.on('data', function(chunk) {\n debug('wrapped data');\n if (state.decoder)\n chunk = state.decoder.write(chunk);\n if (!chunk || !state.objectMode && !chunk.length)\n return;\n\n var ret = self.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n\n // proxy all the other methods.\n // important when wrapping filters and duplexes.\n for (var i in stream) {\n if (util.isFunction(stream[i]) && util.isUndefined(this[i])) {\n this[i] = function(method) { return function() {\n return stream[method].apply(stream, arguments);\n }}(i);\n }\n }\n\n // proxy certain important events.\n var events = ['error', 'close', 'destroy', 'pause', 'resume'];\n forEach(events, function(ev) {\n stream.on(ev, self.emit.bind(self, ev));\n });\n\n // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n self._read = function(n) {\n debug('wrapped _read', n);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return self;\n};\n\n\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\nfunction fromList(n, state) {\n var list = state.buffer;\n var length = state.length;\n var stringMode = !!state.decoder;\n var objectMode = !!state.objectMode;\n var ret;\n\n // nothing in the list, definitely empty.\n if (list.length === 0)\n return null;\n\n if (length === 0)\n ret = null;\n else if (objectMode)\n ret = list.shift();\n else if (!n || n >= length) {\n // read it all, truncate the array.\n if (stringMode)\n ret = list.join('');\n else\n ret = Buffer.concat(list, length);\n list.length = 0;\n } else {\n // read just some of it.\n if (n < list[0].length) {\n // just take a part of the first list item.\n // slice is the same for buffers and strings.\n var buf = list[0];\n ret = buf.slice(0, n);\n list[0] = buf.slice(n);\n } else if (n === list[0].length) {\n // first list is a perfect match\n ret = list.shift();\n } else {\n // complex case.\n // we have enough to cover it, but it spans past the first buffer.\n if (stringMode)\n ret = '';\n else\n ret = new Buffer(n);\n\n var c = 0;\n for (var i = 0, l = list.length; i < l && c < n; i++) {\n var buf = list[0];\n var cpy = Math.min(n - c, buf.length);\n\n if (stringMode)\n ret += buf.slice(0, cpy);\n else\n buf.copy(ret, c, 0, cpy);\n\n if (cpy < buf.length)\n list[0] = buf.slice(cpy);\n else\n list.shift();\n\n c += cpy;\n }\n }\n }\n\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState;\n\n // If we get here before consuming all the bytes, then that is a\n // bug in node. Should never happen.\n if (state.length > 0)\n throw new Error('endReadable called on non-empty stream');\n\n if (!state.endEmitted) {\n state.ended = true;\n process.nextTick(function() {\n // Check that we didn't get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n }\n });\n }\n}\n\nfunction forEach (xs, f) {\n for (var i = 0, l = xs.length; i < l; i++) {\n f(xs[i], i);\n }\n}\n\nfunction indexOf (xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n return -1;\n}\n\n}).call(this,require('_process'))\n},{\"./_stream_duplex\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_duplex.js\",\"_process\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/process/browser.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"core-util-is\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/node_modules/core-util-is/lib/util.js\",\"events\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/events/events.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\",\"isarray\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/isarray/index.js\",\"stream\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/stream-browserify/index.js\",\"string_decoder/\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/string_decoder/index.js\",\"util\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/browser-resolve/empty.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_transform.js\":[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\nmodule.exports = Transform;\n\nvar Duplex = require('./_stream_duplex');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(Transform, Duplex);\n\n\nfunction TransformState(options, stream) {\n this.afterTransform = function(er, data) {\n return afterTransform(stream, er, data);\n };\n\n this.needTransform = false;\n this.transforming = false;\n this.writecb = null;\n this.writechunk = null;\n}\n\nfunction afterTransform(stream, er, data) {\n var ts = stream._transformState;\n ts.transforming = false;\n\n var cb = ts.writecb;\n\n if (!cb)\n return stream.emit('error', new Error('no writecb in Transform class'));\n\n ts.writechunk = null;\n ts.writecb = null;\n\n if (!util.isNullOrUndefined(data))\n stream.push(data);\n\n if (cb)\n cb(er);\n\n var rs = stream._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n stream._read(rs.highWaterMark);\n }\n}\n\n\nfunction Transform(options) {\n if (!(this instanceof Transform))\n return new Transform(options);\n\n Duplex.call(this, options);\n\n this._transformState = new TransformState(options, this);\n\n // when the writable side finishes, then flush out anything remaining.\n var stream = this;\n\n // start out asking for a readable event once data is transformed.\n this._readableState.needReadable = true;\n\n // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false;\n\n this.once('prefinish', function() {\n if (util.isFunction(this._flush))\n this._flush(function(er) {\n done(stream, er);\n });\n else\n done(stream);\n });\n}\n\nTransform.prototype.push = function(chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function(chunk, encoding, cb) {\n throw new Error('not implemented');\n};\n\nTransform.prototype._write = function(chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform ||\n rs.needReadable ||\n rs.length < rs.highWaterMark)\n this._read(rs.highWaterMark);\n }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function(n) {\n var ts = this._transformState;\n\n if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\n\nfunction done(stream, er) {\n if (er)\n return stream.emit('error', er);\n\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n var ws = stream._writableState;\n var ts = stream._transformState;\n\n if (ws.length)\n throw new Error('calling transform done when ws.length != 0');\n\n if (ts.transforming)\n throw new Error('calling transform done when still transforming');\n\n return stream.push(null);\n}\n\n},{\"./_stream_duplex\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_duplex.js\",\"core-util-is\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/node_modules/core-util-is/lib/util.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_writable.js\":[function(require,module,exports){\n(function (process){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, cb), and it'll handle all\n// the drain event emission and buffering.\n\nmodule.exports = Writable;\n\n/**/\nvar Buffer = require('buffer').Buffer;\n/**/\n\nWritable.WritableState = WritableState;\n\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nvar Stream = require('stream');\n\nutil.inherits(Writable, Stream);\n\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n}\n\nfunction WritableState(options, stream) {\n var Duplex = require('./_stream_duplex');\n\n options = options || {};\n\n // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n var hwm = options.highWaterMark;\n var defaultHwm = options.objectMode ? 16 : 16 * 1024;\n this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;\n\n // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!options.objectMode;\n\n if (stream instanceof Duplex)\n this.objectMode = this.objectMode || !!options.writableObjectMode;\n\n // cast to ints.\n this.highWaterMark = ~~this.highWaterMark;\n\n this.needDrain = false;\n // at the start of calling end()\n this.ending = false;\n // when end() has been called, and returned\n this.ended = false;\n // when 'finish' is emitted\n this.finished = false;\n\n // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n this.length = 0;\n\n // a flag to see when we're in the middle of a write.\n this.writing = false;\n\n // when true all writes will be buffered until .uncork() call\n this.corked = 0;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false;\n\n // the callback that's passed to _write(chunk,cb)\n this.onwrite = function(er) {\n onwrite(stream, er);\n };\n\n // the callback that the user supplies to write(chunk,encoding,cb)\n this.writecb = null;\n\n // the amount that is being written when _write is called.\n this.writelen = 0;\n\n this.buffer = [];\n\n // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n this.pendingcb = 0;\n\n // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n this.prefinished = false;\n\n // True if the error was already emitted and should not be thrown again\n this.errorEmitted = false;\n}\n\nfunction Writable(options) {\n var Duplex = require('./_stream_duplex');\n\n // Writable ctor is applied to Duplexes, though they're not\n // instanceof Writable, they're instanceof Readable.\n if (!(this instanceof Writable) && !(this instanceof Duplex))\n return new Writable(options);\n\n this._writableState = new WritableState(options, this);\n\n // legacy.\n this.writable = true;\n\n Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function() {\n this.emit('error', new Error('Cannot pipe. Not readable.'));\n};\n\n\nfunction writeAfterEnd(stream, state, cb) {\n var er = new Error('write after end');\n // TODO: defer error events consistently everywhere, not just the cb\n stream.emit('error', er);\n process.nextTick(function() {\n cb(er);\n });\n}\n\n// If we get something that is not a buffer, string, null, or undefined,\n// and we're not in objectMode, then that's an error.\n// Otherwise stream chunks are all considered to be of length=1, and the\n// watermarks determine how many objects to keep in the buffer, rather than\n// how many bytes or characters.\nfunction validChunk(stream, state, chunk, cb) {\n var valid = true;\n if (!util.isBuffer(chunk) &&\n !util.isString(chunk) &&\n !util.isNullOrUndefined(chunk) &&\n !state.objectMode) {\n var er = new TypeError('Invalid non-string/buffer chunk');\n stream.emit('error', er);\n process.nextTick(function() {\n cb(er);\n });\n valid = false;\n }\n return valid;\n}\n\nWritable.prototype.write = function(chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n\n if (util.isFunction(encoding)) {\n cb = encoding;\n encoding = null;\n }\n\n if (util.isBuffer(chunk))\n encoding = 'buffer';\n else if (!encoding)\n encoding = state.defaultEncoding;\n\n if (!util.isFunction(cb))\n cb = function() {};\n\n if (state.ended)\n writeAfterEnd(this, state, cb);\n else if (validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, chunk, encoding, cb);\n }\n\n return ret;\n};\n\nWritable.prototype.cork = function() {\n var state = this._writableState;\n\n state.corked++;\n};\n\nWritable.prototype.uncork = function() {\n var state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n\n if (!state.writing &&\n !state.corked &&\n !state.finished &&\n !state.bufferProcessing &&\n state.buffer.length)\n clearBuffer(this, state);\n }\n};\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode &&\n state.decodeStrings !== false &&\n util.isString(chunk)) {\n chunk = new Buffer(chunk, encoding);\n }\n return chunk;\n}\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, chunk, encoding, cb) {\n chunk = decodeChunk(state, chunk, encoding);\n if (util.isBuffer(chunk))\n encoding = 'buffer';\n var len = state.objectMode ? 1 : chunk.length;\n\n state.length += len;\n\n var ret = state.length < state.highWaterMark;\n // we must ensure that previous needDrain will not be reset to false.\n if (!ret)\n state.needDrain = true;\n\n if (state.writing || state.corked)\n state.buffer.push(new WriteReq(chunk, encoding, cb));\n else\n doWrite(stream, state, false, len, chunk, encoding, cb);\n\n return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (writev)\n stream._writev(chunk, state.onwrite);\n else\n stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n if (sync)\n process.nextTick(function() {\n state.pendingcb--;\n cb(er);\n });\n else {\n state.pendingcb--;\n cb(er);\n }\n\n stream._writableState.errorEmitted = true;\n stream.emit('error', er);\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n\n onwriteStateUpdate(state);\n\n if (er)\n onwriteError(stream, state, sync, er, cb);\n else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(stream, state);\n\n if (!finished &&\n !state.corked &&\n !state.bufferProcessing &&\n state.buffer.length) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n process.nextTick(function() {\n afterWrite(stream, state, finished, cb);\n });\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished)\n onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n}\n\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n\n if (stream._writev && state.buffer.length > 1) {\n // Fast case, write everything using _writev()\n var cbs = [];\n for (var c = 0; c < state.buffer.length; c++)\n cbs.push(state.buffer[c].callback);\n\n // count the one we are adding, as well.\n // TODO(isaacs) clean this up\n state.pendingcb++;\n doWrite(stream, state, true, state.length, state.buffer, '', function(err) {\n for (var i = 0; i < cbs.length; i++) {\n state.pendingcb--;\n cbs[i](err);\n }\n });\n\n // Clear buffer\n state.buffer = [];\n } else {\n // Slow case, write chunks one-by-one\n for (var c = 0; c < state.buffer.length; c++) {\n var entry = state.buffer[c];\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n\n doWrite(stream, state, false, len, chunk, encoding, cb);\n\n // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n if (state.writing) {\n c++;\n break;\n }\n }\n\n if (c < state.buffer.length)\n state.buffer = state.buffer.slice(c);\n else\n state.buffer.length = 0;\n }\n\n state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function(chunk, encoding, cb) {\n cb(new Error('not implemented'));\n\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function(chunk, encoding, cb) {\n var state = this._writableState;\n\n if (util.isFunction(chunk)) {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (util.isFunction(encoding)) {\n cb = encoding;\n encoding = null;\n }\n\n if (!util.isNullOrUndefined(chunk))\n this.write(chunk, encoding);\n\n // .end() fully uncorks\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n\n // ignore unnecessary end() calls.\n if (!state.ending && !state.finished)\n endWritable(this, state, cb);\n};\n\n\nfunction needFinish(stream, state) {\n return (state.ending &&\n state.length === 0 &&\n !state.finished &&\n !state.writing);\n}\n\nfunction prefinish(stream, state) {\n if (!state.prefinished) {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(stream, state);\n if (need) {\n if (state.pendingcb === 0) {\n prefinish(stream, state);\n state.finished = true;\n stream.emit('finish');\n } else\n prefinish(stream, state);\n }\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished)\n process.nextTick(cb);\n else\n stream.once('finish', cb);\n }\n state.ended = true;\n}\n\n}).call(this,require('_process'))\n},{\"./_stream_duplex\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_duplex.js\",\"_process\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/process/browser.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"core-util-is\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/node_modules/core-util-is/lib/util.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\",\"stream\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/stream-browserify/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/node_modules/core-util-is/lib/util.js\":[function(require,module,exports){\n(function (Buffer){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nfunction isBuffer(arg) {\n return Buffer.isBuffer(arg);\n}\nexports.isBuffer = isBuffer;\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/passthrough.js\":[function(require,module,exports){\nmodule.exports = require(\"./lib/_stream_passthrough.js\")\n\n},{\"./lib/_stream_passthrough.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_passthrough.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/readable.js\":[function(require,module,exports){\nexports = module.exports = require('./lib/_stream_readable.js');\nexports.Stream = require('stream');\nexports.Readable = exports;\nexports.Writable = require('./lib/_stream_writable.js');\nexports.Duplex = require('./lib/_stream_duplex.js');\nexports.Transform = require('./lib/_stream_transform.js');\nexports.PassThrough = require('./lib/_stream_passthrough.js');\n\n},{\"./lib/_stream_duplex.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_duplex.js\",\"./lib/_stream_passthrough.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_passthrough.js\",\"./lib/_stream_readable.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_readable.js\",\"./lib/_stream_transform.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_transform.js\",\"./lib/_stream_writable.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_writable.js\",\"stream\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/stream-browserify/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/transform.js\":[function(require,module,exports){\nmodule.exports = require(\"./lib/_stream_transform.js\")\n\n},{\"./lib/_stream_transform.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_transform.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/writable.js\":[function(require,module,exports){\nmodule.exports = require(\"./lib/_stream_writable.js\")\n\n},{\"./lib/_stream_writable.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/lib/_stream_writable.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/stream-browserify/index.js\":[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nmodule.exports = Stream;\n\nvar EE = require('events').EventEmitter;\nvar inherits = require('inherits');\n\ninherits(Stream, EE);\nStream.Readable = require('readable-stream/readable.js');\nStream.Writable = require('readable-stream/writable.js');\nStream.Duplex = require('readable-stream/duplex.js');\nStream.Transform = require('readable-stream/transform.js');\nStream.PassThrough = require('readable-stream/passthrough.js');\n\n// Backwards-compat with node 0.4.x\nStream.Stream = Stream;\n\n\n\n// old-style streams. Note that the pipe method (the only relevant\n// part of this class) is overridden in the Readable class.\n\nfunction Stream() {\n EE.call(this);\n}\n\nStream.prototype.pipe = function(dest, options) {\n var source = this;\n\n function ondata(chunk) {\n if (dest.writable) {\n if (false === dest.write(chunk) && source.pause) {\n source.pause();\n }\n }\n }\n\n source.on('data', ondata);\n\n function ondrain() {\n if (source.readable && source.resume) {\n source.resume();\n }\n }\n\n dest.on('drain', ondrain);\n\n // If the 'end' option is not supplied, dest.end() will be called when\n // source gets the 'end' or 'close' events. Only dest.end() once.\n if (!dest._isStdio && (!options || options.end !== false)) {\n source.on('end', onend);\n source.on('close', onclose);\n }\n\n var didOnEnd = false;\n function onend() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n dest.end();\n }\n\n\n function onclose() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n if (typeof dest.destroy === 'function') dest.destroy();\n }\n\n // don't leave dangling pipes when there are errors.\n function onerror(er) {\n cleanup();\n if (EE.listenerCount(this, 'error') === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }\n\n source.on('error', onerror);\n dest.on('error', onerror);\n\n // remove all the event listeners that were added.\n function cleanup() {\n source.removeListener('data', ondata);\n dest.removeListener('drain', ondrain);\n\n source.removeListener('end', onend);\n source.removeListener('close', onclose);\n\n source.removeListener('error', onerror);\n dest.removeListener('error', onerror);\n\n source.removeListener('end', cleanup);\n source.removeListener('close', cleanup);\n\n dest.removeListener('close', cleanup);\n }\n\n source.on('end', cleanup);\n source.on('close', cleanup);\n\n dest.on('close', cleanup);\n\n dest.emit('pipe', source);\n\n // Allow for unix-like usage: A.pipe(B).pipe(C)\n return dest;\n};\n\n},{\"events\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/events/events.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\",\"readable-stream/duplex.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/duplex.js\",\"readable-stream/passthrough.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/passthrough.js\",\"readable-stream/readable.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/readable.js\",\"readable-stream/transform.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/transform.js\",\"readable-stream/writable.js\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/readable-stream/writable.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/string_decoder/index.js\":[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar Buffer = require('buffer').Buffer;\n\nvar isBufferEncoding = Buffer.isEncoding\n || function(encoding) {\n switch (encoding && encoding.toLowerCase()) {\n 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': return true;\n default: return false;\n }\n }\n\n\nfunction assertEncoding(encoding) {\n if (encoding && !isBufferEncoding(encoding)) {\n throw new Error('Unknown encoding: ' + encoding);\n }\n}\n\n// StringDecoder provides an interface for efficiently splitting a series of\n// buffers into a series of JS strings without breaking apart multi-byte\n// characters. CESU-8 is handled as part of the UTF-8 encoding.\n//\n// @TODO Handling all encodings inside a single object makes it very difficult\n// to reason about this code, so it should be split up in the future.\n// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code\n// points as used by CESU-8.\nvar StringDecoder = exports.StringDecoder = function(encoding) {\n this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');\n assertEncoding(encoding);\n switch (this.encoding) {\n case 'utf8':\n // CESU-8 represents each of Surrogate Pair by 3-bytes\n this.surrogateSize = 3;\n break;\n case 'ucs2':\n case 'utf16le':\n // UTF-16 represents each of Surrogate Pair by 2-bytes\n this.surrogateSize = 2;\n this.detectIncompleteChar = utf16DetectIncompleteChar;\n break;\n case 'base64':\n // Base-64 stores 3 bytes in 4 chars, and pads the remainder.\n this.surrogateSize = 3;\n this.detectIncompleteChar = base64DetectIncompleteChar;\n break;\n default:\n this.write = passThroughWrite;\n return;\n }\n\n // Enough space to store all bytes of a single character. UTF-8 needs 4\n // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).\n this.charBuffer = new Buffer(6);\n // Number of bytes received for the current incomplete multi-byte character.\n this.charReceived = 0;\n // Number of bytes expected for the current incomplete multi-byte character.\n this.charLength = 0;\n};\n\n\n// write decodes the given buffer and returns it as JS string that is\n// guaranteed to not contain any partial multi-byte characters. Any partial\n// character found at the end of the buffer is buffered up, and will be\n// returned when calling write again with the remaining bytes.\n//\n// Note: Converting a Buffer containing an orphan surrogate to a String\n// currently works, but converting a String to a Buffer (via `new Buffer`, or\n// Buffer#write) will replace incomplete surrogates with the unicode\n// replacement character. See https://codereview.chromium.org/121173009/ .\nStringDecoder.prototype.write = function(buffer) {\n var charStr = '';\n // if our last write ended with an incomplete multibyte character\n while (this.charLength) {\n // determine how many remaining bytes this buffer has to offer for this char\n var available = (buffer.length >= this.charLength - this.charReceived) ?\n this.charLength - this.charReceived :\n buffer.length;\n\n // add the new bytes to the char buffer\n buffer.copy(this.charBuffer, this.charReceived, 0, available);\n this.charReceived += available;\n\n if (this.charReceived < this.charLength) {\n // still not enough chars in this buffer? wait for more ...\n return '';\n }\n\n // remove bytes belonging to the current character from the buffer\n buffer = buffer.slice(available, buffer.length);\n\n // get the character that was split\n charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);\n\n // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character\n var charCode = charStr.charCodeAt(charStr.length - 1);\n if (charCode >= 0xD800 && charCode <= 0xDBFF) {\n this.charLength += this.surrogateSize;\n charStr = '';\n continue;\n }\n this.charReceived = this.charLength = 0;\n\n // if there are no more bytes in this buffer, just emit our char\n if (buffer.length === 0) {\n return charStr;\n }\n break;\n }\n\n // determine and set charLength / charReceived\n this.detectIncompleteChar(buffer);\n\n var end = buffer.length;\n if (this.charLength) {\n // buffer the incomplete character bytes we got\n buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);\n end -= this.charReceived;\n }\n\n charStr += buffer.toString(this.encoding, 0, end);\n\n var end = charStr.length - 1;\n var charCode = charStr.charCodeAt(end);\n // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character\n if (charCode >= 0xD800 && charCode <= 0xDBFF) {\n var size = this.surrogateSize;\n this.charLength += size;\n this.charReceived += size;\n this.charBuffer.copy(this.charBuffer, size, 0, size);\n buffer.copy(this.charBuffer, 0, 0, size);\n return charStr.substring(0, end);\n }\n\n // or just emit the charStr\n return charStr;\n};\n\n// detectIncompleteChar determines if there is an incomplete UTF-8 character at\n// the end of the given buffer. If so, it sets this.charLength to the byte\n// length that character, and sets this.charReceived to the number of bytes\n// that are available for this character.\nStringDecoder.prototype.detectIncompleteChar = function(buffer) {\n // determine how many bytes we have to check at the end of this buffer\n var i = (buffer.length >= 3) ? 3 : buffer.length;\n\n // Figure out if one of the last i bytes of our buffer announces an\n // incomplete char.\n for (; i > 0; i--) {\n var c = buffer[buffer.length - i];\n\n // See http://en.wikipedia.org/wiki/UTF-8#Description\n\n // 110XXXXX\n if (i == 1 && c >> 5 == 0x06) {\n this.charLength = 2;\n break;\n }\n\n // 1110XXXX\n if (i <= 2 && c >> 4 == 0x0E) {\n this.charLength = 3;\n break;\n }\n\n // 11110XXX\n if (i <= 3 && c >> 3 == 0x1E) {\n this.charLength = 4;\n break;\n }\n }\n this.charReceived = i;\n};\n\nStringDecoder.prototype.end = function(buffer) {\n var res = '';\n if (buffer && buffer.length)\n res = this.write(buffer);\n\n if (this.charReceived) {\n var cr = this.charReceived;\n var buf = this.charBuffer;\n var enc = this.encoding;\n res += buf.slice(0, cr).toString(enc);\n }\n\n return res;\n};\n\nfunction passThroughWrite(buffer) {\n return buffer.toString(this.encoding);\n}\n\nfunction utf16DetectIncompleteChar(buffer) {\n this.charReceived = buffer.length % 2;\n this.charLength = this.charReceived ? 2 : 0;\n}\n\nfunction base64DetectIncompleteChar(buffer) {\n this.charReceived = buffer.length % 3;\n this.charLength = this.charReceived ? 3 : 0;\n}\n\n},{\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/util/support/isBufferBrowser.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/assert/node_modules/util/support/isBufferBrowser.js\"][0].apply(exports,arguments)\n},{}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/util/util.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/assert/node_modules/util/util.js\"][0].apply(exports,arguments)\n},{\"./support/isBuffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/util/support/isBufferBrowser.js\",\"_process\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/process/browser.js\",\"inherits\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/inherits/inherits_browser.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/vm-browserify/index.js\":[function(require,module,exports){\nvar indexOf = require('indexof');\n\nvar Object_keys = function (obj) {\n if (Object.keys) return Object.keys(obj)\n else {\n var res = [];\n for (var key in obj) res.push(key)\n return res;\n }\n};\n\nvar forEach = function (xs, fn) {\n if (xs.forEach) return xs.forEach(fn)\n else for (var i = 0; i < xs.length; i++) {\n fn(xs[i], i, xs);\n }\n};\n\nvar defineProp = (function() {\n try {\n Object.defineProperty({}, '_', {});\n return function(obj, name, value) {\n Object.defineProperty(obj, name, {\n writable: true,\n enumerable: false,\n configurable: true,\n value: value\n })\n };\n } catch(e) {\n return function(obj, name, value) {\n obj[name] = value;\n };\n }\n}());\n\nvar globals = ['Array', 'Boolean', 'Date', 'Error', 'EvalError', 'Function',\n'Infinity', 'JSON', 'Math', 'NaN', 'Number', 'Object', 'RangeError',\n'ReferenceError', 'RegExp', 'String', 'SyntaxError', 'TypeError', 'URIError',\n'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'escape',\n'eval', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'undefined', 'unescape'];\n\nfunction Context() {}\nContext.prototype = {};\n\nvar Script = exports.Script = function NodeScript (code) {\n if (!(this instanceof Script)) return new Script(code);\n this.code = code;\n};\n\nScript.prototype.runInContext = function (context) {\n if (!(context instanceof Context)) {\n throw new TypeError(\"needs a 'context' argument.\");\n }\n \n var iframe = document.createElement('iframe');\n if (!iframe.style) iframe.style = {};\n iframe.style.display = 'none';\n \n document.body.appendChild(iframe);\n \n var win = iframe.contentWindow;\n var wEval = win.eval, wExecScript = win.execScript;\n\n if (!wEval && wExecScript) {\n // win.eval() magically appears when this is called in IE:\n wExecScript.call(win, 'null');\n wEval = win.eval;\n }\n \n forEach(Object_keys(context), function (key) {\n win[key] = context[key];\n });\n forEach(globals, function (key) {\n if (context[key]) {\n win[key] = context[key];\n }\n });\n \n var winKeys = Object_keys(win);\n\n var res = wEval.call(win, this.code);\n \n forEach(Object_keys(win), function (key) {\n // Avoid copying circular objects like `top` and `window` by only\n // updating existing context properties or new properties in the `win`\n // that was only introduced after the eval.\n if (key in context || indexOf(winKeys, key) === -1) {\n context[key] = win[key];\n }\n });\n\n forEach(globals, function (key) {\n if (!(key in context)) {\n defineProp(context, key, win[key]);\n }\n });\n \n document.body.removeChild(iframe);\n \n return res;\n};\n\nScript.prototype.runInThisContext = function () {\n return eval(this.code); // maybe...\n};\n\nScript.prototype.runInNewContext = function (context) {\n var ctx = Script.createContext(context);\n var res = this.runInContext(ctx);\n\n forEach(Object_keys(ctx), function (key) {\n context[key] = ctx[key];\n });\n\n return res;\n};\n\nforEach(Object_keys(Script.prototype), function (name) {\n exports[name] = Script[name] = function (code) {\n var s = Script(code);\n return s[name].apply(s, [].slice.call(arguments, 1));\n };\n});\n\nexports.createScript = function (code) {\n return exports.Script(code);\n};\n\nexports.createContext = Script.createContext = function (context) {\n var copy = new Context();\n if(typeof context === 'object') {\n forEach(Object_keys(context), function (key) {\n copy[key] = context[key];\n });\n }\n return copy;\n};\n\n},{\"indexof\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/vm-browserify/node_modules/indexof/index.js\"}],\"/home/itay/dev/pockets/node_modules/browserify/node_modules/vm-browserify/node_modules/indexof/index.js\":[function(require,module,exports){\n\nvar indexOf = [].indexOf;\n\nmodule.exports = function(arr, obj){\n if (indexOf) return arr.indexOf(obj);\n for (var i = 0; i < arr.length; ++i) {\n if (arr[i] === obj) return i;\n }\n return -1;\n};\n},{}],\"/home/itay/dev/pockets/node_modules/bs58/lib/bs58.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/bs58check/node_modules/bs58/lib/bs58.js\"][0].apply(exports,arguments)\n},{}],\"/home/itay/dev/pockets/node_modules/ecurve/lib/curve.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/curve.js\"][0].apply(exports,arguments)\n},{\"./point\":\"/home/itay/dev/pockets/node_modules/ecurve/lib/point.js\",\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"bigi\":\"/home/itay/dev/pockets/node_modules/bigi/lib/index.js\"}],\"/home/itay/dev/pockets/node_modules/ecurve/lib/curves.json\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/curves.json\"][0].apply(exports,arguments)\n},{}],\"/home/itay/dev/pockets/node_modules/ecurve/lib/index.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/index.js\"][0].apply(exports,arguments)\n},{\"./curve\":\"/home/itay/dev/pockets/node_modules/ecurve/lib/curve.js\",\"./names\":\"/home/itay/dev/pockets/node_modules/ecurve/lib/names.js\",\"./point\":\"/home/itay/dev/pockets/node_modules/ecurve/lib/point.js\"}],\"/home/itay/dev/pockets/node_modules/ecurve/lib/names.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/names.js\"][0].apply(exports,arguments)\n},{\"./curve\":\"/home/itay/dev/pockets/node_modules/ecurve/lib/curve.js\",\"./curves\":\"/home/itay/dev/pockets/node_modules/ecurve/lib/curves.json\",\"bigi\":\"/home/itay/dev/pockets/node_modules/bigi/lib/index.js\"}],\"/home/itay/dev/pockets/node_modules/ecurve/lib/point.js\":[function(require,module,exports){\narguments[4][\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/node_modules/ecurve/lib/point.js\"][0].apply(exports,arguments)\n},{\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"bigi\":\"/home/itay/dev/pockets/node_modules/bigi/lib/index.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\"}],\"/home/itay/dev/pockets/node_modules/eventemitter2/lib/eventemitter2.js\":[function(require,module,exports){\n/*!\n * EventEmitter2\n * https://github.com/hij1nx/EventEmitter2\n *\n * Copyright (c) 2013 hij1nx\n * Licensed under the MIT license.\n */\n;!function(undefined) {\n\n var isArray = Array.isArray ? Array.isArray : function _isArray(obj) {\n return Object.prototype.toString.call(obj) === \"[object Array]\";\n };\n var defaultMaxListeners = 10;\n\n function init() {\n this._events = {};\n if (this._conf) {\n configure.call(this, this._conf);\n }\n }\n\n function configure(conf) {\n if (conf) {\n\n this._conf = conf;\n\n conf.delimiter && (this.delimiter = conf.delimiter);\n conf.maxListeners && (this._events.maxListeners = conf.maxListeners);\n conf.wildcard && (this.wildcard = conf.wildcard);\n conf.newListener && (this.newListener = conf.newListener);\n\n if (this.wildcard) {\n this.listenerTree = {};\n }\n }\n }\n\n function EventEmitter(conf) {\n this._events = {};\n this.newListener = false;\n configure.call(this, conf);\n }\n\n //\n // Attention, function return type now is array, always !\n // It has zero elements if no any matches found and one or more\n // elements (leafs) if there are matches\n //\n function searchListenerTree(handlers, type, tree, i) {\n if (!tree) {\n return [];\n }\n var listeners=[], leaf, len, branch, xTree, xxTree, isolatedBranch, endReached,\n typeLength = type.length, currentType = type[i], nextType = type[i+1];\n if (i === typeLength && tree._listeners) {\n //\n // If at the end of the event(s) list and the tree has listeners\n // invoke those listeners.\n //\n if (typeof tree._listeners === 'function') {\n handlers && handlers.push(tree._listeners);\n return [tree];\n } else {\n for (leaf = 0, len = tree._listeners.length; leaf < len; leaf++) {\n handlers && handlers.push(tree._listeners[leaf]);\n }\n return [tree];\n }\n }\n\n if ((currentType === '*' || currentType === '**') || tree[currentType]) {\n //\n // If the event emitted is '*' at this part\n // or there is a concrete match at this patch\n //\n if (currentType === '*') {\n for (branch in tree) {\n if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {\n listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+1));\n }\n }\n return listeners;\n } else if(currentType === '**') {\n endReached = (i+1 === typeLength || (i+2 === typeLength && nextType === '*'));\n if(endReached && tree._listeners) {\n // The next element has a _listeners, add it to the handlers.\n listeners = listeners.concat(searchListenerTree(handlers, type, tree, typeLength));\n }\n\n for (branch in tree) {\n if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {\n if(branch === '*' || branch === '**') {\n if(tree[branch]._listeners && !endReached) {\n listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], typeLength));\n }\n listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i));\n } else if(branch === nextType) {\n listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+2));\n } else {\n // No match on this one, shift into the tree but not in the type array.\n listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i));\n }\n }\n }\n return listeners;\n }\n\n listeners = listeners.concat(searchListenerTree(handlers, type, tree[currentType], i+1));\n }\n\n xTree = tree['*'];\n if (xTree) {\n //\n // If the listener tree will allow any match for this part,\n // then recursively explore all branches of the tree\n //\n searchListenerTree(handlers, type, xTree, i+1);\n }\n\n xxTree = tree['**'];\n if(xxTree) {\n if(i < typeLength) {\n if(xxTree._listeners) {\n // If we have a listener on a '**', it will catch all, so add its handler.\n searchListenerTree(handlers, type, xxTree, typeLength);\n }\n\n // Build arrays of matching next branches and others.\n for(branch in xxTree) {\n if(branch !== '_listeners' && xxTree.hasOwnProperty(branch)) {\n if(branch === nextType) {\n // We know the next element will match, so jump twice.\n searchListenerTree(handlers, type, xxTree[branch], i+2);\n } else if(branch === currentType) {\n // Current node matches, move into the tree.\n searchListenerTree(handlers, type, xxTree[branch], i+1);\n } else {\n isolatedBranch = {};\n isolatedBranch[branch] = xxTree[branch];\n searchListenerTree(handlers, type, { '**': isolatedBranch }, i+1);\n }\n }\n }\n } else if(xxTree._listeners) {\n // We have reached the end and still on a '**'\n searchListenerTree(handlers, type, xxTree, typeLength);\n } else if(xxTree['*'] && xxTree['*']._listeners) {\n searchListenerTree(handlers, type, xxTree['*'], typeLength);\n }\n }\n\n return listeners;\n }\n\n function growListenerTree(type, listener) {\n\n type = typeof type === 'string' ? type.split(this.delimiter) : type.slice();\n\n //\n // Looks for two consecutive '**', if so, don't add the event at all.\n //\n for(var i = 0, len = type.length; i+1 < len; i++) {\n if(type[i] === '**' && type[i+1] === '**') {\n return;\n }\n }\n\n var tree = this.listenerTree;\n var name = type.shift();\n\n while (name) {\n\n if (!tree[name]) {\n tree[name] = {};\n }\n\n tree = tree[name];\n\n if (type.length === 0) {\n\n if (!tree._listeners) {\n tree._listeners = listener;\n }\n else if(typeof tree._listeners === 'function') {\n tree._listeners = [tree._listeners, listener];\n }\n else if (isArray(tree._listeners)) {\n\n tree._listeners.push(listener);\n\n if (!tree._listeners.warned) {\n\n var m = defaultMaxListeners;\n\n if (typeof this._events.maxListeners !== 'undefined') {\n m = this._events.maxListeners;\n }\n\n if (m > 0 && tree._listeners.length > m) {\n\n tree._listeners.warned = true;\n console.error('(node) warning: possible EventEmitter memory ' +\n 'leak detected. %d listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.',\n tree._listeners.length);\n console.trace();\n }\n }\n }\n return true;\n }\n name = type.shift();\n }\n return true;\n }\n\n // By default EventEmitters will print a warning if more than\n // 10 listeners are added to it. This is a useful default which\n // helps finding memory leaks.\n //\n // Obviously not all Emitters should be limited to 10. This function allows\n // that to be increased. Set to zero for unlimited.\n\n EventEmitter.prototype.delimiter = '.';\n\n EventEmitter.prototype.setMaxListeners = function(n) {\n this._events || init.call(this);\n this._events.maxListeners = n;\n if (!this._conf) this._conf = {};\n this._conf.maxListeners = n;\n };\n\n EventEmitter.prototype.event = '';\n\n EventEmitter.prototype.once = function(event, fn) {\n this.many(event, 1, fn);\n return this;\n };\n\n EventEmitter.prototype.many = function(event, ttl, fn) {\n var self = this;\n\n if (typeof fn !== 'function') {\n throw new Error('many only accepts instances of Function');\n }\n\n function listener() {\n if (--ttl === 0) {\n self.off(event, listener);\n }\n fn.apply(this, arguments);\n }\n\n listener._origin = fn;\n\n this.on(event, listener);\n\n return self;\n };\n\n EventEmitter.prototype.emit = function() {\n\n this._events || init.call(this);\n\n var type = arguments[0];\n\n if (type === 'newListener' && !this.newListener) {\n if (!this._events.newListener) { return false; }\n }\n\n // Loop through the *_all* functions and invoke them.\n if (this._all) {\n var l = arguments.length;\n var args = new Array(l - 1);\n for (var i = 1; i < l; i++) args[i - 1] = arguments[i];\n for (i = 0, l = this._all.length; i < l; i++) {\n this.event = type;\n this._all[i].apply(this, args);\n }\n }\n\n // If there is no 'error' event listener then throw.\n if (type === 'error') {\n\n if (!this._all &&\n !this._events.error &&\n !(this.wildcard && this.listenerTree.error)) {\n\n if (arguments[1] instanceof Error) {\n throw arguments[1]; // Unhandled 'error' event\n } else {\n throw new Error(\"Uncaught, unspecified 'error' event.\");\n }\n return false;\n }\n }\n\n var handler;\n\n if(this.wildcard) {\n handler = [];\n var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();\n searchListenerTree.call(this, handler, ns, this.listenerTree, 0);\n }\n else {\n handler = this._events[type];\n }\n\n if (typeof handler === 'function') {\n this.event = type;\n if (arguments.length === 1) {\n handler.call(this);\n }\n else if (arguments.length > 1)\n switch (arguments.length) {\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n default:\n var l = arguments.length;\n var args = new Array(l - 1);\n for (var i = 1; i < l; i++) args[i - 1] = arguments[i];\n handler.apply(this, args);\n }\n return true;\n }\n else if (handler) {\n var l = arguments.length;\n var args = new Array(l - 1);\n for (var i = 1; i < l; i++) args[i - 1] = arguments[i];\n\n var listeners = handler.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n this.event = type;\n listeners[i].apply(this, args);\n }\n return (listeners.length > 0) || !!this._all;\n }\n else {\n return !!this._all;\n }\n\n };\n\n EventEmitter.prototype.on = function(type, listener) {\n\n if (typeof type === 'function') {\n this.onAny(type);\n return this;\n }\n\n if (typeof listener !== 'function') {\n throw new Error('on only accepts instances of Function');\n }\n this._events || init.call(this);\n\n // To avoid recursion in the case that type == \"newListeners\"! Before\n // adding it to the listeners, first emit \"newListeners\".\n this.emit('newListener', type, listener);\n\n if(this.wildcard) {\n growListenerTree.call(this, type, listener);\n return this;\n }\n\n if (!this._events[type]) {\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n }\n else if(typeof this._events[type] === 'function') {\n // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener];\n }\n else if (isArray(this._events[type])) {\n // If we've already got an array, just append.\n this._events[type].push(listener);\n\n // Check for listener leak\n if (!this._events[type].warned) {\n\n var m = defaultMaxListeners;\n\n if (typeof this._events.maxListeners !== 'undefined') {\n m = this._events.maxListeners;\n }\n\n if (m > 0 && this._events[type].length > m) {\n\n this._events[type].warned = true;\n console.error('(node) warning: possible EventEmitter memory ' +\n 'leak detected. %d listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.',\n this._events[type].length);\n console.trace();\n }\n }\n }\n return this;\n };\n\n EventEmitter.prototype.onAny = function(fn) {\n\n if (typeof fn !== 'function') {\n throw new Error('onAny only accepts instances of Function');\n }\n\n if(!this._all) {\n this._all = [];\n }\n\n // Add the function to the event listener collection.\n this._all.push(fn);\n return this;\n };\n\n EventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n EventEmitter.prototype.off = function(type, listener) {\n if (typeof listener !== 'function') {\n throw new Error('removeListener only takes instances of Function');\n }\n\n var handlers,leafs=[];\n\n if(this.wildcard) {\n var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();\n leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0);\n }\n else {\n // does not use listeners(), so no side effect of creating _events[type]\n if (!this._events[type]) return this;\n handlers = this._events[type];\n leafs.push({_listeners:handlers});\n }\n\n for (var iLeaf=0; iLeaf 0) {\n fns = this._all;\n for(i = 0, l = fns.length; i < l; i++) {\n if(fn === fns[i]) {\n fns.splice(i, 1);\n return this;\n }\n }\n } else {\n this._all = [];\n }\n return this;\n };\n\n EventEmitter.prototype.removeListener = EventEmitter.prototype.off;\n\n EventEmitter.prototype.removeAllListeners = function(type) {\n if (arguments.length === 0) {\n !this._events || init.call(this);\n return this;\n }\n\n if(this.wildcard) {\n var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();\n var leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0);\n\n for (var iLeaf=0; iLeaf this.quota) {\n throw new QUOTA_EXCEEDED_ERR();\n }\n fs.writeFileSync(filename, valueString, 'utf8');\n if (!existsBeforeSet) {\n this.keys.push(key);\n this.length = this.keys.length;\n return this.bytesInUse += valueStringLength;\n }\n };\n\n LocalStorage.prototype.getItem = function(key) {\n var filename;\n key = key.toString();\n filename = path.join(this.location, encodeURIComponent(key));\n if (fs.existsSync(filename)) {\n return fs.readFileSync(filename, 'utf8');\n } else {\n return null;\n }\n };\n\n LocalStorage.prototype.getStat = function(key) {\n var filename;\n key = key.toString();\n filename = path.join(this.location, encodeURIComponent(key));\n if (fs.existsSync(filename)) {\n return fs.statSync(filename, 'utf8');\n } else {\n return null;\n }\n };\n\n LocalStorage.prototype.removeItem = function(key) {\n var filename;\n key = key.toString();\n filename = path.join(this.location, encodeURIComponent(key));\n if (fs.existsSync(filename)) {\n _rm(filename);\n }\n return this._init();\n };\n\n LocalStorage.prototype.key = function(n) {\n return this.keys[n];\n };\n\n LocalStorage.prototype.clear = function() {\n _emptyDirectory(this.location);\n this.keys = [];\n this.length = 0;\n return this.bytesInUse = 0;\n };\n\n LocalStorage.prototype.getBytesInUse = function() {\n return this.bytesInUse;\n };\n\n LocalStorage.prototype._deleteLocation = function() {\n _rm(this.location);\n this.keys = [];\n this.length = 0;\n return this.bytesInUse = 0;\n };\n\n return LocalStorage;\n\n })();\n\n JSONStorage = (function(_super) {\n __extends(JSONStorage, _super);\n\n function JSONStorage() {\n return JSONStorage.__super__.constructor.apply(this, arguments);\n }\n\n JSONStorage.prototype.setItem = function(key, value) {\n var newValue;\n newValue = JSON.stringify(value);\n return JSONStorage.__super__.setItem.call(this, key, newValue);\n };\n\n JSONStorage.prototype.getItem = function(key) {\n return JSON.parse(JSONStorage.__super__.getItem.call(this, key));\n };\n\n return JSONStorage;\n\n })(LocalStorage);\n\n exports.LocalStorage = LocalStorage;\n\n exports.JSONStorage = JSONStorage;\n\n exports.QUOTA_EXCEEDED_ERR = QUOTA_EXCEEDED_ERR;\n\n}).call(this);\n\n},{\"fs\":\"/home/itay/dev/pockets/node_modules/browserify/lib/_empty.js\",\"path\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/path-browserify/index.js\"}],\"/home/itay/dev/pockets/node_modules/thenify-all/index.js\":[function(require,module,exports){\n\nvar thenify = require('thenify')\n\nmodule.exports = thenifyAll\nthenifyAll.withCallback = withCallback\nthenifyAll.thenify = thenify\n\n/**\n * Promisifies all the selected functions in an object.\n *\n * @param {Object} source the source object for the async functions\n * @param {Object} [destination] the destination to set all the promisified methods\n * @param {Array} [methods] an array of method names of `source`\n * @return {Object}\n * @api public\n */\n\nfunction thenifyAll(source, destination, methods) {\n return promisifyAll(source, destination, methods, thenify)\n}\n\n/**\n * Promisifies all the selected functions in an object and backward compatible with callback.\n *\n * @param {Object} source the source object for the async functions\n * @param {Object} [destination] the destination to set all the promisified methods\n * @param {Array} [methods] an array of method names of `source`\n * @return {Object}\n * @api public\n */\n\nfunction withCallback(source, destination, methods) {\n return promisifyAll(source, destination, methods, thenify.withCallback)\n}\n\nfunction promisifyAll(source, destination, methods, promisify) {\n if (!destination) {\n destination = {};\n methods = Object.keys(source)\n }\n\n if (Array.isArray(destination)) {\n methods = destination\n destination = {}\n }\n\n if (!methods) {\n methods = Object.keys(source)\n }\n\n if (typeof source === 'function') destination = promisify(source)\n\n methods.forEach(function (name) {\n // promisify only if it's a function\n if (typeof source[name] === 'function') destination[name] = promisify(source[name])\n })\n\n // proxy the rest\n Object.keys(source).forEach(function (name) {\n if (deprecated(source, name)) return\n if (destination[name]) return\n destination[name] = source[name]\n })\n\n return destination\n}\n\nfunction deprecated(source, name) {\n var desc = Object.getOwnPropertyDescriptor(source, name)\n if (!desc || !desc.get) return false\n if (desc.get.name === 'deprecated') return true\n return false\n}\n\n},{\"thenify\":\"/home/itay/dev/pockets/node_modules/thenify-all/node_modules/thenify/index.js\"}],\"/home/itay/dev/pockets/node_modules/thenify-all/node_modules/thenify/index.js\":[function(require,module,exports){\n\nvar Promise = require('native-or-bluebird')\nvar assert = require('assert')\n\nmodule.exports = thenify\n\n/**\n * Turn async functions into promises\n *\n * @param {Function} $$__fn__$$\n * @return {Function}\n * @api public\n */\n\nfunction thenify($$__fn__$$) {\n assert(typeof $$__fn__$$ === 'function')\n return eval(createWraper($$__fn__$$.name))\n}\n\n/**\n * Turn async functions into promises and backward compatible with callback\n *\n * @param {Function} $$__fn__$$\n * @return {Function}\n * @api public\n */\n\nthenify.withCallback = function ($$__fn__$$) {\n assert(typeof $$__fn__$$ === 'function')\n return eval(createWraper($$__fn__$$.name, true))\n}\n\nfunction createCallback(resolve, reject) {\n return function(err, value) {\n if (err) return reject(err)\n var length = arguments.length\n if (length <= 2) return resolve(value)\n var values = new Array(length - 1)\n for (var i = 1; i < length; ++i) values[i - 1] = arguments[i]\n resolve(values)\n }\n}\n\nfunction createWraper(name, withCallback) {\n withCallback = withCallback ?\n 'var lastType = typeof arguments[len - 1]\\n'\n + 'if (lastType === \"function\") return $$__fn__$$.apply(self, arguments)\\n'\n : ''\n\n return '(function ' + (name || '') + '() {\\n'\n + 'var self = this\\n'\n + 'var len = arguments.length\\n'\n + withCallback\n + 'var args = new Array(len + 1)\\n'\n + 'for (var i = 0; i < len; ++i) args[i] = arguments[i]\\n'\n + 'var lastIndex = i\\n'\n + 'return new Promise(function (resolve, reject) {\\n'\n + 'args[lastIndex] = createCallback(resolve, reject)\\n'\n + '$$__fn__$$.apply(self, args)\\n'\n + '})\\n'\n + '})'\n}\n\n},{\"assert\":\"/home/itay/dev/pockets/node_modules/assert/assert.js\",\"native-or-bluebird\":\"/home/itay/dev/pockets/node_modules/thenify-all/node_modules/thenify/node_modules/native-or-bluebird/index.js\"}],\"/home/itay/dev/pockets/node_modules/thenify-all/node_modules/thenify/node_modules/native-or-bluebird/index.js\":[function(require,module,exports){\n(function (process){\n\nmodule.exports = require('./promise')\n\n/* istanbul ignore next */\nif (!module.exports) {\n console.error('The file \"%s\" requires `Promise`,', module.parent.filename)\n console.error('but neither `bluebird` nor the native `Promise` implementation were found.')\n console.error('Please install `bluebird` yourself.')\n process.exit(1)\n}\n\n}).call(this,require('_process'))\n},{\"./promise\":\"/home/itay/dev/pockets/node_modules/thenify-all/node_modules/thenify/node_modules/native-or-bluebird/promise.js\",\"_process\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/process/browser.js\"}],\"/home/itay/dev/pockets/node_modules/thenify-all/node_modules/thenify/node_modules/native-or-bluebird/promise.js\":[function(require,module,exports){\n(function (global){\n\ntry {\n module.exports = require('bluebird')\n} catch (_) {\n module.exports = global.Promise\n}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"bluebird\":\"/home/itay/dev/pockets/node_modules/bluebird/js/browser/bluebird.js\"}],\"/home/itay/dev/pockets/node_modules/traverse/index.js\":[function(require,module,exports){\nvar traverse = module.exports = function (obj) {\n return new Traverse(obj);\n};\n\nfunction Traverse (obj) {\n this.value = obj;\n}\n\nTraverse.prototype.get = function (ps) {\n var node = this.value;\n for (var i = 0; i < ps.length; i ++) {\n var key = ps[i];\n if (!node || !hasOwnProperty.call(node, key)) {\n node = undefined;\n break;\n }\n node = node[key];\n }\n return node;\n};\n\nTraverse.prototype.has = function (ps) {\n var node = this.value;\n for (var i = 0; i < ps.length; i ++) {\n var key = ps[i];\n if (!node || !hasOwnProperty.call(node, key)) {\n return false;\n }\n node = node[key];\n }\n return true;\n};\n\nTraverse.prototype.set = function (ps, value) {\n var node = this.value;\n for (var i = 0; i < ps.length - 1; i ++) {\n var key = ps[i];\n if (!hasOwnProperty.call(node, key)) node[key] = {};\n node = node[key];\n }\n node[ps[i]] = value;\n return value;\n};\n\nTraverse.prototype.map = function (cb) {\n return walk(this.value, cb, true);\n};\n\nTraverse.prototype.forEach = function (cb) {\n this.value = walk(this.value, cb, false);\n return this.value;\n};\n\nTraverse.prototype.reduce = function (cb, init) {\n var skip = arguments.length === 1;\n var acc = skip ? this.value : init;\n this.forEach(function (x) {\n if (!this.isRoot || !skip) {\n acc = cb.call(this, acc, x);\n }\n });\n return acc;\n};\n\nTraverse.prototype.paths = function () {\n var acc = [];\n this.forEach(function (x) {\n acc.push(this.path); \n });\n return acc;\n};\n\nTraverse.prototype.nodes = function () {\n var acc = [];\n this.forEach(function (x) {\n acc.push(this.node);\n });\n return acc;\n};\n\nTraverse.prototype.clone = function () {\n var parents = [], nodes = [];\n \n return (function clone (src) {\n for (var i = 0; i < parents.length; i++) {\n if (parents[i] === src) {\n return nodes[i];\n }\n }\n \n if (typeof src === 'object' && src !== null) {\n var dst = copy(src);\n \n parents.push(src);\n nodes.push(dst);\n \n forEach(objectKeys(src), function (key) {\n dst[key] = clone(src[key]);\n });\n \n parents.pop();\n nodes.pop();\n return dst;\n }\n else {\n return src;\n }\n })(this.value);\n};\n\nfunction walk (root, cb, immutable) {\n var path = [];\n var parents = [];\n var alive = true;\n \n return (function walker (node_) {\n var node = immutable ? copy(node_) : node_;\n var modifiers = {};\n \n var keepGoing = true;\n \n var state = {\n node : node,\n node_ : node_,\n path : [].concat(path),\n parent : parents[parents.length - 1],\n parents : parents,\n key : path.slice(-1)[0],\n isRoot : path.length === 0,\n level : path.length,\n circular : null,\n update : function (x, stopHere) {\n if (!state.isRoot) {\n state.parent.node[state.key] = x;\n }\n state.node = x;\n if (stopHere) keepGoing = false;\n },\n 'delete' : function (stopHere) {\n delete state.parent.node[state.key];\n if (stopHere) keepGoing = false;\n },\n remove : function (stopHere) {\n if (isArray(state.parent.node)) {\n state.parent.node.splice(state.key, 1);\n }\n else {\n delete state.parent.node[state.key];\n }\n if (stopHere) keepGoing = false;\n },\n keys : null,\n before : function (f) { modifiers.before = f },\n after : function (f) { modifiers.after = f },\n pre : function (f) { modifiers.pre = f },\n post : function (f) { modifiers.post = f },\n stop : function () { alive = false },\n block : function () { keepGoing = false }\n };\n \n if (!alive) return state;\n \n function updateState() {\n if (typeof state.node === 'object' && state.node !== null) {\n if (!state.keys || state.node_ !== state.node) {\n state.keys = objectKeys(state.node)\n }\n \n state.isLeaf = state.keys.length == 0;\n \n for (var i = 0; i < parents.length; i++) {\n if (parents[i].node_ === node_) {\n state.circular = parents[i];\n break;\n }\n }\n }\n else {\n state.isLeaf = true;\n state.keys = null;\n }\n \n state.notLeaf = !state.isLeaf;\n state.notRoot = !state.isRoot;\n }\n \n updateState();\n \n // use return values to update if defined\n var ret = cb.call(state, state.node);\n if (ret !== undefined && state.update) state.update(ret);\n \n if (modifiers.before) modifiers.before.call(state, state.node);\n \n if (!keepGoing) return state;\n \n if (typeof state.node == 'object'\n && state.node !== null && !state.circular) {\n parents.push(state);\n \n updateState();\n \n forEach(state.keys, function (key, i) {\n path.push(key);\n \n if (modifiers.pre) modifiers.pre.call(state, state.node[key], key);\n \n var child = walker(state.node[key]);\n if (immutable && hasOwnProperty.call(state.node, key)) {\n state.node[key] = child.node;\n }\n \n child.isLast = i == state.keys.length - 1;\n child.isFirst = i == 0;\n \n if (modifiers.post) modifiers.post.call(state, child);\n \n path.pop();\n });\n parents.pop();\n }\n \n if (modifiers.after) modifiers.after.call(state, state.node);\n \n return state;\n })(root).node;\n}\n\nfunction copy (src) {\n if (typeof src === 'object' && src !== null) {\n var dst;\n \n if (isArray(src)) {\n dst = [];\n }\n else if (isDate(src)) {\n dst = new Date(src.getTime ? src.getTime() : src);\n }\n else if (isRegExp(src)) {\n dst = new RegExp(src);\n }\n else if (isError(src)) {\n dst = { message: src.message };\n }\n else if (isBoolean(src)) {\n dst = new Boolean(src);\n }\n else if (isNumber(src)) {\n dst = new Number(src);\n }\n else if (isString(src)) {\n dst = new String(src);\n }\n else if (Object.create && Object.getPrototypeOf) {\n dst = Object.create(Object.getPrototypeOf(src));\n }\n else if (src.constructor === Object) {\n dst = {};\n }\n else {\n var proto =\n (src.constructor && src.constructor.prototype)\n || src.__proto__\n || {}\n ;\n var T = function () {};\n T.prototype = proto;\n dst = new T;\n }\n \n forEach(objectKeys(src), function (key) {\n dst[key] = src[key];\n });\n return dst;\n }\n else return src;\n}\n\nvar objectKeys = Object.keys || function keys (obj) {\n var res = [];\n for (var key in obj) res.push(key)\n return res;\n};\n\nfunction toS (obj) { return Object.prototype.toString.call(obj) }\nfunction isDate (obj) { return toS(obj) === '[object Date]' }\nfunction isRegExp (obj) { return toS(obj) === '[object RegExp]' }\nfunction isError (obj) { return toS(obj) === '[object Error]' }\nfunction isBoolean (obj) { return toS(obj) === '[object Boolean]' }\nfunction isNumber (obj) { return toS(obj) === '[object Number]' }\nfunction isString (obj) { return toS(obj) === '[object String]' }\n\nvar isArray = Array.isArray || function isArray (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};\n\nvar forEach = function (xs, fn) {\n if (xs.forEach) return xs.forEach(fn)\n else for (var i = 0; i < xs.length; i++) {\n fn(xs[i], i, xs);\n }\n};\n\nforEach(objectKeys(Traverse.prototype), function (key) {\n traverse[key] = function (obj) {\n var args = [].slice.call(arguments, 1);\n var t = new Traverse(obj);\n return t[key].apply(t, args);\n };\n});\n\nvar hasOwnProperty = Object.hasOwnProperty || function (obj, key) {\n return key in obj;\n};\n\n},{}],\"/home/itay/dev/pockets/package.json\":[function(require,module,exports){\nmodule.exports={\n \"name\": \"pockets\",\n \"version\": \"1.0.0\",\n \"description\": \"pockets: An Ionic project\",\n \"scripts\": {\n \"test\": \"mocha\",\n \"test:coverage\": \"istanbul cover ./node_modules/.bin/_mocha -- -R dot test\",\n \"coveralls\": \"cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js\",\n \"build\": \"gulp build\"\n },\n \"dependencies\": {\n \"bigi\": \"^1.4.0\",\n \"bitcoinjs-lib\": \"^1.5.1\",\n \"bluebird\": \"^2.9.14\",\n \"bs58\": \"^2.0.1\",\n \"buffer\": \"^3.1.1\",\n \"ecurve\": \"^1.0.1\",\n \"eventemitter2\": \"^0.4.14\",\n \"node-localstorage\": \"^0.5.0\",\n \"thenify-all\": \"^1.6.0\",\n \"traverse\": \"^0.6.6\",\n \"underscore\": \"^1.8.2\"\n },\n \"devDependencies\": {\n \"brfs\": \"^1.4.0\",\n \"browserify\": \"^9.0.3\",\n \"assert\": \"^1.3.0\",\n \"bower\": \"^1.3.3\",\n \"chai\": \"^2.1.1\",\n \"coveralls\": \"^2.11.2\",\n \"gulp\": \"^3.5.6\",\n \"gulp-concat\": \"^2.2.0\",\n \"gulp-minify-css\": \"^0.3.0\",\n \"gulp-rename\": \"^1.2.0\",\n \"gulp-sass\": \"^0.7.1\",\n \"gulp-sourcemaps\": \"^1.5.0\",\n \"gulp-util\": \"^2.2.14\",\n \"istanbul\": \"^0.3.7\",\n \"mocha\": \"^2.2.1\",\n \"shelljs\": \"^0.3.0\",\n \"should\": \"^5.2.0\",\n \"sinon\": \"^1.13.0\",\n \"sinon-chai\": \"^2.7.0\",\n \"watchify\": \"^2.4.0\",\n \"vinyl-buffer\": \"^1.0.0\",\n \"vinyl-source-stream\": \"^1.1.0\"\n }\n}\n\n},{}],\"/home/itay/dev/pockets/www/lib/pockets/common/config.js\":[function(require,module,exports){\nvar config = module.exports;\n\nconfig.get = function (\n key) {\n return engine.db.get(key);\n};\n\nconfig.set = function (key, value) {\n return engine.db.set(key, value);\n};\n},{}],\"/home/itay/dev/pockets/www/lib/pockets/common/db.js\":[function(require,module,exports){\n(function (global){\nvar db = module.exports;\nif (typeof global.localStorage === 'undefined') {\n var LocalStorage = require('node-localstorage').LocalStorage;\n db._localStorage = new LocalStorage('./scratch');\n}\nelse\n db._localStorage = global.localStroage;\n\ndb.get = function (key) {\n return db._localStorage.getItem(key);\n};\n\ndb.set = function (key, value) {\n return db._localStorage.setItem(key, value);\n};\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"node-localstorage\":\"/home/itay/dev/pockets/node_modules/node-localstorage/LocalStorage.js\"}],\"/home/itay/dev/pockets/www/lib/pockets/common/events.js\":[function(require,module,exports){\nvar\n EventEmitter2 = require('eventemitter2').EventEmitter2;\n\nvar _events = new EventEmitter2({wildcard: true, newListener: true});\n\nmodule.exports = exports = _events;\n},{\"eventemitter2\":\"/home/itay/dev/pockets/node_modules/eventemitter2/lib/eventemitter2.js\"}],\"/home/itay/dev/pockets/www/lib/pockets/common/globals.js\":[function(require,module,exports){\n(function (global){\nglobal.emptyfunc = function () {\n\n};\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],\"/home/itay/dev/pockets/www/lib/pockets/common/index.js\":[function(require,module,exports){\nvar util = require('util');\n\nvar common = module.exports;\n\ncommon.extend = util._extend;\n\ncommon.inspect = function (obj) {\n console.log(util.inspect(obj, {depth: null, colors: true}));\n};\n},{\"util\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/util/util.js\"}],\"/home/itay/dev/pockets/www/lib/pockets/common/logger.js\":[function(require,module,exports){\nvar logger = module.exports;\n\n['silly', 'trace', 'debug', 'info', 'warn', 'error'].forEach(function (level) {\n logger[level] = function (msg) {\n if (console[level])\n console[level](msg);\n }\n});\n},{}],\"/home/itay/dev/pockets/www/lib/pockets/services/bitcoin.js\":[function(require,module,exports){\nvar\n _bitcoin = require('bitcoinjs-lib'),\n base58 = require('bs58'),\n ecurve = require('ecurve'),\n BigInteger = require('bigi'),\n Buffer = require('buffer');\n\nvar bitcoin = module.exports;\n\nbitcoin.validateWallet = function (options, callback) {\n function isAddress(string) {\n try {\n _bitcoin.Address.fromBase58Check(string);\n } catch (e) {\n return false;\n }\n return true;\n }\n\n if (isAddress(options.address))\n return callback(null);\n return callback(new Error('Invalid wallet address [' + options.address + '].'))\n};\n},{\"bigi\":\"/home/itay/dev/pockets/node_modules/bigi/lib/index.js\",\"bitcoinjs-lib\":\"/home/itay/dev/pockets/node_modules/bitcoinjs-lib/src/index.js\",\"bs58\":\"/home/itay/dev/pockets/node_modules/bs58/lib/bs58.js\",\"buffer\":\"/home/itay/dev/pockets/node_modules/browserify/node_modules/buffer/index.js\",\"ecurve\":\"/home/itay/dev/pockets/node_modules/ecurve/lib/index.js\"}],\"/home/itay/dev/pockets/www/lib/pockets/services/pockets.js\":[function(require,module,exports){\nvar traverse = require('traverse');\n\nvar pockets = module.exports;\n\npockets.ROOT = null;\n\npockets.list = function (options, callback) {\n callback = callback || emptyfunc;\n\n return callback(null, pockets.ROOT);\n};\n\npockets.get = function (options, callback) {\n callback = callback || emptyfunc;\n\n var result = null;\n traverse.map(pockets.ROOT, function (x) {\n var point = this;\n if (x && typeof x === 'object' && x.name) { //we have a pocket\n if (x.name === options.name)\n result = point;\n }\n });\n if (!result)\n return callback(new Error('Pocket [' + options.name + '] cannot be found.'));\n result = traverse.get(pockets.ROOT, result.path);\n return callback(null, result);\n};\n\npockets.create = function (options, callback) {\n callback = callback || emptyfunc;\n\n if (!options.parent) {\n pockets.ROOT = options;\n return callback(null);\n }\n else {\n pockets.get({name: options.parent}, function (err, pocket) {\n if (err)\n return callback(err);\n\n pocket.pockets = pocket.pockets || {};\n pocket.pockets[options.name] = options;\n return callback(null);\n });\n }\n};\n\npockets.update = function (options, callback) {\n callback = callback || emptyfunc;\n\n pockets.get(options, function (err, _pocket) {\n _pocket = engine.common.extend(_pocket, options);\n return callback(null);\n });\n};\n\npockets.delete = function (options, callback) {\n callback = callback || emptyfunc;\n\n traverse.forEach(pockets.ROOT, function (x) {\n var point = this;\n if (x && typeof x === 'object' && x.name) { //we have a pocket\n if (x.name === options.name) {\n delete point.parent.parent.node.pockets[options.name];\n }\n }\n });\n\n return callback(null);\n};\n},{\"traverse\":\"/home/itay/dev/pockets/node_modules/traverse/index.js\"}]},{},[\"./www/lib/pockets/engine.js\"]);\n"],"file":"pockets.bundle.js","sourceRoot":"/source/"} \ No newline at end of file diff --git a/www/lib/pockets/engine.js b/www/lib/pockets/engine.js index 4b766c0..5e5b314 100644 --- a/www/lib/pockets/engine.js +++ b/www/lib/pockets/engine.js @@ -16,11 +16,10 @@ engine.init = function (options, callback) { engine.bitcoin = require('./services/bitcoin'); engine.pockets = require('./services/pockets'); - engine.options = engine.common.extend(options || {}, { + engine.options = engine.common.extend({ //default options promisify: false - }); - console.log(engine.options); + }, options || {}); if (engine.options.promisify) engine.promisify(); engine.logger.info('Starting Pockets Library, version [' + engine.VERSION + '].'); @@ -33,8 +32,9 @@ engine.promisify = function () { engine.pockets = promisify(engine.pockets); }; -if (typeof global.localStorage !== 'undefined') - engine.init({promisify: true}); - //inject globals -require('./common/globals'); \ No newline at end of file +require('./common/globals'); + +//fire the engine up if we're running in a browser +if (typeof global.localStorage !== 'undefined') + engine.init({promisify: true}); \ No newline at end of file From 8f0274fbee8a8d035a3892deef10513067b1141b Mon Sep 17 00:00:00 2001 From: Itay Weinberger Date: Fri, 13 Mar 2015 00:49:59 +0200 Subject: [PATCH 02/20] #18 added listener. --- package.json | 4 + test/unit/8-listener.spec.js | 7 + www/js/pockets.bundle.js | 65705 +++++++++++++++++++------ www/js/pockets.bundle.js.map | 2 +- www/lib/pockets/engine.js | 2 + www/lib/pockets/services/listener.js | 42 + 6 files changed, 50864 insertions(+), 14898 deletions(-) create mode 100644 test/unit/8-listener.spec.js create mode 100644 www/lib/pockets/services/listener.js diff --git a/package.json b/package.json index 73a9b86..95e9abd 100644 --- a/package.json +++ b/package.json @@ -9,14 +9,18 @@ "build": "gulp build" }, "dependencies": { + "async": "^0.9.0", "bigi": "^1.4.0", "bitcoinjs-lib": "^1.5.1", "bluebird": "^2.9.14", + "browser-request": "^0.3.3", "bs58": "^2.0.1", "buffer": "^3.1.1", "ecurve": "^1.0.1", "eventemitter2": "^0.4.14", "node-localstorage": "^0.5.0", + "request": "^2.53.0", + "socket.io-client": "^1.3.5", "thenify-all": "^1.6.0", "traverse": "^0.6.6", "underscore": "^1.8.2" diff --git a/test/unit/8-listener.spec.js b/test/unit/8-listener.spec.js new file mode 100644 index 0000000..2b05f3c --- /dev/null +++ b/test/unit/8-listener.spec.js @@ -0,0 +1,7 @@ +describe("listener", function () { + xit("should listen for a wallet update", function (done) { + engine.listener.add('mpSKAvSLeZTHbstNEzYKs7fxw9fat6a1Y5'); + engine.events.on('wallet-update',done); + //now send the money + }); +}); \ No newline at end of file diff --git a/www/js/pockets.bundle.js b/www/js/pockets.bundle.js index 7501468..fe62338 100644 --- a/www/js/pockets.bundle.js +++ b/www/js/pockets.bundle.js @@ -17,12 +17,12 @@ engine.init = function (options, callback) { //services engine.bitcoin = require('./services/bitcoin'); engine.pockets = require('./services/pockets'); + engine.listener = require('./services/listener'); - engine.options = engine.common.extend(options || {}, { + engine.options = engine.common.extend({ //default options - //promisify: false - }); - console.log(engine.options); + promisify: false + }, options || {}); if (engine.options.promisify) engine.promisify(); engine.logger.info('Starting Pockets Library, version [' + engine.VERSION + '].'); @@ -33,6 +33,7 @@ engine.promisify = function () { var promisify = require('thenify-all'); engine.bitcoin = promisify(engine.bitcoin); engine.pockets = promisify(engine.pockets); + engine.listener = promisify(engine.listener); }; //inject globals @@ -42,7 +43,7 @@ require('./common/globals'); if (typeof global.localStorage !== 'undefined') engine.init({promisify: true}); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../../../package.json":"/home/itay/dev/pockets/package.json","./common/config":"/home/itay/dev/pockets/www/lib/pockets/common/config.js","./common/db":"/home/itay/dev/pockets/www/lib/pockets/common/db.js","./common/events":"/home/itay/dev/pockets/www/lib/pockets/common/events.js","./common/globals":"/home/itay/dev/pockets/www/lib/pockets/common/globals.js","./common/index":"/home/itay/dev/pockets/www/lib/pockets/common/index.js","./common/logger":"/home/itay/dev/pockets/www/lib/pockets/common/logger.js","./services/bitcoin":"/home/itay/dev/pockets/www/lib/pockets/services/bitcoin.js","./services/pockets":"/home/itay/dev/pockets/www/lib/pockets/services/pockets.js","thenify-all":"/home/itay/dev/pockets/node_modules/thenify-all/index.js"}],"/home/itay/dev/pockets/node_modules/assert/assert.js":[function(require,module,exports){ +},{"../../../package.json":"/home/itay/dev/pockets/package.json","./common/config":"/home/itay/dev/pockets/www/lib/pockets/common/config.js","./common/db":"/home/itay/dev/pockets/www/lib/pockets/common/db.js","./common/events":"/home/itay/dev/pockets/www/lib/pockets/common/events.js","./common/globals":"/home/itay/dev/pockets/www/lib/pockets/common/globals.js","./common/index":"/home/itay/dev/pockets/www/lib/pockets/common/index.js","./common/logger":"/home/itay/dev/pockets/www/lib/pockets/common/logger.js","./services/bitcoin":"/home/itay/dev/pockets/www/lib/pockets/services/bitcoin.js","./services/listener":"/home/itay/dev/pockets/www/lib/pockets/services/listener.js","./services/pockets":"/home/itay/dev/pockets/www/lib/pockets/services/pockets.js","thenify-all":"/home/itay/dev/pockets/node_modules/thenify-all/index.js"}],"/home/itay/dev/pockets/node_modules/assert/assert.js":[function(require,module,exports){ // http://wiki.commonjs.org/wiki/Unit_Testing/1.0 // // THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! @@ -1025,7 +1026,1134 @@ function hasOwnProperty(obj, prop) { } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":"/home/itay/dev/pockets/node_modules/assert/node_modules/util/support/isBufferBrowser.js","_process":"/home/itay/dev/pockets/node_modules/browserify/node_modules/process/browser.js","inherits":"/home/itay/dev/pockets/node_modules/assert/node_modules/util/node_modules/inherits/inherits_browser.js"}],"/home/itay/dev/pockets/node_modules/bigi/lib/bigi.js":[function(require,module,exports){ +},{"./support/isBuffer":"/home/itay/dev/pockets/node_modules/assert/node_modules/util/support/isBufferBrowser.js","_process":"/home/itay/dev/pockets/node_modules/browserify/node_modules/process/browser.js","inherits":"/home/itay/dev/pockets/node_modules/assert/node_modules/util/node_modules/inherits/inherits_browser.js"}],"/home/itay/dev/pockets/node_modules/async/lib/async.js":[function(require,module,exports){ +(function (process){ +/*! + * async + * https://github.com/caolan/async + * + * Copyright 2010-2014 Caolan McMahon + * Released under the MIT license + */ +/*jshint onevar: false, indent:4 */ +/*global setImmediate: false, setTimeout: false, console: false */ +(function () { + + var async = {}; + + // global on the server, window in the browser + var root, previous_async; + + root = this; + if (root != null) { + previous_async = root.async; + } + + async.noConflict = function () { + root.async = previous_async; + return async; + }; + + function only_once(fn) { + var called = false; + return function() { + if (called) throw new Error("Callback was already called."); + called = true; + fn.apply(root, arguments); + } + } + + //// cross-browser compatiblity functions //// + + var _toString = Object.prototype.toString; + + var _isArray = Array.isArray || function (obj) { + return _toString.call(obj) === '[object Array]'; + }; + + var _each = function (arr, iterator) { + if (arr.forEach) { + return arr.forEach(iterator); + } + for (var i = 0; i < arr.length; i += 1) { + iterator(arr[i], i, arr); + } + }; + + var _map = function (arr, iterator) { + if (arr.map) { + return arr.map(iterator); + } + var results = []; + _each(arr, function (x, i, a) { + results.push(iterator(x, i, a)); + }); + return results; + }; + + var _reduce = function (arr, iterator, memo) { + if (arr.reduce) { + return arr.reduce(iterator, memo); + } + _each(arr, function (x, i, a) { + memo = iterator(memo, x, i, a); + }); + return memo; + }; + + var _keys = function (obj) { + if (Object.keys) { + return Object.keys(obj); + } + var keys = []; + for (var k in obj) { + if (obj.hasOwnProperty(k)) { + keys.push(k); + } + } + return keys; + }; + + //// exported async module functions //// + + //// nextTick implementation with browser-compatible fallback //// + if (typeof process === 'undefined' || !(process.nextTick)) { + if (typeof setImmediate === 'function') { + async.nextTick = function (fn) { + // not a direct alias for IE10 compatibility + setImmediate(fn); + }; + async.setImmediate = async.nextTick; + } + else { + async.nextTick = function (fn) { + setTimeout(fn, 0); + }; + async.setImmediate = async.nextTick; + } + } + else { + async.nextTick = process.nextTick; + if (typeof setImmediate !== 'undefined') { + async.setImmediate = function (fn) { + // not a direct alias for IE10 compatibility + setImmediate(fn); + }; + } + else { + async.setImmediate = async.nextTick; + } + } + + async.each = function (arr, iterator, callback) { + callback = callback || function () {}; + if (!arr.length) { + return callback(); + } + var completed = 0; + _each(arr, function (x) { + iterator(x, only_once(done) ); + }); + function done(err) { + if (err) { + callback(err); + callback = function () {}; + } + else { + completed += 1; + if (completed >= arr.length) { + callback(); + } + } + } + }; + async.forEach = async.each; + + async.eachSeries = function (arr, iterator, callback) { + callback = callback || function () {}; + if (!arr.length) { + return callback(); + } + var completed = 0; + var iterate = function () { + iterator(arr[completed], function (err) { + if (err) { + callback(err); + callback = function () {}; + } + else { + completed += 1; + if (completed >= arr.length) { + callback(); + } + else { + iterate(); + } + } + }); + }; + iterate(); + }; + async.forEachSeries = async.eachSeries; + + async.eachLimit = function (arr, limit, iterator, callback) { + var fn = _eachLimit(limit); + fn.apply(null, [arr, iterator, callback]); + }; + async.forEachLimit = async.eachLimit; + + var _eachLimit = function (limit) { + + return function (arr, iterator, callback) { + callback = callback || function () {}; + if (!arr.length || limit <= 0) { + return callback(); + } + var completed = 0; + var started = 0; + var running = 0; + + (function replenish () { + if (completed >= arr.length) { + return callback(); + } + + while (running < limit && started < arr.length) { + started += 1; + running += 1; + iterator(arr[started - 1], function (err) { + if (err) { + callback(err); + callback = function () {}; + } + else { + completed += 1; + running -= 1; + if (completed >= arr.length) { + callback(); + } + else { + replenish(); + } + } + }); + } + })(); + }; + }; + + + var doParallel = function (fn) { + return function () { + var args = Array.prototype.slice.call(arguments); + return fn.apply(null, [async.each].concat(args)); + }; + }; + var doParallelLimit = function(limit, fn) { + return function () { + var args = Array.prototype.slice.call(arguments); + return fn.apply(null, [_eachLimit(limit)].concat(args)); + }; + }; + var doSeries = function (fn) { + return function () { + var args = Array.prototype.slice.call(arguments); + return fn.apply(null, [async.eachSeries].concat(args)); + }; + }; + + + var _asyncMap = function (eachfn, arr, iterator, callback) { + arr = _map(arr, function (x, i) { + return {index: i, value: x}; + }); + if (!callback) { + eachfn(arr, function (x, callback) { + iterator(x.value, function (err) { + callback(err); + }); + }); + } else { + var results = []; + eachfn(arr, function (x, callback) { + iterator(x.value, function (err, v) { + results[x.index] = v; + callback(err); + }); + }, function (err) { + callback(err, results); + }); + } + }; + async.map = doParallel(_asyncMap); + async.mapSeries = doSeries(_asyncMap); + async.mapLimit = function (arr, limit, iterator, callback) { + return _mapLimit(limit)(arr, iterator, callback); + }; + + var _mapLimit = function(limit) { + return doParallelLimit(limit, _asyncMap); + }; + + // reduce only has a series version, as doing reduce in parallel won't + // work in many situations. + async.reduce = function (arr, memo, iterator, callback) { + async.eachSeries(arr, function (x, callback) { + iterator(memo, x, function (err, v) { + memo = v; + callback(err); + }); + }, function (err) { + callback(err, memo); + }); + }; + // inject alias + async.inject = async.reduce; + // foldl alias + async.foldl = async.reduce; + + async.reduceRight = function (arr, memo, iterator, callback) { + var reversed = _map(arr, function (x) { + return x; + }).reverse(); + async.reduce(reversed, memo, iterator, callback); + }; + // foldr alias + async.foldr = async.reduceRight; + + var _filter = function (eachfn, arr, iterator, callback) { + var results = []; + arr = _map(arr, function (x, i) { + return {index: i, value: x}; + }); + eachfn(arr, function (x, callback) { + iterator(x.value, function (v) { + if (v) { + results.push(x); + } + callback(); + }); + }, function (err) { + callback(_map(results.sort(function (a, b) { + return a.index - b.index; + }), function (x) { + return x.value; + })); + }); + }; + async.filter = doParallel(_filter); + async.filterSeries = doSeries(_filter); + // select alias + async.select = async.filter; + async.selectSeries = async.filterSeries; + + var _reject = function (eachfn, arr, iterator, callback) { + var results = []; + arr = _map(arr, function (x, i) { + return {index: i, value: x}; + }); + eachfn(arr, function (x, callback) { + iterator(x.value, function (v) { + if (!v) { + results.push(x); + } + callback(); + }); + }, function (err) { + callback(_map(results.sort(function (a, b) { + return a.index - b.index; + }), function (x) { + return x.value; + })); + }); + }; + async.reject = doParallel(_reject); + async.rejectSeries = doSeries(_reject); + + var _detect = function (eachfn, arr, iterator, main_callback) { + eachfn(arr, function (x, callback) { + iterator(x, function (result) { + if (result) { + main_callback(x); + main_callback = function () {}; + } + else { + callback(); + } + }); + }, function (err) { + main_callback(); + }); + }; + async.detect = doParallel(_detect); + async.detectSeries = doSeries(_detect); + + async.some = function (arr, iterator, main_callback) { + async.each(arr, function (x, callback) { + iterator(x, function (v) { + if (v) { + main_callback(true); + main_callback = function () {}; + } + callback(); + }); + }, function (err) { + main_callback(false); + }); + }; + // any alias + async.any = async.some; + + async.every = function (arr, iterator, main_callback) { + async.each(arr, function (x, callback) { + iterator(x, function (v) { + if (!v) { + main_callback(false); + main_callback = function () {}; + } + callback(); + }); + }, function (err) { + main_callback(true); + }); + }; + // all alias + async.all = async.every; + + async.sortBy = function (arr, iterator, callback) { + async.map(arr, function (x, callback) { + iterator(x, function (err, criteria) { + if (err) { + callback(err); + } + else { + callback(null, {value: x, criteria: criteria}); + } + }); + }, function (err, results) { + if (err) { + return callback(err); + } + else { + var fn = function (left, right) { + var a = left.criteria, b = right.criteria; + return a < b ? -1 : a > b ? 1 : 0; + }; + callback(null, _map(results.sort(fn), function (x) { + return x.value; + })); + } + }); + }; + + async.auto = function (tasks, callback) { + callback = callback || function () {}; + var keys = _keys(tasks); + var remainingTasks = keys.length + if (!remainingTasks) { + return callback(); + } + + var results = {}; + + var listeners = []; + var addListener = function (fn) { + listeners.unshift(fn); + }; + var removeListener = function (fn) { + for (var i = 0; i < listeners.length; i += 1) { + if (listeners[i] === fn) { + listeners.splice(i, 1); + return; + } + } + }; + var taskComplete = function () { + remainingTasks-- + _each(listeners.slice(0), function (fn) { + fn(); + }); + }; + + addListener(function () { + if (!remainingTasks) { + var theCallback = callback; + // prevent final callback from calling itself if it errors + callback = function () {}; + + theCallback(null, results); + } + }); + + _each(keys, function (k) { + var task = _isArray(tasks[k]) ? tasks[k]: [tasks[k]]; + var taskCallback = function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (args.length <= 1) { + args = args[0]; + } + if (err) { + var safeResults = {}; + _each(_keys(results), function(rkey) { + safeResults[rkey] = results[rkey]; + }); + safeResults[k] = args; + callback(err, safeResults); + // stop subsequent errors hitting callback multiple times + callback = function () {}; + } + else { + results[k] = args; + async.setImmediate(taskComplete); + } + }; + var requires = task.slice(0, Math.abs(task.length - 1)) || []; + var ready = function () { + return _reduce(requires, function (a, x) { + return (a && results.hasOwnProperty(x)); + }, true) && !results.hasOwnProperty(k); + }; + if (ready()) { + task[task.length - 1](taskCallback, results); + } + else { + var listener = function () { + if (ready()) { + removeListener(listener); + task[task.length - 1](taskCallback, results); + } + }; + addListener(listener); + } + }); + }; + + async.retry = function(times, task, callback) { + var DEFAULT_TIMES = 5; + var attempts = []; + // Use defaults if times not passed + if (typeof times === 'function') { + callback = task; + task = times; + times = DEFAULT_TIMES; + } + // Make sure times is a number + times = parseInt(times, 10) || DEFAULT_TIMES; + var wrappedTask = function(wrappedCallback, wrappedResults) { + var retryAttempt = function(task, finalAttempt) { + return function(seriesCallback) { + task(function(err, result){ + seriesCallback(!err || finalAttempt, {err: err, result: result}); + }, wrappedResults); + }; + }; + while (times) { + attempts.push(retryAttempt(task, !(times-=1))); + } + async.series(attempts, function(done, data){ + data = data[data.length - 1]; + (wrappedCallback || callback)(data.err, data.result); + }); + } + // If a callback is passed, run this as a controll flow + return callback ? wrappedTask() : wrappedTask + }; + + async.waterfall = function (tasks, callback) { + callback = callback || function () {}; + if (!_isArray(tasks)) { + var err = new Error('First argument to waterfall must be an array of functions'); + return callback(err); + } + if (!tasks.length) { + return callback(); + } + var wrapIterator = function (iterator) { + return function (err) { + if (err) { + callback.apply(null, arguments); + callback = function () {}; + } + else { + var args = Array.prototype.slice.call(arguments, 1); + var next = iterator.next(); + if (next) { + args.push(wrapIterator(next)); + } + else { + args.push(callback); + } + async.setImmediate(function () { + iterator.apply(null, args); + }); + } + }; + }; + wrapIterator(async.iterator(tasks))(); + }; + + var _parallel = function(eachfn, tasks, callback) { + callback = callback || function () {}; + if (_isArray(tasks)) { + eachfn.map(tasks, function (fn, callback) { + if (fn) { + fn(function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (args.length <= 1) { + args = args[0]; + } + callback.call(null, err, args); + }); + } + }, callback); + } + else { + var results = {}; + eachfn.each(_keys(tasks), function (k, callback) { + tasks[k](function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (args.length <= 1) { + args = args[0]; + } + results[k] = args; + callback(err); + }); + }, function (err) { + callback(err, results); + }); + } + }; + + async.parallel = function (tasks, callback) { + _parallel({ map: async.map, each: async.each }, tasks, callback); + }; + + async.parallelLimit = function(tasks, limit, callback) { + _parallel({ map: _mapLimit(limit), each: _eachLimit(limit) }, tasks, callback); + }; + + async.series = function (tasks, callback) { + callback = callback || function () {}; + if (_isArray(tasks)) { + async.mapSeries(tasks, function (fn, callback) { + if (fn) { + fn(function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (args.length <= 1) { + args = args[0]; + } + callback.call(null, err, args); + }); + } + }, callback); + } + else { + var results = {}; + async.eachSeries(_keys(tasks), function (k, callback) { + tasks[k](function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (args.length <= 1) { + args = args[0]; + } + results[k] = args; + callback(err); + }); + }, function (err) { + callback(err, results); + }); + } + }; + + async.iterator = function (tasks) { + var makeCallback = function (index) { + var fn = function () { + if (tasks.length) { + tasks[index].apply(null, arguments); + } + return fn.next(); + }; + fn.next = function () { + return (index < tasks.length - 1) ? makeCallback(index + 1): null; + }; + return fn; + }; + return makeCallback(0); + }; + + async.apply = function (fn) { + var args = Array.prototype.slice.call(arguments, 1); + return function () { + return fn.apply( + null, args.concat(Array.prototype.slice.call(arguments)) + ); + }; + }; + + var _concat = function (eachfn, arr, fn, callback) { + var r = []; + eachfn(arr, function (x, cb) { + fn(x, function (err, y) { + r = r.concat(y || []); + cb(err); + }); + }, function (err) { + callback(err, r); + }); + }; + async.concat = doParallel(_concat); + async.concatSeries = doSeries(_concat); + + async.whilst = function (test, iterator, callback) { + if (test()) { + iterator(function (err) { + if (err) { + return callback(err); + } + async.whilst(test, iterator, callback); + }); + } + else { + callback(); + } + }; + + async.doWhilst = function (iterator, test, callback) { + iterator(function (err) { + if (err) { + return callback(err); + } + var args = Array.prototype.slice.call(arguments, 1); + if (test.apply(null, args)) { + async.doWhilst(iterator, test, callback); + } + else { + callback(); + } + }); + }; + + async.until = function (test, iterator, callback) { + if (!test()) { + iterator(function (err) { + if (err) { + return callback(err); + } + async.until(test, iterator, callback); + }); + } + else { + callback(); + } + }; + + async.doUntil = function (iterator, test, callback) { + iterator(function (err) { + if (err) { + return callback(err); + } + var args = Array.prototype.slice.call(arguments, 1); + if (!test.apply(null, args)) { + async.doUntil(iterator, test, callback); + } + else { + callback(); + } + }); + }; + + async.queue = function (worker, concurrency) { + if (concurrency === undefined) { + concurrency = 1; + } + function _insert(q, data, pos, callback) { + if (!q.started){ + q.started = true; + } + if (!_isArray(data)) { + data = [data]; + } + if(data.length == 0) { + // call drain immediately if there are no tasks + return async.setImmediate(function() { + if (q.drain) { + q.drain(); + } + }); + } + _each(data, function(task) { + var item = { + data: task, + callback: typeof callback === 'function' ? callback : null + }; + + if (pos) { + q.tasks.unshift(item); + } else { + q.tasks.push(item); + } + + if (q.saturated && q.tasks.length === q.concurrency) { + q.saturated(); + } + async.setImmediate(q.process); + }); + } + + var workers = 0; + var q = { + tasks: [], + concurrency: concurrency, + saturated: null, + empty: null, + drain: null, + started: false, + paused: false, + push: function (data, callback) { + _insert(q, data, false, callback); + }, + kill: function () { + q.drain = null; + q.tasks = []; + }, + unshift: function (data, callback) { + _insert(q, data, true, callback); + }, + process: function () { + if (!q.paused && workers < q.concurrency && q.tasks.length) { + var task = q.tasks.shift(); + if (q.empty && q.tasks.length === 0) { + q.empty(); + } + workers += 1; + var next = function () { + workers -= 1; + if (task.callback) { + task.callback.apply(task, arguments); + } + if (q.drain && q.tasks.length + workers === 0) { + q.drain(); + } + q.process(); + }; + var cb = only_once(next); + worker(task.data, cb); + } + }, + length: function () { + return q.tasks.length; + }, + running: function () { + return workers; + }, + idle: function() { + return q.tasks.length + workers === 0; + }, + pause: function () { + if (q.paused === true) { return; } + q.paused = true; + q.process(); + }, + resume: function () { + if (q.paused === false) { return; } + q.paused = false; + q.process(); + } + }; + return q; + }; + + async.priorityQueue = function (worker, concurrency) { + + function _compareTasks(a, b){ + return a.priority - b.priority; + }; + + function _binarySearch(sequence, item, compare) { + var beg = -1, + end = sequence.length - 1; + while (beg < end) { + var mid = beg + ((end - beg + 1) >>> 1); + if (compare(item, sequence[mid]) >= 0) { + beg = mid; + } else { + end = mid - 1; + } + } + return beg; + } + + function _insert(q, data, priority, callback) { + if (!q.started){ + q.started = true; + } + if (!_isArray(data)) { + data = [data]; + } + if(data.length == 0) { + // call drain immediately if there are no tasks + return async.setImmediate(function() { + if (q.drain) { + q.drain(); + } + }); + } + _each(data, function(task) { + var item = { + data: task, + priority: priority, + callback: typeof callback === 'function' ? callback : null + }; + + q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item); + + if (q.saturated && q.tasks.length === q.concurrency) { + q.saturated(); + } + async.setImmediate(q.process); + }); + } + + // Start with a normal queue + var q = async.queue(worker, concurrency); + + // Override push to accept second parameter representing priority + q.push = function (data, priority, callback) { + _insert(q, data, priority, callback); + }; + + // Remove unshift function + delete q.unshift; + + return q; + }; + + async.cargo = function (worker, payload) { + var working = false, + tasks = []; + + var cargo = { + tasks: tasks, + payload: payload, + saturated: null, + empty: null, + drain: null, + drained: true, + push: function (data, callback) { + if (!_isArray(data)) { + data = [data]; + } + _each(data, function(task) { + tasks.push({ + data: task, + callback: typeof callback === 'function' ? callback : null + }); + cargo.drained = false; + if (cargo.saturated && tasks.length === payload) { + cargo.saturated(); + } + }); + async.setImmediate(cargo.process); + }, + process: function process() { + if (working) return; + if (tasks.length === 0) { + if(cargo.drain && !cargo.drained) cargo.drain(); + cargo.drained = true; + return; + } + + var ts = typeof payload === 'number' + ? tasks.splice(0, payload) + : tasks.splice(0, tasks.length); + + var ds = _map(ts, function (task) { + return task.data; + }); + + if(cargo.empty) cargo.empty(); + working = true; + worker(ds, function () { + working = false; + + var args = arguments; + _each(ts, function (data) { + if (data.callback) { + data.callback.apply(null, args); + } + }); + + process(); + }); + }, + length: function () { + return tasks.length; + }, + running: function () { + return working; + } + }; + return cargo; + }; + + var _console_fn = function (name) { + return function (fn) { + var args = Array.prototype.slice.call(arguments, 1); + fn.apply(null, args.concat([function (err) { + var args = Array.prototype.slice.call(arguments, 1); + if (typeof console !== 'undefined') { + if (err) { + if (console.error) { + console.error(err); + } + } + else if (console[name]) { + _each(args, function (x) { + console[name](x); + }); + } + } + }])); + }; + }; + async.log = _console_fn('log'); + async.dir = _console_fn('dir'); + /*async.info = _console_fn('info'); + async.warn = _console_fn('warn'); + async.error = _console_fn('error');*/ + + async.memoize = function (fn, hasher) { + var memo = {}; + var queues = {}; + hasher = hasher || function (x) { + return x; + }; + var memoized = function () { + var args = Array.prototype.slice.call(arguments); + var callback = args.pop(); + var key = hasher.apply(null, args); + if (key in memo) { + async.nextTick(function () { + callback.apply(null, memo[key]); + }); + } + else if (key in queues) { + queues[key].push(callback); + } + else { + queues[key] = [callback]; + fn.apply(null, args.concat([function () { + memo[key] = arguments; + var q = queues[key]; + delete queues[key]; + for (var i = 0, l = q.length; i < l; i++) { + q[i].apply(null, arguments); + } + }])); + } + }; + memoized.memo = memo; + memoized.unmemoized = fn; + return memoized; + }; + + async.unmemoize = function (fn) { + return function () { + return (fn.unmemoized || fn).apply(null, arguments); + }; + }; + + async.times = function (count, iterator, callback) { + var counter = []; + for (var i = 0; i < count; i++) { + counter.push(i); + } + return async.map(counter, iterator, callback); + }; + + async.timesSeries = function (count, iterator, callback) { + var counter = []; + for (var i = 0; i < count; i++) { + counter.push(i); + } + return async.mapSeries(counter, iterator, callback); + }; + + async.seq = function (/* functions... */) { + var fns = arguments; + return function () { + var that = this; + var args = Array.prototype.slice.call(arguments); + var callback = args.pop(); + async.reduce(fns, args, function (newargs, fn, cb) { + fn.apply(that, newargs.concat([function () { + var err = arguments[0]; + var nextargs = Array.prototype.slice.call(arguments, 1); + cb(err, nextargs); + }])) + }, + function (err, results) { + callback.apply(that, [err].concat(results)); + }); + }; + }; + + async.compose = function (/* functions... */) { + return async.seq.apply(null, Array.prototype.reverse.call(arguments)); + }; + + var _applyEach = function (eachfn, fns /*args...*/) { + var go = function () { + var that = this; + var args = Array.prototype.slice.call(arguments); + var callback = args.pop(); + return eachfn(fns, function (fn, cb) { + fn.apply(that, args.concat([cb])); + }, + callback); + }; + if (arguments.length > 2) { + var args = Array.prototype.slice.call(arguments, 2); + return go.apply(this, args); + } + else { + return go; + } + }; + async.applyEach = doParallel(_applyEach); + async.applyEachSeries = doSeries(_applyEach); + + async.forever = function (fn, callback) { + function next(err) { + if (err) { + if (callback) { + return callback(err); + } + throw err; + } + fn(next); + } + next(); + }; + + // Node.js + if (typeof module !== 'undefined' && module.exports) { + module.exports = async; + } + // AMD / RequireJS + else if (typeof define !== 'undefined' && define.amd) { + define([], function () { + return async; + }); + } + // included directly via