From dbd299939d0e026f3077ad113b86c92f3c29b58c Mon Sep 17 00:00:00 2001 From: Jenkins Date: Thu, 17 Aug 2017 21:23:16 +0000 Subject: [PATCH] v8.9.2 --- .gitignore | 1 - build/auth0.js | 9365 +++++++++++++++++++++++++ build/auth0.min.js | 13 + build/auth0.min.js.map | 1 + build/cordova-auth0-plugin.js | 980 +++ build/cordova-auth0-plugin.min.js | 10 + build/cordova-auth0-plugin.min.js.map | 1 + 7 files changed, 10370 insertions(+), 1 deletion(-) create mode 100644 build/auth0.js create mode 100644 build/auth0.min.js create mode 100644 build/auth0.min.js.map create mode 100644 build/cordova-auth0-plugin.js create mode 100644 build/cordova-auth0-plugin.min.js create mode 100644 build/cordova-auth0-plugin.min.js.map diff --git a/.gitignore b/.gitignore index 11e0ddb7..7e2b598f 100644 --- a/.gitignore +++ b/.gitignore @@ -23,7 +23,6 @@ release .DS_Store -build example/auth0.js .gitignore diff --git a/build/auth0.js b/build/auth0.js new file mode 100644 index 00000000..f8ad3a36 --- /dev/null +++ b/build/auth0.js @@ -0,0 +1,9365 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define("auth0-js", [], factory); + else if(typeof exports === 'object') + exports["auth0-js"] = factory(); + else + root["auth0"] = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; +/******/ +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(54); + + +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (name, context, definition) { + if (typeof module !== 'undefined' && module.exports) module.exports = definition(); + else if (true) !(__WEBPACK_AMD_DEFINE_FACTORY__ = (definition), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + else context[name] = definition(); + })('urljoin', this, function () { + + function normalize (str, options) { + + // make sure protocol is followed by two slashes + str = str.replace(/:\//g, '://'); + + // remove consecutive slashes + str = str.replace(/([^:\s])\/+/g, '$1/'); + + // remove trailing slash before parameters or hash + str = str.replace(/\/(\?|&|#[^!])/g, '$1'); + + // replace ? in parameters with & + str = str.replace(/(\?.+)\?/g, '$1&'); + + return str; + } + + return function () { + var input = arguments; + var options = {}; + + if (typeof arguments[0] === 'object') { + // new syntax with array and options + input = arguments[0]; + options = arguments[1] || {}; + } + + var joined = [].slice.call(input, 0).join('/'); + return normalize(joined, options); + }; + + }); + + +/***/ }, +/* 2 */ +/***/ function(module, exports, __webpack_require__) { + + /* eslint-disable no-param-reassign */ + /* eslint-disable no-restricted-syntax */ + /* eslint-disable guard-for-in */ + + var assert = __webpack_require__(4); + var objectAssign = __webpack_require__(44); + + function pick(object, keys) { + return keys.reduce(function(prev, key) { + if (object[key]) { + prev[key] = object[key]; + } + return prev; + }, {}); + } + + function getKeysNotIn(obj, allowedKeys) { + var notAllowed = []; + for (var key in obj) { + if (allowedKeys.indexOf(key) === -1) { + notAllowed.push(key); + } + } + return notAllowed; + } + + function objectValues(obj) { + var values = []; + for (var key in obj) { + values.push(obj[key]); + } + return values; + } + + function extend() { + var params = objectValues(arguments); + params.unshift({}); + return objectAssign.get().apply(undefined, params); + } + + function merge(object, keys) { + return { + base: keys ? pick(object, keys) : object, + with: function(object2, keys2) { + object2 = keys2 ? pick(object2, keys2) : object2; + return extend(this.base, object2); + } + }; + } + + function blacklist(object, blacklistedKeys) { + return Object.keys(object).reduce(function(p, key) { + if (blacklistedKeys.indexOf(key) === -1) { + p[key] = object[key]; + } + return p; + }, {}); + } + + function camelToSnake(str) { + var newKey = ''; + var index = 0; + var code; + var wasPrevNumber = true; + var wasPrevUppercase = true; + + while (index < str.length) { + code = str.charCodeAt(index); + if ( + (!wasPrevUppercase && code >= 65 && code <= 90) || + (!wasPrevNumber && code >= 48 && code <= 57) + ) { + newKey += '_'; + newKey += str[index].toLowerCase(); + } else { + newKey += str[index].toLowerCase(); + } + wasPrevNumber = code >= 48 && code <= 57; + wasPrevUppercase = code >= 65 && code <= 90; + index++; + } + + return newKey; + } + + function snakeToCamel(str) { + var parts = str.split('_'); + return parts.reduce(function(p, c) { + return p + c.charAt(0).toUpperCase() + c.slice(1); + }, parts.shift()); + } + + function toSnakeCase(object, exceptions) { + if (typeof object !== 'object' || assert.isArray(object) || object === null) { + return object; + } + exceptions = exceptions || []; + + return Object.keys(object).reduce(function(p, key) { + var newKey = exceptions.indexOf(key) === -1 ? camelToSnake(key) : key; + p[newKey] = toSnakeCase(object[key]); + return p; + }, {}); + } + + function toCamelCase(object, exceptions) { + if (typeof object !== 'object' || assert.isArray(object) || object === null) { + return object; + } + + exceptions = exceptions || []; + + return Object.keys(object).reduce(function(p, key) { + var newKey = exceptions.indexOf(key) === -1 ? snakeToCamel(key) : key; + p[newKey] = toCamelCase(object[key]); + return p; + }, {}); + } + + module.exports = { + toSnakeCase: toSnakeCase, + toCamelCase: toCamelCase, + blacklist: blacklist, + merge: merge, + pick: pick, + getKeysNotIn: getKeysNotIn, + extend: extend + }; + + +/***/ }, +/* 3 */ +/***/ function(module, exports) { + + /* WEBPACK VAR INJECTION */(function(global) {function redirect(url) { + global.window.location = url; + } + + function getDocument() { + return global.window.document; + } + + function getWindow() { + return global.window; + } + + module.exports = { + redirect: redirect, + getDocument: getDocument, + getWindow: getWindow + }; + + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }, +/* 4 */ +/***/ function(module, exports) { + + var toString = Object.prototype.toString; + + function attribute(o, attr, type, text) { + type = type === 'array' ? 'object' : type; + if (o && typeof o[attr] !== type) { + throw new Error(text); + } + } + + function variable(o, type, text) { + if (typeof o !== type) { + throw new Error(text); + } + } + + function value(o, values, text) { + if (values.indexOf(o) === -1) { + throw new Error(text); + } + } + + function check(o, config, attributes) { + if (!config.optional || o) { + variable(o, config.type, config.message); + } + if (config.type === 'object' && attributes) { + var keys = Object.keys(attributes); + + for (var index = 0; index < keys.length; index++) { + var a = keys[index]; + if (!attributes[a].optional || o[a]) { + if (!attributes[a].condition || attributes[a].condition(o)) { + attribute(o, a, attributes[a].type, attributes[a].message); + if (attributes[a].values) { + value(o[a], attributes[a].values, attributes[a].value_message); + } + } + } + } + } + } + + /** + * Wrap `Array.isArray` Polyfill for IE9 + * source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray + * + * @param {Array} array + * @private + */ + function isArray(array) { + if (this.supportsIsArray()) { + return Array.isArray(array); + } + + return toString.call(array) === '[object Array]'; + } + + function supportsIsArray() { + return Array.isArray != null; + } + + module.exports = { + check: check, + attribute: attribute, + variable: variable, + value: value, + isArray: isArray, + supportsIsArray: supportsIsArray + }; + + +/***/ }, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var stringify = __webpack_require__(13); + var parse = __webpack_require__(12); + var formats = __webpack_require__(7); + + module.exports = { + formats: formats, + parse: parse, + stringify: stringify + }; + + +/***/ }, +/* 6 */ +/***/ function(module, exports, __webpack_require__) { + + var error = __webpack_require__(21); + var objectHelper = __webpack_require__(2); + + function wrapCallback(cb, options) { + options = options || {}; + options.ignoreCasing = options.ignoreCasing ? options.ignoreCasing : false; + + return function(err, data) { + var errObj; + + if (!err && !data) { + return cb(error.buildResponse('generic_error', 'Something went wrong')); + } + + if (!err && data.err) { + err = data.err; + data = null; + } + + if (!err && data.error) { + err = data; + data = null; + } + + if (err) { + errObj = { + original: err + }; + + if (err.response && err.response.statusCode) { + errObj.statusCode = err.response.statusCode; + } + + if (err.response && err.response.statusText) { + errObj.statusText = err.response.statusText; + } + + if (err.response && err.response.body) { + err = err.response.body; + } + + if (err.err) { + err = err.err; + } + + errObj.code = err.error || err.code || err.error_code || err.status || null; + errObj.description = + err.errorDescription || + err.error_description || + err.description || + err.error || + err.details || + err.err || + null; + + if (err.name) { + errObj.name = err.name; + } + + if (err.policy) { + errObj.policy = err.policy; + } + + return cb(errObj); + } + + if (data.type && (data.type === 'text/html' || data.type === 'text/plain')) { + return cb(null, data.text); + } + + if (options.ignoreCasing) { + return cb(null, data.body || data); + } + + return cb(null, objectHelper.toCamelCase(data.body || data)); + }; + } + + module.exports = wrapCallback; + + +/***/ }, +/* 7 */ +/***/ function(module, exports) { + + 'use strict'; + + var replace = String.prototype.replace; + var percentTwenties = /%20/g; + + module.exports = { + 'default': 'RFC3986', + formatters: { + RFC1738: function (value) { + return replace.call(value, percentTwenties, '+'); + }, + RFC3986: function (value) { + return value; + } + }, + RFC1738: 'RFC1738', + RFC3986: 'RFC3986' + }; + + +/***/ }, +/* 8 */ +/***/ function(module, exports) { + + 'use strict'; + + var has = Object.prototype.hasOwnProperty; + + var hexTable = (function () { + var array = []; + for (var i = 0; i < 256; ++i) { + array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase()); + } + + return array; + }()); + + exports.arrayToObject = function (source, options) { + var obj = options && options.plainObjects ? Object.create(null) : {}; + for (var i = 0; i < source.length; ++i) { + if (typeof source[i] !== 'undefined') { + obj[i] = source[i]; + } + } + + return obj; + }; + + exports.merge = function (target, source, options) { + if (!source) { + return target; + } + + if (typeof source !== 'object') { + if (Array.isArray(target)) { + target.push(source); + } else if (typeof target === 'object') { + if (options.plainObjects || options.allowPrototypes || !has.call(Object.prototype, source)) { + target[source] = true; + } + } else { + return [target, source]; + } + + return target; + } + + if (typeof target !== 'object') { + return [target].concat(source); + } + + var mergeTarget = target; + if (Array.isArray(target) && !Array.isArray(source)) { + mergeTarget = exports.arrayToObject(target, options); + } + + if (Array.isArray(target) && Array.isArray(source)) { + source.forEach(function (item, i) { + if (has.call(target, i)) { + if (target[i] && typeof target[i] === 'object') { + target[i] = exports.merge(target[i], item, options); + } else { + target.push(item); + } + } else { + target[i] = item; + } + }); + return target; + } + + return Object.keys(source).reduce(function (acc, key) { + var value = source[key]; + + if (Object.prototype.hasOwnProperty.call(acc, key)) { + acc[key] = exports.merge(acc[key], value, options); + } else { + acc[key] = value; + } + return acc; + }, mergeTarget); + }; + + exports.decode = function (str) { + try { + return decodeURIComponent(str.replace(/\+/g, ' ')); + } catch (e) { + return str; + } + }; + + exports.encode = function (str) { + // This code was originally written by Brian White (mscdex) for the io.js core querystring library. + // It has been adapted here for stricter adherence to RFC 3986 + if (str.length === 0) { + return str; + } + + var string = typeof str === 'string' ? str : String(str); + + var out = ''; + for (var i = 0; i < string.length; ++i) { + var c = string.charCodeAt(i); + + if ( + c === 0x2D || // - + c === 0x2E || // . + c === 0x5F || // _ + c === 0x7E || // ~ + (c >= 0x30 && c <= 0x39) || // 0-9 + (c >= 0x41 && c <= 0x5A) || // a-z + (c >= 0x61 && c <= 0x7A) // A-Z + ) { + out += string.charAt(i); + continue; + } + + if (c < 0x80) { + out = out + hexTable[c]; + continue; + } + + if (c < 0x800) { + out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]); + continue; + } + + if (c < 0xD800 || c >= 0xE000) { + out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]); + continue; + } + + i += 1; + c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF)); + out += hexTable[0xF0 | (c >> 18)] + hexTable[0x80 | ((c >> 12) & 0x3F)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]; // eslint-disable-line max-len + } + + return out; + }; + + exports.compact = function (obj, references) { + if (typeof obj !== 'object' || obj === null) { + return obj; + } + + var refs = references || []; + var lookup = refs.indexOf(obj); + if (lookup !== -1) { + return refs[lookup]; + } + + refs.push(obj); + + if (Array.isArray(obj)) { + var compacted = []; + + for (var i = 0; i < obj.length; ++i) { + if (obj[i] && typeof obj[i] === 'object') { + compacted.push(exports.compact(obj[i], refs)); + } else if (typeof obj[i] !== 'undefined') { + compacted.push(obj[i]); + } + } + + return compacted; + } + + var keys = Object.keys(obj); + keys.forEach(function (key) { + obj[key] = exports.compact(obj[key], refs); + }); + + return obj; + }; + + exports.isRegExp = function (obj) { + return Object.prototype.toString.call(obj) === '[object RegExp]'; + }; + + exports.isBuffer = function (obj) { + if (obj === null || typeof obj === 'undefined') { + return false; + } + + return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); + }; + + +/***/ }, +/* 9 */ +/***/ function(module, exports) { + + module.exports = { raw: '8.9.2' }; + + +/***/ }, +/* 10 */ +/***/ function(module, exports, __webpack_require__) { + + /* eslint-disable no-param-reassign */ + var request = __webpack_require__(17); + var base64Url = __webpack_require__(20); + var version = __webpack_require__(9); + + // ------------------------------------------------ RequestWrapper + + function RequestWrapper(req) { + this.request = req; + this.method = req.method; + this.url = req.url; + this.body = req._data; + this.headers = req._header; + } + + RequestWrapper.prototype.abort = function() { + this.request.abort(); + }; + + RequestWrapper.prototype.getMethod = function() { + return this.method; + }; + + RequestWrapper.prototype.getBody = function() { + return this.body; + }; + + RequestWrapper.prototype.getUrl = function() { + return this.url; + }; + + RequestWrapper.prototype.getHeaders = function() { + return this.headers; + }; + + // ------------------------------------------------ RequestObj + + function RequestObj(req) { + this.request = req; + } + + RequestObj.prototype.set = function(key, value) { + this.request = this.request.set(key, value); + return this; + }; + + RequestObj.prototype.send = function(body) { + this.request = this.request.send(body); + return this; + }; + + RequestObj.prototype.withCredentials = function() { + this.request = this.request.withCredentials(); + return this; + }; + + RequestObj.prototype.end = function(cb) { + this.request = this.request.end(cb); + return new RequestWrapper(this.request); + }; + + // ------------------------------------------------ RequestBuilder + + function RequestBuilder(options) { + this._sendTelemetry = options._sendTelemetry === false ? options._sendTelemetry : true; + this._telemetryInfo = options._telemetryInfo || null; + this._timesToRetryFailedRequests = options._timesToRetryFailedRequests; + this.headers = options.headers || {}; + } + + RequestBuilder.prototype.setCommonConfiguration = function(ongoingRequest, options) { + options = options || {}; + + if (options.noHeaders) { + return ongoingRequest; + } + + var headers = this.headers; + ongoingRequest = ongoingRequest.set('Content-Type', 'application/json'); + + var keys = Object.keys(this.headers); + + for (var a = 0; a < keys.length; a++) { + ongoingRequest = ongoingRequest.set(keys[a], headers[keys[a]]); + } + + if (this._sendTelemetry) { + ongoingRequest = ongoingRequest.set('Auth0-Client', this.getTelemetryData()); + } + if (this._timesToRetryFailedRequests > 0) { + ongoingRequest = ongoingRequest.retry(this._timesToRetryFailedRequests); + } + return ongoingRequest; + }; + + RequestBuilder.prototype.getTelemetryData = function() { + var clientInfo = this._telemetryInfo || { name: 'auth0.js', version: version.raw }; + var jsonClientInfo = JSON.stringify(clientInfo); + return base64Url.encode(jsonClientInfo); + }; + + RequestBuilder.prototype.get = function(url, options) { + return new RequestObj(this.setCommonConfiguration(request.get(url), options)); + }; + + RequestBuilder.prototype.post = function(url, options) { + return new RequestObj(this.setCommonConfiguration(request.post(url), options)); + }; + + RequestBuilder.prototype.patch = function(url, options) { + return new RequestObj(this.setCommonConfiguration(request.patch(url), options)); + }; + + module.exports = RequestBuilder; + + +/***/ }, +/* 11 */ +/***/ function(module, exports) { + + /* eslint-disable no-console */ + + function Warn(options) { + this.disableWarnings = options.disableWarnings; + } + + Warn.prototype.warning = function(message) { + if (this.disableWarnings) { + return; + } + + console.warn(message); + }; + + module.exports = Warn; + + +/***/ }, +/* 12 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var utils = __webpack_require__(8); + + var has = Object.prototype.hasOwnProperty; + + var defaults = { + allowDots: false, + allowPrototypes: false, + arrayLimit: 20, + decoder: utils.decode, + delimiter: '&', + depth: 5, + parameterLimit: 1000, + plainObjects: false, + strictNullHandling: false + }; + + var parseValues = function parseQueryStringValues(str, options) { + var obj = {}; + var parts = str.split(options.delimiter, options.parameterLimit === Infinity ? undefined : options.parameterLimit); + + for (var i = 0; i < parts.length; ++i) { + var part = parts[i]; + var pos = part.indexOf(']=') === -1 ? part.indexOf('=') : part.indexOf(']=') + 1; + + var key, val; + if (pos === -1) { + key = options.decoder(part); + val = options.strictNullHandling ? null : ''; + } else { + key = options.decoder(part.slice(0, pos)); + val = options.decoder(part.slice(pos + 1)); + } + if (has.call(obj, key)) { + obj[key] = [].concat(obj[key]).concat(val); + } else { + obj[key] = val; + } + } + + return obj; + }; + + var parseObject = function parseObjectRecursive(chain, val, options) { + if (!chain.length) { + return val; + } + + var root = chain.shift(); + + var obj; + if (root === '[]') { + obj = []; + obj = obj.concat(parseObject(chain, val, options)); + } else { + obj = options.plainObjects ? Object.create(null) : {}; + var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root; + var index = parseInt(cleanRoot, 10); + if ( + !isNaN(index) && + root !== cleanRoot && + String(index) === cleanRoot && + index >= 0 && + (options.parseArrays && index <= options.arrayLimit) + ) { + obj = []; + obj[index] = parseObject(chain, val, options); + } else { + obj[cleanRoot] = parseObject(chain, val, options); + } + } + + return obj; + }; + + var parseKeys = function parseQueryStringKeys(givenKey, val, options) { + if (!givenKey) { + return; + } + + // Transform dot notation to bracket notation + var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey; + + // The regex chunks + + var brackets = /(\[[^[\]]*])/; + var child = /(\[[^[\]]*])/g; + + // Get the parent + + var segment = brackets.exec(key); + var parent = segment ? key.slice(0, segment.index) : key; + + // Stash the parent if it exists + + var keys = []; + if (parent) { + // If we aren't using plain objects, optionally prefix keys + // that would overwrite object prototype properties + if (!options.plainObjects && has.call(Object.prototype, parent)) { + if (!options.allowPrototypes) { + return; + } + } + + keys.push(parent); + } + + // Loop through children appending to the array until we hit depth + + var i = 0; + while ((segment = child.exec(key)) !== null && i < options.depth) { + i += 1; + if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) { + if (!options.allowPrototypes) { + return; + } + } + keys.push(segment[1]); + } + + // If there's a remainder, just add whatever is left + + if (segment) { + keys.push('[' + key.slice(segment.index) + ']'); + } + + return parseObject(keys, val, options); + }; + + module.exports = function (str, opts) { + var options = opts || {}; + + if (options.decoder !== null && options.decoder !== undefined && typeof options.decoder !== 'function') { + throw new TypeError('Decoder has to be a function.'); + } + + options.delimiter = typeof options.delimiter === 'string' || utils.isRegExp(options.delimiter) ? options.delimiter : defaults.delimiter; + options.depth = typeof options.depth === 'number' ? options.depth : defaults.depth; + options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : defaults.arrayLimit; + options.parseArrays = options.parseArrays !== false; + options.decoder = typeof options.decoder === 'function' ? options.decoder : defaults.decoder; + options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : defaults.allowDots; + options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : defaults.plainObjects; + options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : defaults.allowPrototypes; + options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : defaults.parameterLimit; + options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling; + + if (str === '' || str === null || typeof str === 'undefined') { + return options.plainObjects ? Object.create(null) : {}; + } + + var tempObj = typeof str === 'string' ? parseValues(str, options) : str; + var obj = options.plainObjects ? Object.create(null) : {}; + + // Iterate over the keys and setup the new object + + var keys = Object.keys(tempObj); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + var newObj = parseKeys(key, tempObj[key], options); + obj = utils.merge(obj, newObj, options); + } + + return utils.compact(obj); + }; + + +/***/ }, +/* 13 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var utils = __webpack_require__(8); + var formats = __webpack_require__(7); + + var arrayPrefixGenerators = { + brackets: function brackets(prefix) { // eslint-disable-line func-name-matching + return prefix + '[]'; + }, + indices: function indices(prefix, key) { // eslint-disable-line func-name-matching + return prefix + '[' + key + ']'; + }, + repeat: function repeat(prefix) { // eslint-disable-line func-name-matching + return prefix; + } + }; + + var toISO = Date.prototype.toISOString; + + var defaults = { + delimiter: '&', + encode: true, + encoder: utils.encode, + encodeValuesOnly: false, + serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching + return toISO.call(date); + }, + skipNulls: false, + strictNullHandling: false + }; + + var stringify = function stringify( // eslint-disable-line func-name-matching + object, + prefix, + generateArrayPrefix, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly + ) { + var obj = object; + if (typeof filter === 'function') { + obj = filter(prefix, obj); + } else if (obj instanceof Date) { + obj = serializeDate(obj); + } else if (obj === null) { + if (strictNullHandling) { + return encoder && !encodeValuesOnly ? encoder(prefix) : prefix; + } + + obj = ''; + } + + if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || utils.isBuffer(obj)) { + if (encoder) { + var keyValue = encodeValuesOnly ? prefix : encoder(prefix); + return [formatter(keyValue) + '=' + formatter(encoder(obj))]; + } + return [formatter(prefix) + '=' + formatter(String(obj))]; + } + + var values = []; + + if (typeof obj === 'undefined') { + return values; + } + + var objKeys; + if (Array.isArray(filter)) { + objKeys = filter; + } else { + var keys = Object.keys(obj); + objKeys = sort ? keys.sort(sort) : keys; + } + + for (var i = 0; i < objKeys.length; ++i) { + var key = objKeys[i]; + + if (skipNulls && obj[key] === null) { + continue; + } + + if (Array.isArray(obj)) { + values = values.concat(stringify( + obj[key], + generateArrayPrefix(prefix, key), + generateArrayPrefix, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly + )); + } else { + values = values.concat(stringify( + obj[key], + prefix + (allowDots ? '.' + key : '[' + key + ']'), + generateArrayPrefix, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly + )); + } + } + + return values; + }; + + module.exports = function (object, opts) { + var obj = object; + var options = opts || {}; + + if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') { + throw new TypeError('Encoder has to be a function.'); + } + + var delimiter = typeof options.delimiter === 'undefined' ? defaults.delimiter : options.delimiter; + var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling; + var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : defaults.skipNulls; + var encode = typeof options.encode === 'boolean' ? options.encode : defaults.encode; + var encoder = typeof options.encoder === 'function' ? options.encoder : defaults.encoder; + var sort = typeof options.sort === 'function' ? options.sort : null; + var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots; + var serializeDate = typeof options.serializeDate === 'function' ? options.serializeDate : defaults.serializeDate; + var encodeValuesOnly = typeof options.encodeValuesOnly === 'boolean' ? options.encodeValuesOnly : defaults.encodeValuesOnly; + if (typeof options.format === 'undefined') { + options.format = formats.default; + } else if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) { + throw new TypeError('Unknown format option provided.'); + } + var formatter = formats.formatters[options.format]; + var objKeys; + var filter; + + if (typeof options.filter === 'function') { + filter = options.filter; + obj = filter('', obj); + } else if (Array.isArray(options.filter)) { + filter = options.filter; + objKeys = filter; + } + + var keys = []; + + if (typeof obj !== 'object' || obj === null) { + return ''; + } + + var arrayFormat; + if (options.arrayFormat in arrayPrefixGenerators) { + arrayFormat = options.arrayFormat; + } else if ('indices' in options) { + arrayFormat = options.indices ? 'indices' : 'repeat'; + } else { + arrayFormat = 'indices'; + } + + var generateArrayPrefix = arrayPrefixGenerators[arrayFormat]; + + if (!objKeys) { + objKeys = Object.keys(obj); + } + + if (sort) { + objKeys.sort(sort); + } + + for (var i = 0; i < objKeys.length; ++i) { + var key = objKeys[i]; + + if (skipNulls && obj[key] === null) { + continue; + } + + keys = keys.concat(stringify( + obj[key], + key, + generateArrayPrefix, + strictNullHandling, + skipNulls, + encode ? encoder : null, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly + )); + } + + return keys.join(delimiter); + }; + + +/***/ }, +/* 14 */ +/***/ function(module, exports) { + + /** + * Check if `obj` is an object. + * + * @param {Object} obj + * @return {Boolean} + * @api private + */ + + function isObject(obj) { + return null !== obj && 'object' === typeof obj; + } + + module.exports = isObject; + + +/***/ }, +/* 15 */ +/***/ function(module, exports) { + + 'use strict' + + exports.byteLength = byteLength + exports.toByteArray = toByteArray + exports.fromByteArray = fromByteArray + + var lookup = [] + var revLookup = [] + var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array + + var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' + for (var i = 0, len = code.length; i < len; ++i) { + lookup[i] = code[i] + revLookup[code.charCodeAt(i)] = i + } + + revLookup['-'.charCodeAt(0)] = 62 + revLookup['_'.charCodeAt(0)] = 63 + + function placeHoldersCount (b64) { + var len = b64.length + if (len % 4 > 0) { + throw new Error('Invalid string. Length must be a multiple of 4') + } + + // the number of equal signs (place holders) + // if there are two placeholders, than the two characters before it + // represent one byte + // if there is only one, then the three characters before it represent 2 bytes + // this is just a cheap hack to not do indexOf twice + return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0 + } + + function byteLength (b64) { + // base64 is 4/3 + up to two characters of the original data + return b64.length * 3 / 4 - placeHoldersCount(b64) + } + + function toByteArray (b64) { + var i, j, l, tmp, placeHolders, arr + var len = b64.length + placeHolders = placeHoldersCount(b64) + + arr = new Arr(len * 3 / 4 - placeHolders) + + // if there are placeholders, only get up to the last complete 4 chars + l = placeHolders > 0 ? len - 4 : len + + var L = 0 + + for (i = 0, j = 0; i < l; i += 4, j += 3) { + tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)] + arr[L++] = (tmp >> 16) & 0xFF + arr[L++] = (tmp >> 8) & 0xFF + arr[L++] = tmp & 0xFF + } + + if (placeHolders === 2) { + tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4) + arr[L++] = tmp & 0xFF + } else if (placeHolders === 1) { + tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2) + arr[L++] = (tmp >> 8) & 0xFF + arr[L++] = tmp & 0xFF + } + + return arr + } + + function tripletToBase64 (num) { + return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F] + } + + function encodeChunk (uint8, start, end) { + var tmp + var output = [] + for (var i = start; i < end; i += 3) { + tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]) + output.push(tripletToBase64(tmp)) + } + return output.join('') + } + + function fromByteArray (uint8) { + var tmp + var len = uint8.length + var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes + var output = '' + var parts = [] + var maxChunkLength = 16383 // must be multiple of 3 + + // go through the array every three bytes, we'll deal with trailing stuff later + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { + parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))) + } + + // pad the end with zeros, but make sure to not forget the extra bytes + if (extraBytes === 1) { + tmp = uint8[len - 1] + output += lookup[tmp >> 2] + output += lookup[(tmp << 4) & 0x3F] + output += '==' + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + (uint8[len - 1]) + output += lookup[tmp >> 10] + output += lookup[(tmp >> 4) & 0x3F] + output += lookup[(tmp << 2) & 0x3F] + output += '=' + } + + parts.push(output) + + return parts.join('') + } + + +/***/ }, +/* 16 */ +/***/ function(module, exports, __webpack_require__) { + + var base64 = __webpack_require__(15); + + function padding(str) { + var mod = (str.length % 4); + var pad = 4 - mod; + + if (mod === 0) { + return str; + } + + return str + (new Array(1 + pad)).join('='); + } + + function byteArrayToString(array) { + var result = ""; + for (var i = 0; i < array.length; i++) { + result += String.fromCharCode(array[i]); + } + return result; + } + + function stringToByteArray(str) { + var arr = new Array(str.length); + for (var a = 0; a < str.length; a++) { + arr[a] = str.charCodeAt(a); + } + return arr; + } + + function byteArrayToHex(raw) { + var HEX = ''; + + for (var i = 0; i < raw.length; i++) { + var _hex = raw[i].toString(16); + HEX += (_hex.length === 2 ? _hex : '0' + _hex); + } + + return HEX; + } + + function encodeString(str) { + return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) { + return String.fromCharCode('0x' + p1); + })) + .replace(/\+/g, '-') // Convert '+' to '-' + .replace(/\//g, '_'); // Convert '/' to '_'; + } + + function decodeToString(str) { + str = padding(str) + .replace(/\-/g, '+') // Convert '-' to '+' + .replace(/_/g, '/'); // Convert '_' to '/' + + return decodeURIComponent(atob(str).split('').map(function (c) { + return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); + }).join('')); + } + + function decodeToHEX(str) { + return byteArrayToHex(base64.toByteArray(padding(str))); + } + + module.exports = { + encodeString: encodeString, + decodeToString: decodeToString, + byteArrayToString: byteArrayToString, + stringToByteArray: stringToByteArray, + padding: padding, + byteArrayToHex: byteArrayToHex, + decodeToHEX: decodeToHEX + }; + + +/***/ }, +/* 17 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Root reference for iframes. + */ + + var root; + if (typeof window !== 'undefined') { // Browser window + root = window; + } else if (typeof self !== 'undefined') { // Web Worker + root = self; + } else { // Other environments + console.warn("Using browser-only version of superagent in non-browser environment"); + root = this; + } + + var Emitter = __webpack_require__(23); + var RequestBase = __webpack_require__(33); + var isObject = __webpack_require__(14); + var isFunction = __webpack_require__(32); + var ResponseBase = __webpack_require__(34); + var shouldRetry = __webpack_require__(35); + + /** + * Noop. + */ + + function noop(){}; + + /** + * Expose `request`. + */ + + var request = exports = module.exports = function(method, url) { + // callback + if ('function' == typeof url) { + return new exports.Request('GET', method).end(url); + } + + // url first + if (1 == arguments.length) { + return new exports.Request('GET', method); + } + + return new exports.Request(method, url); + } + + exports.Request = Request; + + /** + * Determine XHR. + */ + + request.getXHR = function () { + if (root.XMLHttpRequest + && (!root.location || 'file:' != root.location.protocol + || !root.ActiveXObject)) { + return new XMLHttpRequest; + } else { + try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {} + try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch(e) {} + try { return new ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch(e) {} + try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) {} + } + throw Error("Browser-only verison of superagent could not find XHR"); + }; + + /** + * Removes leading and trailing whitespace, added to support IE. + * + * @param {String} s + * @return {String} + * @api private + */ + + var trim = ''.trim + ? function(s) { return s.trim(); } + : function(s) { return s.replace(/(^\s*|\s*$)/g, ''); }; + + /** + * Serialize the given `obj`. + * + * @param {Object} obj + * @return {String} + * @api private + */ + + function serialize(obj) { + if (!isObject(obj)) return obj; + var pairs = []; + for (var key in obj) { + pushEncodedKeyValuePair(pairs, key, obj[key]); + } + return pairs.join('&'); + } + + /** + * Helps 'serialize' with serializing arrays. + * Mutates the pairs array. + * + * @param {Array} pairs + * @param {String} key + * @param {Mixed} val + */ + + function pushEncodedKeyValuePair(pairs, key, val) { + if (val != null) { + if (Array.isArray(val)) { + val.forEach(function(v) { + pushEncodedKeyValuePair(pairs, key, v); + }); + } else if (isObject(val)) { + for(var subkey in val) { + pushEncodedKeyValuePair(pairs, key + '[' + subkey + ']', val[subkey]); + } + } else { + pairs.push(encodeURIComponent(key) + + '=' + encodeURIComponent(val)); + } + } else if (val === null) { + pairs.push(encodeURIComponent(key)); + } + } + + /** + * Expose serialization method. + */ + + request.serializeObject = serialize; + + /** + * Parse the given x-www-form-urlencoded `str`. + * + * @param {String} str + * @return {Object} + * @api private + */ + + function parseString(str) { + var obj = {}; + var pairs = str.split('&'); + var pair; + var pos; + + for (var i = 0, len = pairs.length; i < len; ++i) { + pair = pairs[i]; + pos = pair.indexOf('='); + if (pos == -1) { + obj[decodeURIComponent(pair)] = ''; + } else { + obj[decodeURIComponent(pair.slice(0, pos))] = + decodeURIComponent(pair.slice(pos + 1)); + } + } + + return obj; + } + + /** + * Expose parser. + */ + + request.parseString = parseString; + + /** + * Default MIME type map. + * + * superagent.types.xml = 'application/xml'; + * + */ + + request.types = { + html: 'text/html', + json: 'application/json', + xml: 'application/xml', + urlencoded: 'application/x-www-form-urlencoded', + 'form': 'application/x-www-form-urlencoded', + 'form-data': 'application/x-www-form-urlencoded' + }; + + /** + * Default serialization map. + * + * superagent.serialize['application/xml'] = function(obj){ + * return 'generated xml here'; + * }; + * + */ + + request.serialize = { + 'application/x-www-form-urlencoded': serialize, + 'application/json': JSON.stringify + }; + + /** + * Default parsers. + * + * superagent.parse['application/xml'] = function(str){ + * return { object parsed from str }; + * }; + * + */ + + request.parse = { + 'application/x-www-form-urlencoded': parseString, + 'application/json': JSON.parse + }; + + /** + * Parse the given header `str` into + * an object containing the mapped fields. + * + * @param {String} str + * @return {Object} + * @api private + */ + + function parseHeader(str) { + var lines = str.split(/\r?\n/); + var fields = {}; + var index; + var line; + var field; + var val; + + lines.pop(); // trailing CRLF + + for (var i = 0, len = lines.length; i < len; ++i) { + line = lines[i]; + index = line.indexOf(':'); + field = line.slice(0, index).toLowerCase(); + val = trim(line.slice(index + 1)); + fields[field] = val; + } + + return fields; + } + + /** + * Check if `mime` is json or has +json structured syntax suffix. + * + * @param {String} mime + * @return {Boolean} + * @api private + */ + + function isJSON(mime) { + return /[\/+]json\b/.test(mime); + } + + /** + * Initialize a new `Response` with the given `xhr`. + * + * - set flags (.ok, .error, etc) + * - parse header + * + * Examples: + * + * Aliasing `superagent` as `request` is nice: + * + * request = superagent; + * + * We can use the promise-like API, or pass callbacks: + * + * request.get('/').end(function(res){}); + * request.get('/', function(res){}); + * + * Sending data can be chained: + * + * request + * .post('/user') + * .send({ name: 'tj' }) + * .end(function(res){}); + * + * Or passed to `.send()`: + * + * request + * .post('/user') + * .send({ name: 'tj' }, function(res){}); + * + * Or passed to `.post()`: + * + * request + * .post('/user', { name: 'tj' }) + * .end(function(res){}); + * + * Or further reduced to a single call for simple cases: + * + * request + * .post('/user', { name: 'tj' }, function(res){}); + * + * @param {XMLHTTPRequest} xhr + * @param {Object} options + * @api private + */ + + function Response(req) { + this.req = req; + this.xhr = this.req.xhr; + // responseText is accessible only if responseType is '' or 'text' and on older browsers + this.text = ((this.req.method !='HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text')) || typeof this.xhr.responseType === 'undefined') + ? this.xhr.responseText + : null; + this.statusText = this.req.xhr.statusText; + var status = this.xhr.status; + // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request + if (status === 1223) { + status = 204; + } + this._setStatusProperties(status); + this.header = this.headers = parseHeader(this.xhr.getAllResponseHeaders()); + // getAllResponseHeaders sometimes falsely returns "" for CORS requests, but + // getResponseHeader still works. so we get content-type even if getting + // other headers fails. + this.header['content-type'] = this.xhr.getResponseHeader('content-type'); + this._setHeaderProperties(this.header); + + if (null === this.text && req._responseType) { + this.body = this.xhr.response; + } else { + this.body = this.req.method != 'HEAD' + ? this._parseBody(this.text ? this.text : this.xhr.response) + : null; + } + } + + ResponseBase(Response.prototype); + + /** + * Parse the given body `str`. + * + * Used for auto-parsing of bodies. Parsers + * are defined on the `superagent.parse` object. + * + * @param {String} str + * @return {Mixed} + * @api private + */ + + Response.prototype._parseBody = function(str){ + var parse = request.parse[this.type]; + if(this.req._parser) { + return this.req._parser(this, str); + } + if (!parse && isJSON(this.type)) { + parse = request.parse['application/json']; + } + return parse && str && (str.length || str instanceof Object) + ? parse(str) + : null; + }; + + /** + * Return an `Error` representative of this response. + * + * @return {Error} + * @api public + */ + + Response.prototype.toError = function(){ + var req = this.req; + var method = req.method; + var url = req.url; + + var msg = 'cannot ' + method + ' ' + url + ' (' + this.status + ')'; + var err = new Error(msg); + err.status = this.status; + err.method = method; + err.url = url; + + return err; + }; + + /** + * Expose `Response`. + */ + + request.Response = Response; + + /** + * Initialize a new `Request` with the given `method` and `url`. + * + * @param {String} method + * @param {String} url + * @api public + */ + + function Request(method, url) { + var self = this; + this._query = this._query || []; + this.method = method; + this.url = url; + this.header = {}; // preserves header name case + this._header = {}; // coerces header names to lowercase + this.on('end', function(){ + var err = null; + var res = null; + + try { + res = new Response(self); + } catch(e) { + err = new Error('Parser is unable to parse the response'); + err.parse = true; + err.original = e; + // issue #675: return the raw response if the response parsing fails + if (self.xhr) { + // ie9 doesn't have 'response' property + err.rawResponse = typeof self.xhr.responseType == 'undefined' ? self.xhr.responseText : self.xhr.response; + // issue #876: return the http status code if the response parsing fails + err.status = self.xhr.status ? self.xhr.status : null; + err.statusCode = err.status; // backwards-compat only + } else { + err.rawResponse = null; + err.status = null; + } + + return self.callback(err); + } + + self.emit('response', res); + + var new_err; + try { + if (!self._isResponseOK(res)) { + new_err = new Error(res.statusText || 'Unsuccessful HTTP response'); + new_err.original = err; + new_err.response = res; + new_err.status = res.status; + } + } catch(e) { + new_err = e; // #985 touching res may cause INVALID_STATE_ERR on old Android + } + + // #1000 don't catch errors from the callback to avoid double calling it + if (new_err) { + self.callback(new_err, res); + } else { + self.callback(null, res); + } + }); + } + + /** + * Mixin `Emitter` and `RequestBase`. + */ + + Emitter(Request.prototype); + RequestBase(Request.prototype); + + /** + * Set Content-Type to `type`, mapping values from `request.types`. + * + * Examples: + * + * superagent.types.xml = 'application/xml'; + * + * request.post('/') + * .type('xml') + * .send(xmlstring) + * .end(callback); + * + * request.post('/') + * .type('application/xml') + * .send(xmlstring) + * .end(callback); + * + * @param {String} type + * @return {Request} for chaining + * @api public + */ + + Request.prototype.type = function(type){ + this.set('Content-Type', request.types[type] || type); + return this; + }; + + /** + * Set Accept to `type`, mapping values from `request.types`. + * + * Examples: + * + * superagent.types.json = 'application/json'; + * + * request.get('/agent') + * .accept('json') + * .end(callback); + * + * request.get('/agent') + * .accept('application/json') + * .end(callback); + * + * @param {String} accept + * @return {Request} for chaining + * @api public + */ + + Request.prototype.accept = function(type){ + this.set('Accept', request.types[type] || type); + return this; + }; + + /** + * Set Authorization field value with `user` and `pass`. + * + * @param {String} user + * @param {String} [pass] optional in case of using 'bearer' as type + * @param {Object} options with 'type' property 'auto', 'basic' or 'bearer' (default 'basic') + * @return {Request} for chaining + * @api public + */ + + Request.prototype.auth = function(user, pass, options){ + if (typeof pass === 'object' && pass !== null) { // pass is optional and can substitute for options + options = pass; + } + if (!options) { + options = { + type: 'function' === typeof btoa ? 'basic' : 'auto', + } + } + + switch (options.type) { + case 'basic': + this.set('Authorization', 'Basic ' + btoa(user + ':' + pass)); + break; + + case 'auto': + this.username = user; + this.password = pass; + break; + + case 'bearer': // usage would be .auth(accessToken, { type: 'bearer' }) + this.set('Authorization', 'Bearer ' + user); + break; + } + return this; + }; + + /** + * Add query-string `val`. + * + * Examples: + * + * request.get('/shoes') + * .query('size=10') + * .query({ color: 'blue' }) + * + * @param {Object|String} val + * @return {Request} for chaining + * @api public + */ + + Request.prototype.query = function(val){ + if ('string' != typeof val) val = serialize(val); + if (val) this._query.push(val); + return this; + }; + + /** + * Queue the given `file` as an attachment to the specified `field`, + * with optional `options` (or filename). + * + * ``` js + * request.post('/upload') + * .attach('content', new Blob(['hey!'], { type: "text/html"})) + * .end(callback); + * ``` + * + * @param {String} field + * @param {Blob|File} file + * @param {String|Object} options + * @return {Request} for chaining + * @api public + */ + + Request.prototype.attach = function(field, file, options){ + if (file) { + if (this._data) { + throw Error("superagent can't mix .send() and .attach()"); + } + + this._getFormData().append(field, file, options || file.name); + } + return this; + }; + + Request.prototype._getFormData = function(){ + if (!this._formData) { + this._formData = new root.FormData(); + } + return this._formData; + }; + + /** + * Invoke the callback with `err` and `res` + * and handle arity check. + * + * @param {Error} err + * @param {Response} res + * @api private + */ + + Request.prototype.callback = function(err, res){ + // console.log(this._retries, this._maxRetries) + if (this._maxRetries && this._retries++ < this._maxRetries && shouldRetry(err, res)) { + return this._retry(); + } + + var fn = this._callback; + this.clearTimeout(); + + if (err) { + if (this._maxRetries) err.retries = this._retries - 1; + this.emit('error', err); + } + + fn(err, res); + }; + + /** + * Invoke callback with x-domain error. + * + * @api private + */ + + Request.prototype.crossDomainError = function(){ + var err = new Error('Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.'); + err.crossDomain = true; + + err.status = this.status; + err.method = this.method; + err.url = this.url; + + this.callback(err); + }; + + // This only warns, because the request is still likely to work + Request.prototype.buffer = Request.prototype.ca = Request.prototype.agent = function(){ + console.warn("This is not supported in browser version of superagent"); + return this; + }; + + // This throws, because it can't send/receive data as expected + Request.prototype.pipe = Request.prototype.write = function(){ + throw Error("Streaming is not supported in browser version of superagent"); + }; + + /** + * Compose querystring to append to req.url + * + * @api private + */ + + Request.prototype._appendQueryString = function(){ + var query = this._query.join('&'); + if (query) { + this.url += (this.url.indexOf('?') >= 0 ? '&' : '?') + query; + } + + if (this._sort) { + var index = this.url.indexOf('?'); + if (index >= 0) { + var queryArr = this.url.substring(index + 1).split('&'); + if (isFunction(this._sort)) { + queryArr.sort(this._sort); + } else { + queryArr.sort(); + } + this.url = this.url.substring(0, index) + '?' + queryArr.join('&'); + } + } + }; + + /** + * Check if `obj` is a host object, + * we don't want to serialize these :) + * + * @param {Object} obj + * @return {Boolean} + * @api private + */ + Request.prototype._isHost = function _isHost(obj) { + // Native objects stringify to [object File], [object Blob], [object FormData], etc. + return obj && 'object' === typeof obj && !Array.isArray(obj) && Object.prototype.toString.call(obj) !== '[object Object]'; + } + + /** + * Initiate request, invoking callback `fn(res)` + * with an instanceof `Response`. + * + * @param {Function} fn + * @return {Request} for chaining + * @api public + */ + + Request.prototype.end = function(fn){ + if (this._endCalled) { + console.warn("Warning: .end() was called twice. This is not supported in superagent"); + } + this._endCalled = true; + + // store callback + this._callback = fn || noop; + + // querystring + this._appendQueryString(); + + return this._end(); + }; + + Request.prototype._end = function() { + var self = this; + var xhr = this.xhr = request.getXHR(); + var data = this._formData || this._data; + + this._setTimeouts(); + + // state change + xhr.onreadystatechange = function(){ + var readyState = xhr.readyState; + if (readyState >= 2 && self._responseTimeoutTimer) { + clearTimeout(self._responseTimeoutTimer); + } + if (4 != readyState) { + return; + } + + // In IE9, reads to any property (e.g. status) off of an aborted XHR will + // result in the error "Could not complete the operation due to error c00c023f" + var status; + try { status = xhr.status } catch(e) { status = 0; } + + if (!status) { + if (self.timedout || self._aborted) return; + return self.crossDomainError(); + } + self.emit('end'); + }; + + // progress + var handleProgress = function(direction, e) { + if (e.total > 0) { + e.percent = e.loaded / e.total * 100; + } + e.direction = direction; + self.emit('progress', e); + } + if (this.hasListeners('progress')) { + try { + xhr.onprogress = handleProgress.bind(null, 'download'); + if (xhr.upload) { + xhr.upload.onprogress = handleProgress.bind(null, 'upload'); + } + } catch(e) { + // Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist. + // Reported here: + // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context + } + } + + // initiate request + try { + if (this.username && this.password) { + xhr.open(this.method, this.url, true, this.username, this.password); + } else { + xhr.open(this.method, this.url, true); + } + } catch (err) { + // see #1149 + return this.callback(err); + } + + // CORS + if (this._withCredentials) xhr.withCredentials = true; + + // body + if (!this._formData && 'GET' != this.method && 'HEAD' != this.method && 'string' != typeof data && !this._isHost(data)) { + // serialize stuff + var contentType = this._header['content-type']; + var serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : '']; + if (!serialize && isJSON(contentType)) { + serialize = request.serialize['application/json']; + } + if (serialize) data = serialize(data); + } + + // set header fields + for (var field in this.header) { + if (null == this.header[field]) continue; + xhr.setRequestHeader(field, this.header[field]); + } + + if (this._responseType) { + xhr.responseType = this._responseType; + } + + // send stuff + this.emit('request', this); + + // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing) + // We need null here if data is undefined + xhr.send(typeof data !== 'undefined' ? data : null); + return this; + }; + + /** + * GET `url` with optional callback `fn(res)`. + * + * @param {String} url + * @param {Mixed|Function} [data] or fn + * @param {Function} [fn] + * @return {Request} + * @api public + */ + + request.get = function(url, data, fn){ + var req = request('GET', url); + if ('function' == typeof data) fn = data, data = null; + if (data) req.query(data); + if (fn) req.end(fn); + return req; + }; + + /** + * HEAD `url` with optional callback `fn(res)`. + * + * @param {String} url + * @param {Mixed|Function} [data] or fn + * @param {Function} [fn] + * @return {Request} + * @api public + */ + + request.head = function(url, data, fn){ + var req = request('HEAD', url); + if ('function' == typeof data) fn = data, data = null; + if (data) req.send(data); + if (fn) req.end(fn); + return req; + }; + + /** + * OPTIONS query to `url` with optional callback `fn(res)`. + * + * @param {String} url + * @param {Mixed|Function} [data] or fn + * @param {Function} [fn] + * @return {Request} + * @api public + */ + + request.options = function(url, data, fn){ + var req = request('OPTIONS', url); + if ('function' == typeof data) fn = data, data = null; + if (data) req.send(data); + if (fn) req.end(fn); + return req; + }; + + /** + * DELETE `url` with optional `data` and callback `fn(res)`. + * + * @param {String} url + * @param {Mixed} [data] + * @param {Function} [fn] + * @return {Request} + * @api public + */ + + function del(url, data, fn){ + var req = request('DELETE', url); + if ('function' == typeof data) fn = data, data = null; + if (data) req.send(data); + if (fn) req.end(fn); + return req; + }; + + request['del'] = del; + request['delete'] = del; + + /** + * PATCH `url` with optional `data` and callback `fn(res)`. + * + * @param {String} url + * @param {Mixed} [data] + * @param {Function} [fn] + * @return {Request} + * @api public + */ + + request.patch = function(url, data, fn){ + var req = request('PATCH', url); + if ('function' == typeof data) fn = data, data = null; + if (data) req.send(data); + if (fn) req.end(fn); + return req; + }; + + /** + * POST `url` with optional `data` and callback `fn(res)`. + * + * @param {String} url + * @param {Mixed} [data] + * @param {Function} [fn] + * @return {Request} + * @api public + */ + + request.post = function(url, data, fn){ + var req = request('POST', url); + if ('function' == typeof data) fn = data, data = null; + if (data) req.send(data); + if (fn) req.end(fn); + return req; + }; + + /** + * PUT `url` with optional `data` and callback `fn(res)`. + * + * @param {String} url + * @param {Mixed|Function} [data] or fn + * @param {Function} [fn] + * @return {Request} + * @api public + */ + + request.put = function(url, data, fn){ + var req = request('PUT', url); + if ('function' == typeof data) fn = data, data = null; + if (data) req.send(data); + if (fn) req.end(fn); + return req; + }; + + +/***/ }, +/* 18 */ +/***/ function(module, exports) { + + var WinChan = (function() { + var RELAY_FRAME_NAME = "__winchan_relay_frame"; + var CLOSE_CMD = "die"; + + // a portable addListener implementation + function addListener(w, event, cb) { + if(w.attachEvent) w.attachEvent('on' + event, cb); + else if (w.addEventListener) w.addEventListener(event, cb, false); + } + + // a portable removeListener implementation + function removeListener(w, event, cb) { + if(w.detachEvent) w.detachEvent('on' + event, cb); + else if (w.removeEventListener) w.removeEventListener(event, cb, false); + } + + + // checking for IE8 or above + function isInternetExplorer() { + if (typeof navigator === 'undefined') { + return false; + } + + var rv = -1; // Return value assumes failure. + var ua = navigator.userAgent; + if (navigator.appName === 'Microsoft Internet Explorer') { + var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); + if (re.exec(ua) != null) + rv = parseFloat(RegExp.$1); + } + // IE > 11 + else if (ua.indexOf("Trident") > -1) { + var re = new RegExp("rv:([0-9]{2,2}[\.0-9]{0,})"); + if (re.exec(ua) !== null) { + rv = parseFloat(RegExp.$1); + } + } + + return rv >= 8; + } + + // checking Mobile Firefox (Fennec) + function isFennec() { + try { + // We must check for both XUL and Java versions of Fennec. Both have + // distinct UA strings. + var userAgent = navigator.userAgent; + return (userAgent.indexOf('Fennec/') != -1) || // XUL + (userAgent.indexOf('Firefox/') != -1 && userAgent.indexOf('Android') != -1); // Java + } catch(e) {} + return false; + } + + // feature checking to see if this platform is supported at all + function isSupported() { + return (typeof window !== 'undefined' && window.JSON && window.JSON.stringify && + window.JSON.parse && window.postMessage); + } + + // given a URL, extract the origin. Taken from: https://github.com/firebase/firebase-simple-login/blob/d2cb95b9f812d8488bdbfba51c3a7c153ba1a074/js/src/simple-login/transports/WinChan.js#L25-L30 + function extractOrigin(url) { + if (!/^https?:\/\//.test(url)) url = window.location.href; + var m = /^(https?:\/\/[\-_a-zA-Z\.0-9:]+)/.exec(url); + if (m) return m[1]; + return url; + } + + // find the relay iframe in the opener + function findRelay() { + var loc = window.location; + var frames = window.opener.frames; + for (var i = frames.length - 1; i >= 0; i--) { + try { + if (frames[i].location.protocol === window.location.protocol && + frames[i].location.host === window.location.host && + frames[i].name === RELAY_FRAME_NAME) + { + return frames[i]; + } + } catch(e) { } + } + return; + } + + var isIE = isInternetExplorer(); + + if (isSupported()) { + /* General flow: + * 0. user clicks + * (IE SPECIFIC) 1. caller adds relay iframe (served from trusted domain) to DOM + * 2. caller opens window (with content from trusted domain) + * 3. window on opening adds a listener to 'message' + * (IE SPECIFIC) 4. window on opening finds iframe + * 5. window checks if iframe is "loaded" - has a 'doPost' function yet + * (IE SPECIFIC5) 5a. if iframe.doPost exists, window uses it to send ready event to caller + * (IE SPECIFIC5) 5b. if iframe.doPost doesn't exist, window waits for frame ready + * (IE SPECIFIC5) 5bi. once ready, window calls iframe.doPost to send ready event + * 6. caller upon reciept of 'ready', sends args + */ + return { + open: function(opts, cb) { + if (!cb) throw "missing required callback argument"; + + // test required options + var err; + if (!opts.url) err = "missing required 'url' parameter"; + if (!opts.relay_url) err = "missing required 'relay_url' parameter"; + if (err) setTimeout(function() { cb(err); }, 0); + + // supply default options + if (!opts.window_name) opts.window_name = null; + if (!opts.window_features || isFennec()) opts.window_features = undefined; + + // opts.params may be undefined + + var iframe; + + // sanity check, are url and relay_url the same origin? + var origin = opts.origin || extractOrigin(opts.url); + if (origin !== extractOrigin(opts.relay_url)) { + return setTimeout(function() { + cb('invalid arguments: origin of url and relay_url must match'); + }, 0); + } + + var messageTarget; + + if (isIE) { + // first we need to add a "relay" iframe to the document that's served + // from the target domain. We can postmessage into a iframe, but not a + // window + iframe = document.createElement("iframe"); + // iframe.setAttribute('name', framename); + iframe.setAttribute('src', opts.relay_url); + iframe.style.display = "none"; + iframe.setAttribute('name', RELAY_FRAME_NAME); + document.body.appendChild(iframe); + messageTarget = iframe.contentWindow; + } + + var w = opts.popup || window.open(opts.url, opts.window_name, opts.window_features); + if (opts.popup) { + w.location.href = opts.url; + } + + if (!messageTarget) messageTarget = w; + + // lets listen in case the window blows up before telling us + var closeInterval = setInterval(function() { + if (w && w.closed) { + cleanup(); + if (cb) { + cb('User closed the popup window'); + cb = null; + } + } + }, 500); + + var req = JSON.stringify({a: 'request', d: opts.params}); + + // cleanup on unload + function cleanup() { + if (iframe) document.body.removeChild(iframe); + iframe = undefined; + if (closeInterval) closeInterval = clearInterval(closeInterval); + removeListener(window, 'message', onMessage); + removeListener(window, 'unload', cleanup); + if (w) { + try { + w.close(); + } catch (securityViolation) { + // This happens in Opera 12 sometimes + // see https://github.com/mozilla/browserid/issues/1844 + messageTarget.postMessage(CLOSE_CMD, origin); + } + } + w = messageTarget = undefined; + } + + addListener(window, 'unload', cleanup); + + function onMessage(e) { + if (e.origin !== origin) { return; } + try { + var d = JSON.parse(e.data); + } catch(err) { + if (cb) { + cb(err); + } else { + throw err; + } + } + + if (d.a === 'ready') { + messageTarget.postMessage(req, origin); + } else if (d.a === 'error') { + cleanup(); + if (cb) { + cb(d.d); + cb = null; + } + } else if (d.a === 'response') { + cleanup(); + if (cb) { + cb(null, d.d); + cb = null; + } + } + } + + addListener(window, 'message', onMessage); + + return { + close: cleanup, + focus: function() { + if (w) { + try { + w.focus(); + } catch (e) { + // IE7 blows up here, do nothing + } + } + } + }; + }, + onOpen: function(cb) { + var o = "*"; + var msgTarget = isIE ? findRelay() : window.opener; + if (!msgTarget) throw "can't find relay frame"; + function doPost(msg) { + msg = JSON.stringify(msg); + if (isIE) msgTarget.doPost(msg, o); + else msgTarget.postMessage(msg, o); + } + + function onMessage(e) { + // only one message gets through, but let's make sure it's actually + // the message we're looking for (other code may be using + // postmessage) - we do this by ensuring the payload can + // be parsed, and it's got an 'a' (action) value of 'request'. + var d; + try { + d = JSON.parse(e.data); + } catch(err) { } + if (!d || d.a !== 'request') return; + removeListener(window, 'message', onMessage); + o = e.origin; + if (cb) { + // this setTimeout is critically important for IE8 - + // in ie8 sometimes addListener for 'message' can synchronously + // cause your callback to be invoked. awesome. + setTimeout(function() { + cb(o, d.d, function(r) { + cb = undefined; + doPost({a: 'response', d: r}); + }); + }, 0); + } + } + + function onDie(e) { + if (e.data === CLOSE_CMD) { + try { window.close(); } catch (o_O) {} + } + } + addListener(isIE ? msgTarget : window, 'message', onMessage); + addListener(isIE ? msgTarget : window, 'message', onDie); + + // we cannot post to our parent that we're ready before the iframe + // is loaded. (IE specific possible failure) + try { + doPost({a: "ready"}); + } catch(e) { + // this code should never be exectued outside IE + addListener(msgTarget, 'load', function(e) { + doPost({a: "ready"}); + }); + } + + // if window is unloaded and the client hasn't called cb, it's an error + var onUnload = function() { + try { + // IE8 doesn't like this... + removeListener(isIE ? msgTarget : window, 'message', onDie); + } catch (ohWell) { } + if (cb) doPost({ a: 'error', d: 'client closed window' }); + cb = undefined; + // explicitly close the window, in case the client is trying to reload or nav + try { window.close(); } catch (e) { } + }; + addListener(window, 'unload', onUnload); + return { + detach: function() { + removeListener(window, 'unload', onUnload); + } + }; + } + }; + } else { + return { + open: function(url, winopts, arg, cb) { + setTimeout(function() { cb("unsupported browser"); }, 0); + }, + onOpen: function(cb) { + setTimeout(function() { cb("unsupported browser"); }, 0); + } + }; + } + })(); + + if (typeof module !== 'undefined' && module.exports) { + module.exports = WinChan; + } + + +/***/ }, +/* 19 */ +/***/ function(module, exports, __webpack_require__) { + + var urljoin = __webpack_require__(1); + + var RequestBuilder = __webpack_require__(10); + var qs = __webpack_require__(5); + var objectHelper = __webpack_require__(2); + var assert = __webpack_require__(4); + var responseHandler = __webpack_require__(6); + var parametersWhitelist = __webpack_require__(45); + var Warn = __webpack_require__(11); + + var PasswordlessAuthentication = __webpack_require__(41); + var DBConnection = __webpack_require__(40); + + /** + * Creates a new Auth0 Authentication API client + * @constructor + * @param {Object} options + * @param {String} options.domain your Auth0 domain + * @param {String} options.clientID your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard + * @param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorization Response + * @param {String} [options.responseType] type of the response used by OAuth 2.0 flow. It can be any space separated list of the values `code`, `token`, `id_token`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0} + * @param {String} [options.responseMode] how the Auth response is encoded and redirected back to the client. Supported values are `query`, `fragment` and `form_post`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes} + * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email` + * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth + * @see {@link https://auth0.com/docs/api/authentication} + */ + function Authentication(options) { + /* eslint-disable */ + assert.check( + options, + { type: 'object', message: 'options parameter is not valid' }, + { + domain: { type: 'string', message: 'domain option is required' }, + clientID: { type: 'string', message: 'clientID option is required' }, + responseType: { optional: true, type: 'string', message: 'responseType is not valid' }, + responseMode: { optional: true, type: 'string', message: 'responseMode is not valid' }, + redirectUri: { optional: true, type: 'string', message: 'redirectUri is not valid' }, + scope: { optional: true, type: 'string', message: 'scope is not valid' }, + audience: { optional: true, type: 'string', message: 'audience is not valid' }, + _disableDeprecationWarnings: { + optional: true, + type: 'boolean', + message: '_disableDeprecationWarnings option is not valid' + }, + _sendTelemetry: { + optional: true, + type: 'boolean', + message: '_sendTelemetry option is not valid' + }, + _telemetryInfo: { + optional: true, + type: 'object', + message: '_telemetryInfo option is not valid' + } + } + ); + /* eslint-enable */ + + this.baseOptions = options; + + this.baseOptions._sendTelemetry = this.baseOptions._sendTelemetry === false + ? this.baseOptions._sendTelemetry + : true; + + this.baseOptions.rootUrl = 'https://' + this.baseOptions.domain; + + this.request = new RequestBuilder(this.baseOptions); + + this.passwordless = new PasswordlessAuthentication(this.request, this.baseOptions); + this.dbConnection = new DBConnection(this.request, this.baseOptions); + + this.warn = new Warn({ + disableWarnings: !!options._disableDeprecationWarnings + }); + } + + /** + * Builds and returns the `/authorize` url in order to initialize a new authN/authZ transaction + * + * @method buildAuthorizeUrl + * @param {Object} options + * @param {String} [options.domain] your Auth0 domain + * @param {String} [options.clientID] your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard + * @param {String} options.redirectUri url that the Auth0 will redirect after Auth with the Authorization Response + * @param {String} options.responseType type of the response used by OAuth 2.0 flow. It can be any space separated list of the values `code`, `token`, `id_token`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0} + * @param {String} [options.responseMode] how the Auth response is encoded and redirected back to the client. Supported values are `query`, `fragment` and `form_post`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes} + * @param {String} [options.state] value used to mitigate XSRF attacks. {@link https://auth0.com/docs/protocols/oauth2/oauth-state} + * @param {String} [options.nonce] value used to mitigate replay attacks when using Implicit Grant. {@link https://auth0.com/docs/api-auth/tutorials/nonce} + * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email` + * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth + * @see {@link https://auth0.com/docs/api/authentication#authorize-client} + * @see {@link https://auth0.com/docs/api/authentication#social} + */ + Authentication.prototype.buildAuthorizeUrl = function(options) { + var params; + var qString; + + assert.check(options, { type: 'object', message: 'options parameter is not valid' }); + + params = objectHelper + .merge(this.baseOptions, [ + 'clientID', + 'responseType', + 'responseMode', + 'redirectUri', + 'scope', + 'audience' + ]) + .with(options); + + /* eslint-disable */ + assert.check( + params, + { type: 'object', message: 'options parameter is not valid' }, + { + clientID: { type: 'string', message: 'clientID option is required' }, + redirectUri: { optional: true, type: 'string', message: 'redirectUri option is required' }, + responseType: { type: 'string', message: 'responseType option is required' }, + nonce: { + type: 'string', + message: 'nonce option is required', + condition: function(o) { + return o.responseType.indexOf('code') === -1 && o.responseType.indexOf('id_token') !== -1; + } + }, + scope: { optional: true, type: 'string', message: 'scope option is required' }, + audience: { optional: true, type: 'string', message: 'audience option is required' } + } + ); + /* eslint-enable */ + + // eslint-disable-next-line + if (this.baseOptions._sendTelemetry) { + params.auth0Client = this.request.getTelemetryData(); + } + + if (params.connection_scope && assert.isArray(params.connection_scope)) { + params.connection_scope = params.connection_scope.join(','); + } + + params = objectHelper.toSnakeCase(params, ['auth0Client']); + params = parametersWhitelist.oauthAuthorizeParams(this.warn, params); + + qString = qs.stringify(params); + + return urljoin(this.baseOptions.rootUrl, 'authorize', '?' + qString); + }; + + /** + * Builds and returns the Logout url in order to initialize a new authN/authZ transaction + * + * If you want to navigate the user to a specific URL after the logout, set that URL at the returnTo parameter. The URL should be included in any the appropriate Allowed Logout URLs list: + * + * - If the client_id parameter is included, the returnTo URL must be listed in the Allowed Logout URLs set at the client level (see Setting Allowed Logout URLs at the App Level). + * - If the client_id parameter is NOT included, the returnTo URL must be listed in the Allowed Logout URLs set at the account level (see Setting Allowed Logout URLs at the Account Level). + * @method buildLogoutUrl + * @param {Object} options + * @param {String} [options.clientID] identifier of your client + * @param {String} [options.returnTo] URL to be redirected after the logout + * @param {Boolean} [options.federated] tells Auth0 if it should logout the user also from the IdP. + * @see {@link https://auth0.com/docs/api/authentication#logout} + */ + Authentication.prototype.buildLogoutUrl = function(options) { + var params; + var qString; + + assert.check(options, { + optional: true, + type: 'object', + message: 'options parameter is not valid' + }); + + params = objectHelper.merge(this.baseOptions, ['clientID']).with(options || {}); + + // eslint-disable-next-line + if (this.baseOptions._sendTelemetry) { + params.auth0Client = this.request.getTelemetryData(); + } + + params = objectHelper.toSnakeCase(params, ['auth0Client', 'returnTo']); + + qString = qs.stringify(params); + + return urljoin(this.baseOptions.rootUrl, 'v2', 'logout', '?' + qString); + }; + + /** + * @callback authorizeCallback + * @param {Error} [err] error returned by Auth0 with the reason of the Auth failure + * @param {Object} [result] result of the Auth request + * @param {String} [result.accessToken] token that allows access to the specified resource server (identified by the audience parameter or by default Auth0's /userinfo endpoint) + * @param {Number} [result.expiresIn] number of seconds until the access token expires + * @param {String} [result.idToken] token that identifies the user + * @param {String} [result.refreshToken] token that can be used to get new access tokens from Auth0. Note that not all clients can request them or the resource server might not allow them. + */ + + /** + * @callback tokenCallback + * @param {Error} [err] error returned by Auth0 with the reason of the Auth failure + * @param {Object} [result] result of the Auth request + * @param {String} result.accessToken token that allows access to the specified resource server (identified by the audience parameter or by default Auth0's /userinfo endpoint) + * @param {Number} result.expiresIn number of seconds until the access token expires + * @param {String} [result.idToken] token that identifies the user + * @param {String} [result.refreshToken] token that can be used to get new access tokens from Auth0. Note that not all clients can request them or the resource server might not allow them. + */ + + /** + * Makes a call to the `oauth/token` endpoint with `password` grant type to login to the default directory. + * + * @method loginWithDefaultDirectory + * @param {Object} options + * @param {String} options.username email or username of the user that will perform Auth + * @param {String} options.password the password of the user that will perform Auth + * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email` + * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth + * @param {tokenCallback} cb function called with the result of the request + * @see {@link https://auth0.com/docs/api-auth/grant/password} + */ + Authentication.prototype.loginWithDefaultDirectory = function(options, cb) { + assert.check( + options, + { type: 'object', message: 'options parameter is not valid' }, + { + username: { type: 'string', message: 'username option is required' }, + password: { type: 'string', message: 'password option is required' }, + scope: { optional: true, type: 'string', message: 'scope option is required' }, + audience: { optional: true, type: 'string', message: 'audience option is required' } + } + ); + + options.grantType = 'password'; + + return this.oauthToken(options, cb); + }; + + /** + * Makes a call to the `oauth/token` endpoint with `password-realm` grant type + * + * @method login + * @param {Object} options + * @param {String} options.username email or username of the user that will perform Auth + * @param {String} options.password the password of the user that will perform Auth + * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email` + * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth + * @param {Object} options.realm the HRD domain or the connection name where the user belongs to. e.g. `Username-Password-Authentication` + * @param {tokenCallback} cb function called with the result of the request + * @see {@link https://auth0.com/docs/api-auth/grant/password} + */ + Authentication.prototype.login = function(options, cb) { + assert.check( + options, + { type: 'object', message: 'options parameter is not valid' }, + { + username: { type: 'string', message: 'username option is required' }, + password: { type: 'string', message: 'password option is required' }, + realm: { type: 'string', message: 'realm option is required' }, + scope: { optional: true, type: 'string', message: 'scope option is required' }, + audience: { optional: true, type: 'string', message: 'audience option is required' } + } + ); + + options.grantType = 'http://auth0.com/oauth/grant-type/password-realm'; + + return this.oauthToken(options, cb); + }; + + /** + * Makes a call to the `oauth/token` endpoint + * + * @method oauthToken + * @private + */ + Authentication.prototype.oauthToken = function(options, cb) { + var url; + var body; + + assert.check(options, { type: 'object', message: 'options parameter is not valid' }); + assert.check(cb, { type: 'function', message: 'cb parameter is not valid' }); + + url = urljoin(this.baseOptions.rootUrl, 'oauth', 'token'); + + body = objectHelper.merge(this.baseOptions, ['clientID', 'scope', 'audience']).with(options); + + assert.check( + body, + { type: 'object', message: 'options parameter is not valid' }, + { + clientID: { type: 'string', message: 'clientID option is required' }, + grantType: { type: 'string', message: 'grantType option is required' }, + scope: { optional: true, type: 'string', message: 'scope option is required' }, + audience: { optional: true, type: 'string', message: 'audience option is required' } + } + ); + + body = objectHelper.toSnakeCase(body, ['auth0Client']); + body = parametersWhitelist.oauthTokenParams(this.warn, body); + + body.grant_type = body.grant_type; + + return this.request.post(url).send(body).end(responseHandler(cb)); + }; + + /** + * Performs authentication calling `/oauth/ro` endpoint with username + * and password for a given connection name. + * + * This method is not compatible with API Auth so if you need to fetch API tokens with audience + * you should use {@link login} or {@link loginWithDefaultDirectory}. + * + * @method loginWithResourceOwner + * @param {Object} options + * @param {String} options.username email or username of the user that will perform Auth + * @param {String} options.password the password of the user that will perform Auth + * @param {Object} options.connection the connection name where the user belongs to. e.g. `Username-Password-Authentication` + * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email` + * @param {String} [options.device] name of the device/browser where the Auth was requested + * @param {tokenCallback} cb function called with the result of the request + */ + Authentication.prototype.loginWithResourceOwner = function(options, cb) { + var url; + var body; + + assert.check( + options, + { type: 'object', message: 'options parameter is not valid' }, + { + username: { type: 'string', message: 'username option is required' }, + password: { type: 'string', message: 'password option is required' }, + connection: { type: 'string', message: 'connection option is required' }, + scope: { optional: true, type: 'string', message: 'scope option is required' } + } + ); + assert.check(cb, { type: 'function', message: 'cb parameter is not valid' }); + + url = urljoin(this.baseOptions.rootUrl, 'oauth', 'ro'); + + body = objectHelper + .merge(this.baseOptions, ['clientID', 'scope']) + .with(options, ['username', 'password', 'scope', 'connection', 'device']); + + body = objectHelper.toSnakeCase(body, ['auth0Client']); + + body.grant_type = body.grant_type || 'password'; + + return this.request.post(url).send(body).end(responseHandler(cb)); + }; + + /** + * Makes a call to the `/ssodata` endpoint. + * We recommend to avoid using this method and rely on your tenant hosted login page and using prompt=none via {@link renewAuth} method. + * + * @method getSSOData + * @param {Boolean} withActiveDirectories tells Auth0 to return AD data + * @param {Function} cb + */ + Authentication.prototype.getSSOData = function(withActiveDirectories, cb) { + var url; + var params = ''; + + if (typeof withActiveDirectories === 'function') { + cb = withActiveDirectories; + withActiveDirectories = false; + } + + assert.check(withActiveDirectories, { + type: 'boolean', + message: 'withActiveDirectories parameter is not valid' + }); + assert.check(cb, { type: 'function', message: 'cb parameter is not valid' }); + + if (withActiveDirectories) { + params = + '?' + + qs.stringify({ + ldaps: 1, + client_id: this.baseOptions.clientID + }); + } + + url = urljoin(this.baseOptions.rootUrl, 'user', 'ssodata', params); + + return this.request.get(url, { noHeaders: true }).withCredentials().end(responseHandler(cb)); + }; + + /** + * @callback userInfoCallback + * @param {Error} [err] error returned by Auth0 + * @param {Object} [userInfo] user information + */ + + /** + * Makes a call to the `/userinfo` endpoint and returns the user profile + * + * @method userInfo + * @param {String} accessToken token issued to a user after Auth + * @param {userInfoCallback} cb + * @see {@link https://auth0.com/docs/api/authentication#get-user-info} + */ + Authentication.prototype.userInfo = function(accessToken, cb) { + var url; + + assert.check(accessToken, { type: 'string', message: 'accessToken parameter is not valid' }); + assert.check(cb, { type: 'function', message: 'cb parameter is not valid' }); + + url = urljoin(this.baseOptions.rootUrl, 'userinfo'); + + return this.request + .get(url) + .set('Authorization', 'Bearer ' + accessToken) + .end(responseHandler(cb, { ignoreCasing: true })); + }; + + /** + * @callback delegationCallback + * @param {Error} [err] error returned by Auth0 with the reason why the delegation failed + * @param {Object} [result] result of the delegation request. The payload depends on what ai type was used + */ + + /** + * Makes a call to the `/delegation` endpoint with either an `id_token` or `refresh_token` + * + * @method delegation + * @param {Object} options + * @param {String} [options.clientID] client identifier + * @param {String} options.grantType grant type used for delegation. The only valid value is `urn:ietf:params:oauth:grant-type:jwt-bearer` + * @param {String} [options.idToken] valid token of the user issued after Auth. If no `refresh_token` is provided this parameter is required + * @param {String} [options.refreshToken] valid refresh token of the user issued after Auth. If no `id_token` is provided this parameter is required + * @param {String} [options.target] the target client id of the delegation + * @param {String} [options.scope] either `openid` or `openid profile email` + * @param {String} [options.apiType] the api to be called + * @param {delegationCallback} cb + * @see {@link https://auth0.com/docs/api/authentication#delegation} + */ + Authentication.prototype.delegation = function(options, cb) { + var url; + var body; + + assert.check( + options, + { type: 'object', message: 'options parameter is not valid' }, + { + grant_type: { type: 'string', message: 'grant_type option is required' } + } + ); + assert.check(cb, { type: 'function', message: 'cb parameter is not valid' }); + + url = urljoin(this.baseOptions.rootUrl, 'delegation'); + + body = objectHelper.merge(this.baseOptions, ['clientID']).with(options); + + body = objectHelper.toSnakeCase(body, ['auth0Client']); + + return this.request.post(url).send(body).end(responseHandler(cb)); + }; + + /** + * Fetches the user country based on the ip. + * + * @method getUserCountry + * @private + * @param {Function} cb + */ + Authentication.prototype.getUserCountry = function(cb) { + var url; + + assert.check(cb, { type: 'function', message: 'cb parameter is not valid' }); + + url = urljoin(this.baseOptions.rootUrl, 'user', 'geoloc', 'country'); + + return this.request.get(url).end(responseHandler(cb)); + }; + + module.exports = Authentication; + + +/***/ }, +/* 20 */ +/***/ function(module, exports, __webpack_require__) { + + var base64 = __webpack_require__(15); + + function padding(str) { + var mod = str.length % 4; + var pad = 4 - mod; + + if (mod === 0) { + return str; + } + + return str + new Array(1 + pad).join('='); + } + + function stringToByteArray(str) { + var arr = new Array(str.length); + for (var a = 0; a < str.length; a++) { + arr[a] = str.charCodeAt(a); + } + return arr; + } + + function byteArrayToString(array) { + var result = ''; + for (var i = 0; i < array.length; i++) { + result += String.fromCharCode(array[i]); + } + return result; + } + + function encode(str) { + return base64 + .fromByteArray(stringToByteArray(str)) + .replace(/\+/g, '-') // Convert '+' to '-' + .replace(/\//g, '_'); // Convert '/' to '_' + } + + function decode(str) { + str = padding(str) + .replace(/-/g, '+') // Convert '-' to '+' + .replace(/_/g, '/'); // Convert '_' to '/' + + return byteArrayToString(base64.toByteArray(str)); + } + + module.exports = { + encode: encode, + decode: decode + }; + + +/***/ }, +/* 21 */ +/***/ function(module, exports) { + + function buildResponse(error, description) { + return { + error: error, + errorDescription: description + }; + } + + function invalidJwt(description) { + return buildResponse('invalid_token', description); + } + + module.exports = { + buildResponse: buildResponse, + invalidJwt: invalidJwt + }; + + +/***/ }, +/* 22 */ +/***/ function(module, exports, __webpack_require__) { + + var random = __webpack_require__(48); + var storage = __webpack_require__(49); + + var DEFAULT_NAMESPACE = 'com.auth0.auth.'; + + function TransactionManager(options) { + options = options || {}; + this.namespace = options.namespace || DEFAULT_NAMESPACE; + this.keyLength = options.keyLength || 32; + } + + TransactionManager.prototype.process = function(options) { + var transaction; + + if (options.responseType.indexOf('code') !== -1) { + return options; + } + + if (options.responseType.indexOf('id_token') !== -1 && !!options.nonce) { + return options; + } + + transaction = this.generateTransaction(options.appState, options.state, options.nonce); + + options.state = transaction.state; + + if (options.responseType.indexOf('id_token') !== -1) { + options.nonce = transaction.nonce; + } + + return options; + }; + + TransactionManager.prototype.generateTransaction = function(appState, state, nonce) { + var transaction = state || random.randomString(this.keyLength); + nonce = nonce || random.randomString(this.keyLength); + + storage.setItem(this.namespace + transaction, { + nonce: nonce, + appState: appState + }); + + return { + state: transaction, + nonce: nonce + }; + }; + + TransactionManager.prototype.getStoredTransaction = function(transaction) { + var transactionData; + + transactionData = storage.getItem(this.namespace + transaction); + storage.removeItem(this.namespace + transaction); + return transactionData; + }; + + module.exports = TransactionManager; + + +/***/ }, +/* 23 */ +/***/ function(module, exports, __webpack_require__) { + + + /** + * Expose `Emitter`. + */ + + if (true) { + module.exports = Emitter; + } + + /** + * Initialize a new `Emitter`. + * + * @api public + */ + + function Emitter(obj) { + if (obj) return mixin(obj); + }; + + /** + * Mixin the emitter properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + + function mixin(obj) { + for (var key in Emitter.prototype) { + obj[key] = Emitter.prototype[key]; + } + return obj; + } + + /** + * Listen on the given `event` with `fn`. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.on = + Emitter.prototype.addEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + (this._callbacks['$' + event] = this._callbacks['$' + event] || []) + .push(fn); + return this; + }; + + /** + * Adds an `event` listener that will be invoked a single + * time then automatically removed. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.once = function(event, fn){ + function on() { + this.off(event, on); + fn.apply(this, arguments); + } + + on.fn = fn; + this.on(event, on); + return this; + }; + + /** + * Remove the given callback for `event` or all + * registered callbacks. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.off = + Emitter.prototype.removeListener = + Emitter.prototype.removeAllListeners = + Emitter.prototype.removeEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + + // all + if (0 == arguments.length) { + this._callbacks = {}; + return this; + } + + // specific event + var callbacks = this._callbacks['$' + event]; + if (!callbacks) return this; + + // remove all handlers + if (1 == arguments.length) { + delete this._callbacks['$' + event]; + return this; + } + + // remove specific handler + var cb; + for (var i = 0; i < callbacks.length; i++) { + cb = callbacks[i]; + if (cb === fn || cb.fn === fn) { + callbacks.splice(i, 1); + break; + } + } + return this; + }; + + /** + * Emit `event` with the given args. + * + * @param {String} event + * @param {Mixed} ... + * @return {Emitter} + */ + + Emitter.prototype.emit = function(event){ + this._callbacks = this._callbacks || {}; + var args = [].slice.call(arguments, 1) + , callbacks = this._callbacks['$' + event]; + + if (callbacks) { + callbacks = callbacks.slice(0); + for (var i = 0, len = callbacks.length; i < len; ++i) { + callbacks[i].apply(this, args); + } + } + + return this; + }; + + /** + * Return array of callbacks for `event`. + * + * @param {String} event + * @return {Array} + * @api public + */ + + Emitter.prototype.listeners = function(event){ + this._callbacks = this._callbacks || {}; + return this._callbacks['$' + event] || []; + }; + + /** + * Check if this emitter has `event` handlers. + * + * @param {String} event + * @return {Boolean} + * @api public + */ + + Emitter.prototype.hasListeners = function(event){ + return !! this.listeners(event).length; + }; + + +/***/ }, +/* 24 */ +/***/ function(module, exports, __webpack_require__) { + + ;(function (root, factory) { + if (true) { + // CommonJS + module.exports = exports = factory(); + } + else if (typeof define === "function" && define.amd) { + // AMD + define([], factory); + } + else { + // Global (browser) + root.CryptoJS = factory(); + } + }(this, function () { + + /** + * CryptoJS core components. + */ + var CryptoJS = CryptoJS || (function (Math, undefined) { + /* + * Local polyfil of Object.create + */ + var create = Object.create || (function () { + function F() {}; + + return function (obj) { + var subtype; + + F.prototype = obj; + + subtype = new F(); + + F.prototype = null; + + return subtype; + }; + }()) + + /** + * CryptoJS namespace. + */ + var C = {}; + + /** + * Library namespace. + */ + var C_lib = C.lib = {}; + + /** + * Base object for prototypal inheritance. + */ + var Base = C_lib.Base = (function () { + + + return { + /** + * Creates a new object that inherits from this object. + * + * @param {Object} overrides Properties to copy into the new object. + * + * @return {Object} The new object. + * + * @static + * + * @example + * + * var MyType = CryptoJS.lib.Base.extend({ + * field: 'value', + * + * method: function () { + * } + * }); + */ + extend: function (overrides) { + // Spawn + var subtype = create(this); + + // Augment + if (overrides) { + subtype.mixIn(overrides); + } + + // Create default initializer + if (!subtype.hasOwnProperty('init') || this.init === subtype.init) { + subtype.init = function () { + subtype.$super.init.apply(this, arguments); + }; + } + + // Initializer's prototype is the subtype object + subtype.init.prototype = subtype; + + // Reference supertype + subtype.$super = this; + + return subtype; + }, + + /** + * Extends this object and runs the init method. + * Arguments to create() will be passed to init(). + * + * @return {Object} The new object. + * + * @static + * + * @example + * + * var instance = MyType.create(); + */ + create: function () { + var instance = this.extend(); + instance.init.apply(instance, arguments); + + return instance; + }, + + /** + * Initializes a newly created object. + * Override this method to add some logic when your objects are created. + * + * @example + * + * var MyType = CryptoJS.lib.Base.extend({ + * init: function () { + * // ... + * } + * }); + */ + init: function () { + }, + + /** + * Copies properties into this object. + * + * @param {Object} properties The properties to mix in. + * + * @example + * + * MyType.mixIn({ + * field: 'value' + * }); + */ + mixIn: function (properties) { + for (var propertyName in properties) { + if (properties.hasOwnProperty(propertyName)) { + this[propertyName] = properties[propertyName]; + } + } + + // IE won't copy toString using the loop above + if (properties.hasOwnProperty('toString')) { + this.toString = properties.toString; + } + }, + + /** + * Creates a copy of this object. + * + * @return {Object} The clone. + * + * @example + * + * var clone = instance.clone(); + */ + clone: function () { + return this.init.prototype.extend(this); + } + }; + }()); + + /** + * An array of 32-bit words. + * + * @property {Array} words The array of 32-bit words. + * @property {number} sigBytes The number of significant bytes in this word array. + */ + var WordArray = C_lib.WordArray = Base.extend({ + /** + * Initializes a newly created word array. + * + * @param {Array} words (Optional) An array of 32-bit words. + * @param {number} sigBytes (Optional) The number of significant bytes in the words. + * + * @example + * + * var wordArray = CryptoJS.lib.WordArray.create(); + * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); + * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); + */ + init: function (words, sigBytes) { + words = this.words = words || []; + + if (sigBytes != undefined) { + this.sigBytes = sigBytes; + } else { + this.sigBytes = words.length * 4; + } + }, + + /** + * Converts this word array to a string. + * + * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex + * + * @return {string} The stringified word array. + * + * @example + * + * var string = wordArray + ''; + * var string = wordArray.toString(); + * var string = wordArray.toString(CryptoJS.enc.Utf8); + */ + toString: function (encoder) { + return (encoder || Hex).stringify(this); + }, + + /** + * Concatenates a word array to this word array. + * + * @param {WordArray} wordArray The word array to append. + * + * @return {WordArray} This word array. + * + * @example + * + * wordArray1.concat(wordArray2); + */ + concat: function (wordArray) { + // Shortcuts + var thisWords = this.words; + var thatWords = wordArray.words; + var thisSigBytes = this.sigBytes; + var thatSigBytes = wordArray.sigBytes; + + // Clamp excess bits + this.clamp(); + + // Concat + if (thisSigBytes % 4) { + // Copy one byte at a time + for (var i = 0; i < thatSigBytes; i++) { + var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8); + } + } else { + // Copy one word at a time + for (var i = 0; i < thatSigBytes; i += 4) { + thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2]; + } + } + this.sigBytes += thatSigBytes; + + // Chainable + return this; + }, + + /** + * Removes insignificant bits. + * + * @example + * + * wordArray.clamp(); + */ + clamp: function () { + // Shortcuts + var words = this.words; + var sigBytes = this.sigBytes; + + // Clamp + words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8); + words.length = Math.ceil(sigBytes / 4); + }, + + /** + * Creates a copy of this word array. + * + * @return {WordArray} The clone. + * + * @example + * + * var clone = wordArray.clone(); + */ + clone: function () { + var clone = Base.clone.call(this); + clone.words = this.words.slice(0); + + return clone; + }, + + /** + * Creates a word array filled with random bytes. + * + * @param {number} nBytes The number of random bytes to generate. + * + * @return {WordArray} The random word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.lib.WordArray.random(16); + */ + random: function (nBytes) { + var words = []; + + var r = (function (m_w) { + var m_w = m_w; + var m_z = 0x3ade68b1; + var mask = 0xffffffff; + + return function () { + m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask; + m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask; + var result = ((m_z << 0x10) + m_w) & mask; + result /= 0x100000000; + result += 0.5; + return result * (Math.random() > .5 ? 1 : -1); + } + }); + + for (var i = 0, rcache; i < nBytes; i += 4) { + var _r = r((rcache || Math.random()) * 0x100000000); + + rcache = _r() * 0x3ade67b7; + words.push((_r() * 0x100000000) | 0); + } + + return new WordArray.init(words, nBytes); + } + }); + + /** + * Encoder namespace. + */ + var C_enc = C.enc = {}; + + /** + * Hex encoding strategy. + */ + var Hex = C_enc.Hex = { + /** + * Converts a word array to a hex string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The hex string. + * + * @static + * + * @example + * + * var hexString = CryptoJS.enc.Hex.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + + // Convert + var hexChars = []; + for (var i = 0; i < sigBytes; i++) { + var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + hexChars.push((bite >>> 4).toString(16)); + hexChars.push((bite & 0x0f).toString(16)); + } + + return hexChars.join(''); + }, + + /** + * Converts a hex string to a word array. + * + * @param {string} hexStr The hex string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Hex.parse(hexString); + */ + parse: function (hexStr) { + // Shortcut + var hexStrLength = hexStr.length; + + // Convert + var words = []; + for (var i = 0; i < hexStrLength; i += 2) { + words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4); + } + + return new WordArray.init(words, hexStrLength / 2); + } + }; + + /** + * Latin1 encoding strategy. + */ + var Latin1 = C_enc.Latin1 = { + /** + * Converts a word array to a Latin1 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The Latin1 string. + * + * @static + * + * @example + * + * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + + // Convert + var latin1Chars = []; + for (var i = 0; i < sigBytes; i++) { + var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + latin1Chars.push(String.fromCharCode(bite)); + } + + return latin1Chars.join(''); + }, + + /** + * Converts a Latin1 string to a word array. + * + * @param {string} latin1Str The Latin1 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); + */ + parse: function (latin1Str) { + // Shortcut + var latin1StrLength = latin1Str.length; + + // Convert + var words = []; + for (var i = 0; i < latin1StrLength; i++) { + words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8); + } + + return new WordArray.init(words, latin1StrLength); + } + }; + + /** + * UTF-8 encoding strategy. + */ + var Utf8 = C_enc.Utf8 = { + /** + * Converts a word array to a UTF-8 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The UTF-8 string. + * + * @static + * + * @example + * + * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); + */ + stringify: function (wordArray) { + try { + return decodeURIComponent(escape(Latin1.stringify(wordArray))); + } catch (e) { + throw new Error('Malformed UTF-8 data'); + } + }, + + /** + * Converts a UTF-8 string to a word array. + * + * @param {string} utf8Str The UTF-8 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); + */ + parse: function (utf8Str) { + return Latin1.parse(unescape(encodeURIComponent(utf8Str))); + } + }; + + /** + * Abstract buffered block algorithm template. + * + * The property blockSize must be implemented in a concrete subtype. + * + * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 + */ + var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ + /** + * Resets this block algorithm's data buffer to its initial state. + * + * @example + * + * bufferedBlockAlgorithm.reset(); + */ + reset: function () { + // Initial values + this._data = new WordArray.init(); + this._nDataBytes = 0; + }, + + /** + * Adds new data to this block algorithm's buffer. + * + * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. + * + * @example + * + * bufferedBlockAlgorithm._append('data'); + * bufferedBlockAlgorithm._append(wordArray); + */ + _append: function (data) { + // Convert string to WordArray, else assume WordArray already + if (typeof data == 'string') { + data = Utf8.parse(data); + } + + // Append + this._data.concat(data); + this._nDataBytes += data.sigBytes; + }, + + /** + * Processes available data blocks. + * + * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. + * + * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. + * + * @return {WordArray} The processed data. + * + * @example + * + * var processedData = bufferedBlockAlgorithm._process(); + * var processedData = bufferedBlockAlgorithm._process(!!'flush'); + */ + _process: function (doFlush) { + // Shortcuts + var data = this._data; + var dataWords = data.words; + var dataSigBytes = data.sigBytes; + var blockSize = this.blockSize; + var blockSizeBytes = blockSize * 4; + + // Count blocks ready + var nBlocksReady = dataSigBytes / blockSizeBytes; + if (doFlush) { + // Round up to include partial blocks + nBlocksReady = Math.ceil(nBlocksReady); + } else { + // Round down to include only full blocks, + // less the number of blocks that must remain in the buffer + nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); + } + + // Count words ready + var nWordsReady = nBlocksReady * blockSize; + + // Count bytes ready + var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); + + // Process blocks + if (nWordsReady) { + for (var offset = 0; offset < nWordsReady; offset += blockSize) { + // Perform concrete-algorithm logic + this._doProcessBlock(dataWords, offset); + } + + // Remove processed words + var processedWords = dataWords.splice(0, nWordsReady); + data.sigBytes -= nBytesReady; + } + + // Return processed words + return new WordArray.init(processedWords, nBytesReady); + }, + + /** + * Creates a copy of this object. + * + * @return {Object} The clone. + * + * @example + * + * var clone = bufferedBlockAlgorithm.clone(); + */ + clone: function () { + var clone = Base.clone.call(this); + clone._data = this._data.clone(); + + return clone; + }, + + _minBufferSize: 0 + }); + + /** + * Abstract hasher template. + * + * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) + */ + var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ + /** + * Configuration options. + */ + cfg: Base.extend(), + + /** + * Initializes a newly created hasher. + * + * @param {Object} cfg (Optional) The configuration options to use for this hash computation. + * + * @example + * + * var hasher = CryptoJS.algo.SHA256.create(); + */ + init: function (cfg) { + // Apply config defaults + this.cfg = this.cfg.extend(cfg); + + // Set initial values + this.reset(); + }, + + /** + * Resets this hasher to its initial state. + * + * @example + * + * hasher.reset(); + */ + reset: function () { + // Reset data buffer + BufferedBlockAlgorithm.reset.call(this); + + // Perform concrete-hasher logic + this._doReset(); + }, + + /** + * Updates this hasher with a message. + * + * @param {WordArray|string} messageUpdate The message to append. + * + * @return {Hasher} This hasher. + * + * @example + * + * hasher.update('message'); + * hasher.update(wordArray); + */ + update: function (messageUpdate) { + // Append + this._append(messageUpdate); + + // Update the hash + this._process(); + + // Chainable + return this; + }, + + /** + * Finalizes the hash computation. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} messageUpdate (Optional) A final message update. + * + * @return {WordArray} The hash. + * + * @example + * + * var hash = hasher.finalize(); + * var hash = hasher.finalize('message'); + * var hash = hasher.finalize(wordArray); + */ + finalize: function (messageUpdate) { + // Final message update + if (messageUpdate) { + this._append(messageUpdate); + } + + // Perform concrete-hasher logic + var hash = this._doFinalize(); + + return hash; + }, + + blockSize: 512/32, + + /** + * Creates a shortcut function to a hasher's object interface. + * + * @param {Hasher} hasher The hasher to create a helper for. + * + * @return {Function} The shortcut function. + * + * @static + * + * @example + * + * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); + */ + _createHelper: function (hasher) { + return function (message, cfg) { + return new hasher.init(cfg).finalize(message); + }; + }, + + /** + * Creates a shortcut function to the HMAC's object interface. + * + * @param {Hasher} hasher The hasher to use in this HMAC helper. + * + * @return {Function} The shortcut function. + * + * @static + * + * @example + * + * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); + */ + _createHmacHelper: function (hasher) { + return function (message, key) { + return new C_algo.HMAC.init(hasher, key).finalize(message); + }; + } + }); + + /** + * Algorithm namespace. + */ + var C_algo = C.algo = {}; + + return C; + }(Math)); + + + return CryptoJS; + + })); + +/***/ }, +/* 25 */ +/***/ function(module, exports, __webpack_require__) { + + ;(function (root, factory) { + if (true) { + // CommonJS + module.exports = exports = factory(__webpack_require__(24)); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } + }(this, function (CryptoJS) { + + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; + + // Initialization and round constants tables + var H = []; + var K = []; + + // Compute constants + (function () { + function isPrime(n) { + var sqrtN = Math.sqrt(n); + for (var factor = 2; factor <= sqrtN; factor++) { + if (!(n % factor)) { + return false; + } + } + + return true; + } + + function getFractionalBits(n) { + return ((n - (n | 0)) * 0x100000000) | 0; + } + + var n = 2; + var nPrime = 0; + while (nPrime < 64) { + if (isPrime(n)) { + if (nPrime < 8) { + H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2)); + } + K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3)); + + nPrime++; + } + + n++; + } + }()); + + // Reusable object + var W = []; + + /** + * SHA-256 hash algorithm. + */ + var SHA256 = C_algo.SHA256 = Hasher.extend({ + _doReset: function () { + this._hash = new WordArray.init(H.slice(0)); + }, + + _doProcessBlock: function (M, offset) { + // Shortcut + var H = this._hash.words; + + // Working variables + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; + var e = H[4]; + var f = H[5]; + var g = H[6]; + var h = H[7]; + + // Computation + for (var i = 0; i < 64; i++) { + if (i < 16) { + W[i] = M[offset + i] | 0; + } else { + var gamma0x = W[i - 15]; + var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^ + ((gamma0x << 14) | (gamma0x >>> 18)) ^ + (gamma0x >>> 3); + + var gamma1x = W[i - 2]; + var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^ + ((gamma1x << 13) | (gamma1x >>> 19)) ^ + (gamma1x >>> 10); + + W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]; + } + + var ch = (e & f) ^ (~e & g); + var maj = (a & b) ^ (a & c) ^ (b & c); + + var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22)); + var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25)); + + var t1 = h + sigma1 + ch + K[i] + W[i]; + var t2 = sigma0 + maj; + + h = g; + g = f; + f = e; + e = (d + t1) | 0; + d = c; + c = b; + b = a; + a = (t1 + t2) | 0; + } + + // Intermediate hash value + H[0] = (H[0] + a) | 0; + H[1] = (H[1] + b) | 0; + H[2] = (H[2] + c) | 0; + H[3] = (H[3] + d) | 0; + H[4] = (H[4] + e) | 0; + H[5] = (H[5] + f) | 0; + H[6] = (H[6] + g) | 0; + H[7] = (H[7] + h) | 0; + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; + data.sigBytes = dataWords.length * 4; + + // Hash final blocks + this._process(); + + // Return final computed hash + return this._hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA256('message'); + * var hash = CryptoJS.SHA256(wordArray); + */ + C.SHA256 = Hasher._createHelper(SHA256); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA256(message, key); + */ + C.HmacSHA256 = Hasher._createHmacHelper(SHA256); + }(Math)); + + + return CryptoJS.SHA256; + + })); + +/***/ }, +/* 26 */ +/***/ function(module, exports) { + + function DummyCache() {} + + DummyCache.prototype.get = function () { + return null; + }; + + DummyCache.prototype.has = function () { + return false; + }; + + DummyCache.prototype.set = function () { + }; + + module.exports = DummyCache; + + +/***/ }, +/* 27 */ +/***/ function(module, exports) { + + function ConfigurationError(message) { + this.name = 'ConfigurationError'; + this.message = (message || ''); + } + ConfigurationError.prototype = Error.prototype; + + function TokenValidationError(message) { + this.name = 'TokenValidationError'; + this.message = (message || ''); + } + TokenValidationError.prototype = Error.prototype; + + module.exports = { + ConfigurationError: ConfigurationError, + TokenValidationError: TokenValidationError + }; + + +/***/ }, +/* 28 */ +/***/ function(module, exports, __webpack_require__) { + + var urljoin = __webpack_require__(1); + var base64 = __webpack_require__(16); + var request = __webpack_require__(17); + + function process(jwks) { + var modulus = base64.decodeToHEX(jwks.n); + var exp = base64.decodeToHEX(jwks.e); + + return { + modulus: modulus, + exp: exp + }; + } + + function getJWKS(options, cb) { + var url = urljoin(options.iss, '.well-known', 'jwks.json'); + + return request + .get(url) + .end(function (err, data) { + var matchingKey = null; + var a; + var key; + + if (err) { + cb(err); + } + + // eslint-disable-next-line no-plusplus + for (a = 0; a < data.body.keys.length && matchingKey === null; a++) { + key = data.body.keys[a]; + if (key.kid === options.kid) { + matchingKey = key; + } + } + + cb(null, process(matchingKey)); + }); + } + + module.exports = { + process: process, + getJWKS: getJWKS + }; + + +/***/ }, +/* 29 */ +/***/ function(module, exports, __webpack_require__) { + + /* + Based on the work of Tom Wu + http://www-cs-students.stanford.edu/~tjw/jsbn/ + http://www-cs-students.stanford.edu/~tjw/jsbn/LICENSE + */ + + var BigInteger = __webpack_require__(31).BigInteger; + var SHA256 = __webpack_require__(25); + + var DigestInfoHead = { + sha1: '3021300906052b0e03021a05000414', + sha224: '302d300d06096086480165030402040500041c', + sha256: '3031300d060960864801650304020105000420', + sha384: '3041300d060960864801650304020205000430', + sha512: '3051300d060960864801650304020305000440', + md2: '3020300c06082a864886f70d020205000410', + md5: '3020300c06082a864886f70d020505000410', + ripemd160: '3021300906052b2403020105000414' + }; + + var DigestAlgs = { + sha256: SHA256 + }; + + function RSAVerifier(modulus, exp) { + this.n = null; + this.e = 0; + + if (modulus != null && exp != null && modulus.length > 0 && exp.length > 0) { + this.n = new BigInteger(modulus, 16); + this.e = parseInt(exp, 16); + } else { + throw new Error('Invalid key data'); + } + } + + function getAlgorithmFromDigest(hDigestInfo) { + for (var algName in DigestInfoHead) { + var head = DigestInfoHead[algName]; + var len = head.length; + + if (hDigestInfo.substring(0, len) === head) { + return { + alg: algName, + hash: hDigestInfo.substring(len) + }; + } + } + return []; + } + + + RSAVerifier.prototype.verify = function (msg, encsig) { + encsig = encsig.replace(/[^0-9a-f]|[\s\n]]/ig, ''); + + var sig = new BigInteger(encsig, 16); + if (sig.bitLength() > this.n.bitLength()) { + throw new Error('Signature does not match with the key modulus.'); + } + + var decryptedSig = sig.modPowInt(this.e, this.n); + var digest = decryptedSig.toString(16).replace(/^1f+00/, ''); + + var digestInfo = getAlgorithmFromDigest(digest); + if (digestInfo.length === 0) { + return false; + } + + if (!DigestAlgs.hasOwnProperty(digestInfo.alg)) { + throw new Error('Hashing algorithm is not supported.'); + } + + var msgHash = DigestAlgs[digestInfo.alg](msg).toString(); + return (digestInfo.hash === msgHash); + }; + + module.exports = RSAVerifier; + + +/***/ }, +/* 30 */ +/***/ function(module, exports, __webpack_require__) { + + var RSAVerifier = __webpack_require__(29); + var base64 = __webpack_require__(16); + var jwks = __webpack_require__(28); + var error = __webpack_require__(27); + var DummyCache = __webpack_require__(26); + var supportedAlgs = ['RS256']; + + /** + * Creates a new id_token verifier + * @constructor + * @param {Object} parameters + * @param {String} parameters.issuer name of the issuer of the token + * that should match the `iss` claim in the id_token + * @param {String} parameters.audience identifies the recipients that the JWT is intended for + * and should match the `aud` claim + * @param {Object} [parameters.jwksCache] cache for JSON Web Token Keys. By default it has no cache + * @param {String} [parameters.expectedAlg='RS256'] algorithm in which the id_token was signed + * and will be used to validate + * @param {number} [parameters.leeway=0] number of seconds that the clock can be out of sync + * while validating expiration of the id_token + */ + function IdTokenVerifier(parameters) { + var options = parameters || {}; + + this.jwksCache = options.jwksCache || new DummyCache(); + this.expectedAlg = options.expectedAlg || 'RS256'; + this.issuer = options.issuer; + this.audience = options.audience; + this.leeway = options.leeway || 0; + this.__disableExpirationCheck = options.__disableExpirationCheck || false; + + if (this.leeway < 0 || this.leeway > 60) { + throw new error.ConfigurationError('The leeway should be positive and lower than a minute.'); + } + + if (supportedAlgs.indexOf(this.expectedAlg) === -1) { + throw new error.ConfigurationError('Algorithm ' + this.expectedAlg + + ' is not supported. (Expected algs: [' + supportedAlgs.join(',') + '])'); + } + } + + /** + * @callback verifyCallback + * @param {Error} [err] error returned if the verify cannot be performed + * @param {boolean} [status] if the token is valid or not + */ + + /** + * Verifies an id_token + * + * It will validate: + * - signature according to the algorithm configured in the verifier. + * - if nonce is present and matches the one provided + * - if `iss` and `aud` claims matches the configured issuer and audience + * - if token is not expired and valid (if the `nbf` claim is in the past) + * + * @method verify + * @param {String} token id_token to verify + * @param {String} [nonce] nonce value that should match the one in the id_token claims + * @param {verifyCallback} cb callback used to notify the results of the validation + */ + IdTokenVerifier.prototype.verify = function (token, nonce, cb) { + var jwt = this.decode(token); + + if (jwt instanceof Error) { + return cb(jwt, false); + } + + /* eslint-disable vars-on-top */ + var headAndPayload = jwt.encoded.header + '.' + jwt.encoded.payload; + var signature = base64.decodeToHEX(jwt.encoded.signature); + + var alg = jwt.header.alg; + var kid = jwt.header.kid; + + var aud = jwt.payload.aud; + var iss = jwt.payload.iss; + var exp = jwt.payload.exp; + var nbf = jwt.payload.nbf; + var tnonce = jwt.payload.nonce || null; + /* eslint-enable vars-on-top */ + + if (this.issuer !== iss) { + return cb(new error.TokenValidationError('Issuer ' + iss + ' is not valid.'), false); + } + + if (this.audience !== aud) { + return cb(new error.TokenValidationError('Audience ' + aud + ' is not valid.'), false); + } + + if (this.expectedAlg !== alg) { + return cb(new error.TokenValidationError('Algorithm ' + alg + + ' is not supported. (Expected algs: [' + supportedAlgs.join(',') + '])'), false); + } + + if (tnonce !== nonce) { + return cb(new error.TokenValidationError('Nonce does not match.'), false); + } + + var expirationError = this.verifyExpAndNbf(exp, nbf); // eslint-disable-line vars-on-top + + if (expirationError) { + return cb(expirationError, false); + } + + return this.getRsaVerifier(iss, kid, function (err, rsaVerifier) { + if (err) { + return cb(err); + } + if (rsaVerifier.verify(headAndPayload, signature)) { + return cb(null, jwt.payload); + } + return cb(new error.TokenValidationError('Invalid signature.')); + }); + }; + + /** + * Verifies that the `exp` and `nbf` claims are valid in the current moment. + * + * @method verifyExpAndNbf + * @param {String} exp value of `exp` claim + * @param {String} nbf value of `nbf` claim + * @return {boolean} if token is valid according to `exp` and `nbf` + */ + IdTokenVerifier.prototype.verifyExpAndNbf = function (exp, nbf) { + var now = new Date(); + var expDate = new Date(0); + var nbfDate = new Date(0); + + if (this.__disableExpirationCheck) { + return null; + } + + expDate.setUTCSeconds(exp + this.leeway); + + if (now > expDate) { + return new error.TokenValidationError('Expired token.'); + } + + if (typeof nbf === 'undefined') { + return null; + } + nbfDate.setUTCSeconds(nbf - this.leeway); + if (now < nbfDate) { + return new error.TokenValidationError('The token is not valid until later in the future. ' + + 'Please check your computed clock.'); + } + + return null; + }; + + /** + * Verifies that the `exp` and `iat` claims are valid in the current moment. + * + * @method verifyExpAndIat + * @param {String} exp value of `exp` claim + * @param {String} iat value of `iat` claim + * @return {boolean} if token is valid according to `exp` and `iat` + */ + IdTokenVerifier.prototype.verifyExpAndIat = function (exp, iat) { + var now = new Date(); + var expDate = new Date(0); + var iatDate = new Date(0); + + if (this.__disableExpirationCheck) { + return null; + } + + expDate.setUTCSeconds(exp + this.leeway); + + if (now > expDate) { + return new error.TokenValidationError('Expired token.'); + } + + iatDate.setUTCSeconds(iat - this.leeway); + + if (now < iatDate) { + return new error.TokenValidationError('The token was issued in the future. ' + + 'Please check your computed clock.'); + } + return null; + }; + + IdTokenVerifier.prototype.getRsaVerifier = function (iss, kid, cb) { + var _this = this; + var cachekey = iss + kid; + + if (!this.jwksCache.has(cachekey)) { + jwks.getJWKS({ + iss: iss, + kid: kid + }, function (err, keyInfo) { + if (err) { + cb(err); + } + _this.jwksCache.set(cachekey, keyInfo); + cb(null, new RSAVerifier(keyInfo.modulus, keyInfo.exp)); + }); + } else { + var keyInfo = this.jwksCache.get(cachekey); // eslint-disable-line vars-on-top + cb(null, new RSAVerifier(keyInfo.modulus, keyInfo.exp)); + } + }; + + + /** + * @typedef DecodedToken + * @type {Object} + * @property {Object} header - content of the JWT header. + * @property {Object} payload - token claims. + * @property {Object} encoded - encoded parts of the token. + */ + + /** + * Decodes a well formed JWT without any verification + * + * @method decode + * @param {String} token decodes the token + * @return {DecodedToken} if token is valid according to `exp` and `nbf` + */ + IdTokenVerifier.prototype.decode = function (token) { + var parts = token.split('.'); + var header; + var payload; + + if (parts.length !== 3) { + return new error.TokenValidationError('Cannot decode a malformed JWT'); + } + + try { + header = JSON.parse(base64.decodeToString(parts[0])); + payload = JSON.parse(base64.decodeToString(parts[1])); + } catch (e) { + return new error.TokenValidationError('Token header or payload is not valid JSON'); + } + + return { + header: header, + payload: payload, + encoded: { + header: parts[0], + payload: parts[1], + signature: parts[2] + } + }; + }; + + module.exports = IdTokenVerifier; + + +/***/ }, +/* 31 */ +/***/ function(module, exports, __webpack_require__) { + + (function(){ + + // Copyright (c) 2005 Tom Wu + // All Rights Reserved. + // See "LICENSE" for details. + + // Basic JavaScript BN library - subset useful for RSA encryption. + + // Bits per digit + var dbits; + + // JavaScript engine analysis + var canary = 0xdeadbeefcafe; + var j_lm = ((canary&0xffffff)==0xefcafe); + + // (public) Constructor + function BigInteger(a,b,c) { + if(a != null) + if("number" == typeof a) this.fromNumber(a,b,c); + else if(b == null && "string" != typeof a) this.fromString(a,256); + else this.fromString(a,b); + } + + // return new, unset BigInteger + function nbi() { return new BigInteger(null); } + + // am: Compute w_j += (x*this_i), propagate carries, + // c is initial carry, returns final carry. + // c < 3*dvalue, x < 2*dvalue, this_i < dvalue + // We need to select the fastest one that works in this environment. + + // am1: use a single mult and divide to get the high bits, + // max digit bits should be 26 because + // max internal value = 2*dvalue^2-2*dvalue (< 2^53) + function am1(i,x,w,j,c,n) { + while(--n >= 0) { + var v = x*this[i++]+w[j]+c; + c = Math.floor(v/0x4000000); + w[j++] = v&0x3ffffff; + } + return c; + } + // am2 avoids a big mult-and-extract completely. + // Max digit bits should be <= 30 because we do bitwise ops + // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31) + function am2(i,x,w,j,c,n) { + var xl = x&0x7fff, xh = x>>15; + while(--n >= 0) { + var l = this[i]&0x7fff; + var h = this[i++]>>15; + var m = xh*l+h*xl; + l = xl*l+((m&0x7fff)<<15)+w[j]+(c&0x3fffffff); + c = (l>>>30)+(m>>>15)+xh*h+(c>>>30); + w[j++] = l&0x3fffffff; + } + return c; + } + // Alternately, set max digit bits to 28 since some + // browsers slow down when dealing with 32-bit numbers. + function am3(i,x,w,j,c,n) { + var xl = x&0x3fff, xh = x>>14; + while(--n >= 0) { + var l = this[i]&0x3fff; + var h = this[i++]>>14; + var m = xh*l+h*xl; + l = xl*l+((m&0x3fff)<<14)+w[j]+c; + c = (l>>28)+(m>>14)+xh*h; + w[j++] = l&0xfffffff; + } + return c; + } + var inBrowser = typeof navigator !== "undefined"; + if(inBrowser && j_lm && (navigator.appName == "Microsoft Internet Explorer")) { + BigInteger.prototype.am = am2; + dbits = 30; + } + else if(inBrowser && j_lm && (navigator.appName != "Netscape")) { + BigInteger.prototype.am = am1; + dbits = 26; + } + else { // Mozilla/Netscape seems to prefer am3 + BigInteger.prototype.am = am3; + dbits = 28; + } + + BigInteger.prototype.DB = dbits; + BigInteger.prototype.DM = ((1<= 0; --i) r[i] = this[i]; + r.t = this.t; + r.s = this.s; + } + + // (protected) set from integer value x, -DV <= x < DV + function bnpFromInt(x) { + this.t = 1; + this.s = (x<0)?-1:0; + if(x > 0) this[0] = x; + else if(x < -1) this[0] = x+this.DV; + else this.t = 0; + } + + // return bigint initialized to value + function nbv(i) { var r = nbi(); r.fromInt(i); return r; } + + // (protected) set from string and radix + function bnpFromString(s,b) { + var k; + if(b == 16) k = 4; + else if(b == 8) k = 3; + else if(b == 256) k = 8; // byte array + else if(b == 2) k = 1; + else if(b == 32) k = 5; + else if(b == 4) k = 2; + else { this.fromRadix(s,b); return; } + this.t = 0; + this.s = 0; + var i = s.length, mi = false, sh = 0; + while(--i >= 0) { + var x = (k==8)?s[i]&0xff:intAt(s,i); + if(x < 0) { + if(s.charAt(i) == "-") mi = true; + continue; + } + mi = false; + if(sh == 0) + this[this.t++] = x; + else if(sh+k > this.DB) { + this[this.t-1] |= (x&((1<<(this.DB-sh))-1))<>(this.DB-sh)); + } + else + this[this.t-1] |= x<= this.DB) sh -= this.DB; + } + if(k == 8 && (s[0]&0x80) != 0) { + this.s = -1; + if(sh > 0) this[this.t-1] |= ((1<<(this.DB-sh))-1)< 0 && this[this.t-1] == c) --this.t; + } + + // (public) return string representation in given radix + function bnToString(b) { + if(this.s < 0) return "-"+this.negate().toString(b); + var k; + if(b == 16) k = 4; + else if(b == 8) k = 3; + else if(b == 2) k = 1; + else if(b == 32) k = 5; + else if(b == 4) k = 2; + else return this.toRadix(b); + var km = (1< 0) { + if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); } + while(i >= 0) { + if(p < k) { + d = (this[i]&((1<>(p+=this.DB-k); + } + else { + d = (this[i]>>(p-=k))&km; + if(p <= 0) { p += this.DB; --i; } + } + if(d > 0) m = true; + if(m) r += int2char(d); + } + } + return m?r:"0"; + } + + // (public) -this + function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; } + + // (public) |this| + function bnAbs() { return (this.s<0)?this.negate():this; } + + // (public) return + if this > a, - if this < a, 0 if equal + function bnCompareTo(a) { + var r = this.s-a.s; + if(r != 0) return r; + var i = this.t; + r = i-a.t; + if(r != 0) return (this.s<0)?-r:r; + while(--i >= 0) if((r=this[i]-a[i]) != 0) return r; + return 0; + } + + // returns bit length of the integer x + function nbits(x) { + var r = 1, t; + if((t=x>>>16) != 0) { x = t; r += 16; } + if((t=x>>8) != 0) { x = t; r += 8; } + if((t=x>>4) != 0) { x = t; r += 4; } + if((t=x>>2) != 0) { x = t; r += 2; } + if((t=x>>1) != 0) { x = t; r += 1; } + return r; + } + + // (public) return the number of bits in "this" + function bnBitLength() { + if(this.t <= 0) return 0; + return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM)); + } + + // (protected) r = this << n*DB + function bnpDLShiftTo(n,r) { + var i; + for(i = this.t-1; i >= 0; --i) r[i+n] = this[i]; + for(i = n-1; i >= 0; --i) r[i] = 0; + r.t = this.t+n; + r.s = this.s; + } + + // (protected) r = this >> n*DB + function bnpDRShiftTo(n,r) { + for(var i = n; i < this.t; ++i) r[i-n] = this[i]; + r.t = Math.max(this.t-n,0); + r.s = this.s; + } + + // (protected) r = this << n + function bnpLShiftTo(n,r) { + var bs = n%this.DB; + var cbs = this.DB-bs; + var bm = (1<= 0; --i) { + r[i+ds+1] = (this[i]>>cbs)|c; + c = (this[i]&bm)<= 0; --i) r[i] = 0; + r[ds] = c; + r.t = this.t+ds+1; + r.s = this.s; + r.clamp(); + } + + // (protected) r = this >> n + function bnpRShiftTo(n,r) { + r.s = this.s; + var ds = Math.floor(n/this.DB); + if(ds >= this.t) { r.t = 0; return; } + var bs = n%this.DB; + var cbs = this.DB-bs; + var bm = (1<>bs; + for(var i = ds+1; i < this.t; ++i) { + r[i-ds-1] |= (this[i]&bm)<>bs; + } + if(bs > 0) r[this.t-ds-1] |= (this.s&bm)<>= this.DB; + } + if(a.t < this.t) { + c -= a.s; + while(i < this.t) { + c += this[i]; + r[i++] = c&this.DM; + c >>= this.DB; + } + c += this.s; + } + else { + c += this.s; + while(i < a.t) { + c -= a[i]; + r[i++] = c&this.DM; + c >>= this.DB; + } + c -= a.s; + } + r.s = (c<0)?-1:0; + if(c < -1) r[i++] = this.DV+c; + else if(c > 0) r[i++] = c; + r.t = i; + r.clamp(); + } + + // (protected) r = this * a, r != this,a (HAC 14.12) + // "this" should be the larger one if appropriate. + function bnpMultiplyTo(a,r) { + var x = this.abs(), y = a.abs(); + var i = x.t; + r.t = i+y.t; + while(--i >= 0) r[i] = 0; + for(i = 0; i < y.t; ++i) r[i+x.t] = x.am(0,y[i],r,i,0,x.t); + r.s = 0; + r.clamp(); + if(this.s != a.s) BigInteger.ZERO.subTo(r,r); + } + + // (protected) r = this^2, r != this (HAC 14.16) + function bnpSquareTo(r) { + var x = this.abs(); + var i = r.t = 2*x.t; + while(--i >= 0) r[i] = 0; + for(i = 0; i < x.t-1; ++i) { + var c = x.am(i,x[i],r,2*i,0,1); + if((r[i+x.t]+=x.am(i+1,2*x[i],r,2*i+1,c,x.t-i-1)) >= x.DV) { + r[i+x.t] -= x.DV; + r[i+x.t+1] = 1; + } + } + if(r.t > 0) r[r.t-1] += x.am(i,x[i],r,2*i,0,1); + r.s = 0; + r.clamp(); + } + + // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20) + // r != q, this != m. q or r may be null. + function bnpDivRemTo(m,q,r) { + var pm = m.abs(); + if(pm.t <= 0) return; + var pt = this.abs(); + if(pt.t < pm.t) { + if(q != null) q.fromInt(0); + if(r != null) this.copyTo(r); + return; + } + if(r == null) r = nbi(); + var y = nbi(), ts = this.s, ms = m.s; + var nsh = this.DB-nbits(pm[pm.t-1]); // normalize modulus + if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); } + else { pm.copyTo(y); pt.copyTo(r); } + var ys = y.t; + var y0 = y[ys-1]; + if(y0 == 0) return; + var yt = y0*(1<1)?y[ys-2]>>this.F2:0); + var d1 = this.FV/yt, d2 = (1<= 0) { + r[r.t++] = 1; + r.subTo(t,r); + } + BigInteger.ONE.dlShiftTo(ys,t); + t.subTo(y,y); // "negative" y so we can replace sub with am later + while(y.t < ys) y[y.t++] = 0; + while(--j >= 0) { + // Estimate quotient digit + var qd = (r[--i]==y0)?this.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2); + if((r[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out + y.dlShiftTo(j,t); + r.subTo(t,r); + while(r[i] < --qd) r.subTo(t,r); + } + } + if(q != null) { + r.drShiftTo(ys,q); + if(ts != ms) BigInteger.ZERO.subTo(q,q); + } + r.t = ys; + r.clamp(); + if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder + if(ts < 0) BigInteger.ZERO.subTo(r,r); + } + + // (public) this mod a + function bnMod(a) { + var r = nbi(); + this.abs().divRemTo(a,null,r); + if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r); + return r; + } + + // Modular reduction using "classic" algorithm + function Classic(m) { this.m = m; } + function cConvert(x) { + if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m); + else return x; + } + function cRevert(x) { return x; } + function cReduce(x) { x.divRemTo(this.m,null,x); } + function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } + function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); } + + Classic.prototype.convert = cConvert; + Classic.prototype.revert = cRevert; + Classic.prototype.reduce = cReduce; + Classic.prototype.mulTo = cMulTo; + Classic.prototype.sqrTo = cSqrTo; + + // (protected) return "-1/this % 2^DB"; useful for Mont. reduction + // justification: + // xy == 1 (mod m) + // xy = 1+km + // xy(2-xy) = (1+km)(1-km) + // x[y(2-xy)] = 1-k^2m^2 + // x[y(2-xy)] == 1 (mod m^2) + // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2 + // should reduce x and y(2-xy) by m^2 at each step to keep size bounded. + // JS multiply "overflows" differently from C/C++, so care is needed here. + function bnpInvDigit() { + if(this.t < 1) return 0; + var x = this[0]; + if((x&1) == 0) return 0; + var y = x&3; // y == 1/x mod 2^2 + y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4 + y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8 + y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16 + // last step - calculate inverse mod DV directly; + // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints + y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits + // we really want the negative inverse, and -DV < y < DV + return (y>0)?this.DV-y:-y; + } + + // Montgomery reduction + function Montgomery(m) { + this.m = m; + this.mp = m.invDigit(); + this.mpl = this.mp&0x7fff; + this.mph = this.mp>>15; + this.um = (1<<(m.DB-15))-1; + this.mt2 = 2*m.t; + } + + // xR mod m + function montConvert(x) { + var r = nbi(); + x.abs().dlShiftTo(this.m.t,r); + r.divRemTo(this.m,null,r); + if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r); + return r; + } + + // x/R mod m + function montRevert(x) { + var r = nbi(); + x.copyTo(r); + this.reduce(r); + return r; + } + + // x = x/R mod m (HAC 14.32) + function montReduce(x) { + while(x.t <= this.mt2) // pad x so am has enough room later + x[x.t++] = 0; + for(var i = 0; i < this.m.t; ++i) { + // faster way of calculating u0 = x[i]*mp mod DV + var j = x[i]&0x7fff; + var u0 = (j*this.mpl+(((j*this.mph+(x[i]>>15)*this.mpl)&this.um)<<15))&x.DM; + // use am to combine the multiply-shift-add into one call + j = i+this.m.t; + x[j] += this.m.am(0,u0,x,i,0,this.m.t); + // propagate carry + while(x[j] >= x.DV) { x[j] -= x.DV; x[++j]++; } + } + x.clamp(); + x.drShiftTo(this.m.t,x); + if(x.compareTo(this.m) >= 0) x.subTo(this.m,x); + } + + // r = "x^2/R mod m"; x != r + function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); } + + // r = "xy/R mod m"; x,y != r + function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } + + Montgomery.prototype.convert = montConvert; + Montgomery.prototype.revert = montRevert; + Montgomery.prototype.reduce = montReduce; + Montgomery.prototype.mulTo = montMulTo; + Montgomery.prototype.sqrTo = montSqrTo; + + // (protected) true iff this is even + function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; } + + // (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79) + function bnpExp(e,z) { + if(e > 0xffffffff || e < 1) return BigInteger.ONE; + var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1; + g.copyTo(r); + while(--i >= 0) { + z.sqrTo(r,r2); + if((e&(1< 0) z.mulTo(r2,g,r); + else { var t = r; r = r2; r2 = t; } + } + return z.revert(r); + } + + // (public) this^e % m, 0 <= e < 2^32 + function bnModPowInt(e,m) { + var z; + if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m); + return this.exp(e,z); + } + + // protected + BigInteger.prototype.copyTo = bnpCopyTo; + BigInteger.prototype.fromInt = bnpFromInt; + BigInteger.prototype.fromString = bnpFromString; + BigInteger.prototype.clamp = bnpClamp; + BigInteger.prototype.dlShiftTo = bnpDLShiftTo; + BigInteger.prototype.drShiftTo = bnpDRShiftTo; + BigInteger.prototype.lShiftTo = bnpLShiftTo; + BigInteger.prototype.rShiftTo = bnpRShiftTo; + BigInteger.prototype.subTo = bnpSubTo; + BigInteger.prototype.multiplyTo = bnpMultiplyTo; + BigInteger.prototype.squareTo = bnpSquareTo; + BigInteger.prototype.divRemTo = bnpDivRemTo; + BigInteger.prototype.invDigit = bnpInvDigit; + BigInteger.prototype.isEven = bnpIsEven; + BigInteger.prototype.exp = bnpExp; + + // public + BigInteger.prototype.toString = bnToString; + BigInteger.prototype.negate = bnNegate; + BigInteger.prototype.abs = bnAbs; + BigInteger.prototype.compareTo = bnCompareTo; + BigInteger.prototype.bitLength = bnBitLength; + BigInteger.prototype.mod = bnMod; + BigInteger.prototype.modPowInt = bnModPowInt; + + // "constants" + BigInteger.ZERO = nbv(0); + BigInteger.ONE = nbv(1); + + // Copyright (c) 2005-2009 Tom Wu + // All Rights Reserved. + // See "LICENSE" for details. + + // Extended JavaScript BN functions, required for RSA private ops. + + // Version 1.1: new BigInteger("0", 10) returns "proper" zero + // Version 1.2: square() API, isProbablePrime fix + + // (public) + function bnClone() { var r = nbi(); this.copyTo(r); return r; } + + // (public) return value as integer + function bnIntValue() { + if(this.s < 0) { + if(this.t == 1) return this[0]-this.DV; + else if(this.t == 0) return -1; + } + else if(this.t == 1) return this[0]; + else if(this.t == 0) return 0; + // assumes 16 < DB < 32 + return ((this[1]&((1<<(32-this.DB))-1))<>24; } + + // (public) return value as short (assumes DB>=16) + function bnShortValue() { return (this.t==0)?this.s:(this[0]<<16)>>16; } + + // (protected) return x s.t. r^x < DV + function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); } + + // (public) 0 if this == 0, 1 if this > 0 + function bnSigNum() { + if(this.s < 0) return -1; + else if(this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0; + else return 1; + } + + // (protected) convert to radix string + function bnpToRadix(b) { + if(b == null) b = 10; + if(this.signum() == 0 || b < 2 || b > 36) return "0"; + var cs = this.chunkSize(b); + var a = Math.pow(b,cs); + var d = nbv(a), y = nbi(), z = nbi(), r = ""; + this.divRemTo(d,y,z); + while(y.signum() > 0) { + r = (a+z.intValue()).toString(b).substr(1) + r; + y.divRemTo(d,y,z); + } + return z.intValue().toString(b) + r; + } + + // (protected) convert from radix string + function bnpFromRadix(s,b) { + this.fromInt(0); + if(b == null) b = 10; + var cs = this.chunkSize(b); + var d = Math.pow(b,cs), mi = false, j = 0, w = 0; + for(var i = 0; i < s.length; ++i) { + var x = intAt(s,i); + if(x < 0) { + if(s.charAt(i) == "-" && this.signum() == 0) mi = true; + continue; + } + w = b*w+x; + if(++j >= cs) { + this.dMultiply(d); + this.dAddOffset(w,0); + j = 0; + w = 0; + } + } + if(j > 0) { + this.dMultiply(Math.pow(b,j)); + this.dAddOffset(w,0); + } + if(mi) BigInteger.ZERO.subTo(this,this); + } + + // (protected) alternate constructor + function bnpFromNumber(a,b,c) { + if("number" == typeof b) { + // new BigInteger(int,int,RNG) + if(a < 2) this.fromInt(1); + else { + this.fromNumber(a,c); + if(!this.testBit(a-1)) // force MSB set + this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this); + if(this.isEven()) this.dAddOffset(1,0); // force odd + while(!this.isProbablePrime(b)) { + this.dAddOffset(2,0); + if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this); + } + } + } + else { + // new BigInteger(int,RNG) + var x = new Array(), t = a&7; + x.length = (a>>3)+1; + b.nextBytes(x); + if(t > 0) x[0] &= ((1< 0) { + if(p < this.DB && (d = this[i]>>p) != (this.s&this.DM)>>p) + r[k++] = d|(this.s<<(this.DB-p)); + while(i >= 0) { + if(p < 8) { + d = (this[i]&((1<>(p+=this.DB-8); + } + else { + d = (this[i]>>(p-=8))&0xff; + if(p <= 0) { p += this.DB; --i; } + } + if((d&0x80) != 0) d |= -256; + if(k == 0 && (this.s&0x80) != (d&0x80)) ++k; + if(k > 0 || d != this.s) r[k++] = d; + } + } + return r; + } + + function bnEquals(a) { return(this.compareTo(a)==0); } + function bnMin(a) { return(this.compareTo(a)<0)?this:a; } + function bnMax(a) { return(this.compareTo(a)>0)?this:a; } + + // (protected) r = this op a (bitwise) + function bnpBitwiseTo(a,op,r) { + var i, f, m = Math.min(a.t,this.t); + for(i = 0; i < m; ++i) r[i] = op(this[i],a[i]); + if(a.t < this.t) { + f = a.s&this.DM; + for(i = m; i < this.t; ++i) r[i] = op(this[i],f); + r.t = this.t; + } + else { + f = this.s&this.DM; + for(i = m; i < a.t; ++i) r[i] = op(f,a[i]); + r.t = a.t; + } + r.s = op(this.s,a.s); + r.clamp(); + } + + // (public) this & a + function op_and(x,y) { return x&y; } + function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; } + + // (public) this | a + function op_or(x,y) { return x|y; } + function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; } + + // (public) this ^ a + function op_xor(x,y) { return x^y; } + function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; } + + // (public) this & ~a + function op_andnot(x,y) { return x&~y; } + function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; } + + // (public) ~this + function bnNot() { + var r = nbi(); + for(var i = 0; i < this.t; ++i) r[i] = this.DM&~this[i]; + r.t = this.t; + r.s = ~this.s; + return r; + } + + // (public) this << n + function bnShiftLeft(n) { + var r = nbi(); + if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r); + return r; + } + + // (public) this >> n + function bnShiftRight(n) { + var r = nbi(); + if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r); + return r; + } + + // return index of lowest 1-bit in x, x < 2^31 + function lbit(x) { + if(x == 0) return -1; + var r = 0; + if((x&0xffff) == 0) { x >>= 16; r += 16; } + if((x&0xff) == 0) { x >>= 8; r += 8; } + if((x&0xf) == 0) { x >>= 4; r += 4; } + if((x&3) == 0) { x >>= 2; r += 2; } + if((x&1) == 0) ++r; + return r; + } + + // (public) returns index of lowest 1-bit (or -1 if none) + function bnGetLowestSetBit() { + for(var i = 0; i < this.t; ++i) + if(this[i] != 0) return i*this.DB+lbit(this[i]); + if(this.s < 0) return this.t*this.DB; + return -1; + } + + // return number of 1 bits in x + function cbit(x) { + var r = 0; + while(x != 0) { x &= x-1; ++r; } + return r; + } + + // (public) return number of set bits + function bnBitCount() { + var r = 0, x = this.s&this.DM; + for(var i = 0; i < this.t; ++i) r += cbit(this[i]^x); + return r; + } + + // (public) true iff nth bit is set + function bnTestBit(n) { + var j = Math.floor(n/this.DB); + if(j >= this.t) return(this.s!=0); + return((this[j]&(1<<(n%this.DB)))!=0); + } + + // (protected) this op (1<>= this.DB; + } + if(a.t < this.t) { + c += a.s; + while(i < this.t) { + c += this[i]; + r[i++] = c&this.DM; + c >>= this.DB; + } + c += this.s; + } + else { + c += this.s; + while(i < a.t) { + c += a[i]; + r[i++] = c&this.DM; + c >>= this.DB; + } + c += a.s; + } + r.s = (c<0)?-1:0; + if(c > 0) r[i++] = c; + else if(c < -1) r[i++] = this.DV+c; + r.t = i; + r.clamp(); + } + + // (public) this + a + function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; } + + // (public) this - a + function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; } + + // (public) this * a + function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; } + + // (public) this^2 + function bnSquare() { var r = nbi(); this.squareTo(r); return r; } + + // (public) this / a + function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; } + + // (public) this % a + function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; } + + // (public) [this/a,this%a] + function bnDivideAndRemainder(a) { + var q = nbi(), r = nbi(); + this.divRemTo(a,q,r); + return new Array(q,r); + } + + // (protected) this *= n, this >= 0, 1 < n < DV + function bnpDMultiply(n) { + this[this.t] = this.am(0,n-1,this,0,0,this.t); + ++this.t; + this.clamp(); + } + + // (protected) this += n << w words, this >= 0 + function bnpDAddOffset(n,w) { + if(n == 0) return; + while(this.t <= w) this[this.t++] = 0; + this[w] += n; + while(this[w] >= this.DV) { + this[w] -= this.DV; + if(++w >= this.t) this[this.t++] = 0; + ++this[w]; + } + } + + // A "null" reducer + function NullExp() {} + function nNop(x) { return x; } + function nMulTo(x,y,r) { x.multiplyTo(y,r); } + function nSqrTo(x,r) { x.squareTo(r); } + + NullExp.prototype.convert = nNop; + NullExp.prototype.revert = nNop; + NullExp.prototype.mulTo = nMulTo; + NullExp.prototype.sqrTo = nSqrTo; + + // (public) this^e + function bnPow(e) { return this.exp(e,new NullExp()); } + + // (protected) r = lower n words of "this * a", a.t <= n + // "this" should be the larger one if appropriate. + function bnpMultiplyLowerTo(a,n,r) { + var i = Math.min(this.t+a.t,n); + r.s = 0; // assumes a,this >= 0 + r.t = i; + while(i > 0) r[--i] = 0; + var j; + for(j = r.t-this.t; i < j; ++i) r[i+this.t] = this.am(0,a[i],r,i,0,this.t); + for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a[i],r,i,0,n-i); + r.clamp(); + } + + // (protected) r = "this * a" without lower n words, n > 0 + // "this" should be the larger one if appropriate. + function bnpMultiplyUpperTo(a,n,r) { + --n; + var i = r.t = this.t+a.t-n; + r.s = 0; // assumes a,this >= 0 + while(--i >= 0) r[i] = 0; + for(i = Math.max(n-this.t,0); i < a.t; ++i) + r[this.t+i-n] = this.am(n-i,a[i],r,0,0,this.t+i-n); + r.clamp(); + r.drShiftTo(1,r); + } + + // Barrett modular reduction + function Barrett(m) { + // setup Barrett + this.r2 = nbi(); + this.q3 = nbi(); + BigInteger.ONE.dlShiftTo(2*m.t,this.r2); + this.mu = this.r2.divide(m); + this.m = m; + } + + function barrettConvert(x) { + if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m); + else if(x.compareTo(this.m) < 0) return x; + else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; } + } + + function barrettRevert(x) { return x; } + + // x = x mod m (HAC 14.42) + function barrettReduce(x) { + x.drShiftTo(this.m.t-1,this.r2); + if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); } + this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3); + this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2); + while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1); + x.subTo(this.r2,x); + while(x.compareTo(this.m) >= 0) x.subTo(this.m,x); + } + + // r = x^2 mod m; x != r + function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); } + + // r = x*y mod m; x,y != r + function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } + + Barrett.prototype.convert = barrettConvert; + Barrett.prototype.revert = barrettRevert; + Barrett.prototype.reduce = barrettReduce; + Barrett.prototype.mulTo = barrettMulTo; + Barrett.prototype.sqrTo = barrettSqrTo; + + // (public) this^e % m (HAC 14.85) + function bnModPow(e,m) { + var i = e.bitLength(), k, r = nbv(1), z; + if(i <= 0) return r; + else if(i < 18) k = 1; + else if(i < 48) k = 3; + else if(i < 144) k = 4; + else if(i < 768) k = 5; + else k = 6; + if(i < 8) + z = new Classic(m); + else if(m.isEven()) + z = new Barrett(m); + else + z = new Montgomery(m); + + // precomputation + var g = new Array(), n = 3, k1 = k-1, km = (1< 1) { + var g2 = nbi(); + z.sqrTo(g[1],g2); + while(n <= km) { + g[n] = nbi(); + z.mulTo(g2,g[n-2],g[n]); + n += 2; + } + } + + var j = e.t-1, w, is1 = true, r2 = nbi(), t; + i = nbits(e[j])-1; + while(j >= 0) { + if(i >= k1) w = (e[j]>>(i-k1))&km; + else { + w = (e[j]&((1<<(i+1))-1))<<(k1-i); + if(j > 0) w |= e[j-1]>>(this.DB+i-k1); + } + + n = k; + while((w&1) == 0) { w >>= 1; --n; } + if((i -= n) < 0) { i += this.DB; --j; } + if(is1) { // ret == 1, don't bother squaring or multiplying it + g[w].copyTo(r); + is1 = false; + } + else { + while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } + if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; } + z.mulTo(r2,g[w],r); + } + + while(j >= 0 && (e[j]&(1< 0) { + x.rShiftTo(g,x); + y.rShiftTo(g,y); + } + while(x.signum() > 0) { + if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x); + if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y); + if(x.compareTo(y) >= 0) { + x.subTo(y,x); + x.rShiftTo(1,x); + } + else { + y.subTo(x,y); + y.rShiftTo(1,y); + } + } + if(g > 0) y.lShiftTo(g,y); + return y; + } + + // (protected) this % n, n < 2^26 + function bnpModInt(n) { + if(n <= 0) return 0; + var d = this.DV%n, r = (this.s<0)?n-1:0; + if(this.t > 0) + if(d == 0) r = this[0]%n; + else for(var i = this.t-1; i >= 0; --i) r = (d*r+this[i])%n; + return r; + } + + // (public) 1/this % m (HAC 14.61) + function bnModInverse(m) { + var ac = m.isEven(); + if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO; + var u = m.clone(), v = this.clone(); + var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1); + while(u.signum() != 0) { + while(u.isEven()) { + u.rShiftTo(1,u); + if(ac) { + if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); } + a.rShiftTo(1,a); + } + else if(!b.isEven()) b.subTo(m,b); + b.rShiftTo(1,b); + } + while(v.isEven()) { + v.rShiftTo(1,v); + if(ac) { + if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); } + c.rShiftTo(1,c); + } + else if(!d.isEven()) d.subTo(m,d); + d.rShiftTo(1,d); + } + if(u.compareTo(v) >= 0) { + u.subTo(v,u); + if(ac) a.subTo(c,a); + b.subTo(d,b); + } + else { + v.subTo(u,v); + if(ac) c.subTo(a,c); + d.subTo(b,d); + } + } + if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO; + if(d.compareTo(m) >= 0) return d.subtract(m); + if(d.signum() < 0) d.addTo(m,d); else return d; + if(d.signum() < 0) return d.add(m); else return d; + } + + var lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997]; + var lplim = (1<<26)/lowprimes[lowprimes.length-1]; + + // (public) test primality with certainty >= 1-.5^t + function bnIsProbablePrime(t) { + var i, x = this.abs(); + if(x.t == 1 && x[0] <= lowprimes[lowprimes.length-1]) { + for(i = 0; i < lowprimes.length; ++i) + if(x[0] == lowprimes[i]) return true; + return false; + } + if(x.isEven()) return false; + i = 1; + while(i < lowprimes.length) { + var m = lowprimes[i], j = i+1; + while(j < lowprimes.length && m < lplim) m *= lowprimes[j++]; + m = x.modInt(m); + while(i < j) if(m%lowprimes[i++] == 0) return false; + } + return x.millerRabin(t); + } + + // (protected) true if probably prime (HAC 4.24, Miller-Rabin) + function bnpMillerRabin(t) { + var n1 = this.subtract(BigInteger.ONE); + var k = n1.getLowestSetBit(); + if(k <= 0) return false; + var r = n1.shiftRight(k); + t = (t+1)>>1; + if(t > lowprimes.length) t = lowprimes.length; + var a = nbi(); + for(var i = 0; i < t; ++i) { + //Pick bases at random, instead of starting at 2 + a.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]); + var y = a.modPow(r,this); + if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) { + var j = 1; + while(j++ < k && y.compareTo(n1) != 0) { + y = y.modPowInt(2,this); + if(y.compareTo(BigInteger.ONE) == 0) return false; + } + if(y.compareTo(n1) != 0) return false; + } + } + return true; + } + + // protected + BigInteger.prototype.chunkSize = bnpChunkSize; + BigInteger.prototype.toRadix = bnpToRadix; + BigInteger.prototype.fromRadix = bnpFromRadix; + BigInteger.prototype.fromNumber = bnpFromNumber; + BigInteger.prototype.bitwiseTo = bnpBitwiseTo; + BigInteger.prototype.changeBit = bnpChangeBit; + BigInteger.prototype.addTo = bnpAddTo; + BigInteger.prototype.dMultiply = bnpDMultiply; + BigInteger.prototype.dAddOffset = bnpDAddOffset; + BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo; + BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo; + BigInteger.prototype.modInt = bnpModInt; + BigInteger.prototype.millerRabin = bnpMillerRabin; + + // public + BigInteger.prototype.clone = bnClone; + BigInteger.prototype.intValue = bnIntValue; + BigInteger.prototype.byteValue = bnByteValue; + BigInteger.prototype.shortValue = bnShortValue; + BigInteger.prototype.signum = bnSigNum; + BigInteger.prototype.toByteArray = bnToByteArray; + BigInteger.prototype.equals = bnEquals; + BigInteger.prototype.min = bnMin; + BigInteger.prototype.max = bnMax; + BigInteger.prototype.and = bnAnd; + BigInteger.prototype.or = bnOr; + BigInteger.prototype.xor = bnXor; + BigInteger.prototype.andNot = bnAndNot; + BigInteger.prototype.not = bnNot; + BigInteger.prototype.shiftLeft = bnShiftLeft; + BigInteger.prototype.shiftRight = bnShiftRight; + BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit; + BigInteger.prototype.bitCount = bnBitCount; + BigInteger.prototype.testBit = bnTestBit; + BigInteger.prototype.setBit = bnSetBit; + BigInteger.prototype.clearBit = bnClearBit; + BigInteger.prototype.flipBit = bnFlipBit; + BigInteger.prototype.add = bnAdd; + BigInteger.prototype.subtract = bnSubtract; + BigInteger.prototype.multiply = bnMultiply; + BigInteger.prototype.divide = bnDivide; + BigInteger.prototype.remainder = bnRemainder; + BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder; + BigInteger.prototype.modPow = bnModPow; + BigInteger.prototype.modInverse = bnModInverse; + BigInteger.prototype.pow = bnPow; + BigInteger.prototype.gcd = bnGCD; + BigInteger.prototype.isProbablePrime = bnIsProbablePrime; + + // JSBN-specific extension + BigInteger.prototype.square = bnSquare; + + // Expose the Barrett function + BigInteger.prototype.Barrett = Barrett + + // BigInteger interfaces not implemented in jsbn: + + // BigInteger(int signum, byte[] magnitude) + // double doubleValue() + // float floatValue() + // int hashCode() + // long longValue() + // static BigInteger valueOf(long val) + + // Random number generator - requires a PRNG backend, e.g. prng4.js + + // For best results, put code like + // + // in your main HTML document. + + var rng_state; + var rng_pool; + var rng_pptr; + + // Mix in a 32-bit integer into the pool + function rng_seed_int(x) { + rng_pool[rng_pptr++] ^= x & 255; + rng_pool[rng_pptr++] ^= (x >> 8) & 255; + rng_pool[rng_pptr++] ^= (x >> 16) & 255; + rng_pool[rng_pptr++] ^= (x >> 24) & 255; + if(rng_pptr >= rng_psize) rng_pptr -= rng_psize; + } + + // Mix in the current time (w/milliseconds) into the pool + function rng_seed_time() { + rng_seed_int(new Date().getTime()); + } + + // Initialize the pool with junk if needed. + if(rng_pool == null) { + rng_pool = new Array(); + rng_pptr = 0; + var t; + if(typeof window !== "undefined" && window.crypto) { + if (window.crypto.getRandomValues) { + // Use webcrypto if available + var ua = new Uint8Array(32); + window.crypto.getRandomValues(ua); + for(t = 0; t < 32; ++t) + rng_pool[rng_pptr++] = ua[t]; + } + else if(navigator.appName == "Netscape" && navigator.appVersion < "5") { + // Extract entropy (256 bits) from NS4 RNG if available + var z = window.crypto.random(32); + for(t = 0; t < z.length; ++t) + rng_pool[rng_pptr++] = z.charCodeAt(t) & 255; + } + } + while(rng_pptr < rng_psize) { // extract some randomness from Math.random() + t = Math.floor(65536 * Math.random()); + rng_pool[rng_pptr++] = t >>> 8; + rng_pool[rng_pptr++] = t & 255; + } + rng_pptr = 0; + rng_seed_time(); + //rng_seed_int(window.screenX); + //rng_seed_int(window.screenY); + } + + function rng_get_byte() { + if(rng_state == null) { + rng_seed_time(); + rng_state = prng_newstate(); + rng_state.init(rng_pool); + for(rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) + rng_pool[rng_pptr] = 0; + rng_pptr = 0; + //rng_pool = null; + } + // TODO: allow reseeding after first request + return rng_state.next(); + } + + function rng_get_bytes(ba) { + var i; + for(i = 0; i < ba.length; ++i) ba[i] = rng_get_byte(); + } + + function SecureRandom() {} + + SecureRandom.prototype.nextBytes = rng_get_bytes; + + // prng4.js - uses Arcfour as a PRNG + + function Arcfour() { + this.i = 0; + this.j = 0; + this.S = new Array(); + } + + // Initialize arcfour context from key, an array of ints, each from [0..255] + function ARC4init(key) { + var i, j, t; + for(i = 0; i < 256; ++i) + this.S[i] = i; + j = 0; + for(i = 0; i < 256; ++i) { + j = (j + this.S[i] + key[i % key.length]) & 255; + t = this.S[i]; + this.S[i] = this.S[j]; + this.S[j] = t; + } + this.i = 0; + this.j = 0; + } + + function ARC4next() { + var t; + this.i = (this.i + 1) & 255; + this.j = (this.j + this.S[this.i]) & 255; + t = this.S[this.i]; + this.S[this.i] = this.S[this.j]; + this.S[this.j] = t; + return this.S[(t + this.S[this.i]) & 255]; + } + + Arcfour.prototype.init = ARC4init; + Arcfour.prototype.next = ARC4next; + + // Plug in your RNG constructor here + function prng_newstate() { + return new Arcfour(); + } + + // Pool size must be a multiple of 4 and greater than 32. + // An array of bytes the size of the pool will be passed to init() + var rng_psize = 256; + + BigInteger.SecureRandom = SecureRandom; + BigInteger.BigInteger = BigInteger; + if (true) { + exports = module.exports = BigInteger; + } else { + this.BigInteger = BigInteger; + this.SecureRandom = SecureRandom; + } + + }).call(this); + + +/***/ }, +/* 32 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Check if `fn` is a function. + * + * @param {Function} fn + * @return {Boolean} + * @api private + */ + var isObject = __webpack_require__(14); + + function isFunction(fn) { + var tag = isObject(fn) ? Object.prototype.toString.call(fn) : ''; + return tag === '[object Function]'; + } + + module.exports = isFunction; + + +/***/ }, +/* 33 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Module of mixed-in functions shared between node and client code + */ + var isObject = __webpack_require__(14); + + /** + * Expose `RequestBase`. + */ + + module.exports = RequestBase; + + /** + * Initialize a new `RequestBase`. + * + * @api public + */ + + function RequestBase(obj) { + if (obj) return mixin(obj); + } + + /** + * Mixin the prototype properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + + function mixin(obj) { + for (var key in RequestBase.prototype) { + obj[key] = RequestBase.prototype[key]; + } + return obj; + } + + /** + * Clear previous timeout. + * + * @return {Request} for chaining + * @api public + */ + + RequestBase.prototype.clearTimeout = function _clearTimeout(){ + clearTimeout(this._timer); + clearTimeout(this._responseTimeoutTimer); + delete this._timer; + delete this._responseTimeoutTimer; + return this; + }; + + /** + * Override default response body parser + * + * This function will be called to convert incoming data into request.body + * + * @param {Function} + * @api public + */ + + RequestBase.prototype.parse = function parse(fn){ + this._parser = fn; + return this; + }; + + /** + * Set format of binary response body. + * In browser valid formats are 'blob' and 'arraybuffer', + * which return Blob and ArrayBuffer, respectively. + * + * In Node all values result in Buffer. + * + * Examples: + * + * req.get('/') + * .responseType('blob') + * .end(callback); + * + * @param {String} val + * @return {Request} for chaining + * @api public + */ + + RequestBase.prototype.responseType = function(val){ + this._responseType = val; + return this; + }; + + /** + * Override default request body serializer + * + * This function will be called to convert data set via .send or .attach into payload to send + * + * @param {Function} + * @api public + */ + + RequestBase.prototype.serialize = function serialize(fn){ + this._serializer = fn; + return this; + }; + + /** + * Set timeouts. + * + * - response timeout is time between sending request and receiving the first byte of the response. Includes DNS and connection time. + * - deadline is the time from start of the request to receiving response body in full. If the deadline is too short large files may not load at all on slow connections. + * + * Value of 0 or false means no timeout. + * + * @param {Number|Object} ms or {response, read, deadline} + * @return {Request} for chaining + * @api public + */ + + RequestBase.prototype.timeout = function timeout(options){ + if (!options || 'object' !== typeof options) { + this._timeout = options; + this._responseTimeout = 0; + return this; + } + + for(var option in options) { + switch(option) { + case 'deadline': + this._timeout = options.deadline; + break; + case 'response': + this._responseTimeout = options.response; + break; + default: + console.warn("Unknown timeout option", option); + } + } + return this; + }; + + /** + * Set number of retry attempts on error. + * + * Failed requests will be retried 'count' times if timeout or err.code >= 500. + * + * @param {Number} count + * @return {Request} for chaining + * @api public + */ + + RequestBase.prototype.retry = function retry(count){ + // Default to 1 if no count passed or true + if (arguments.length === 0 || count === true) count = 1; + if (count <= 0) count = 0; + this._maxRetries = count; + this._retries = 0; + return this; + }; + + /** + * Retry request + * + * @return {Request} for chaining + * @api private + */ + + RequestBase.prototype._retry = function() { + this.clearTimeout(); + + // node + if (this.req) { + this.req = null; + this.req = this.request(); + } + + this._aborted = false; + this.timedout = false; + + return this._end(); + }; + + /** + * Promise support + * + * @param {Function} resolve + * @param {Function} [reject] + * @return {Request} + */ + + RequestBase.prototype.then = function then(resolve, reject) { + if (!this._fullfilledPromise) { + var self = this; + if (this._endCalled) { + console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"); + } + this._fullfilledPromise = new Promise(function(innerResolve, innerReject){ + self.end(function(err, res){ + if (err) innerReject(err); else innerResolve(res); + }); + }); + } + return this._fullfilledPromise.then(resolve, reject); + } + + RequestBase.prototype.catch = function(cb) { + return this.then(undefined, cb); + }; + + /** + * Allow for extension + */ + + RequestBase.prototype.use = function use(fn) { + fn(this); + return this; + } + + RequestBase.prototype.ok = function(cb) { + if ('function' !== typeof cb) throw Error("Callback required"); + this._okCallback = cb; + return this; + }; + + RequestBase.prototype._isResponseOK = function(res) { + if (!res) { + return false; + } + + if (this._okCallback) { + return this._okCallback(res); + } + + return res.status >= 200 && res.status < 300; + }; + + + /** + * Get request header `field`. + * Case-insensitive. + * + * @param {String} field + * @return {String} + * @api public + */ + + RequestBase.prototype.get = function(field){ + return this._header[field.toLowerCase()]; + }; + + /** + * Get case-insensitive header `field` value. + * This is a deprecated internal API. Use `.get(field)` instead. + * + * (getHeader is no longer used internally by the superagent code base) + * + * @param {String} field + * @return {String} + * @api private + * @deprecated + */ + + RequestBase.prototype.getHeader = RequestBase.prototype.get; + + /** + * Set header `field` to `val`, or multiple fields with one object. + * Case-insensitive. + * + * Examples: + * + * req.get('/') + * .set('Accept', 'application/json') + * .set('X-API-Key', 'foobar') + * .end(callback); + * + * req.get('/') + * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' }) + * .end(callback); + * + * @param {String|Object} field + * @param {String} val + * @return {Request} for chaining + * @api public + */ + + RequestBase.prototype.set = function(field, val){ + if (isObject(field)) { + for (var key in field) { + this.set(key, field[key]); + } + return this; + } + this._header[field.toLowerCase()] = val; + this.header[field] = val; + return this; + }; + + /** + * Remove header `field`. + * Case-insensitive. + * + * Example: + * + * req.get('/') + * .unset('User-Agent') + * .end(callback); + * + * @param {String} field + */ + RequestBase.prototype.unset = function(field){ + delete this._header[field.toLowerCase()]; + delete this.header[field]; + return this; + }; + + /** + * Write the field `name` and `val`, or multiple fields with one object + * for "multipart/form-data" request bodies. + * + * ``` js + * request.post('/upload') + * .field('foo', 'bar') + * .end(callback); + * + * request.post('/upload') + * .field({ foo: 'bar', baz: 'qux' }) + * .end(callback); + * ``` + * + * @param {String|Object} name + * @param {String|Blob|File|Buffer|fs.ReadStream} val + * @return {Request} for chaining + * @api public + */ + RequestBase.prototype.field = function(name, val) { + + // name should be either a string or an object. + if (null === name || undefined === name) { + throw new Error('.field(name, val) name can not be empty'); + } + + if (this._data) { + console.error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()"); + } + + if (isObject(name)) { + for (var key in name) { + this.field(key, name[key]); + } + return this; + } + + if (Array.isArray(val)) { + for (var i in val) { + this.field(name, val[i]); + } + return this; + } + + // val should be defined now + if (null === val || undefined === val) { + throw new Error('.field(name, val) val can not be empty'); + } + if ('boolean' === typeof val) { + val = '' + val; + } + this._getFormData().append(name, val); + return this; + }; + + /** + * Abort the request, and clear potential timeout. + * + * @return {Request} + * @api public + */ + RequestBase.prototype.abort = function(){ + if (this._aborted) { + return this; + } + this._aborted = true; + this.xhr && this.xhr.abort(); // browser + this.req && this.req.abort(); // node + this.clearTimeout(); + this.emit('abort'); + return this; + }; + + /** + * Enable transmission of cookies with x-domain requests. + * + * Note that for this to work the origin must not be + * using "Access-Control-Allow-Origin" with a wildcard, + * and also must set "Access-Control-Allow-Credentials" + * to "true". + * + * @api public + */ + + RequestBase.prototype.withCredentials = function(on){ + // This is browser-only functionality. Node side is no-op. + if(on==undefined) on = true; + this._withCredentials = on; + return this; + }; + + /** + * Set the max redirects to `n`. Does noting in browser XHR implementation. + * + * @param {Number} n + * @return {Request} for chaining + * @api public + */ + + RequestBase.prototype.redirects = function(n){ + this._maxRedirects = n; + return this; + }; + + /** + * Convert to a plain javascript object (not JSON string) of scalar properties. + * Note as this method is designed to return a useful non-this value, + * it cannot be chained. + * + * @return {Object} describing method, url, and data of this request + * @api public + */ + + RequestBase.prototype.toJSON = function(){ + return { + method: this.method, + url: this.url, + data: this._data, + headers: this._header + }; + }; + + + /** + * Send `data` as the request body, defaulting the `.type()` to "json" when + * an object is given. + * + * Examples: + * + * // manual json + * request.post('/user') + * .type('json') + * .send('{"name":"tj"}') + * .end(callback) + * + * // auto json + * request.post('/user') + * .send({ name: 'tj' }) + * .end(callback) + * + * // manual x-www-form-urlencoded + * request.post('/user') + * .type('form') + * .send('name=tj') + * .end(callback) + * + * // auto x-www-form-urlencoded + * request.post('/user') + * .type('form') + * .send({ name: 'tj' }) + * .end(callback) + * + * // defaults to x-www-form-urlencoded + * request.post('/user') + * .send('name=tobi') + * .send('species=ferret') + * .end(callback) + * + * @param {String|Object} data + * @return {Request} for chaining + * @api public + */ + + RequestBase.prototype.send = function(data){ + var isObj = isObject(data); + var type = this._header['content-type']; + + if (this._formData) { + console.error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()"); + } + + if (isObj && !this._data) { + if (Array.isArray(data)) { + this._data = []; + } else if (!this._isHost(data)) { + this._data = {}; + } + } else if (data && this._data && this._isHost(this._data)) { + throw Error("Can't merge these send calls"); + } + + // merge + if (isObj && isObject(this._data)) { + for (var key in data) { + this._data[key] = data[key]; + } + } else if ('string' == typeof data) { + // default to x-www-form-urlencoded + if (!type) this.type('form'); + type = this._header['content-type']; + if ('application/x-www-form-urlencoded' == type) { + this._data = this._data + ? this._data + '&' + data + : data; + } else { + this._data = (this._data || '') + data; + } + } else { + this._data = data; + } + + if (!isObj || this._isHost(data)) { + return this; + } + + // default to json + if (!type) this.type('json'); + return this; + }; + + + /** + * Sort `querystring` by the sort function + * + * + * Examples: + * + * // default order + * request.get('/user') + * .query('name=Nick') + * .query('search=Manny') + * .sortQuery() + * .end(callback) + * + * // customized sort function + * request.get('/user') + * .query('name=Nick') + * .query('search=Manny') + * .sortQuery(function(a, b){ + * return a.length - b.length; + * }) + * .end(callback) + * + * + * @param {Function} sort + * @return {Request} for chaining + * @api public + */ + + RequestBase.prototype.sortQuery = function(sort) { + // _sort default to true but otherwise can be a function or boolean + this._sort = typeof sort === 'undefined' ? true : sort; + return this; + }; + + /** + * Invoke callback with timeout error. + * + * @api private + */ + + RequestBase.prototype._timeoutError = function(reason, timeout, errno){ + if (this._aborted) { + return; + } + var err = new Error(reason + timeout + 'ms exceeded'); + err.timeout = timeout; + err.code = 'ECONNABORTED'; + err.errno = errno; + this.timedout = true; + this.abort(); + this.callback(err); + }; + + RequestBase.prototype._setTimeouts = function() { + var self = this; + + // deadline + if (this._timeout && !this._timer) { + this._timer = setTimeout(function(){ + self._timeoutError('Timeout of ', self._timeout, 'ETIME'); + }, this._timeout); + } + // response timeout + if (this._responseTimeout && !this._responseTimeoutTimer) { + this._responseTimeoutTimer = setTimeout(function(){ + self._timeoutError('Response timeout of ', self._responseTimeout, 'ETIMEDOUT'); + }, this._responseTimeout); + } + } + + +/***/ }, +/* 34 */ +/***/ function(module, exports, __webpack_require__) { + + + /** + * Module dependencies. + */ + + var utils = __webpack_require__(36); + + /** + * Expose `ResponseBase`. + */ + + module.exports = ResponseBase; + + /** + * Initialize a new `ResponseBase`. + * + * @api public + */ + + function ResponseBase(obj) { + if (obj) return mixin(obj); + } + + /** + * Mixin the prototype properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + + function mixin(obj) { + for (var key in ResponseBase.prototype) { + obj[key] = ResponseBase.prototype[key]; + } + return obj; + } + + /** + * Get case-insensitive `field` value. + * + * @param {String} field + * @return {String} + * @api public + */ + + ResponseBase.prototype.get = function(field){ + return this.header[field.toLowerCase()]; + }; + + /** + * Set header related properties: + * + * - `.type` the content type without params + * + * A response of "Content-Type: text/plain; charset=utf-8" + * will provide you with a `.type` of "text/plain". + * + * @param {Object} header + * @api private + */ + + ResponseBase.prototype._setHeaderProperties = function(header){ + // TODO: moar! + // TODO: make this a util + + // content-type + var ct = header['content-type'] || ''; + this.type = utils.type(ct); + + // params + var params = utils.params(ct); + for (var key in params) this[key] = params[key]; + + this.links = {}; + + // links + try { + if (header.link) { + this.links = utils.parseLinks(header.link); + } + } catch (err) { + // ignore + } + }; + + /** + * Set flags such as `.ok` based on `status`. + * + * For example a 2xx response will give you a `.ok` of __true__ + * whereas 5xx will be __false__ and `.error` will be __true__. The + * `.clientError` and `.serverError` are also available to be more + * specific, and `.statusType` is the class of error ranging from 1..5 + * sometimes useful for mapping respond colors etc. + * + * "sugar" properties are also defined for common cases. Currently providing: + * + * - .noContent + * - .badRequest + * - .unauthorized + * - .notAcceptable + * - .notFound + * + * @param {Number} status + * @api private + */ + + ResponseBase.prototype._setStatusProperties = function(status){ + var type = status / 100 | 0; + + // status / class + this.status = this.statusCode = status; + this.statusType = type; + + // basics + this.info = 1 == type; + this.ok = 2 == type; + this.redirect = 3 == type; + this.clientError = 4 == type; + this.serverError = 5 == type; + this.error = (4 == type || 5 == type) + ? this.toError() + : false; + + // sugar + this.accepted = 202 == status; + this.noContent = 204 == status; + this.badRequest = 400 == status; + this.unauthorized = 401 == status; + this.notAcceptable = 406 == status; + this.forbidden = 403 == status; + this.notFound = 404 == status; + }; + + +/***/ }, +/* 35 */ +/***/ function(module, exports) { + + var ERROR_CODES = [ + 'ECONNRESET', + 'ETIMEDOUT', + 'EADDRINFO', + 'ESOCKETTIMEDOUT' + ]; + + /** + * Determine if a request should be retried. + * (Borrowed from segmentio/superagent-retry) + * + * @param {Error} err + * @param {Response} [res] + * @returns {Boolean} + */ + module.exports = function shouldRetry(err, res) { + if (err && err.code && ~ERROR_CODES.indexOf(err.code)) return true; + if (res && res.status && res.status >= 500) return true; + // Superagent timeout + if (err && 'timeout' in err && err.code == 'ECONNABORTED') return true; + return false; + }; + +/***/ }, +/* 36 */ +/***/ function(module, exports) { + + + /** + * Return the mime type for the given `str`. + * + * @param {String} str + * @return {String} + * @api private + */ + + exports.type = function(str){ + return str.split(/ *; */).shift(); + }; + + /** + * Return header field parameters. + * + * @param {String} str + * @return {Object} + * @api private + */ + + exports.params = function(str){ + return str.split(/ *; */).reduce(function(obj, str){ + var parts = str.split(/ *= */); + var key = parts.shift(); + var val = parts.shift(); + + if (key && val) obj[key] = val; + return obj; + }, {}); + }; + + /** + * Parse Link header fields. + * + * @param {String} str + * @return {Object} + * @api private + */ + + exports.parseLinks = function(str){ + return str.split(/ *, */).reduce(function(obj, str){ + var parts = str.split(/ *; */); + var url = parts[0].slice(1, -1); + var rel = parts[1].split(/ *= */)[1].slice(1, -1); + obj[rel] = url; + return obj; + }, {}); + }; + + /** + * Strip content related fields from `header`. + * + * @param {Object} header + * @return {Object} header + * @api private + */ + + exports.cleanHeader = function(header, shouldStripCookie){ + delete header['content-type']; + delete header['content-length']; + delete header['transfer-encoding']; + delete header['host']; + if (shouldStripCookie) { + delete header['cookie']; + } + return header; + }; + +/***/ }, +/* 37 */, +/* 38 */, +/* 39 */, +/* 40 */ +/***/ function(module, exports, __webpack_require__) { + + var urljoin = __webpack_require__(1); + + var objectHelper = __webpack_require__(2); + var assert = __webpack_require__(4); + var responseHandler = __webpack_require__(6); + + function DBConnection(request, options) { + this.baseOptions = options; + this.request = request; + } + + /** + * @callback signUpCallback + * @param {Error} [err] error returned by Auth0 with the reason why the signup failed + * @param {Object} [result] result of the signup request + * @param {Object} result.email user's email + * @param {Object} result.emailVerified if the user's email was verified + */ + + /** + * Creates a new user in a Auth0 Database connection + * + * @method signup + * @param {Object} options + * @param {String} options.email user email address + * @param {String} options.password user password + * @param {String} options.connection name of the connection where the user will be created + * @param {Object} [options.userMetadata] additional signup attributes used for creating the user. Will be stored in `user_metadata` + * @param {signUpCallback} cb + * @see {@link https://auth0.com/docs/api/authentication#signup} + */ + DBConnection.prototype.signup = function(options, cb) { + var url; + var body; + var metadata; + + assert.check( + options, + { type: 'object', message: 'options parameter is not valid' }, + { + connection: { type: 'string', message: 'connection option is required' }, + email: { type: 'string', message: 'email option is required' }, + password: { type: 'string', message: 'password option is required' } + } + ); + assert.check(cb, { type: 'function', message: 'cb parameter is not valid' }); + + url = urljoin(this.baseOptions.rootUrl, 'dbconnections', 'signup'); + + body = objectHelper.merge(this.baseOptions, ['clientID']).with(options); + + metadata = body.user_metadata || body.userMetadata; + + body = objectHelper.blacklist(body, ['scope', 'userMetadata', 'user_metadata']); + + body = objectHelper.toSnakeCase(body, ['auth0Client']); + + if (metadata) { + body.user_metadata = metadata; + } + + return this.request.post(url).send(body).end(responseHandler(cb)); + }; + + /** + * @callback changePasswordCallback + * @param {Error} [err] error returned by Auth0 with the reason why the request failed + */ + + /** + * Request an email with instruction to change a user's password + * + * @method changePassword + * @param {Object} options + * @param {String} options.email address where the user will recieve the change password email. It should match the user's email in Auth0 + * @param {String} options.connection name of the connection where the user was created + * @param {changePasswordCallback} cb + * @see {@link https://auth0.com/docs/api/authentication#change-password} + */ + DBConnection.prototype.changePassword = function(options, cb) { + var url; + var body; + + assert.check( + options, + { type: 'object', message: 'options parameter is not valid' }, + { + connection: { type: 'string', message: 'connection option is required' }, + email: { type: 'string', message: 'email option is required' } + } + ); + assert.check(cb, { type: 'function', message: 'cb parameter is not valid' }); + + url = urljoin(this.baseOptions.rootUrl, 'dbconnections', 'change_password'); + + body = objectHelper.merge(this.baseOptions, ['clientID']).with(options, ['email', 'connection']); + + body = objectHelper.toSnakeCase(body, ['auth0Client']); + + return this.request.post(url).send(body).end(responseHandler(cb)); + }; + + module.exports = DBConnection; + + +/***/ }, +/* 41 */ +/***/ function(module, exports, __webpack_require__) { + + var urljoin = __webpack_require__(1); + + var objectHelper = __webpack_require__(2); + var assert = __webpack_require__(4); + var qs = __webpack_require__(5); + var responseHandler = __webpack_require__(6); + + function PasswordlessAuthentication(request, options) { + this.baseOptions = options; + this.request = request; + } + + PasswordlessAuthentication.prototype.buildVerifyUrl = function(options) { + var params; + var qString; + + /* eslint-disable */ + assert.check( + options, + { type: 'object', message: 'options parameter is not valid' }, + { + connection: { type: 'string', message: 'connection option is required' }, + verificationCode: { type: 'string', message: 'verificationCode option is required' }, + phoneNumber: { + optional: false, + type: 'string', + message: 'phoneNumber option is required', + condition: function(o) { + return !o.email; + } + }, + email: { + optional: false, + type: 'string', + message: 'email option is required', + condition: function(o) { + return !o.phoneNumber; + } + } + } + ); + /* eslint-enable */ + + params = objectHelper + .merge(this.baseOptions, [ + 'clientID', + 'responseType', + 'responseMode', + 'redirectUri', + 'scope', + 'audience', + '_csrf', + 'state', + '_intstate', + 'protocol', + 'nonce' + ]) + .with(options); + + // eslint-disable-next-line + if (this.baseOptions._sendTelemetry) { + params.auth0Client = this.request.getTelemetryData(); + } + + params = objectHelper.toSnakeCase(params, ['auth0Client']); + + qString = qs.stringify(params); + + return urljoin(this.baseOptions.rootUrl, 'passwordless', 'verify_redirect', '?' + qString); + }; + + PasswordlessAuthentication.prototype.start = function(options, cb) { + var url; + var body; + + /* eslint-disable */ + assert.check( + options, + { type: 'object', message: 'options parameter is not valid' }, + { + connection: { type: 'string', message: 'connection option is required' }, + send: { + type: 'string', + message: 'send option is required', + values: ['link', 'code'], + value_message: 'send is not valid ([link, code])' + }, + phoneNumber: { + optional: true, + type: 'string', + message: 'phoneNumber option is required', + condition: function(o) { + return o.send === 'code' || !o.email; + } + }, + email: { + optional: true, + type: 'string', + message: 'email option is required', + condition: function(o) { + return o.send === 'link' || !o.phoneNumber; + } + }, + authParams: { optional: true, type: 'object', message: 'authParams option is required' } + } + ); + /* eslint-enable */ + + assert.check(cb, { type: 'function', message: 'cb parameter is not valid' }); + + url = urljoin(this.baseOptions.rootUrl, 'passwordless', 'start'); + + body = objectHelper + .merge(this.baseOptions, ['clientID', 'responseType', 'redirectUri', 'scope']) + .with(options); + + if (body.scope) { + body.authParams = body.authParams || {}; + body.authParams.scope = body.scope; + } + + if (body.redirectUri) { + body.authParams = body.authParams || {}; + body.authParams.redirect_uri = body.redirectUri; + } + + if (body.responseType) { + body.authParams = body.authParams || {}; + body.authParams.response_type = body.responseType; + } + + delete body.redirectUri; + delete body.responseType; + delete body.scope; + + body = objectHelper.toSnakeCase(body, ['auth0Client', 'authParams']); + + return this.request.post(url).send(body).end(responseHandler(cb)); + }; + + PasswordlessAuthentication.prototype.verify = function(options, cb) { + var url; + var cleanOption; + + /* eslint-disable */ + assert.check( + options, + { type: 'object', message: 'options parameter is not valid' }, + { + connection: { type: 'string', message: 'connection option is required' }, + verificationCode: { type: 'string', message: 'verificationCode option is required' }, + phoneNumber: { + optional: false, + type: 'string', + message: 'phoneNumber option is required', + condition: function(o) { + return !o.email; + } + }, + email: { + optional: false, + type: 'string', + message: 'email option is required', + condition: function(o) { + return !o.phoneNumber; + } + } + } + ); + /* eslint-enable */ + + assert.check(cb, { type: 'function', message: 'cb parameter is not valid' }); + + cleanOption = objectHelper.pick(options, [ + 'connection', + 'verificationCode', + 'phoneNumber', + 'email', + 'auth0Client' + ]); + cleanOption = objectHelper.toSnakeCase(cleanOption, ['auth0Client']); + + url = urljoin(this.baseOptions.rootUrl, 'passwordless', 'verify'); + + return this.request.post(url).send(cleanOption).end(responseHandler(cb)); + }; + + module.exports = PasswordlessAuthentication; + + +/***/ }, +/* 42 */ +/***/ function(module, exports, __webpack_require__) { + + var windowHandler = __webpack_require__(3); + var base64Url = __webpack_require__(20); + + function create(name, value, days) { + var date; + var expires; + + if ( + windowHandler.getDocument().cookie === undefined || + windowHandler.getDocument().cookie === null + ) { + throw new Error('cookie storage not available'); + } + + if (days) { + var timeToExpire = days * 24 * 60 * 60 * 1000; + date = new Date(); + date.setTime(date.getTime() + timeToExpire); + expires = '; expires=' + date.toGMTString(); + } else { + expires = ''; + } + + windowHandler.getDocument().cookie = name + '=' + base64Url.encode(value) + expires + '; path=/'; + } + + function read(name) { + var i; + var cookie; + var cookies; + var nameEQ = name + '='; + + if ( + windowHandler.getDocument().cookie === undefined || + windowHandler.getDocument().cookie === null + ) { + throw new Error('cookie storage not available'); + } + + cookies = windowHandler.getDocument().cookie.split(';'); + + for (i = 0; i < cookies.length; i++) { + cookie = cookies[i]; + while (cookie.charAt(0) === ' ') { + cookie = cookie.substring(1, cookie.length); + } + if (cookie.indexOf(nameEQ) === 0) { + return base64Url.decode(cookie.substring(nameEQ.length, cookie.length)); + } + } + + return null; + } + + function erase(name) { + create(name, '', -1); + } + + module.exports = { + create: create, + read: read, + erase: erase + }; + + +/***/ }, +/* 43 */ +/***/ function(module, exports, __webpack_require__) { + + var windowHelper = __webpack_require__(3); + + function IframeHandler(options) { + this.url = options.url; + this.callback = options.callback; + this.timeout = options.timeout || 60 * 1000; + this.timeoutCallback = options.timeoutCallback || null; + this.eventListenerType = options.eventListenerType || 'message'; + this.iframe = null; + this.timeoutHandle = null; + this._destroyTimeout = null; + this.transientMessageEventListener = null; + this.proxyEventListener = null; + // If no event identifier specified, set default + this.eventValidator = options.eventValidator || { + isValid: function() { + return true; + } + }; + + if (typeof this.callback !== 'function') { + throw new Error('options.callback must be a function'); + } + } + + IframeHandler.prototype.init = function() { + var _this = this; + var _window = windowHelper.getWindow(); + + this.iframe = _window.document.createElement('iframe'); + this.iframe.style.display = 'none'; + this.iframe.src = this.url; + + // Workaround to avoid using bind that does not work in IE8 + this.proxyEventListener = function(e) { + _this.eventListener(e); + }; + + switch (this.eventListenerType) { + case 'message': + this.eventSourceObject = _window; + break; + case 'load': + this.eventSourceObject = this.iframe; + break; + default: + throw new Error('Unsupported event listener type: ' + this.eventListenerType); + } + + this.eventSourceObject.addEventListener(this.eventListenerType, this.proxyEventListener, false); + + _window.document.body.appendChild(this.iframe); + + this.timeoutHandle = setTimeout(function() { + _this.timeoutHandler(); + }, this.timeout); + }; + + IframeHandler.prototype.eventListener = function(event) { + var eventData = { event: event, sourceObject: this.eventSourceObject }; + + if (!this.eventValidator.isValid(eventData)) { + return; + } + + this.destroy(); + this.callback(eventData); + }; + + IframeHandler.prototype.timeoutHandler = function() { + this.destroy(); + if (this.timeoutCallback) { + this.timeoutCallback(); + } + }; + + IframeHandler.prototype.destroy = function() { + var _this = this; + var _window = windowHelper.getWindow(); + + clearTimeout(this.timeoutHandle); + + this._destroyTimeout = setTimeout(function() { + _this.eventSourceObject.removeEventListener( + _this.eventListenerType, + _this.proxyEventListener, + false + ); + _window.document.body.removeChild(_this.iframe); + }, 0); + }; + + module.exports = IframeHandler; + + +/***/ }, +/* 44 */ +/***/ function(module, exports) { + + /* eslint-disable no-continue */ + + function get() { + if (!Object.assign) { + return objectAssignPolyfill; + } + + return Object.assign; + } + + function objectAssignPolyfill(target) { + 'use strict'; + if (target === undefined || target === null) { + throw new TypeError('Cannot convert first argument to object'); + } + + var to = Object(target); + for (var i = 1; i < arguments.length; i++) { + var nextSource = arguments[i]; + if (nextSource === undefined || nextSource === null) { + continue; + } + + var keysArray = Object.keys(Object(nextSource)); + for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) { + var nextKey = keysArray[nextIndex]; + var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); + if (desc !== undefined && desc.enumerable) { + to[nextKey] = nextSource[nextKey]; + } + } + } + return to; + } + + module.exports = { + get: get, + objectAssignPolyfill: objectAssignPolyfill + }; + + +/***/ }, +/* 45 */ +/***/ function(module, exports, __webpack_require__) { + + var objectHelper = __webpack_require__(2); + + var tokenParams = [ + // auth0 + 'realm', + 'audience', + // oauth2 + 'client_id', + 'client_secret', + 'redirect_uri', + 'scope', + 'code', + 'grant_type', + 'username', + 'password', + 'refresh_token', + 'assertion', + 'client_assertion', + 'client_assertion_type', + 'code_verifier' + ]; + + var authorizeParams = [ + // auth0 + 'connection', + 'connection_scope', + 'auth0Client', + 'owp', + 'device', + + 'protocol', + '_csrf', + '_intstate', + 'login_ticket', + + // oauth2 + 'client_id', + 'response_type', + 'response_mode', + 'redirect_uri', + 'audience', + 'scope', + 'state', + 'nonce', + 'display', + 'prompt', + 'max_age', + 'ui_locales', + 'claims_locales', + 'id_token_hint', + 'login_hint', + 'acr_values', + 'claims', + 'registration', + 'request', + 'request_uri', + 'code_challenge', + 'code_challenge_method' + ]; + + function oauthAuthorizeParams(warn, params) { + var notAllowed = objectHelper.getKeysNotIn(params, authorizeParams); + + if (notAllowed.length > 0) { + warn.warning( + 'Following parameters are not allowed on the `/authorize` endpoint: [' + + notAllowed.join(',') + + ']' + ); + } + + return params; + } + + function oauthTokenParams(warn, params) { + return objectHelper.pick(params, tokenParams); + } + + module.exports = { + oauthTokenParams: oauthTokenParams, + oauthAuthorizeParams: oauthAuthorizeParams + }; + + +/***/ }, +/* 46 */ +/***/ function(module, exports, __webpack_require__) { + + var version = __webpack_require__(9); + + function PluginHandler(webAuth, plugins) { + this.plugins = plugins; + + for (var a = 0; a < this.plugins.length; a++) { + if (this.plugins[a].version !== version.raw) { + var pluginName = ''; + + if (this.plugins[a].constructor && this.plugins[a].constructor.name) { + pluginName = this.plugins[a].constructor.name; + } + + throw new Error( + 'Plugin ' + + pluginName + + ' version (' + + this.plugins[a].version + + ') ' + + 'is not compatible with the SDK version (' + + version.raw + + ')' + ); + } + + this.plugins[a].setWebAuth(webAuth); + } + } + + PluginHandler.prototype.get = function(extensibilityPoint) { + for (var a = 0; a < this.plugins.length; a++) { + if (this.plugins[a].supports(extensibilityPoint)) { + return this.plugins[a].init(); + } + } + + return null; + }; + + module.exports = PluginHandler; + + +/***/ }, +/* 47 */ +/***/ function(module, exports, __webpack_require__) { + + /* eslint-disable no-restricted-syntax */ + /* eslint-disable guard-for-in */ + var WinChan = __webpack_require__(18); + + var windowHandler = __webpack_require__(3); + var objectHelper = __webpack_require__(2); + var qs = __webpack_require__(5); + + function PopupHandler() { + this._current_popup = null; + } + + PopupHandler.prototype.calculatePosition = function(options) { + var width = options.width || 500; + var height = options.height || 600; + var _window = windowHandler.getWindow(); + + var screenX = typeof _window.screenX !== 'undefined' ? _window.screenX : _window.screenLeft; + var screenY = typeof _window.screenY !== 'undefined' ? _window.screenY : _window.screenTop; + + var outerWidth = typeof _window.outerWidth !== 'undefined' + ? _window.outerWidth + : _window.document.body.clientWidth; + + var outerHeight = typeof _window.outerHeight !== 'undefined' + ? _window.outerHeight + : _window.document.body.clientHeight; + + var left = (outerWidth - width) / 2; + var top = (outerHeight - height) / 2; + + return { width: width, height: height, left: screenX + left, top: screenY + top }; + }; + + PopupHandler.prototype.preload = function(options) { + var _this = this; + var _window = windowHandler.getWindow(); + var popupPosition = this.calculatePosition(options.popupOptions || {}); + var popupOptions = objectHelper.merge(popupPosition).with(options.popupOptions); + var url = options.url || 'about:blank'; + var windowFeatures = qs.stringify(popupOptions, { + encode: false, + delimiter: ',' + }); + + if (this._current_popup && !this._current_popup.closed) { + return this._current_popup; + } + + this._current_popup = _window.open(url, 'auth0_signup_popup', windowFeatures); + + this._current_popup.kill = function() { + this.close(); + _this._current_popup = null; + }; + + return this._current_popup; + }; + + PopupHandler.prototype.load = function(url, relayUrl, options, cb) { + var _this = this; + var popupPosition = this.calculatePosition(options.popupOptions || {}); + var popupOptions = objectHelper.merge(popupPosition).with(options.popupOptions); + + var winchanOptions = objectHelper + .merge({ + url: url, + relay_url: relayUrl, + window_features: qs.stringify(popupOptions, { + delimiter: ',', + encode: false + }), + popup: this._current_popup + }) + .with(options); + + var popup = WinChan.open(winchanOptions, function(err, data) { + _this._current_popup = null; + return cb(err, data); + }); + + popup.focus(); + + return popup; + }; + + module.exports = PopupHandler; + + +/***/ }, +/* 48 */ +/***/ function(module, exports, __webpack_require__) { + + var windowHelper = __webpack_require__(3); + + function randomString(length) { + // eslint-disable-next-line + var bytes = new Uint8Array(length); + var result = []; + var charset = '0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._~'; + + var cryptoObj = windowHelper.getWindow().crypto || windowHelper.getWindow().msCrypto; + if (!cryptoObj) { + return null; + } + + var random = cryptoObj.getRandomValues(bytes); + + for (var a = 0; a < random.length; a++) { + result.push(charset[random[a] % charset.length]); + } + + return result.join(''); + } + + module.exports = { + randomString: randomString + }; + + +/***/ }, +/* 49 */ +/***/ function(module, exports, __webpack_require__) { + + var StorageHandler = __webpack_require__(52); + var storage; + + function getStorage(force) { + if (!storage || force) { + storage = new StorageHandler(); + } + return storage; + } + + module.exports = { + getItem: function(key) { + var value = getStorage().getItem(key); + return value ? JSON.parse(value) : value; + }, + removeItem: function(key) { + return getStorage().removeItem(key); + }, + setItem: function(key, value) { + var json = JSON.stringify(value); + return getStorage().setItem(key, json); + }, + reload: function() { + getStorage(true); + } + }; + + +/***/ }, +/* 50 */ +/***/ function(module, exports, __webpack_require__) { + + var cookies = __webpack_require__(42); + + function CookieStorage() {} + + CookieStorage.prototype.getItem = function(key) { + return cookies.read(key); + }; + + CookieStorage.prototype.removeItem = function(key) { + cookies.erase(key); + }; + + CookieStorage.prototype.setItem = function(key, value) { + cookies.create(key, value, 1); + }; + + module.exports = CookieStorage; + + +/***/ }, +/* 51 */ +/***/ function(module, exports) { + + function DummyStorage() {} + + DummyStorage.prototype.getItem = function() { + return null; + }; + + DummyStorage.prototype.removeItem = function() {}; + + DummyStorage.prototype.setItem = function() {}; + + module.exports = DummyStorage; + + +/***/ }, +/* 52 */ +/***/ function(module, exports, __webpack_require__) { + + var windowHandler = __webpack_require__(3); + var DummyStorage = __webpack_require__(51); + var CookieStorage = __webpack_require__(50); + var Warn = __webpack_require__(11); + + function StorageHandler() { + this.warn = new Warn({}); + this.storage = windowHandler.getWindow().localStorage || new CookieStorage(); + } + + StorageHandler.prototype.failover = function() { + if (this.storage instanceof DummyStorage) { + this.warn.warning('DummyStorage: ignore failover'); + return; + } else if (this.storage instanceof CookieStorage) { + this.warn.warning('CookieStorage: failing over DummyStorage'); + this.storage = new DummyStorage(); + } else { + this.warn.warning('LocalStorage: failing over CookieStorage'); + this.storage = new CookieStorage(); + } + }; + + StorageHandler.prototype.getItem = function(key) { + try { + return this.storage.getItem(key); + } catch (e) { + this.warn.warning(e); + this.failover(); + return this.getItem(key); + } + }; + + StorageHandler.prototype.removeItem = function(key) { + try { + return this.storage.removeItem(key); + } catch (e) { + this.warn.warning(e); + this.failover(); + return this.removeItem(key); + } + }; + + StorageHandler.prototype.setItem = function(key, value) { + try { + return this.storage.setItem(key, value); + } catch (e) { + this.warn.warning(e); + this.failover(); + return this.setItem(key, value); + } + }; + + module.exports = StorageHandler; + + +/***/ }, +/* 53 */ +/***/ function(module, exports) { + + // given a URL, extract the origin. Taken from: https://github.com/firebase/firebase-simple-login/blob/d2cb95b9f812d8488bdbfba51c3a7c153ba1a074/js/src/simple-login/transports/WinChan.js#L25-L30 + function extractOrigin(url) { + if (!/^https?:\/\//.test(url)) url = window.location.href; + var m = /^(https?:\/\/[-_a-zA-Z.0-9:]+)/.exec(url); + if (m) return m[1]; + return url; + } + + module.exports = { + extractOrigin: extractOrigin + }; + + +/***/ }, +/* 54 */ +/***/ function(module, exports, __webpack_require__) { + + var Authentication = __webpack_require__(19); + var Management = __webpack_require__(55); + var WebAuth = __webpack_require__(57); + var version = __webpack_require__(9); + + module.exports = { + Authentication: Authentication, + Management: Management, + WebAuth: WebAuth, + version: version.raw + }; + + +/***/ }, +/* 55 */ +/***/ function(module, exports, __webpack_require__) { + + var urljoin = __webpack_require__(1); + + var RequestBuilder = __webpack_require__(10); + var assert = __webpack_require__(4); + var responseHandler = __webpack_require__(6); + + /** + * Auth0 Management API Client (methods allowed to be called from the browser only) + * @constructor + * @param {Object} options + * @param {Object} options.domain your Auth0 acount domain + * @param {Object} options.token a valid API token + */ + function Management(options) { + /* eslint-disable */ + assert.check( + options, + { type: 'object', message: 'options parameter is not valid' }, + { + domain: { type: 'string', message: 'domain option is required' }, + token: { type: 'string', message: 'token option is required' }, + _sendTelemetry: { + optional: true, + type: 'boolean', + message: '_sendTelemetry option is not valid' + }, + _telemetryInfo: { + optional: true, + type: 'object', + message: '_telemetryInfo option is not valid' + } + } + ); + /* eslint-enable */ + + this.baseOptions = options; + + this.baseOptions.headers = { Authorization: 'Bearer ' + this.baseOptions.token }; + + this.request = new RequestBuilder(this.baseOptions); + this.baseOptions.rootUrl = urljoin('https://' + this.baseOptions.domain, 'api', 'v2'); + } + + /** + * @callback userCallback + * @param {Error} [err] failure reason for the failed request to Management API + * @param {Object} [result] user profile + */ + + /** + * Returns the user profile + * + * @method getUser + * @param {String} userId identifier of the user to retrieve + * @param {userCallback} cb + * @see https://auth0.com/docs/api/management/v2#!/Users/get_users_by_id + */ + Management.prototype.getUser = function(userId, cb) { + var url; + + assert.check(userId, { type: 'string', message: 'userId parameter is not valid' }); + assert.check(cb, { type: 'function', message: 'cb parameter is not valid' }); + + url = urljoin(this.baseOptions.rootUrl, 'users', userId); + + return this.request.get(url).end(responseHandler(cb, { ignoreCasing: true })); + }; + + /** + * Updates the user metdata. It will patch the user metdata with the attributes sent. + * + * + * @method patchUserMetadata + * @param {String} userId + * @param {Object} userMetadata + * @param {userCallback} cb + * @see {@link https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id} + */ + Management.prototype.patchUserMetadata = function(userId, userMetadata, cb) { + var url; + + assert.check(userId, { type: 'string', message: 'userId parameter is not valid' }); + assert.check(userMetadata, { type: 'object', message: 'userMetadata parameter is not valid' }); + assert.check(cb, { type: 'function', message: 'cb parameter is not valid' }); + + url = urljoin(this.baseOptions.rootUrl, 'users', userId); + + return this.request + .patch(url) + .send({ user_metadata: userMetadata }) + .end(responseHandler(cb, { ignoreCasing: true })); + }; + + /** + * Link two users + * + * @method linkUser + * @param {String} userId + * @param {String} secondaryUserToken + * @param {userCallback} cb + * @see {@link https://auth0.com/docs/api/management/v2#!/Users/post_identities} + */ + Management.prototype.linkUser = function(userId, secondaryUserToken, cb) { + var url; + /* eslint-disable */ + assert.check(userId, { type: 'string', message: 'userId parameter is not valid' }); + assert.check(secondaryUserToken, { + type: 'string', + message: 'secondaryUserToken parameter is not valid' + }); + assert.check(cb, { type: 'function', message: 'cb parameter is not valid' }); + /* eslint-enable */ + + url = urljoin(this.baseOptions.rootUrl, 'users', userId, 'identities'); + + return this.request + .post(url) + .send({ link_with: secondaryUserToken }) + .end(responseHandler(cb, { ignoreCasing: true })); + }; + + module.exports = Management; + + +/***/ }, +/* 56 */ +/***/ function(module, exports, __webpack_require__) { + + var urljoin = __webpack_require__(1); + + var windowHelper = __webpack_require__(3); + var objectHelper = __webpack_require__(2); + var RequestBuilder = __webpack_require__(10); + + function CrossOriginAuthentication(webAuth, options) { + this.webAuth = webAuth; + this.baseOptions = options; + this.request = new RequestBuilder(options); + } + + function getFragment(name) { + var theWindow = windowHelper.getWindow(); + var value = '&' + theWindow.location.hash.substring(1); + var parts = value.split('&' + name + '='); + if (parts.length === 2) { + return parts.pop().split('&').shift(); + } + } + + function createKey(origin, coId) { + return ['co/verifier', encodeURIComponent(origin), encodeURIComponent(coId)].join('/'); + } + + /** + * Logs in the user with username and password using the cross origin authentication (/co/authenticate) flow. You can use either `username` or `email` to identify the user, but `username` will take precedence over `email`. + * This only works when 3rd party cookies are enabled in the browser. After the /co/authenticate call, you'll have to use the {@link parseHash} function at the `redirectUri` specified in the constructor. + * + * @method login + * @param {Object} options options used in the {@link authorize} call after the login_ticket is acquired + * @param {String} [options.username] Username (mutually exclusive with email) + * @param {String} [options.email] Email (mutually exclusive with username) + * @param {String} options.password Password + * @param {String} [options.realm] Realm used to authenticate the user, it can be a realm name or a database connection name + * @param {crossOriginLoginCallback} cb Callback function called only when an authentication error, like invalid username or password, occurs. For other types of errors, there will be a redirect to the `redirectUri`. + */ + CrossOriginAuthentication.prototype.login = function(options, cb) { + var _this = this; + var theWindow = windowHelper.getWindow(); + var url = urljoin(this.baseOptions.rootUrl, '/co/authenticate'); + var authenticateBody = { + client_id: options.clientID || this.baseOptions.clientID, + username: options.username || options.email + }; + if (options.password) { + authenticateBody.password = options.password; + } + if (options.otp) { + authenticateBody.otp = options.otp; + } + var realm = options.realm || this.baseOptions.realm; + + if (realm) { + var credentialType = + options.credentialType || + this.baseOptions.credentialType || + 'http://auth0.com/oauth/grant-type/password-realm'; + authenticateBody.realm = realm; + authenticateBody.credential_type = credentialType; + } else { + authenticateBody.credential_type = 'password'; + } + this.request.post(url).withCredentials().send(authenticateBody).end(function(err, data) { + if (err) { + var errorObject = (err.response && err.response.body) || { + error: 'request_error', + error_description: JSON.stringify(err) + }; + return cb(errorObject); + } + options = objectHelper.blacklist(options, ['username', 'password', 'credentialType', 'otp']); + var authorizeOptions = objectHelper + .merge(options) + .with({ loginTicket: data.body.login_ticket }); + var key = createKey(_this.baseOptions.rootUrl, data.body.co_id); + theWindow.sessionStorage[key] = data.body.co_verifier; + _this.webAuth.authorize(authorizeOptions); + }); + }; + + function tryGetVerifier(theWindow, key) { + try { + var verifier = theWindow.sessionStorage[key]; + theWindow.sessionStorage.removeItem(key); + return verifier; + } catch (e) { + return ''; + } + } + + /** + * Runs the callback code for the cross origin authentication call. This method is meant to be called by the cross origin authentication callback url. + * + * @method callback + */ + CrossOriginAuthentication.prototype.callback = function() { + var targetOrigin = decodeURIComponent(getFragment('origin')); + var theWindow = windowHelper.getWindow(); + + theWindow.addEventListener('message', function(evt) { + if (evt.data.type !== 'co_verifier_request') { + return; + } + var key = createKey(evt.origin, evt.data.request.id); + var verifier = tryGetVerifier(theWindow, key); + + evt.source.postMessage( + { + type: 'co_verifier_response', + response: { + verifier: verifier + } + }, + evt.origin + ); + }); + + theWindow.parent.postMessage({ type: 'ready' }, targetOrigin); + }; + + module.exports = CrossOriginAuthentication; + + +/***/ }, +/* 57 */ +/***/ function(module, exports, __webpack_require__) { + + var IdTokenVerifier = __webpack_require__(30); + + var assert = __webpack_require__(4); + var error = __webpack_require__(21); + var qs = __webpack_require__(5); + var PluginHandler = __webpack_require__(46); + var windowHelper = __webpack_require__(3); + var objectHelper = __webpack_require__(2); + var TransactionManager = __webpack_require__(22); + var Authentication = __webpack_require__(19); + var Redirect = __webpack_require__(59); + var Popup = __webpack_require__(58); + var SilentAuthenticationHandler = __webpack_require__(60); + var CrossOriginAuthentication = __webpack_require__(56); + /** + * Handles all the browser's AuthN/AuthZ flows + * @constructor + * @param {Object} options + * @param {String} options.domain your Auth0 domain + * @param {String} options.clientID your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard + * @param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorization Response + * @param {String} [options.responseType] type of the response used by OAuth 2.0 flow. It can be any space separated list of the values `code`, `token`, `id_token`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0} + * @param {String} [options.responseMode] how the Auth response is encoded and redirected back to the client. Supported values are `query`, `fragment` and `form_post`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes} + * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email` + * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth + * @param {Array} [options.plugins] + * @param {Number} [options._timesToRetryFailedRequests] Number of times to retry a failed request, according to {@link https://github.com/visionmedia/superagent/blob/master/lib/should-retry.js} + * @see {@link https://auth0.com/docs/api/authentication} + */ + function WebAuth(options) { + /* eslint-disable */ + assert.check( + options, + { type: 'object', message: 'options parameter is not valid' }, + { + domain: { type: 'string', message: 'domain option is required' }, + clientID: { type: 'string', message: 'clientID option is required' }, + responseType: { optional: true, type: 'string', message: 'responseType is not valid' }, + responseMode: { optional: true, type: 'string', message: 'responseMode is not valid' }, + redirectUri: { optional: true, type: 'string', message: 'redirectUri is not valid' }, + scope: { optional: true, type: 'string', message: 'scope is not valid' }, + audience: { optional: true, type: 'string', message: 'audience is not valid' }, + leeway: { optional: true, type: 'number', message: 'leeway is not valid' }, + plugins: { optional: true, type: 'array', message: 'plugins is not valid' }, + _disableDeprecationWarnings: { + optional: true, + type: 'boolean', + message: '_disableDeprecationWarnings option is not valid' + }, + _sendTelemetry: { + optional: true, + type: 'boolean', + message: '_sendTelemetry option is not valid' + }, + _telemetryInfo: { + optional: true, + type: 'object', + message: '_telemetryInfo option is not valid' + }, + _timesToRetryFailedRequests: { + optional: true, + type: 'number', + message: '_timesToRetryFailedRequests option is not valid' + } + } + ); + + if (options.overrides) { + assert.check( + options.overrides, + { type: 'object', message: 'overrides option is not valid' }, + { + __tenant: { type: 'string', message: '__tenant option is required' }, + __token_issuer: { type: 'string', message: '__token_issuer option is required' } + } + ); + } + /* eslint-enable */ + + this.baseOptions = options; + this.baseOptions.plugins = new PluginHandler(this, this.baseOptions.plugins || []); + + this.baseOptions._sendTelemetry = this.baseOptions._sendTelemetry === false + ? this.baseOptions._sendTelemetry + : true; + + this.baseOptions._timesToRetryFailedRequests = options._timesToRetryFailedRequests + ? parseInt(options._timesToRetryFailedRequests, 0) + : 0; + + this.baseOptions.tenant = + (this.baseOptions.overrides && this.baseOptions.overrides.__tenant) || + this.baseOptions.domain.split('.')[0]; + + this.baseOptions.token_issuer = + (this.baseOptions.overrides && this.baseOptions.overrides.__token_issuer) || + 'https://' + this.baseOptions.domain + '/'; + + this.transactionManager = new TransactionManager(this.baseOptions.transaction); + + this.client = new Authentication(this.baseOptions); + this.redirect = new Redirect(this.client, this.baseOptions); + this.popup = new Popup(this, this.baseOptions); + this.crossOriginAuthentication = new CrossOriginAuthentication(this, this.baseOptions); + } + + /** + * Parse the url hash and extract the Auth response from a Auth flow started with {@link authorize} + * + * Only validates id_tokens signed by Auth0 using the RS256 algorithm using the public key exposed + * by the `/.well-known/jwks.json` endpoint of your account. + * Tokens signed with other algorithms, e.g. HS256 will not be accepted. + * + * @method parseHash + * @param {Object} options + * @param {String} options.hash the url hash. If not provided it will extract from window.location.hash + * @param {String} [options.state] value originally sent in `state` parameter to {@link authorize} to mitigate XSRF + * @param {String} [options.nonce] value originally sent in `nonce` parameter to {@link authorize} to prevent replay attacks + * @param {String} [options._idTokenVerification] makes parseHash perform or skip `id_token` verification. We **strongly** recommend validating the `id_token` yourself if you disable the verification. + * @param {authorizeCallback} cb + */ + WebAuth.prototype.parseHash = function(options, cb) { + var parsedQs; + var err; + var state; + var transaction; + var transactionNonce; + + if (!cb && typeof options === 'function') { + cb = options; + options = {}; + } else { + options = options || {}; + } + + options._idTokenVerification = !(options._idTokenVerification === false); + + var _window = windowHelper.getWindow(); + + var hashStr = options.hash === undefined ? _window.location.hash : options.hash; + hashStr = hashStr.replace(/^#?\/?/, ''); + + parsedQs = qs.parse(hashStr); + + if (parsedQs.hasOwnProperty('error')) { + err = error.buildResponse(parsedQs.error, parsedQs.error_description); + + if (parsedQs.state) { + err.state = parsedQs.state; + } + + return cb(err); + } + + if ( + !parsedQs.hasOwnProperty('access_token') && + !parsedQs.hasOwnProperty('id_token') && + !parsedQs.hasOwnProperty('refresh_token') + ) { + return cb(null, null); + } + + state = parsedQs.state || options.state; + + transaction = this.transactionManager.getStoredTransaction(state); + transactionNonce = options.nonce || (transaction && transaction.nonce) || null; + + var applicationStatus = (transaction && transaction.appStatus) || null; + if (parsedQs.id_token && options._idTokenVerification) { + return this.validateToken(parsedQs.id_token, transactionNonce, function( + validationError, + payload + ) { + if (validationError) { + return cb(validationError); + } + return cb(null, buildParseHashResponse(parsedQs, applicationStatus, payload)); + }); + } + + if (parsedQs.id_token) { + var verifier = new IdTokenVerifier({ + issuer: this.baseOptions.token_issuer, + audience: this.baseOptions.clientID, + leeway: this.baseOptions.leeway || 0, + __disableExpirationCheck: this.baseOptions.__disableExpirationCheck + }); + + var decodedToken = verifier.decode(parsedQs.id_token); + cb(null, buildParseHashResponse(parsedQs, applicationStatus, decodedToken.payload)); + } else { + cb(null, buildParseHashResponse(parsedQs, applicationStatus, null)); + } + }; + + function buildParseHashResponse(qsParams, appStatus, token) { + return { + accessToken: qsParams.access_token || null, + idToken: qsParams.id_token || null, + idTokenPayload: token || null, + appStatus: appStatus || null, + refreshToken: qsParams.refresh_token || null, + state: qsParams.state || null, + expiresIn: qsParams.expires_in ? parseInt(qsParams.expires_in, 10) : null, + tokenType: qsParams.token_type || null, + scope: qsParams.scope || null + }; + } + + /** + * @callback validateTokenCallback + * @param {Error} [err] error returned by while validating the token + * @param {Object} [payload] claims stored in the token + */ + + /** + * Decodes the a JWT and verifies its nonce value + * + * @method validateToken + * @private + * @param {String} token + * @param {String} nonce + * @param {validateTokenCallback} cb + */ + WebAuth.prototype.validateToken = function(token, nonce, cb) { + var verifier = new IdTokenVerifier({ + issuer: this.baseOptions.token_issuer, + audience: this.baseOptions.clientID, + leeway: this.baseOptions.leeway || 0, + __disableExpirationCheck: this.baseOptions.__disableExpirationCheck + }); + + verifier.verify(token, nonce, function(err, payload) { + if (err) { + return cb(error.invalidJwt(err.message)); + } + + cb(null, payload); + }); + }; + + /** + * Executes a silent authentication transaction under the hood in order to fetch a new tokens for the current session. + * This method requires that all Auth is performed with {@link authorize} + * Watch out! If you're not using the hosted login page to do social logins, you have to use your own [social connection keys](https://manage.auth0.com/#/connections/social). If you use Auth0's dev keys, you'll always get `login_required` as an error when calling this method. + * + * @method renewAuth + * @param {Object} options + * @param {String} [options.domain] your Auth0 domain + * @param {String} [options.clientID] your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard + * @param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorization Response + * @param {String} [options.responseType] type of the response used by OAuth 2.0 flow. It can be any space separated list of the values `code`, `token`, `id_token`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0} + * @param {String} [options.responseMode] how the Auth response is encoded and redirected back to the client. Supported values are `query`, `fragment` and `form_post`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes} + * @param {String} [options.state] value used to mitigate XSRF attacks. {@link https://auth0.com/docs/protocols/oauth2/oauth-state} + * @param {String} [options.nonce] value used to mitigate replay attacks when using Implicit Grant. {@link https://auth0.com/docs/api-auth/tutorials/nonce} + * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email` + * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth + * @param {String} [options.postMessageDataType] identifier data type to look for in postMessage event data, where events are initiated from silent callback urls, before accepting a message event is the event expected. A value of false means any postMessage event will trigger a callback. + * @see {@link https://auth0.com/docs/api/authentication#authorize-client} + */ + WebAuth.prototype.renewAuth = function(options, cb) { + var handler; + var usePostMessage = !!options.usePostMessage; + var postMessageDataType = options.postMessageDataType || false; + var _this = this; + + var params = objectHelper + .merge(this.baseOptions, [ + 'clientID', + 'redirectUri', + 'responseType', + 'scope', + 'audience', + '_csrf', + 'state', + '_intstate', + 'nonce' + ]) + .with(options); + + params.responseType = params.responseType || 'token'; + params.responseMode = params.responseMode || 'fragment'; + if (!options.nonce) { + params = this.transactionManager.process(params); + } + + assert.check(params, { type: 'object', message: 'options parameter is not valid' }); + assert.check(cb, { type: 'function', message: 'cb parameter is not valid' }); + + params.prompt = 'none'; + + params = objectHelper.blacklist(params, ['usePostMessage', 'tenant', 'postMessageDataType']); + + handler = SilentAuthenticationHandler.create({ + authenticationUrl: this.client.buildAuthorizeUrl(params), + postMessageDataType: postMessageDataType + }); + + handler.login(usePostMessage, function(err, hash) { + if (typeof hash === 'object') { + // hash was already parsed, so we just return it. + // it's here to be backwards compatible and should be removed in the next major version. + return cb(err, hash); + } + var transaction = _this.transactionManager.getStoredTransaction(params.state); + var transactionNonce = options.nonce || (transaction && transaction.nonce) || null; + var transactionState = options.state || (transaction && transaction.state) || null; + _this.parseHash({ hash: hash, nonce: transactionNonce, state: transactionState }, cb); + }); + }; + + /** + * Request an email with instruction to change a user's password + * + * @method changePassword + * @param {Object} options + * @param {String} options.email address where the user will recieve the change password email. It should match the user's email in Auth0 + * @param {String} options.connection name of the connection where the user was created + * @param {changePasswordCallback} cb + * @see {@link https://auth0.com/docs/api/authentication#change-password} + */ + WebAuth.prototype.changePassword = function(options, cb) { + return this.client.dbConnection.changePassword(options, cb); + }; + + /** + * Starts a passwordless authentication transaction. + * + * @method passwordlessStart + * @param {Object} options + * @param {String} options.send what will be sent via email which could be `link` or `code`. For SMS `code` is the only one valud + * @param {String} [options.phoneNumber] phone number where to send the `code`. This parameter is mutually exclusive with `email` + * @param {String} [options.email] email where to send the `code` or `link`. This parameter is mutually exclusive with `phoneNumber` + * @param {String} options.connection name of the passwordless connection + * @param {Object} [options.authParams] additional Auth parameters when using `link` + * @param {Function} cb + * @see {@link https://auth0.com/docs/api/authentication#passwordless} + */ + WebAuth.prototype.passwordlessStart = function(options, cb) { + return this.client.passwordless.start(options, cb); + }; + + /** + * Creates a new user in a Auth0 Database connection + * + * @method signup + * @param {Object} options + * @param {String} options.email user email address + * @param {String} options.password user password + * @param {String} options.connection name of the connection where the user will be created + * @param {signUpCallback} cb + * @see {@link https://auth0.com/docs/api/authentication#signup} + */ + WebAuth.prototype.signup = function(options, cb) { + return this.client.dbConnection.signup(options, cb); + }; + + /** + * Redirects to the hosted login page (`/authorize`) in order to start a new authN/authZ transaction. + * After that, you'll have to use the {@link parseHash} function at the specified `redirectUri`. + * + * @method authorize + * @param {Object} options + * @param {String} [options.domain] your Auth0 domain + * @param {String} [options.clientID] your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard + * @param {String} options.redirectUri url that the Auth0 will redirect after Auth with the Authorization Response + * @param {String} options.responseType type of the response used by OAuth 2.0 flow. It can be any space separated list of the values `code`, `token`, `id_token`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0} + * @param {String} [options.responseMode] how the Auth response is encoded and redirected back to the client. Supported values are `query`, `fragment` and `form_post`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes} + * @param {String} [options.state] value used to mitigate XSRF attacks. {@link https://auth0.com/docs/protocols/oauth2/oauth-state} + * @param {String} [options.nonce] value used to mitigate replay attacks when using Implicit Grant. {@link https://auth0.com/docs/api-auth/tutorials/nonce} + * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email` + * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth + * @see {@link https://auth0.com/docs/api/authentication#authorize-client} + */ + WebAuth.prototype.authorize = function(options) { + var params = objectHelper + .merge(this.baseOptions, [ + 'clientID', + 'responseType', + 'responseMode', + 'redirectUri', + 'scope', + 'audience', + '_csrf', + 'state', + '_intstate', + 'nonce' + ]) + .with(options); + + assert.check( + params, + { type: 'object', message: 'options parameter is not valid' }, + { + responseType: { type: 'string', message: 'responseType option is required' } + } + ); + + params = this.transactionManager.process(params); + + windowHelper.redirect(this.client.buildAuthorizeUrl(params)); + }; + + /** + * Signs up a new user, automatically logs the user in after the signup and returns the user token. + * The login will be done using /oauth/token with password-realm grant type. + * + * @method signupAndAuthorize + * @param {Object} options + * @param {String} options.email user email address + * @param {String} options.password user password + * @param {String} options.connection name of the connection where the user will be created + * @param {tokenCallback} cb + * @see {@link https://auth0.com/docs/api/authentication#signup} + * @see {@link https://auth0.com/docs/api-auth/grant/password} + */ + WebAuth.prototype.signupAndAuthorize = function(options, cb) { + var _this = this; + + return this.client.dbConnection.signup( + objectHelper.blacklist(options, ['popupHandler']), + function(err) { + if (err) { + return cb(err); + } + options.realm = options.connection; + if (!options.username) { + options.username = options.email; + } + _this.client.login(options, cb); + } + ); + }; + + /** + * @callback crossOriginLoginCallback + * @param {Error} [err] Authentication error returned by Auth0 with the reason why the request failed + */ + + /** + * Logs in the user with username and password using the cross origin authentication (/co/authenticate) flow. You can use either `username` or `email` to identify the user, but `username` will take precedence over `email`. + * This only works when 3rd party cookies are enabled in the browser. After the /co/authenticate call, you'll have to use the {@link parseHash} function at the `redirectUri` specified in the constructor. + * + * @method login + * @param {Object} options options used in the {@link authorize} call after the login_ticket is acquired + * @param {String} [options.username] Username (mutually exclusive with email) + * @param {String} [options.email] Email (mutually exclusive with username) + * @param {String} options.password Password + * @param {String} [options.realm] Realm used to authenticate the user, it can be a realm name or a database connection name + * @param {crossOriginLoginCallback} cb Callback function called only when an authentication error, like invalid username or password, occurs. For other types of errors, there will be a redirect to the `redirectUri`. + */ + WebAuth.prototype.login = function(options, cb) { + this.crossOriginAuthentication.login(options, cb); + }; + + /** + * Logs in the user by verifying the verification code (OTP) using the cross origin authentication (/co/authenticate) flow. You can use either `phoneNumber` or `email` to identify the user. + * This only works when 3rd party cookies are enabled in the browser. After the /co/authenticate call, you'll have to use the {@link parseHash} function at the `redirectUri` specified in the constructor. + * + * @method login + * @param {Object} options options used in the {@link authorize} call after the login_ticket is acquired + * @param {String} [options.phoneNumber] Phone Number (mutually exclusive with email) + * @param {String} [options.email] Email (mutually exclusive with username) + * @param {String} options.verificationCode Verification Code (OTP) + * @param {String} options.connection Passwordless connection to use. It can either be 'sms' or 'email'. + * @param {crossOriginLoginCallback} cb Callback function called only when an authentication error, like invalid username or password, occurs. For other types of errors, there will be a redirect to the `redirectUri`. + */ + WebAuth.prototype.passwordlessLogin = function(options, cb) { + var loginOptions = objectHelper.extend( + { + credentialType: 'http://auth0.com/oauth/grant-type/passwordless/otp', + realm: options.connection, + username: options.email || options.phoneNumber, + otp: options.verificationCode + }, + objectHelper.blacklist(options, ['connection', 'email', 'phoneNumber', 'verificationCode']) + ); + this.crossOriginAuthentication.login(loginOptions, cb); + }; + + /** + * Runs the callback code for the cross origin authentication call. This method is meant to be called by the cross origin authentication callback url. + * + * @method crossOriginAuthenticationCallback + */ + WebAuth.prototype.crossOriginAuthenticationCallback = function() { + this.crossOriginAuthentication.callback(); + }; + + /** + * Redirects to the auth0 logout endpoint + * + * If you want to navigate the user to a specific URL after the logout, set that URL at the returnTo parameter. The URL should be included in any the appropriate Allowed Logout URLs list: + * + * - If the client_id parameter is included, the returnTo URL must be listed in the Allowed Logout URLs set at the client level (see Setting Allowed Logout URLs at the App Level). + * - If the client_id parameter is NOT included, the returnTo URL must be listed in the Allowed Logout URLs set at the account level (see Setting Allowed Logout URLs at the Account Level). + * + * @method logout + * @param {Object} options + * @param {String} [options.clientID] identifier of your client + * @param {String} [options.returnTo] URL to be redirected after the logout + * @param {Boolean} [options.federated] tells Auth0 if it should logout the user also from the IdP. + * @see {@link https://auth0.com/docs/api/authentication#logout} + */ + WebAuth.prototype.logout = function(options) { + windowHelper.redirect(this.client.buildLogoutUrl(options)); + }; + + /** + * Verifies the passwordless TOTP and redirects to finish the passwordless transaction + * + * @method passwordlessVerify + * @param {Object} options + * @param {String} options.type `sms` or `email` + * @param {String} options.phoneNumber only if type = sms + * @param {String} options.email only if type = email + * @param {String} options.connection the connection name + * @param {String} options.verificationCode the TOTP code + * @param {Function} cb + */ + WebAuth.prototype.passwordlessVerify = function(options, cb) { + var _this = this; + var params = objectHelper + .merge(this.baseOptions, [ + 'clientID', + 'responseType', + 'responseMode', + 'redirectUri', + 'scope', + 'audience', + '_csrf', + 'state', + '_intstate', + 'nonce' + ]) + .with(options); + + assert.check( + params, + { type: 'object', message: 'options parameter is not valid' }, + { + responseType: { type: 'string', message: 'responseType option is required' } + } + ); + + params = this.transactionManager.process(params); + return this.client.passwordless.verify(params, function(err) { + if (err) { + return cb(err); + } + return windowHelper.redirect(_this.client.passwordless.buildVerifyUrl(params)); + }); + }; + + module.exports = WebAuth; + + +/***/ }, +/* 58 */ +/***/ function(module, exports, __webpack_require__) { + + var urljoin = __webpack_require__(1); + var WinChan = __webpack_require__(18); + + var urlHelper = __webpack_require__(53); + var assert = __webpack_require__(4); + var responseHandler = __webpack_require__(6); + var PopupHandler = __webpack_require__(47); + var objectHelper = __webpack_require__(2); + var Warn = __webpack_require__(11); + var TransactionManager = __webpack_require__(22); + + function Popup(webAuth, options) { + this.baseOptions = options; + this.client = webAuth.client; + this.webAuth = webAuth; + + this.transactionManager = new TransactionManager(this.baseOptions.transaction); + this.warn = new Warn({ + disableWarnings: !!options._disableDeprecationWarnings + }); + } + + /** + * Returns a new instance of the popup handler + * + * @method buildPopupHandler + * @private + */ + Popup.prototype.buildPopupHandler = function() { + var pluginHandler = this.baseOptions.plugins.get('popup.getPopupHandler'); + + if (pluginHandler) { + return pluginHandler.getPopupHandler(); + } + + return new PopupHandler(); + }; + + /** + * Initializes the popup window and returns the instance to be used later in order to avoid being blocked by the browser. + * + * @method preload + * @param {Object} options receives the window height and width and any other window feature to be sent to window.open + */ + Popup.prototype.preload = function(options) { + options = options || {}; + + var popup = this.buildPopupHandler(); + + popup.preload(options); + return popup; + }; + + /** + * Internal use. + * + * @method getPopupHandler + * @private + */ + Popup.prototype.getPopupHandler = function(options, preload) { + if (options.popupHandler) { + return options.popupHandler; + } + + if (preload) { + return this.preload(options); + } + + return this.buildPopupHandler(); + }; + + /** + * Handles the popup logic for the callback page. + * + * @method callback + * @param {Object} options + * @param {String} options.hash the url hash. If not provided it will extract from window.location.hash + * @param {String} [options.state] value originally sent in `state` parameter to {@link authorize} to mitigate XSRF + * @param {String} [options.nonce] value originally sent in `nonce` parameter to {@link authorize} to prevent replay attacks + * @param {String} [options._idTokenVerification] makes parseHash perform or skip `id_token` verification. We **strongly** recommend validating the `id_token` yourself if you disable the verification. + * @see {@link parseHash} + */ + Popup.prototype.callback = function(options) { + var _this = this; + WinChan.onOpen(function(popupOrigin, r, cb) { + _this.webAuth.parseHash(options || {}, function(err, data) { + return cb(err || data); + }); + }); + }; + + /** + * Shows inside a new window the hosted login page (`/authorize`) in order to start a new authN/authZ transaction and post its result using `postMessage`. + * + * @method authorize + * @param {Object} options + * @param {String} [options.domain] your Auth0 domain + * @param {String} [options.clientID] your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard + * @param {String} options.redirectUri url that the Auth0 will redirect after Auth with the Authorization Response + * @param {String} options.responseType type of the response used by OAuth 2.0 flow. It can be any space separated list of the values `code`, `token`, `id_token`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0} + * @param {String} [options.responseMode] how the Auth response is encoded and redirected back to the client. Supported values are `query`, `fragment` and `form_post`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes} + * @param {String} [options.state] value used to mitigate XSRF attacks. {@link https://auth0.com/docs/protocols/oauth2/oauth-state} + * @param {String} [options.nonce] value used to mitigate replay attacks when using Implicit Grant. {@link https://auth0.com/docs/api-auth/tutorials/nonce} + * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email` + * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth + * @param {Boolean} [options.owp] determines if Auth0 should render the relay page or not and the caller is responsible of handling the response. + * @param {authorizeCallback} cb + * @see {@link https://auth0.com/docs/api/authentication#authorize-client} + */ + Popup.prototype.authorize = function(options, cb) { + var popup; + var url; + var relayUrl; + var popOpts = {}; + + var pluginHandler = this.baseOptions.plugins.get('popup.authorize'); + + var params = objectHelper + .merge(this.baseOptions, [ + 'clientID', + 'scope', + 'domain', + 'audience', + 'responseType', + 'redirectUri', + '_csrf', + 'state', + '_intstate', + 'nonce' + ]) + .with(objectHelper.blacklist(options, ['popupHandler'])); + + assert.check( + params, + { type: 'object', message: 'options parameter is not valid' }, + { + responseType: { type: 'string', message: 'responseType option is required' } + } + ); + + // the relay page should not be necesary as long it happens in the same domain + // (a redirectUri shoul be provided). It is necesary when using OWP + relayUrl = urljoin(this.baseOptions.rootUrl, 'relay.html'); + + // if a owp is enabled, it should use the owp flag + if (options.owp) { + // used by server to render the relay page instead of sending the chunk in the + // url to the callback + params.owp = true; + } else { + popOpts.origin = urlHelper.extractOrigin(params.redirectUri); + relayUrl = params.redirectUri; + } + + if (options.popupOptions) { + popOpts.popupOptions = objectHelper.pick(options.popupOptions, ['width', 'height']); + } + + if (pluginHandler) { + params = pluginHandler.processParams(params); + } + + params = this.transactionManager.process(params); + + delete params.domain; + + url = this.client.buildAuthorizeUrl(params); + + popup = this.getPopupHandler(options); + + return popup.load(url, relayUrl, popOpts, responseHandler(cb)); + }; + + /** + * Performs authentication with username/email and password with a database connection inside a new window + * + * This method is not compatible with API Auth so if you need to fetch API tokens with audience + * you should use {@link authorize} or {@link login}. + * + * @method loginWithCredentials + * @param {Object} options + * @param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorization Response + * @param {String} [options.responseType] type of the response used. It can be any of the values `code` and `token` + * @param {String} [options.responseMode] how the AuthN response is encoded and redirected back to the client. Supported values are `query` and `fragment` + * @param {String} [options.scope] scopes to be requested during AuthN. e.g. `openid email` + * @param {credentialsCallback} cb + */ + Popup.prototype.loginWithCredentials = function(options, cb) { + var params; + var popup; + var url; + var relayUrl; + + /* eslint-disable */ + assert.check( + options, + { type: 'object', message: 'options parameter is not valid' }, + { + clientID: { optional: true, type: 'string', message: 'clientID option is required' }, + redirectUri: { optional: true, type: 'string', message: 'redirectUri option is required' }, + responseType: { optional: true, type: 'string', message: 'responseType option is required' }, + scope: { optional: true, type: 'string', message: 'scope option is required' }, + audience: { optional: true, type: 'string', message: 'audience option is required' } + } + ); + /* eslint-enable */ + + popup = this.getPopupHandler(options); + + options = objectHelper + .merge(this.baseOptions, [ + 'clientID', + 'scope', + 'domain', + 'audience', + '_csrf', + 'state', + '_intstate', + 'nonce' + ]) + .with(objectHelper.blacklist(options, ['popupHandler'])); + + params = objectHelper.pick(options, ['clientID', 'domain']); + params.options = objectHelper.toSnakeCase( + objectHelper.pick(options, ['password', 'connection', 'state', 'scope', '_csrf', 'device']) + ); + params.options.username = options.username || options.email; + + url = urljoin(this.baseOptions.rootUrl, 'sso_dbconnection_popup', options.clientID); + relayUrl = urljoin(this.baseOptions.rootUrl, 'relay.html'); + + return popup.load(url, relayUrl, { params: params }, responseHandler(cb)); + }; + + /** + * Verifies the passwordless TOTP and redirects to finish the passwordless transaction + * + * @method passwordlessVerify + * @param {Object} options + * @param {String} options.type `sms` or `email` + * @param {String} options.phoneNumber only if type = sms + * @param {String} options.email only if type = email + * @param {String} options.connection the connection name + * @param {String} options.verificationCode the TOTP code + * @param {Function} cb + */ + Popup.prototype.passwordlessVerify = function(options, cb) { + var _this = this; + return this.client.passwordless.verify( + objectHelper.blacklist(options, ['popupHandler']), + function(err) { + if (err) { + return cb(err); + } + + options.username = options.phoneNumber || options.email; + options.password = options.verificationCode; + + delete options.email; + delete options.phoneNumber; + delete options.verificationCode; + delete options.type; + + _this.client.loginWithResourceOwner(options, cb); + } + ); + }; + + /** + * Signs up a new user and automatically logs the user in after the signup. + * + * This method is not compatible with API Auth so if you need to fetch API tokens with audience + * you should use {@link authorize} or {@link signupAndAuthorize}. + * + * @method signupAndLogin + * @param {Object} options + * @param {String} options.email user email address + * @param {String} options.password user password + * @param {String} options.connection name of the connection where the user will be created + * @param {credentialsCallback} cb + */ + Popup.prototype.signupAndLogin = function(options, cb) { + var _this = this; + + // Preload popup to avoid the browser to block it since the login happens later + var popupHandler = this.getPopupHandler(options, true); + options.popupHandler = popupHandler; + + return this.client.dbConnection.signup( + objectHelper.blacklist(options, ['popupHandler']), + function(err) { + if (err) { + if (popupHandler._current_popup) { + popupHandler._current_popup.kill(); + } + return cb(err); + } + _this.loginWithCredentials(options, cb); + } + ); + }; + + module.exports = Popup; + + +/***/ }, +/* 59 */ +/***/ function(module, exports, __webpack_require__) { + + var UsernamePassword = __webpack_require__(61); + var objectHelper = __webpack_require__(2); + var Warn = __webpack_require__(11); + var assert = __webpack_require__(4); + + function Redirect(client, options) { + this.baseOptions = options; + this.client = client; + + this.warn = new Warn({ + disableWarnings: !!options._disableDeprecationWarnings + }); + } + + /** + * @callback credentialsCallback + * @param {Error} [err] error returned by Auth0 with the reason of the Auth failure + * @param {Object} [result] result of the AuthN request + * @param {String} result.accessToken token that can be used with {@link userinfo} + * @param {String} [result.idToken] token that identifies the user + * @param {String} [result.refreshToken] token that can be used to get new access tokens from Auth0. Note that not all clients can request them or the resource server might not allow them. + */ + + /** + * Performs authentication with username/email and password with a database connection + * + * This method is not compatible with API Auth so if you need to fetch API tokens with audience + * you should use {@link authorize} or {@link login}. + * + * @method loginWithCredentials + * @param {Object} options + * @param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorization Response + * @param {String} [options.responseType] type of the response used. It can be any of the values `code` and `token` + * @param {String} [options.responseMode] how the AuthN response is encoded and redirected back to the client. Supported values are `query` and `fragment` + * @param {String} [options.scope] scopes to be requested during AuthN. e.g. `openid email` + * @param {credentialsCallback} cb + */ + Redirect.prototype.loginWithCredentials = function(options, cb) { + var usernamePassword; + + var params = objectHelper + .merge(this.baseOptions, [ + 'clientID', + 'redirectUri', + 'tenant', + 'responseType', + 'responseMode', + 'scope', + 'audience', + '_csrf', + 'state', + '_intstate', + 'nonce' + ]) + .with(options); + + assert.check( + params, + { type: 'object', message: 'options parameter is not valid' }, + { + responseType: { type: 'string', message: 'responseType option is required' } + } + ); + + usernamePassword = new UsernamePassword(this.baseOptions); + return usernamePassword.login(params, function(err, data) { + if (err) { + return cb(err); + } + return usernamePassword.callback(data); + }); + }; + + /** + * Signs up a new user and automatically logs the user in after the signup. + * + * @method signupAndLogin + * @param {Object} options + * @param {String} options.email user email address + * @param {String} options.password user password + * @param {String} options.connection name of the connection where the user will be created + * @param {credentialsCallback} cb + */ + Redirect.prototype.signupAndLogin = function(options, cb) { + var _this = this; + return this.client.dbConnection.signup(options, function(err) { + if (err) { + return cb(err); + } + return _this.loginWithCredentials(options, cb); + }); + }; + + module.exports = Redirect; + + +/***/ }, +/* 60 */ +/***/ function(module, exports, __webpack_require__) { + + var IframeHandler = __webpack_require__(43); + + function SilentAuthenticationHandler(options) { + this.authenticationUrl = options.authenticationUrl; + this.timeout = options.timeout || 60 * 1000; + this.handler = null; + this.postMessageDataType = options.postMessageDataType || false; + } + + SilentAuthenticationHandler.create = function(options) { + return new SilentAuthenticationHandler(options); + }; + + SilentAuthenticationHandler.prototype.login = function(usePostMessage, callback) { + this.handler = new IframeHandler({ + auth0: this.auth0, + url: this.authenticationUrl, + eventListenerType: usePostMessage ? 'message' : 'load', + callback: this.getCallbackHandler(callback, usePostMessage), + timeout: this.timeout, + eventValidator: this.getEventValidator(), + timeoutCallback: function() { + callback(null, '#error=timeout&error_description=Timeout+during+authentication+renew.'); + }, + usePostMessage: usePostMessage || false + }); + + this.handler.init(); + }; + + SilentAuthenticationHandler.prototype.getEventValidator = function() { + var _this = this; + return { + isValid: function(eventData) { + switch (eventData.event.type) { + case 'message': + // Default behaviour, return all message events. + if (_this.postMessageDataType === false) { + return true; + } + + return ( + eventData.event.data.type && eventData.event.data.type === _this.postMessageDataType + ); + + case 'load': // Fall through to default + default: + return true; + } + } + }; + }; + + SilentAuthenticationHandler.prototype.getCallbackHandler = function(callback, usePostMessage) { + return function(eventData) { + var callbackValue; + if (!usePostMessage) { + callbackValue = eventData.sourceObject.contentWindow.location.hash; + } else if (typeof eventData.event.data === 'object' && eventData.event.data.hash) { + callbackValue = eventData.event.data.hash; + } else { + callbackValue = eventData.event.data; + } + callback(null, callbackValue); + }; + }; + + module.exports = SilentAuthenticationHandler; + + +/***/ }, +/* 61 */ +/***/ function(module, exports, __webpack_require__) { + + var urljoin = __webpack_require__(1); + + var objectHelper = __webpack_require__(2); + var RequestBuilder = __webpack_require__(10); + var responseHandler = __webpack_require__(6); + var windowHelper = __webpack_require__(3); + + function UsernamePassword(options) { + this.baseOptions = options; + this.request = new RequestBuilder(options); + } + + UsernamePassword.prototype.login = function(options, cb) { + var url; + var body; + + url = urljoin(this.baseOptions.rootUrl, 'usernamepassword', 'login'); + + options.username = options.username || options.email; // eslint-disable-line + + options = objectHelper.blacklist(options, ['email']); // eslint-disable-line + + body = objectHelper + .merge(this.baseOptions, [ + 'clientID', + 'redirectUri', + 'tenant', + 'responseType', + 'responseMode', + 'scope', + 'audience' + ]) + .with(options); + + body = objectHelper.toSnakeCase(body, ['auth0Client']); + + return this.request.post(url).send(body).end(responseHandler(cb)); + }; + + UsernamePassword.prototype.callback = function(formHtml) { + var div; + var form; + var _document = windowHelper.getDocument(); + + div = _document.createElement('div'); + div.innerHTML = formHtml; + form = _document.body.appendChild(div).children[0]; + + form.submit(); + }; + + module.exports = UsernamePassword; + + +/***/ } +/******/ ]) +}); +; \ No newline at end of file diff --git a/build/auth0.min.js b/build/auth0.min.js new file mode 100644 index 00000000..ae540426 --- /dev/null +++ b/build/auth0.min.js @@ -0,0 +1,13 @@ +/*! + * auth0.min.js v8.9.2 + * + * Author: Auth0 + * Date: 8/17/2017, 9:23:13 PM + * License: MIT + * + */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("auth0-js",[],e):"object"==typeof exports?exports["auth0-js"]=e():t.auth0=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){t.exports=n(54)},function(t,e,n){var r,i;!function(o,s,a){"undefined"!=typeof t&&t.exports?t.exports=a():(r=a,i="function"==typeof r?r.call(e,n,e,t):r,!(void 0!==i&&(t.exports=i)))}("urljoin",this,function(){function t(t,e){return t=t.replace(/:\//g,"://"),t=t.replace(/([^:\s])\/+/g,"$1/"),t=t.replace(/\/(\?|&|#[^!])/g,"$1"),t=t.replace(/(\?.+)\?/g,"$1&")}return function(){var e=arguments,n={};"object"==typeof arguments[0]&&(e=arguments[0],n=arguments[1]||{});var r=[].slice.call(e,0).join("/");return t(r,n)}})},function(t,e,n){function r(t,e){return e.reduce(function(e,n){return t[n]&&(e[n]=t[n]),e},{})}function i(t,e){var n=[];for(var r in t)e.indexOf(r)===-1&&n.push(r);return n}function o(t){var e=[];for(var n in t)e.push(t[n]);return e}function s(){var t=o(arguments);return t.unshift({}),f.get().apply(void 0,t)}function a(t,e){return{base:e?r(t,e):t,with:function(t,e){return t=e?r(t,e):t,s(this.base,t)}}}function p(t,e){return Object.keys(t).reduce(function(n,r){return e.indexOf(r)===-1&&(n[r]=t[r]),n},{})}function u(t){for(var e,n="",r=0,i=!0,o=!0;r=65&&e<=90||!i&&e>=48&&e<=57?(n+="_",n+=t[r].toLowerCase()):n+=t[r].toLowerCase(),i=e>=48&&e<=57,o=e>=65&&e<=90,r++;return n}function c(t){var e=t.split("_");return e.reduce(function(t,e){return t+e.charAt(0).toUpperCase()+e.slice(1)},e.shift())}function h(t,e){return"object"!=typeof t||d.isArray(t)||null===t?t:(e=e||[],Object.keys(t).reduce(function(n,r){var i=e.indexOf(r)===-1?u(r):r;return n[i]=h(t[r]),n},{}))}function l(t,e){return"object"!=typeof t||d.isArray(t)||null===t?t:(e=e||[],Object.keys(t).reduce(function(n,r){var i=e.indexOf(r)===-1?c(r):r;return n[i]=l(t[r]),n},{}))}var d=n(4),f=n(44);t.exports={toSnakeCase:h,toCamelCase:l,blacklist:p,merge:a,pick:r,getKeysNotIn:i,extend:s}},function(t,e){(function(e){function n(t){e.window.location=t}function r(){return e.window.document}function i(){return e.window}t.exports={redirect:n,getDocument:r,getWindow:i}}).call(e,function(){return this}())},function(t,e){function n(t,e,n,r){if(n="array"===n?"object":n,t&&typeof t[e]!==n)throw new Error(r)}function r(t,e,n){if(typeof t!==e)throw new Error(n)}function i(t,e,n){if(e.indexOf(t)===-1)throw new Error(n)}function o(t,e,o){if(e.optional&&!t||r(t,e.type,e.message),"object"===e.type&&o)for(var s=Object.keys(o),a=0;a=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122?n+=e.charAt(i):o<128?n+=r[o]:o<2048?n+=r[192|o>>6]+r[128|63&o]:o<55296||o>=57344?n+=r[224|o>>12]+r[128|o>>6&63]+r[128|63&o]:(i+=1,o=65536+((1023&o)<<10|1023&e.charCodeAt(i)),n+=r[240|o>>18]+r[128|o>>12&63]+r[128|o>>6&63]+r[128|63&o])}return n},e.compact=function(t,n){if("object"!=typeof t||null===t)return t;var r=n||[],i=r.indexOf(t);if(i!==-1)return r[i];if(r.push(t),Array.isArray(t)){for(var o=[],s=0;s0&&(t=t.retry(this._timesToRetryFailedRequests)),t},o.prototype.getTelemetryData=function(){var t=this._telemetryInfo||{name:"auth0.js",version:p.raw},e=JSON.stringify(t);return a.encode(e)},o.prototype.get=function(t,e){return new i(this.setCommonConfiguration(s.get(t),e))},o.prototype.post=function(t,e){return new i(this.setCommonConfiguration(s.post(t),e))},o.prototype.patch=function(t,e){return new i(this.setCommonConfiguration(s.patch(t),e))},t.exports=o},function(t,e){function n(t){this.disableWarnings=t.disableWarnings}n.prototype.warning=function(t){this.disableWarnings||console.warn(t)},t.exports=n},function(t,e,n){"use strict";var r=n(8),i=Object.prototype.hasOwnProperty,o={allowDots:!1,allowPrototypes:!1,arrayLimit:20,decoder:r.decode,delimiter:"&",depth:5,parameterLimit:1e3,plainObjects:!1,strictNullHandling:!1},s=function(t,e){for(var n={},r=t.split(e.delimiter,e.parameterLimit===1/0?void 0:e.parameterLimit),o=0;o=0&&n.parseArrays&&s<=n.arrayLimit?(r=[],r[s]=a(t,e,n)):r[o]=a(t,e,n)}return r},p=function(t,e,n){if(t){var r=n.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/,s=/(\[[^[\]]*])/g,p=o.exec(r),u=p?r.slice(0,p.index):r,c=[];if(u){if(!n.plainObjects&&i.call(Object.prototype,u)&&!n.allowPrototypes)return;c.push(u)}for(var h=0;null!==(p=s.exec(r))&&h0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function r(t){return 3*t.length/4-n(t)}function i(t){var e,r,i,o,s,a,p=t.length;s=n(t),a=new c(3*p/4-s),i=s>0?p-4:p;var h=0;for(e=0,r=0;e>16&255,a[h++]=o>>8&255,a[h++]=255&o;return 2===s?(o=u[t.charCodeAt(e)]<<2|u[t.charCodeAt(e+1)]>>4,a[h++]=255&o):1===s&&(o=u[t.charCodeAt(e)]<<10|u[t.charCodeAt(e+1)]<<4|u[t.charCodeAt(e+2)]>>2,a[h++]=o>>8&255,a[h++]=255&o),a}function o(t){return p[t>>18&63]+p[t>>12&63]+p[t>>6&63]+p[63&t]}function s(t,e,n){for(var r,i=[],s=e;sc?c:u+a));return 1===r?(e=t[n-1],i+=p[e>>2],i+=p[e<<4&63],i+="=="):2===r&&(e=(t[n-2]<<8)+t[n-1],i+=p[e>>10],i+=p[e>>4&63],i+=p[e<<2&63],i+="="),o.push(i),o.join("")}e.byteLength=r,e.toByteArray=i,e.fromByteArray=a;for(var p=[],u=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,d=h.length;l=0?"&":"?")+t),this._sort){var e=this.url.indexOf("?");if(e>=0){var n=this.url.substring(e+1).split("&");m(this._sort)?n.sort(this._sort):n.sort(),this.url=this.url.substring(0,e)+"?"+n.join("&")}}},c.prototype._isHost=function(t){return t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},c.prototype.end=function(t){return this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=t||r,this._appendQueryString(),this._end()},c.prototype._end=function(){var t=this,e=this.xhr=b.getXHR(),n=this._formData||this._data;this._setTimeouts(),e.onreadystatechange=function(){var n=e.readyState;if(n>=2&&t._responseTimeoutTimer&&clearTimeout(t._responseTimeoutTimer),4==n){var r;try{r=e.status}catch(t){r=0}if(!r){if(t.timedout||t._aborted)return;return t.crossDomainError()}t.emit("end")}};var r=function(e,n){n.total>0&&(n.percent=n.loaded/n.total*100),n.direction=e,t.emit("progress",n)};if(this.hasListeners("progress"))try{e.onprogress=r.bind(null,"download"),e.upload&&(e.upload.onprogress=r.bind(null,"upload"))}catch(t){}try{this.username&&this.password?e.open(this.method,this.url,!0,this.username,this.password):e.open(this.method,this.url,!0)}catch(t){return this.callback(t)}if(this._withCredentials&&(e.withCredentials=!0),!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof n&&!this._isHost(n)){var i=this._header["content-type"],o=this._serializer||b.serialize[i?i.split(";")[0]:""];!o&&p(i)&&(o=b.serialize["application/json"]),o&&(n=o(n))}for(var s in this.header)null!=this.header[s]&&e.setRequestHeader(s,this.header[s]);return this._responseType&&(e.responseType=this._responseType),this.emit("request",this),e.send("undefined"!=typeof n?n:null),this},b.get=function(t,e,n){var r=b("GET",t);return"function"==typeof e&&(n=e,e=null),e&&r.query(e),n&&r.end(n),r},b.head=function(t,e,n){var r=b("HEAD",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},b.options=function(t,e,n){var r=b("OPTIONS",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},b.del=h,b.delete=h,b.patch=function(t,e,n){var r=b("PATCH",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},b.post=function(t,e,n){var r=b("POST",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},b.put=function(t,e,n){var r=b("PUT",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r}},function(t,e){var n=function(){function t(t,e,n){t.attachEvent?t.attachEvent("on"+e,n):t.addEventListener&&t.addEventListener(e,n,!1)}function e(t,e,n){t.detachEvent?t.detachEvent("on"+e,n):t.removeEventListener&&t.removeEventListener(e,n,!1)}function n(){if("undefined"==typeof navigator)return!1;var t=-1,e=navigator.userAgent;if("Microsoft Internet Explorer"===navigator.appName){var n=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");null!=n.exec(e)&&(t=parseFloat(RegExp.$1))}else if(e.indexOf("Trident")>-1){var n=new RegExp("rv:([0-9]{2,2}[.0-9]{0,})");null!==n.exec(e)&&(t=parseFloat(RegExp.$1))}return t>=8}function r(){try{var t=navigator.userAgent;return t.indexOf("Fennec/")!=-1||t.indexOf("Firefox/")!=-1&&t.indexOf("Android")!=-1}catch(t){}return!1}function i(){return"undefined"!=typeof window&&window.JSON&&window.JSON.stringify&&window.JSON.parse&&window.postMessage}function o(t){/^https?:\/\//.test(t)||(t=window.location.href);var e=/^(https?:\/\/[\-_a-zA-Z\.0-9:]+)/.exec(t);return e?e[1]:t}function s(){for(var t=(window.location,window.opener.frames),e=t.length-1;e>=0;e--)try{if(t[e].location.protocol===window.location.protocol&&t[e].location.host===window.location.host&&t[e].name===a)return t[e]}catch(t){}}var a="__winchan_relay_frame",p="die",u=n();return i()?{open:function(n,i){function s(){if(l&&document.body.removeChild(l),l=void 0,m&&(m=clearInterval(m)),e(window,"message",c),e(window,"unload",s),y)try{y.close()}catch(t){f.postMessage(p,d)}y=f=void 0}function c(t){if(t.origin===d){try{var e=JSON.parse(t.data)}catch(t){if(!i)throw t;i(t)}"ready"===e.a?f.postMessage(g,d):"error"===e.a?(s(),i&&(i(e.d),i=null)):"response"===e.a&&(s(),i&&(i(null,e.d),i=null))}}if(!i)throw"missing required callback argument";var h;n.url||(h="missing required 'url' parameter"),n.relay_url||(h="missing required 'relay_url' parameter"),h&&setTimeout(function(){i(h)},0),n.window_name||(n.window_name=null),n.window_features&&!r()||(n.window_features=void 0);var l,d=n.origin||o(n.url);if(d!==o(n.relay_url))return setTimeout(function(){i("invalid arguments: origin of url and relay_url must match")},0);var f;u&&(l=document.createElement("iframe"),l.setAttribute("src",n.relay_url),l.style.display="none",l.setAttribute("name",a),document.body.appendChild(l),f=l.contentWindow);var y=n.popup||window.open(n.url,n.window_name,n.window_features);n.popup&&(y.location.href=n.url),f||(f=y);var m=setInterval(function(){y&&y.closed&&(s(),i&&(i("User closed the popup window"),i=null))},500),g=JSON.stringify({a:"request",d:n.params});return t(window,"unload",s),t(window,"message",c),{close:s,focus:function(){if(y)try{y.focus()}catch(t){}}}},onOpen:function(n){function r(t){t=JSON.stringify(t),u?c.doPost(t,a):c.postMessage(t,a)}function i(t){var o;try{o=JSON.parse(t.data)}catch(t){}o&&"request"===o.a&&(e(window,"message",i),a=t.origin,n&&setTimeout(function(){n(a,o.d,function(t){n=void 0,r({a:"response",d:t})})},0))}function o(t){if(t.data===p)try{window.close()}catch(t){}}var a="*",c=u?s():window.opener;if(!c)throw"can't find relay frame";t(u?c:window,"message",i),t(u?c:window,"message",o);try{r({a:"ready"})}catch(e){t(c,"load",function(t){r({a:"ready"})})}var h=function(){try{e(u?c:window,"message",o)}catch(t){}n&&r({a:"error",d:"client closed window"}),n=void 0;try{window.close()}catch(t){}};return t(window,"unload",h),{detach:function(){e(window,"unload",h)}}}}:{open:function(t,e,n,r){setTimeout(function(){r("unsupported browser")},0)},onOpen:function(t){setTimeout(function(){t("unsupported browser")},0)}}}();"undefined"!=typeof t&&t.exports&&(t.exports=n)},function(t,e,n){function r(t){p.check(t,{type:"object",message:"options parameter is not valid"},{domain:{type:"string",message:"domain option is required"},clientID:{type:"string",message:"clientID option is required"},responseType:{optional:!0,type:"string",message:"responseType is not valid"},responseMode:{optional:!0,type:"string",message:"responseMode is not valid"},redirectUri:{optional:!0,type:"string",message:"redirectUri is not valid"},scope:{optional:!0,type:"string",message:"scope is not valid"},audience:{optional:!0,type:"string",message:"audience is not valid"},_disableDeprecationWarnings:{optional:!0,type:"boolean",message:"_disableDeprecationWarnings option is not valid"},_sendTelemetry:{optional:!0,type:"boolean",message:"_sendTelemetry option is not valid"},_telemetryInfo:{optional:!0,type:"object",message:"_telemetryInfo option is not valid"}}),this.baseOptions=t,this.baseOptions._sendTelemetry=this.baseOptions._sendTelemetry!==!1||this.baseOptions._sendTelemetry,this.baseOptions.rootUrl="https://"+this.baseOptions.domain,this.request=new o(this.baseOptions),this.passwordless=new l(this.request,this.baseOptions),this.dbConnection=new d(this.request,this.baseOptions),this.warn=new h({disableWarnings:!!t._disableDeprecationWarnings})}var i=n(1),o=n(10),s=n(5),a=n(2),p=n(4),u=n(6),c=n(45),h=n(11),l=n(41),d=n(40);r.prototype.buildAuthorizeUrl=function(t){var e,n;return p.check(t,{type:"object",message:"options parameter is not valid"}),e=a.merge(this.baseOptions,["clientID","responseType","responseMode","redirectUri","scope","audience"]).with(t),p.check(e,{type:"object",message:"options parameter is not valid"},{clientID:{type:"string",message:"clientID option is required"},redirectUri:{optional:!0,type:"string",message:"redirectUri option is required"},responseType:{type:"string",message:"responseType option is required"},nonce:{type:"string",message:"nonce option is required",condition:function(t){return t.responseType.indexOf("code")===-1&&t.responseType.indexOf("id_token")!==-1}},scope:{optional:!0,type:"string",message:"scope option is required"},audience:{optional:!0,type:"string",message:"audience option is required"}}),this.baseOptions._sendTelemetry&&(e.auth0Client=this.request.getTelemetryData()),e.connection_scope&&p.isArray(e.connection_scope)&&(e.connection_scope=e.connection_scope.join(",")),e=a.toSnakeCase(e,["auth0Client"]),e=c.oauthAuthorizeParams(this.warn,e),n=s.stringify(e),i(this.baseOptions.rootUrl,"authorize","?"+n)},r.prototype.buildLogoutUrl=function(t){var e,n;return p.check(t,{optional:!0,type:"object",message:"options parameter is not valid"}),e=a.merge(this.baseOptions,["clientID"]).with(t||{}),this.baseOptions._sendTelemetry&&(e.auth0Client=this.request.getTelemetryData()),e=a.toSnakeCase(e,["auth0Client","returnTo"]),n=s.stringify(e),i(this.baseOptions.rootUrl,"v2","logout","?"+n)},r.prototype.loginWithDefaultDirectory=function(t,e){return p.check(t,{type:"object",message:"options parameter is not valid"},{username:{type:"string",message:"username option is required"},password:{type:"string",message:"password option is required"},scope:{optional:!0,type:"string",message:"scope option is required"},audience:{optional:!0,type:"string",message:"audience option is required"}}),t.grantType="password",this.oauthToken(t,e)},r.prototype.login=function(t,e){return p.check(t,{type:"object",message:"options parameter is not valid"},{username:{type:"string",message:"username option is required"},password:{type:"string",message:"password option is required"},realm:{type:"string",message:"realm option is required"},scope:{optional:!0,type:"string",message:"scope option is required"},audience:{optional:!0,type:"string",message:"audience option is required"}}),t.grantType="http://auth0.com/oauth/grant-type/password-realm",this.oauthToken(t,e)},r.prototype.oauthToken=function(t,e){var n,r;return p.check(t,{type:"object",message:"options parameter is not valid"}),p.check(e,{type:"function",message:"cb parameter is not valid"}),n=i(this.baseOptions.rootUrl,"oauth","token"),r=a.merge(this.baseOptions,["clientID","scope","audience"]).with(t),p.check(r,{type:"object",message:"options parameter is not valid"},{clientID:{type:"string",message:"clientID option is required"},grantType:{type:"string",message:"grantType option is required"},scope:{optional:!0,type:"string",message:"scope option is required"},audience:{optional:!0,type:"string",message:"audience option is required"}}),r=a.toSnakeCase(r,["auth0Client"]),r=c.oauthTokenParams(this.warn,r),r.grant_type=r.grant_type,this.request.post(n).send(r).end(u(e))},r.prototype.loginWithResourceOwner=function(t,e){ +var n,r;return p.check(t,{type:"object",message:"options parameter is not valid"},{username:{type:"string",message:"username option is required"},password:{type:"string",message:"password option is required"},connection:{type:"string",message:"connection option is required"},scope:{optional:!0,type:"string",message:"scope option is required"}}),p.check(e,{type:"function",message:"cb parameter is not valid"}),n=i(this.baseOptions.rootUrl,"oauth","ro"),r=a.merge(this.baseOptions,["clientID","scope"]).with(t,["username","password","scope","connection","device"]),r=a.toSnakeCase(r,["auth0Client"]),r.grant_type=r.grant_type||"password",this.request.post(n).send(r).end(u(e))},r.prototype.getSSOData=function(t,e){var n,r="";return"function"==typeof t&&(e=t,t=!1),p.check(t,{type:"boolean",message:"withActiveDirectories parameter is not valid"}),p.check(e,{type:"function",message:"cb parameter is not valid"}),t&&(r="?"+s.stringify({ldaps:1,client_id:this.baseOptions.clientID})),n=i(this.baseOptions.rootUrl,"user","ssodata",r),this.request.get(n,{noHeaders:!0}).withCredentials().end(u(e))},r.prototype.userInfo=function(t,e){var n;return p.check(t,{type:"string",message:"accessToken parameter is not valid"}),p.check(e,{type:"function",message:"cb parameter is not valid"}),n=i(this.baseOptions.rootUrl,"userinfo"),this.request.get(n).set("Authorization","Bearer "+t).end(u(e,{ignoreCasing:!0}))},r.prototype.delegation=function(t,e){var n,r;return p.check(t,{type:"object",message:"options parameter is not valid"},{grant_type:{type:"string",message:"grant_type option is required"}}),p.check(e,{type:"function",message:"cb parameter is not valid"}),n=i(this.baseOptions.rootUrl,"delegation"),r=a.merge(this.baseOptions,["clientID"]).with(t),r=a.toSnakeCase(r,["auth0Client"]),this.request.post(n).send(r).end(u(e))},r.prototype.getUserCountry=function(t){var e;return p.check(t,{type:"function",message:"cb parameter is not valid"}),e=i(this.baseOptions.rootUrl,"user","geoloc","country"),this.request.get(e).end(u(t))},t.exports=r},function(t,e,n){function r(t){var e=t.length%4,n=4-e;return 0===e?t:t+new Array(1+n).join("=")}function i(t){for(var e=new Array(t.length),n=0;n>>2]>>>24-o%4*8&255;e[r+o>>>2]|=s<<24-(r+o)%4*8}else for(var o=0;o>>2]=n[o>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=o.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n,r=[],i=function(e){var e=e,n=987654321,r=4294967295;return function(){n=36969*(65535&n)+(n>>16)&r,e=18e3*(65535&e)+(e>>16)&r;var i=(n<<16)+e&r;return i/=4294967296,i+=.5,i*(t.random()>.5?1:-1)}},o=0;o>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new s.init(n,e/2)}},u=a.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new s.init(n,e)}},c=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},h=i.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=c.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,i=n.sigBytes,o=this.blockSize,a=4*o,p=i/a;p=e?t.ceil(p):t.max((0|p)-this._minBufferSize,0);var u=p*o,c=t.min(4*u,i);if(u){for(var h=0;h>>7)^(f<<14|f>>>18)^f>>>3,m=u[d-2],g=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;u[d]=y+u[d-7]+g+u[d-16]}var v=a&c^~a&h,b=r&i^r&o^i&o,w=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),_=(a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25),T=l+_+v+p[d]+u[d],k=w+b;l=h,h=c,c=a,a=s+T|0,s=o,o=i,i=r,r=T+k|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0,n[5]=n[5]+c|0,n[6]=n[6]+h|0,n[7]=n[7]+l|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[(i+64>>>9<<4)+14]=e.floor(r/4294967296),n[(i+64>>>9<<4)+15]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});n.SHA256=o._createHelper(c),n.HmacSHA256=o._createHmacHelper(c)}(Math),t.SHA256})},function(t,e){function n(){}n.prototype.get=function(){return null},n.prototype.has=function(){return!1},n.prototype.set=function(){},t.exports=n},function(t,e){function n(t){this.name="ConfigurationError",this.message=t||""}function r(t){this.name="TokenValidationError",this.message=t||""}n.prototype=Error.prototype,r.prototype=Error.prototype,t.exports={ConfigurationError:n,TokenValidationError:r}},function(t,e,n){function r(t){var e=s.decodeToHEX(t.n),n=s.decodeToHEX(t.e);return{modulus:e,exp:n}}function i(t,e){var n=o(t.iss,".well-known","jwks.json");return a.get(n).end(function(n,i){var o,s,a=null;for(n&&e(n),o=0;o0&&e.length>0))throw new Error("Invalid key data");this.n=new o(t,16),this.e=parseInt(e,16)}function i(t){for(var e in a){var n=a[e],r=n.length;if(t.substring(0,r)===n)return{alg:e,hash:t.substring(r)}}return[]}var o=n(31).BigInteger,s=n(25),a={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},p={sha256:s};r.prototype.verify=function(t,e){e=e.replace(/[^0-9a-f]|[\s\n]]/gi,"");var n=new o(e,16);if(n.bitLength()>this.n.bitLength())throw new Error("Signature does not match with the key modulus.");var r=n.modPowInt(this.e,this.n),s=r.toString(16).replace(/^1f+00/,""),a=i(s);if(0===a.length)return!1;if(!p.hasOwnProperty(a.alg))throw new Error("Hashing algorithm is not supported.");var u=p[a.alg](t).toString();return a.hash===u},t.exports=r},function(t,e,n){function r(t){var e=t||{};if(this.jwksCache=e.jwksCache||new p,this.expectedAlg=e.expectedAlg||"RS256",this.issuer=e.issuer,this.audience=e.audience,this.leeway=e.leeway||0,this.__disableExpirationCheck=e.__disableExpirationCheck||!1,this.leeway<0||this.leeway>60)throw new a.ConfigurationError("The leeway should be positive and lower than a minute.");if(u.indexOf(this.expectedAlg)===-1)throw new a.ConfigurationError("Algorithm "+this.expectedAlg+" is not supported. (Expected algs: ["+u.join(",")+"])")}var i=n(29),o=n(16),s=n(28),a=n(27),p=n(26),u=["RS256"];r.prototype.verify=function(t,e,n){var r=this.decode(t);if(r instanceof Error)return n(r,!1);var i=r.encoded.header+"."+r.encoded.payload,s=o.decodeToHEX(r.encoded.signature),p=r.header.alg,c=r.header.kid,h=r.payload.aud,l=r.payload.iss,d=r.payload.exp,f=r.payload.nbf,y=r.payload.nonce||null;if(this.issuer!==l)return n(new a.TokenValidationError("Issuer "+l+" is not valid."),!1);if(this.audience!==h)return n(new a.TokenValidationError("Audience "+h+" is not valid."),!1);if(this.expectedAlg!==p)return n(new a.TokenValidationError("Algorithm "+p+" is not supported. (Expected algs: ["+u.join(",")+"])"),!1);if(y!==e)return n(new a.TokenValidationError("Nonce does not match."),!1);var m=this.verifyExpAndNbf(d,f);return m?n(m,!1):this.getRsaVerifier(l,c,function(t,e){return t?n(t):e.verify(i,s)?n(null,r.payload):n(new a.TokenValidationError("Invalid signature."))})},r.prototype.verifyExpAndNbf=function(t,e){var n=new Date,r=new Date(0),i=new Date(0);return this.__disableExpirationCheck?null:(r.setUTCSeconds(t+this.leeway),n>r?new a.TokenValidationError("Expired token."):"undefined"==typeof e?null:(i.setUTCSeconds(e-this.leeway),nr?new a.TokenValidationError("Expired token."):(i.setUTCSeconds(e-this.leeway),n=0;){var s=e*this[t++]+n[r]+i;i=Math.floor(s/67108864),n[r++]=67108863&s}return i}function o(t,e,n,r,i,o){for(var s=32767&e,a=e>>15;--o>=0;){var p=32767&this[t],u=this[t++]>>15,c=a*p+u*s;p=s*p+((32767&c)<<15)+n[r]+(1073741823&i),i=(p>>>30)+(c>>>15)+a*u+(i>>>30),n[r++]=1073741823&p}return i}function s(t,e,n,r,i,o){for(var s=16383&e,a=e>>14;--o>=0;){var p=16383&this[t],u=this[t++]>>14,c=a*p+u*s;p=s*p+((16383&c)<<14)+n[r]+i,i=(p>>28)+(c>>14)+a*u,n[r++]=268435455&p}return i}function a(t){return me.charAt(t)}function p(t,e){var n=ge[t.charCodeAt(e)];return null==n?-1:n}function u(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}function c(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0}function h(t){var e=r();return e.fromInt(t),e}function l(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var i=t.length,o=!1,s=0;--i>=0;){var a=8==r?255&t[i]:p(t,i);a<0?"-"==t.charAt(i)&&(o=!0):(o=!1,0==s?this[this.t++]=a:s+r>this.DB?(this[this.t-1]|=(a&(1<>this.DB-s):this[this.t-1]|=a<=this.DB&&(s-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t}function f(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var n,r=(1<0)for(p>p)>0&&(i=!0,o=a(n));s>=0;)p>(p+=this.DB-e)):(n=this[s]>>(p-=e)&r,p<=0&&(p+=this.DB,--s)),n>0&&(i=!0),i&&(o+=a(n));return i?o:"0"}function y(){var t=r();return n.ZERO.subTo(this,t),t}function m(){return this.s<0?this.negate():this}function g(t){var e=this.s-t.s;if(0!=e)return e;var n=this.t;if(e=n-t.t,0!=e)return this.s<0?-e:e;for(;--n>=0;)if(0!=(e=this[n]-t[n]))return e;return 0}function v(t){var e,n=1;return 0!=(e=t>>>16)&&(t=e,n+=16),0!=(e=t>>8)&&(t=e,n+=8),0!=(e=t>>4)&&(t=e,n+=4),0!=(e=t>>2)&&(t=e,n+=2),0!=(e=t>>1)&&(t=e,n+=1),n}function b(){return this.t<=0?0:this.DB*(this.t-1)+v(this[this.t-1]^this.s&this.DM)}function w(t,e){var n;for(n=this.t-1;n>=0;--n)e[n+t]=this[n];for(n=t-1;n>=0;--n)e[n]=0;e.t=this.t+t,e.s=this.s}function _(t,e){for(var n=t;n=0;--n)e[n+s+1]=this[n]>>i|a,a=(this[n]&o)<=0;--n)e[n]=0;e[s]=a,e.t=this.t+s+1,e.s=this.s,e.clamp()}function k(t,e){e.s=this.s;var n=Math.floor(t/this.DB);if(n>=this.t)return void(e.t=0);var r=t%this.DB,i=this.DB-r,o=(1<>r;for(var s=n+1;s>r;r>0&&(e[this.t-n-1]|=(this.s&o)<>=this.DB;if(t.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r-=t.s}e.s=r<0?-1:0,r<-1?e[n++]=this.DV+r:r>0&&(e[n++]=r),e.t=n,e.clamp()}function x(t,e){var r=this.abs(),i=t.abs(),o=r.t;for(e.t=o+i.t;--o>=0;)e[o]=0;for(o=0;o=0;)t[n]=0;for(n=0;n=e.DV&&(t[n+e.t]-=e.DV,t[n+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(n,e[n],t,2*n,0,1)),t.s=0,t.clamp()}function D(t,e,i){var o=t.abs();if(!(o.t<=0)){var s=this.abs();if(s.t0?(o.lShiftTo(c,a),s.lShiftTo(c,i)):(o.copyTo(a),s.copyTo(i));var h=a.t,l=a[h-1];if(0!=l){var d=l*(1<1?a[h-2]>>this.F2:0),f=this.FV/d,y=(1<=0&&(i[i.t++]=1,i.subTo(w,i)),n.ONE.dlShiftTo(h,w),w.subTo(a,a);a.t=0;){var _=i[--g]==l?this.DM:Math.floor(i[g]*f+(i[g-1]+m)*y);if((i[g]+=a.am(0,_,i,b,0,h))<_)for(a.dlShiftTo(b,w),i.subTo(w,i);i[g]<--_;)i.subTo(w,i)}null!=e&&(i.drShiftTo(h,e),p!=u&&n.ZERO.subTo(e,e)),i.t=h,i.clamp(),c>0&&i.rShiftTo(c,i),p<0&&n.ZERO.subTo(i,i)}}}function S(t){var e=r();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(n.ZERO)>0&&t.subTo(e,e),e}function A(t){this.m=t}function E(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function q(t){return t}function j(t){t.divRemTo(this.m,null,t)}function I(t,e,n){t.multiplyTo(e,n),this.reduce(n)}function R(t,e){t.squareTo(e),this.reduce(e)}function M(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return e=e*(2-(15&t)*e)&15,e=e*(2-(255&t)*e)&255,e=e*(2-((65535&t)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}function B(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(e,e),e}function P(t){var e=r();return t.copyTo(e),this.reduce(e),e}function H(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(n=e+this.m.t,t[n]+=this.m.am(0,r,t,e,0,this.m.t);t[n]>=t.DV;)t[n]-=t.DV,t[++n]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function L(t,e){t.squareTo(e),this.reduce(e)}function N(t,e,n){t.multiplyTo(e,n),this.reduce(n)}function V(){return 0==(this.t>0?1&this[0]:this.s)}function W(t,e){if(t>4294967295||t<1)return n.ONE;var i=r(),o=r(),s=e.convert(this),a=v(t)-1;for(s.copyTo(i);--a>=0;)if(e.sqrTo(i,o),(t&1<0)e.mulTo(o,s,i);else{var p=i;i=o,o=p}return e.revert(i)}function z(t,e){var n;return n=t<256||e.isEven()?new A(e):new B(e),this.exp(t,n)}function F(){var t=r();return this.copyTo(t),t}function J(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function Z(){return 0==this.t?this.s:this[0]<<16>>16}function $(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function K(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function G(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),n=Math.pow(t,e),i=h(n),o=r(),s=r(),a="";for(this.divRemTo(i,o,s);o.signum()>0;)a=(n+s.intValue()).toString(t).substr(1)+a,o.divRemTo(i,o,s);return s.intValue().toString(t)+a}function Q(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),i=Math.pow(e,r),o=!1,s=0,a=0,u=0;u=r&&(this.dMultiply(i),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(a,0)),o&&n.ZERO.subTo(this,this)}function Y(t,e,r){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(n.ONE.shiftLeft(t-1),at,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(n.ONE.shiftLeft(t-1),this);else{var i=new Array,o=7&t;i.length=(t>>3)+1,e.nextBytes(i),o>0?i[0]&=(1<0)for(r>r)!=(this.s&this.DM)>>r&&(e[i++]=n|this.s<=0;)r<8?(n=(this[t]&(1<>(r+=this.DB-8)):(n=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),0!=(128&n)&&(n|=-256),0==i&&(128&this.s)!=(128&n)&&++i,(i>0||n!=this.s)&&(e[i++]=n);return e}function et(t){return 0==this.compareTo(t)}function nt(t){return this.compareTo(t)<0?this:t}function rt(t){return this.compareTo(t)>0?this:t}function it(t,e,n){var r,i,o=Math.min(t.t,this.t);for(r=0;r>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function gt(){for(var t=0;t=this.t?0!=this.s:0!=(this[e]&1<>=this.DB;if(t.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r+=t.s}e.s=r<0?-1:0,r>0?e[n++]=r:r<-1&&(e[n++]=this.DV+r),e.t=n,e.clamp()}function Ct(t){var e=r();return this.addTo(t,e),e}function Dt(t){var e=r();return this.subTo(t,e),e}function St(t){var e=r();return this.multiplyTo(t,e),e}function At(){var t=r();return this.squareTo(t),t}function Et(t){var e=r();return this.divRemTo(t,e,null),e}function qt(t){var e=r();return this.divRemTo(t,null,e),e}function jt(t){var e=r(),n=r();return this.divRemTo(t,e,n),new Array(e,n)}function It(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function Rt(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}}function Mt(){}function Bt(t){return t}function Ut(t,e,n){t.multiplyTo(e,n)}function Pt(t,e){t.squareTo(e)}function Ht(t){return this.exp(t,new Mt)}function Lt(t,e,n){var r=Math.min(this.t+t.t,e);for(n.s=0,n.t=r;r>0;)n[--r]=0;var i;for(i=n.t-this.t;r=0;)n[r]=0;for(r=Math.max(e-this.t,0);r2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=r();return t.copyTo(e),this.reduce(e),e}function zt(t){return t}function Ft(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function Jt(t,e){t.squareTo(e),this.reduce(e)}function Xt(t,e,n){t.multiplyTo(e,n),this.reduce(n)}function Zt(t,e){var n,i,o=t.bitLength(),s=h(1);if(o<=0)return s;n=o<18?1:o<48?3:o<144?4:o<768?5:6,i=o<8?new A(e):e.isEven()?new Vt(e):new B(e);var a=new Array,p=3,u=n-1,c=(1<1){var l=r();for(i.sqrTo(a[1],l);p<=c;)a[p]=r(),i.mulTo(l,a[p-2],a[p]),p+=2}var d,f,y=t.t-1,m=!0,g=r();for(o=v(t[y])-1;y>=0;){for(o>=u?d=t[y]>>o-u&c:(d=(t[y]&(1<0&&(d|=t[y-1]>>this.DB+o-u)),p=n;0==(1&d);)d>>=1,--p;if((o-=p)<0&&(o+=this.DB,--y),m)a[d].copyTo(s),m=!1;else{for(;p>1;)i.sqrTo(s,g),i.sqrTo(g,s),p-=2;p>0?i.sqrTo(s,g):(f=s,s=g,g=f),i.mulTo(g,a[d],s)}for(;y>=0&&0==(t[y]&1<0&&(e.rShiftTo(o,e),n.rShiftTo(o,n));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),e.compareTo(n)>=0?(e.subTo(n,e),e.rShiftTo(1,e)):(n.subTo(e,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n}function Kt(t){if(t<=0)return 0;var e=this.DV%t,n=this.s<0?t-1:0;if(this.t>0)if(0==e)n=this[0]%t;else for(var r=this.t-1;r>=0;--r)n=(e*n+this[r])%t;return n}function Gt(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return n.ZERO;for(var r=t.clone(),i=this.clone(),o=h(1),s=h(0),a=h(0),p=h(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),e?(o.isEven()&&s.isEven()||(o.addTo(this,o),s.subTo(t,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;i.isEven();)i.rShiftTo(1,i),e?(a.isEven()&&p.isEven()||(a.addTo(this,a),p.subTo(t,p)),a.rShiftTo(1,a)):p.isEven()||p.subTo(t,p),p.rShiftTo(1,p);r.compareTo(i)>=0?(r.subTo(i,r),e&&o.subTo(a,o),s.subTo(p,s)):(i.subTo(r,i),e&&a.subTo(o,a),p.subTo(s,p))}return 0!=i.compareTo(n.ONE)?n.ZERO:p.compareTo(t)>=0?p.subtract(t):p.signum()<0?(p.addTo(t,p),p.signum()<0?p.add(t):p):p}function Qt(t){var e,n=this.abs();if(1==n.t&&n[0]<=ve[ve.length-1]){for(e=0;e>1,t>ve.length&&(t=ve.length);for(var s=r(),a=0;a>8&255,_e[Te++]^=t>>16&255,_e[Te++]^=t>>24&255,Te>=Ce&&(Te-=Ce)}function ee(){te((new Date).getTime())}function ne(){if(null==we){for(ee(),we=pe(),we.init(_e),Te=0;Te<_e.length;++Te)_e[Te]=0;Te=0}return we.next()}function re(t){var e;for(e=0;e>>8,_e[Te++]=255&ke;Te=0,ee()}ie.prototype.nextBytes=re,oe.prototype.init=se,oe.prototype.next=ae;var Ce=256;n.SecureRandom=ie,n.BigInteger=n,e=t.exports=n}).call(this)},function(t,e,n){function r(t){var e=i(t)?Object.prototype.toString.call(t):"";return"[object Function]"===e}var i=n(14);t.exports=r},function(t,e,n){function r(t){if(t)return i(t)}function i(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}var o=n(14);t.exports=r,r.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,this},r.prototype.parse=function(t){return this._parser=t,this},r.prototype.responseType=function(t){return this._responseType=t,this},r.prototype.serialize=function(t){return this._serializer=t,this},r.prototype.timeout=function(t){if(!t||"object"!=typeof t)return this._timeout=t,this._responseTimeout=0,this;for(var e in t)switch(e){case"deadline":this._timeout=t.deadline;break;case"response":this._responseTimeout=t.response;break;default:console.warn("Unknown timeout option",e)}return this},r.prototype.retry=function(t){return 0!==arguments.length&&t!==!0||(t=1),t<=0&&(t=0),this._maxRetries=t,this._retries=0,this},r.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this._end()},r.prototype.then=function(t,e){if(!this._fullfilledPromise){var n=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise(function(t,e){n.end(function(n,r){n?e(n):t(r)})})}return this._fullfilledPromise.then(t,e)},r.prototype.catch=function(t){return this.then(void 0,t)},r.prototype.use=function(t){return t(this),this},r.prototype.ok=function(t){if("function"!=typeof t)throw Error("Callback required");return this._okCallback=t,this},r.prototype._isResponseOK=function(t){return!!t&&(this._okCallback?this._okCallback(t):t.status>=200&&t.status<300)},r.prototype.get=function(t){return this._header[t.toLowerCase()]},r.prototype.getHeader=r.prototype.get,r.prototype.set=function(t,e){if(o(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},r.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},r.prototype.field=function(t,e){if(null===t||void 0===t)throw new Error(".field(name, val) name can not be empty");if(this._data&&console.error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()"),o(t)){for(var n in t)this.field(n,t[n]);return this}if(Array.isArray(e)){for(var r in e)this.field(t,e[r]);return this}if(null===e||void 0===e)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof e&&(e=""+e),this._getFormData().append(t,e),this},r.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},r.prototype.withCredentials=function(t){return void 0==t&&(t=!0),this._withCredentials=t,this},r.prototype.redirects=function(t){return this._maxRedirects=t,this},r.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},r.prototype.send=function(t){var e=o(t),n=this._header["content-type"];if(this._formData&&console.error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()"),e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(e&&o(this._data))for(var r in t)this._data[r]=t[r];else"string"==typeof t?(n||this.type("form"),n=this._header["content-type"],"application/x-www-form-urlencoded"==n?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||this._isHost(t)?this:(n||this.type("json"),this)},r.prototype.sortQuery=function(t){return this._sort="undefined"==typeof t||t,this},r.prototype._timeoutError=function(t,e,n){if(!this._aborted){var r=new Error(t+e+"ms exceeded");r.timeout=e,r.code="ECONNABORTED",r.errno=n,this.timedout=!0,this.abort(),this.callback(r)}},r.prototype._setTimeouts=function(){var t=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){t._timeoutError("Timeout of ",t._timeout,"ETIME")},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){t._timeoutError("Response timeout of ",t._responseTimeout,"ETIMEDOUT")},this._responseTimeout))}},function(t,e,n){function r(t){if(t)return i(t)}function i(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}var o=n(36);t.exports=r,r.prototype.get=function(t){return this.header[t.toLowerCase()]},r.prototype._setHeaderProperties=function(t){var e=t["content-type"]||"";this.type=o.type(e);var n=o.params(e);for(var r in n)this[r]=n[r];this.links={};try{t.link&&(this.links=o.parseLinks(t.link))}catch(t){}},r.prototype._setStatusProperties=function(t){var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.redirect=3==e,this.clientError=4==e,this.serverError=5==e,this.error=(4==e||5==e)&&this.toError(),this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.forbidden=403==t,this.notFound=404==t}},function(t,e){var n=["ECONNRESET","ETIMEDOUT","EADDRINFO","ESOCKETTIMEDOUT"];t.exports=function(t,e){return!!(t&&t.code&&~n.indexOf(t.code))||(!!(e&&e.status&&e.status>=500)||!!(t&&"timeout"in t&&"ECONNABORTED"==t.code))}},function(t,e){e.type=function(t){return t.split(/ *; */).shift()},e.params=function(t){return t.split(/ *; */).reduce(function(t,e){var n=e.split(/ *= */),r=n.shift(),i=n.shift();return r&&i&&(t[r]=i),t},{})},e.parseLinks=function(t){return t.split(/ *, */).reduce(function(t,e){var n=e.split(/ *; */),r=n[0].slice(1,-1),i=n[1].split(/ *= */)[1].slice(1,-1);return t[i]=r,t},{})},e.cleanHeader=function(t,e){return delete t["content-type"],delete t["content-length"],delete t["transfer-encoding"],delete t.host,e&&delete t.cookie,t}},,,,function(t,e,n){function r(t,e){this.baseOptions=e,this.request=t}var i=n(1),o=n(2),s=n(4),a=n(6);r.prototype.signup=function(t,e){var n,r,p;return s.check(t,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},email:{type:"string",message:"email option is required"},password:{type:"string",message:"password option is required"}}),s.check(e,{type:"function",message:"cb parameter is not valid"}),n=i(this.baseOptions.rootUrl,"dbconnections","signup"),r=o.merge(this.baseOptions,["clientID"]).with(t),p=r.user_metadata||r.userMetadata,r=o.blacklist(r,["scope","userMetadata","user_metadata"]),r=o.toSnakeCase(r,["auth0Client"]),p&&(r.user_metadata=p),this.request.post(n).send(r).end(a(e))},r.prototype.changePassword=function(t,e){var n,r;return s.check(t,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},email:{type:"string",message:"email option is required"}}),s.check(e,{type:"function",message:"cb parameter is not valid"}),n=i(this.baseOptions.rootUrl,"dbconnections","change_password"),r=o.merge(this.baseOptions,["clientID"]).with(t,["email","connection"]),r=o.toSnakeCase(r,["auth0Client"]),this.request.post(n).send(r).end(a(e))},t.exports=r},function(t,e,n){function r(t,e){this.baseOptions=e,this.request=t}var i=n(1),o=n(2),s=n(4),a=n(5),p=n(6);r.prototype.buildVerifyUrl=function(t){var e,n;return s.check(t,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},verificationCode:{type:"string",message:"verificationCode option is required"},phoneNumber:{optional:!1,type:"string",message:"phoneNumber option is required",condition:function(t){return!t.email}},email:{optional:!1,type:"string",message:"email option is required",condition:function(t){return!t.phoneNumber}}}),e=o.merge(this.baseOptions,["clientID","responseType","responseMode","redirectUri","scope","audience","_csrf","state","_intstate","protocol","nonce"]).with(t),this.baseOptions._sendTelemetry&&(e.auth0Client=this.request.getTelemetryData()),e=o.toSnakeCase(e,["auth0Client"]),n=a.stringify(e),i(this.baseOptions.rootUrl,"passwordless","verify_redirect","?"+n)},r.prototype.start=function(t,e){var n,r;return s.check(t,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},send:{type:"string",message:"send option is required",values:["link","code"],value_message:"send is not valid ([link, code])"},phoneNumber:{optional:!0,type:"string",message:"phoneNumber option is required",condition:function(t){return"code"===t.send||!t.email}},email:{optional:!0,type:"string",message:"email option is required",condition:function(t){return"link"===t.send||!t.phoneNumber}},authParams:{optional:!0,type:"object",message:"authParams option is required"}}),s.check(e,{type:"function",message:"cb parameter is not valid"}),n=i(this.baseOptions.rootUrl,"passwordless","start"),r=o.merge(this.baseOptions,["clientID","responseType","redirectUri","scope"]).with(t),r.scope&&(r.authParams=r.authParams||{},r.authParams.scope=r.scope),r.redirectUri&&(r.authParams=r.authParams||{},r.authParams.redirect_uri=r.redirectUri),r.responseType&&(r.authParams=r.authParams||{},r.authParams.response_type=r.responseType),delete r.redirectUri,delete r.responseType,delete r.scope,r=o.toSnakeCase(r,["auth0Client","authParams"]),this.request.post(n).send(r).end(p(e))},r.prototype.verify=function(t,e){var n,r;return s.check(t,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},verificationCode:{type:"string",message:"verificationCode option is required"},phoneNumber:{optional:!1,type:"string",message:"phoneNumber option is required",condition:function(t){return!t.email}},email:{optional:!1,type:"string",message:"email option is required",condition:function(t){return!t.phoneNumber}}}),s.check(e,{type:"function",message:"cb parameter is not valid"}),r=o.pick(t,["connection","verificationCode","phoneNumber","email","auth0Client"]),r=o.toSnakeCase(r,["auth0Client"]),n=i(this.baseOptions.rootUrl,"passwordless","verify"),this.request.post(n).send(r).end(p(e))},t.exports=r},function(t,e,n){function r(t,e,n){var r,i;if(void 0===s.getDocument().cookie||null===s.getDocument().cookie)throw new Error("cookie storage not available");if(n){var o=24*n*60*60*1e3;r=new Date,r.setTime(r.getTime()+o),i="; expires="+r.toGMTString()}else i="";s.getDocument().cookie=t+"="+a.encode(e)+i+"; path=/"}function i(t){var e,n,r,i=t+"=";if(void 0===s.getDocument().cookie||null===s.getDocument().cookie)throw new Error("cookie storage not available");for(r=s.getDocument().cookie.split(";"),e=0;e0&&t.warning("Following parameters are not allowed on the `/authorize` endpoint: ["+n.join(",")+"]"),e}function i(t,e){return o.pick(e,s)}var o=n(2),s=["realm","audience","client_id","client_secret","redirect_uri","scope","code","grant_type","username","password","refresh_token","assertion","client_assertion","client_assertion_type","code_verifier"],a=["connection","connection_scope","auth0Client","owp","device","protocol","_csrf","_intstate","login_ticket","client_id","response_type","response_mode","redirect_uri","audience","scope","state","nonce","display","prompt","max_age","ui_locales","claims_locales","id_token_hint","login_hint","acr_values","claims","registration","request","request_uri","code_challenge","code_challenge_method"];t.exports={oauthTokenParams:i,oauthAuthorizeParams:r}},function(t,e,n){function r(t,e){this.plugins=e;for(var n=0;n= 65 && code <= 90) ||\n\t (!wasPrevNumber && code >= 48 && code <= 57)\n\t ) {\n\t newKey += '_';\n\t newKey += str[index].toLowerCase();\n\t } else {\n\t newKey += str[index].toLowerCase();\n\t }\n\t wasPrevNumber = code >= 48 && code <= 57;\n\t wasPrevUppercase = code >= 65 && code <= 90;\n\t index++;\n\t }\n\t\n\t return newKey;\n\t}\n\t\n\tfunction snakeToCamel(str) {\n\t var parts = str.split('_');\n\t return parts.reduce(function(p, c) {\n\t return p + c.charAt(0).toUpperCase() + c.slice(1);\n\t }, parts.shift());\n\t}\n\t\n\tfunction toSnakeCase(object, exceptions) {\n\t if (typeof object !== 'object' || assert.isArray(object) || object === null) {\n\t return object;\n\t }\n\t exceptions = exceptions || [];\n\t\n\t return Object.keys(object).reduce(function(p, key) {\n\t var newKey = exceptions.indexOf(key) === -1 ? camelToSnake(key) : key;\n\t p[newKey] = toSnakeCase(object[key]);\n\t return p;\n\t }, {});\n\t}\n\t\n\tfunction toCamelCase(object, exceptions) {\n\t if (typeof object !== 'object' || assert.isArray(object) || object === null) {\n\t return object;\n\t }\n\t\n\t exceptions = exceptions || [];\n\t\n\t return Object.keys(object).reduce(function(p, key) {\n\t var newKey = exceptions.indexOf(key) === -1 ? snakeToCamel(key) : key;\n\t p[newKey] = toCamelCase(object[key]);\n\t return p;\n\t }, {});\n\t}\n\t\n\tmodule.exports = {\n\t toSnakeCase: toSnakeCase,\n\t toCamelCase: toCamelCase,\n\t blacklist: blacklist,\n\t merge: merge,\n\t pick: pick,\n\t getKeysNotIn: getKeysNotIn,\n\t extend: extend\n\t};\n\n\n/***/ },\n/* 3 */\n/***/ function(module, exports) {\n\n\t/* WEBPACK VAR INJECTION */(function(global) {function redirect(url) {\n\t global.window.location = url;\n\t}\n\t\n\tfunction getDocument() {\n\t return global.window.document;\n\t}\n\t\n\tfunction getWindow() {\n\t return global.window;\n\t}\n\t\n\tmodule.exports = {\n\t redirect: redirect,\n\t getDocument: getDocument,\n\t getWindow: getWindow\n\t};\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/***/ },\n/* 4 */\n/***/ function(module, exports) {\n\n\tvar toString = Object.prototype.toString;\n\t\n\tfunction attribute(o, attr, type, text) {\n\t type = type === 'array' ? 'object' : type;\n\t if (o && typeof o[attr] !== type) {\n\t throw new Error(text);\n\t }\n\t}\n\t\n\tfunction variable(o, type, text) {\n\t if (typeof o !== type) {\n\t throw new Error(text);\n\t }\n\t}\n\t\n\tfunction value(o, values, text) {\n\t if (values.indexOf(o) === -1) {\n\t throw new Error(text);\n\t }\n\t}\n\t\n\tfunction check(o, config, attributes) {\n\t if (!config.optional || o) {\n\t variable(o, config.type, config.message);\n\t }\n\t if (config.type === 'object' && attributes) {\n\t var keys = Object.keys(attributes);\n\t\n\t for (var index = 0; index < keys.length; index++) {\n\t var a = keys[index];\n\t if (!attributes[a].optional || o[a]) {\n\t if (!attributes[a].condition || attributes[a].condition(o)) {\n\t attribute(o, a, attributes[a].type, attributes[a].message);\n\t if (attributes[a].values) {\n\t value(o[a], attributes[a].values, attributes[a].value_message);\n\t }\n\t }\n\t }\n\t }\n\t }\n\t}\n\t\n\t/**\n\t * Wrap `Array.isArray` Polyfill for IE9\n\t * source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray\n\t *\n\t * @param {Array} array\n\t * @private\n\t */\n\tfunction isArray(array) {\n\t if (this.supportsIsArray()) {\n\t return Array.isArray(array);\n\t }\n\t\n\t return toString.call(array) === '[object Array]';\n\t}\n\t\n\tfunction supportsIsArray() {\n\t return Array.isArray != null;\n\t}\n\t\n\tmodule.exports = {\n\t check: check,\n\t attribute: attribute,\n\t variable: variable,\n\t value: value,\n\t isArray: isArray,\n\t supportsIsArray: supportsIsArray\n\t};\n\n\n/***/ },\n/* 5 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar stringify = __webpack_require__(13);\n\tvar parse = __webpack_require__(12);\n\tvar formats = __webpack_require__(7);\n\t\n\tmodule.exports = {\n\t formats: formats,\n\t parse: parse,\n\t stringify: stringify\n\t};\n\n\n/***/ },\n/* 6 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar error = __webpack_require__(21);\n\tvar objectHelper = __webpack_require__(2);\n\t\n\tfunction wrapCallback(cb, options) {\n\t options = options || {};\n\t options.ignoreCasing = options.ignoreCasing ? options.ignoreCasing : false;\n\t\n\t return function(err, data) {\n\t var errObj;\n\t\n\t if (!err && !data) {\n\t return cb(error.buildResponse('generic_error', 'Something went wrong'));\n\t }\n\t\n\t if (!err && data.err) {\n\t err = data.err;\n\t data = null;\n\t }\n\t\n\t if (!err && data.error) {\n\t err = data;\n\t data = null;\n\t }\n\t\n\t if (err) {\n\t errObj = {\n\t original: err\n\t };\n\t\n\t if (err.response && err.response.statusCode) {\n\t errObj.statusCode = err.response.statusCode;\n\t }\n\t\n\t if (err.response && err.response.statusText) {\n\t errObj.statusText = err.response.statusText;\n\t }\n\t\n\t if (err.response && err.response.body) {\n\t err = err.response.body;\n\t }\n\t\n\t if (err.err) {\n\t err = err.err;\n\t }\n\t\n\t errObj.code = err.error || err.code || err.error_code || err.status || null;\n\t errObj.description =\n\t err.errorDescription ||\n\t err.error_description ||\n\t err.description ||\n\t err.error ||\n\t err.details ||\n\t err.err ||\n\t null;\n\t\n\t if (err.name) {\n\t errObj.name = err.name;\n\t }\n\t\n\t if (err.policy) {\n\t errObj.policy = err.policy;\n\t }\n\t\n\t return cb(errObj);\n\t }\n\t\n\t if (data.type && (data.type === 'text/html' || data.type === 'text/plain')) {\n\t return cb(null, data.text);\n\t }\n\t\n\t if (options.ignoreCasing) {\n\t return cb(null, data.body || data);\n\t }\n\t\n\t return cb(null, objectHelper.toCamelCase(data.body || data));\n\t };\n\t}\n\t\n\tmodule.exports = wrapCallback;\n\n\n/***/ },\n/* 7 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tvar replace = String.prototype.replace;\n\tvar percentTwenties = /%20/g;\n\t\n\tmodule.exports = {\n\t 'default': 'RFC3986',\n\t formatters: {\n\t RFC1738: function (value) {\n\t return replace.call(value, percentTwenties, '+');\n\t },\n\t RFC3986: function (value) {\n\t return value;\n\t }\n\t },\n\t RFC1738: 'RFC1738',\n\t RFC3986: 'RFC3986'\n\t};\n\n\n/***/ },\n/* 8 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tvar has = Object.prototype.hasOwnProperty;\n\t\n\tvar hexTable = (function () {\n\t var array = [];\n\t for (var i = 0; i < 256; ++i) {\n\t array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());\n\t }\n\t\n\t return array;\n\t}());\n\t\n\texports.arrayToObject = function (source, options) {\n\t var obj = options && options.plainObjects ? Object.create(null) : {};\n\t for (var i = 0; i < source.length; ++i) {\n\t if (typeof source[i] !== 'undefined') {\n\t obj[i] = source[i];\n\t }\n\t }\n\t\n\t return obj;\n\t};\n\t\n\texports.merge = function (target, source, options) {\n\t if (!source) {\n\t return target;\n\t }\n\t\n\t if (typeof source !== 'object') {\n\t if (Array.isArray(target)) {\n\t target.push(source);\n\t } else if (typeof target === 'object') {\n\t if (options.plainObjects || options.allowPrototypes || !has.call(Object.prototype, source)) {\n\t target[source] = true;\n\t }\n\t } else {\n\t return [target, source];\n\t }\n\t\n\t return target;\n\t }\n\t\n\t if (typeof target !== 'object') {\n\t return [target].concat(source);\n\t }\n\t\n\t var mergeTarget = target;\n\t if (Array.isArray(target) && !Array.isArray(source)) {\n\t mergeTarget = exports.arrayToObject(target, options);\n\t }\n\t\n\t if (Array.isArray(target) && Array.isArray(source)) {\n\t source.forEach(function (item, i) {\n\t if (has.call(target, i)) {\n\t if (target[i] && typeof target[i] === 'object') {\n\t target[i] = exports.merge(target[i], item, options);\n\t } else {\n\t target.push(item);\n\t }\n\t } else {\n\t target[i] = item;\n\t }\n\t });\n\t return target;\n\t }\n\t\n\t return Object.keys(source).reduce(function (acc, key) {\n\t var value = source[key];\n\t\n\t if (Object.prototype.hasOwnProperty.call(acc, key)) {\n\t acc[key] = exports.merge(acc[key], value, options);\n\t } else {\n\t acc[key] = value;\n\t }\n\t return acc;\n\t }, mergeTarget);\n\t};\n\t\n\texports.decode = function (str) {\n\t try {\n\t return decodeURIComponent(str.replace(/\\+/g, ' '));\n\t } catch (e) {\n\t return str;\n\t }\n\t};\n\t\n\texports.encode = function (str) {\n\t // This code was originally written by Brian White (mscdex) for the io.js core querystring library.\n\t // It has been adapted here for stricter adherence to RFC 3986\n\t if (str.length === 0) {\n\t return str;\n\t }\n\t\n\t var string = typeof str === 'string' ? str : String(str);\n\t\n\t var out = '';\n\t for (var i = 0; i < string.length; ++i) {\n\t var c = string.charCodeAt(i);\n\t\n\t if (\n\t c === 0x2D || // -\n\t c === 0x2E || // .\n\t c === 0x5F || // _\n\t c === 0x7E || // ~\n\t (c >= 0x30 && c <= 0x39) || // 0-9\n\t (c >= 0x41 && c <= 0x5A) || // a-z\n\t (c >= 0x61 && c <= 0x7A) // A-Z\n\t ) {\n\t out += string.charAt(i);\n\t continue;\n\t }\n\t\n\t if (c < 0x80) {\n\t out = out + hexTable[c];\n\t continue;\n\t }\n\t\n\t if (c < 0x800) {\n\t out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);\n\t continue;\n\t }\n\t\n\t if (c < 0xD800 || c >= 0xE000) {\n\t out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);\n\t continue;\n\t }\n\t\n\t i += 1;\n\t c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));\n\t out += hexTable[0xF0 | (c >> 18)] + hexTable[0x80 | ((c >> 12) & 0x3F)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]; // eslint-disable-line max-len\n\t }\n\t\n\t return out;\n\t};\n\t\n\texports.compact = function (obj, references) {\n\t if (typeof obj !== 'object' || obj === null) {\n\t return obj;\n\t }\n\t\n\t var refs = references || [];\n\t var lookup = refs.indexOf(obj);\n\t if (lookup !== -1) {\n\t return refs[lookup];\n\t }\n\t\n\t refs.push(obj);\n\t\n\t if (Array.isArray(obj)) {\n\t var compacted = [];\n\t\n\t for (var i = 0; i < obj.length; ++i) {\n\t if (obj[i] && typeof obj[i] === 'object') {\n\t compacted.push(exports.compact(obj[i], refs));\n\t } else if (typeof obj[i] !== 'undefined') {\n\t compacted.push(obj[i]);\n\t }\n\t }\n\t\n\t return compacted;\n\t }\n\t\n\t var keys = Object.keys(obj);\n\t keys.forEach(function (key) {\n\t obj[key] = exports.compact(obj[key], refs);\n\t });\n\t\n\t return obj;\n\t};\n\t\n\texports.isRegExp = function (obj) {\n\t return Object.prototype.toString.call(obj) === '[object RegExp]';\n\t};\n\t\n\texports.isBuffer = function (obj) {\n\t if (obj === null || typeof obj === 'undefined') {\n\t return false;\n\t }\n\t\n\t return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));\n\t};\n\n\n/***/ },\n/* 9 */\n/***/ function(module, exports) {\n\n\tmodule.exports = { raw: '8.9.2' };\n\n\n/***/ },\n/* 10 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* eslint-disable no-param-reassign */\n\tvar request = __webpack_require__(17);\n\tvar base64Url = __webpack_require__(20);\n\tvar version = __webpack_require__(9);\n\t\n\t// ------------------------------------------------ RequestWrapper\n\t\n\tfunction RequestWrapper(req) {\n\t this.request = req;\n\t this.method = req.method;\n\t this.url = req.url;\n\t this.body = req._data;\n\t this.headers = req._header;\n\t}\n\t\n\tRequestWrapper.prototype.abort = function() {\n\t this.request.abort();\n\t};\n\t\n\tRequestWrapper.prototype.getMethod = function() {\n\t return this.method;\n\t};\n\t\n\tRequestWrapper.prototype.getBody = function() {\n\t return this.body;\n\t};\n\t\n\tRequestWrapper.prototype.getUrl = function() {\n\t return this.url;\n\t};\n\t\n\tRequestWrapper.prototype.getHeaders = function() {\n\t return this.headers;\n\t};\n\t\n\t// ------------------------------------------------ RequestObj\n\t\n\tfunction RequestObj(req) {\n\t this.request = req;\n\t}\n\t\n\tRequestObj.prototype.set = function(key, value) {\n\t this.request = this.request.set(key, value);\n\t return this;\n\t};\n\t\n\tRequestObj.prototype.send = function(body) {\n\t this.request = this.request.send(body);\n\t return this;\n\t};\n\t\n\tRequestObj.prototype.withCredentials = function() {\n\t this.request = this.request.withCredentials();\n\t return this;\n\t};\n\t\n\tRequestObj.prototype.end = function(cb) {\n\t this.request = this.request.end(cb);\n\t return new RequestWrapper(this.request);\n\t};\n\t\n\t// ------------------------------------------------ RequestBuilder\n\t\n\tfunction RequestBuilder(options) {\n\t this._sendTelemetry = options._sendTelemetry === false ? options._sendTelemetry : true;\n\t this._telemetryInfo = options._telemetryInfo || null;\n\t this._timesToRetryFailedRequests = options._timesToRetryFailedRequests;\n\t this.headers = options.headers || {};\n\t}\n\t\n\tRequestBuilder.prototype.setCommonConfiguration = function(ongoingRequest, options) {\n\t options = options || {};\n\t\n\t if (options.noHeaders) {\n\t return ongoingRequest;\n\t }\n\t\n\t var headers = this.headers;\n\t ongoingRequest = ongoingRequest.set('Content-Type', 'application/json');\n\t\n\t var keys = Object.keys(this.headers);\n\t\n\t for (var a = 0; a < keys.length; a++) {\n\t ongoingRequest = ongoingRequest.set(keys[a], headers[keys[a]]);\n\t }\n\t\n\t if (this._sendTelemetry) {\n\t ongoingRequest = ongoingRequest.set('Auth0-Client', this.getTelemetryData());\n\t }\n\t if (this._timesToRetryFailedRequests > 0) {\n\t ongoingRequest = ongoingRequest.retry(this._timesToRetryFailedRequests);\n\t }\n\t return ongoingRequest;\n\t};\n\t\n\tRequestBuilder.prototype.getTelemetryData = function() {\n\t var clientInfo = this._telemetryInfo || { name: 'auth0.js', version: version.raw };\n\t var jsonClientInfo = JSON.stringify(clientInfo);\n\t return base64Url.encode(jsonClientInfo);\n\t};\n\t\n\tRequestBuilder.prototype.get = function(url, options) {\n\t return new RequestObj(this.setCommonConfiguration(request.get(url), options));\n\t};\n\t\n\tRequestBuilder.prototype.post = function(url, options) {\n\t return new RequestObj(this.setCommonConfiguration(request.post(url), options));\n\t};\n\t\n\tRequestBuilder.prototype.patch = function(url, options) {\n\t return new RequestObj(this.setCommonConfiguration(request.patch(url), options));\n\t};\n\t\n\tmodule.exports = RequestBuilder;\n\n\n/***/ },\n/* 11 */\n/***/ function(module, exports) {\n\n\t/* eslint-disable no-console */\n\t\n\tfunction Warn(options) {\n\t this.disableWarnings = options.disableWarnings;\n\t}\n\t\n\tWarn.prototype.warning = function(message) {\n\t if (this.disableWarnings) {\n\t return;\n\t }\n\t\n\t console.warn(message);\n\t};\n\t\n\tmodule.exports = Warn;\n\n\n/***/ },\n/* 12 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(8);\n\t\n\tvar has = Object.prototype.hasOwnProperty;\n\t\n\tvar defaults = {\n\t allowDots: false,\n\t allowPrototypes: false,\n\t arrayLimit: 20,\n\t decoder: utils.decode,\n\t delimiter: '&',\n\t depth: 5,\n\t parameterLimit: 1000,\n\t plainObjects: false,\n\t strictNullHandling: false\n\t};\n\t\n\tvar parseValues = function parseQueryStringValues(str, options) {\n\t var obj = {};\n\t var parts = str.split(options.delimiter, options.parameterLimit === Infinity ? undefined : options.parameterLimit);\n\t\n\t for (var i = 0; i < parts.length; ++i) {\n\t var part = parts[i];\n\t var pos = part.indexOf(']=') === -1 ? part.indexOf('=') : part.indexOf(']=') + 1;\n\t\n\t var key, val;\n\t if (pos === -1) {\n\t key = options.decoder(part);\n\t val = options.strictNullHandling ? null : '';\n\t } else {\n\t key = options.decoder(part.slice(0, pos));\n\t val = options.decoder(part.slice(pos + 1));\n\t }\n\t if (has.call(obj, key)) {\n\t obj[key] = [].concat(obj[key]).concat(val);\n\t } else {\n\t obj[key] = val;\n\t }\n\t }\n\t\n\t return obj;\n\t};\n\t\n\tvar parseObject = function parseObjectRecursive(chain, val, options) {\n\t if (!chain.length) {\n\t return val;\n\t }\n\t\n\t var root = chain.shift();\n\t\n\t var obj;\n\t if (root === '[]') {\n\t obj = [];\n\t obj = obj.concat(parseObject(chain, val, options));\n\t } else {\n\t obj = options.plainObjects ? Object.create(null) : {};\n\t var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;\n\t var index = parseInt(cleanRoot, 10);\n\t if (\n\t !isNaN(index) &&\n\t root !== cleanRoot &&\n\t String(index) === cleanRoot &&\n\t index >= 0 &&\n\t (options.parseArrays && index <= options.arrayLimit)\n\t ) {\n\t obj = [];\n\t obj[index] = parseObject(chain, val, options);\n\t } else {\n\t obj[cleanRoot] = parseObject(chain, val, options);\n\t }\n\t }\n\t\n\t return obj;\n\t};\n\t\n\tvar parseKeys = function parseQueryStringKeys(givenKey, val, options) {\n\t if (!givenKey) {\n\t return;\n\t }\n\t\n\t // Transform dot notation to bracket notation\n\t var key = options.allowDots ? givenKey.replace(/\\.([^.[]+)/g, '[$1]') : givenKey;\n\t\n\t // The regex chunks\n\t\n\t var brackets = /(\\[[^[\\]]*])/;\n\t var child = /(\\[[^[\\]]*])/g;\n\t\n\t // Get the parent\n\t\n\t var segment = brackets.exec(key);\n\t var parent = segment ? key.slice(0, segment.index) : key;\n\t\n\t // Stash the parent if it exists\n\t\n\t var keys = [];\n\t if (parent) {\n\t // If we aren't using plain objects, optionally prefix keys\n\t // that would overwrite object prototype properties\n\t if (!options.plainObjects && has.call(Object.prototype, parent)) {\n\t if (!options.allowPrototypes) {\n\t return;\n\t }\n\t }\n\t\n\t keys.push(parent);\n\t }\n\t\n\t // Loop through children appending to the array until we hit depth\n\t\n\t var i = 0;\n\t while ((segment = child.exec(key)) !== null && i < options.depth) {\n\t i += 1;\n\t if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {\n\t if (!options.allowPrototypes) {\n\t return;\n\t }\n\t }\n\t keys.push(segment[1]);\n\t }\n\t\n\t // If there's a remainder, just add whatever is left\n\t\n\t if (segment) {\n\t keys.push('[' + key.slice(segment.index) + ']');\n\t }\n\t\n\t return parseObject(keys, val, options);\n\t};\n\t\n\tmodule.exports = function (str, opts) {\n\t var options = opts || {};\n\t\n\t if (options.decoder !== null && options.decoder !== undefined && typeof options.decoder !== 'function') {\n\t throw new TypeError('Decoder has to be a function.');\n\t }\n\t\n\t options.delimiter = typeof options.delimiter === 'string' || utils.isRegExp(options.delimiter) ? options.delimiter : defaults.delimiter;\n\t options.depth = typeof options.depth === 'number' ? options.depth : defaults.depth;\n\t options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : defaults.arrayLimit;\n\t options.parseArrays = options.parseArrays !== false;\n\t options.decoder = typeof options.decoder === 'function' ? options.decoder : defaults.decoder;\n\t options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : defaults.allowDots;\n\t options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : defaults.plainObjects;\n\t options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : defaults.allowPrototypes;\n\t options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : defaults.parameterLimit;\n\t options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;\n\t\n\t if (str === '' || str === null || typeof str === 'undefined') {\n\t return options.plainObjects ? Object.create(null) : {};\n\t }\n\t\n\t var tempObj = typeof str === 'string' ? parseValues(str, options) : str;\n\t var obj = options.plainObjects ? Object.create(null) : {};\n\t\n\t // Iterate over the keys and setup the new object\n\t\n\t var keys = Object.keys(tempObj);\n\t for (var i = 0; i < keys.length; ++i) {\n\t var key = keys[i];\n\t var newObj = parseKeys(key, tempObj[key], options);\n\t obj = utils.merge(obj, newObj, options);\n\t }\n\t\n\t return utils.compact(obj);\n\t};\n\n\n/***/ },\n/* 13 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(8);\n\tvar formats = __webpack_require__(7);\n\t\n\tvar arrayPrefixGenerators = {\n\t brackets: function brackets(prefix) { // eslint-disable-line func-name-matching\n\t return prefix + '[]';\n\t },\n\t indices: function indices(prefix, key) { // eslint-disable-line func-name-matching\n\t return prefix + '[' + key + ']';\n\t },\n\t repeat: function repeat(prefix) { // eslint-disable-line func-name-matching\n\t return prefix;\n\t }\n\t};\n\t\n\tvar toISO = Date.prototype.toISOString;\n\t\n\tvar defaults = {\n\t delimiter: '&',\n\t encode: true,\n\t encoder: utils.encode,\n\t encodeValuesOnly: false,\n\t serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching\n\t return toISO.call(date);\n\t },\n\t skipNulls: false,\n\t strictNullHandling: false\n\t};\n\t\n\tvar stringify = function stringify( // eslint-disable-line func-name-matching\n\t object,\n\t prefix,\n\t generateArrayPrefix,\n\t strictNullHandling,\n\t skipNulls,\n\t encoder,\n\t filter,\n\t sort,\n\t allowDots,\n\t serializeDate,\n\t formatter,\n\t encodeValuesOnly\n\t) {\n\t var obj = object;\n\t if (typeof filter === 'function') {\n\t obj = filter(prefix, obj);\n\t } else if (obj instanceof Date) {\n\t obj = serializeDate(obj);\n\t } else if (obj === null) {\n\t if (strictNullHandling) {\n\t return encoder && !encodeValuesOnly ? encoder(prefix) : prefix;\n\t }\n\t\n\t obj = '';\n\t }\n\t\n\t if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || utils.isBuffer(obj)) {\n\t if (encoder) {\n\t var keyValue = encodeValuesOnly ? prefix : encoder(prefix);\n\t return [formatter(keyValue) + '=' + formatter(encoder(obj))];\n\t }\n\t return [formatter(prefix) + '=' + formatter(String(obj))];\n\t }\n\t\n\t var values = [];\n\t\n\t if (typeof obj === 'undefined') {\n\t return values;\n\t }\n\t\n\t var objKeys;\n\t if (Array.isArray(filter)) {\n\t objKeys = filter;\n\t } else {\n\t var keys = Object.keys(obj);\n\t objKeys = sort ? keys.sort(sort) : keys;\n\t }\n\t\n\t for (var i = 0; i < objKeys.length; ++i) {\n\t var key = objKeys[i];\n\t\n\t if (skipNulls && obj[key] === null) {\n\t continue;\n\t }\n\t\n\t if (Array.isArray(obj)) {\n\t values = values.concat(stringify(\n\t obj[key],\n\t generateArrayPrefix(prefix, key),\n\t generateArrayPrefix,\n\t strictNullHandling,\n\t skipNulls,\n\t encoder,\n\t filter,\n\t sort,\n\t allowDots,\n\t serializeDate,\n\t formatter,\n\t encodeValuesOnly\n\t ));\n\t } else {\n\t values = values.concat(stringify(\n\t obj[key],\n\t prefix + (allowDots ? '.' + key : '[' + key + ']'),\n\t generateArrayPrefix,\n\t strictNullHandling,\n\t skipNulls,\n\t encoder,\n\t filter,\n\t sort,\n\t allowDots,\n\t serializeDate,\n\t formatter,\n\t encodeValuesOnly\n\t ));\n\t }\n\t }\n\t\n\t return values;\n\t};\n\t\n\tmodule.exports = function (object, opts) {\n\t var obj = object;\n\t var options = opts || {};\n\t\n\t if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') {\n\t throw new TypeError('Encoder has to be a function.');\n\t }\n\t\n\t var delimiter = typeof options.delimiter === 'undefined' ? defaults.delimiter : options.delimiter;\n\t var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;\n\t var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : defaults.skipNulls;\n\t var encode = typeof options.encode === 'boolean' ? options.encode : defaults.encode;\n\t var encoder = typeof options.encoder === 'function' ? options.encoder : defaults.encoder;\n\t var sort = typeof options.sort === 'function' ? options.sort : null;\n\t var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots;\n\t var serializeDate = typeof options.serializeDate === 'function' ? options.serializeDate : defaults.serializeDate;\n\t var encodeValuesOnly = typeof options.encodeValuesOnly === 'boolean' ? options.encodeValuesOnly : defaults.encodeValuesOnly;\n\t if (typeof options.format === 'undefined') {\n\t options.format = formats.default;\n\t } else if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) {\n\t throw new TypeError('Unknown format option provided.');\n\t }\n\t var formatter = formats.formatters[options.format];\n\t var objKeys;\n\t var filter;\n\t\n\t if (typeof options.filter === 'function') {\n\t filter = options.filter;\n\t obj = filter('', obj);\n\t } else if (Array.isArray(options.filter)) {\n\t filter = options.filter;\n\t objKeys = filter;\n\t }\n\t\n\t var keys = [];\n\t\n\t if (typeof obj !== 'object' || obj === null) {\n\t return '';\n\t }\n\t\n\t var arrayFormat;\n\t if (options.arrayFormat in arrayPrefixGenerators) {\n\t arrayFormat = options.arrayFormat;\n\t } else if ('indices' in options) {\n\t arrayFormat = options.indices ? 'indices' : 'repeat';\n\t } else {\n\t arrayFormat = 'indices';\n\t }\n\t\n\t var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];\n\t\n\t if (!objKeys) {\n\t objKeys = Object.keys(obj);\n\t }\n\t\n\t if (sort) {\n\t objKeys.sort(sort);\n\t }\n\t\n\t for (var i = 0; i < objKeys.length; ++i) {\n\t var key = objKeys[i];\n\t\n\t if (skipNulls && obj[key] === null) {\n\t continue;\n\t }\n\t\n\t keys = keys.concat(stringify(\n\t obj[key],\n\t key,\n\t generateArrayPrefix,\n\t strictNullHandling,\n\t skipNulls,\n\t encode ? encoder : null,\n\t filter,\n\t sort,\n\t allowDots,\n\t serializeDate,\n\t formatter,\n\t encodeValuesOnly\n\t ));\n\t }\n\t\n\t return keys.join(delimiter);\n\t};\n\n\n/***/ },\n/* 14 */\n/***/ function(module, exports) {\n\n\t/**\n\t * Check if `obj` is an object.\n\t *\n\t * @param {Object} obj\n\t * @return {Boolean}\n\t * @api private\n\t */\n\t\n\tfunction isObject(obj) {\n\t return null !== obj && 'object' === typeof obj;\n\t}\n\t\n\tmodule.exports = isObject;\n\n\n/***/ },\n/* 15 */\n/***/ function(module, exports) {\n\n\t'use strict'\n\t\n\texports.byteLength = byteLength\n\texports.toByteArray = toByteArray\n\texports.fromByteArray = fromByteArray\n\t\n\tvar lookup = []\n\tvar revLookup = []\n\tvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\t\n\tvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\n\tfor (var i = 0, len = code.length; i < len; ++i) {\n\t lookup[i] = code[i]\n\t revLookup[code.charCodeAt(i)] = i\n\t}\n\t\n\trevLookup['-'.charCodeAt(0)] = 62\n\trevLookup['_'.charCodeAt(0)] = 63\n\t\n\tfunction placeHoldersCount (b64) {\n\t var len = b64.length\n\t if (len % 4 > 0) {\n\t throw new Error('Invalid string. Length must be a multiple of 4')\n\t }\n\t\n\t // the number of equal signs (place holders)\n\t // if there are two placeholders, than the two characters before it\n\t // represent one byte\n\t // if there is only one, then the three characters before it represent 2 bytes\n\t // this is just a cheap hack to not do indexOf twice\n\t return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0\n\t}\n\t\n\tfunction byteLength (b64) {\n\t // base64 is 4/3 + up to two characters of the original data\n\t return b64.length * 3 / 4 - placeHoldersCount(b64)\n\t}\n\t\n\tfunction toByteArray (b64) {\n\t var i, j, l, tmp, placeHolders, arr\n\t var len = b64.length\n\t placeHolders = placeHoldersCount(b64)\n\t\n\t arr = new Arr(len * 3 / 4 - placeHolders)\n\t\n\t // if there are placeholders, only get up to the last complete 4 chars\n\t l = placeHolders > 0 ? len - 4 : len\n\t\n\t var L = 0\n\t\n\t for (i = 0, j = 0; i < l; i += 4, j += 3) {\n\t tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]\n\t arr[L++] = (tmp >> 16) & 0xFF\n\t arr[L++] = (tmp >> 8) & 0xFF\n\t arr[L++] = tmp & 0xFF\n\t }\n\t\n\t if (placeHolders === 2) {\n\t tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)\n\t arr[L++] = tmp & 0xFF\n\t } else if (placeHolders === 1) {\n\t tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)\n\t arr[L++] = (tmp >> 8) & 0xFF\n\t arr[L++] = tmp & 0xFF\n\t }\n\t\n\t return arr\n\t}\n\t\n\tfunction tripletToBase64 (num) {\n\t return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]\n\t}\n\t\n\tfunction encodeChunk (uint8, start, end) {\n\t var tmp\n\t var output = []\n\t for (var i = start; i < end; i += 3) {\n\t tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\n\t output.push(tripletToBase64(tmp))\n\t }\n\t return output.join('')\n\t}\n\t\n\tfunction fromByteArray (uint8) {\n\t var tmp\n\t var len = uint8.length\n\t var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n\t var output = ''\n\t var parts = []\n\t var maxChunkLength = 16383 // must be multiple of 3\n\t\n\t // go through the array every three bytes, we'll deal with trailing stuff later\n\t for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n\t parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n\t }\n\t\n\t // pad the end with zeros, but make sure to not forget the extra bytes\n\t if (extraBytes === 1) {\n\t tmp = uint8[len - 1]\n\t output += lookup[tmp >> 2]\n\t output += lookup[(tmp << 4) & 0x3F]\n\t output += '=='\n\t } else if (extraBytes === 2) {\n\t tmp = (uint8[len - 2] << 8) + (uint8[len - 1])\n\t output += lookup[tmp >> 10]\n\t output += lookup[(tmp >> 4) & 0x3F]\n\t output += lookup[(tmp << 2) & 0x3F]\n\t output += '='\n\t }\n\t\n\t parts.push(output)\n\t\n\t return parts.join('')\n\t}\n\n\n/***/ },\n/* 16 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar base64 = __webpack_require__(15);\n\t\n\tfunction padding(str) {\n\t var mod = (str.length % 4);\n\t var pad = 4 - mod;\n\t\n\t if (mod === 0) {\n\t return str;\n\t }\n\t\n\t return str + (new Array(1 + pad)).join('=');\n\t}\n\t\n\tfunction byteArrayToString(array) {\n\t var result = \"\";\n\t for (var i = 0; i < array.length; i++) {\n\t result += String.fromCharCode(array[i]);\n\t }\n\t return result;\n\t}\n\t\n\tfunction stringToByteArray(str) {\n\t var arr = new Array(str.length);\n\t for (var a = 0; a < str.length; a++) {\n\t arr[a] = str.charCodeAt(a);\n\t }\n\t return arr;\n\t}\n\t\n\tfunction byteArrayToHex(raw) {\n\t var HEX = '';\n\t\n\t for (var i = 0; i < raw.length; i++) {\n\t var _hex = raw[i].toString(16);\n\t HEX += (_hex.length === 2 ? _hex : '0' + _hex);\n\t }\n\t\n\t return HEX;\n\t}\n\t\n\tfunction encodeString(str) {\n\t return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {\n\t return String.fromCharCode('0x' + p1);\n\t }))\n\t .replace(/\\+/g, '-') // Convert '+' to '-'\n\t .replace(/\\//g, '_'); // Convert '/' to '_';\n\t}\n\t\n\tfunction decodeToString(str) {\n\t str = padding(str)\n\t .replace(/\\-/g, '+') // Convert '-' to '+'\n\t .replace(/_/g, '/'); // Convert '_' to '/'\n\t\n\t return decodeURIComponent(atob(str).split('').map(function (c) {\n\t return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n\t }).join(''));\n\t}\n\t\n\tfunction decodeToHEX(str) {\n\t return byteArrayToHex(base64.toByteArray(padding(str)));\n\t}\n\t\n\tmodule.exports = {\n\t encodeString: encodeString,\n\t decodeToString: decodeToString,\n\t byteArrayToString: byteArrayToString,\n\t stringToByteArray: stringToByteArray,\n\t padding: padding,\n\t byteArrayToHex: byteArrayToHex,\n\t decodeToHEX: decodeToHEX\n\t};\n\n\n/***/ },\n/* 17 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Root reference for iframes.\n\t */\n\t\n\tvar root;\n\tif (typeof window !== 'undefined') { // Browser window\n\t root = window;\n\t} else if (typeof self !== 'undefined') { // Web Worker\n\t root = self;\n\t} else { // Other environments\n\t console.warn(\"Using browser-only version of superagent in non-browser environment\");\n\t root = this;\n\t}\n\t\n\tvar Emitter = __webpack_require__(23);\n\tvar RequestBase = __webpack_require__(33);\n\tvar isObject = __webpack_require__(14);\n\tvar isFunction = __webpack_require__(32);\n\tvar ResponseBase = __webpack_require__(34);\n\tvar shouldRetry = __webpack_require__(35);\n\t\n\t/**\n\t * Noop.\n\t */\n\t\n\tfunction noop(){};\n\t\n\t/**\n\t * Expose `request`.\n\t */\n\t\n\tvar request = exports = module.exports = function(method, url) {\n\t // callback\n\t if ('function' == typeof url) {\n\t return new exports.Request('GET', method).end(url);\n\t }\n\t\n\t // url first\n\t if (1 == arguments.length) {\n\t return new exports.Request('GET', method);\n\t }\n\t\n\t return new exports.Request(method, url);\n\t}\n\t\n\texports.Request = Request;\n\t\n\t/**\n\t * Determine XHR.\n\t */\n\t\n\trequest.getXHR = function () {\n\t if (root.XMLHttpRequest\n\t && (!root.location || 'file:' != root.location.protocol\n\t || !root.ActiveXObject)) {\n\t return new XMLHttpRequest;\n\t } else {\n\t try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {}\n\t try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch(e) {}\n\t try { return new ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch(e) {}\n\t try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) {}\n\t }\n\t throw Error(\"Browser-only verison of superagent could not find XHR\");\n\t};\n\t\n\t/**\n\t * Removes leading and trailing whitespace, added to support IE.\n\t *\n\t * @param {String} s\n\t * @return {String}\n\t * @api private\n\t */\n\t\n\tvar trim = ''.trim\n\t ? function(s) { return s.trim(); }\n\t : function(s) { return s.replace(/(^\\s*|\\s*$)/g, ''); };\n\t\n\t/**\n\t * Serialize the given `obj`.\n\t *\n\t * @param {Object} obj\n\t * @return {String}\n\t * @api private\n\t */\n\t\n\tfunction serialize(obj) {\n\t if (!isObject(obj)) return obj;\n\t var pairs = [];\n\t for (var key in obj) {\n\t pushEncodedKeyValuePair(pairs, key, obj[key]);\n\t }\n\t return pairs.join('&');\n\t}\n\t\n\t/**\n\t * Helps 'serialize' with serializing arrays.\n\t * Mutates the pairs array.\n\t *\n\t * @param {Array} pairs\n\t * @param {String} key\n\t * @param {Mixed} val\n\t */\n\t\n\tfunction pushEncodedKeyValuePair(pairs, key, val) {\n\t if (val != null) {\n\t if (Array.isArray(val)) {\n\t val.forEach(function(v) {\n\t pushEncodedKeyValuePair(pairs, key, v);\n\t });\n\t } else if (isObject(val)) {\n\t for(var subkey in val) {\n\t pushEncodedKeyValuePair(pairs, key + '[' + subkey + ']', val[subkey]);\n\t }\n\t } else {\n\t pairs.push(encodeURIComponent(key)\n\t + '=' + encodeURIComponent(val));\n\t }\n\t } else if (val === null) {\n\t pairs.push(encodeURIComponent(key));\n\t }\n\t}\n\t\n\t/**\n\t * Expose serialization method.\n\t */\n\t\n\t request.serializeObject = serialize;\n\t\n\t /**\n\t * Parse the given x-www-form-urlencoded `str`.\n\t *\n\t * @param {String} str\n\t * @return {Object}\n\t * @api private\n\t */\n\t\n\tfunction parseString(str) {\n\t var obj = {};\n\t var pairs = str.split('&');\n\t var pair;\n\t var pos;\n\t\n\t for (var i = 0, len = pairs.length; i < len; ++i) {\n\t pair = pairs[i];\n\t pos = pair.indexOf('=');\n\t if (pos == -1) {\n\t obj[decodeURIComponent(pair)] = '';\n\t } else {\n\t obj[decodeURIComponent(pair.slice(0, pos))] =\n\t decodeURIComponent(pair.slice(pos + 1));\n\t }\n\t }\n\t\n\t return obj;\n\t}\n\t\n\t/**\n\t * Expose parser.\n\t */\n\t\n\trequest.parseString = parseString;\n\t\n\t/**\n\t * Default MIME type map.\n\t *\n\t * superagent.types.xml = 'application/xml';\n\t *\n\t */\n\t\n\trequest.types = {\n\t html: 'text/html',\n\t json: 'application/json',\n\t xml: 'application/xml',\n\t urlencoded: 'application/x-www-form-urlencoded',\n\t 'form': 'application/x-www-form-urlencoded',\n\t 'form-data': 'application/x-www-form-urlencoded'\n\t};\n\t\n\t/**\n\t * Default serialization map.\n\t *\n\t * superagent.serialize['application/xml'] = function(obj){\n\t * return 'generated xml here';\n\t * };\n\t *\n\t */\n\t\n\t request.serialize = {\n\t 'application/x-www-form-urlencoded': serialize,\n\t 'application/json': JSON.stringify\n\t };\n\t\n\t /**\n\t * Default parsers.\n\t *\n\t * superagent.parse['application/xml'] = function(str){\n\t * return { object parsed from str };\n\t * };\n\t *\n\t */\n\t\n\trequest.parse = {\n\t 'application/x-www-form-urlencoded': parseString,\n\t 'application/json': JSON.parse\n\t};\n\t\n\t/**\n\t * Parse the given header `str` into\n\t * an object containing the mapped fields.\n\t *\n\t * @param {String} str\n\t * @return {Object}\n\t * @api private\n\t */\n\t\n\tfunction parseHeader(str) {\n\t var lines = str.split(/\\r?\\n/);\n\t var fields = {};\n\t var index;\n\t var line;\n\t var field;\n\t var val;\n\t\n\t lines.pop(); // trailing CRLF\n\t\n\t for (var i = 0, len = lines.length; i < len; ++i) {\n\t line = lines[i];\n\t index = line.indexOf(':');\n\t field = line.slice(0, index).toLowerCase();\n\t val = trim(line.slice(index + 1));\n\t fields[field] = val;\n\t }\n\t\n\t return fields;\n\t}\n\t\n\t/**\n\t * Check if `mime` is json or has +json structured syntax suffix.\n\t *\n\t * @param {String} mime\n\t * @return {Boolean}\n\t * @api private\n\t */\n\t\n\tfunction isJSON(mime) {\n\t return /[\\/+]json\\b/.test(mime);\n\t}\n\t\n\t/**\n\t * Initialize a new `Response` with the given `xhr`.\n\t *\n\t * - set flags (.ok, .error, etc)\n\t * - parse header\n\t *\n\t * Examples:\n\t *\n\t * Aliasing `superagent` as `request` is nice:\n\t *\n\t * request = superagent;\n\t *\n\t * We can use the promise-like API, or pass callbacks:\n\t *\n\t * request.get('/').end(function(res){});\n\t * request.get('/', function(res){});\n\t *\n\t * Sending data can be chained:\n\t *\n\t * request\n\t * .post('/user')\n\t * .send({ name: 'tj' })\n\t * .end(function(res){});\n\t *\n\t * Or passed to `.send()`:\n\t *\n\t * request\n\t * .post('/user')\n\t * .send({ name: 'tj' }, function(res){});\n\t *\n\t * Or passed to `.post()`:\n\t *\n\t * request\n\t * .post('/user', { name: 'tj' })\n\t * .end(function(res){});\n\t *\n\t * Or further reduced to a single call for simple cases:\n\t *\n\t * request\n\t * .post('/user', { name: 'tj' }, function(res){});\n\t *\n\t * @param {XMLHTTPRequest} xhr\n\t * @param {Object} options\n\t * @api private\n\t */\n\t\n\tfunction Response(req) {\n\t this.req = req;\n\t this.xhr = this.req.xhr;\n\t // responseText is accessible only if responseType is '' or 'text' and on older browsers\n\t this.text = ((this.req.method !='HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text')) || typeof this.xhr.responseType === 'undefined')\n\t ? this.xhr.responseText\n\t : null;\n\t this.statusText = this.req.xhr.statusText;\n\t var status = this.xhr.status;\n\t // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n\t if (status === 1223) {\n\t status = 204;\n\t }\n\t this._setStatusProperties(status);\n\t this.header = this.headers = parseHeader(this.xhr.getAllResponseHeaders());\n\t // getAllResponseHeaders sometimes falsely returns \"\" for CORS requests, but\n\t // getResponseHeader still works. so we get content-type even if getting\n\t // other headers fails.\n\t this.header['content-type'] = this.xhr.getResponseHeader('content-type');\n\t this._setHeaderProperties(this.header);\n\t\n\t if (null === this.text && req._responseType) {\n\t this.body = this.xhr.response;\n\t } else {\n\t this.body = this.req.method != 'HEAD'\n\t ? this._parseBody(this.text ? this.text : this.xhr.response)\n\t : null;\n\t }\n\t}\n\t\n\tResponseBase(Response.prototype);\n\t\n\t/**\n\t * Parse the given body `str`.\n\t *\n\t * Used for auto-parsing of bodies. Parsers\n\t * are defined on the `superagent.parse` object.\n\t *\n\t * @param {String} str\n\t * @return {Mixed}\n\t * @api private\n\t */\n\t\n\tResponse.prototype._parseBody = function(str){\n\t var parse = request.parse[this.type];\n\t if(this.req._parser) {\n\t return this.req._parser(this, str);\n\t }\n\t if (!parse && isJSON(this.type)) {\n\t parse = request.parse['application/json'];\n\t }\n\t return parse && str && (str.length || str instanceof Object)\n\t ? parse(str)\n\t : null;\n\t};\n\t\n\t/**\n\t * Return an `Error` representative of this response.\n\t *\n\t * @return {Error}\n\t * @api public\n\t */\n\t\n\tResponse.prototype.toError = function(){\n\t var req = this.req;\n\t var method = req.method;\n\t var url = req.url;\n\t\n\t var msg = 'cannot ' + method + ' ' + url + ' (' + this.status + ')';\n\t var err = new Error(msg);\n\t err.status = this.status;\n\t err.method = method;\n\t err.url = url;\n\t\n\t return err;\n\t};\n\t\n\t/**\n\t * Expose `Response`.\n\t */\n\t\n\trequest.Response = Response;\n\t\n\t/**\n\t * Initialize a new `Request` with the given `method` and `url`.\n\t *\n\t * @param {String} method\n\t * @param {String} url\n\t * @api public\n\t */\n\t\n\tfunction Request(method, url) {\n\t var self = this;\n\t this._query = this._query || [];\n\t this.method = method;\n\t this.url = url;\n\t this.header = {}; // preserves header name case\n\t this._header = {}; // coerces header names to lowercase\n\t this.on('end', function(){\n\t var err = null;\n\t var res = null;\n\t\n\t try {\n\t res = new Response(self);\n\t } catch(e) {\n\t err = new Error('Parser is unable to parse the response');\n\t err.parse = true;\n\t err.original = e;\n\t // issue #675: return the raw response if the response parsing fails\n\t if (self.xhr) {\n\t // ie9 doesn't have 'response' property\n\t err.rawResponse = typeof self.xhr.responseType == 'undefined' ? self.xhr.responseText : self.xhr.response;\n\t // issue #876: return the http status code if the response parsing fails\n\t err.status = self.xhr.status ? self.xhr.status : null;\n\t err.statusCode = err.status; // backwards-compat only\n\t } else {\n\t err.rawResponse = null;\n\t err.status = null;\n\t }\n\t\n\t return self.callback(err);\n\t }\n\t\n\t self.emit('response', res);\n\t\n\t var new_err;\n\t try {\n\t if (!self._isResponseOK(res)) {\n\t new_err = new Error(res.statusText || 'Unsuccessful HTTP response');\n\t new_err.original = err;\n\t new_err.response = res;\n\t new_err.status = res.status;\n\t }\n\t } catch(e) {\n\t new_err = e; // #985 touching res may cause INVALID_STATE_ERR on old Android\n\t }\n\t\n\t // #1000 don't catch errors from the callback to avoid double calling it\n\t if (new_err) {\n\t self.callback(new_err, res);\n\t } else {\n\t self.callback(null, res);\n\t }\n\t });\n\t}\n\t\n\t/**\n\t * Mixin `Emitter` and `RequestBase`.\n\t */\n\t\n\tEmitter(Request.prototype);\n\tRequestBase(Request.prototype);\n\t\n\t/**\n\t * Set Content-Type to `type`, mapping values from `request.types`.\n\t *\n\t * Examples:\n\t *\n\t * superagent.types.xml = 'application/xml';\n\t *\n\t * request.post('/')\n\t * .type('xml')\n\t * .send(xmlstring)\n\t * .end(callback);\n\t *\n\t * request.post('/')\n\t * .type('application/xml')\n\t * .send(xmlstring)\n\t * .end(callback);\n\t *\n\t * @param {String} type\n\t * @return {Request} for chaining\n\t * @api public\n\t */\n\t\n\tRequest.prototype.type = function(type){\n\t this.set('Content-Type', request.types[type] || type);\n\t return this;\n\t};\n\t\n\t/**\n\t * Set Accept to `type`, mapping values from `request.types`.\n\t *\n\t * Examples:\n\t *\n\t * superagent.types.json = 'application/json';\n\t *\n\t * request.get('/agent')\n\t * .accept('json')\n\t * .end(callback);\n\t *\n\t * request.get('/agent')\n\t * .accept('application/json')\n\t * .end(callback);\n\t *\n\t * @param {String} accept\n\t * @return {Request} for chaining\n\t * @api public\n\t */\n\t\n\tRequest.prototype.accept = function(type){\n\t this.set('Accept', request.types[type] || type);\n\t return this;\n\t};\n\t\n\t/**\n\t * Set Authorization field value with `user` and `pass`.\n\t *\n\t * @param {String} user\n\t * @param {String} [pass] optional in case of using 'bearer' as type\n\t * @param {Object} options with 'type' property 'auto', 'basic' or 'bearer' (default 'basic')\n\t * @return {Request} for chaining\n\t * @api public\n\t */\n\t\n\tRequest.prototype.auth = function(user, pass, options){\n\t if (typeof pass === 'object' && pass !== null) { // pass is optional and can substitute for options\n\t options = pass;\n\t }\n\t if (!options) {\n\t options = {\n\t type: 'function' === typeof btoa ? 'basic' : 'auto',\n\t }\n\t }\n\t\n\t switch (options.type) {\n\t case 'basic':\n\t this.set('Authorization', 'Basic ' + btoa(user + ':' + pass));\n\t break;\n\t\n\t case 'auto':\n\t this.username = user;\n\t this.password = pass;\n\t break;\n\t \n\t case 'bearer': // usage would be .auth(accessToken, { type: 'bearer' })\n\t this.set('Authorization', 'Bearer ' + user);\n\t break; \n\t }\n\t return this;\n\t};\n\t\n\t/**\n\t * Add query-string `val`.\n\t *\n\t * Examples:\n\t *\n\t * request.get('/shoes')\n\t * .query('size=10')\n\t * .query({ color: 'blue' })\n\t *\n\t * @param {Object|String} val\n\t * @return {Request} for chaining\n\t * @api public\n\t */\n\t\n\tRequest.prototype.query = function(val){\n\t if ('string' != typeof val) val = serialize(val);\n\t if (val) this._query.push(val);\n\t return this;\n\t};\n\t\n\t/**\n\t * Queue the given `file` as an attachment to the specified `field`,\n\t * with optional `options` (or filename).\n\t *\n\t * ``` js\n\t * request.post('/upload')\n\t * .attach('content', new Blob(['hey!'], { type: \"text/html\"}))\n\t * .end(callback);\n\t * ```\n\t *\n\t * @param {String} field\n\t * @param {Blob|File} file\n\t * @param {String|Object} options\n\t * @return {Request} for chaining\n\t * @api public\n\t */\n\t\n\tRequest.prototype.attach = function(field, file, options){\n\t if (file) {\n\t if (this._data) {\n\t throw Error(\"superagent can't mix .send() and .attach()\");\n\t }\n\t\n\t this._getFormData().append(field, file, options || file.name);\n\t }\n\t return this;\n\t};\n\t\n\tRequest.prototype._getFormData = function(){\n\t if (!this._formData) {\n\t this._formData = new root.FormData();\n\t }\n\t return this._formData;\n\t};\n\t\n\t/**\n\t * Invoke the callback with `err` and `res`\n\t * and handle arity check.\n\t *\n\t * @param {Error} err\n\t * @param {Response} res\n\t * @api private\n\t */\n\t\n\tRequest.prototype.callback = function(err, res){\n\t // console.log(this._retries, this._maxRetries)\n\t if (this._maxRetries && this._retries++ < this._maxRetries && shouldRetry(err, res)) {\n\t return this._retry();\n\t }\n\t\n\t var fn = this._callback;\n\t this.clearTimeout();\n\t\n\t if (err) {\n\t if (this._maxRetries) err.retries = this._retries - 1;\n\t this.emit('error', err);\n\t }\n\t\n\t fn(err, res);\n\t};\n\t\n\t/**\n\t * Invoke callback with x-domain error.\n\t *\n\t * @api private\n\t */\n\t\n\tRequest.prototype.crossDomainError = function(){\n\t var err = new Error('Request has been terminated\\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.');\n\t err.crossDomain = true;\n\t\n\t err.status = this.status;\n\t err.method = this.method;\n\t err.url = this.url;\n\t\n\t this.callback(err);\n\t};\n\t\n\t// This only warns, because the request is still likely to work\n\tRequest.prototype.buffer = Request.prototype.ca = Request.prototype.agent = function(){\n\t console.warn(\"This is not supported in browser version of superagent\");\n\t return this;\n\t};\n\t\n\t// This throws, because it can't send/receive data as expected\n\tRequest.prototype.pipe = Request.prototype.write = function(){\n\t throw Error(\"Streaming is not supported in browser version of superagent\");\n\t};\n\t\n\t/**\n\t * Compose querystring to append to req.url\n\t *\n\t * @api private\n\t */\n\t\n\tRequest.prototype._appendQueryString = function(){\n\t var query = this._query.join('&');\n\t if (query) {\n\t this.url += (this.url.indexOf('?') >= 0 ? '&' : '?') + query;\n\t }\n\t\n\t if (this._sort) {\n\t var index = this.url.indexOf('?');\n\t if (index >= 0) {\n\t var queryArr = this.url.substring(index + 1).split('&');\n\t if (isFunction(this._sort)) {\n\t queryArr.sort(this._sort);\n\t } else {\n\t queryArr.sort();\n\t }\n\t this.url = this.url.substring(0, index) + '?' + queryArr.join('&');\n\t }\n\t }\n\t};\n\t\n\t/**\n\t * Check if `obj` is a host object,\n\t * we don't want to serialize these :)\n\t *\n\t * @param {Object} obj\n\t * @return {Boolean}\n\t * @api private\n\t */\n\tRequest.prototype._isHost = function _isHost(obj) {\n\t // Native objects stringify to [object File], [object Blob], [object FormData], etc.\n\t return obj && 'object' === typeof obj && !Array.isArray(obj) && Object.prototype.toString.call(obj) !== '[object Object]';\n\t}\n\t\n\t/**\n\t * Initiate request, invoking callback `fn(res)`\n\t * with an instanceof `Response`.\n\t *\n\t * @param {Function} fn\n\t * @return {Request} for chaining\n\t * @api public\n\t */\n\t\n\tRequest.prototype.end = function(fn){\n\t if (this._endCalled) {\n\t console.warn(\"Warning: .end() was called twice. This is not supported in superagent\");\n\t }\n\t this._endCalled = true;\n\t\n\t // store callback\n\t this._callback = fn || noop;\n\t\n\t // querystring\n\t this._appendQueryString();\n\t\n\t return this._end();\n\t};\n\t\n\tRequest.prototype._end = function() {\n\t var self = this;\n\t var xhr = this.xhr = request.getXHR();\n\t var data = this._formData || this._data;\n\t\n\t this._setTimeouts();\n\t\n\t // state change\n\t xhr.onreadystatechange = function(){\n\t var readyState = xhr.readyState;\n\t if (readyState >= 2 && self._responseTimeoutTimer) {\n\t clearTimeout(self._responseTimeoutTimer);\n\t }\n\t if (4 != readyState) {\n\t return;\n\t }\n\t\n\t // In IE9, reads to any property (e.g. status) off of an aborted XHR will\n\t // result in the error \"Could not complete the operation due to error c00c023f\"\n\t var status;\n\t try { status = xhr.status } catch(e) { status = 0; }\n\t\n\t if (!status) {\n\t if (self.timedout || self._aborted) return;\n\t return self.crossDomainError();\n\t }\n\t self.emit('end');\n\t };\n\t\n\t // progress\n\t var handleProgress = function(direction, e) {\n\t if (e.total > 0) {\n\t e.percent = e.loaded / e.total * 100;\n\t }\n\t e.direction = direction;\n\t self.emit('progress', e);\n\t }\n\t if (this.hasListeners('progress')) {\n\t try {\n\t xhr.onprogress = handleProgress.bind(null, 'download');\n\t if (xhr.upload) {\n\t xhr.upload.onprogress = handleProgress.bind(null, 'upload');\n\t }\n\t } catch(e) {\n\t // Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist.\n\t // Reported here:\n\t // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context\n\t }\n\t }\n\t\n\t // initiate request\n\t try {\n\t if (this.username && this.password) {\n\t xhr.open(this.method, this.url, true, this.username, this.password);\n\t } else {\n\t xhr.open(this.method, this.url, true);\n\t }\n\t } catch (err) {\n\t // see #1149\n\t return this.callback(err);\n\t }\n\t\n\t // CORS\n\t if (this._withCredentials) xhr.withCredentials = true;\n\t\n\t // body\n\t if (!this._formData && 'GET' != this.method && 'HEAD' != this.method && 'string' != typeof data && !this._isHost(data)) {\n\t // serialize stuff\n\t var contentType = this._header['content-type'];\n\t var serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : ''];\n\t if (!serialize && isJSON(contentType)) {\n\t serialize = request.serialize['application/json'];\n\t }\n\t if (serialize) data = serialize(data);\n\t }\n\t\n\t // set header fields\n\t for (var field in this.header) {\n\t if (null == this.header[field]) continue;\n\t xhr.setRequestHeader(field, this.header[field]);\n\t }\n\t\n\t if (this._responseType) {\n\t xhr.responseType = this._responseType;\n\t }\n\t\n\t // send stuff\n\t this.emit('request', this);\n\t\n\t // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing)\n\t // We need null here if data is undefined\n\t xhr.send(typeof data !== 'undefined' ? data : null);\n\t return this;\n\t};\n\t\n\t/**\n\t * GET `url` with optional callback `fn(res)`.\n\t *\n\t * @param {String} url\n\t * @param {Mixed|Function} [data] or fn\n\t * @param {Function} [fn]\n\t * @return {Request}\n\t * @api public\n\t */\n\t\n\trequest.get = function(url, data, fn){\n\t var req = request('GET', url);\n\t if ('function' == typeof data) fn = data, data = null;\n\t if (data) req.query(data);\n\t if (fn) req.end(fn);\n\t return req;\n\t};\n\t\n\t/**\n\t * HEAD `url` with optional callback `fn(res)`.\n\t *\n\t * @param {String} url\n\t * @param {Mixed|Function} [data] or fn\n\t * @param {Function} [fn]\n\t * @return {Request}\n\t * @api public\n\t */\n\t\n\trequest.head = function(url, data, fn){\n\t var req = request('HEAD', url);\n\t if ('function' == typeof data) fn = data, data = null;\n\t if (data) req.send(data);\n\t if (fn) req.end(fn);\n\t return req;\n\t};\n\t\n\t/**\n\t * OPTIONS query to `url` with optional callback `fn(res)`.\n\t *\n\t * @param {String} url\n\t * @param {Mixed|Function} [data] or fn\n\t * @param {Function} [fn]\n\t * @return {Request}\n\t * @api public\n\t */\n\t\n\trequest.options = function(url, data, fn){\n\t var req = request('OPTIONS', url);\n\t if ('function' == typeof data) fn = data, data = null;\n\t if (data) req.send(data);\n\t if (fn) req.end(fn);\n\t return req;\n\t};\n\t\n\t/**\n\t * DELETE `url` with optional `data` and callback `fn(res)`.\n\t *\n\t * @param {String} url\n\t * @param {Mixed} [data]\n\t * @param {Function} [fn]\n\t * @return {Request}\n\t * @api public\n\t */\n\t\n\tfunction del(url, data, fn){\n\t var req = request('DELETE', url);\n\t if ('function' == typeof data) fn = data, data = null;\n\t if (data) req.send(data);\n\t if (fn) req.end(fn);\n\t return req;\n\t};\n\t\n\trequest['del'] = del;\n\trequest['delete'] = del;\n\t\n\t/**\n\t * PATCH `url` with optional `data` and callback `fn(res)`.\n\t *\n\t * @param {String} url\n\t * @param {Mixed} [data]\n\t * @param {Function} [fn]\n\t * @return {Request}\n\t * @api public\n\t */\n\t\n\trequest.patch = function(url, data, fn){\n\t var req = request('PATCH', url);\n\t if ('function' == typeof data) fn = data, data = null;\n\t if (data) req.send(data);\n\t if (fn) req.end(fn);\n\t return req;\n\t};\n\t\n\t/**\n\t * POST `url` with optional `data` and callback `fn(res)`.\n\t *\n\t * @param {String} url\n\t * @param {Mixed} [data]\n\t * @param {Function} [fn]\n\t * @return {Request}\n\t * @api public\n\t */\n\t\n\trequest.post = function(url, data, fn){\n\t var req = request('POST', url);\n\t if ('function' == typeof data) fn = data, data = null;\n\t if (data) req.send(data);\n\t if (fn) req.end(fn);\n\t return req;\n\t};\n\t\n\t/**\n\t * PUT `url` with optional `data` and callback `fn(res)`.\n\t *\n\t * @param {String} url\n\t * @param {Mixed|Function} [data] or fn\n\t * @param {Function} [fn]\n\t * @return {Request}\n\t * @api public\n\t */\n\t\n\trequest.put = function(url, data, fn){\n\t var req = request('PUT', url);\n\t if ('function' == typeof data) fn = data, data = null;\n\t if (data) req.send(data);\n\t if (fn) req.end(fn);\n\t return req;\n\t};\n\n\n/***/ },\n/* 18 */\n/***/ function(module, exports) {\n\n\tvar WinChan = (function() {\n\t var RELAY_FRAME_NAME = \"__winchan_relay_frame\";\n\t var CLOSE_CMD = \"die\";\n\t\n\t // a portable addListener implementation\n\t function addListener(w, event, cb) {\n\t if(w.attachEvent) w.attachEvent('on' + event, cb);\n\t else if (w.addEventListener) w.addEventListener(event, cb, false);\n\t }\n\t\n\t // a portable removeListener implementation\n\t function removeListener(w, event, cb) {\n\t if(w.detachEvent) w.detachEvent('on' + event, cb);\n\t else if (w.removeEventListener) w.removeEventListener(event, cb, false);\n\t }\n\t\n\t\n\t // checking for IE8 or above\n\t function isInternetExplorer() {\n\t if (typeof navigator === 'undefined') {\n\t return false;\n\t }\n\t\n\t var rv = -1; // Return value assumes failure.\n\t var ua = navigator.userAgent;\n\t if (navigator.appName === 'Microsoft Internet Explorer') {\n\t var re = new RegExp(\"MSIE ([0-9]{1,}[\\.0-9]{0,})\");\n\t if (re.exec(ua) != null)\n\t rv = parseFloat(RegExp.$1);\n\t }\n\t // IE > 11\n\t else if (ua.indexOf(\"Trident\") > -1) {\n\t var re = new RegExp(\"rv:([0-9]{2,2}[\\.0-9]{0,})\");\n\t if (re.exec(ua) !== null) {\n\t rv = parseFloat(RegExp.$1);\n\t }\n\t }\n\t\n\t return rv >= 8;\n\t }\n\t\n\t // checking Mobile Firefox (Fennec)\n\t function isFennec() {\n\t try {\n\t // We must check for both XUL and Java versions of Fennec. Both have\n\t // distinct UA strings.\n\t var userAgent = navigator.userAgent;\n\t return (userAgent.indexOf('Fennec/') != -1) || // XUL\n\t (userAgent.indexOf('Firefox/') != -1 && userAgent.indexOf('Android') != -1); // Java\n\t } catch(e) {}\n\t return false;\n\t }\n\t\n\t // feature checking to see if this platform is supported at all\n\t function isSupported() {\n\t return (typeof window !== 'undefined' && window.JSON && window.JSON.stringify &&\n\t window.JSON.parse && window.postMessage);\n\t }\n\t\n\t // given a URL, extract the origin. Taken from: https://github.com/firebase/firebase-simple-login/blob/d2cb95b9f812d8488bdbfba51c3a7c153ba1a074/js/src/simple-login/transports/WinChan.js#L25-L30\n\t function extractOrigin(url) {\n\t if (!/^https?:\\/\\//.test(url)) url = window.location.href;\n\t var m = /^(https?:\\/\\/[\\-_a-zA-Z\\.0-9:]+)/.exec(url);\n\t if (m) return m[1];\n\t return url;\n\t }\n\t\n\t // find the relay iframe in the opener\n\t function findRelay() {\n\t var loc = window.location;\n\t var frames = window.opener.frames;\n\t for (var i = frames.length - 1; i >= 0; i--) {\n\t try {\n\t if (frames[i].location.protocol === window.location.protocol &&\n\t frames[i].location.host === window.location.host &&\n\t frames[i].name === RELAY_FRAME_NAME)\n\t {\n\t return frames[i];\n\t }\n\t } catch(e) { }\n\t }\n\t return;\n\t }\n\t\n\t var isIE = isInternetExplorer();\n\t\n\t if (isSupported()) {\n\t /* General flow:\n\t * 0. user clicks\n\t * (IE SPECIFIC) 1. caller adds relay iframe (served from trusted domain) to DOM\n\t * 2. caller opens window (with content from trusted domain)\n\t * 3. window on opening adds a listener to 'message'\n\t * (IE SPECIFIC) 4. window on opening finds iframe\n\t * 5. window checks if iframe is \"loaded\" - has a 'doPost' function yet\n\t * (IE SPECIFIC5) 5a. if iframe.doPost exists, window uses it to send ready event to caller\n\t * (IE SPECIFIC5) 5b. if iframe.doPost doesn't exist, window waits for frame ready\n\t * (IE SPECIFIC5) 5bi. once ready, window calls iframe.doPost to send ready event\n\t * 6. caller upon reciept of 'ready', sends args\n\t */\n\t return {\n\t open: function(opts, cb) {\n\t if (!cb) throw \"missing required callback argument\";\n\t\n\t // test required options\n\t var err;\n\t if (!opts.url) err = \"missing required 'url' parameter\";\n\t if (!opts.relay_url) err = \"missing required 'relay_url' parameter\";\n\t if (err) setTimeout(function() { cb(err); }, 0);\n\t\n\t // supply default options\n\t if (!opts.window_name) opts.window_name = null;\n\t if (!opts.window_features || isFennec()) opts.window_features = undefined;\n\t\n\t // opts.params may be undefined\n\t\n\t var iframe;\n\t\n\t // sanity check, are url and relay_url the same origin?\n\t var origin = opts.origin || extractOrigin(opts.url);\n\t if (origin !== extractOrigin(opts.relay_url)) {\n\t return setTimeout(function() {\n\t cb('invalid arguments: origin of url and relay_url must match');\n\t }, 0);\n\t }\n\t\n\t var messageTarget;\n\t\n\t if (isIE) {\n\t // first we need to add a \"relay\" iframe to the document that's served\n\t // from the target domain. We can postmessage into a iframe, but not a\n\t // window\n\t iframe = document.createElement(\"iframe\");\n\t // iframe.setAttribute('name', framename);\n\t iframe.setAttribute('src', opts.relay_url);\n\t iframe.style.display = \"none\";\n\t iframe.setAttribute('name', RELAY_FRAME_NAME);\n\t document.body.appendChild(iframe);\n\t messageTarget = iframe.contentWindow;\n\t }\n\t\n\t var w = opts.popup || window.open(opts.url, opts.window_name, opts.window_features);\n\t if (opts.popup) {\n\t w.location.href = opts.url;\n\t }\n\t\n\t if (!messageTarget) messageTarget = w;\n\t\n\t // lets listen in case the window blows up before telling us\n\t var closeInterval = setInterval(function() {\n\t if (w && w.closed) {\n\t cleanup();\n\t if (cb) {\n\t cb('User closed the popup window');\n\t cb = null;\n\t }\n\t }\n\t }, 500);\n\t\n\t var req = JSON.stringify({a: 'request', d: opts.params});\n\t\n\t // cleanup on unload\n\t function cleanup() {\n\t if (iframe) document.body.removeChild(iframe);\n\t iframe = undefined;\n\t if (closeInterval) closeInterval = clearInterval(closeInterval);\n\t removeListener(window, 'message', onMessage);\n\t removeListener(window, 'unload', cleanup);\n\t if (w) {\n\t try {\n\t w.close();\n\t } catch (securityViolation) {\n\t // This happens in Opera 12 sometimes\n\t // see https://github.com/mozilla/browserid/issues/1844\n\t messageTarget.postMessage(CLOSE_CMD, origin);\n\t }\n\t }\n\t w = messageTarget = undefined;\n\t }\n\t\n\t addListener(window, 'unload', cleanup);\n\t\n\t function onMessage(e) {\n\t if (e.origin !== origin) { return; }\n\t try {\n\t var d = JSON.parse(e.data);\n\t } catch(err) {\n\t if (cb) {\n\t cb(err);\n\t } else {\n\t throw err;\n\t }\n\t }\n\t\n\t if (d.a === 'ready') {\n\t messageTarget.postMessage(req, origin);\n\t } else if (d.a === 'error') {\n\t cleanup();\n\t if (cb) {\n\t cb(d.d);\n\t cb = null;\n\t }\n\t } else if (d.a === 'response') {\n\t cleanup();\n\t if (cb) {\n\t cb(null, d.d);\n\t cb = null;\n\t }\n\t }\n\t }\n\t\n\t addListener(window, 'message', onMessage);\n\t\n\t return {\n\t close: cleanup,\n\t focus: function() {\n\t if (w) {\n\t try {\n\t w.focus();\n\t } catch (e) {\n\t // IE7 blows up here, do nothing\n\t }\n\t }\n\t }\n\t };\n\t },\n\t onOpen: function(cb) {\n\t var o = \"*\";\n\t var msgTarget = isIE ? findRelay() : window.opener;\n\t if (!msgTarget) throw \"can't find relay frame\";\n\t function doPost(msg) {\n\t msg = JSON.stringify(msg);\n\t if (isIE) msgTarget.doPost(msg, o);\n\t else msgTarget.postMessage(msg, o);\n\t }\n\t\n\t function onMessage(e) {\n\t // only one message gets through, but let's make sure it's actually\n\t // the message we're looking for (other code may be using\n\t // postmessage) - we do this by ensuring the payload can\n\t // be parsed, and it's got an 'a' (action) value of 'request'.\n\t var d;\n\t try {\n\t d = JSON.parse(e.data);\n\t } catch(err) { }\n\t if (!d || d.a !== 'request') return;\n\t removeListener(window, 'message', onMessage);\n\t o = e.origin;\n\t if (cb) {\n\t // this setTimeout is critically important for IE8 -\n\t // in ie8 sometimes addListener for 'message' can synchronously\n\t // cause your callback to be invoked. awesome.\n\t setTimeout(function() {\n\t cb(o, d.d, function(r) {\n\t cb = undefined;\n\t doPost({a: 'response', d: r});\n\t });\n\t }, 0);\n\t }\n\t }\n\t\n\t function onDie(e) {\n\t if (e.data === CLOSE_CMD) {\n\t try { window.close(); } catch (o_O) {}\n\t }\n\t }\n\t addListener(isIE ? msgTarget : window, 'message', onMessage);\n\t addListener(isIE ? msgTarget : window, 'message', onDie);\n\t\n\t // we cannot post to our parent that we're ready before the iframe\n\t // is loaded. (IE specific possible failure)\n\t try {\n\t doPost({a: \"ready\"});\n\t } catch(e) {\n\t // this code should never be exectued outside IE\n\t addListener(msgTarget, 'load', function(e) {\n\t doPost({a: \"ready\"});\n\t });\n\t }\n\t\n\t // if window is unloaded and the client hasn't called cb, it's an error\n\t var onUnload = function() {\n\t try {\n\t // IE8 doesn't like this...\n\t removeListener(isIE ? msgTarget : window, 'message', onDie);\n\t } catch (ohWell) { }\n\t if (cb) doPost({ a: 'error', d: 'client closed window' });\n\t cb = undefined;\n\t // explicitly close the window, in case the client is trying to reload or nav\n\t try { window.close(); } catch (e) { }\n\t };\n\t addListener(window, 'unload', onUnload);\n\t return {\n\t detach: function() {\n\t removeListener(window, 'unload', onUnload);\n\t }\n\t };\n\t }\n\t };\n\t } else {\n\t return {\n\t open: function(url, winopts, arg, cb) {\n\t setTimeout(function() { cb(\"unsupported browser\"); }, 0);\n\t },\n\t onOpen: function(cb) {\n\t setTimeout(function() { cb(\"unsupported browser\"); }, 0);\n\t }\n\t };\n\t }\n\t})();\n\t\n\tif (typeof module !== 'undefined' && module.exports) {\n\t module.exports = WinChan;\n\t}\n\n\n/***/ },\n/* 19 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar urljoin = __webpack_require__(1);\n\t\n\tvar RequestBuilder = __webpack_require__(10);\n\tvar qs = __webpack_require__(5);\n\tvar objectHelper = __webpack_require__(2);\n\tvar assert = __webpack_require__(4);\n\tvar responseHandler = __webpack_require__(6);\n\tvar parametersWhitelist = __webpack_require__(45);\n\tvar Warn = __webpack_require__(11);\n\t\n\tvar PasswordlessAuthentication = __webpack_require__(41);\n\tvar DBConnection = __webpack_require__(40);\n\t\n\t/**\n\t * Creates a new Auth0 Authentication API client\n\t * @constructor\n\t * @param {Object} options\n\t * @param {String} options.domain your Auth0 domain\n\t * @param {String} options.clientID your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard\n\t * @param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorization Response\n\t * @param {String} [options.responseType] type of the response used by OAuth 2.0 flow. It can be any space separated list of the values `code`, `token`, `id_token`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0}\n\t * @param {String} [options.responseMode] how the Auth response is encoded and redirected back to the client. Supported values are `query`, `fragment` and `form_post`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes}\n\t * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email`\n\t * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth\n\t * @see {@link https://auth0.com/docs/api/authentication}\n\t */\n\tfunction Authentication(options) {\n\t /* eslint-disable */\n\t assert.check(\n\t options,\n\t { type: 'object', message: 'options parameter is not valid' },\n\t {\n\t domain: { type: 'string', message: 'domain option is required' },\n\t clientID: { type: 'string', message: 'clientID option is required' },\n\t responseType: { optional: true, type: 'string', message: 'responseType is not valid' },\n\t responseMode: { optional: true, type: 'string', message: 'responseMode is not valid' },\n\t redirectUri: { optional: true, type: 'string', message: 'redirectUri is not valid' },\n\t scope: { optional: true, type: 'string', message: 'scope is not valid' },\n\t audience: { optional: true, type: 'string', message: 'audience is not valid' },\n\t _disableDeprecationWarnings: {\n\t optional: true,\n\t type: 'boolean',\n\t message: '_disableDeprecationWarnings option is not valid'\n\t },\n\t _sendTelemetry: {\n\t optional: true,\n\t type: 'boolean',\n\t message: '_sendTelemetry option is not valid'\n\t },\n\t _telemetryInfo: {\n\t optional: true,\n\t type: 'object',\n\t message: '_telemetryInfo option is not valid'\n\t }\n\t }\n\t );\n\t /* eslint-enable */\n\t\n\t this.baseOptions = options;\n\t\n\t this.baseOptions._sendTelemetry = this.baseOptions._sendTelemetry === false\n\t ? this.baseOptions._sendTelemetry\n\t : true;\n\t\n\t this.baseOptions.rootUrl = 'https://' + this.baseOptions.domain;\n\t\n\t this.request = new RequestBuilder(this.baseOptions);\n\t\n\t this.passwordless = new PasswordlessAuthentication(this.request, this.baseOptions);\n\t this.dbConnection = new DBConnection(this.request, this.baseOptions);\n\t\n\t this.warn = new Warn({\n\t disableWarnings: !!options._disableDeprecationWarnings\n\t });\n\t}\n\t\n\t/**\n\t * Builds and returns the `/authorize` url in order to initialize a new authN/authZ transaction\n\t *\n\t * @method buildAuthorizeUrl\n\t * @param {Object} options\n\t * @param {String} [options.domain] your Auth0 domain\n\t * @param {String} [options.clientID] your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard\n\t * @param {String} options.redirectUri url that the Auth0 will redirect after Auth with the Authorization Response\n\t * @param {String} options.responseType type of the response used by OAuth 2.0 flow. It can be any space separated list of the values `code`, `token`, `id_token`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0}\n\t * @param {String} [options.responseMode] how the Auth response is encoded and redirected back to the client. Supported values are `query`, `fragment` and `form_post`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes}\n\t * @param {String} [options.state] value used to mitigate XSRF attacks. {@link https://auth0.com/docs/protocols/oauth2/oauth-state}\n\t * @param {String} [options.nonce] value used to mitigate replay attacks when using Implicit Grant. {@link https://auth0.com/docs/api-auth/tutorials/nonce}\n\t * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email`\n\t * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth\n\t * @see {@link https://auth0.com/docs/api/authentication#authorize-client}\n\t * @see {@link https://auth0.com/docs/api/authentication#social}\n\t */\n\tAuthentication.prototype.buildAuthorizeUrl = function(options) {\n\t var params;\n\t var qString;\n\t\n\t assert.check(options, { type: 'object', message: 'options parameter is not valid' });\n\t\n\t params = objectHelper\n\t .merge(this.baseOptions, [\n\t 'clientID',\n\t 'responseType',\n\t 'responseMode',\n\t 'redirectUri',\n\t 'scope',\n\t 'audience'\n\t ])\n\t .with(options);\n\t\n\t /* eslint-disable */\n\t assert.check(\n\t params,\n\t { type: 'object', message: 'options parameter is not valid' },\n\t {\n\t clientID: { type: 'string', message: 'clientID option is required' },\n\t redirectUri: { optional: true, type: 'string', message: 'redirectUri option is required' },\n\t responseType: { type: 'string', message: 'responseType option is required' },\n\t nonce: {\n\t type: 'string',\n\t message: 'nonce option is required',\n\t condition: function(o) {\n\t return o.responseType.indexOf('code') === -1 && o.responseType.indexOf('id_token') !== -1;\n\t }\n\t },\n\t scope: { optional: true, type: 'string', message: 'scope option is required' },\n\t audience: { optional: true, type: 'string', message: 'audience option is required' }\n\t }\n\t );\n\t /* eslint-enable */\n\t\n\t // eslint-disable-next-line\n\t if (this.baseOptions._sendTelemetry) {\n\t params.auth0Client = this.request.getTelemetryData();\n\t }\n\t\n\t if (params.connection_scope && assert.isArray(params.connection_scope)) {\n\t params.connection_scope = params.connection_scope.join(',');\n\t }\n\t\n\t params = objectHelper.toSnakeCase(params, ['auth0Client']);\n\t params = parametersWhitelist.oauthAuthorizeParams(this.warn, params);\n\t\n\t qString = qs.stringify(params);\n\t\n\t return urljoin(this.baseOptions.rootUrl, 'authorize', '?' + qString);\n\t};\n\t\n\t/**\n\t * Builds and returns the Logout url in order to initialize a new authN/authZ transaction\n\t *\n\t * If you want to navigate the user to a specific URL after the logout, set that URL at the returnTo parameter. The URL should be included in any the appropriate Allowed Logout URLs list:\n\t *\n\t * - If the client_id parameter is included, the returnTo URL must be listed in the Allowed Logout URLs set at the client level (see Setting Allowed Logout URLs at the App Level).\n\t * - If the client_id parameter is NOT included, the returnTo URL must be listed in the Allowed Logout URLs set at the account level (see Setting Allowed Logout URLs at the Account Level).\n\t * @method buildLogoutUrl\n\t * @param {Object} options\n\t * @param {String} [options.clientID] identifier of your client\n\t * @param {String} [options.returnTo] URL to be redirected after the logout\n\t * @param {Boolean} [options.federated] tells Auth0 if it should logout the user also from the IdP.\n\t * @see {@link https://auth0.com/docs/api/authentication#logout}\n\t */\n\tAuthentication.prototype.buildLogoutUrl = function(options) {\n\t var params;\n\t var qString;\n\t\n\t assert.check(options, {\n\t optional: true,\n\t type: 'object',\n\t message: 'options parameter is not valid'\n\t });\n\t\n\t params = objectHelper.merge(this.baseOptions, ['clientID']).with(options || {});\n\t\n\t // eslint-disable-next-line\n\t if (this.baseOptions._sendTelemetry) {\n\t params.auth0Client = this.request.getTelemetryData();\n\t }\n\t\n\t params = objectHelper.toSnakeCase(params, ['auth0Client', 'returnTo']);\n\t\n\t qString = qs.stringify(params);\n\t\n\t return urljoin(this.baseOptions.rootUrl, 'v2', 'logout', '?' + qString);\n\t};\n\t\n\t/**\n\t * @callback authorizeCallback\n\t * @param {Error} [err] error returned by Auth0 with the reason of the Auth failure\n\t * @param {Object} [result] result of the Auth request\n\t * @param {String} [result.accessToken] token that allows access to the specified resource server (identified by the audience parameter or by default Auth0's /userinfo endpoint)\n\t * @param {Number} [result.expiresIn] number of seconds until the access token expires\n\t * @param {String} [result.idToken] token that identifies the user\n\t * @param {String} [result.refreshToken] token that can be used to get new access tokens from Auth0. Note that not all clients can request them or the resource server might not allow them.\n\t */\n\t\n\t/**\n\t * @callback tokenCallback\n\t * @param {Error} [err] error returned by Auth0 with the reason of the Auth failure\n\t * @param {Object} [result] result of the Auth request\n\t * @param {String} result.accessToken token that allows access to the specified resource server (identified by the audience parameter or by default Auth0's /userinfo endpoint)\n\t * @param {Number} result.expiresIn number of seconds until the access token expires\n\t * @param {String} [result.idToken] token that identifies the user\n\t * @param {String} [result.refreshToken] token that can be used to get new access tokens from Auth0. Note that not all clients can request them or the resource server might not allow them.\n\t */\n\t\n\t/**\n\t * Makes a call to the `oauth/token` endpoint with `password` grant type to login to the default directory.\n\t *\n\t * @method loginWithDefaultDirectory\n\t * @param {Object} options\n\t * @param {String} options.username email or username of the user that will perform Auth\n\t * @param {String} options.password the password of the user that will perform Auth\n\t * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email`\n\t * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth\n\t * @param {tokenCallback} cb function called with the result of the request\n\t * @see {@link https://auth0.com/docs/api-auth/grant/password}\n\t */\n\tAuthentication.prototype.loginWithDefaultDirectory = function(options, cb) {\n\t assert.check(\n\t options,\n\t { type: 'object', message: 'options parameter is not valid' },\n\t {\n\t username: { type: 'string', message: 'username option is required' },\n\t password: { type: 'string', message: 'password option is required' },\n\t scope: { optional: true, type: 'string', message: 'scope option is required' },\n\t audience: { optional: true, type: 'string', message: 'audience option is required' }\n\t }\n\t );\n\t\n\t options.grantType = 'password';\n\t\n\t return this.oauthToken(options, cb);\n\t};\n\t\n\t/**\n\t * Makes a call to the `oauth/token` endpoint with `password-realm` grant type\n\t *\n\t * @method login\n\t * @param {Object} options\n\t * @param {String} options.username email or username of the user that will perform Auth\n\t * @param {String} options.password the password of the user that will perform Auth\n\t * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email`\n\t * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth\n\t * @param {Object} options.realm the HRD domain or the connection name where the user belongs to. e.g. `Username-Password-Authentication`\n\t * @param {tokenCallback} cb function called with the result of the request\n\t * @see {@link https://auth0.com/docs/api-auth/grant/password}\n\t */\n\tAuthentication.prototype.login = function(options, cb) {\n\t assert.check(\n\t options,\n\t { type: 'object', message: 'options parameter is not valid' },\n\t {\n\t username: { type: 'string', message: 'username option is required' },\n\t password: { type: 'string', message: 'password option is required' },\n\t realm: { type: 'string', message: 'realm option is required' },\n\t scope: { optional: true, type: 'string', message: 'scope option is required' },\n\t audience: { optional: true, type: 'string', message: 'audience option is required' }\n\t }\n\t );\n\t\n\t options.grantType = 'http://auth0.com/oauth/grant-type/password-realm';\n\t\n\t return this.oauthToken(options, cb);\n\t};\n\t\n\t/**\n\t * Makes a call to the `oauth/token` endpoint\n\t *\n\t * @method oauthToken\n\t * @private\n\t */\n\tAuthentication.prototype.oauthToken = function(options, cb) {\n\t var url;\n\t var body;\n\t\n\t assert.check(options, { type: 'object', message: 'options parameter is not valid' });\n\t assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\t\n\t url = urljoin(this.baseOptions.rootUrl, 'oauth', 'token');\n\t\n\t body = objectHelper.merge(this.baseOptions, ['clientID', 'scope', 'audience']).with(options);\n\t\n\t assert.check(\n\t body,\n\t { type: 'object', message: 'options parameter is not valid' },\n\t {\n\t clientID: { type: 'string', message: 'clientID option is required' },\n\t grantType: { type: 'string', message: 'grantType option is required' },\n\t scope: { optional: true, type: 'string', message: 'scope option is required' },\n\t audience: { optional: true, type: 'string', message: 'audience option is required' }\n\t }\n\t );\n\t\n\t body = objectHelper.toSnakeCase(body, ['auth0Client']);\n\t body = parametersWhitelist.oauthTokenParams(this.warn, body);\n\t\n\t body.grant_type = body.grant_type;\n\t\n\t return this.request.post(url).send(body).end(responseHandler(cb));\n\t};\n\t\n\t/**\n\t * Performs authentication calling `/oauth/ro` endpoint with username\n\t * and password for a given connection name.\n\t *\n\t * This method is not compatible with API Auth so if you need to fetch API tokens with audience\n\t * you should use {@link login} or {@link loginWithDefaultDirectory}.\n\t *\n\t * @method loginWithResourceOwner\n\t * @param {Object} options\n\t * @param {String} options.username email or username of the user that will perform Auth\n\t * @param {String} options.password the password of the user that will perform Auth\n\t * @param {Object} options.connection the connection name where the user belongs to. e.g. `Username-Password-Authentication`\n\t * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email`\n\t * @param {String} [options.device] name of the device/browser where the Auth was requested\n\t * @param {tokenCallback} cb function called with the result of the request\n\t */\n\tAuthentication.prototype.loginWithResourceOwner = function(options, cb) {\n\t var url;\n\t var body;\n\t\n\t assert.check(\n\t options,\n\t { type: 'object', message: 'options parameter is not valid' },\n\t {\n\t username: { type: 'string', message: 'username option is required' },\n\t password: { type: 'string', message: 'password option is required' },\n\t connection: { type: 'string', message: 'connection option is required' },\n\t scope: { optional: true, type: 'string', message: 'scope option is required' }\n\t }\n\t );\n\t assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\t\n\t url = urljoin(this.baseOptions.rootUrl, 'oauth', 'ro');\n\t\n\t body = objectHelper\n\t .merge(this.baseOptions, ['clientID', 'scope'])\n\t .with(options, ['username', 'password', 'scope', 'connection', 'device']);\n\t\n\t body = objectHelper.toSnakeCase(body, ['auth0Client']);\n\t\n\t body.grant_type = body.grant_type || 'password';\n\t\n\t return this.request.post(url).send(body).end(responseHandler(cb));\n\t};\n\t\n\t/**\n\t * Makes a call to the `/ssodata` endpoint.\n\t * We recommend to avoid using this method and rely on your tenant hosted login page and using prompt=none via {@link renewAuth} method.\n\t *\n\t * @method getSSOData\n\t * @param {Boolean} withActiveDirectories tells Auth0 to return AD data\n\t * @param {Function} cb\n\t */\n\tAuthentication.prototype.getSSOData = function(withActiveDirectories, cb) {\n\t var url;\n\t var params = '';\n\t\n\t if (typeof withActiveDirectories === 'function') {\n\t cb = withActiveDirectories;\n\t withActiveDirectories = false;\n\t }\n\t\n\t assert.check(withActiveDirectories, {\n\t type: 'boolean',\n\t message: 'withActiveDirectories parameter is not valid'\n\t });\n\t assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\t\n\t if (withActiveDirectories) {\n\t params =\n\t '?' +\n\t qs.stringify({\n\t ldaps: 1,\n\t client_id: this.baseOptions.clientID\n\t });\n\t }\n\t\n\t url = urljoin(this.baseOptions.rootUrl, 'user', 'ssodata', params);\n\t\n\t return this.request.get(url, { noHeaders: true }).withCredentials().end(responseHandler(cb));\n\t};\n\t\n\t/**\n\t * @callback userInfoCallback\n\t * @param {Error} [err] error returned by Auth0\n\t * @param {Object} [userInfo] user information\n\t */\n\t\n\t/**\n\t * Makes a call to the `/userinfo` endpoint and returns the user profile\n\t *\n\t * @method userInfo\n\t * @param {String} accessToken token issued to a user after Auth\n\t * @param {userInfoCallback} cb\n\t * @see {@link https://auth0.com/docs/api/authentication#get-user-info}\n\t */\n\tAuthentication.prototype.userInfo = function(accessToken, cb) {\n\t var url;\n\t\n\t assert.check(accessToken, { type: 'string', message: 'accessToken parameter is not valid' });\n\t assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\t\n\t url = urljoin(this.baseOptions.rootUrl, 'userinfo');\n\t\n\t return this.request\n\t .get(url)\n\t .set('Authorization', 'Bearer ' + accessToken)\n\t .end(responseHandler(cb, { ignoreCasing: true }));\n\t};\n\t\n\t/**\n\t * @callback delegationCallback\n\t * @param {Error} [err] error returned by Auth0 with the reason why the delegation failed\n\t * @param {Object} [result] result of the delegation request. The payload depends on what ai type was used\n\t */\n\t\n\t/**\n\t * Makes a call to the `/delegation` endpoint with either an `id_token` or `refresh_token`\n\t *\n\t * @method delegation\n\t * @param {Object} options\n\t * @param {String} [options.clientID] client identifier\n\t * @param {String} options.grantType grant type used for delegation. The only valid value is `urn:ietf:params:oauth:grant-type:jwt-bearer`\n\t * @param {String} [options.idToken] valid token of the user issued after Auth. If no `refresh_token` is provided this parameter is required\n\t * @param {String} [options.refreshToken] valid refresh token of the user issued after Auth. If no `id_token` is provided this parameter is required\n\t * @param {String} [options.target] the target client id of the delegation\n\t * @param {String} [options.scope] either `openid` or `openid profile email`\n\t * @param {String} [options.apiType] the api to be called\n\t * @param {delegationCallback} cb\n\t * @see {@link https://auth0.com/docs/api/authentication#delegation}\n\t */\n\tAuthentication.prototype.delegation = function(options, cb) {\n\t var url;\n\t var body;\n\t\n\t assert.check(\n\t options,\n\t { type: 'object', message: 'options parameter is not valid' },\n\t {\n\t grant_type: { type: 'string', message: 'grant_type option is required' }\n\t }\n\t );\n\t assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\t\n\t url = urljoin(this.baseOptions.rootUrl, 'delegation');\n\t\n\t body = objectHelper.merge(this.baseOptions, ['clientID']).with(options);\n\t\n\t body = objectHelper.toSnakeCase(body, ['auth0Client']);\n\t\n\t return this.request.post(url).send(body).end(responseHandler(cb));\n\t};\n\t\n\t/**\n\t * Fetches the user country based on the ip.\n\t *\n\t * @method getUserCountry\n\t * @private\n\t * @param {Function} cb\n\t */\n\tAuthentication.prototype.getUserCountry = function(cb) {\n\t var url;\n\t\n\t assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\t\n\t url = urljoin(this.baseOptions.rootUrl, 'user', 'geoloc', 'country');\n\t\n\t return this.request.get(url).end(responseHandler(cb));\n\t};\n\t\n\tmodule.exports = Authentication;\n\n\n/***/ },\n/* 20 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar base64 = __webpack_require__(15);\n\t\n\tfunction padding(str) {\n\t var mod = str.length % 4;\n\t var pad = 4 - mod;\n\t\n\t if (mod === 0) {\n\t return str;\n\t }\n\t\n\t return str + new Array(1 + pad).join('=');\n\t}\n\t\n\tfunction stringToByteArray(str) {\n\t var arr = new Array(str.length);\n\t for (var a = 0; a < str.length; a++) {\n\t arr[a] = str.charCodeAt(a);\n\t }\n\t return arr;\n\t}\n\t\n\tfunction byteArrayToString(array) {\n\t var result = '';\n\t for (var i = 0; i < array.length; i++) {\n\t result += String.fromCharCode(array[i]);\n\t }\n\t return result;\n\t}\n\t\n\tfunction encode(str) {\n\t return base64\n\t .fromByteArray(stringToByteArray(str))\n\t .replace(/\\+/g, '-') // Convert '+' to '-'\n\t .replace(/\\//g, '_'); // Convert '/' to '_'\n\t}\n\t\n\tfunction decode(str) {\n\t str = padding(str)\n\t .replace(/-/g, '+') // Convert '-' to '+'\n\t .replace(/_/g, '/'); // Convert '_' to '/'\n\t\n\t return byteArrayToString(base64.toByteArray(str));\n\t}\n\t\n\tmodule.exports = {\n\t encode: encode,\n\t decode: decode\n\t};\n\n\n/***/ },\n/* 21 */\n/***/ function(module, exports) {\n\n\tfunction buildResponse(error, description) {\n\t return {\n\t error: error,\n\t errorDescription: description\n\t };\n\t}\n\t\n\tfunction invalidJwt(description) {\n\t return buildResponse('invalid_token', description);\n\t}\n\t\n\tmodule.exports = {\n\t buildResponse: buildResponse,\n\t invalidJwt: invalidJwt\n\t};\n\n\n/***/ },\n/* 22 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar random = __webpack_require__(48);\n\tvar storage = __webpack_require__(49);\n\t\n\tvar DEFAULT_NAMESPACE = 'com.auth0.auth.';\n\t\n\tfunction TransactionManager(options) {\n\t options = options || {};\n\t this.namespace = options.namespace || DEFAULT_NAMESPACE;\n\t this.keyLength = options.keyLength || 32;\n\t}\n\t\n\tTransactionManager.prototype.process = function(options) {\n\t var transaction;\n\t\n\t if (options.responseType.indexOf('code') !== -1) {\n\t return options;\n\t }\n\t\n\t if (options.responseType.indexOf('id_token') !== -1 && !!options.nonce) {\n\t return options;\n\t }\n\t\n\t transaction = this.generateTransaction(options.appState, options.state, options.nonce);\n\t\n\t options.state = transaction.state;\n\t\n\t if (options.responseType.indexOf('id_token') !== -1) {\n\t options.nonce = transaction.nonce;\n\t }\n\t\n\t return options;\n\t};\n\t\n\tTransactionManager.prototype.generateTransaction = function(appState, state, nonce) {\n\t var transaction = state || random.randomString(this.keyLength);\n\t nonce = nonce || random.randomString(this.keyLength);\n\t\n\t storage.setItem(this.namespace + transaction, {\n\t nonce: nonce,\n\t appState: appState\n\t });\n\t\n\t return {\n\t state: transaction,\n\t nonce: nonce\n\t };\n\t};\n\t\n\tTransactionManager.prototype.getStoredTransaction = function(transaction) {\n\t var transactionData;\n\t\n\t transactionData = storage.getItem(this.namespace + transaction);\n\t storage.removeItem(this.namespace + transaction);\n\t return transactionData;\n\t};\n\t\n\tmodule.exports = TransactionManager;\n\n\n/***/ },\n/* 23 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\r\n\t/**\r\n\t * Expose `Emitter`.\r\n\t */\r\n\t\r\n\tif (true) {\r\n\t module.exports = Emitter;\r\n\t}\r\n\t\r\n\t/**\r\n\t * Initialize a new `Emitter`.\r\n\t *\r\n\t * @api public\r\n\t */\r\n\t\r\n\tfunction Emitter(obj) {\r\n\t if (obj) return mixin(obj);\r\n\t};\r\n\t\r\n\t/**\r\n\t * Mixin the emitter properties.\r\n\t *\r\n\t * @param {Object} obj\r\n\t * @return {Object}\r\n\t * @api private\r\n\t */\r\n\t\r\n\tfunction mixin(obj) {\r\n\t for (var key in Emitter.prototype) {\r\n\t obj[key] = Emitter.prototype[key];\r\n\t }\r\n\t return obj;\r\n\t}\r\n\t\r\n\t/**\r\n\t * Listen on the given `event` with `fn`.\r\n\t *\r\n\t * @param {String} event\r\n\t * @param {Function} fn\r\n\t * @return {Emitter}\r\n\t * @api public\r\n\t */\r\n\t\r\n\tEmitter.prototype.on =\r\n\tEmitter.prototype.addEventListener = function(event, fn){\r\n\t this._callbacks = this._callbacks || {};\r\n\t (this._callbacks['$' + event] = this._callbacks['$' + event] || [])\r\n\t .push(fn);\r\n\t return this;\r\n\t};\r\n\t\r\n\t/**\r\n\t * Adds an `event` listener that will be invoked a single\r\n\t * time then automatically removed.\r\n\t *\r\n\t * @param {String} event\r\n\t * @param {Function} fn\r\n\t * @return {Emitter}\r\n\t * @api public\r\n\t */\r\n\t\r\n\tEmitter.prototype.once = function(event, fn){\r\n\t function on() {\r\n\t this.off(event, on);\r\n\t fn.apply(this, arguments);\r\n\t }\r\n\t\r\n\t on.fn = fn;\r\n\t this.on(event, on);\r\n\t return this;\r\n\t};\r\n\t\r\n\t/**\r\n\t * Remove the given callback for `event` or all\r\n\t * registered callbacks.\r\n\t *\r\n\t * @param {String} event\r\n\t * @param {Function} fn\r\n\t * @return {Emitter}\r\n\t * @api public\r\n\t */\r\n\t\r\n\tEmitter.prototype.off =\r\n\tEmitter.prototype.removeListener =\r\n\tEmitter.prototype.removeAllListeners =\r\n\tEmitter.prototype.removeEventListener = function(event, fn){\r\n\t this._callbacks = this._callbacks || {};\r\n\t\r\n\t // all\r\n\t if (0 == arguments.length) {\r\n\t this._callbacks = {};\r\n\t return this;\r\n\t }\r\n\t\r\n\t // specific event\r\n\t var callbacks = this._callbacks['$' + event];\r\n\t if (!callbacks) return this;\r\n\t\r\n\t // remove all handlers\r\n\t if (1 == arguments.length) {\r\n\t delete this._callbacks['$' + event];\r\n\t return this;\r\n\t }\r\n\t\r\n\t // remove specific handler\r\n\t var cb;\r\n\t for (var i = 0; i < callbacks.length; i++) {\r\n\t cb = callbacks[i];\r\n\t if (cb === fn || cb.fn === fn) {\r\n\t callbacks.splice(i, 1);\r\n\t break;\r\n\t }\r\n\t }\r\n\t return this;\r\n\t};\r\n\t\r\n\t/**\r\n\t * Emit `event` with the given args.\r\n\t *\r\n\t * @param {String} event\r\n\t * @param {Mixed} ...\r\n\t * @return {Emitter}\r\n\t */\r\n\t\r\n\tEmitter.prototype.emit = function(event){\r\n\t this._callbacks = this._callbacks || {};\r\n\t var args = [].slice.call(arguments, 1)\r\n\t , callbacks = this._callbacks['$' + event];\r\n\t\r\n\t if (callbacks) {\r\n\t callbacks = callbacks.slice(0);\r\n\t for (var i = 0, len = callbacks.length; i < len; ++i) {\r\n\t callbacks[i].apply(this, args);\r\n\t }\r\n\t }\r\n\t\r\n\t return this;\r\n\t};\r\n\t\r\n\t/**\r\n\t * Return array of callbacks for `event`.\r\n\t *\r\n\t * @param {String} event\r\n\t * @return {Array}\r\n\t * @api public\r\n\t */\r\n\t\r\n\tEmitter.prototype.listeners = function(event){\r\n\t this._callbacks = this._callbacks || {};\r\n\t return this._callbacks['$' + event] || [];\r\n\t};\r\n\t\r\n\t/**\r\n\t * Check if this emitter has `event` handlers.\r\n\t *\r\n\t * @param {String} event\r\n\t * @return {Boolean}\r\n\t * @api public\r\n\t */\r\n\t\r\n\tEmitter.prototype.hasListeners = function(event){\r\n\t return !! this.listeners(event).length;\r\n\t};\r\n\n\n/***/ },\n/* 24 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t;(function (root, factory) {\n\t\tif (true) {\n\t\t\t// CommonJS\n\t\t\tmodule.exports = exports = factory();\n\t\t}\n\t\telse if (typeof define === \"function\" && define.amd) {\n\t\t\t// AMD\n\t\t\tdefine([], factory);\n\t\t}\n\t\telse {\n\t\t\t// Global (browser)\n\t\t\troot.CryptoJS = factory();\n\t\t}\n\t}(this, function () {\n\t\n\t\t/**\n\t\t * CryptoJS core components.\n\t\t */\n\t\tvar CryptoJS = CryptoJS || (function (Math, undefined) {\n\t\t /*\n\t\t * Local polyfil of Object.create\n\t\t */\n\t\t var create = Object.create || (function () {\n\t\t function F() {};\n\t\n\t\t return function (obj) {\n\t\t var subtype;\n\t\n\t\t F.prototype = obj;\n\t\n\t\t subtype = new F();\n\t\n\t\t F.prototype = null;\n\t\n\t\t return subtype;\n\t\t };\n\t\t }())\n\t\n\t\t /**\n\t\t * CryptoJS namespace.\n\t\t */\n\t\t var C = {};\n\t\n\t\t /**\n\t\t * Library namespace.\n\t\t */\n\t\t var C_lib = C.lib = {};\n\t\n\t\t /**\n\t\t * Base object for prototypal inheritance.\n\t\t */\n\t\t var Base = C_lib.Base = (function () {\n\t\n\t\n\t\t return {\n\t\t /**\n\t\t * Creates a new object that inherits from this object.\n\t\t *\n\t\t * @param {Object} overrides Properties to copy into the new object.\n\t\t *\n\t\t * @return {Object} The new object.\n\t\t *\n\t\t * @static\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * var MyType = CryptoJS.lib.Base.extend({\n\t\t * field: 'value',\n\t\t *\n\t\t * method: function () {\n\t\t * }\n\t\t * });\n\t\t */\n\t\t extend: function (overrides) {\n\t\t // Spawn\n\t\t var subtype = create(this);\n\t\n\t\t // Augment\n\t\t if (overrides) {\n\t\t subtype.mixIn(overrides);\n\t\t }\n\t\n\t\t // Create default initializer\n\t\t if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {\n\t\t subtype.init = function () {\n\t\t subtype.$super.init.apply(this, arguments);\n\t\t };\n\t\t }\n\t\n\t\t // Initializer's prototype is the subtype object\n\t\t subtype.init.prototype = subtype;\n\t\n\t\t // Reference supertype\n\t\t subtype.$super = this;\n\t\n\t\t return subtype;\n\t\t },\n\t\n\t\t /**\n\t\t * Extends this object and runs the init method.\n\t\t * Arguments to create() will be passed to init().\n\t\t *\n\t\t * @return {Object} The new object.\n\t\t *\n\t\t * @static\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * var instance = MyType.create();\n\t\t */\n\t\t create: function () {\n\t\t var instance = this.extend();\n\t\t instance.init.apply(instance, arguments);\n\t\n\t\t return instance;\n\t\t },\n\t\n\t\t /**\n\t\t * Initializes a newly created object.\n\t\t * Override this method to add some logic when your objects are created.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * var MyType = CryptoJS.lib.Base.extend({\n\t\t * init: function () {\n\t\t * // ...\n\t\t * }\n\t\t * });\n\t\t */\n\t\t init: function () {\n\t\t },\n\t\n\t\t /**\n\t\t * Copies properties into this object.\n\t\t *\n\t\t * @param {Object} properties The properties to mix in.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * MyType.mixIn({\n\t\t * field: 'value'\n\t\t * });\n\t\t */\n\t\t mixIn: function (properties) {\n\t\t for (var propertyName in properties) {\n\t\t if (properties.hasOwnProperty(propertyName)) {\n\t\t this[propertyName] = properties[propertyName];\n\t\t }\n\t\t }\n\t\n\t\t // IE won't copy toString using the loop above\n\t\t if (properties.hasOwnProperty('toString')) {\n\t\t this.toString = properties.toString;\n\t\t }\n\t\t },\n\t\n\t\t /**\n\t\t * Creates a copy of this object.\n\t\t *\n\t\t * @return {Object} The clone.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * var clone = instance.clone();\n\t\t */\n\t\t clone: function () {\n\t\t return this.init.prototype.extend(this);\n\t\t }\n\t\t };\n\t\t }());\n\t\n\t\t /**\n\t\t * An array of 32-bit words.\n\t\t *\n\t\t * @property {Array} words The array of 32-bit words.\n\t\t * @property {number} sigBytes The number of significant bytes in this word array.\n\t\t */\n\t\t var WordArray = C_lib.WordArray = Base.extend({\n\t\t /**\n\t\t * Initializes a newly created word array.\n\t\t *\n\t\t * @param {Array} words (Optional) An array of 32-bit words.\n\t\t * @param {number} sigBytes (Optional) The number of significant bytes in the words.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * var wordArray = CryptoJS.lib.WordArray.create();\n\t\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);\n\t\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);\n\t\t */\n\t\t init: function (words, sigBytes) {\n\t\t words = this.words = words || [];\n\t\n\t\t if (sigBytes != undefined) {\n\t\t this.sigBytes = sigBytes;\n\t\t } else {\n\t\t this.sigBytes = words.length * 4;\n\t\t }\n\t\t },\n\t\n\t\t /**\n\t\t * Converts this word array to a string.\n\t\t *\n\t\t * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex\n\t\t *\n\t\t * @return {string} The stringified word array.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * var string = wordArray + '';\n\t\t * var string = wordArray.toString();\n\t\t * var string = wordArray.toString(CryptoJS.enc.Utf8);\n\t\t */\n\t\t toString: function (encoder) {\n\t\t return (encoder || Hex).stringify(this);\n\t\t },\n\t\n\t\t /**\n\t\t * Concatenates a word array to this word array.\n\t\t *\n\t\t * @param {WordArray} wordArray The word array to append.\n\t\t *\n\t\t * @return {WordArray} This word array.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * wordArray1.concat(wordArray2);\n\t\t */\n\t\t concat: function (wordArray) {\n\t\t // Shortcuts\n\t\t var thisWords = this.words;\n\t\t var thatWords = wordArray.words;\n\t\t var thisSigBytes = this.sigBytes;\n\t\t var thatSigBytes = wordArray.sigBytes;\n\t\n\t\t // Clamp excess bits\n\t\t this.clamp();\n\t\n\t\t // Concat\n\t\t if (thisSigBytes % 4) {\n\t\t // Copy one byte at a time\n\t\t for (var i = 0; i < thatSigBytes; i++) {\n\t\t var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t\t thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);\n\t\t }\n\t\t } else {\n\t\t // Copy one word at a time\n\t\t for (var i = 0; i < thatSigBytes; i += 4) {\n\t\t thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];\n\t\t }\n\t\t }\n\t\t this.sigBytes += thatSigBytes;\n\t\n\t\t // Chainable\n\t\t return this;\n\t\t },\n\t\n\t\t /**\n\t\t * Removes insignificant bits.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * wordArray.clamp();\n\t\t */\n\t\t clamp: function () {\n\t\t // Shortcuts\n\t\t var words = this.words;\n\t\t var sigBytes = this.sigBytes;\n\t\n\t\t // Clamp\n\t\t words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);\n\t\t words.length = Math.ceil(sigBytes / 4);\n\t\t },\n\t\n\t\t /**\n\t\t * Creates a copy of this word array.\n\t\t *\n\t\t * @return {WordArray} The clone.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * var clone = wordArray.clone();\n\t\t */\n\t\t clone: function () {\n\t\t var clone = Base.clone.call(this);\n\t\t clone.words = this.words.slice(0);\n\t\n\t\t return clone;\n\t\t },\n\t\n\t\t /**\n\t\t * Creates a word array filled with random bytes.\n\t\t *\n\t\t * @param {number} nBytes The number of random bytes to generate.\n\t\t *\n\t\t * @return {WordArray} The random word array.\n\t\t *\n\t\t * @static\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * var wordArray = CryptoJS.lib.WordArray.random(16);\n\t\t */\n\t\t random: function (nBytes) {\n\t\t var words = [];\n\t\n\t\t var r = (function (m_w) {\n\t\t var m_w = m_w;\n\t\t var m_z = 0x3ade68b1;\n\t\t var mask = 0xffffffff;\n\t\n\t\t return function () {\n\t\t m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;\n\t\t m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;\n\t\t var result = ((m_z << 0x10) + m_w) & mask;\n\t\t result /= 0x100000000;\n\t\t result += 0.5;\n\t\t return result * (Math.random() > .5 ? 1 : -1);\n\t\t }\n\t\t });\n\t\n\t\t for (var i = 0, rcache; i < nBytes; i += 4) {\n\t\t var _r = r((rcache || Math.random()) * 0x100000000);\n\t\n\t\t rcache = _r() * 0x3ade67b7;\n\t\t words.push((_r() * 0x100000000) | 0);\n\t\t }\n\t\n\t\t return new WordArray.init(words, nBytes);\n\t\t }\n\t\t });\n\t\n\t\t /**\n\t\t * Encoder namespace.\n\t\t */\n\t\t var C_enc = C.enc = {};\n\t\n\t\t /**\n\t\t * Hex encoding strategy.\n\t\t */\n\t\t var Hex = C_enc.Hex = {\n\t\t /**\n\t\t * Converts a word array to a hex string.\n\t\t *\n\t\t * @param {WordArray} wordArray The word array.\n\t\t *\n\t\t * @return {string} The hex string.\n\t\t *\n\t\t * @static\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * var hexString = CryptoJS.enc.Hex.stringify(wordArray);\n\t\t */\n\t\t stringify: function (wordArray) {\n\t\t // Shortcuts\n\t\t var words = wordArray.words;\n\t\t var sigBytes = wordArray.sigBytes;\n\t\n\t\t // Convert\n\t\t var hexChars = [];\n\t\t for (var i = 0; i < sigBytes; i++) {\n\t\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t\t hexChars.push((bite >>> 4).toString(16));\n\t\t hexChars.push((bite & 0x0f).toString(16));\n\t\t }\n\t\n\t\t return hexChars.join('');\n\t\t },\n\t\n\t\t /**\n\t\t * Converts a hex string to a word array.\n\t\t *\n\t\t * @param {string} hexStr The hex string.\n\t\t *\n\t\t * @return {WordArray} The word array.\n\t\t *\n\t\t * @static\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * var wordArray = CryptoJS.enc.Hex.parse(hexString);\n\t\t */\n\t\t parse: function (hexStr) {\n\t\t // Shortcut\n\t\t var hexStrLength = hexStr.length;\n\t\n\t\t // Convert\n\t\t var words = [];\n\t\t for (var i = 0; i < hexStrLength; i += 2) {\n\t\t words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);\n\t\t }\n\t\n\t\t return new WordArray.init(words, hexStrLength / 2);\n\t\t }\n\t\t };\n\t\n\t\t /**\n\t\t * Latin1 encoding strategy.\n\t\t */\n\t\t var Latin1 = C_enc.Latin1 = {\n\t\t /**\n\t\t * Converts a word array to a Latin1 string.\n\t\t *\n\t\t * @param {WordArray} wordArray The word array.\n\t\t *\n\t\t * @return {string} The Latin1 string.\n\t\t *\n\t\t * @static\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);\n\t\t */\n\t\t stringify: function (wordArray) {\n\t\t // Shortcuts\n\t\t var words = wordArray.words;\n\t\t var sigBytes = wordArray.sigBytes;\n\t\n\t\t // Convert\n\t\t var latin1Chars = [];\n\t\t for (var i = 0; i < sigBytes; i++) {\n\t\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t\t latin1Chars.push(String.fromCharCode(bite));\n\t\t }\n\t\n\t\t return latin1Chars.join('');\n\t\t },\n\t\n\t\t /**\n\t\t * Converts a Latin1 string to a word array.\n\t\t *\n\t\t * @param {string} latin1Str The Latin1 string.\n\t\t *\n\t\t * @return {WordArray} The word array.\n\t\t *\n\t\t * @static\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);\n\t\t */\n\t\t parse: function (latin1Str) {\n\t\t // Shortcut\n\t\t var latin1StrLength = latin1Str.length;\n\t\n\t\t // Convert\n\t\t var words = [];\n\t\t for (var i = 0; i < latin1StrLength; i++) {\n\t\t words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);\n\t\t }\n\t\n\t\t return new WordArray.init(words, latin1StrLength);\n\t\t }\n\t\t };\n\t\n\t\t /**\n\t\t * UTF-8 encoding strategy.\n\t\t */\n\t\t var Utf8 = C_enc.Utf8 = {\n\t\t /**\n\t\t * Converts a word array to a UTF-8 string.\n\t\t *\n\t\t * @param {WordArray} wordArray The word array.\n\t\t *\n\t\t * @return {string} The UTF-8 string.\n\t\t *\n\t\t * @static\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);\n\t\t */\n\t\t stringify: function (wordArray) {\n\t\t try {\n\t\t return decodeURIComponent(escape(Latin1.stringify(wordArray)));\n\t\t } catch (e) {\n\t\t throw new Error('Malformed UTF-8 data');\n\t\t }\n\t\t },\n\t\n\t\t /**\n\t\t * Converts a UTF-8 string to a word array.\n\t\t *\n\t\t * @param {string} utf8Str The UTF-8 string.\n\t\t *\n\t\t * @return {WordArray} The word array.\n\t\t *\n\t\t * @static\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);\n\t\t */\n\t\t parse: function (utf8Str) {\n\t\t return Latin1.parse(unescape(encodeURIComponent(utf8Str)));\n\t\t }\n\t\t };\n\t\n\t\t /**\n\t\t * Abstract buffered block algorithm template.\n\t\t *\n\t\t * The property blockSize must be implemented in a concrete subtype.\n\t\t *\n\t\t * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0\n\t\t */\n\t\t var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({\n\t\t /**\n\t\t * Resets this block algorithm's data buffer to its initial state.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * bufferedBlockAlgorithm.reset();\n\t\t */\n\t\t reset: function () {\n\t\t // Initial values\n\t\t this._data = new WordArray.init();\n\t\t this._nDataBytes = 0;\n\t\t },\n\t\n\t\t /**\n\t\t * Adds new data to this block algorithm's buffer.\n\t\t *\n\t\t * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * bufferedBlockAlgorithm._append('data');\n\t\t * bufferedBlockAlgorithm._append(wordArray);\n\t\t */\n\t\t _append: function (data) {\n\t\t // Convert string to WordArray, else assume WordArray already\n\t\t if (typeof data == 'string') {\n\t\t data = Utf8.parse(data);\n\t\t }\n\t\n\t\t // Append\n\t\t this._data.concat(data);\n\t\t this._nDataBytes += data.sigBytes;\n\t\t },\n\t\n\t\t /**\n\t\t * Processes available data blocks.\n\t\t *\n\t\t * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.\n\t\t *\n\t\t * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.\n\t\t *\n\t\t * @return {WordArray} The processed data.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * var processedData = bufferedBlockAlgorithm._process();\n\t\t * var processedData = bufferedBlockAlgorithm._process(!!'flush');\n\t\t */\n\t\t _process: function (doFlush) {\n\t\t // Shortcuts\n\t\t var data = this._data;\n\t\t var dataWords = data.words;\n\t\t var dataSigBytes = data.sigBytes;\n\t\t var blockSize = this.blockSize;\n\t\t var blockSizeBytes = blockSize * 4;\n\t\n\t\t // Count blocks ready\n\t\t var nBlocksReady = dataSigBytes / blockSizeBytes;\n\t\t if (doFlush) {\n\t\t // Round up to include partial blocks\n\t\t nBlocksReady = Math.ceil(nBlocksReady);\n\t\t } else {\n\t\t // Round down to include only full blocks,\n\t\t // less the number of blocks that must remain in the buffer\n\t\t nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);\n\t\t }\n\t\n\t\t // Count words ready\n\t\t var nWordsReady = nBlocksReady * blockSize;\n\t\n\t\t // Count bytes ready\n\t\t var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);\n\t\n\t\t // Process blocks\n\t\t if (nWordsReady) {\n\t\t for (var offset = 0; offset < nWordsReady; offset += blockSize) {\n\t\t // Perform concrete-algorithm logic\n\t\t this._doProcessBlock(dataWords, offset);\n\t\t }\n\t\n\t\t // Remove processed words\n\t\t var processedWords = dataWords.splice(0, nWordsReady);\n\t\t data.sigBytes -= nBytesReady;\n\t\t }\n\t\n\t\t // Return processed words\n\t\t return new WordArray.init(processedWords, nBytesReady);\n\t\t },\n\t\n\t\t /**\n\t\t * Creates a copy of this object.\n\t\t *\n\t\t * @return {Object} The clone.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * var clone = bufferedBlockAlgorithm.clone();\n\t\t */\n\t\t clone: function () {\n\t\t var clone = Base.clone.call(this);\n\t\t clone._data = this._data.clone();\n\t\n\t\t return clone;\n\t\t },\n\t\n\t\t _minBufferSize: 0\n\t\t });\n\t\n\t\t /**\n\t\t * Abstract hasher template.\n\t\t *\n\t\t * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)\n\t\t */\n\t\t var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({\n\t\t /**\n\t\t * Configuration options.\n\t\t */\n\t\t cfg: Base.extend(),\n\t\n\t\t /**\n\t\t * Initializes a newly created hasher.\n\t\t *\n\t\t * @param {Object} cfg (Optional) The configuration options to use for this hash computation.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * var hasher = CryptoJS.algo.SHA256.create();\n\t\t */\n\t\t init: function (cfg) {\n\t\t // Apply config defaults\n\t\t this.cfg = this.cfg.extend(cfg);\n\t\n\t\t // Set initial values\n\t\t this.reset();\n\t\t },\n\t\n\t\t /**\n\t\t * Resets this hasher to its initial state.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * hasher.reset();\n\t\t */\n\t\t reset: function () {\n\t\t // Reset data buffer\n\t\t BufferedBlockAlgorithm.reset.call(this);\n\t\n\t\t // Perform concrete-hasher logic\n\t\t this._doReset();\n\t\t },\n\t\n\t\t /**\n\t\t * Updates this hasher with a message.\n\t\t *\n\t\t * @param {WordArray|string} messageUpdate The message to append.\n\t\t *\n\t\t * @return {Hasher} This hasher.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * hasher.update('message');\n\t\t * hasher.update(wordArray);\n\t\t */\n\t\t update: function (messageUpdate) {\n\t\t // Append\n\t\t this._append(messageUpdate);\n\t\n\t\t // Update the hash\n\t\t this._process();\n\t\n\t\t // Chainable\n\t\t return this;\n\t\t },\n\t\n\t\t /**\n\t\t * Finalizes the hash computation.\n\t\t * Note that the finalize operation is effectively a destructive, read-once operation.\n\t\t *\n\t\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\n\t\t *\n\t\t * @return {WordArray} The hash.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * var hash = hasher.finalize();\n\t\t * var hash = hasher.finalize('message');\n\t\t * var hash = hasher.finalize(wordArray);\n\t\t */\n\t\t finalize: function (messageUpdate) {\n\t\t // Final message update\n\t\t if (messageUpdate) {\n\t\t this._append(messageUpdate);\n\t\t }\n\t\n\t\t // Perform concrete-hasher logic\n\t\t var hash = this._doFinalize();\n\t\n\t\t return hash;\n\t\t },\n\t\n\t\t blockSize: 512/32,\n\t\n\t\t /**\n\t\t * Creates a shortcut function to a hasher's object interface.\n\t\t *\n\t\t * @param {Hasher} hasher The hasher to create a helper for.\n\t\t *\n\t\t * @return {Function} The shortcut function.\n\t\t *\n\t\t * @static\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);\n\t\t */\n\t\t _createHelper: function (hasher) {\n\t\t return function (message, cfg) {\n\t\t return new hasher.init(cfg).finalize(message);\n\t\t };\n\t\t },\n\t\n\t\t /**\n\t\t * Creates a shortcut function to the HMAC's object interface.\n\t\t *\n\t\t * @param {Hasher} hasher The hasher to use in this HMAC helper.\n\t\t *\n\t\t * @return {Function} The shortcut function.\n\t\t *\n\t\t * @static\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);\n\t\t */\n\t\t _createHmacHelper: function (hasher) {\n\t\t return function (message, key) {\n\t\t return new C_algo.HMAC.init(hasher, key).finalize(message);\n\t\t };\n\t\t }\n\t\t });\n\t\n\t\t /**\n\t\t * Algorithm namespace.\n\t\t */\n\t\t var C_algo = C.algo = {};\n\t\n\t\t return C;\n\t\t}(Math));\n\t\n\t\n\t\treturn CryptoJS;\n\t\n\t}));\n\n/***/ },\n/* 25 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t;(function (root, factory) {\n\t\tif (true) {\n\t\t\t// CommonJS\n\t\t\tmodule.exports = exports = factory(__webpack_require__(24));\n\t\t}\n\t\telse if (typeof define === \"function\" && define.amd) {\n\t\t\t// AMD\n\t\t\tdefine([\"./core\"], factory);\n\t\t}\n\t\telse {\n\t\t\t// Global (browser)\n\t\t\tfactory(root.CryptoJS);\n\t\t}\n\t}(this, function (CryptoJS) {\n\t\n\t\t(function (Math) {\n\t\t // Shortcuts\n\t\t var C = CryptoJS;\n\t\t var C_lib = C.lib;\n\t\t var WordArray = C_lib.WordArray;\n\t\t var Hasher = C_lib.Hasher;\n\t\t var C_algo = C.algo;\n\t\n\t\t // Initialization and round constants tables\n\t\t var H = [];\n\t\t var K = [];\n\t\n\t\t // Compute constants\n\t\t (function () {\n\t\t function isPrime(n) {\n\t\t var sqrtN = Math.sqrt(n);\n\t\t for (var factor = 2; factor <= sqrtN; factor++) {\n\t\t if (!(n % factor)) {\n\t\t return false;\n\t\t }\n\t\t }\n\t\n\t\t return true;\n\t\t }\n\t\n\t\t function getFractionalBits(n) {\n\t\t return ((n - (n | 0)) * 0x100000000) | 0;\n\t\t }\n\t\n\t\t var n = 2;\n\t\t var nPrime = 0;\n\t\t while (nPrime < 64) {\n\t\t if (isPrime(n)) {\n\t\t if (nPrime < 8) {\n\t\t H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));\n\t\t }\n\t\t K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));\n\t\n\t\t nPrime++;\n\t\t }\n\t\n\t\t n++;\n\t\t }\n\t\t }());\n\t\n\t\t // Reusable object\n\t\t var W = [];\n\t\n\t\t /**\n\t\t * SHA-256 hash algorithm.\n\t\t */\n\t\t var SHA256 = C_algo.SHA256 = Hasher.extend({\n\t\t _doReset: function () {\n\t\t this._hash = new WordArray.init(H.slice(0));\n\t\t },\n\t\n\t\t _doProcessBlock: function (M, offset) {\n\t\t // Shortcut\n\t\t var H = this._hash.words;\n\t\n\t\t // Working variables\n\t\t var a = H[0];\n\t\t var b = H[1];\n\t\t var c = H[2];\n\t\t var d = H[3];\n\t\t var e = H[4];\n\t\t var f = H[5];\n\t\t var g = H[6];\n\t\t var h = H[7];\n\t\n\t\t // Computation\n\t\t for (var i = 0; i < 64; i++) {\n\t\t if (i < 16) {\n\t\t W[i] = M[offset + i] | 0;\n\t\t } else {\n\t\t var gamma0x = W[i - 15];\n\t\t var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^\n\t\t ((gamma0x << 14) | (gamma0x >>> 18)) ^\n\t\t (gamma0x >>> 3);\n\t\n\t\t var gamma1x = W[i - 2];\n\t\t var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^\n\t\t ((gamma1x << 13) | (gamma1x >>> 19)) ^\n\t\t (gamma1x >>> 10);\n\t\n\t\t W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];\n\t\t }\n\t\n\t\t var ch = (e & f) ^ (~e & g);\n\t\t var maj = (a & b) ^ (a & c) ^ (b & c);\n\t\n\t\t var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));\n\t\t var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25));\n\t\n\t\t var t1 = h + sigma1 + ch + K[i] + W[i];\n\t\t var t2 = sigma0 + maj;\n\t\n\t\t h = g;\n\t\t g = f;\n\t\t f = e;\n\t\t e = (d + t1) | 0;\n\t\t d = c;\n\t\t c = b;\n\t\t b = a;\n\t\t a = (t1 + t2) | 0;\n\t\t }\n\t\n\t\t // Intermediate hash value\n\t\t H[0] = (H[0] + a) | 0;\n\t\t H[1] = (H[1] + b) | 0;\n\t\t H[2] = (H[2] + c) | 0;\n\t\t H[3] = (H[3] + d) | 0;\n\t\t H[4] = (H[4] + e) | 0;\n\t\t H[5] = (H[5] + f) | 0;\n\t\t H[6] = (H[6] + g) | 0;\n\t\t H[7] = (H[7] + h) | 0;\n\t\t },\n\t\n\t\t _doFinalize: function () {\n\t\t // Shortcuts\n\t\t var data = this._data;\n\t\t var dataWords = data.words;\n\t\n\t\t var nBitsTotal = this._nDataBytes * 8;\n\t\t var nBitsLeft = data.sigBytes * 8;\n\t\n\t\t // Add padding\n\t\t dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);\n\t\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);\n\t\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;\n\t\t data.sigBytes = dataWords.length * 4;\n\t\n\t\t // Hash final blocks\n\t\t this._process();\n\t\n\t\t // Return final computed hash\n\t\t return this._hash;\n\t\t },\n\t\n\t\t clone: function () {\n\t\t var clone = Hasher.clone.call(this);\n\t\t clone._hash = this._hash.clone();\n\t\n\t\t return clone;\n\t\t }\n\t\t });\n\t\n\t\t /**\n\t\t * Shortcut function to the hasher's object interface.\n\t\t *\n\t\t * @param {WordArray|string} message The message to hash.\n\t\t *\n\t\t * @return {WordArray} The hash.\n\t\t *\n\t\t * @static\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * var hash = CryptoJS.SHA256('message');\n\t\t * var hash = CryptoJS.SHA256(wordArray);\n\t\t */\n\t\t C.SHA256 = Hasher._createHelper(SHA256);\n\t\n\t\t /**\n\t\t * Shortcut function to the HMAC's object interface.\n\t\t *\n\t\t * @param {WordArray|string} message The message to hash.\n\t\t * @param {WordArray|string} key The secret key.\n\t\t *\n\t\t * @return {WordArray} The HMAC.\n\t\t *\n\t\t * @static\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * var hmac = CryptoJS.HmacSHA256(message, key);\n\t\t */\n\t\t C.HmacSHA256 = Hasher._createHmacHelper(SHA256);\n\t\t}(Math));\n\t\n\t\n\t\treturn CryptoJS.SHA256;\n\t\n\t}));\n\n/***/ },\n/* 26 */\n/***/ function(module, exports) {\n\n\tfunction DummyCache() {}\n\t\n\tDummyCache.prototype.get = function () {\n\t return null;\n\t};\n\t\n\tDummyCache.prototype.has = function () {\n\t return false;\n\t};\n\t\n\tDummyCache.prototype.set = function () {\n\t};\n\t\n\tmodule.exports = DummyCache;\n\n\n/***/ },\n/* 27 */\n/***/ function(module, exports) {\n\n\tfunction ConfigurationError(message) {\n\t this.name = 'ConfigurationError';\n\t this.message = (message || '');\n\t}\n\tConfigurationError.prototype = Error.prototype;\n\t\n\tfunction TokenValidationError(message) {\n\t this.name = 'TokenValidationError';\n\t this.message = (message || '');\n\t}\n\tTokenValidationError.prototype = Error.prototype;\n\t\n\tmodule.exports = {\n\t ConfigurationError: ConfigurationError,\n\t TokenValidationError: TokenValidationError\n\t};\n\n\n/***/ },\n/* 28 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar urljoin = __webpack_require__(1);\n\tvar base64 = __webpack_require__(16);\n\tvar request = __webpack_require__(17);\n\t\n\tfunction process(jwks) {\n\t var modulus = base64.decodeToHEX(jwks.n);\n\t var exp = base64.decodeToHEX(jwks.e);\n\t\n\t return {\n\t modulus: modulus,\n\t exp: exp\n\t };\n\t}\n\t\n\tfunction getJWKS(options, cb) {\n\t var url = urljoin(options.iss, '.well-known', 'jwks.json');\n\t\n\t return request\n\t .get(url)\n\t .end(function (err, data) {\n\t var matchingKey = null;\n\t var a;\n\t var key;\n\t\n\t if (err) {\n\t cb(err);\n\t }\n\t\n\t // eslint-disable-next-line no-plusplus\n\t for (a = 0; a < data.body.keys.length && matchingKey === null; a++) {\n\t key = data.body.keys[a];\n\t if (key.kid === options.kid) {\n\t matchingKey = key;\n\t }\n\t }\n\t\n\t cb(null, process(matchingKey));\n\t });\n\t}\n\t\n\tmodule.exports = {\n\t process: process,\n\t getJWKS: getJWKS\n\t};\n\n\n/***/ },\n/* 29 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/*\n\tBased on the work of Tom Wu\n\thttp://www-cs-students.stanford.edu/~tjw/jsbn/\n\thttp://www-cs-students.stanford.edu/~tjw/jsbn/LICENSE\n\t*/\n\t\n\tvar BigInteger = __webpack_require__(31).BigInteger;\n\tvar SHA256 = __webpack_require__(25);\n\t\n\tvar DigestInfoHead = {\n\t sha1: '3021300906052b0e03021a05000414',\n\t sha224: '302d300d06096086480165030402040500041c',\n\t sha256: '3031300d060960864801650304020105000420',\n\t sha384: '3041300d060960864801650304020205000430',\n\t sha512: '3051300d060960864801650304020305000440',\n\t md2: '3020300c06082a864886f70d020205000410',\n\t md5: '3020300c06082a864886f70d020505000410',\n\t ripemd160: '3021300906052b2403020105000414'\n\t};\n\t\n\tvar DigestAlgs = {\n\t sha256: SHA256\n\t};\n\t\n\tfunction RSAVerifier(modulus, exp) {\n\t this.n = null;\n\t this.e = 0;\n\t\n\t if (modulus != null && exp != null && modulus.length > 0 && exp.length > 0) {\n\t this.n = new BigInteger(modulus, 16);\n\t this.e = parseInt(exp, 16);\n\t } else {\n\t throw new Error('Invalid key data');\n\t }\n\t}\n\t\n\tfunction getAlgorithmFromDigest(hDigestInfo) {\n\t for (var algName in DigestInfoHead) {\n\t var head = DigestInfoHead[algName];\n\t var len = head.length;\n\t\n\t if (hDigestInfo.substring(0, len) === head) {\n\t return {\n\t alg: algName,\n\t hash: hDigestInfo.substring(len)\n\t };\n\t }\n\t }\n\t return [];\n\t}\n\t\n\t\n\tRSAVerifier.prototype.verify = function (msg, encsig) {\n\t encsig = encsig.replace(/[^0-9a-f]|[\\s\\n]]/ig, '');\n\t\n\t var sig = new BigInteger(encsig, 16);\n\t if (sig.bitLength() > this.n.bitLength()) {\n\t throw new Error('Signature does not match with the key modulus.');\n\t }\n\t\n\t var decryptedSig = sig.modPowInt(this.e, this.n);\n\t var digest = decryptedSig.toString(16).replace(/^1f+00/, '');\n\t\n\t var digestInfo = getAlgorithmFromDigest(digest);\n\t if (digestInfo.length === 0) {\n\t return false;\n\t }\n\t\n\t if (!DigestAlgs.hasOwnProperty(digestInfo.alg)) {\n\t throw new Error('Hashing algorithm is not supported.');\n\t }\n\t\n\t var msgHash = DigestAlgs[digestInfo.alg](msg).toString();\n\t return (digestInfo.hash === msgHash);\n\t};\n\t\n\tmodule.exports = RSAVerifier;\n\n\n/***/ },\n/* 30 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar RSAVerifier = __webpack_require__(29);\n\tvar base64 = __webpack_require__(16);\n\tvar jwks = __webpack_require__(28);\n\tvar error = __webpack_require__(27);\n\tvar DummyCache = __webpack_require__(26);\n\tvar supportedAlgs = ['RS256'];\n\t\n\t/**\n\t * Creates a new id_token verifier\n\t * @constructor\n\t * @param {Object} parameters\n\t * @param {String} parameters.issuer name of the issuer of the token\n\t * that should match the `iss` claim in the id_token\n\t * @param {String} parameters.audience identifies the recipients that the JWT is intended for\n\t * and should match the `aud` claim\n\t * @param {Object} [parameters.jwksCache] cache for JSON Web Token Keys. By default it has no cache\n\t * @param {String} [parameters.expectedAlg='RS256'] algorithm in which the id_token was signed\n\t * and will be used to validate\n\t * @param {number} [parameters.leeway=0] number of seconds that the clock can be out of sync\n\t * while validating expiration of the id_token\n\t */\n\tfunction IdTokenVerifier(parameters) {\n\t var options = parameters || {};\n\t\n\t this.jwksCache = options.jwksCache || new DummyCache();\n\t this.expectedAlg = options.expectedAlg || 'RS256';\n\t this.issuer = options.issuer;\n\t this.audience = options.audience;\n\t this.leeway = options.leeway || 0;\n\t this.__disableExpirationCheck = options.__disableExpirationCheck || false;\n\t\n\t if (this.leeway < 0 || this.leeway > 60) {\n\t throw new error.ConfigurationError('The leeway should be positive and lower than a minute.');\n\t }\n\t\n\t if (supportedAlgs.indexOf(this.expectedAlg) === -1) {\n\t throw new error.ConfigurationError('Algorithm ' + this.expectedAlg +\n\t ' is not supported. (Expected algs: [' + supportedAlgs.join(',') + '])');\n\t }\n\t}\n\t\n\t/**\n\t * @callback verifyCallback\n\t * @param {Error} [err] error returned if the verify cannot be performed\n\t * @param {boolean} [status] if the token is valid or not\n\t */\n\t\n\t/**\n\t * Verifies an id_token\n\t *\n\t * It will validate:\n\t * - signature according to the algorithm configured in the verifier.\n\t * - if nonce is present and matches the one provided\n\t * - if `iss` and `aud` claims matches the configured issuer and audience\n\t * - if token is not expired and valid (if the `nbf` claim is in the past)\n\t *\n\t * @method verify\n\t * @param {String} token id_token to verify\n\t * @param {String} [nonce] nonce value that should match the one in the id_token claims\n\t * @param {verifyCallback} cb callback used to notify the results of the validation\n\t */\n\tIdTokenVerifier.prototype.verify = function (token, nonce, cb) {\n\t var jwt = this.decode(token);\n\t\n\t if (jwt instanceof Error) {\n\t return cb(jwt, false);\n\t }\n\t\n\t /* eslint-disable vars-on-top */\n\t var headAndPayload = jwt.encoded.header + '.' + jwt.encoded.payload;\n\t var signature = base64.decodeToHEX(jwt.encoded.signature);\n\t\n\t var alg = jwt.header.alg;\n\t var kid = jwt.header.kid;\n\t\n\t var aud = jwt.payload.aud;\n\t var iss = jwt.payload.iss;\n\t var exp = jwt.payload.exp;\n\t var nbf = jwt.payload.nbf;\n\t var tnonce = jwt.payload.nonce || null;\n\t /* eslint-enable vars-on-top */\n\t\n\t if (this.issuer !== iss) {\n\t return cb(new error.TokenValidationError('Issuer ' + iss + ' is not valid.'), false);\n\t }\n\t\n\t if (this.audience !== aud) {\n\t return cb(new error.TokenValidationError('Audience ' + aud + ' is not valid.'), false);\n\t }\n\t\n\t if (this.expectedAlg !== alg) {\n\t return cb(new error.TokenValidationError('Algorithm ' + alg +\n\t ' is not supported. (Expected algs: [' + supportedAlgs.join(',') + '])'), false);\n\t }\n\t\n\t if (tnonce !== nonce) {\n\t return cb(new error.TokenValidationError('Nonce does not match.'), false);\n\t }\n\t\n\t var expirationError = this.verifyExpAndNbf(exp, nbf); // eslint-disable-line vars-on-top\n\t\n\t if (expirationError) {\n\t return cb(expirationError, false);\n\t }\n\t\n\t return this.getRsaVerifier(iss, kid, function (err, rsaVerifier) {\n\t if (err) {\n\t return cb(err);\n\t }\n\t if (rsaVerifier.verify(headAndPayload, signature)) {\n\t return cb(null, jwt.payload);\n\t }\n\t return cb(new error.TokenValidationError('Invalid signature.'));\n\t });\n\t};\n\t\n\t/**\n\t * Verifies that the `exp` and `nbf` claims are valid in the current moment.\n\t *\n\t * @method verifyExpAndNbf\n\t * @param {String} exp value of `exp` claim\n\t * @param {String} nbf value of `nbf` claim\n\t * @return {boolean} if token is valid according to `exp` and `nbf`\n\t */\n\tIdTokenVerifier.prototype.verifyExpAndNbf = function (exp, nbf) {\n\t var now = new Date();\n\t var expDate = new Date(0);\n\t var nbfDate = new Date(0);\n\t\n\t if (this.__disableExpirationCheck) {\n\t return null;\n\t }\n\t\n\t expDate.setUTCSeconds(exp + this.leeway);\n\t\n\t if (now > expDate) {\n\t return new error.TokenValidationError('Expired token.');\n\t }\n\t\n\t if (typeof nbf === 'undefined') {\n\t return null;\n\t }\n\t nbfDate.setUTCSeconds(nbf - this.leeway);\n\t if (now < nbfDate) {\n\t return new error.TokenValidationError('The token is not valid until later in the future. ' +\n\t 'Please check your computed clock.');\n\t }\n\t\n\t return null;\n\t};\n\t\n\t/**\n\t * Verifies that the `exp` and `iat` claims are valid in the current moment.\n\t *\n\t * @method verifyExpAndIat\n\t * @param {String} exp value of `exp` claim\n\t * @param {String} iat value of `iat` claim\n\t * @return {boolean} if token is valid according to `exp` and `iat`\n\t */\n\tIdTokenVerifier.prototype.verifyExpAndIat = function (exp, iat) {\n\t var now = new Date();\n\t var expDate = new Date(0);\n\t var iatDate = new Date(0);\n\t\n\t if (this.__disableExpirationCheck) {\n\t return null;\n\t }\n\t\n\t expDate.setUTCSeconds(exp + this.leeway);\n\t\n\t if (now > expDate) {\n\t return new error.TokenValidationError('Expired token.');\n\t }\n\t\n\t iatDate.setUTCSeconds(iat - this.leeway);\n\t\n\t if (now < iatDate) {\n\t return new error.TokenValidationError('The token was issued in the future. ' +\n\t 'Please check your computed clock.');\n\t }\n\t return null;\n\t};\n\t\n\tIdTokenVerifier.prototype.getRsaVerifier = function (iss, kid, cb) {\n\t var _this = this;\n\t var cachekey = iss + kid;\n\t\n\t if (!this.jwksCache.has(cachekey)) {\n\t jwks.getJWKS({\n\t iss: iss,\n\t kid: kid\n\t }, function (err, keyInfo) {\n\t if (err) {\n\t cb(err);\n\t }\n\t _this.jwksCache.set(cachekey, keyInfo);\n\t cb(null, new RSAVerifier(keyInfo.modulus, keyInfo.exp));\n\t });\n\t } else {\n\t var keyInfo = this.jwksCache.get(cachekey); // eslint-disable-line vars-on-top\n\t cb(null, new RSAVerifier(keyInfo.modulus, keyInfo.exp));\n\t }\n\t};\n\t\n\t\n\t/**\n\t * @typedef DecodedToken\n\t * @type {Object}\n\t * @property {Object} header - content of the JWT header.\n\t * @property {Object} payload - token claims.\n\t * @property {Object} encoded - encoded parts of the token.\n\t */\n\t\n\t/**\n\t * Decodes a well formed JWT without any verification\n\t *\n\t * @method decode\n\t * @param {String} token decodes the token\n\t * @return {DecodedToken} if token is valid according to `exp` and `nbf`\n\t */\n\tIdTokenVerifier.prototype.decode = function (token) {\n\t var parts = token.split('.');\n\t var header;\n\t var payload;\n\t\n\t if (parts.length !== 3) {\n\t return new error.TokenValidationError('Cannot decode a malformed JWT');\n\t }\n\t\n\t try {\n\t header = JSON.parse(base64.decodeToString(parts[0]));\n\t payload = JSON.parse(base64.decodeToString(parts[1]));\n\t } catch (e) {\n\t return new error.TokenValidationError('Token header or payload is not valid JSON');\n\t }\n\t\n\t return {\n\t header: header,\n\t payload: payload,\n\t encoded: {\n\t header: parts[0],\n\t payload: parts[1],\n\t signature: parts[2]\n\t }\n\t };\n\t};\n\t\n\tmodule.exports = IdTokenVerifier;\n\n\n/***/ },\n/* 31 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t(function(){\n\t\n\t // Copyright (c) 2005 Tom Wu\n\t // All Rights Reserved.\n\t // See \"LICENSE\" for details.\n\t\n\t // Basic JavaScript BN library - subset useful for RSA encryption.\n\t\n\t // Bits per digit\n\t var dbits;\n\t\n\t // JavaScript engine analysis\n\t var canary = 0xdeadbeefcafe;\n\t var j_lm = ((canary&0xffffff)==0xefcafe);\n\t\n\t // (public) Constructor\n\t function BigInteger(a,b,c) {\n\t if(a != null)\n\t if(\"number\" == typeof a) this.fromNumber(a,b,c);\n\t else if(b == null && \"string\" != typeof a) this.fromString(a,256);\n\t else this.fromString(a,b);\n\t }\n\t\n\t // return new, unset BigInteger\n\t function nbi() { return new BigInteger(null); }\n\t\n\t // am: Compute w_j += (x*this_i), propagate carries,\n\t // c is initial carry, returns final carry.\n\t // c < 3*dvalue, x < 2*dvalue, this_i < dvalue\n\t // We need to select the fastest one that works in this environment.\n\t\n\t // am1: use a single mult and divide to get the high bits,\n\t // max digit bits should be 26 because\n\t // max internal value = 2*dvalue^2-2*dvalue (< 2^53)\n\t function am1(i,x,w,j,c,n) {\n\t while(--n >= 0) {\n\t var v = x*this[i++]+w[j]+c;\n\t c = Math.floor(v/0x4000000);\n\t w[j++] = v&0x3ffffff;\n\t }\n\t return c;\n\t }\n\t // am2 avoids a big mult-and-extract completely.\n\t // Max digit bits should be <= 30 because we do bitwise ops\n\t // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)\n\t function am2(i,x,w,j,c,n) {\n\t var xl = x&0x7fff, xh = x>>15;\n\t while(--n >= 0) {\n\t var l = this[i]&0x7fff;\n\t var h = this[i++]>>15;\n\t var m = xh*l+h*xl;\n\t l = xl*l+((m&0x7fff)<<15)+w[j]+(c&0x3fffffff);\n\t c = (l>>>30)+(m>>>15)+xh*h+(c>>>30);\n\t w[j++] = l&0x3fffffff;\n\t }\n\t return c;\n\t }\n\t // Alternately, set max digit bits to 28 since some\n\t // browsers slow down when dealing with 32-bit numbers.\n\t function am3(i,x,w,j,c,n) {\n\t var xl = x&0x3fff, xh = x>>14;\n\t while(--n >= 0) {\n\t var l = this[i]&0x3fff;\n\t var h = this[i++]>>14;\n\t var m = xh*l+h*xl;\n\t l = xl*l+((m&0x3fff)<<14)+w[j]+c;\n\t c = (l>>28)+(m>>14)+xh*h;\n\t w[j++] = l&0xfffffff;\n\t }\n\t return c;\n\t }\n\t var inBrowser = typeof navigator !== \"undefined\";\n\t if(inBrowser && j_lm && (navigator.appName == \"Microsoft Internet Explorer\")) {\n\t BigInteger.prototype.am = am2;\n\t dbits = 30;\n\t }\n\t else if(inBrowser && j_lm && (navigator.appName != \"Netscape\")) {\n\t BigInteger.prototype.am = am1;\n\t dbits = 26;\n\t }\n\t else { // Mozilla/Netscape seems to prefer am3\n\t BigInteger.prototype.am = am3;\n\t dbits = 28;\n\t }\n\t\n\t BigInteger.prototype.DB = dbits;\n\t BigInteger.prototype.DM = ((1<= 0; --i) r[i] = this[i];\n\t r.t = this.t;\n\t r.s = this.s;\n\t }\n\t\n\t // (protected) set from integer value x, -DV <= x < DV\n\t function bnpFromInt(x) {\n\t this.t = 1;\n\t this.s = (x<0)?-1:0;\n\t if(x > 0) this[0] = x;\n\t else if(x < -1) this[0] = x+this.DV;\n\t else this.t = 0;\n\t }\n\t\n\t // return bigint initialized to value\n\t function nbv(i) { var r = nbi(); r.fromInt(i); return r; }\n\t\n\t // (protected) set from string and radix\n\t function bnpFromString(s,b) {\n\t var k;\n\t if(b == 16) k = 4;\n\t else if(b == 8) k = 3;\n\t else if(b == 256) k = 8; // byte array\n\t else if(b == 2) k = 1;\n\t else if(b == 32) k = 5;\n\t else if(b == 4) k = 2;\n\t else { this.fromRadix(s,b); return; }\n\t this.t = 0;\n\t this.s = 0;\n\t var i = s.length, mi = false, sh = 0;\n\t while(--i >= 0) {\n\t var x = (k==8)?s[i]&0xff:intAt(s,i);\n\t if(x < 0) {\n\t if(s.charAt(i) == \"-\") mi = true;\n\t continue;\n\t }\n\t mi = false;\n\t if(sh == 0)\n\t this[this.t++] = x;\n\t else if(sh+k > this.DB) {\n\t this[this.t-1] |= (x&((1<<(this.DB-sh))-1))<>(this.DB-sh));\n\t }\n\t else\n\t this[this.t-1] |= x<= this.DB) sh -= this.DB;\n\t }\n\t if(k == 8 && (s[0]&0x80) != 0) {\n\t this.s = -1;\n\t if(sh > 0) this[this.t-1] |= ((1<<(this.DB-sh))-1)< 0 && this[this.t-1] == c) --this.t;\n\t }\n\t\n\t // (public) return string representation in given radix\n\t function bnToString(b) {\n\t if(this.s < 0) return \"-\"+this.negate().toString(b);\n\t var k;\n\t if(b == 16) k = 4;\n\t else if(b == 8) k = 3;\n\t else if(b == 2) k = 1;\n\t else if(b == 32) k = 5;\n\t else if(b == 4) k = 2;\n\t else return this.toRadix(b);\n\t var km = (1< 0) {\n\t if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }\n\t while(i >= 0) {\n\t if(p < k) {\n\t d = (this[i]&((1<>(p+=this.DB-k);\n\t }\n\t else {\n\t d = (this[i]>>(p-=k))&km;\n\t if(p <= 0) { p += this.DB; --i; }\n\t }\n\t if(d > 0) m = true;\n\t if(m) r += int2char(d);\n\t }\n\t }\n\t return m?r:\"0\";\n\t }\n\t\n\t // (public) -this\n\t function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; }\n\t\n\t // (public) |this|\n\t function bnAbs() { return (this.s<0)?this.negate():this; }\n\t\n\t // (public) return + if this > a, - if this < a, 0 if equal\n\t function bnCompareTo(a) {\n\t var r = this.s-a.s;\n\t if(r != 0) return r;\n\t var i = this.t;\n\t r = i-a.t;\n\t if(r != 0) return (this.s<0)?-r:r;\n\t while(--i >= 0) if((r=this[i]-a[i]) != 0) return r;\n\t return 0;\n\t }\n\t\n\t // returns bit length of the integer x\n\t function nbits(x) {\n\t var r = 1, t;\n\t if((t=x>>>16) != 0) { x = t; r += 16; }\n\t if((t=x>>8) != 0) { x = t; r += 8; }\n\t if((t=x>>4) != 0) { x = t; r += 4; }\n\t if((t=x>>2) != 0) { x = t; r += 2; }\n\t if((t=x>>1) != 0) { x = t; r += 1; }\n\t return r;\n\t }\n\t\n\t // (public) return the number of bits in \"this\"\n\t function bnBitLength() {\n\t if(this.t <= 0) return 0;\n\t return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM));\n\t }\n\t\n\t // (protected) r = this << n*DB\n\t function bnpDLShiftTo(n,r) {\n\t var i;\n\t for(i = this.t-1; i >= 0; --i) r[i+n] = this[i];\n\t for(i = n-1; i >= 0; --i) r[i] = 0;\n\t r.t = this.t+n;\n\t r.s = this.s;\n\t }\n\t\n\t // (protected) r = this >> n*DB\n\t function bnpDRShiftTo(n,r) {\n\t for(var i = n; i < this.t; ++i) r[i-n] = this[i];\n\t r.t = Math.max(this.t-n,0);\n\t r.s = this.s;\n\t }\n\t\n\t // (protected) r = this << n\n\t function bnpLShiftTo(n,r) {\n\t var bs = n%this.DB;\n\t var cbs = this.DB-bs;\n\t var bm = (1<= 0; --i) {\n\t r[i+ds+1] = (this[i]>>cbs)|c;\n\t c = (this[i]&bm)<= 0; --i) r[i] = 0;\n\t r[ds] = c;\n\t r.t = this.t+ds+1;\n\t r.s = this.s;\n\t r.clamp();\n\t }\n\t\n\t // (protected) r = this >> n\n\t function bnpRShiftTo(n,r) {\n\t r.s = this.s;\n\t var ds = Math.floor(n/this.DB);\n\t if(ds >= this.t) { r.t = 0; return; }\n\t var bs = n%this.DB;\n\t var cbs = this.DB-bs;\n\t var bm = (1<>bs;\n\t for(var i = ds+1; i < this.t; ++i) {\n\t r[i-ds-1] |= (this[i]&bm)<>bs;\n\t }\n\t if(bs > 0) r[this.t-ds-1] |= (this.s&bm)<>= this.DB;\n\t }\n\t if(a.t < this.t) {\n\t c -= a.s;\n\t while(i < this.t) {\n\t c += this[i];\n\t r[i++] = c&this.DM;\n\t c >>= this.DB;\n\t }\n\t c += this.s;\n\t }\n\t else {\n\t c += this.s;\n\t while(i < a.t) {\n\t c -= a[i];\n\t r[i++] = c&this.DM;\n\t c >>= this.DB;\n\t }\n\t c -= a.s;\n\t }\n\t r.s = (c<0)?-1:0;\n\t if(c < -1) r[i++] = this.DV+c;\n\t else if(c > 0) r[i++] = c;\n\t r.t = i;\n\t r.clamp();\n\t }\n\t\n\t // (protected) r = this * a, r != this,a (HAC 14.12)\n\t // \"this\" should be the larger one if appropriate.\n\t function bnpMultiplyTo(a,r) {\n\t var x = this.abs(), y = a.abs();\n\t var i = x.t;\n\t r.t = i+y.t;\n\t while(--i >= 0) r[i] = 0;\n\t for(i = 0; i < y.t; ++i) r[i+x.t] = x.am(0,y[i],r,i,0,x.t);\n\t r.s = 0;\n\t r.clamp();\n\t if(this.s != a.s) BigInteger.ZERO.subTo(r,r);\n\t }\n\t\n\t // (protected) r = this^2, r != this (HAC 14.16)\n\t function bnpSquareTo(r) {\n\t var x = this.abs();\n\t var i = r.t = 2*x.t;\n\t while(--i >= 0) r[i] = 0;\n\t for(i = 0; i < x.t-1; ++i) {\n\t var c = x.am(i,x[i],r,2*i,0,1);\n\t if((r[i+x.t]+=x.am(i+1,2*x[i],r,2*i+1,c,x.t-i-1)) >= x.DV) {\n\t r[i+x.t] -= x.DV;\n\t r[i+x.t+1] = 1;\n\t }\n\t }\n\t if(r.t > 0) r[r.t-1] += x.am(i,x[i],r,2*i,0,1);\n\t r.s = 0;\n\t r.clamp();\n\t }\n\t\n\t // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)\n\t // r != q, this != m. q or r may be null.\n\t function bnpDivRemTo(m,q,r) {\n\t var pm = m.abs();\n\t if(pm.t <= 0) return;\n\t var pt = this.abs();\n\t if(pt.t < pm.t) {\n\t if(q != null) q.fromInt(0);\n\t if(r != null) this.copyTo(r);\n\t return;\n\t }\n\t if(r == null) r = nbi();\n\t var y = nbi(), ts = this.s, ms = m.s;\n\t var nsh = this.DB-nbits(pm[pm.t-1]); // normalize modulus\n\t if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); }\n\t else { pm.copyTo(y); pt.copyTo(r); }\n\t var ys = y.t;\n\t var y0 = y[ys-1];\n\t if(y0 == 0) return;\n\t var yt = y0*(1<1)?y[ys-2]>>this.F2:0);\n\t var d1 = this.FV/yt, d2 = (1<= 0) {\n\t r[r.t++] = 1;\n\t r.subTo(t,r);\n\t }\n\t BigInteger.ONE.dlShiftTo(ys,t);\n\t t.subTo(y,y); // \"negative\" y so we can replace sub with am later\n\t while(y.t < ys) y[y.t++] = 0;\n\t while(--j >= 0) {\n\t // Estimate quotient digit\n\t var qd = (r[--i]==y0)?this.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2);\n\t if((r[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out\n\t y.dlShiftTo(j,t);\n\t r.subTo(t,r);\n\t while(r[i] < --qd) r.subTo(t,r);\n\t }\n\t }\n\t if(q != null) {\n\t r.drShiftTo(ys,q);\n\t if(ts != ms) BigInteger.ZERO.subTo(q,q);\n\t }\n\t r.t = ys;\n\t r.clamp();\n\t if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder\n\t if(ts < 0) BigInteger.ZERO.subTo(r,r);\n\t }\n\t\n\t // (public) this mod a\n\t function bnMod(a) {\n\t var r = nbi();\n\t this.abs().divRemTo(a,null,r);\n\t if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r);\n\t return r;\n\t }\n\t\n\t // Modular reduction using \"classic\" algorithm\n\t function Classic(m) { this.m = m; }\n\t function cConvert(x) {\n\t if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m);\n\t else return x;\n\t }\n\t function cRevert(x) { return x; }\n\t function cReduce(x) { x.divRemTo(this.m,null,x); }\n\t function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }\n\t function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); }\n\t\n\t Classic.prototype.convert = cConvert;\n\t Classic.prototype.revert = cRevert;\n\t Classic.prototype.reduce = cReduce;\n\t Classic.prototype.mulTo = cMulTo;\n\t Classic.prototype.sqrTo = cSqrTo;\n\t\n\t // (protected) return \"-1/this % 2^DB\"; useful for Mont. reduction\n\t // justification:\n\t // xy == 1 (mod m)\n\t // xy = 1+km\n\t // xy(2-xy) = (1+km)(1-km)\n\t // x[y(2-xy)] = 1-k^2m^2\n\t // x[y(2-xy)] == 1 (mod m^2)\n\t // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2\n\t // should reduce x and y(2-xy) by m^2 at each step to keep size bounded.\n\t // JS multiply \"overflows\" differently from C/C++, so care is needed here.\n\t function bnpInvDigit() {\n\t if(this.t < 1) return 0;\n\t var x = this[0];\n\t if((x&1) == 0) return 0;\n\t var y = x&3; // y == 1/x mod 2^2\n\t y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4\n\t y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8\n\t y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16\n\t // last step - calculate inverse mod DV directly;\n\t // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints\n\t y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits\n\t // we really want the negative inverse, and -DV < y < DV\n\t return (y>0)?this.DV-y:-y;\n\t }\n\t\n\t // Montgomery reduction\n\t function Montgomery(m) {\n\t this.m = m;\n\t this.mp = m.invDigit();\n\t this.mpl = this.mp&0x7fff;\n\t this.mph = this.mp>>15;\n\t this.um = (1<<(m.DB-15))-1;\n\t this.mt2 = 2*m.t;\n\t }\n\t\n\t // xR mod m\n\t function montConvert(x) {\n\t var r = nbi();\n\t x.abs().dlShiftTo(this.m.t,r);\n\t r.divRemTo(this.m,null,r);\n\t if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r);\n\t return r;\n\t }\n\t\n\t // x/R mod m\n\t function montRevert(x) {\n\t var r = nbi();\n\t x.copyTo(r);\n\t this.reduce(r);\n\t return r;\n\t }\n\t\n\t // x = x/R mod m (HAC 14.32)\n\t function montReduce(x) {\n\t while(x.t <= this.mt2) // pad x so am has enough room later\n\t x[x.t++] = 0;\n\t for(var i = 0; i < this.m.t; ++i) {\n\t // faster way of calculating u0 = x[i]*mp mod DV\n\t var j = x[i]&0x7fff;\n\t var u0 = (j*this.mpl+(((j*this.mph+(x[i]>>15)*this.mpl)&this.um)<<15))&x.DM;\n\t // use am to combine the multiply-shift-add into one call\n\t j = i+this.m.t;\n\t x[j] += this.m.am(0,u0,x,i,0,this.m.t);\n\t // propagate carry\n\t while(x[j] >= x.DV) { x[j] -= x.DV; x[++j]++; }\n\t }\n\t x.clamp();\n\t x.drShiftTo(this.m.t,x);\n\t if(x.compareTo(this.m) >= 0) x.subTo(this.m,x);\n\t }\n\t\n\t // r = \"x^2/R mod m\"; x != r\n\t function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); }\n\t\n\t // r = \"xy/R mod m\"; x,y != r\n\t function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }\n\t\n\t Montgomery.prototype.convert = montConvert;\n\t Montgomery.prototype.revert = montRevert;\n\t Montgomery.prototype.reduce = montReduce;\n\t Montgomery.prototype.mulTo = montMulTo;\n\t Montgomery.prototype.sqrTo = montSqrTo;\n\t\n\t // (protected) true iff this is even\n\t function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; }\n\t\n\t // (protected) this^e, e < 2^32, doing sqr and mul with \"r\" (HAC 14.79)\n\t function bnpExp(e,z) {\n\t if(e > 0xffffffff || e < 1) return BigInteger.ONE;\n\t var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1;\n\t g.copyTo(r);\n\t while(--i >= 0) {\n\t z.sqrTo(r,r2);\n\t if((e&(1< 0) z.mulTo(r2,g,r);\n\t else { var t = r; r = r2; r2 = t; }\n\t }\n\t return z.revert(r);\n\t }\n\t\n\t // (public) this^e % m, 0 <= e < 2^32\n\t function bnModPowInt(e,m) {\n\t var z;\n\t if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m);\n\t return this.exp(e,z);\n\t }\n\t\n\t // protected\n\t BigInteger.prototype.copyTo = bnpCopyTo;\n\t BigInteger.prototype.fromInt = bnpFromInt;\n\t BigInteger.prototype.fromString = bnpFromString;\n\t BigInteger.prototype.clamp = bnpClamp;\n\t BigInteger.prototype.dlShiftTo = bnpDLShiftTo;\n\t BigInteger.prototype.drShiftTo = bnpDRShiftTo;\n\t BigInteger.prototype.lShiftTo = bnpLShiftTo;\n\t BigInteger.prototype.rShiftTo = bnpRShiftTo;\n\t BigInteger.prototype.subTo = bnpSubTo;\n\t BigInteger.prototype.multiplyTo = bnpMultiplyTo;\n\t BigInteger.prototype.squareTo = bnpSquareTo;\n\t BigInteger.prototype.divRemTo = bnpDivRemTo;\n\t BigInteger.prototype.invDigit = bnpInvDigit;\n\t BigInteger.prototype.isEven = bnpIsEven;\n\t BigInteger.prototype.exp = bnpExp;\n\t\n\t // public\n\t BigInteger.prototype.toString = bnToString;\n\t BigInteger.prototype.negate = bnNegate;\n\t BigInteger.prototype.abs = bnAbs;\n\t BigInteger.prototype.compareTo = bnCompareTo;\n\t BigInteger.prototype.bitLength = bnBitLength;\n\t BigInteger.prototype.mod = bnMod;\n\t BigInteger.prototype.modPowInt = bnModPowInt;\n\t\n\t // \"constants\"\n\t BigInteger.ZERO = nbv(0);\n\t BigInteger.ONE = nbv(1);\n\t\n\t // Copyright (c) 2005-2009 Tom Wu\n\t // All Rights Reserved.\n\t // See \"LICENSE\" for details.\n\t\n\t // Extended JavaScript BN functions, required for RSA private ops.\n\t\n\t // Version 1.1: new BigInteger(\"0\", 10) returns \"proper\" zero\n\t // Version 1.2: square() API, isProbablePrime fix\n\t\n\t // (public)\n\t function bnClone() { var r = nbi(); this.copyTo(r); return r; }\n\t\n\t // (public) return value as integer\n\t function bnIntValue() {\n\t if(this.s < 0) {\n\t if(this.t == 1) return this[0]-this.DV;\n\t else if(this.t == 0) return -1;\n\t }\n\t else if(this.t == 1) return this[0];\n\t else if(this.t == 0) return 0;\n\t // assumes 16 < DB < 32\n\t return ((this[1]&((1<<(32-this.DB))-1))<>24; }\n\t\n\t // (public) return value as short (assumes DB>=16)\n\t function bnShortValue() { return (this.t==0)?this.s:(this[0]<<16)>>16; }\n\t\n\t // (protected) return x s.t. r^x < DV\n\t function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); }\n\t\n\t // (public) 0 if this == 0, 1 if this > 0\n\t function bnSigNum() {\n\t if(this.s < 0) return -1;\n\t else if(this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0;\n\t else return 1;\n\t }\n\t\n\t // (protected) convert to radix string\n\t function bnpToRadix(b) {\n\t if(b == null) b = 10;\n\t if(this.signum() == 0 || b < 2 || b > 36) return \"0\";\n\t var cs = this.chunkSize(b);\n\t var a = Math.pow(b,cs);\n\t var d = nbv(a), y = nbi(), z = nbi(), r = \"\";\n\t this.divRemTo(d,y,z);\n\t while(y.signum() > 0) {\n\t r = (a+z.intValue()).toString(b).substr(1) + r;\n\t y.divRemTo(d,y,z);\n\t }\n\t return z.intValue().toString(b) + r;\n\t }\n\t\n\t // (protected) convert from radix string\n\t function bnpFromRadix(s,b) {\n\t this.fromInt(0);\n\t if(b == null) b = 10;\n\t var cs = this.chunkSize(b);\n\t var d = Math.pow(b,cs), mi = false, j = 0, w = 0;\n\t for(var i = 0; i < s.length; ++i) {\n\t var x = intAt(s,i);\n\t if(x < 0) {\n\t if(s.charAt(i) == \"-\" && this.signum() == 0) mi = true;\n\t continue;\n\t }\n\t w = b*w+x;\n\t if(++j >= cs) {\n\t this.dMultiply(d);\n\t this.dAddOffset(w,0);\n\t j = 0;\n\t w = 0;\n\t }\n\t }\n\t if(j > 0) {\n\t this.dMultiply(Math.pow(b,j));\n\t this.dAddOffset(w,0);\n\t }\n\t if(mi) BigInteger.ZERO.subTo(this,this);\n\t }\n\t\n\t // (protected) alternate constructor\n\t function bnpFromNumber(a,b,c) {\n\t if(\"number\" == typeof b) {\n\t // new BigInteger(int,int,RNG)\n\t if(a < 2) this.fromInt(1);\n\t else {\n\t this.fromNumber(a,c);\n\t if(!this.testBit(a-1))\t// force MSB set\n\t this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this);\n\t if(this.isEven()) this.dAddOffset(1,0); // force odd\n\t while(!this.isProbablePrime(b)) {\n\t this.dAddOffset(2,0);\n\t if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this);\n\t }\n\t }\n\t }\n\t else {\n\t // new BigInteger(int,RNG)\n\t var x = new Array(), t = a&7;\n\t x.length = (a>>3)+1;\n\t b.nextBytes(x);\n\t if(t > 0) x[0] &= ((1< 0) {\n\t if(p < this.DB && (d = this[i]>>p) != (this.s&this.DM)>>p)\n\t r[k++] = d|(this.s<<(this.DB-p));\n\t while(i >= 0) {\n\t if(p < 8) {\n\t d = (this[i]&((1<>(p+=this.DB-8);\n\t }\n\t else {\n\t d = (this[i]>>(p-=8))&0xff;\n\t if(p <= 0) { p += this.DB; --i; }\n\t }\n\t if((d&0x80) != 0) d |= -256;\n\t if(k == 0 && (this.s&0x80) != (d&0x80)) ++k;\n\t if(k > 0 || d != this.s) r[k++] = d;\n\t }\n\t }\n\t return r;\n\t }\n\t\n\t function bnEquals(a) { return(this.compareTo(a)==0); }\n\t function bnMin(a) { return(this.compareTo(a)<0)?this:a; }\n\t function bnMax(a) { return(this.compareTo(a)>0)?this:a; }\n\t\n\t // (protected) r = this op a (bitwise)\n\t function bnpBitwiseTo(a,op,r) {\n\t var i, f, m = Math.min(a.t,this.t);\n\t for(i = 0; i < m; ++i) r[i] = op(this[i],a[i]);\n\t if(a.t < this.t) {\n\t f = a.s&this.DM;\n\t for(i = m; i < this.t; ++i) r[i] = op(this[i],f);\n\t r.t = this.t;\n\t }\n\t else {\n\t f = this.s&this.DM;\n\t for(i = m; i < a.t; ++i) r[i] = op(f,a[i]);\n\t r.t = a.t;\n\t }\n\t r.s = op(this.s,a.s);\n\t r.clamp();\n\t }\n\t\n\t // (public) this & a\n\t function op_and(x,y) { return x&y; }\n\t function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; }\n\t\n\t // (public) this | a\n\t function op_or(x,y) { return x|y; }\n\t function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; }\n\t\n\t // (public) this ^ a\n\t function op_xor(x,y) { return x^y; }\n\t function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; }\n\t\n\t // (public) this & ~a\n\t function op_andnot(x,y) { return x&~y; }\n\t function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; }\n\t\n\t // (public) ~this\n\t function bnNot() {\n\t var r = nbi();\n\t for(var i = 0; i < this.t; ++i) r[i] = this.DM&~this[i];\n\t r.t = this.t;\n\t r.s = ~this.s;\n\t return r;\n\t }\n\t\n\t // (public) this << n\n\t function bnShiftLeft(n) {\n\t var r = nbi();\n\t if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r);\n\t return r;\n\t }\n\t\n\t // (public) this >> n\n\t function bnShiftRight(n) {\n\t var r = nbi();\n\t if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r);\n\t return r;\n\t }\n\t\n\t // return index of lowest 1-bit in x, x < 2^31\n\t function lbit(x) {\n\t if(x == 0) return -1;\n\t var r = 0;\n\t if((x&0xffff) == 0) { x >>= 16; r += 16; }\n\t if((x&0xff) == 0) { x >>= 8; r += 8; }\n\t if((x&0xf) == 0) { x >>= 4; r += 4; }\n\t if((x&3) == 0) { x >>= 2; r += 2; }\n\t if((x&1) == 0) ++r;\n\t return r;\n\t }\n\t\n\t // (public) returns index of lowest 1-bit (or -1 if none)\n\t function bnGetLowestSetBit() {\n\t for(var i = 0; i < this.t; ++i)\n\t if(this[i] != 0) return i*this.DB+lbit(this[i]);\n\t if(this.s < 0) return this.t*this.DB;\n\t return -1;\n\t }\n\t\n\t // return number of 1 bits in x\n\t function cbit(x) {\n\t var r = 0;\n\t while(x != 0) { x &= x-1; ++r; }\n\t return r;\n\t }\n\t\n\t // (public) return number of set bits\n\t function bnBitCount() {\n\t var r = 0, x = this.s&this.DM;\n\t for(var i = 0; i < this.t; ++i) r += cbit(this[i]^x);\n\t return r;\n\t }\n\t\n\t // (public) true iff nth bit is set\n\t function bnTestBit(n) {\n\t var j = Math.floor(n/this.DB);\n\t if(j >= this.t) return(this.s!=0);\n\t return((this[j]&(1<<(n%this.DB)))!=0);\n\t }\n\t\n\t // (protected) this op (1<>= this.DB;\n\t }\n\t if(a.t < this.t) {\n\t c += a.s;\n\t while(i < this.t) {\n\t c += this[i];\n\t r[i++] = c&this.DM;\n\t c >>= this.DB;\n\t }\n\t c += this.s;\n\t }\n\t else {\n\t c += this.s;\n\t while(i < a.t) {\n\t c += a[i];\n\t r[i++] = c&this.DM;\n\t c >>= this.DB;\n\t }\n\t c += a.s;\n\t }\n\t r.s = (c<0)?-1:0;\n\t if(c > 0) r[i++] = c;\n\t else if(c < -1) r[i++] = this.DV+c;\n\t r.t = i;\n\t r.clamp();\n\t }\n\t\n\t // (public) this + a\n\t function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; }\n\t\n\t // (public) this - a\n\t function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; }\n\t\n\t // (public) this * a\n\t function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; }\n\t\n\t // (public) this^2\n\t function bnSquare() { var r = nbi(); this.squareTo(r); return r; }\n\t\n\t // (public) this / a\n\t function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }\n\t\n\t // (public) this % a\n\t function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; }\n\t\n\t // (public) [this/a,this%a]\n\t function bnDivideAndRemainder(a) {\n\t var q = nbi(), r = nbi();\n\t this.divRemTo(a,q,r);\n\t return new Array(q,r);\n\t }\n\t\n\t // (protected) this *= n, this >= 0, 1 < n < DV\n\t function bnpDMultiply(n) {\n\t this[this.t] = this.am(0,n-1,this,0,0,this.t);\n\t ++this.t;\n\t this.clamp();\n\t }\n\t\n\t // (protected) this += n << w words, this >= 0\n\t function bnpDAddOffset(n,w) {\n\t if(n == 0) return;\n\t while(this.t <= w) this[this.t++] = 0;\n\t this[w] += n;\n\t while(this[w] >= this.DV) {\n\t this[w] -= this.DV;\n\t if(++w >= this.t) this[this.t++] = 0;\n\t ++this[w];\n\t }\n\t }\n\t\n\t // A \"null\" reducer\n\t function NullExp() {}\n\t function nNop(x) { return x; }\n\t function nMulTo(x,y,r) { x.multiplyTo(y,r); }\n\t function nSqrTo(x,r) { x.squareTo(r); }\n\t\n\t NullExp.prototype.convert = nNop;\n\t NullExp.prototype.revert = nNop;\n\t NullExp.prototype.mulTo = nMulTo;\n\t NullExp.prototype.sqrTo = nSqrTo;\n\t\n\t // (public) this^e\n\t function bnPow(e) { return this.exp(e,new NullExp()); }\n\t\n\t // (protected) r = lower n words of \"this * a\", a.t <= n\n\t // \"this\" should be the larger one if appropriate.\n\t function bnpMultiplyLowerTo(a,n,r) {\n\t var i = Math.min(this.t+a.t,n);\n\t r.s = 0; // assumes a,this >= 0\n\t r.t = i;\n\t while(i > 0) r[--i] = 0;\n\t var j;\n\t for(j = r.t-this.t; i < j; ++i) r[i+this.t] = this.am(0,a[i],r,i,0,this.t);\n\t for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a[i],r,i,0,n-i);\n\t r.clamp();\n\t }\n\t\n\t // (protected) r = \"this * a\" without lower n words, n > 0\n\t // \"this\" should be the larger one if appropriate.\n\t function bnpMultiplyUpperTo(a,n,r) {\n\t --n;\n\t var i = r.t = this.t+a.t-n;\n\t r.s = 0; // assumes a,this >= 0\n\t while(--i >= 0) r[i] = 0;\n\t for(i = Math.max(n-this.t,0); i < a.t; ++i)\n\t r[this.t+i-n] = this.am(n-i,a[i],r,0,0,this.t+i-n);\n\t r.clamp();\n\t r.drShiftTo(1,r);\n\t }\n\t\n\t // Barrett modular reduction\n\t function Barrett(m) {\n\t // setup Barrett\n\t this.r2 = nbi();\n\t this.q3 = nbi();\n\t BigInteger.ONE.dlShiftTo(2*m.t,this.r2);\n\t this.mu = this.r2.divide(m);\n\t this.m = m;\n\t }\n\t\n\t function barrettConvert(x) {\n\t if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m);\n\t else if(x.compareTo(this.m) < 0) return x;\n\t else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; }\n\t }\n\t\n\t function barrettRevert(x) { return x; }\n\t\n\t // x = x mod m (HAC 14.42)\n\t function barrettReduce(x) {\n\t x.drShiftTo(this.m.t-1,this.r2);\n\t if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); }\n\t this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);\n\t this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);\n\t while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1);\n\t x.subTo(this.r2,x);\n\t while(x.compareTo(this.m) >= 0) x.subTo(this.m,x);\n\t }\n\t\n\t // r = x^2 mod m; x != r\n\t function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); }\n\t\n\t // r = x*y mod m; x,y != r\n\t function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }\n\t\n\t Barrett.prototype.convert = barrettConvert;\n\t Barrett.prototype.revert = barrettRevert;\n\t Barrett.prototype.reduce = barrettReduce;\n\t Barrett.prototype.mulTo = barrettMulTo;\n\t Barrett.prototype.sqrTo = barrettSqrTo;\n\t\n\t // (public) this^e % m (HAC 14.85)\n\t function bnModPow(e,m) {\n\t var i = e.bitLength(), k, r = nbv(1), z;\n\t if(i <= 0) return r;\n\t else if(i < 18) k = 1;\n\t else if(i < 48) k = 3;\n\t else if(i < 144) k = 4;\n\t else if(i < 768) k = 5;\n\t else k = 6;\n\t if(i < 8)\n\t z = new Classic(m);\n\t else if(m.isEven())\n\t z = new Barrett(m);\n\t else\n\t z = new Montgomery(m);\n\t\n\t // precomputation\n\t var g = new Array(), n = 3, k1 = k-1, km = (1< 1) {\n\t var g2 = nbi();\n\t z.sqrTo(g[1],g2);\n\t while(n <= km) {\n\t g[n] = nbi();\n\t z.mulTo(g2,g[n-2],g[n]);\n\t n += 2;\n\t }\n\t }\n\t\n\t var j = e.t-1, w, is1 = true, r2 = nbi(), t;\n\t i = nbits(e[j])-1;\n\t while(j >= 0) {\n\t if(i >= k1) w = (e[j]>>(i-k1))&km;\n\t else {\n\t w = (e[j]&((1<<(i+1))-1))<<(k1-i);\n\t if(j > 0) w |= e[j-1]>>(this.DB+i-k1);\n\t }\n\t\n\t n = k;\n\t while((w&1) == 0) { w >>= 1; --n; }\n\t if((i -= n) < 0) { i += this.DB; --j; }\n\t if(is1) {\t// ret == 1, don't bother squaring or multiplying it\n\t g[w].copyTo(r);\n\t is1 = false;\n\t }\n\t else {\n\t while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; }\n\t if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; }\n\t z.mulTo(r2,g[w],r);\n\t }\n\t\n\t while(j >= 0 && (e[j]&(1< 0) {\n\t x.rShiftTo(g,x);\n\t y.rShiftTo(g,y);\n\t }\n\t while(x.signum() > 0) {\n\t if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x);\n\t if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y);\n\t if(x.compareTo(y) >= 0) {\n\t x.subTo(y,x);\n\t x.rShiftTo(1,x);\n\t }\n\t else {\n\t y.subTo(x,y);\n\t y.rShiftTo(1,y);\n\t }\n\t }\n\t if(g > 0) y.lShiftTo(g,y);\n\t return y;\n\t }\n\t\n\t // (protected) this % n, n < 2^26\n\t function bnpModInt(n) {\n\t if(n <= 0) return 0;\n\t var d = this.DV%n, r = (this.s<0)?n-1:0;\n\t if(this.t > 0)\n\t if(d == 0) r = this[0]%n;\n\t else for(var i = this.t-1; i >= 0; --i) r = (d*r+this[i])%n;\n\t return r;\n\t }\n\t\n\t // (public) 1/this % m (HAC 14.61)\n\t function bnModInverse(m) {\n\t var ac = m.isEven();\n\t if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO;\n\t var u = m.clone(), v = this.clone();\n\t var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1);\n\t while(u.signum() != 0) {\n\t while(u.isEven()) {\n\t u.rShiftTo(1,u);\n\t if(ac) {\n\t if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); }\n\t a.rShiftTo(1,a);\n\t }\n\t else if(!b.isEven()) b.subTo(m,b);\n\t b.rShiftTo(1,b);\n\t }\n\t while(v.isEven()) {\n\t v.rShiftTo(1,v);\n\t if(ac) {\n\t if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); }\n\t c.rShiftTo(1,c);\n\t }\n\t else if(!d.isEven()) d.subTo(m,d);\n\t d.rShiftTo(1,d);\n\t }\n\t if(u.compareTo(v) >= 0) {\n\t u.subTo(v,u);\n\t if(ac) a.subTo(c,a);\n\t b.subTo(d,b);\n\t }\n\t else {\n\t v.subTo(u,v);\n\t if(ac) c.subTo(a,c);\n\t d.subTo(b,d);\n\t }\n\t }\n\t if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO;\n\t if(d.compareTo(m) >= 0) return d.subtract(m);\n\t if(d.signum() < 0) d.addTo(m,d); else return d;\n\t if(d.signum() < 0) return d.add(m); else return d;\n\t }\n\t\n\t var lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997];\n\t var lplim = (1<<26)/lowprimes[lowprimes.length-1];\n\t\n\t // (public) test primality with certainty >= 1-.5^t\n\t function bnIsProbablePrime(t) {\n\t var i, x = this.abs();\n\t if(x.t == 1 && x[0] <= lowprimes[lowprimes.length-1]) {\n\t for(i = 0; i < lowprimes.length; ++i)\n\t if(x[0] == lowprimes[i]) return true;\n\t return false;\n\t }\n\t if(x.isEven()) return false;\n\t i = 1;\n\t while(i < lowprimes.length) {\n\t var m = lowprimes[i], j = i+1;\n\t while(j < lowprimes.length && m < lplim) m *= lowprimes[j++];\n\t m = x.modInt(m);\n\t while(i < j) if(m%lowprimes[i++] == 0) return false;\n\t }\n\t return x.millerRabin(t);\n\t }\n\t\n\t // (protected) true if probably prime (HAC 4.24, Miller-Rabin)\n\t function bnpMillerRabin(t) {\n\t var n1 = this.subtract(BigInteger.ONE);\n\t var k = n1.getLowestSetBit();\n\t if(k <= 0) return false;\n\t var r = n1.shiftRight(k);\n\t t = (t+1)>>1;\n\t if(t > lowprimes.length) t = lowprimes.length;\n\t var a = nbi();\n\t for(var i = 0; i < t; ++i) {\n\t //Pick bases at random, instead of starting at 2\n\t a.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]);\n\t var y = a.modPow(r,this);\n\t if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {\n\t var j = 1;\n\t while(j++ < k && y.compareTo(n1) != 0) {\n\t y = y.modPowInt(2,this);\n\t if(y.compareTo(BigInteger.ONE) == 0) return false;\n\t }\n\t if(y.compareTo(n1) != 0) return false;\n\t }\n\t }\n\t return true;\n\t }\n\t\n\t // protected\n\t BigInteger.prototype.chunkSize = bnpChunkSize;\n\t BigInteger.prototype.toRadix = bnpToRadix;\n\t BigInteger.prototype.fromRadix = bnpFromRadix;\n\t BigInteger.prototype.fromNumber = bnpFromNumber;\n\t BigInteger.prototype.bitwiseTo = bnpBitwiseTo;\n\t BigInteger.prototype.changeBit = bnpChangeBit;\n\t BigInteger.prototype.addTo = bnpAddTo;\n\t BigInteger.prototype.dMultiply = bnpDMultiply;\n\t BigInteger.prototype.dAddOffset = bnpDAddOffset;\n\t BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo;\n\t BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo;\n\t BigInteger.prototype.modInt = bnpModInt;\n\t BigInteger.prototype.millerRabin = bnpMillerRabin;\n\t\n\t // public\n\t BigInteger.prototype.clone = bnClone;\n\t BigInteger.prototype.intValue = bnIntValue;\n\t BigInteger.prototype.byteValue = bnByteValue;\n\t BigInteger.prototype.shortValue = bnShortValue;\n\t BigInteger.prototype.signum = bnSigNum;\n\t BigInteger.prototype.toByteArray = bnToByteArray;\n\t BigInteger.prototype.equals = bnEquals;\n\t BigInteger.prototype.min = bnMin;\n\t BigInteger.prototype.max = bnMax;\n\t BigInteger.prototype.and = bnAnd;\n\t BigInteger.prototype.or = bnOr;\n\t BigInteger.prototype.xor = bnXor;\n\t BigInteger.prototype.andNot = bnAndNot;\n\t BigInteger.prototype.not = bnNot;\n\t BigInteger.prototype.shiftLeft = bnShiftLeft;\n\t BigInteger.prototype.shiftRight = bnShiftRight;\n\t BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit;\n\t BigInteger.prototype.bitCount = bnBitCount;\n\t BigInteger.prototype.testBit = bnTestBit;\n\t BigInteger.prototype.setBit = bnSetBit;\n\t BigInteger.prototype.clearBit = bnClearBit;\n\t BigInteger.prototype.flipBit = bnFlipBit;\n\t BigInteger.prototype.add = bnAdd;\n\t BigInteger.prototype.subtract = bnSubtract;\n\t BigInteger.prototype.multiply = bnMultiply;\n\t BigInteger.prototype.divide = bnDivide;\n\t BigInteger.prototype.remainder = bnRemainder;\n\t BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder;\n\t BigInteger.prototype.modPow = bnModPow;\n\t BigInteger.prototype.modInverse = bnModInverse;\n\t BigInteger.prototype.pow = bnPow;\n\t BigInteger.prototype.gcd = bnGCD;\n\t BigInteger.prototype.isProbablePrime = bnIsProbablePrime;\n\t\n\t // JSBN-specific extension\n\t BigInteger.prototype.square = bnSquare;\n\t\n\t // Expose the Barrett function\n\t BigInteger.prototype.Barrett = Barrett\n\t\n\t // BigInteger interfaces not implemented in jsbn:\n\t\n\t // BigInteger(int signum, byte[] magnitude)\n\t // double doubleValue()\n\t // float floatValue()\n\t // int hashCode()\n\t // long longValue()\n\t // static BigInteger valueOf(long val)\n\t\n\t\t// Random number generator - requires a PRNG backend, e.g. prng4.js\n\t\n\t\t// For best results, put code like\n\t\t// \n\t\t// in your main HTML document.\n\t\n\t\tvar rng_state;\n\t\tvar rng_pool;\n\t\tvar rng_pptr;\n\t\n\t\t// Mix in a 32-bit integer into the pool\n\t\tfunction rng_seed_int(x) {\n\t\t rng_pool[rng_pptr++] ^= x & 255;\n\t\t rng_pool[rng_pptr++] ^= (x >> 8) & 255;\n\t\t rng_pool[rng_pptr++] ^= (x >> 16) & 255;\n\t\t rng_pool[rng_pptr++] ^= (x >> 24) & 255;\n\t\t if(rng_pptr >= rng_psize) rng_pptr -= rng_psize;\n\t\t}\n\t\n\t\t// Mix in the current time (w/milliseconds) into the pool\n\t\tfunction rng_seed_time() {\n\t\t rng_seed_int(new Date().getTime());\n\t\t}\n\t\n\t\t// Initialize the pool with junk if needed.\n\t\tif(rng_pool == null) {\n\t\t rng_pool = new Array();\n\t\t rng_pptr = 0;\n\t\t var t;\n\t\t if(typeof window !== \"undefined\" && window.crypto) {\n\t\t\tif (window.crypto.getRandomValues) {\n\t\t\t // Use webcrypto if available\n\t\t\t var ua = new Uint8Array(32);\n\t\t\t window.crypto.getRandomValues(ua);\n\t\t\t for(t = 0; t < 32; ++t)\n\t\t\t\trng_pool[rng_pptr++] = ua[t];\n\t\t\t}\n\t\t\telse if(navigator.appName == \"Netscape\" && navigator.appVersion < \"5\") {\n\t\t\t // Extract entropy (256 bits) from NS4 RNG if available\n\t\t\t var z = window.crypto.random(32);\n\t\t\t for(t = 0; t < z.length; ++t)\n\t\t\t\trng_pool[rng_pptr++] = z.charCodeAt(t) & 255;\n\t\t\t}\n\t\t }\n\t\t while(rng_pptr < rng_psize) { // extract some randomness from Math.random()\n\t\t\tt = Math.floor(65536 * Math.random());\n\t\t\trng_pool[rng_pptr++] = t >>> 8;\n\t\t\trng_pool[rng_pptr++] = t & 255;\n\t\t }\n\t\t rng_pptr = 0;\n\t\t rng_seed_time();\n\t\t //rng_seed_int(window.screenX);\n\t\t //rng_seed_int(window.screenY);\n\t\t}\n\t\n\t\tfunction rng_get_byte() {\n\t\t if(rng_state == null) {\n\t\t\trng_seed_time();\n\t\t\trng_state = prng_newstate();\n\t\t\trng_state.init(rng_pool);\n\t\t\tfor(rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr)\n\t\t\t rng_pool[rng_pptr] = 0;\n\t\t\trng_pptr = 0;\n\t\t\t//rng_pool = null;\n\t\t }\n\t\t // TODO: allow reseeding after first request\n\t\t return rng_state.next();\n\t\t}\n\t\n\t\tfunction rng_get_bytes(ba) {\n\t\t var i;\n\t\t for(i = 0; i < ba.length; ++i) ba[i] = rng_get_byte();\n\t\t}\n\t\n\t\tfunction SecureRandom() {}\n\t\n\t\tSecureRandom.prototype.nextBytes = rng_get_bytes;\n\t\n\t\t// prng4.js - uses Arcfour as a PRNG\n\t\n\t\tfunction Arcfour() {\n\t\t this.i = 0;\n\t\t this.j = 0;\n\t\t this.S = new Array();\n\t\t}\n\t\n\t\t// Initialize arcfour context from key, an array of ints, each from [0..255]\n\t\tfunction ARC4init(key) {\n\t\t var i, j, t;\n\t\t for(i = 0; i < 256; ++i)\n\t\t\tthis.S[i] = i;\n\t\t j = 0;\n\t\t for(i = 0; i < 256; ++i) {\n\t\t\tj = (j + this.S[i] + key[i % key.length]) & 255;\n\t\t\tt = this.S[i];\n\t\t\tthis.S[i] = this.S[j];\n\t\t\tthis.S[j] = t;\n\t\t }\n\t\t this.i = 0;\n\t\t this.j = 0;\n\t\t}\n\t\n\t\tfunction ARC4next() {\n\t\t var t;\n\t\t this.i = (this.i + 1) & 255;\n\t\t this.j = (this.j + this.S[this.i]) & 255;\n\t\t t = this.S[this.i];\n\t\t this.S[this.i] = this.S[this.j];\n\t\t this.S[this.j] = t;\n\t\t return this.S[(t + this.S[this.i]) & 255];\n\t\t}\n\t\n\t\tArcfour.prototype.init = ARC4init;\n\t\tArcfour.prototype.next = ARC4next;\n\t\n\t\t// Plug in your RNG constructor here\n\t\tfunction prng_newstate() {\n\t\t return new Arcfour();\n\t\t}\n\t\n\t\t// Pool size must be a multiple of 4 and greater than 32.\n\t\t// An array of bytes the size of the pool will be passed to init()\n\t\tvar rng_psize = 256;\n\t\n\t BigInteger.SecureRandom = SecureRandom;\n\t BigInteger.BigInteger = BigInteger;\n\t if (true) {\n\t exports = module.exports = BigInteger;\n\t } else {\n\t this.BigInteger = BigInteger;\n\t this.SecureRandom = SecureRandom;\n\t }\n\t\n\t}).call(this);\n\n\n/***/ },\n/* 32 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Check if `fn` is a function.\n\t *\n\t * @param {Function} fn\n\t * @return {Boolean}\n\t * @api private\n\t */\n\tvar isObject = __webpack_require__(14);\n\t\n\tfunction isFunction(fn) {\n\t var tag = isObject(fn) ? Object.prototype.toString.call(fn) : '';\n\t return tag === '[object Function]';\n\t}\n\t\n\tmodule.exports = isFunction;\n\n\n/***/ },\n/* 33 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Module of mixed-in functions shared between node and client code\n\t */\n\tvar isObject = __webpack_require__(14);\n\t\n\t/**\n\t * Expose `RequestBase`.\n\t */\n\t\n\tmodule.exports = RequestBase;\n\t\n\t/**\n\t * Initialize a new `RequestBase`.\n\t *\n\t * @api public\n\t */\n\t\n\tfunction RequestBase(obj) {\n\t if (obj) return mixin(obj);\n\t}\n\t\n\t/**\n\t * Mixin the prototype properties.\n\t *\n\t * @param {Object} obj\n\t * @return {Object}\n\t * @api private\n\t */\n\t\n\tfunction mixin(obj) {\n\t for (var key in RequestBase.prototype) {\n\t obj[key] = RequestBase.prototype[key];\n\t }\n\t return obj;\n\t}\n\t\n\t/**\n\t * Clear previous timeout.\n\t *\n\t * @return {Request} for chaining\n\t * @api public\n\t */\n\t\n\tRequestBase.prototype.clearTimeout = function _clearTimeout(){\n\t clearTimeout(this._timer);\n\t clearTimeout(this._responseTimeoutTimer);\n\t delete this._timer;\n\t delete this._responseTimeoutTimer;\n\t return this;\n\t};\n\t\n\t/**\n\t * Override default response body parser\n\t *\n\t * This function will be called to convert incoming data into request.body\n\t *\n\t * @param {Function}\n\t * @api public\n\t */\n\t\n\tRequestBase.prototype.parse = function parse(fn){\n\t this._parser = fn;\n\t return this;\n\t};\n\t\n\t/**\n\t * Set format of binary response body.\n\t * In browser valid formats are 'blob' and 'arraybuffer',\n\t * which return Blob and ArrayBuffer, respectively.\n\t *\n\t * In Node all values result in Buffer.\n\t *\n\t * Examples:\n\t *\n\t * req.get('/')\n\t * .responseType('blob')\n\t * .end(callback);\n\t *\n\t * @param {String} val\n\t * @return {Request} for chaining\n\t * @api public\n\t */\n\t\n\tRequestBase.prototype.responseType = function(val){\n\t this._responseType = val;\n\t return this;\n\t};\n\t\n\t/**\n\t * Override default request body serializer\n\t *\n\t * This function will be called to convert data set via .send or .attach into payload to send\n\t *\n\t * @param {Function}\n\t * @api public\n\t */\n\t\n\tRequestBase.prototype.serialize = function serialize(fn){\n\t this._serializer = fn;\n\t return this;\n\t};\n\t\n\t/**\n\t * Set timeouts.\n\t *\n\t * - response timeout is time between sending request and receiving the first byte of the response. Includes DNS and connection time.\n\t * - deadline is the time from start of the request to receiving response body in full. If the deadline is too short large files may not load at all on slow connections.\n\t *\n\t * Value of 0 or false means no timeout.\n\t *\n\t * @param {Number|Object} ms or {response, read, deadline}\n\t * @return {Request} for chaining\n\t * @api public\n\t */\n\t\n\tRequestBase.prototype.timeout = function timeout(options){\n\t if (!options || 'object' !== typeof options) {\n\t this._timeout = options;\n\t this._responseTimeout = 0;\n\t return this;\n\t }\n\t\n\t for(var option in options) {\n\t switch(option) {\n\t case 'deadline':\n\t this._timeout = options.deadline;\n\t break;\n\t case 'response':\n\t this._responseTimeout = options.response;\n\t break;\n\t default:\n\t console.warn(\"Unknown timeout option\", option);\n\t }\n\t }\n\t return this;\n\t};\n\t\n\t/**\n\t * Set number of retry attempts on error.\n\t *\n\t * Failed requests will be retried 'count' times if timeout or err.code >= 500.\n\t *\n\t * @param {Number} count\n\t * @return {Request} for chaining\n\t * @api public\n\t */\n\t\n\tRequestBase.prototype.retry = function retry(count){\n\t // Default to 1 if no count passed or true\n\t if (arguments.length === 0 || count === true) count = 1;\n\t if (count <= 0) count = 0;\n\t this._maxRetries = count;\n\t this._retries = 0;\n\t return this;\n\t};\n\t\n\t/**\n\t * Retry request\n\t *\n\t * @return {Request} for chaining\n\t * @api private\n\t */\n\t\n\tRequestBase.prototype._retry = function() {\n\t this.clearTimeout();\n\t\n\t // node\n\t if (this.req) {\n\t this.req = null;\n\t this.req = this.request();\n\t }\n\t\n\t this._aborted = false;\n\t this.timedout = false;\n\t\n\t return this._end();\n\t};\n\t\n\t/**\n\t * Promise support\n\t *\n\t * @param {Function} resolve\n\t * @param {Function} [reject]\n\t * @return {Request}\n\t */\n\t\n\tRequestBase.prototype.then = function then(resolve, reject) {\n\t if (!this._fullfilledPromise) {\n\t var self = this;\n\t if (this._endCalled) {\n\t console.warn(\"Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises\");\n\t }\n\t this._fullfilledPromise = new Promise(function(innerResolve, innerReject){\n\t self.end(function(err, res){\n\t if (err) innerReject(err); else innerResolve(res);\n\t });\n\t });\n\t }\n\t return this._fullfilledPromise.then(resolve, reject);\n\t}\n\t\n\tRequestBase.prototype.catch = function(cb) {\n\t return this.then(undefined, cb);\n\t};\n\t\n\t/**\n\t * Allow for extension\n\t */\n\t\n\tRequestBase.prototype.use = function use(fn) {\n\t fn(this);\n\t return this;\n\t}\n\t\n\tRequestBase.prototype.ok = function(cb) {\n\t if ('function' !== typeof cb) throw Error(\"Callback required\");\n\t this._okCallback = cb;\n\t return this;\n\t};\n\t\n\tRequestBase.prototype._isResponseOK = function(res) {\n\t if (!res) {\n\t return false;\n\t }\n\t\n\t if (this._okCallback) {\n\t return this._okCallback(res);\n\t }\n\t\n\t return res.status >= 200 && res.status < 300;\n\t};\n\t\n\t\n\t/**\n\t * Get request header `field`.\n\t * Case-insensitive.\n\t *\n\t * @param {String} field\n\t * @return {String}\n\t * @api public\n\t */\n\t\n\tRequestBase.prototype.get = function(field){\n\t return this._header[field.toLowerCase()];\n\t};\n\t\n\t/**\n\t * Get case-insensitive header `field` value.\n\t * This is a deprecated internal API. Use `.get(field)` instead.\n\t *\n\t * (getHeader is no longer used internally by the superagent code base)\n\t *\n\t * @param {String} field\n\t * @return {String}\n\t * @api private\n\t * @deprecated\n\t */\n\t\n\tRequestBase.prototype.getHeader = RequestBase.prototype.get;\n\t\n\t/**\n\t * Set header `field` to `val`, or multiple fields with one object.\n\t * Case-insensitive.\n\t *\n\t * Examples:\n\t *\n\t * req.get('/')\n\t * .set('Accept', 'application/json')\n\t * .set('X-API-Key', 'foobar')\n\t * .end(callback);\n\t *\n\t * req.get('/')\n\t * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })\n\t * .end(callback);\n\t *\n\t * @param {String|Object} field\n\t * @param {String} val\n\t * @return {Request} for chaining\n\t * @api public\n\t */\n\t\n\tRequestBase.prototype.set = function(field, val){\n\t if (isObject(field)) {\n\t for (var key in field) {\n\t this.set(key, field[key]);\n\t }\n\t return this;\n\t }\n\t this._header[field.toLowerCase()] = val;\n\t this.header[field] = val;\n\t return this;\n\t};\n\t\n\t/**\n\t * Remove header `field`.\n\t * Case-insensitive.\n\t *\n\t * Example:\n\t *\n\t * req.get('/')\n\t * .unset('User-Agent')\n\t * .end(callback);\n\t *\n\t * @param {String} field\n\t */\n\tRequestBase.prototype.unset = function(field){\n\t delete this._header[field.toLowerCase()];\n\t delete this.header[field];\n\t return this;\n\t};\n\t\n\t/**\n\t * Write the field `name` and `val`, or multiple fields with one object\n\t * for \"multipart/form-data\" request bodies.\n\t *\n\t * ``` js\n\t * request.post('/upload')\n\t * .field('foo', 'bar')\n\t * .end(callback);\n\t *\n\t * request.post('/upload')\n\t * .field({ foo: 'bar', baz: 'qux' })\n\t * .end(callback);\n\t * ```\n\t *\n\t * @param {String|Object} name\n\t * @param {String|Blob|File|Buffer|fs.ReadStream} val\n\t * @return {Request} for chaining\n\t * @api public\n\t */\n\tRequestBase.prototype.field = function(name, val) {\n\t\n\t // name should be either a string or an object.\n\t if (null === name || undefined === name) {\n\t throw new Error('.field(name, val) name can not be empty');\n\t }\n\t\n\t if (this._data) {\n\t console.error(\".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()\");\n\t }\n\t\n\t if (isObject(name)) {\n\t for (var key in name) {\n\t this.field(key, name[key]);\n\t }\n\t return this;\n\t }\n\t\n\t if (Array.isArray(val)) {\n\t for (var i in val) {\n\t this.field(name, val[i]);\n\t }\n\t return this;\n\t }\n\t\n\t // val should be defined now\n\t if (null === val || undefined === val) {\n\t throw new Error('.field(name, val) val can not be empty');\n\t }\n\t if ('boolean' === typeof val) {\n\t val = '' + val;\n\t }\n\t this._getFormData().append(name, val);\n\t return this;\n\t};\n\t\n\t/**\n\t * Abort the request, and clear potential timeout.\n\t *\n\t * @return {Request}\n\t * @api public\n\t */\n\tRequestBase.prototype.abort = function(){\n\t if (this._aborted) {\n\t return this;\n\t }\n\t this._aborted = true;\n\t this.xhr && this.xhr.abort(); // browser\n\t this.req && this.req.abort(); // node\n\t this.clearTimeout();\n\t this.emit('abort');\n\t return this;\n\t};\n\t\n\t/**\n\t * Enable transmission of cookies with x-domain requests.\n\t *\n\t * Note that for this to work the origin must not be\n\t * using \"Access-Control-Allow-Origin\" with a wildcard,\n\t * and also must set \"Access-Control-Allow-Credentials\"\n\t * to \"true\".\n\t *\n\t * @api public\n\t */\n\t\n\tRequestBase.prototype.withCredentials = function(on){\n\t // This is browser-only functionality. Node side is no-op.\n\t if(on==undefined) on = true;\n\t this._withCredentials = on;\n\t return this;\n\t};\n\t\n\t/**\n\t * Set the max redirects to `n`. Does noting in browser XHR implementation.\n\t *\n\t * @param {Number} n\n\t * @return {Request} for chaining\n\t * @api public\n\t */\n\t\n\tRequestBase.prototype.redirects = function(n){\n\t this._maxRedirects = n;\n\t return this;\n\t};\n\t\n\t/**\n\t * Convert to a plain javascript object (not JSON string) of scalar properties.\n\t * Note as this method is designed to return a useful non-this value,\n\t * it cannot be chained.\n\t *\n\t * @return {Object} describing method, url, and data of this request\n\t * @api public\n\t */\n\t\n\tRequestBase.prototype.toJSON = function(){\n\t return {\n\t method: this.method,\n\t url: this.url,\n\t data: this._data,\n\t headers: this._header\n\t };\n\t};\n\t\n\t\n\t/**\n\t * Send `data` as the request body, defaulting the `.type()` to \"json\" when\n\t * an object is given.\n\t *\n\t * Examples:\n\t *\n\t * // manual json\n\t * request.post('/user')\n\t * .type('json')\n\t * .send('{\"name\":\"tj\"}')\n\t * .end(callback)\n\t *\n\t * // auto json\n\t * request.post('/user')\n\t * .send({ name: 'tj' })\n\t * .end(callback)\n\t *\n\t * // manual x-www-form-urlencoded\n\t * request.post('/user')\n\t * .type('form')\n\t * .send('name=tj')\n\t * .end(callback)\n\t *\n\t * // auto x-www-form-urlencoded\n\t * request.post('/user')\n\t * .type('form')\n\t * .send({ name: 'tj' })\n\t * .end(callback)\n\t *\n\t * // defaults to x-www-form-urlencoded\n\t * request.post('/user')\n\t * .send('name=tobi')\n\t * .send('species=ferret')\n\t * .end(callback)\n\t *\n\t * @param {String|Object} data\n\t * @return {Request} for chaining\n\t * @api public\n\t */\n\t\n\tRequestBase.prototype.send = function(data){\n\t var isObj = isObject(data);\n\t var type = this._header['content-type'];\n\t\n\t if (this._formData) {\n\t console.error(\".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()\");\n\t }\n\t\n\t if (isObj && !this._data) {\n\t if (Array.isArray(data)) {\n\t this._data = [];\n\t } else if (!this._isHost(data)) {\n\t this._data = {};\n\t }\n\t } else if (data && this._data && this._isHost(this._data)) {\n\t throw Error(\"Can't merge these send calls\");\n\t }\n\t\n\t // merge\n\t if (isObj && isObject(this._data)) {\n\t for (var key in data) {\n\t this._data[key] = data[key];\n\t }\n\t } else if ('string' == typeof data) {\n\t // default to x-www-form-urlencoded\n\t if (!type) this.type('form');\n\t type = this._header['content-type'];\n\t if ('application/x-www-form-urlencoded' == type) {\n\t this._data = this._data\n\t ? this._data + '&' + data\n\t : data;\n\t } else {\n\t this._data = (this._data || '') + data;\n\t }\n\t } else {\n\t this._data = data;\n\t }\n\t\n\t if (!isObj || this._isHost(data)) {\n\t return this;\n\t }\n\t\n\t // default to json\n\t if (!type) this.type('json');\n\t return this;\n\t};\n\t\n\t\n\t/**\n\t * Sort `querystring` by the sort function\n\t *\n\t *\n\t * Examples:\n\t *\n\t * // default order\n\t * request.get('/user')\n\t * .query('name=Nick')\n\t * .query('search=Manny')\n\t * .sortQuery()\n\t * .end(callback)\n\t *\n\t * // customized sort function\n\t * request.get('/user')\n\t * .query('name=Nick')\n\t * .query('search=Manny')\n\t * .sortQuery(function(a, b){\n\t * return a.length - b.length;\n\t * })\n\t * .end(callback)\n\t *\n\t *\n\t * @param {Function} sort\n\t * @return {Request} for chaining\n\t * @api public\n\t */\n\t\n\tRequestBase.prototype.sortQuery = function(sort) {\n\t // _sort default to true but otherwise can be a function or boolean\n\t this._sort = typeof sort === 'undefined' ? true : sort;\n\t return this;\n\t};\n\t\n\t/**\n\t * Invoke callback with timeout error.\n\t *\n\t * @api private\n\t */\n\t\n\tRequestBase.prototype._timeoutError = function(reason, timeout, errno){\n\t if (this._aborted) {\n\t return;\n\t }\n\t var err = new Error(reason + timeout + 'ms exceeded');\n\t err.timeout = timeout;\n\t err.code = 'ECONNABORTED';\n\t err.errno = errno;\n\t this.timedout = true;\n\t this.abort();\n\t this.callback(err);\n\t};\n\t\n\tRequestBase.prototype._setTimeouts = function() {\n\t var self = this;\n\t\n\t // deadline\n\t if (this._timeout && !this._timer) {\n\t this._timer = setTimeout(function(){\n\t self._timeoutError('Timeout of ', self._timeout, 'ETIME');\n\t }, this._timeout);\n\t }\n\t // response timeout\n\t if (this._responseTimeout && !this._responseTimeoutTimer) {\n\t this._responseTimeoutTimer = setTimeout(function(){\n\t self._timeoutError('Response timeout of ', self._responseTimeout, 'ETIMEDOUT');\n\t }, this._responseTimeout);\n\t }\n\t}\n\n\n/***/ },\n/* 34 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar utils = __webpack_require__(36);\n\t\n\t/**\n\t * Expose `ResponseBase`.\n\t */\n\t\n\tmodule.exports = ResponseBase;\n\t\n\t/**\n\t * Initialize a new `ResponseBase`.\n\t *\n\t * @api public\n\t */\n\t\n\tfunction ResponseBase(obj) {\n\t if (obj) return mixin(obj);\n\t}\n\t\n\t/**\n\t * Mixin the prototype properties.\n\t *\n\t * @param {Object} obj\n\t * @return {Object}\n\t * @api private\n\t */\n\t\n\tfunction mixin(obj) {\n\t for (var key in ResponseBase.prototype) {\n\t obj[key] = ResponseBase.prototype[key];\n\t }\n\t return obj;\n\t}\n\t\n\t/**\n\t * Get case-insensitive `field` value.\n\t *\n\t * @param {String} field\n\t * @return {String}\n\t * @api public\n\t */\n\t\n\tResponseBase.prototype.get = function(field){\n\t return this.header[field.toLowerCase()];\n\t};\n\t\n\t/**\n\t * Set header related properties:\n\t *\n\t * - `.type` the content type without params\n\t *\n\t * A response of \"Content-Type: text/plain; charset=utf-8\"\n\t * will provide you with a `.type` of \"text/plain\".\n\t *\n\t * @param {Object} header\n\t * @api private\n\t */\n\t\n\tResponseBase.prototype._setHeaderProperties = function(header){\n\t // TODO: moar!\n\t // TODO: make this a util\n\t\n\t // content-type\n\t var ct = header['content-type'] || '';\n\t this.type = utils.type(ct);\n\t\n\t // params\n\t var params = utils.params(ct);\n\t for (var key in params) this[key] = params[key];\n\t\n\t this.links = {};\n\t\n\t // links\n\t try {\n\t if (header.link) {\n\t this.links = utils.parseLinks(header.link);\n\t }\n\t } catch (err) {\n\t // ignore\n\t }\n\t};\n\t\n\t/**\n\t * Set flags such as `.ok` based on `status`.\n\t *\n\t * For example a 2xx response will give you a `.ok` of __true__\n\t * whereas 5xx will be __false__ and `.error` will be __true__. The\n\t * `.clientError` and `.serverError` are also available to be more\n\t * specific, and `.statusType` is the class of error ranging from 1..5\n\t * sometimes useful for mapping respond colors etc.\n\t *\n\t * \"sugar\" properties are also defined for common cases. Currently providing:\n\t *\n\t * - .noContent\n\t * - .badRequest\n\t * - .unauthorized\n\t * - .notAcceptable\n\t * - .notFound\n\t *\n\t * @param {Number} status\n\t * @api private\n\t */\n\t\n\tResponseBase.prototype._setStatusProperties = function(status){\n\t var type = status / 100 | 0;\n\t\n\t // status / class\n\t this.status = this.statusCode = status;\n\t this.statusType = type;\n\t\n\t // basics\n\t this.info = 1 == type;\n\t this.ok = 2 == type;\n\t this.redirect = 3 == type;\n\t this.clientError = 4 == type;\n\t this.serverError = 5 == type;\n\t this.error = (4 == type || 5 == type)\n\t ? this.toError()\n\t : false;\n\t\n\t // sugar\n\t this.accepted = 202 == status;\n\t this.noContent = 204 == status;\n\t this.badRequest = 400 == status;\n\t this.unauthorized = 401 == status;\n\t this.notAcceptable = 406 == status;\n\t this.forbidden = 403 == status;\n\t this.notFound = 404 == status;\n\t};\n\n\n/***/ },\n/* 35 */\n/***/ function(module, exports) {\n\n\tvar ERROR_CODES = [\n\t 'ECONNRESET',\n\t 'ETIMEDOUT',\n\t 'EADDRINFO',\n\t 'ESOCKETTIMEDOUT'\n\t];\n\t\n\t/**\n\t * Determine if a request should be retried.\n\t * (Borrowed from segmentio/superagent-retry)\n\t *\n\t * @param {Error} err\n\t * @param {Response} [res]\n\t * @returns {Boolean}\n\t */\n\tmodule.exports = function shouldRetry(err, res) {\n\t if (err && err.code && ~ERROR_CODES.indexOf(err.code)) return true;\n\t if (res && res.status && res.status >= 500) return true;\n\t // Superagent timeout\n\t if (err && 'timeout' in err && err.code == 'ECONNABORTED') return true;\n\t return false;\n\t};\n\n/***/ },\n/* 36 */\n/***/ function(module, exports) {\n\n\t\n\t/**\n\t * Return the mime type for the given `str`.\n\t *\n\t * @param {String} str\n\t * @return {String}\n\t * @api private\n\t */\n\t\n\texports.type = function(str){\n\t return str.split(/ *; */).shift();\n\t};\n\t\n\t/**\n\t * Return header field parameters.\n\t *\n\t * @param {String} str\n\t * @return {Object}\n\t * @api private\n\t */\n\t\n\texports.params = function(str){\n\t return str.split(/ *; */).reduce(function(obj, str){\n\t var parts = str.split(/ *= */);\n\t var key = parts.shift();\n\t var val = parts.shift();\n\t\n\t if (key && val) obj[key] = val;\n\t return obj;\n\t }, {});\n\t};\n\t\n\t/**\n\t * Parse Link header fields.\n\t *\n\t * @param {String} str\n\t * @return {Object}\n\t * @api private\n\t */\n\t\n\texports.parseLinks = function(str){\n\t return str.split(/ *, */).reduce(function(obj, str){\n\t var parts = str.split(/ *; */);\n\t var url = parts[0].slice(1, -1);\n\t var rel = parts[1].split(/ *= */)[1].slice(1, -1);\n\t obj[rel] = url;\n\t return obj;\n\t }, {});\n\t};\n\t\n\t/**\n\t * Strip content related fields from `header`.\n\t *\n\t * @param {Object} header\n\t * @return {Object} header\n\t * @api private\n\t */\n\t\n\texports.cleanHeader = function(header, shouldStripCookie){\n\t delete header['content-type'];\n\t delete header['content-length'];\n\t delete header['transfer-encoding'];\n\t delete header['host'];\n\t if (shouldStripCookie) {\n\t delete header['cookie'];\n\t }\n\t return header;\n\t};\n\n/***/ },\n/* 37 */,\n/* 38 */,\n/* 39 */,\n/* 40 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar urljoin = __webpack_require__(1);\n\t\n\tvar objectHelper = __webpack_require__(2);\n\tvar assert = __webpack_require__(4);\n\tvar responseHandler = __webpack_require__(6);\n\t\n\tfunction DBConnection(request, options) {\n\t this.baseOptions = options;\n\t this.request = request;\n\t}\n\t\n\t/**\n\t * @callback signUpCallback\n\t * @param {Error} [err] error returned by Auth0 with the reason why the signup failed\n\t * @param {Object} [result] result of the signup request\n\t * @param {Object} result.email user's email\n\t * @param {Object} result.emailVerified if the user's email was verified\n\t */\n\t\n\t/**\n\t * Creates a new user in a Auth0 Database connection\n\t *\n\t * @method signup\n\t * @param {Object} options\n\t * @param {String} options.email user email address\n\t * @param {String} options.password user password\n\t * @param {String} options.connection name of the connection where the user will be created\n\t * @param {Object} [options.userMetadata] additional signup attributes used for creating the user. Will be stored in `user_metadata`\n\t * @param {signUpCallback} cb\n\t * @see {@link https://auth0.com/docs/api/authentication#signup}\n\t */\n\tDBConnection.prototype.signup = function(options, cb) {\n\t var url;\n\t var body;\n\t var metadata;\n\t\n\t assert.check(\n\t options,\n\t { type: 'object', message: 'options parameter is not valid' },\n\t {\n\t connection: { type: 'string', message: 'connection option is required' },\n\t email: { type: 'string', message: 'email option is required' },\n\t password: { type: 'string', message: 'password option is required' }\n\t }\n\t );\n\t assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\t\n\t url = urljoin(this.baseOptions.rootUrl, 'dbconnections', 'signup');\n\t\n\t body = objectHelper.merge(this.baseOptions, ['clientID']).with(options);\n\t\n\t metadata = body.user_metadata || body.userMetadata;\n\t\n\t body = objectHelper.blacklist(body, ['scope', 'userMetadata', 'user_metadata']);\n\t\n\t body = objectHelper.toSnakeCase(body, ['auth0Client']);\n\t\n\t if (metadata) {\n\t body.user_metadata = metadata;\n\t }\n\t\n\t return this.request.post(url).send(body).end(responseHandler(cb));\n\t};\n\t\n\t/**\n\t * @callback changePasswordCallback\n\t * @param {Error} [err] error returned by Auth0 with the reason why the request failed\n\t */\n\t\n\t/**\n\t * Request an email with instruction to change a user's password\n\t *\n\t * @method changePassword\n\t * @param {Object} options\n\t * @param {String} options.email address where the user will recieve the change password email. It should match the user's email in Auth0\n\t * @param {String} options.connection name of the connection where the user was created\n\t * @param {changePasswordCallback} cb\n\t * @see {@link https://auth0.com/docs/api/authentication#change-password}\n\t */\n\tDBConnection.prototype.changePassword = function(options, cb) {\n\t var url;\n\t var body;\n\t\n\t assert.check(\n\t options,\n\t { type: 'object', message: 'options parameter is not valid' },\n\t {\n\t connection: { type: 'string', message: 'connection option is required' },\n\t email: { type: 'string', message: 'email option is required' }\n\t }\n\t );\n\t assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\t\n\t url = urljoin(this.baseOptions.rootUrl, 'dbconnections', 'change_password');\n\t\n\t body = objectHelper.merge(this.baseOptions, ['clientID']).with(options, ['email', 'connection']);\n\t\n\t body = objectHelper.toSnakeCase(body, ['auth0Client']);\n\t\n\t return this.request.post(url).send(body).end(responseHandler(cb));\n\t};\n\t\n\tmodule.exports = DBConnection;\n\n\n/***/ },\n/* 41 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar urljoin = __webpack_require__(1);\n\t\n\tvar objectHelper = __webpack_require__(2);\n\tvar assert = __webpack_require__(4);\n\tvar qs = __webpack_require__(5);\n\tvar responseHandler = __webpack_require__(6);\n\t\n\tfunction PasswordlessAuthentication(request, options) {\n\t this.baseOptions = options;\n\t this.request = request;\n\t}\n\t\n\tPasswordlessAuthentication.prototype.buildVerifyUrl = function(options) {\n\t var params;\n\t var qString;\n\t\n\t /* eslint-disable */\n\t assert.check(\n\t options,\n\t { type: 'object', message: 'options parameter is not valid' },\n\t {\n\t connection: { type: 'string', message: 'connection option is required' },\n\t verificationCode: { type: 'string', message: 'verificationCode option is required' },\n\t phoneNumber: {\n\t optional: false,\n\t type: 'string',\n\t message: 'phoneNumber option is required',\n\t condition: function(o) {\n\t return !o.email;\n\t }\n\t },\n\t email: {\n\t optional: false,\n\t type: 'string',\n\t message: 'email option is required',\n\t condition: function(o) {\n\t return !o.phoneNumber;\n\t }\n\t }\n\t }\n\t );\n\t /* eslint-enable */\n\t\n\t params = objectHelper\n\t .merge(this.baseOptions, [\n\t 'clientID',\n\t 'responseType',\n\t 'responseMode',\n\t 'redirectUri',\n\t 'scope',\n\t 'audience',\n\t '_csrf',\n\t 'state',\n\t '_intstate',\n\t 'protocol',\n\t 'nonce'\n\t ])\n\t .with(options);\n\t\n\t // eslint-disable-next-line\n\t if (this.baseOptions._sendTelemetry) {\n\t params.auth0Client = this.request.getTelemetryData();\n\t }\n\t\n\t params = objectHelper.toSnakeCase(params, ['auth0Client']);\n\t\n\t qString = qs.stringify(params);\n\t\n\t return urljoin(this.baseOptions.rootUrl, 'passwordless', 'verify_redirect', '?' + qString);\n\t};\n\t\n\tPasswordlessAuthentication.prototype.start = function(options, cb) {\n\t var url;\n\t var body;\n\t\n\t /* eslint-disable */\n\t assert.check(\n\t options,\n\t { type: 'object', message: 'options parameter is not valid' },\n\t {\n\t connection: { type: 'string', message: 'connection option is required' },\n\t send: {\n\t type: 'string',\n\t message: 'send option is required',\n\t values: ['link', 'code'],\n\t value_message: 'send is not valid ([link, code])'\n\t },\n\t phoneNumber: {\n\t optional: true,\n\t type: 'string',\n\t message: 'phoneNumber option is required',\n\t condition: function(o) {\n\t return o.send === 'code' || !o.email;\n\t }\n\t },\n\t email: {\n\t optional: true,\n\t type: 'string',\n\t message: 'email option is required',\n\t condition: function(o) {\n\t return o.send === 'link' || !o.phoneNumber;\n\t }\n\t },\n\t authParams: { optional: true, type: 'object', message: 'authParams option is required' }\n\t }\n\t );\n\t /* eslint-enable */\n\t\n\t assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\t\n\t url = urljoin(this.baseOptions.rootUrl, 'passwordless', 'start');\n\t\n\t body = objectHelper\n\t .merge(this.baseOptions, ['clientID', 'responseType', 'redirectUri', 'scope'])\n\t .with(options);\n\t\n\t if (body.scope) {\n\t body.authParams = body.authParams || {};\n\t body.authParams.scope = body.scope;\n\t }\n\t\n\t if (body.redirectUri) {\n\t body.authParams = body.authParams || {};\n\t body.authParams.redirect_uri = body.redirectUri;\n\t }\n\t\n\t if (body.responseType) {\n\t body.authParams = body.authParams || {};\n\t body.authParams.response_type = body.responseType;\n\t }\n\t\n\t delete body.redirectUri;\n\t delete body.responseType;\n\t delete body.scope;\n\t\n\t body = objectHelper.toSnakeCase(body, ['auth0Client', 'authParams']);\n\t\n\t return this.request.post(url).send(body).end(responseHandler(cb));\n\t};\n\t\n\tPasswordlessAuthentication.prototype.verify = function(options, cb) {\n\t var url;\n\t var cleanOption;\n\t\n\t /* eslint-disable */\n\t assert.check(\n\t options,\n\t { type: 'object', message: 'options parameter is not valid' },\n\t {\n\t connection: { type: 'string', message: 'connection option is required' },\n\t verificationCode: { type: 'string', message: 'verificationCode option is required' },\n\t phoneNumber: {\n\t optional: false,\n\t type: 'string',\n\t message: 'phoneNumber option is required',\n\t condition: function(o) {\n\t return !o.email;\n\t }\n\t },\n\t email: {\n\t optional: false,\n\t type: 'string',\n\t message: 'email option is required',\n\t condition: function(o) {\n\t return !o.phoneNumber;\n\t }\n\t }\n\t }\n\t );\n\t /* eslint-enable */\n\t\n\t assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\t\n\t cleanOption = objectHelper.pick(options, [\n\t 'connection',\n\t 'verificationCode',\n\t 'phoneNumber',\n\t 'email',\n\t 'auth0Client'\n\t ]);\n\t cleanOption = objectHelper.toSnakeCase(cleanOption, ['auth0Client']);\n\t\n\t url = urljoin(this.baseOptions.rootUrl, 'passwordless', 'verify');\n\t\n\t return this.request.post(url).send(cleanOption).end(responseHandler(cb));\n\t};\n\t\n\tmodule.exports = PasswordlessAuthentication;\n\n\n/***/ },\n/* 42 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar windowHandler = __webpack_require__(3);\n\tvar base64Url = __webpack_require__(20);\n\t\n\tfunction create(name, value, days) {\n\t var date;\n\t var expires;\n\t\n\t if (\n\t windowHandler.getDocument().cookie === undefined ||\n\t windowHandler.getDocument().cookie === null\n\t ) {\n\t throw new Error('cookie storage not available');\n\t }\n\t\n\t if (days) {\n\t var timeToExpire = days * 24 * 60 * 60 * 1000;\n\t date = new Date();\n\t date.setTime(date.getTime() + timeToExpire);\n\t expires = '; expires=' + date.toGMTString();\n\t } else {\n\t expires = '';\n\t }\n\t\n\t windowHandler.getDocument().cookie = name + '=' + base64Url.encode(value) + expires + '; path=/';\n\t}\n\t\n\tfunction read(name) {\n\t var i;\n\t var cookie;\n\t var cookies;\n\t var nameEQ = name + '=';\n\t\n\t if (\n\t windowHandler.getDocument().cookie === undefined ||\n\t windowHandler.getDocument().cookie === null\n\t ) {\n\t throw new Error('cookie storage not available');\n\t }\n\t\n\t cookies = windowHandler.getDocument().cookie.split(';');\n\t\n\t for (i = 0; i < cookies.length; i++) {\n\t cookie = cookies[i];\n\t while (cookie.charAt(0) === ' ') {\n\t cookie = cookie.substring(1, cookie.length);\n\t }\n\t if (cookie.indexOf(nameEQ) === 0) {\n\t return base64Url.decode(cookie.substring(nameEQ.length, cookie.length));\n\t }\n\t }\n\t\n\t return null;\n\t}\n\t\n\tfunction erase(name) {\n\t create(name, '', -1);\n\t}\n\t\n\tmodule.exports = {\n\t create: create,\n\t read: read,\n\t erase: erase\n\t};\n\n\n/***/ },\n/* 43 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar windowHelper = __webpack_require__(3);\n\t\n\tfunction IframeHandler(options) {\n\t this.url = options.url;\n\t this.callback = options.callback;\n\t this.timeout = options.timeout || 60 * 1000;\n\t this.timeoutCallback = options.timeoutCallback || null;\n\t this.eventListenerType = options.eventListenerType || 'message';\n\t this.iframe = null;\n\t this.timeoutHandle = null;\n\t this._destroyTimeout = null;\n\t this.transientMessageEventListener = null;\n\t this.proxyEventListener = null;\n\t // If no event identifier specified, set default\n\t this.eventValidator = options.eventValidator || {\n\t isValid: function() {\n\t return true;\n\t }\n\t };\n\t\n\t if (typeof this.callback !== 'function') {\n\t throw new Error('options.callback must be a function');\n\t }\n\t}\n\t\n\tIframeHandler.prototype.init = function() {\n\t var _this = this;\n\t var _window = windowHelper.getWindow();\n\t\n\t this.iframe = _window.document.createElement('iframe');\n\t this.iframe.style.display = 'none';\n\t this.iframe.src = this.url;\n\t\n\t // Workaround to avoid using bind that does not work in IE8\n\t this.proxyEventListener = function(e) {\n\t _this.eventListener(e);\n\t };\n\t\n\t switch (this.eventListenerType) {\n\t case 'message':\n\t this.eventSourceObject = _window;\n\t break;\n\t case 'load':\n\t this.eventSourceObject = this.iframe;\n\t break;\n\t default:\n\t throw new Error('Unsupported event listener type: ' + this.eventListenerType);\n\t }\n\t\n\t this.eventSourceObject.addEventListener(this.eventListenerType, this.proxyEventListener, false);\n\t\n\t _window.document.body.appendChild(this.iframe);\n\t\n\t this.timeoutHandle = setTimeout(function() {\n\t _this.timeoutHandler();\n\t }, this.timeout);\n\t};\n\t\n\tIframeHandler.prototype.eventListener = function(event) {\n\t var eventData = { event: event, sourceObject: this.eventSourceObject };\n\t\n\t if (!this.eventValidator.isValid(eventData)) {\n\t return;\n\t }\n\t\n\t this.destroy();\n\t this.callback(eventData);\n\t};\n\t\n\tIframeHandler.prototype.timeoutHandler = function() {\n\t this.destroy();\n\t if (this.timeoutCallback) {\n\t this.timeoutCallback();\n\t }\n\t};\n\t\n\tIframeHandler.prototype.destroy = function() {\n\t var _this = this;\n\t var _window = windowHelper.getWindow();\n\t\n\t clearTimeout(this.timeoutHandle);\n\t\n\t this._destroyTimeout = setTimeout(function() {\n\t _this.eventSourceObject.removeEventListener(\n\t _this.eventListenerType,\n\t _this.proxyEventListener,\n\t false\n\t );\n\t _window.document.body.removeChild(_this.iframe);\n\t }, 0);\n\t};\n\t\n\tmodule.exports = IframeHandler;\n\n\n/***/ },\n/* 44 */\n/***/ function(module, exports) {\n\n\t/* eslint-disable no-continue */\n\t\n\tfunction get() {\n\t if (!Object.assign) {\n\t return objectAssignPolyfill;\n\t }\n\t\n\t return Object.assign;\n\t}\n\t\n\tfunction objectAssignPolyfill(target) {\n\t 'use strict';\n\t if (target === undefined || target === null) {\n\t throw new TypeError('Cannot convert first argument to object');\n\t }\n\t\n\t var to = Object(target);\n\t for (var i = 1; i < arguments.length; i++) {\n\t var nextSource = arguments[i];\n\t if (nextSource === undefined || nextSource === null) {\n\t continue;\n\t }\n\t\n\t var keysArray = Object.keys(Object(nextSource));\n\t for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {\n\t var nextKey = keysArray[nextIndex];\n\t var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);\n\t if (desc !== undefined && desc.enumerable) {\n\t to[nextKey] = nextSource[nextKey];\n\t }\n\t }\n\t }\n\t return to;\n\t}\n\t\n\tmodule.exports = {\n\t get: get,\n\t objectAssignPolyfill: objectAssignPolyfill\n\t};\n\n\n/***/ },\n/* 45 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar objectHelper = __webpack_require__(2);\n\t\n\tvar tokenParams = [\n\t // auth0\n\t 'realm',\n\t 'audience',\n\t // oauth2\n\t 'client_id',\n\t 'client_secret',\n\t 'redirect_uri',\n\t 'scope',\n\t 'code',\n\t 'grant_type',\n\t 'username',\n\t 'password',\n\t 'refresh_token',\n\t 'assertion',\n\t 'client_assertion',\n\t 'client_assertion_type',\n\t 'code_verifier'\n\t];\n\t\n\tvar authorizeParams = [\n\t // auth0\n\t 'connection',\n\t 'connection_scope',\n\t 'auth0Client',\n\t 'owp',\n\t 'device',\n\t\n\t 'protocol',\n\t '_csrf',\n\t '_intstate',\n\t 'login_ticket',\n\t\n\t // oauth2\n\t 'client_id',\n\t 'response_type',\n\t 'response_mode',\n\t 'redirect_uri',\n\t 'audience',\n\t 'scope',\n\t 'state',\n\t 'nonce',\n\t 'display',\n\t 'prompt',\n\t 'max_age',\n\t 'ui_locales',\n\t 'claims_locales',\n\t 'id_token_hint',\n\t 'login_hint',\n\t 'acr_values',\n\t 'claims',\n\t 'registration',\n\t 'request',\n\t 'request_uri',\n\t 'code_challenge',\n\t 'code_challenge_method'\n\t];\n\t\n\tfunction oauthAuthorizeParams(warn, params) {\n\t var notAllowed = objectHelper.getKeysNotIn(params, authorizeParams);\n\t\n\t if (notAllowed.length > 0) {\n\t warn.warning(\n\t 'Following parameters are not allowed on the `/authorize` endpoint: [' +\n\t notAllowed.join(',') +\n\t ']'\n\t );\n\t }\n\t\n\t return params;\n\t}\n\t\n\tfunction oauthTokenParams(warn, params) {\n\t return objectHelper.pick(params, tokenParams);\n\t}\n\t\n\tmodule.exports = {\n\t oauthTokenParams: oauthTokenParams,\n\t oauthAuthorizeParams: oauthAuthorizeParams\n\t};\n\n\n/***/ },\n/* 46 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar version = __webpack_require__(9);\n\t\n\tfunction PluginHandler(webAuth, plugins) {\n\t this.plugins = plugins;\n\t\n\t for (var a = 0; a < this.plugins.length; a++) {\n\t if (this.plugins[a].version !== version.raw) {\n\t var pluginName = '';\n\t\n\t if (this.plugins[a].constructor && this.plugins[a].constructor.name) {\n\t pluginName = this.plugins[a].constructor.name;\n\t }\n\t\n\t throw new Error(\n\t 'Plugin ' +\n\t pluginName +\n\t ' version (' +\n\t this.plugins[a].version +\n\t ') ' +\n\t 'is not compatible with the SDK version (' +\n\t version.raw +\n\t ')'\n\t );\n\t }\n\t\n\t this.plugins[a].setWebAuth(webAuth);\n\t }\n\t}\n\t\n\tPluginHandler.prototype.get = function(extensibilityPoint) {\n\t for (var a = 0; a < this.plugins.length; a++) {\n\t if (this.plugins[a].supports(extensibilityPoint)) {\n\t return this.plugins[a].init();\n\t }\n\t }\n\t\n\t return null;\n\t};\n\t\n\tmodule.exports = PluginHandler;\n\n\n/***/ },\n/* 47 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* eslint-disable no-restricted-syntax */\n\t/* eslint-disable guard-for-in */\n\tvar WinChan = __webpack_require__(18);\n\t\n\tvar windowHandler = __webpack_require__(3);\n\tvar objectHelper = __webpack_require__(2);\n\tvar qs = __webpack_require__(5);\n\t\n\tfunction PopupHandler() {\n\t this._current_popup = null;\n\t}\n\t\n\tPopupHandler.prototype.calculatePosition = function(options) {\n\t var width = options.width || 500;\n\t var height = options.height || 600;\n\t var _window = windowHandler.getWindow();\n\t\n\t var screenX = typeof _window.screenX !== 'undefined' ? _window.screenX : _window.screenLeft;\n\t var screenY = typeof _window.screenY !== 'undefined' ? _window.screenY : _window.screenTop;\n\t\n\t var outerWidth = typeof _window.outerWidth !== 'undefined'\n\t ? _window.outerWidth\n\t : _window.document.body.clientWidth;\n\t\n\t var outerHeight = typeof _window.outerHeight !== 'undefined'\n\t ? _window.outerHeight\n\t : _window.document.body.clientHeight;\n\t\n\t var left = (outerWidth - width) / 2;\n\t var top = (outerHeight - height) / 2;\n\t\n\t return { width: width, height: height, left: screenX + left, top: screenY + top };\n\t};\n\t\n\tPopupHandler.prototype.preload = function(options) {\n\t var _this = this;\n\t var _window = windowHandler.getWindow();\n\t var popupPosition = this.calculatePosition(options.popupOptions || {});\n\t var popupOptions = objectHelper.merge(popupPosition).with(options.popupOptions);\n\t var url = options.url || 'about:blank';\n\t var windowFeatures = qs.stringify(popupOptions, {\n\t encode: false,\n\t delimiter: ','\n\t });\n\t\n\t if (this._current_popup && !this._current_popup.closed) {\n\t return this._current_popup;\n\t }\n\t\n\t this._current_popup = _window.open(url, 'auth0_signup_popup', windowFeatures);\n\t\n\t this._current_popup.kill = function() {\n\t this.close();\n\t _this._current_popup = null;\n\t };\n\t\n\t return this._current_popup;\n\t};\n\t\n\tPopupHandler.prototype.load = function(url, relayUrl, options, cb) {\n\t var _this = this;\n\t var popupPosition = this.calculatePosition(options.popupOptions || {});\n\t var popupOptions = objectHelper.merge(popupPosition).with(options.popupOptions);\n\t\n\t var winchanOptions = objectHelper\n\t .merge({\n\t url: url,\n\t relay_url: relayUrl,\n\t window_features: qs.stringify(popupOptions, {\n\t delimiter: ',',\n\t encode: false\n\t }),\n\t popup: this._current_popup\n\t })\n\t .with(options);\n\t\n\t var popup = WinChan.open(winchanOptions, function(err, data) {\n\t _this._current_popup = null;\n\t return cb(err, data);\n\t });\n\t\n\t popup.focus();\n\t\n\t return popup;\n\t};\n\t\n\tmodule.exports = PopupHandler;\n\n\n/***/ },\n/* 48 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar windowHelper = __webpack_require__(3);\n\t\n\tfunction randomString(length) {\n\t // eslint-disable-next-line\n\t var bytes = new Uint8Array(length);\n\t var result = [];\n\t var charset = '0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._~';\n\t\n\t var cryptoObj = windowHelper.getWindow().crypto || windowHelper.getWindow().msCrypto;\n\t if (!cryptoObj) {\n\t return null;\n\t }\n\t\n\t var random = cryptoObj.getRandomValues(bytes);\n\t\n\t for (var a = 0; a < random.length; a++) {\n\t result.push(charset[random[a] % charset.length]);\n\t }\n\t\n\t return result.join('');\n\t}\n\t\n\tmodule.exports = {\n\t randomString: randomString\n\t};\n\n\n/***/ },\n/* 49 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar StorageHandler = __webpack_require__(52);\n\tvar storage;\n\t\n\tfunction getStorage(force) {\n\t if (!storage || force) {\n\t storage = new StorageHandler();\n\t }\n\t return storage;\n\t}\n\t\n\tmodule.exports = {\n\t getItem: function(key) {\n\t var value = getStorage().getItem(key);\n\t return value ? JSON.parse(value) : value;\n\t },\n\t removeItem: function(key) {\n\t return getStorage().removeItem(key);\n\t },\n\t setItem: function(key, value) {\n\t var json = JSON.stringify(value);\n\t return getStorage().setItem(key, json);\n\t },\n\t reload: function() {\n\t getStorage(true);\n\t }\n\t};\n\n\n/***/ },\n/* 50 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar cookies = __webpack_require__(42);\n\t\n\tfunction CookieStorage() {}\n\t\n\tCookieStorage.prototype.getItem = function(key) {\n\t return cookies.read(key);\n\t};\n\t\n\tCookieStorage.prototype.removeItem = function(key) {\n\t cookies.erase(key);\n\t};\n\t\n\tCookieStorage.prototype.setItem = function(key, value) {\n\t cookies.create(key, value, 1);\n\t};\n\t\n\tmodule.exports = CookieStorage;\n\n\n/***/ },\n/* 51 */\n/***/ function(module, exports) {\n\n\tfunction DummyStorage() {}\n\t\n\tDummyStorage.prototype.getItem = function() {\n\t return null;\n\t};\n\t\n\tDummyStorage.prototype.removeItem = function() {};\n\t\n\tDummyStorage.prototype.setItem = function() {};\n\t\n\tmodule.exports = DummyStorage;\n\n\n/***/ },\n/* 52 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar windowHandler = __webpack_require__(3);\n\tvar DummyStorage = __webpack_require__(51);\n\tvar CookieStorage = __webpack_require__(50);\n\tvar Warn = __webpack_require__(11);\n\t\n\tfunction StorageHandler() {\n\t this.warn = new Warn({});\n\t this.storage = windowHandler.getWindow().localStorage || new CookieStorage();\n\t}\n\t\n\tStorageHandler.prototype.failover = function() {\n\t if (this.storage instanceof DummyStorage) {\n\t this.warn.warning('DummyStorage: ignore failover');\n\t return;\n\t } else if (this.storage instanceof CookieStorage) {\n\t this.warn.warning('CookieStorage: failing over DummyStorage');\n\t this.storage = new DummyStorage();\n\t } else {\n\t this.warn.warning('LocalStorage: failing over CookieStorage');\n\t this.storage = new CookieStorage();\n\t }\n\t};\n\t\n\tStorageHandler.prototype.getItem = function(key) {\n\t try {\n\t return this.storage.getItem(key);\n\t } catch (e) {\n\t this.warn.warning(e);\n\t this.failover();\n\t return this.getItem(key);\n\t }\n\t};\n\t\n\tStorageHandler.prototype.removeItem = function(key) {\n\t try {\n\t return this.storage.removeItem(key);\n\t } catch (e) {\n\t this.warn.warning(e);\n\t this.failover();\n\t return this.removeItem(key);\n\t }\n\t};\n\t\n\tStorageHandler.prototype.setItem = function(key, value) {\n\t try {\n\t return this.storage.setItem(key, value);\n\t } catch (e) {\n\t this.warn.warning(e);\n\t this.failover();\n\t return this.setItem(key, value);\n\t }\n\t};\n\t\n\tmodule.exports = StorageHandler;\n\n\n/***/ },\n/* 53 */\n/***/ function(module, exports) {\n\n\t// given a URL, extract the origin. Taken from: https://github.com/firebase/firebase-simple-login/blob/d2cb95b9f812d8488bdbfba51c3a7c153ba1a074/js/src/simple-login/transports/WinChan.js#L25-L30\n\tfunction extractOrigin(url) {\n\t if (!/^https?:\\/\\//.test(url)) url = window.location.href;\n\t var m = /^(https?:\\/\\/[-_a-zA-Z.0-9:]+)/.exec(url);\n\t if (m) return m[1];\n\t return url;\n\t}\n\t\n\tmodule.exports = {\n\t extractOrigin: extractOrigin\n\t};\n\n\n/***/ },\n/* 54 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar Authentication = __webpack_require__(19);\n\tvar Management = __webpack_require__(55);\n\tvar WebAuth = __webpack_require__(57);\n\tvar version = __webpack_require__(9);\n\t\n\tmodule.exports = {\n\t Authentication: Authentication,\n\t Management: Management,\n\t WebAuth: WebAuth,\n\t version: version.raw\n\t};\n\n\n/***/ },\n/* 55 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar urljoin = __webpack_require__(1);\n\t\n\tvar RequestBuilder = __webpack_require__(10);\n\tvar assert = __webpack_require__(4);\n\tvar responseHandler = __webpack_require__(6);\n\t\n\t/**\n\t * Auth0 Management API Client (methods allowed to be called from the browser only)\n\t * @constructor\n\t * @param {Object} options\n\t * @param {Object} options.domain your Auth0 acount domain\n\t * @param {Object} options.token a valid API token\n\t */\n\tfunction Management(options) {\n\t /* eslint-disable */\n\t assert.check(\n\t options,\n\t { type: 'object', message: 'options parameter is not valid' },\n\t {\n\t domain: { type: 'string', message: 'domain option is required' },\n\t token: { type: 'string', message: 'token option is required' },\n\t _sendTelemetry: {\n\t optional: true,\n\t type: 'boolean',\n\t message: '_sendTelemetry option is not valid'\n\t },\n\t _telemetryInfo: {\n\t optional: true,\n\t type: 'object',\n\t message: '_telemetryInfo option is not valid'\n\t }\n\t }\n\t );\n\t /* eslint-enable */\n\t\n\t this.baseOptions = options;\n\t\n\t this.baseOptions.headers = { Authorization: 'Bearer ' + this.baseOptions.token };\n\t\n\t this.request = new RequestBuilder(this.baseOptions);\n\t this.baseOptions.rootUrl = urljoin('https://' + this.baseOptions.domain, 'api', 'v2');\n\t}\n\t\n\t/**\n\t * @callback userCallback\n\t * @param {Error} [err] failure reason for the failed request to Management API\n\t * @param {Object} [result] user profile\n\t */\n\t\n\t/**\n\t * Returns the user profile\n\t *\n\t * @method getUser\n\t * @param {String} userId identifier of the user to retrieve\n\t * @param {userCallback} cb\n\t * @see https://auth0.com/docs/api/management/v2#!/Users/get_users_by_id\n\t */\n\tManagement.prototype.getUser = function(userId, cb) {\n\t var url;\n\t\n\t assert.check(userId, { type: 'string', message: 'userId parameter is not valid' });\n\t assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\t\n\t url = urljoin(this.baseOptions.rootUrl, 'users', userId);\n\t\n\t return this.request.get(url).end(responseHandler(cb, { ignoreCasing: true }));\n\t};\n\t\n\t/**\n\t * Updates the user metdata. It will patch the user metdata with the attributes sent.\n\t *\n\t *\n\t * @method patchUserMetadata\n\t * @param {String} userId\n\t * @param {Object} userMetadata\n\t * @param {userCallback} cb\n\t * @see {@link https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id}\n\t */\n\tManagement.prototype.patchUserMetadata = function(userId, userMetadata, cb) {\n\t var url;\n\t\n\t assert.check(userId, { type: 'string', message: 'userId parameter is not valid' });\n\t assert.check(userMetadata, { type: 'object', message: 'userMetadata parameter is not valid' });\n\t assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\t\n\t url = urljoin(this.baseOptions.rootUrl, 'users', userId);\n\t\n\t return this.request\n\t .patch(url)\n\t .send({ user_metadata: userMetadata })\n\t .end(responseHandler(cb, { ignoreCasing: true }));\n\t};\n\t\n\t/**\n\t * Link two users\n\t *\n\t * @method linkUser\n\t * @param {String} userId\n\t * @param {String} secondaryUserToken\n\t * @param {userCallback} cb\n\t * @see {@link https://auth0.com/docs/api/management/v2#!/Users/post_identities}\n\t */\n\tManagement.prototype.linkUser = function(userId, secondaryUserToken, cb) {\n\t var url;\n\t /* eslint-disable */\n\t assert.check(userId, { type: 'string', message: 'userId parameter is not valid' });\n\t assert.check(secondaryUserToken, {\n\t type: 'string',\n\t message: 'secondaryUserToken parameter is not valid'\n\t });\n\t assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\t /* eslint-enable */\n\t\n\t url = urljoin(this.baseOptions.rootUrl, 'users', userId, 'identities');\n\t\n\t return this.request\n\t .post(url)\n\t .send({ link_with: secondaryUserToken })\n\t .end(responseHandler(cb, { ignoreCasing: true }));\n\t};\n\t\n\tmodule.exports = Management;\n\n\n/***/ },\n/* 56 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar urljoin = __webpack_require__(1);\n\t\n\tvar windowHelper = __webpack_require__(3);\n\tvar objectHelper = __webpack_require__(2);\n\tvar RequestBuilder = __webpack_require__(10);\n\t\n\tfunction CrossOriginAuthentication(webAuth, options) {\n\t this.webAuth = webAuth;\n\t this.baseOptions = options;\n\t this.request = new RequestBuilder(options);\n\t}\n\t\n\tfunction getFragment(name) {\n\t var theWindow = windowHelper.getWindow();\n\t var value = '&' + theWindow.location.hash.substring(1);\n\t var parts = value.split('&' + name + '=');\n\t if (parts.length === 2) {\n\t return parts.pop().split('&').shift();\n\t }\n\t}\n\t\n\tfunction createKey(origin, coId) {\n\t return ['co/verifier', encodeURIComponent(origin), encodeURIComponent(coId)].join('/');\n\t}\n\t\n\t/**\n\t * Logs in the user with username and password using the cross origin authentication (/co/authenticate) flow. You can use either `username` or `email` to identify the user, but `username` will take precedence over `email`.\n\t * This only works when 3rd party cookies are enabled in the browser. After the /co/authenticate call, you'll have to use the {@link parseHash} function at the `redirectUri` specified in the constructor.\n\t *\n\t * @method login\n\t * @param {Object} options options used in the {@link authorize} call after the login_ticket is acquired\n\t * @param {String} [options.username] Username (mutually exclusive with email)\n\t * @param {String} [options.email] Email (mutually exclusive with username)\n\t * @param {String} options.password Password\n\t * @param {String} [options.realm] Realm used to authenticate the user, it can be a realm name or a database connection name\n\t * @param {crossOriginLoginCallback} cb Callback function called only when an authentication error, like invalid username or password, occurs. For other types of errors, there will be a redirect to the `redirectUri`.\n\t */\n\tCrossOriginAuthentication.prototype.login = function(options, cb) {\n\t var _this = this;\n\t var theWindow = windowHelper.getWindow();\n\t var url = urljoin(this.baseOptions.rootUrl, '/co/authenticate');\n\t var authenticateBody = {\n\t client_id: options.clientID || this.baseOptions.clientID,\n\t username: options.username || options.email\n\t };\n\t if (options.password) {\n\t authenticateBody.password = options.password;\n\t }\n\t if (options.otp) {\n\t authenticateBody.otp = options.otp;\n\t }\n\t var realm = options.realm || this.baseOptions.realm;\n\t\n\t if (realm) {\n\t var credentialType =\n\t options.credentialType ||\n\t this.baseOptions.credentialType ||\n\t 'http://auth0.com/oauth/grant-type/password-realm';\n\t authenticateBody.realm = realm;\n\t authenticateBody.credential_type = credentialType;\n\t } else {\n\t authenticateBody.credential_type = 'password';\n\t }\n\t this.request.post(url).withCredentials().send(authenticateBody).end(function(err, data) {\n\t if (err) {\n\t var errorObject = (err.response && err.response.body) || {\n\t error: 'request_error',\n\t error_description: JSON.stringify(err)\n\t };\n\t return cb(errorObject);\n\t }\n\t options = objectHelper.blacklist(options, ['username', 'password', 'credentialType', 'otp']);\n\t var authorizeOptions = objectHelper\n\t .merge(options)\n\t .with({ loginTicket: data.body.login_ticket });\n\t var key = createKey(_this.baseOptions.rootUrl, data.body.co_id);\n\t theWindow.sessionStorage[key] = data.body.co_verifier;\n\t _this.webAuth.authorize(authorizeOptions);\n\t });\n\t};\n\t\n\tfunction tryGetVerifier(theWindow, key) {\n\t try {\n\t var verifier = theWindow.sessionStorage[key];\n\t theWindow.sessionStorage.removeItem(key);\n\t return verifier;\n\t } catch (e) {\n\t return '';\n\t }\n\t}\n\t\n\t/**\n\t * Runs the callback code for the cross origin authentication call. This method is meant to be called by the cross origin authentication callback url.\n\t *\n\t * @method callback\n\t */\n\tCrossOriginAuthentication.prototype.callback = function() {\n\t var targetOrigin = decodeURIComponent(getFragment('origin'));\n\t var theWindow = windowHelper.getWindow();\n\t\n\t theWindow.addEventListener('message', function(evt) {\n\t if (evt.data.type !== 'co_verifier_request') {\n\t return;\n\t }\n\t var key = createKey(evt.origin, evt.data.request.id);\n\t var verifier = tryGetVerifier(theWindow, key);\n\t\n\t evt.source.postMessage(\n\t {\n\t type: 'co_verifier_response',\n\t response: {\n\t verifier: verifier\n\t }\n\t },\n\t evt.origin\n\t );\n\t });\n\t\n\t theWindow.parent.postMessage({ type: 'ready' }, targetOrigin);\n\t};\n\t\n\tmodule.exports = CrossOriginAuthentication;\n\n\n/***/ },\n/* 57 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar IdTokenVerifier = __webpack_require__(30);\n\t\n\tvar assert = __webpack_require__(4);\n\tvar error = __webpack_require__(21);\n\tvar qs = __webpack_require__(5);\n\tvar PluginHandler = __webpack_require__(46);\n\tvar windowHelper = __webpack_require__(3);\n\tvar objectHelper = __webpack_require__(2);\n\tvar TransactionManager = __webpack_require__(22);\n\tvar Authentication = __webpack_require__(19);\n\tvar Redirect = __webpack_require__(59);\n\tvar Popup = __webpack_require__(58);\n\tvar SilentAuthenticationHandler = __webpack_require__(60);\n\tvar CrossOriginAuthentication = __webpack_require__(56);\n\t/**\n\t * Handles all the browser's AuthN/AuthZ flows\n\t * @constructor\n\t * @param {Object} options\n\t * @param {String} options.domain your Auth0 domain\n\t * @param {String} options.clientID your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard\n\t * @param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorization Response\n\t * @param {String} [options.responseType] type of the response used by OAuth 2.0 flow. It can be any space separated list of the values `code`, `token`, `id_token`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0}\n\t * @param {String} [options.responseMode] how the Auth response is encoded and redirected back to the client. Supported values are `query`, `fragment` and `form_post`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes}\n\t * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email`\n\t * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth\n\t * @param {Array} [options.plugins]\n\t * @param {Number} [options._timesToRetryFailedRequests] Number of times to retry a failed request, according to {@link https://github.com/visionmedia/superagent/blob/master/lib/should-retry.js}\n\t * @see {@link https://auth0.com/docs/api/authentication}\n\t */\n\tfunction WebAuth(options) {\n\t /* eslint-disable */\n\t assert.check(\n\t options,\n\t { type: 'object', message: 'options parameter is not valid' },\n\t {\n\t domain: { type: 'string', message: 'domain option is required' },\n\t clientID: { type: 'string', message: 'clientID option is required' },\n\t responseType: { optional: true, type: 'string', message: 'responseType is not valid' },\n\t responseMode: { optional: true, type: 'string', message: 'responseMode is not valid' },\n\t redirectUri: { optional: true, type: 'string', message: 'redirectUri is not valid' },\n\t scope: { optional: true, type: 'string', message: 'scope is not valid' },\n\t audience: { optional: true, type: 'string', message: 'audience is not valid' },\n\t leeway: { optional: true, type: 'number', message: 'leeway is not valid' },\n\t plugins: { optional: true, type: 'array', message: 'plugins is not valid' },\n\t _disableDeprecationWarnings: {\n\t optional: true,\n\t type: 'boolean',\n\t message: '_disableDeprecationWarnings option is not valid'\n\t },\n\t _sendTelemetry: {\n\t optional: true,\n\t type: 'boolean',\n\t message: '_sendTelemetry option is not valid'\n\t },\n\t _telemetryInfo: {\n\t optional: true,\n\t type: 'object',\n\t message: '_telemetryInfo option is not valid'\n\t },\n\t _timesToRetryFailedRequests: {\n\t optional: true,\n\t type: 'number',\n\t message: '_timesToRetryFailedRequests option is not valid'\n\t }\n\t }\n\t );\n\t\n\t if (options.overrides) {\n\t assert.check(\n\t options.overrides,\n\t { type: 'object', message: 'overrides option is not valid' },\n\t {\n\t __tenant: { type: 'string', message: '__tenant option is required' },\n\t __token_issuer: { type: 'string', message: '__token_issuer option is required' }\n\t }\n\t );\n\t }\n\t /* eslint-enable */\n\t\n\t this.baseOptions = options;\n\t this.baseOptions.plugins = new PluginHandler(this, this.baseOptions.plugins || []);\n\t\n\t this.baseOptions._sendTelemetry = this.baseOptions._sendTelemetry === false\n\t ? this.baseOptions._sendTelemetry\n\t : true;\n\t\n\t this.baseOptions._timesToRetryFailedRequests = options._timesToRetryFailedRequests\n\t ? parseInt(options._timesToRetryFailedRequests, 0)\n\t : 0;\n\t\n\t this.baseOptions.tenant =\n\t (this.baseOptions.overrides && this.baseOptions.overrides.__tenant) ||\n\t this.baseOptions.domain.split('.')[0];\n\t\n\t this.baseOptions.token_issuer =\n\t (this.baseOptions.overrides && this.baseOptions.overrides.__token_issuer) ||\n\t 'https://' + this.baseOptions.domain + '/';\n\t\n\t this.transactionManager = new TransactionManager(this.baseOptions.transaction);\n\t\n\t this.client = new Authentication(this.baseOptions);\n\t this.redirect = new Redirect(this.client, this.baseOptions);\n\t this.popup = new Popup(this, this.baseOptions);\n\t this.crossOriginAuthentication = new CrossOriginAuthentication(this, this.baseOptions);\n\t}\n\t\n\t/**\n\t * Parse the url hash and extract the Auth response from a Auth flow started with {@link authorize}\n\t *\n\t * Only validates id_tokens signed by Auth0 using the RS256 algorithm using the public key exposed\n\t * by the `/.well-known/jwks.json` endpoint of your account.\n\t * Tokens signed with other algorithms, e.g. HS256 will not be accepted.\n\t *\n\t * @method parseHash\n\t * @param {Object} options\n\t * @param {String} options.hash the url hash. If not provided it will extract from window.location.hash\n\t * @param {String} [options.state] value originally sent in `state` parameter to {@link authorize} to mitigate XSRF\n\t * @param {String} [options.nonce] value originally sent in `nonce` parameter to {@link authorize} to prevent replay attacks\n\t * @param {String} [options._idTokenVerification] makes parseHash perform or skip `id_token` verification. We **strongly** recommend validating the `id_token` yourself if you disable the verification.\n\t * @param {authorizeCallback} cb\n\t */\n\tWebAuth.prototype.parseHash = function(options, cb) {\n\t var parsedQs;\n\t var err;\n\t var state;\n\t var transaction;\n\t var transactionNonce;\n\t\n\t if (!cb && typeof options === 'function') {\n\t cb = options;\n\t options = {};\n\t } else {\n\t options = options || {};\n\t }\n\t\n\t options._idTokenVerification = !(options._idTokenVerification === false);\n\t\n\t var _window = windowHelper.getWindow();\n\t\n\t var hashStr = options.hash === undefined ? _window.location.hash : options.hash;\n\t hashStr = hashStr.replace(/^#?\\/?/, '');\n\t\n\t parsedQs = qs.parse(hashStr);\n\t\n\t if (parsedQs.hasOwnProperty('error')) {\n\t err = error.buildResponse(parsedQs.error, parsedQs.error_description);\n\t\n\t if (parsedQs.state) {\n\t err.state = parsedQs.state;\n\t }\n\t\n\t return cb(err);\n\t }\n\t\n\t if (\n\t !parsedQs.hasOwnProperty('access_token') &&\n\t !parsedQs.hasOwnProperty('id_token') &&\n\t !parsedQs.hasOwnProperty('refresh_token')\n\t ) {\n\t return cb(null, null);\n\t }\n\t\n\t state = parsedQs.state || options.state;\n\t\n\t transaction = this.transactionManager.getStoredTransaction(state);\n\t transactionNonce = options.nonce || (transaction && transaction.nonce) || null;\n\t\n\t var applicationStatus = (transaction && transaction.appStatus) || null;\n\t if (parsedQs.id_token && options._idTokenVerification) {\n\t return this.validateToken(parsedQs.id_token, transactionNonce, function(\n\t validationError,\n\t payload\n\t ) {\n\t if (validationError) {\n\t return cb(validationError);\n\t }\n\t return cb(null, buildParseHashResponse(parsedQs, applicationStatus, payload));\n\t });\n\t }\n\t\n\t if (parsedQs.id_token) {\n\t var verifier = new IdTokenVerifier({\n\t issuer: this.baseOptions.token_issuer,\n\t audience: this.baseOptions.clientID,\n\t leeway: this.baseOptions.leeway || 0,\n\t __disableExpirationCheck: this.baseOptions.__disableExpirationCheck\n\t });\n\t\n\t var decodedToken = verifier.decode(parsedQs.id_token);\n\t cb(null, buildParseHashResponse(parsedQs, applicationStatus, decodedToken.payload));\n\t } else {\n\t cb(null, buildParseHashResponse(parsedQs, applicationStatus, null));\n\t }\n\t};\n\t\n\tfunction buildParseHashResponse(qsParams, appStatus, token) {\n\t return {\n\t accessToken: qsParams.access_token || null,\n\t idToken: qsParams.id_token || null,\n\t idTokenPayload: token || null,\n\t appStatus: appStatus || null,\n\t refreshToken: qsParams.refresh_token || null,\n\t state: qsParams.state || null,\n\t expiresIn: qsParams.expires_in ? parseInt(qsParams.expires_in, 10) : null,\n\t tokenType: qsParams.token_type || null,\n\t scope: qsParams.scope || null\n\t };\n\t}\n\t\n\t/**\n\t * @callback validateTokenCallback\n\t * @param {Error} [err] error returned by while validating the token\n\t * @param {Object} [payload] claims stored in the token\n\t */\n\t\n\t/**\n\t * Decodes the a JWT and verifies its nonce value\n\t *\n\t * @method validateToken\n\t * @private\n\t * @param {String} token\n\t * @param {String} nonce\n\t * @param {validateTokenCallback} cb\n\t */\n\tWebAuth.prototype.validateToken = function(token, nonce, cb) {\n\t var verifier = new IdTokenVerifier({\n\t issuer: this.baseOptions.token_issuer,\n\t audience: this.baseOptions.clientID,\n\t leeway: this.baseOptions.leeway || 0,\n\t __disableExpirationCheck: this.baseOptions.__disableExpirationCheck\n\t });\n\t\n\t verifier.verify(token, nonce, function(err, payload) {\n\t if (err) {\n\t return cb(error.invalidJwt(err.message));\n\t }\n\t\n\t cb(null, payload);\n\t });\n\t};\n\t\n\t/**\n\t * Executes a silent authentication transaction under the hood in order to fetch a new tokens for the current session.\n\t * This method requires that all Auth is performed with {@link authorize}\n\t * Watch out! If you're not using the hosted login page to do social logins, you have to use your own [social connection keys](https://manage.auth0.com/#/connections/social). If you use Auth0's dev keys, you'll always get `login_required` as an error when calling this method.\n\t *\n\t * @method renewAuth\n\t * @param {Object} options\n\t * @param {String} [options.domain] your Auth0 domain\n\t * @param {String} [options.clientID] your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard\n\t * @param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorization Response\n\t * @param {String} [options.responseType] type of the response used by OAuth 2.0 flow. It can be any space separated list of the values `code`, `token`, `id_token`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0}\n\t * @param {String} [options.responseMode] how the Auth response is encoded and redirected back to the client. Supported values are `query`, `fragment` and `form_post`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes}\n\t * @param {String} [options.state] value used to mitigate XSRF attacks. {@link https://auth0.com/docs/protocols/oauth2/oauth-state}\n\t * @param {String} [options.nonce] value used to mitigate replay attacks when using Implicit Grant. {@link https://auth0.com/docs/api-auth/tutorials/nonce}\n\t * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email`\n\t * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth\n\t * @param {String} [options.postMessageDataType] identifier data type to look for in postMessage event data, where events are initiated from silent callback urls, before accepting a message event is the event expected. A value of false means any postMessage event will trigger a callback.\n\t * @see {@link https://auth0.com/docs/api/authentication#authorize-client}\n\t */\n\tWebAuth.prototype.renewAuth = function(options, cb) {\n\t var handler;\n\t var usePostMessage = !!options.usePostMessage;\n\t var postMessageDataType = options.postMessageDataType || false;\n\t var _this = this;\n\t\n\t var params = objectHelper\n\t .merge(this.baseOptions, [\n\t 'clientID',\n\t 'redirectUri',\n\t 'responseType',\n\t 'scope',\n\t 'audience',\n\t '_csrf',\n\t 'state',\n\t '_intstate',\n\t 'nonce'\n\t ])\n\t .with(options);\n\t\n\t params.responseType = params.responseType || 'token';\n\t params.responseMode = params.responseMode || 'fragment';\n\t if (!options.nonce) {\n\t params = this.transactionManager.process(params);\n\t }\n\t\n\t assert.check(params, { type: 'object', message: 'options parameter is not valid' });\n\t assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\t\n\t params.prompt = 'none';\n\t\n\t params = objectHelper.blacklist(params, ['usePostMessage', 'tenant', 'postMessageDataType']);\n\t\n\t handler = SilentAuthenticationHandler.create({\n\t authenticationUrl: this.client.buildAuthorizeUrl(params),\n\t postMessageDataType: postMessageDataType\n\t });\n\t\n\t handler.login(usePostMessage, function(err, hash) {\n\t if (typeof hash === 'object') {\n\t // hash was already parsed, so we just return it.\n\t // it's here to be backwards compatible and should be removed in the next major version.\n\t return cb(err, hash);\n\t }\n\t var transaction = _this.transactionManager.getStoredTransaction(params.state);\n\t var transactionNonce = options.nonce || (transaction && transaction.nonce) || null;\n\t var transactionState = options.state || (transaction && transaction.state) || null;\n\t _this.parseHash({ hash: hash, nonce: transactionNonce, state: transactionState }, cb);\n\t });\n\t};\n\t\n\t/**\n\t * Request an email with instruction to change a user's password\n\t *\n\t * @method changePassword\n\t * @param {Object} options\n\t * @param {String} options.email address where the user will recieve the change password email. It should match the user's email in Auth0\n\t * @param {String} options.connection name of the connection where the user was created\n\t * @param {changePasswordCallback} cb\n\t * @see {@link https://auth0.com/docs/api/authentication#change-password}\n\t */\n\tWebAuth.prototype.changePassword = function(options, cb) {\n\t return this.client.dbConnection.changePassword(options, cb);\n\t};\n\t\n\t/**\n\t * Starts a passwordless authentication transaction.\n\t *\n\t * @method passwordlessStart\n\t * @param {Object} options\n\t * @param {String} options.send what will be sent via email which could be `link` or `code`. For SMS `code` is the only one valud\n\t * @param {String} [options.phoneNumber] phone number where to send the `code`. This parameter is mutually exclusive with `email`\n\t * @param {String} [options.email] email where to send the `code` or `link`. This parameter is mutually exclusive with `phoneNumber`\n\t * @param {String} options.connection name of the passwordless connection\n\t * @param {Object} [options.authParams] additional Auth parameters when using `link`\n\t * @param {Function} cb\n\t * @see {@link https://auth0.com/docs/api/authentication#passwordless}\n\t */\n\tWebAuth.prototype.passwordlessStart = function(options, cb) {\n\t return this.client.passwordless.start(options, cb);\n\t};\n\t\n\t/**\n\t * Creates a new user in a Auth0 Database connection\n\t *\n\t * @method signup\n\t * @param {Object} options\n\t * @param {String} options.email user email address\n\t * @param {String} options.password user password\n\t * @param {String} options.connection name of the connection where the user will be created\n\t * @param {signUpCallback} cb\n\t * @see {@link https://auth0.com/docs/api/authentication#signup}\n\t */\n\tWebAuth.prototype.signup = function(options, cb) {\n\t return this.client.dbConnection.signup(options, cb);\n\t};\n\t\n\t/**\n\t * Redirects to the hosted login page (`/authorize`) in order to start a new authN/authZ transaction.\n\t * After that, you'll have to use the {@link parseHash} function at the specified `redirectUri`.\n\t *\n\t * @method authorize\n\t * @param {Object} options\n\t * @param {String} [options.domain] your Auth0 domain\n\t * @param {String} [options.clientID] your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard\n\t * @param {String} options.redirectUri url that the Auth0 will redirect after Auth with the Authorization Response\n\t * @param {String} options.responseType type of the response used by OAuth 2.0 flow. It can be any space separated list of the values `code`, `token`, `id_token`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0}\n\t * @param {String} [options.responseMode] how the Auth response is encoded and redirected back to the client. Supported values are `query`, `fragment` and `form_post`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes}\n\t * @param {String} [options.state] value used to mitigate XSRF attacks. {@link https://auth0.com/docs/protocols/oauth2/oauth-state}\n\t * @param {String} [options.nonce] value used to mitigate replay attacks when using Implicit Grant. {@link https://auth0.com/docs/api-auth/tutorials/nonce}\n\t * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email`\n\t * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth\n\t * @see {@link https://auth0.com/docs/api/authentication#authorize-client}\n\t */\n\tWebAuth.prototype.authorize = function(options) {\n\t var params = objectHelper\n\t .merge(this.baseOptions, [\n\t 'clientID',\n\t 'responseType',\n\t 'responseMode',\n\t 'redirectUri',\n\t 'scope',\n\t 'audience',\n\t '_csrf',\n\t 'state',\n\t '_intstate',\n\t 'nonce'\n\t ])\n\t .with(options);\n\t\n\t assert.check(\n\t params,\n\t { type: 'object', message: 'options parameter is not valid' },\n\t {\n\t responseType: { type: 'string', message: 'responseType option is required' }\n\t }\n\t );\n\t\n\t params = this.transactionManager.process(params);\n\t\n\t windowHelper.redirect(this.client.buildAuthorizeUrl(params));\n\t};\n\t\n\t/**\n\t * Signs up a new user, automatically logs the user in after the signup and returns the user token.\n\t * The login will be done using /oauth/token with password-realm grant type.\n\t *\n\t * @method signupAndAuthorize\n\t * @param {Object} options\n\t * @param {String} options.email user email address\n\t * @param {String} options.password user password\n\t * @param {String} options.connection name of the connection where the user will be created\n\t * @param {tokenCallback} cb\n\t * @see {@link https://auth0.com/docs/api/authentication#signup}\n\t * @see {@link https://auth0.com/docs/api-auth/grant/password}\n\t */\n\tWebAuth.prototype.signupAndAuthorize = function(options, cb) {\n\t var _this = this;\n\t\n\t return this.client.dbConnection.signup(\n\t objectHelper.blacklist(options, ['popupHandler']),\n\t function(err) {\n\t if (err) {\n\t return cb(err);\n\t }\n\t options.realm = options.connection;\n\t if (!options.username) {\n\t options.username = options.email;\n\t }\n\t _this.client.login(options, cb);\n\t }\n\t );\n\t};\n\t\n\t/**\n\t * @callback crossOriginLoginCallback\n\t * @param {Error} [err] Authentication error returned by Auth0 with the reason why the request failed\n\t */\n\t\n\t/**\n\t * Logs in the user with username and password using the cross origin authentication (/co/authenticate) flow. You can use either `username` or `email` to identify the user, but `username` will take precedence over `email`.\n\t * This only works when 3rd party cookies are enabled in the browser. After the /co/authenticate call, you'll have to use the {@link parseHash} function at the `redirectUri` specified in the constructor.\n\t *\n\t * @method login\n\t * @param {Object} options options used in the {@link authorize} call after the login_ticket is acquired\n\t * @param {String} [options.username] Username (mutually exclusive with email)\n\t * @param {String} [options.email] Email (mutually exclusive with username)\n\t * @param {String} options.password Password\n\t * @param {String} [options.realm] Realm used to authenticate the user, it can be a realm name or a database connection name\n\t * @param {crossOriginLoginCallback} cb Callback function called only when an authentication error, like invalid username or password, occurs. For other types of errors, there will be a redirect to the `redirectUri`.\n\t */\n\tWebAuth.prototype.login = function(options, cb) {\n\t this.crossOriginAuthentication.login(options, cb);\n\t};\n\t\n\t/**\n\t * Logs in the user by verifying the verification code (OTP) using the cross origin authentication (/co/authenticate) flow. You can use either `phoneNumber` or `email` to identify the user.\n\t * This only works when 3rd party cookies are enabled in the browser. After the /co/authenticate call, you'll have to use the {@link parseHash} function at the `redirectUri` specified in the constructor.\n\t *\n\t * @method login\n\t * @param {Object} options options used in the {@link authorize} call after the login_ticket is acquired\n\t * @param {String} [options.phoneNumber] Phone Number (mutually exclusive with email)\n\t * @param {String} [options.email] Email (mutually exclusive with username)\n\t * @param {String} options.verificationCode Verification Code (OTP)\n\t * @param {String} options.connection Passwordless connection to use. It can either be 'sms' or 'email'.\n\t * @param {crossOriginLoginCallback} cb Callback function called only when an authentication error, like invalid username or password, occurs. For other types of errors, there will be a redirect to the `redirectUri`.\n\t */\n\tWebAuth.prototype.passwordlessLogin = function(options, cb) {\n\t var loginOptions = objectHelper.extend(\n\t {\n\t credentialType: 'http://auth0.com/oauth/grant-type/passwordless/otp',\n\t realm: options.connection,\n\t username: options.email || options.phoneNumber,\n\t otp: options.verificationCode\n\t },\n\t objectHelper.blacklist(options, ['connection', 'email', 'phoneNumber', 'verificationCode'])\n\t );\n\t this.crossOriginAuthentication.login(loginOptions, cb);\n\t};\n\t\n\t/**\n\t * Runs the callback code for the cross origin authentication call. This method is meant to be called by the cross origin authentication callback url.\n\t *\n\t * @method crossOriginAuthenticationCallback\n\t */\n\tWebAuth.prototype.crossOriginAuthenticationCallback = function() {\n\t this.crossOriginAuthentication.callback();\n\t};\n\t\n\t/**\n\t * Redirects to the auth0 logout endpoint\n\t *\n\t * If you want to navigate the user to a specific URL after the logout, set that URL at the returnTo parameter. The URL should be included in any the appropriate Allowed Logout URLs list:\n\t *\n\t * - If the client_id parameter is included, the returnTo URL must be listed in the Allowed Logout URLs set at the client level (see Setting Allowed Logout URLs at the App Level).\n\t * - If the client_id parameter is NOT included, the returnTo URL must be listed in the Allowed Logout URLs set at the account level (see Setting Allowed Logout URLs at the Account Level).\n\t *\n\t * @method logout\n\t * @param {Object} options\n\t * @param {String} [options.clientID] identifier of your client\n\t * @param {String} [options.returnTo] URL to be redirected after the logout\n\t * @param {Boolean} [options.federated] tells Auth0 if it should logout the user also from the IdP.\n\t * @see {@link https://auth0.com/docs/api/authentication#logout}\n\t */\n\tWebAuth.prototype.logout = function(options) {\n\t windowHelper.redirect(this.client.buildLogoutUrl(options));\n\t};\n\t\n\t/**\n\t * Verifies the passwordless TOTP and redirects to finish the passwordless transaction\n\t *\n\t * @method passwordlessVerify\n\t * @param {Object} options\n\t * @param {String} options.type `sms` or `email`\n\t * @param {String} options.phoneNumber only if type = sms\n\t * @param {String} options.email only if type = email\n\t * @param {String} options.connection the connection name\n\t * @param {String} options.verificationCode the TOTP code\n\t * @param {Function} cb\n\t */\n\tWebAuth.prototype.passwordlessVerify = function(options, cb) {\n\t var _this = this;\n\t var params = objectHelper\n\t .merge(this.baseOptions, [\n\t 'clientID',\n\t 'responseType',\n\t 'responseMode',\n\t 'redirectUri',\n\t 'scope',\n\t 'audience',\n\t '_csrf',\n\t 'state',\n\t '_intstate',\n\t 'nonce'\n\t ])\n\t .with(options);\n\t\n\t assert.check(\n\t params,\n\t { type: 'object', message: 'options parameter is not valid' },\n\t {\n\t responseType: { type: 'string', message: 'responseType option is required' }\n\t }\n\t );\n\t\n\t params = this.transactionManager.process(params);\n\t return this.client.passwordless.verify(params, function(err) {\n\t if (err) {\n\t return cb(err);\n\t }\n\t return windowHelper.redirect(_this.client.passwordless.buildVerifyUrl(params));\n\t });\n\t};\n\t\n\tmodule.exports = WebAuth;\n\n\n/***/ },\n/* 58 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar urljoin = __webpack_require__(1);\n\tvar WinChan = __webpack_require__(18);\n\t\n\tvar urlHelper = __webpack_require__(53);\n\tvar assert = __webpack_require__(4);\n\tvar responseHandler = __webpack_require__(6);\n\tvar PopupHandler = __webpack_require__(47);\n\tvar objectHelper = __webpack_require__(2);\n\tvar Warn = __webpack_require__(11);\n\tvar TransactionManager = __webpack_require__(22);\n\t\n\tfunction Popup(webAuth, options) {\n\t this.baseOptions = options;\n\t this.client = webAuth.client;\n\t this.webAuth = webAuth;\n\t\n\t this.transactionManager = new TransactionManager(this.baseOptions.transaction);\n\t this.warn = new Warn({\n\t disableWarnings: !!options._disableDeprecationWarnings\n\t });\n\t}\n\t\n\t/**\n\t * Returns a new instance of the popup handler\n\t *\n\t * @method buildPopupHandler\n\t * @private\n\t */\n\tPopup.prototype.buildPopupHandler = function() {\n\t var pluginHandler = this.baseOptions.plugins.get('popup.getPopupHandler');\n\t\n\t if (pluginHandler) {\n\t return pluginHandler.getPopupHandler();\n\t }\n\t\n\t return new PopupHandler();\n\t};\n\t\n\t/**\n\t * Initializes the popup window and returns the instance to be used later in order to avoid being blocked by the browser.\n\t *\n\t * @method preload\n\t * @param {Object} options receives the window height and width and any other window feature to be sent to window.open\n\t */\n\tPopup.prototype.preload = function(options) {\n\t options = options || {};\n\t\n\t var popup = this.buildPopupHandler();\n\t\n\t popup.preload(options);\n\t return popup;\n\t};\n\t\n\t/**\n\t * Internal use.\n\t *\n\t * @method getPopupHandler\n\t * @private\n\t */\n\tPopup.prototype.getPopupHandler = function(options, preload) {\n\t if (options.popupHandler) {\n\t return options.popupHandler;\n\t }\n\t\n\t if (preload) {\n\t return this.preload(options);\n\t }\n\t\n\t return this.buildPopupHandler();\n\t};\n\t\n\t/**\n\t * Handles the popup logic for the callback page.\n\t *\n\t * @method callback\n\t * @param {Object} options\n\t * @param {String} options.hash the url hash. If not provided it will extract from window.location.hash\n\t * @param {String} [options.state] value originally sent in `state` parameter to {@link authorize} to mitigate XSRF\n\t * @param {String} [options.nonce] value originally sent in `nonce` parameter to {@link authorize} to prevent replay attacks\n\t * @param {String} [options._idTokenVerification] makes parseHash perform or skip `id_token` verification. We **strongly** recommend validating the `id_token` yourself if you disable the verification.\n\t * @see {@link parseHash}\n\t */\n\tPopup.prototype.callback = function(options) {\n\t var _this = this;\n\t WinChan.onOpen(function(popupOrigin, r, cb) {\n\t _this.webAuth.parseHash(options || {}, function(err, data) {\n\t return cb(err || data);\n\t });\n\t });\n\t};\n\t\n\t/**\n\t * Shows inside a new window the hosted login page (`/authorize`) in order to start a new authN/authZ transaction and post its result using `postMessage`.\n\t *\n\t * @method authorize\n\t * @param {Object} options\n\t * @param {String} [options.domain] your Auth0 domain\n\t * @param {String} [options.clientID] your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard\n\t * @param {String} options.redirectUri url that the Auth0 will redirect after Auth with the Authorization Response\n\t * @param {String} options.responseType type of the response used by OAuth 2.0 flow. It can be any space separated list of the values `code`, `token`, `id_token`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0}\n\t * @param {String} [options.responseMode] how the Auth response is encoded and redirected back to the client. Supported values are `query`, `fragment` and `form_post`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes}\n\t * @param {String} [options.state] value used to mitigate XSRF attacks. {@link https://auth0.com/docs/protocols/oauth2/oauth-state}\n\t * @param {String} [options.nonce] value used to mitigate replay attacks when using Implicit Grant. {@link https://auth0.com/docs/api-auth/tutorials/nonce}\n\t * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email`\n\t * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth\n\t * @param {Boolean} [options.owp] determines if Auth0 should render the relay page or not and the caller is responsible of handling the response.\n\t * @param {authorizeCallback} cb\n\t * @see {@link https://auth0.com/docs/api/authentication#authorize-client}\n\t */\n\tPopup.prototype.authorize = function(options, cb) {\n\t var popup;\n\t var url;\n\t var relayUrl;\n\t var popOpts = {};\n\t\n\t var pluginHandler = this.baseOptions.plugins.get('popup.authorize');\n\t\n\t var params = objectHelper\n\t .merge(this.baseOptions, [\n\t 'clientID',\n\t 'scope',\n\t 'domain',\n\t 'audience',\n\t 'responseType',\n\t 'redirectUri',\n\t '_csrf',\n\t 'state',\n\t '_intstate',\n\t 'nonce'\n\t ])\n\t .with(objectHelper.blacklist(options, ['popupHandler']));\n\t\n\t assert.check(\n\t params,\n\t { type: 'object', message: 'options parameter is not valid' },\n\t {\n\t responseType: { type: 'string', message: 'responseType option is required' }\n\t }\n\t );\n\t\n\t // the relay page should not be necesary as long it happens in the same domain\n\t // (a redirectUri shoul be provided). It is necesary when using OWP\n\t relayUrl = urljoin(this.baseOptions.rootUrl, 'relay.html');\n\t\n\t // if a owp is enabled, it should use the owp flag\n\t if (options.owp) {\n\t // used by server to render the relay page instead of sending the chunk in the\n\t // url to the callback\n\t params.owp = true;\n\t } else {\n\t popOpts.origin = urlHelper.extractOrigin(params.redirectUri);\n\t relayUrl = params.redirectUri;\n\t }\n\t\n\t if (options.popupOptions) {\n\t popOpts.popupOptions = objectHelper.pick(options.popupOptions, ['width', 'height']);\n\t }\n\t\n\t if (pluginHandler) {\n\t params = pluginHandler.processParams(params);\n\t }\n\t\n\t params = this.transactionManager.process(params);\n\t\n\t delete params.domain;\n\t\n\t url = this.client.buildAuthorizeUrl(params);\n\t\n\t popup = this.getPopupHandler(options);\n\t\n\t return popup.load(url, relayUrl, popOpts, responseHandler(cb));\n\t};\n\t\n\t/**\n\t * Performs authentication with username/email and password with a database connection inside a new window\n\t *\n\t * This method is not compatible with API Auth so if you need to fetch API tokens with audience\n\t * you should use {@link authorize} or {@link login}.\n\t *\n\t * @method loginWithCredentials\n\t * @param {Object} options\n\t * @param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorization Response\n\t * @param {String} [options.responseType] type of the response used. It can be any of the values `code` and `token`\n\t * @param {String} [options.responseMode] how the AuthN response is encoded and redirected back to the client. Supported values are `query` and `fragment`\n\t * @param {String} [options.scope] scopes to be requested during AuthN. e.g. `openid email`\n\t * @param {credentialsCallback} cb\n\t */\n\tPopup.prototype.loginWithCredentials = function(options, cb) {\n\t var params;\n\t var popup;\n\t var url;\n\t var relayUrl;\n\t\n\t /* eslint-disable */\n\t assert.check(\n\t options,\n\t { type: 'object', message: 'options parameter is not valid' },\n\t {\n\t clientID: { optional: true, type: 'string', message: 'clientID option is required' },\n\t redirectUri: { optional: true, type: 'string', message: 'redirectUri option is required' },\n\t responseType: { optional: true, type: 'string', message: 'responseType option is required' },\n\t scope: { optional: true, type: 'string', message: 'scope option is required' },\n\t audience: { optional: true, type: 'string', message: 'audience option is required' }\n\t }\n\t );\n\t /* eslint-enable */\n\t\n\t popup = this.getPopupHandler(options);\n\t\n\t options = objectHelper\n\t .merge(this.baseOptions, [\n\t 'clientID',\n\t 'scope',\n\t 'domain',\n\t 'audience',\n\t '_csrf',\n\t 'state',\n\t '_intstate',\n\t 'nonce'\n\t ])\n\t .with(objectHelper.blacklist(options, ['popupHandler']));\n\t\n\t params = objectHelper.pick(options, ['clientID', 'domain']);\n\t params.options = objectHelper.toSnakeCase(\n\t objectHelper.pick(options, ['password', 'connection', 'state', 'scope', '_csrf', 'device'])\n\t );\n\t params.options.username = options.username || options.email;\n\t\n\t url = urljoin(this.baseOptions.rootUrl, 'sso_dbconnection_popup', options.clientID);\n\t relayUrl = urljoin(this.baseOptions.rootUrl, 'relay.html');\n\t\n\t return popup.load(url, relayUrl, { params: params }, responseHandler(cb));\n\t};\n\t\n\t/**\n\t * Verifies the passwordless TOTP and redirects to finish the passwordless transaction\n\t *\n\t * @method passwordlessVerify\n\t * @param {Object} options\n\t * @param {String} options.type `sms` or `email`\n\t * @param {String} options.phoneNumber only if type = sms\n\t * @param {String} options.email only if type = email\n\t * @param {String} options.connection the connection name\n\t * @param {String} options.verificationCode the TOTP code\n\t * @param {Function} cb\n\t */\n\tPopup.prototype.passwordlessVerify = function(options, cb) {\n\t var _this = this;\n\t return this.client.passwordless.verify(\n\t objectHelper.blacklist(options, ['popupHandler']),\n\t function(err) {\n\t if (err) {\n\t return cb(err);\n\t }\n\t\n\t options.username = options.phoneNumber || options.email;\n\t options.password = options.verificationCode;\n\t\n\t delete options.email;\n\t delete options.phoneNumber;\n\t delete options.verificationCode;\n\t delete options.type;\n\t\n\t _this.client.loginWithResourceOwner(options, cb);\n\t }\n\t );\n\t};\n\t\n\t/**\n\t * Signs up a new user and automatically logs the user in after the signup.\n\t *\n\t * This method is not compatible with API Auth so if you need to fetch API tokens with audience\n\t * you should use {@link authorize} or {@link signupAndAuthorize}.\n\t *\n\t * @method signupAndLogin\n\t * @param {Object} options\n\t * @param {String} options.email user email address\n\t * @param {String} options.password user password\n\t * @param {String} options.connection name of the connection where the user will be created\n\t * @param {credentialsCallback} cb\n\t */\n\tPopup.prototype.signupAndLogin = function(options, cb) {\n\t var _this = this;\n\t\n\t // Preload popup to avoid the browser to block it since the login happens later\n\t var popupHandler = this.getPopupHandler(options, true);\n\t options.popupHandler = popupHandler;\n\t\n\t return this.client.dbConnection.signup(\n\t objectHelper.blacklist(options, ['popupHandler']),\n\t function(err) {\n\t if (err) {\n\t if (popupHandler._current_popup) {\n\t popupHandler._current_popup.kill();\n\t }\n\t return cb(err);\n\t }\n\t _this.loginWithCredentials(options, cb);\n\t }\n\t );\n\t};\n\t\n\tmodule.exports = Popup;\n\n\n/***/ },\n/* 59 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar UsernamePassword = __webpack_require__(61);\n\tvar objectHelper = __webpack_require__(2);\n\tvar Warn = __webpack_require__(11);\n\tvar assert = __webpack_require__(4);\n\t\n\tfunction Redirect(client, options) {\n\t this.baseOptions = options;\n\t this.client = client;\n\t\n\t this.warn = new Warn({\n\t disableWarnings: !!options._disableDeprecationWarnings\n\t });\n\t}\n\t\n\t/**\n\t * @callback credentialsCallback\n\t * @param {Error} [err] error returned by Auth0 with the reason of the Auth failure\n\t * @param {Object} [result] result of the AuthN request\n\t * @param {String} result.accessToken token that can be used with {@link userinfo}\n\t * @param {String} [result.idToken] token that identifies the user\n\t * @param {String} [result.refreshToken] token that can be used to get new access tokens from Auth0. Note that not all clients can request them or the resource server might not allow them.\n\t */\n\t\n\t/**\n\t * Performs authentication with username/email and password with a database connection\n\t *\n\t * This method is not compatible with API Auth so if you need to fetch API tokens with audience\n\t * you should use {@link authorize} or {@link login}.\n\t *\n\t * @method loginWithCredentials\n\t * @param {Object} options\n\t * @param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorization Response\n\t * @param {String} [options.responseType] type of the response used. It can be any of the values `code` and `token`\n\t * @param {String} [options.responseMode] how the AuthN response is encoded and redirected back to the client. Supported values are `query` and `fragment`\n\t * @param {String} [options.scope] scopes to be requested during AuthN. e.g. `openid email`\n\t * @param {credentialsCallback} cb\n\t */\n\tRedirect.prototype.loginWithCredentials = function(options, cb) {\n\t var usernamePassword;\n\t\n\t var params = objectHelper\n\t .merge(this.baseOptions, [\n\t 'clientID',\n\t 'redirectUri',\n\t 'tenant',\n\t 'responseType',\n\t 'responseMode',\n\t 'scope',\n\t 'audience',\n\t '_csrf',\n\t 'state',\n\t '_intstate',\n\t 'nonce'\n\t ])\n\t .with(options);\n\t\n\t assert.check(\n\t params,\n\t { type: 'object', message: 'options parameter is not valid' },\n\t {\n\t responseType: { type: 'string', message: 'responseType option is required' }\n\t }\n\t );\n\t\n\t usernamePassword = new UsernamePassword(this.baseOptions);\n\t return usernamePassword.login(params, function(err, data) {\n\t if (err) {\n\t return cb(err);\n\t }\n\t return usernamePassword.callback(data);\n\t });\n\t};\n\t\n\t/**\n\t * Signs up a new user and automatically logs the user in after the signup.\n\t *\n\t * @method signupAndLogin\n\t * @param {Object} options\n\t * @param {String} options.email user email address\n\t * @param {String} options.password user password\n\t * @param {String} options.connection name of the connection where the user will be created\n\t * @param {credentialsCallback} cb\n\t */\n\tRedirect.prototype.signupAndLogin = function(options, cb) {\n\t var _this = this;\n\t return this.client.dbConnection.signup(options, function(err) {\n\t if (err) {\n\t return cb(err);\n\t }\n\t return _this.loginWithCredentials(options, cb);\n\t });\n\t};\n\t\n\tmodule.exports = Redirect;\n\n\n/***/ },\n/* 60 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar IframeHandler = __webpack_require__(43);\n\t\n\tfunction SilentAuthenticationHandler(options) {\n\t this.authenticationUrl = options.authenticationUrl;\n\t this.timeout = options.timeout || 60 * 1000;\n\t this.handler = null;\n\t this.postMessageDataType = options.postMessageDataType || false;\n\t}\n\t\n\tSilentAuthenticationHandler.create = function(options) {\n\t return new SilentAuthenticationHandler(options);\n\t};\n\t\n\tSilentAuthenticationHandler.prototype.login = function(usePostMessage, callback) {\n\t this.handler = new IframeHandler({\n\t auth0: this.auth0,\n\t url: this.authenticationUrl,\n\t eventListenerType: usePostMessage ? 'message' : 'load',\n\t callback: this.getCallbackHandler(callback, usePostMessage),\n\t timeout: this.timeout,\n\t eventValidator: this.getEventValidator(),\n\t timeoutCallback: function() {\n\t callback(null, '#error=timeout&error_description=Timeout+during+authentication+renew.');\n\t },\n\t usePostMessage: usePostMessage || false\n\t });\n\t\n\t this.handler.init();\n\t};\n\t\n\tSilentAuthenticationHandler.prototype.getEventValidator = function() {\n\t var _this = this;\n\t return {\n\t isValid: function(eventData) {\n\t switch (eventData.event.type) {\n\t case 'message':\n\t // Default behaviour, return all message events.\n\t if (_this.postMessageDataType === false) {\n\t return true;\n\t }\n\t\n\t return (\n\t eventData.event.data.type && eventData.event.data.type === _this.postMessageDataType\n\t );\n\t\n\t case 'load': // Fall through to default\n\t default:\n\t return true;\n\t }\n\t }\n\t };\n\t};\n\t\n\tSilentAuthenticationHandler.prototype.getCallbackHandler = function(callback, usePostMessage) {\n\t return function(eventData) {\n\t var callbackValue;\n\t if (!usePostMessage) {\n\t callbackValue = eventData.sourceObject.contentWindow.location.hash;\n\t } else if (typeof eventData.event.data === 'object' && eventData.event.data.hash) {\n\t callbackValue = eventData.event.data.hash;\n\t } else {\n\t callbackValue = eventData.event.data;\n\t }\n\t callback(null, callbackValue);\n\t };\n\t};\n\t\n\tmodule.exports = SilentAuthenticationHandler;\n\n\n/***/ },\n/* 61 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar urljoin = __webpack_require__(1);\n\t\n\tvar objectHelper = __webpack_require__(2);\n\tvar RequestBuilder = __webpack_require__(10);\n\tvar responseHandler = __webpack_require__(6);\n\tvar windowHelper = __webpack_require__(3);\n\t\n\tfunction UsernamePassword(options) {\n\t this.baseOptions = options;\n\t this.request = new RequestBuilder(options);\n\t}\n\t\n\tUsernamePassword.prototype.login = function(options, cb) {\n\t var url;\n\t var body;\n\t\n\t url = urljoin(this.baseOptions.rootUrl, 'usernamepassword', 'login');\n\t\n\t options.username = options.username || options.email; // eslint-disable-line\n\t\n\t options = objectHelper.blacklist(options, ['email']); // eslint-disable-line\n\t\n\t body = objectHelper\n\t .merge(this.baseOptions, [\n\t 'clientID',\n\t 'redirectUri',\n\t 'tenant',\n\t 'responseType',\n\t 'responseMode',\n\t 'scope',\n\t 'audience'\n\t ])\n\t .with(options);\n\t\n\t body = objectHelper.toSnakeCase(body, ['auth0Client']);\n\t\n\t return this.request.post(url).send(body).end(responseHandler(cb));\n\t};\n\t\n\tUsernamePassword.prototype.callback = function(formHtml) {\n\t var div;\n\t var form;\n\t var _document = windowHelper.getDocument();\n\t\n\t div = _document.createElement('div');\n\t div.innerHTML = formHtml;\n\t form = _document.body.appendChild(div).children[0];\n\t\n\t form.submit();\n\t};\n\t\n\tmodule.exports = UsernamePassword;\n\n\n/***/ }\n/******/ ])\n});\n;\n\n\n// WEBPACK FOOTER //\n// auth0.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 88487ab7880081fa1caa","(function (name, context, definition) {\n if (typeof module !== 'undefined' && module.exports) module.exports = definition();\n else if (typeof define === 'function' && define.amd) define(definition);\n else context[name] = definition();\n})('urljoin', this, function () {\n\n function normalize (str, options) {\n\n // make sure protocol is followed by two slashes\n str = str.replace(/:\\//g, '://');\n\n // remove consecutive slashes\n str = str.replace(/([^:\\s])\\/+/g, '$1/');\n\n // remove trailing slash before parameters or hash\n str = str.replace(/\\/(\\?|&|#[^!])/g, '$1');\n\n // replace ? in parameters with &\n str = str.replace(/(\\?.+)\\?/g, '$1&');\n\n return str;\n }\n\n return function () {\n var input = arguments;\n var options = {};\n\n if (typeof arguments[0] === 'object') {\n // new syntax with array and options\n input = arguments[0];\n options = arguments[1] || {};\n }\n\n var joined = [].slice.call(input, 0).join('/');\n return normalize(joined, options);\n };\n\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/url-join/lib/url-join.js\n// module id = 1\n// module chunks = 0 1","/* eslint-disable no-param-reassign */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable guard-for-in */\n\nvar assert = require('./assert');\nvar objectAssign = require('./object-assign');\n\nfunction pick(object, keys) {\n return keys.reduce(function(prev, key) {\n if (object[key]) {\n prev[key] = object[key];\n }\n return prev;\n }, {});\n}\n\nfunction getKeysNotIn(obj, allowedKeys) {\n var notAllowed = [];\n for (var key in obj) {\n if (allowedKeys.indexOf(key) === -1) {\n notAllowed.push(key);\n }\n }\n return notAllowed;\n}\n\nfunction objectValues(obj) {\n var values = [];\n for (var key in obj) {\n values.push(obj[key]);\n }\n return values;\n}\n\nfunction extend() {\n var params = objectValues(arguments);\n params.unshift({});\n return objectAssign.get().apply(undefined, params);\n}\n\nfunction merge(object, keys) {\n return {\n base: keys ? pick(object, keys) : object,\n with: function(object2, keys2) {\n object2 = keys2 ? pick(object2, keys2) : object2;\n return extend(this.base, object2);\n }\n };\n}\n\nfunction blacklist(object, blacklistedKeys) {\n return Object.keys(object).reduce(function(p, key) {\n if (blacklistedKeys.indexOf(key) === -1) {\n p[key] = object[key];\n }\n return p;\n }, {});\n}\n\nfunction camelToSnake(str) {\n var newKey = '';\n var index = 0;\n var code;\n var wasPrevNumber = true;\n var wasPrevUppercase = true;\n\n while (index < str.length) {\n code = str.charCodeAt(index);\n if (\n (!wasPrevUppercase && code >= 65 && code <= 90) ||\n (!wasPrevNumber && code >= 48 && code <= 57)\n ) {\n newKey += '_';\n newKey += str[index].toLowerCase();\n } else {\n newKey += str[index].toLowerCase();\n }\n wasPrevNumber = code >= 48 && code <= 57;\n wasPrevUppercase = code >= 65 && code <= 90;\n index++;\n }\n\n return newKey;\n}\n\nfunction snakeToCamel(str) {\n var parts = str.split('_');\n return parts.reduce(function(p, c) {\n return p + c.charAt(0).toUpperCase() + c.slice(1);\n }, parts.shift());\n}\n\nfunction toSnakeCase(object, exceptions) {\n if (typeof object !== 'object' || assert.isArray(object) || object === null) {\n return object;\n }\n exceptions = exceptions || [];\n\n return Object.keys(object).reduce(function(p, key) {\n var newKey = exceptions.indexOf(key) === -1 ? camelToSnake(key) : key;\n p[newKey] = toSnakeCase(object[key]);\n return p;\n }, {});\n}\n\nfunction toCamelCase(object, exceptions) {\n if (typeof object !== 'object' || assert.isArray(object) || object === null) {\n return object;\n }\n\n exceptions = exceptions || [];\n\n return Object.keys(object).reduce(function(p, key) {\n var newKey = exceptions.indexOf(key) === -1 ? snakeToCamel(key) : key;\n p[newKey] = toCamelCase(object[key]);\n return p;\n }, {});\n}\n\nmodule.exports = {\n toSnakeCase: toSnakeCase,\n toCamelCase: toCamelCase,\n blacklist: blacklist,\n merge: merge,\n pick: pick,\n getKeysNotIn: getKeysNotIn,\n extend: extend\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/object.js\n// module id = 2\n// module chunks = 0","function redirect(url) {\n global.window.location = url;\n}\n\nfunction getDocument() {\n return global.window.document;\n}\n\nfunction getWindow() {\n return global.window;\n}\n\nmodule.exports = {\n redirect: redirect,\n getDocument: getDocument,\n getWindow: getWindow\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/window.js\n// module id = 3\n// module chunks = 0 1","var toString = Object.prototype.toString;\n\nfunction attribute(o, attr, type, text) {\n type = type === 'array' ? 'object' : type;\n if (o && typeof o[attr] !== type) {\n throw new Error(text);\n }\n}\n\nfunction variable(o, type, text) {\n if (typeof o !== type) {\n throw new Error(text);\n }\n}\n\nfunction value(o, values, text) {\n if (values.indexOf(o) === -1) {\n throw new Error(text);\n }\n}\n\nfunction check(o, config, attributes) {\n if (!config.optional || o) {\n variable(o, config.type, config.message);\n }\n if (config.type === 'object' && attributes) {\n var keys = Object.keys(attributes);\n\n for (var index = 0; index < keys.length; index++) {\n var a = keys[index];\n if (!attributes[a].optional || o[a]) {\n if (!attributes[a].condition || attributes[a].condition(o)) {\n attribute(o, a, attributes[a].type, attributes[a].message);\n if (attributes[a].values) {\n value(o[a], attributes[a].values, attributes[a].value_message);\n }\n }\n }\n }\n }\n}\n\n/**\n * Wrap `Array.isArray` Polyfill for IE9\n * source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray\n *\n * @param {Array} array\n * @private\n */\nfunction isArray(array) {\n if (this.supportsIsArray()) {\n return Array.isArray(array);\n }\n\n return toString.call(array) === '[object Array]';\n}\n\nfunction supportsIsArray() {\n return Array.isArray != null;\n}\n\nmodule.exports = {\n check: check,\n attribute: attribute,\n variable: variable,\n value: value,\n isArray: isArray,\n supportsIsArray: supportsIsArray\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/assert.js\n// module id = 4\n// module chunks = 0","'use strict';\n\nvar stringify = require('./stringify');\nvar parse = require('./parse');\nvar formats = require('./formats');\n\nmodule.exports = {\n formats: formats,\n parse: parse,\n stringify: stringify\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/qs/lib/index.js\n// module id = 5\n// module chunks = 0 1","var error = require('./error');\nvar objectHelper = require('./object');\n\nfunction wrapCallback(cb, options) {\n options = options || {};\n options.ignoreCasing = options.ignoreCasing ? options.ignoreCasing : false;\n\n return function(err, data) {\n var errObj;\n\n if (!err && !data) {\n return cb(error.buildResponse('generic_error', 'Something went wrong'));\n }\n\n if (!err && data.err) {\n err = data.err;\n data = null;\n }\n\n if (!err && data.error) {\n err = data;\n data = null;\n }\n\n if (err) {\n errObj = {\n original: err\n };\n\n if (err.response && err.response.statusCode) {\n errObj.statusCode = err.response.statusCode;\n }\n\n if (err.response && err.response.statusText) {\n errObj.statusText = err.response.statusText;\n }\n\n if (err.response && err.response.body) {\n err = err.response.body;\n }\n\n if (err.err) {\n err = err.err;\n }\n\n errObj.code = err.error || err.code || err.error_code || err.status || null;\n errObj.description =\n err.errorDescription ||\n err.error_description ||\n err.description ||\n err.error ||\n err.details ||\n err.err ||\n null;\n\n if (err.name) {\n errObj.name = err.name;\n }\n\n if (err.policy) {\n errObj.policy = err.policy;\n }\n\n return cb(errObj);\n }\n\n if (data.type && (data.type === 'text/html' || data.type === 'text/plain')) {\n return cb(null, data.text);\n }\n\n if (options.ignoreCasing) {\n return cb(null, data.body || data);\n }\n\n return cb(null, objectHelper.toCamelCase(data.body || data));\n };\n}\n\nmodule.exports = wrapCallback;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/response-handler.js\n// module id = 6\n// module chunks = 0","'use strict';\n\nvar replace = String.prototype.replace;\nvar percentTwenties = /%20/g;\n\nmodule.exports = {\n 'default': 'RFC3986',\n formatters: {\n RFC1738: function (value) {\n return replace.call(value, percentTwenties, '+');\n },\n RFC3986: function (value) {\n return value;\n }\n },\n RFC1738: 'RFC1738',\n RFC3986: 'RFC3986'\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/qs/lib/formats.js\n// module id = 7\n// module chunks = 0 1","'use strict';\n\nvar has = Object.prototype.hasOwnProperty;\n\nvar hexTable = (function () {\n var array = [];\n for (var i = 0; i < 256; ++i) {\n array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());\n }\n\n return array;\n}());\n\nexports.arrayToObject = function (source, options) {\n var obj = options && options.plainObjects ? Object.create(null) : {};\n for (var i = 0; i < source.length; ++i) {\n if (typeof source[i] !== 'undefined') {\n obj[i] = source[i];\n }\n }\n\n return obj;\n};\n\nexports.merge = function (target, source, options) {\n if (!source) {\n return target;\n }\n\n if (typeof source !== 'object') {\n if (Array.isArray(target)) {\n target.push(source);\n } else if (typeof target === 'object') {\n if (options.plainObjects || options.allowPrototypes || !has.call(Object.prototype, source)) {\n target[source] = true;\n }\n } else {\n return [target, source];\n }\n\n return target;\n }\n\n if (typeof target !== 'object') {\n return [target].concat(source);\n }\n\n var mergeTarget = target;\n if (Array.isArray(target) && !Array.isArray(source)) {\n mergeTarget = exports.arrayToObject(target, options);\n }\n\n if (Array.isArray(target) && Array.isArray(source)) {\n source.forEach(function (item, i) {\n if (has.call(target, i)) {\n if (target[i] && typeof target[i] === 'object') {\n target[i] = exports.merge(target[i], item, options);\n } else {\n target.push(item);\n }\n } else {\n target[i] = item;\n }\n });\n return target;\n }\n\n return Object.keys(source).reduce(function (acc, key) {\n var value = source[key];\n\n if (Object.prototype.hasOwnProperty.call(acc, key)) {\n acc[key] = exports.merge(acc[key], value, options);\n } else {\n acc[key] = value;\n }\n return acc;\n }, mergeTarget);\n};\n\nexports.decode = function (str) {\n try {\n return decodeURIComponent(str.replace(/\\+/g, ' '));\n } catch (e) {\n return str;\n }\n};\n\nexports.encode = function (str) {\n // This code was originally written by Brian White (mscdex) for the io.js core querystring library.\n // It has been adapted here for stricter adherence to RFC 3986\n if (str.length === 0) {\n return str;\n }\n\n var string = typeof str === 'string' ? str : String(str);\n\n var out = '';\n for (var i = 0; i < string.length; ++i) {\n var c = string.charCodeAt(i);\n\n if (\n c === 0x2D || // -\n c === 0x2E || // .\n c === 0x5F || // _\n c === 0x7E || // ~\n (c >= 0x30 && c <= 0x39) || // 0-9\n (c >= 0x41 && c <= 0x5A) || // a-z\n (c >= 0x61 && c <= 0x7A) // A-Z\n ) {\n out += string.charAt(i);\n continue;\n }\n\n if (c < 0x80) {\n out = out + hexTable[c];\n continue;\n }\n\n if (c < 0x800) {\n out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);\n continue;\n }\n\n if (c < 0xD800 || c >= 0xE000) {\n out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);\n continue;\n }\n\n i += 1;\n c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));\n out += hexTable[0xF0 | (c >> 18)] + hexTable[0x80 | ((c >> 12) & 0x3F)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]; // eslint-disable-line max-len\n }\n\n return out;\n};\n\nexports.compact = function (obj, references) {\n if (typeof obj !== 'object' || obj === null) {\n return obj;\n }\n\n var refs = references || [];\n var lookup = refs.indexOf(obj);\n if (lookup !== -1) {\n return refs[lookup];\n }\n\n refs.push(obj);\n\n if (Array.isArray(obj)) {\n var compacted = [];\n\n for (var i = 0; i < obj.length; ++i) {\n if (obj[i] && typeof obj[i] === 'object') {\n compacted.push(exports.compact(obj[i], refs));\n } else if (typeof obj[i] !== 'undefined') {\n compacted.push(obj[i]);\n }\n }\n\n return compacted;\n }\n\n var keys = Object.keys(obj);\n keys.forEach(function (key) {\n obj[key] = exports.compact(obj[key], refs);\n });\n\n return obj;\n};\n\nexports.isRegExp = function (obj) {\n return Object.prototype.toString.call(obj) === '[object RegExp]';\n};\n\nexports.isBuffer = function (obj) {\n if (obj === null || typeof obj === 'undefined') {\n return false;\n }\n\n return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/qs/lib/utils.js\n// module id = 8\n// module chunks = 0 1","module.exports = { raw: '8.9.2' };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/version.js\n// module id = 9\n// module chunks = 0 1","/* eslint-disable no-param-reassign */\nvar request = require('superagent');\nvar base64Url = require('./base64_url');\nvar version = require('../version');\n\n// ------------------------------------------------ RequestWrapper\n\nfunction RequestWrapper(req) {\n this.request = req;\n this.method = req.method;\n this.url = req.url;\n this.body = req._data;\n this.headers = req._header;\n}\n\nRequestWrapper.prototype.abort = function() {\n this.request.abort();\n};\n\nRequestWrapper.prototype.getMethod = function() {\n return this.method;\n};\n\nRequestWrapper.prototype.getBody = function() {\n return this.body;\n};\n\nRequestWrapper.prototype.getUrl = function() {\n return this.url;\n};\n\nRequestWrapper.prototype.getHeaders = function() {\n return this.headers;\n};\n\n// ------------------------------------------------ RequestObj\n\nfunction RequestObj(req) {\n this.request = req;\n}\n\nRequestObj.prototype.set = function(key, value) {\n this.request = this.request.set(key, value);\n return this;\n};\n\nRequestObj.prototype.send = function(body) {\n this.request = this.request.send(body);\n return this;\n};\n\nRequestObj.prototype.withCredentials = function() {\n this.request = this.request.withCredentials();\n return this;\n};\n\nRequestObj.prototype.end = function(cb) {\n this.request = this.request.end(cb);\n return new RequestWrapper(this.request);\n};\n\n// ------------------------------------------------ RequestBuilder\n\nfunction RequestBuilder(options) {\n this._sendTelemetry = options._sendTelemetry === false ? options._sendTelemetry : true;\n this._telemetryInfo = options._telemetryInfo || null;\n this._timesToRetryFailedRequests = options._timesToRetryFailedRequests;\n this.headers = options.headers || {};\n}\n\nRequestBuilder.prototype.setCommonConfiguration = function(ongoingRequest, options) {\n options = options || {};\n\n if (options.noHeaders) {\n return ongoingRequest;\n }\n\n var headers = this.headers;\n ongoingRequest = ongoingRequest.set('Content-Type', 'application/json');\n\n var keys = Object.keys(this.headers);\n\n for (var a = 0; a < keys.length; a++) {\n ongoingRequest = ongoingRequest.set(keys[a], headers[keys[a]]);\n }\n\n if (this._sendTelemetry) {\n ongoingRequest = ongoingRequest.set('Auth0-Client', this.getTelemetryData());\n }\n if (this._timesToRetryFailedRequests > 0) {\n ongoingRequest = ongoingRequest.retry(this._timesToRetryFailedRequests);\n }\n return ongoingRequest;\n};\n\nRequestBuilder.prototype.getTelemetryData = function() {\n var clientInfo = this._telemetryInfo || { name: 'auth0.js', version: version.raw };\n var jsonClientInfo = JSON.stringify(clientInfo);\n return base64Url.encode(jsonClientInfo);\n};\n\nRequestBuilder.prototype.get = function(url, options) {\n return new RequestObj(this.setCommonConfiguration(request.get(url), options));\n};\n\nRequestBuilder.prototype.post = function(url, options) {\n return new RequestObj(this.setCommonConfiguration(request.post(url), options));\n};\n\nRequestBuilder.prototype.patch = function(url, options) {\n return new RequestObj(this.setCommonConfiguration(request.patch(url), options));\n};\n\nmodule.exports = RequestBuilder;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/request-builder.js\n// module id = 10\n// module chunks = 0","/* eslint-disable no-console */\n\nfunction Warn(options) {\n this.disableWarnings = options.disableWarnings;\n}\n\nWarn.prototype.warning = function(message) {\n if (this.disableWarnings) {\n return;\n }\n\n console.warn(message);\n};\n\nmodule.exports = Warn;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/warn.js\n// module id = 11\n// module chunks = 0","'use strict';\n\nvar utils = require('./utils');\n\nvar has = Object.prototype.hasOwnProperty;\n\nvar defaults = {\n allowDots: false,\n allowPrototypes: false,\n arrayLimit: 20,\n decoder: utils.decode,\n delimiter: '&',\n depth: 5,\n parameterLimit: 1000,\n plainObjects: false,\n strictNullHandling: false\n};\n\nvar parseValues = function parseQueryStringValues(str, options) {\n var obj = {};\n var parts = str.split(options.delimiter, options.parameterLimit === Infinity ? undefined : options.parameterLimit);\n\n for (var i = 0; i < parts.length; ++i) {\n var part = parts[i];\n var pos = part.indexOf(']=') === -1 ? part.indexOf('=') : part.indexOf(']=') + 1;\n\n var key, val;\n if (pos === -1) {\n key = options.decoder(part);\n val = options.strictNullHandling ? null : '';\n } else {\n key = options.decoder(part.slice(0, pos));\n val = options.decoder(part.slice(pos + 1));\n }\n if (has.call(obj, key)) {\n obj[key] = [].concat(obj[key]).concat(val);\n } else {\n obj[key] = val;\n }\n }\n\n return obj;\n};\n\nvar parseObject = function parseObjectRecursive(chain, val, options) {\n if (!chain.length) {\n return val;\n }\n\n var root = chain.shift();\n\n var obj;\n if (root === '[]') {\n obj = [];\n obj = obj.concat(parseObject(chain, val, options));\n } else {\n obj = options.plainObjects ? Object.create(null) : {};\n var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;\n var index = parseInt(cleanRoot, 10);\n if (\n !isNaN(index) &&\n root !== cleanRoot &&\n String(index) === cleanRoot &&\n index >= 0 &&\n (options.parseArrays && index <= options.arrayLimit)\n ) {\n obj = [];\n obj[index] = parseObject(chain, val, options);\n } else {\n obj[cleanRoot] = parseObject(chain, val, options);\n }\n }\n\n return obj;\n};\n\nvar parseKeys = function parseQueryStringKeys(givenKey, val, options) {\n if (!givenKey) {\n return;\n }\n\n // Transform dot notation to bracket notation\n var key = options.allowDots ? givenKey.replace(/\\.([^.[]+)/g, '[$1]') : givenKey;\n\n // The regex chunks\n\n var brackets = /(\\[[^[\\]]*])/;\n var child = /(\\[[^[\\]]*])/g;\n\n // Get the parent\n\n var segment = brackets.exec(key);\n var parent = segment ? key.slice(0, segment.index) : key;\n\n // Stash the parent if it exists\n\n var keys = [];\n if (parent) {\n // If we aren't using plain objects, optionally prefix keys\n // that would overwrite object prototype properties\n if (!options.plainObjects && has.call(Object.prototype, parent)) {\n if (!options.allowPrototypes) {\n return;\n }\n }\n\n keys.push(parent);\n }\n\n // Loop through children appending to the array until we hit depth\n\n var i = 0;\n while ((segment = child.exec(key)) !== null && i < options.depth) {\n i += 1;\n if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {\n if (!options.allowPrototypes) {\n return;\n }\n }\n keys.push(segment[1]);\n }\n\n // If there's a remainder, just add whatever is left\n\n if (segment) {\n keys.push('[' + key.slice(segment.index) + ']');\n }\n\n return parseObject(keys, val, options);\n};\n\nmodule.exports = function (str, opts) {\n var options = opts || {};\n\n if (options.decoder !== null && options.decoder !== undefined && typeof options.decoder !== 'function') {\n throw new TypeError('Decoder has to be a function.');\n }\n\n options.delimiter = typeof options.delimiter === 'string' || utils.isRegExp(options.delimiter) ? options.delimiter : defaults.delimiter;\n options.depth = typeof options.depth === 'number' ? options.depth : defaults.depth;\n options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : defaults.arrayLimit;\n options.parseArrays = options.parseArrays !== false;\n options.decoder = typeof options.decoder === 'function' ? options.decoder : defaults.decoder;\n options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : defaults.allowDots;\n options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : defaults.plainObjects;\n options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : defaults.allowPrototypes;\n options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : defaults.parameterLimit;\n options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;\n\n if (str === '' || str === null || typeof str === 'undefined') {\n return options.plainObjects ? Object.create(null) : {};\n }\n\n var tempObj = typeof str === 'string' ? parseValues(str, options) : str;\n var obj = options.plainObjects ? Object.create(null) : {};\n\n // Iterate over the keys and setup the new object\n\n var keys = Object.keys(tempObj);\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n var newObj = parseKeys(key, tempObj[key], options);\n obj = utils.merge(obj, newObj, options);\n }\n\n return utils.compact(obj);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/qs/lib/parse.js\n// module id = 12\n// module chunks = 0 1","'use strict';\n\nvar utils = require('./utils');\nvar formats = require('./formats');\n\nvar arrayPrefixGenerators = {\n brackets: function brackets(prefix) { // eslint-disable-line func-name-matching\n return prefix + '[]';\n },\n indices: function indices(prefix, key) { // eslint-disable-line func-name-matching\n return prefix + '[' + key + ']';\n },\n repeat: function repeat(prefix) { // eslint-disable-line func-name-matching\n return prefix;\n }\n};\n\nvar toISO = Date.prototype.toISOString;\n\nvar defaults = {\n delimiter: '&',\n encode: true,\n encoder: utils.encode,\n encodeValuesOnly: false,\n serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching\n return toISO.call(date);\n },\n skipNulls: false,\n strictNullHandling: false\n};\n\nvar stringify = function stringify( // eslint-disable-line func-name-matching\n object,\n prefix,\n generateArrayPrefix,\n strictNullHandling,\n skipNulls,\n encoder,\n filter,\n sort,\n allowDots,\n serializeDate,\n formatter,\n encodeValuesOnly\n) {\n var obj = object;\n if (typeof filter === 'function') {\n obj = filter(prefix, obj);\n } else if (obj instanceof Date) {\n obj = serializeDate(obj);\n } else if (obj === null) {\n if (strictNullHandling) {\n return encoder && !encodeValuesOnly ? encoder(prefix) : prefix;\n }\n\n obj = '';\n }\n\n if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || utils.isBuffer(obj)) {\n if (encoder) {\n var keyValue = encodeValuesOnly ? prefix : encoder(prefix);\n return [formatter(keyValue) + '=' + formatter(encoder(obj))];\n }\n return [formatter(prefix) + '=' + formatter(String(obj))];\n }\n\n var values = [];\n\n if (typeof obj === 'undefined') {\n return values;\n }\n\n var objKeys;\n if (Array.isArray(filter)) {\n objKeys = filter;\n } else {\n var keys = Object.keys(obj);\n objKeys = sort ? keys.sort(sort) : keys;\n }\n\n for (var i = 0; i < objKeys.length; ++i) {\n var key = objKeys[i];\n\n if (skipNulls && obj[key] === null) {\n continue;\n }\n\n if (Array.isArray(obj)) {\n values = values.concat(stringify(\n obj[key],\n generateArrayPrefix(prefix, key),\n generateArrayPrefix,\n strictNullHandling,\n skipNulls,\n encoder,\n filter,\n sort,\n allowDots,\n serializeDate,\n formatter,\n encodeValuesOnly\n ));\n } else {\n values = values.concat(stringify(\n obj[key],\n prefix + (allowDots ? '.' + key : '[' + key + ']'),\n generateArrayPrefix,\n strictNullHandling,\n skipNulls,\n encoder,\n filter,\n sort,\n allowDots,\n serializeDate,\n formatter,\n encodeValuesOnly\n ));\n }\n }\n\n return values;\n};\n\nmodule.exports = function (object, opts) {\n var obj = object;\n var options = opts || {};\n\n if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') {\n throw new TypeError('Encoder has to be a function.');\n }\n\n var delimiter = typeof options.delimiter === 'undefined' ? defaults.delimiter : options.delimiter;\n var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;\n var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : defaults.skipNulls;\n var encode = typeof options.encode === 'boolean' ? options.encode : defaults.encode;\n var encoder = typeof options.encoder === 'function' ? options.encoder : defaults.encoder;\n var sort = typeof options.sort === 'function' ? options.sort : null;\n var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots;\n var serializeDate = typeof options.serializeDate === 'function' ? options.serializeDate : defaults.serializeDate;\n var encodeValuesOnly = typeof options.encodeValuesOnly === 'boolean' ? options.encodeValuesOnly : defaults.encodeValuesOnly;\n if (typeof options.format === 'undefined') {\n options.format = formats.default;\n } else if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) {\n throw new TypeError('Unknown format option provided.');\n }\n var formatter = formats.formatters[options.format];\n var objKeys;\n var filter;\n\n if (typeof options.filter === 'function') {\n filter = options.filter;\n obj = filter('', obj);\n } else if (Array.isArray(options.filter)) {\n filter = options.filter;\n objKeys = filter;\n }\n\n var keys = [];\n\n if (typeof obj !== 'object' || obj === null) {\n return '';\n }\n\n var arrayFormat;\n if (options.arrayFormat in arrayPrefixGenerators) {\n arrayFormat = options.arrayFormat;\n } else if ('indices' in options) {\n arrayFormat = options.indices ? 'indices' : 'repeat';\n } else {\n arrayFormat = 'indices';\n }\n\n var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];\n\n if (!objKeys) {\n objKeys = Object.keys(obj);\n }\n\n if (sort) {\n objKeys.sort(sort);\n }\n\n for (var i = 0; i < objKeys.length; ++i) {\n var key = objKeys[i];\n\n if (skipNulls && obj[key] === null) {\n continue;\n }\n\n keys = keys.concat(stringify(\n obj[key],\n key,\n generateArrayPrefix,\n strictNullHandling,\n skipNulls,\n encode ? encoder : null,\n filter,\n sort,\n allowDots,\n serializeDate,\n formatter,\n encodeValuesOnly\n ));\n }\n\n return keys.join(delimiter);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/qs/lib/stringify.js\n// module id = 13\n// module chunks = 0 1","/**\n * Check if `obj` is an object.\n *\n * @param {Object} obj\n * @return {Boolean}\n * @api private\n */\n\nfunction isObject(obj) {\n return null !== obj && 'object' === typeof obj;\n}\n\nmodule.exports = isObject;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/superagent/lib/is-object.js\n// module id = 14\n// module chunks = 0","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction placeHoldersCount (b64) {\n var len = b64.length\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // the number of equal signs (place holders)\n // if there are two placeholders, than the two characters before it\n // represent one byte\n // if there is only one, then the three characters before it represent 2 bytes\n // this is just a cheap hack to not do indexOf twice\n return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0\n}\n\nfunction byteLength (b64) {\n // base64 is 4/3 + up to two characters of the original data\n return b64.length * 3 / 4 - placeHoldersCount(b64)\n}\n\nfunction toByteArray (b64) {\n var i, j, l, tmp, placeHolders, arr\n var len = b64.length\n placeHolders = placeHoldersCount(b64)\n\n arr = new Arr(len * 3 / 4 - placeHolders)\n\n // if there are placeholders, only get up to the last complete 4 chars\n l = placeHolders > 0 ? len - 4 : len\n\n var L = 0\n\n for (i = 0, j = 0; i < l; i += 4, j += 3) {\n tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]\n arr[L++] = (tmp >> 16) & 0xFF\n arr[L++] = (tmp >> 8) & 0xFF\n arr[L++] = tmp & 0xFF\n }\n\n if (placeHolders === 2) {\n tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[L++] = tmp & 0xFF\n } else if (placeHolders === 1) {\n tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[L++] = (tmp >> 8) & 0xFF\n arr[L++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var output = ''\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n output += lookup[tmp >> 2]\n output += lookup[(tmp << 4) & 0x3F]\n output += '=='\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + (uint8[len - 1])\n output += lookup[tmp >> 10]\n output += lookup[(tmp >> 4) & 0x3F]\n output += lookup[(tmp << 2) & 0x3F]\n output += '='\n }\n\n parts.push(output)\n\n return parts.join('')\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/base64-js/index.js\n// module id = 15\n// module chunks = 0","var base64 = require('base64-js');\n\nfunction padding(str) {\n var mod = (str.length % 4);\n var pad = 4 - mod;\n\n if (mod === 0) {\n return str;\n }\n\n return str + (new Array(1 + pad)).join('=');\n}\n\nfunction byteArrayToString(array) {\n var result = \"\";\n for (var i = 0; i < array.length; i++) {\n result += String.fromCharCode(array[i]);\n }\n return result;\n}\n\nfunction stringToByteArray(str) {\n var arr = new Array(str.length);\n for (var a = 0; a < str.length; a++) {\n arr[a] = str.charCodeAt(a);\n }\n return arr;\n}\n\nfunction byteArrayToHex(raw) {\n var HEX = '';\n\n for (var i = 0; i < raw.length; i++) {\n var _hex = raw[i].toString(16);\n HEX += (_hex.length === 2 ? _hex : '0' + _hex);\n }\n\n return HEX;\n}\n\nfunction encodeString(str) {\n return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {\n return String.fromCharCode('0x' + p1);\n }))\n .replace(/\\+/g, '-') // Convert '+' to '-'\n .replace(/\\//g, '_'); // Convert '/' to '_';\n}\n\nfunction decodeToString(str) {\n str = padding(str)\n .replace(/\\-/g, '+') // Convert '-' to '+'\n .replace(/_/g, '/'); // Convert '_' to '/'\n\n return decodeURIComponent(atob(str).split('').map(function (c) {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''));\n}\n\nfunction decodeToHEX(str) {\n return byteArrayToHex(base64.toByteArray(padding(str)));\n}\n\nmodule.exports = {\n encodeString: encodeString,\n decodeToString: decodeToString,\n byteArrayToString: byteArrayToString,\n stringToByteArray: stringToByteArray,\n padding: padding,\n byteArrayToHex: byteArrayToHex,\n decodeToHEX: decodeToHEX\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/idtoken-verifier/src/helpers/base64.js\n// module id = 16\n// module chunks = 0","/**\n * Root reference for iframes.\n */\n\nvar root;\nif (typeof window !== 'undefined') { // Browser window\n root = window;\n} else if (typeof self !== 'undefined') { // Web Worker\n root = self;\n} else { // Other environments\n console.warn(\"Using browser-only version of superagent in non-browser environment\");\n root = this;\n}\n\nvar Emitter = require('component-emitter');\nvar RequestBase = require('./request-base');\nvar isObject = require('./is-object');\nvar isFunction = require('./is-function');\nvar ResponseBase = require('./response-base');\nvar shouldRetry = require('./should-retry');\n\n/**\n * Noop.\n */\n\nfunction noop(){};\n\n/**\n * Expose `request`.\n */\n\nvar request = exports = module.exports = function(method, url) {\n // callback\n if ('function' == typeof url) {\n return new exports.Request('GET', method).end(url);\n }\n\n // url first\n if (1 == arguments.length) {\n return new exports.Request('GET', method);\n }\n\n return new exports.Request(method, url);\n}\n\nexports.Request = Request;\n\n/**\n * Determine XHR.\n */\n\nrequest.getXHR = function () {\n if (root.XMLHttpRequest\n && (!root.location || 'file:' != root.location.protocol\n || !root.ActiveXObject)) {\n return new XMLHttpRequest;\n } else {\n try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {}\n try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch(e) {}\n try { return new ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch(e) {}\n try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) {}\n }\n throw Error(\"Browser-only verison of superagent could not find XHR\");\n};\n\n/**\n * Removes leading and trailing whitespace, added to support IE.\n *\n * @param {String} s\n * @return {String}\n * @api private\n */\n\nvar trim = ''.trim\n ? function(s) { return s.trim(); }\n : function(s) { return s.replace(/(^\\s*|\\s*$)/g, ''); };\n\n/**\n * Serialize the given `obj`.\n *\n * @param {Object} obj\n * @return {String}\n * @api private\n */\n\nfunction serialize(obj) {\n if (!isObject(obj)) return obj;\n var pairs = [];\n for (var key in obj) {\n pushEncodedKeyValuePair(pairs, key, obj[key]);\n }\n return pairs.join('&');\n}\n\n/**\n * Helps 'serialize' with serializing arrays.\n * Mutates the pairs array.\n *\n * @param {Array} pairs\n * @param {String} key\n * @param {Mixed} val\n */\n\nfunction pushEncodedKeyValuePair(pairs, key, val) {\n if (val != null) {\n if (Array.isArray(val)) {\n val.forEach(function(v) {\n pushEncodedKeyValuePair(pairs, key, v);\n });\n } else if (isObject(val)) {\n for(var subkey in val) {\n pushEncodedKeyValuePair(pairs, key + '[' + subkey + ']', val[subkey]);\n }\n } else {\n pairs.push(encodeURIComponent(key)\n + '=' + encodeURIComponent(val));\n }\n } else if (val === null) {\n pairs.push(encodeURIComponent(key));\n }\n}\n\n/**\n * Expose serialization method.\n */\n\n request.serializeObject = serialize;\n\n /**\n * Parse the given x-www-form-urlencoded `str`.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nfunction parseString(str) {\n var obj = {};\n var pairs = str.split('&');\n var pair;\n var pos;\n\n for (var i = 0, len = pairs.length; i < len; ++i) {\n pair = pairs[i];\n pos = pair.indexOf('=');\n if (pos == -1) {\n obj[decodeURIComponent(pair)] = '';\n } else {\n obj[decodeURIComponent(pair.slice(0, pos))] =\n decodeURIComponent(pair.slice(pos + 1));\n }\n }\n\n return obj;\n}\n\n/**\n * Expose parser.\n */\n\nrequest.parseString = parseString;\n\n/**\n * Default MIME type map.\n *\n * superagent.types.xml = 'application/xml';\n *\n */\n\nrequest.types = {\n html: 'text/html',\n json: 'application/json',\n xml: 'application/xml',\n urlencoded: 'application/x-www-form-urlencoded',\n 'form': 'application/x-www-form-urlencoded',\n 'form-data': 'application/x-www-form-urlencoded'\n};\n\n/**\n * Default serialization map.\n *\n * superagent.serialize['application/xml'] = function(obj){\n * return 'generated xml here';\n * };\n *\n */\n\n request.serialize = {\n 'application/x-www-form-urlencoded': serialize,\n 'application/json': JSON.stringify\n };\n\n /**\n * Default parsers.\n *\n * superagent.parse['application/xml'] = function(str){\n * return { object parsed from str };\n * };\n *\n */\n\nrequest.parse = {\n 'application/x-www-form-urlencoded': parseString,\n 'application/json': JSON.parse\n};\n\n/**\n * Parse the given header `str` into\n * an object containing the mapped fields.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nfunction parseHeader(str) {\n var lines = str.split(/\\r?\\n/);\n var fields = {};\n var index;\n var line;\n var field;\n var val;\n\n lines.pop(); // trailing CRLF\n\n for (var i = 0, len = lines.length; i < len; ++i) {\n line = lines[i];\n index = line.indexOf(':');\n field = line.slice(0, index).toLowerCase();\n val = trim(line.slice(index + 1));\n fields[field] = val;\n }\n\n return fields;\n}\n\n/**\n * Check if `mime` is json or has +json structured syntax suffix.\n *\n * @param {String} mime\n * @return {Boolean}\n * @api private\n */\n\nfunction isJSON(mime) {\n return /[\\/+]json\\b/.test(mime);\n}\n\n/**\n * Initialize a new `Response` with the given `xhr`.\n *\n * - set flags (.ok, .error, etc)\n * - parse header\n *\n * Examples:\n *\n * Aliasing `superagent` as `request` is nice:\n *\n * request = superagent;\n *\n * We can use the promise-like API, or pass callbacks:\n *\n * request.get('/').end(function(res){});\n * request.get('/', function(res){});\n *\n * Sending data can be chained:\n *\n * request\n * .post('/user')\n * .send({ name: 'tj' })\n * .end(function(res){});\n *\n * Or passed to `.send()`:\n *\n * request\n * .post('/user')\n * .send({ name: 'tj' }, function(res){});\n *\n * Or passed to `.post()`:\n *\n * request\n * .post('/user', { name: 'tj' })\n * .end(function(res){});\n *\n * Or further reduced to a single call for simple cases:\n *\n * request\n * .post('/user', { name: 'tj' }, function(res){});\n *\n * @param {XMLHTTPRequest} xhr\n * @param {Object} options\n * @api private\n */\n\nfunction Response(req) {\n this.req = req;\n this.xhr = this.req.xhr;\n // responseText is accessible only if responseType is '' or 'text' and on older browsers\n this.text = ((this.req.method !='HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text')) || typeof this.xhr.responseType === 'undefined')\n ? this.xhr.responseText\n : null;\n this.statusText = this.req.xhr.statusText;\n var status = this.xhr.status;\n // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n if (status === 1223) {\n status = 204;\n }\n this._setStatusProperties(status);\n this.header = this.headers = parseHeader(this.xhr.getAllResponseHeaders());\n // getAllResponseHeaders sometimes falsely returns \"\" for CORS requests, but\n // getResponseHeader still works. so we get content-type even if getting\n // other headers fails.\n this.header['content-type'] = this.xhr.getResponseHeader('content-type');\n this._setHeaderProperties(this.header);\n\n if (null === this.text && req._responseType) {\n this.body = this.xhr.response;\n } else {\n this.body = this.req.method != 'HEAD'\n ? this._parseBody(this.text ? this.text : this.xhr.response)\n : null;\n }\n}\n\nResponseBase(Response.prototype);\n\n/**\n * Parse the given body `str`.\n *\n * Used for auto-parsing of bodies. Parsers\n * are defined on the `superagent.parse` object.\n *\n * @param {String} str\n * @return {Mixed}\n * @api private\n */\n\nResponse.prototype._parseBody = function(str){\n var parse = request.parse[this.type];\n if(this.req._parser) {\n return this.req._parser(this, str);\n }\n if (!parse && isJSON(this.type)) {\n parse = request.parse['application/json'];\n }\n return parse && str && (str.length || str instanceof Object)\n ? parse(str)\n : null;\n};\n\n/**\n * Return an `Error` representative of this response.\n *\n * @return {Error}\n * @api public\n */\n\nResponse.prototype.toError = function(){\n var req = this.req;\n var method = req.method;\n var url = req.url;\n\n var msg = 'cannot ' + method + ' ' + url + ' (' + this.status + ')';\n var err = new Error(msg);\n err.status = this.status;\n err.method = method;\n err.url = url;\n\n return err;\n};\n\n/**\n * Expose `Response`.\n */\n\nrequest.Response = Response;\n\n/**\n * Initialize a new `Request` with the given `method` and `url`.\n *\n * @param {String} method\n * @param {String} url\n * @api public\n */\n\nfunction Request(method, url) {\n var self = this;\n this._query = this._query || [];\n this.method = method;\n this.url = url;\n this.header = {}; // preserves header name case\n this._header = {}; // coerces header names to lowercase\n this.on('end', function(){\n var err = null;\n var res = null;\n\n try {\n res = new Response(self);\n } catch(e) {\n err = new Error('Parser is unable to parse the response');\n err.parse = true;\n err.original = e;\n // issue #675: return the raw response if the response parsing fails\n if (self.xhr) {\n // ie9 doesn't have 'response' property\n err.rawResponse = typeof self.xhr.responseType == 'undefined' ? self.xhr.responseText : self.xhr.response;\n // issue #876: return the http status code if the response parsing fails\n err.status = self.xhr.status ? self.xhr.status : null;\n err.statusCode = err.status; // backwards-compat only\n } else {\n err.rawResponse = null;\n err.status = null;\n }\n\n return self.callback(err);\n }\n\n self.emit('response', res);\n\n var new_err;\n try {\n if (!self._isResponseOK(res)) {\n new_err = new Error(res.statusText || 'Unsuccessful HTTP response');\n new_err.original = err;\n new_err.response = res;\n new_err.status = res.status;\n }\n } catch(e) {\n new_err = e; // #985 touching res may cause INVALID_STATE_ERR on old Android\n }\n\n // #1000 don't catch errors from the callback to avoid double calling it\n if (new_err) {\n self.callback(new_err, res);\n } else {\n self.callback(null, res);\n }\n });\n}\n\n/**\n * Mixin `Emitter` and `RequestBase`.\n */\n\nEmitter(Request.prototype);\nRequestBase(Request.prototype);\n\n/**\n * Set Content-Type to `type`, mapping values from `request.types`.\n *\n * Examples:\n *\n * superagent.types.xml = 'application/xml';\n *\n * request.post('/')\n * .type('xml')\n * .send(xmlstring)\n * .end(callback);\n *\n * request.post('/')\n * .type('application/xml')\n * .send(xmlstring)\n * .end(callback);\n *\n * @param {String} type\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.type = function(type){\n this.set('Content-Type', request.types[type] || type);\n return this;\n};\n\n/**\n * Set Accept to `type`, mapping values from `request.types`.\n *\n * Examples:\n *\n * superagent.types.json = 'application/json';\n *\n * request.get('/agent')\n * .accept('json')\n * .end(callback);\n *\n * request.get('/agent')\n * .accept('application/json')\n * .end(callback);\n *\n * @param {String} accept\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.accept = function(type){\n this.set('Accept', request.types[type] || type);\n return this;\n};\n\n/**\n * Set Authorization field value with `user` and `pass`.\n *\n * @param {String} user\n * @param {String} [pass] optional in case of using 'bearer' as type\n * @param {Object} options with 'type' property 'auto', 'basic' or 'bearer' (default 'basic')\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.auth = function(user, pass, options){\n if (typeof pass === 'object' && pass !== null) { // pass is optional and can substitute for options\n options = pass;\n }\n if (!options) {\n options = {\n type: 'function' === typeof btoa ? 'basic' : 'auto',\n }\n }\n\n switch (options.type) {\n case 'basic':\n this.set('Authorization', 'Basic ' + btoa(user + ':' + pass));\n break;\n\n case 'auto':\n this.username = user;\n this.password = pass;\n break;\n \n case 'bearer': // usage would be .auth(accessToken, { type: 'bearer' })\n this.set('Authorization', 'Bearer ' + user);\n break; \n }\n return this;\n};\n\n/**\n * Add query-string `val`.\n *\n * Examples:\n *\n * request.get('/shoes')\n * .query('size=10')\n * .query({ color: 'blue' })\n *\n * @param {Object|String} val\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.query = function(val){\n if ('string' != typeof val) val = serialize(val);\n if (val) this._query.push(val);\n return this;\n};\n\n/**\n * Queue the given `file` as an attachment to the specified `field`,\n * with optional `options` (or filename).\n *\n * ``` js\n * request.post('/upload')\n * .attach('content', new Blob(['hey!'], { type: \"text/html\"}))\n * .end(callback);\n * ```\n *\n * @param {String} field\n * @param {Blob|File} file\n * @param {String|Object} options\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.attach = function(field, file, options){\n if (file) {\n if (this._data) {\n throw Error(\"superagent can't mix .send() and .attach()\");\n }\n\n this._getFormData().append(field, file, options || file.name);\n }\n return this;\n};\n\nRequest.prototype._getFormData = function(){\n if (!this._formData) {\n this._formData = new root.FormData();\n }\n return this._formData;\n};\n\n/**\n * Invoke the callback with `err` and `res`\n * and handle arity check.\n *\n * @param {Error} err\n * @param {Response} res\n * @api private\n */\n\nRequest.prototype.callback = function(err, res){\n // console.log(this._retries, this._maxRetries)\n if (this._maxRetries && this._retries++ < this._maxRetries && shouldRetry(err, res)) {\n return this._retry();\n }\n\n var fn = this._callback;\n this.clearTimeout();\n\n if (err) {\n if (this._maxRetries) err.retries = this._retries - 1;\n this.emit('error', err);\n }\n\n fn(err, res);\n};\n\n/**\n * Invoke callback with x-domain error.\n *\n * @api private\n */\n\nRequest.prototype.crossDomainError = function(){\n var err = new Error('Request has been terminated\\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.');\n err.crossDomain = true;\n\n err.status = this.status;\n err.method = this.method;\n err.url = this.url;\n\n this.callback(err);\n};\n\n// This only warns, because the request is still likely to work\nRequest.prototype.buffer = Request.prototype.ca = Request.prototype.agent = function(){\n console.warn(\"This is not supported in browser version of superagent\");\n return this;\n};\n\n// This throws, because it can't send/receive data as expected\nRequest.prototype.pipe = Request.prototype.write = function(){\n throw Error(\"Streaming is not supported in browser version of superagent\");\n};\n\n/**\n * Compose querystring to append to req.url\n *\n * @api private\n */\n\nRequest.prototype._appendQueryString = function(){\n var query = this._query.join('&');\n if (query) {\n this.url += (this.url.indexOf('?') >= 0 ? '&' : '?') + query;\n }\n\n if (this._sort) {\n var index = this.url.indexOf('?');\n if (index >= 0) {\n var queryArr = this.url.substring(index + 1).split('&');\n if (isFunction(this._sort)) {\n queryArr.sort(this._sort);\n } else {\n queryArr.sort();\n }\n this.url = this.url.substring(0, index) + '?' + queryArr.join('&');\n }\n }\n};\n\n/**\n * Check if `obj` is a host object,\n * we don't want to serialize these :)\n *\n * @param {Object} obj\n * @return {Boolean}\n * @api private\n */\nRequest.prototype._isHost = function _isHost(obj) {\n // Native objects stringify to [object File], [object Blob], [object FormData], etc.\n return obj && 'object' === typeof obj && !Array.isArray(obj) && Object.prototype.toString.call(obj) !== '[object Object]';\n}\n\n/**\n * Initiate request, invoking callback `fn(res)`\n * with an instanceof `Response`.\n *\n * @param {Function} fn\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.end = function(fn){\n if (this._endCalled) {\n console.warn(\"Warning: .end() was called twice. This is not supported in superagent\");\n }\n this._endCalled = true;\n\n // store callback\n this._callback = fn || noop;\n\n // querystring\n this._appendQueryString();\n\n return this._end();\n};\n\nRequest.prototype._end = function() {\n var self = this;\n var xhr = this.xhr = request.getXHR();\n var data = this._formData || this._data;\n\n this._setTimeouts();\n\n // state change\n xhr.onreadystatechange = function(){\n var readyState = xhr.readyState;\n if (readyState >= 2 && self._responseTimeoutTimer) {\n clearTimeout(self._responseTimeoutTimer);\n }\n if (4 != readyState) {\n return;\n }\n\n // In IE9, reads to any property (e.g. status) off of an aborted XHR will\n // result in the error \"Could not complete the operation due to error c00c023f\"\n var status;\n try { status = xhr.status } catch(e) { status = 0; }\n\n if (!status) {\n if (self.timedout || self._aborted) return;\n return self.crossDomainError();\n }\n self.emit('end');\n };\n\n // progress\n var handleProgress = function(direction, e) {\n if (e.total > 0) {\n e.percent = e.loaded / e.total * 100;\n }\n e.direction = direction;\n self.emit('progress', e);\n }\n if (this.hasListeners('progress')) {\n try {\n xhr.onprogress = handleProgress.bind(null, 'download');\n if (xhr.upload) {\n xhr.upload.onprogress = handleProgress.bind(null, 'upload');\n }\n } catch(e) {\n // Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist.\n // Reported here:\n // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context\n }\n }\n\n // initiate request\n try {\n if (this.username && this.password) {\n xhr.open(this.method, this.url, true, this.username, this.password);\n } else {\n xhr.open(this.method, this.url, true);\n }\n } catch (err) {\n // see #1149\n return this.callback(err);\n }\n\n // CORS\n if (this._withCredentials) xhr.withCredentials = true;\n\n // body\n if (!this._formData && 'GET' != this.method && 'HEAD' != this.method && 'string' != typeof data && !this._isHost(data)) {\n // serialize stuff\n var contentType = this._header['content-type'];\n var serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : ''];\n if (!serialize && isJSON(contentType)) {\n serialize = request.serialize['application/json'];\n }\n if (serialize) data = serialize(data);\n }\n\n // set header fields\n for (var field in this.header) {\n if (null == this.header[field]) continue;\n xhr.setRequestHeader(field, this.header[field]);\n }\n\n if (this._responseType) {\n xhr.responseType = this._responseType;\n }\n\n // send stuff\n this.emit('request', this);\n\n // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing)\n // We need null here if data is undefined\n xhr.send(typeof data !== 'undefined' ? data : null);\n return this;\n};\n\n/**\n * GET `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.get = function(url, data, fn){\n var req = request('GET', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.query(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * HEAD `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.head = function(url, data, fn){\n var req = request('HEAD', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * OPTIONS query to `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.options = function(url, data, fn){\n var req = request('OPTIONS', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * DELETE `url` with optional `data` and callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed} [data]\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nfunction del(url, data, fn){\n var req = request('DELETE', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\nrequest['del'] = del;\nrequest['delete'] = del;\n\n/**\n * PATCH `url` with optional `data` and callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed} [data]\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.patch = function(url, data, fn){\n var req = request('PATCH', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * POST `url` with optional `data` and callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed} [data]\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.post = function(url, data, fn){\n var req = request('POST', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * PUT `url` with optional `data` and callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.put = function(url, data, fn){\n var req = request('PUT', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/superagent/lib/client.js\n// module id = 17\n// module chunks = 0","var WinChan = (function() {\n var RELAY_FRAME_NAME = \"__winchan_relay_frame\";\n var CLOSE_CMD = \"die\";\n\n // a portable addListener implementation\n function addListener(w, event, cb) {\n if(w.attachEvent) w.attachEvent('on' + event, cb);\n else if (w.addEventListener) w.addEventListener(event, cb, false);\n }\n\n // a portable removeListener implementation\n function removeListener(w, event, cb) {\n if(w.detachEvent) w.detachEvent('on' + event, cb);\n else if (w.removeEventListener) w.removeEventListener(event, cb, false);\n }\n\n\n // checking for IE8 or above\n function isInternetExplorer() {\n if (typeof navigator === 'undefined') {\n return false;\n }\n\n var rv = -1; // Return value assumes failure.\n var ua = navigator.userAgent;\n if (navigator.appName === 'Microsoft Internet Explorer') {\n var re = new RegExp(\"MSIE ([0-9]{1,}[\\.0-9]{0,})\");\n if (re.exec(ua) != null)\n rv = parseFloat(RegExp.$1);\n }\n // IE > 11\n else if (ua.indexOf(\"Trident\") > -1) {\n var re = new RegExp(\"rv:([0-9]{2,2}[\\.0-9]{0,})\");\n if (re.exec(ua) !== null) {\n rv = parseFloat(RegExp.$1);\n }\n }\n\n return rv >= 8;\n }\n\n // checking Mobile Firefox (Fennec)\n function isFennec() {\n try {\n // We must check for both XUL and Java versions of Fennec. Both have\n // distinct UA strings.\n var userAgent = navigator.userAgent;\n return (userAgent.indexOf('Fennec/') != -1) || // XUL\n (userAgent.indexOf('Firefox/') != -1 && userAgent.indexOf('Android') != -1); // Java\n } catch(e) {}\n return false;\n }\n\n // feature checking to see if this platform is supported at all\n function isSupported() {\n return (typeof window !== 'undefined' && window.JSON && window.JSON.stringify &&\n window.JSON.parse && window.postMessage);\n }\n\n // given a URL, extract the origin. Taken from: https://github.com/firebase/firebase-simple-login/blob/d2cb95b9f812d8488bdbfba51c3a7c153ba1a074/js/src/simple-login/transports/WinChan.js#L25-L30\n function extractOrigin(url) {\n if (!/^https?:\\/\\//.test(url)) url = window.location.href;\n var m = /^(https?:\\/\\/[\\-_a-zA-Z\\.0-9:]+)/.exec(url);\n if (m) return m[1];\n return url;\n }\n\n // find the relay iframe in the opener\n function findRelay() {\n var loc = window.location;\n var frames = window.opener.frames;\n for (var i = frames.length - 1; i >= 0; i--) {\n try {\n if (frames[i].location.protocol === window.location.protocol &&\n frames[i].location.host === window.location.host &&\n frames[i].name === RELAY_FRAME_NAME)\n {\n return frames[i];\n }\n } catch(e) { }\n }\n return;\n }\n\n var isIE = isInternetExplorer();\n\n if (isSupported()) {\n /* General flow:\n * 0. user clicks\n * (IE SPECIFIC) 1. caller adds relay iframe (served from trusted domain) to DOM\n * 2. caller opens window (with content from trusted domain)\n * 3. window on opening adds a listener to 'message'\n * (IE SPECIFIC) 4. window on opening finds iframe\n * 5. window checks if iframe is \"loaded\" - has a 'doPost' function yet\n * (IE SPECIFIC5) 5a. if iframe.doPost exists, window uses it to send ready event to caller\n * (IE SPECIFIC5) 5b. if iframe.doPost doesn't exist, window waits for frame ready\n * (IE SPECIFIC5) 5bi. once ready, window calls iframe.doPost to send ready event\n * 6. caller upon reciept of 'ready', sends args\n */\n return {\n open: function(opts, cb) {\n if (!cb) throw \"missing required callback argument\";\n\n // test required options\n var err;\n if (!opts.url) err = \"missing required 'url' parameter\";\n if (!opts.relay_url) err = \"missing required 'relay_url' parameter\";\n if (err) setTimeout(function() { cb(err); }, 0);\n\n // supply default options\n if (!opts.window_name) opts.window_name = null;\n if (!opts.window_features || isFennec()) opts.window_features = undefined;\n\n // opts.params may be undefined\n\n var iframe;\n\n // sanity check, are url and relay_url the same origin?\n var origin = opts.origin || extractOrigin(opts.url);\n if (origin !== extractOrigin(opts.relay_url)) {\n return setTimeout(function() {\n cb('invalid arguments: origin of url and relay_url must match');\n }, 0);\n }\n\n var messageTarget;\n\n if (isIE) {\n // first we need to add a \"relay\" iframe to the document that's served\n // from the target domain. We can postmessage into a iframe, but not a\n // window\n iframe = document.createElement(\"iframe\");\n // iframe.setAttribute('name', framename);\n iframe.setAttribute('src', opts.relay_url);\n iframe.style.display = \"none\";\n iframe.setAttribute('name', RELAY_FRAME_NAME);\n document.body.appendChild(iframe);\n messageTarget = iframe.contentWindow;\n }\n\n var w = opts.popup || window.open(opts.url, opts.window_name, opts.window_features);\n if (opts.popup) {\n w.location.href = opts.url;\n }\n\n if (!messageTarget) messageTarget = w;\n\n // lets listen in case the window blows up before telling us\n var closeInterval = setInterval(function() {\n if (w && w.closed) {\n cleanup();\n if (cb) {\n cb('User closed the popup window');\n cb = null;\n }\n }\n }, 500);\n\n var req = JSON.stringify({a: 'request', d: opts.params});\n\n // cleanup on unload\n function cleanup() {\n if (iframe) document.body.removeChild(iframe);\n iframe = undefined;\n if (closeInterval) closeInterval = clearInterval(closeInterval);\n removeListener(window, 'message', onMessage);\n removeListener(window, 'unload', cleanup);\n if (w) {\n try {\n w.close();\n } catch (securityViolation) {\n // This happens in Opera 12 sometimes\n // see https://github.com/mozilla/browserid/issues/1844\n messageTarget.postMessage(CLOSE_CMD, origin);\n }\n }\n w = messageTarget = undefined;\n }\n\n addListener(window, 'unload', cleanup);\n\n function onMessage(e) {\n if (e.origin !== origin) { return; }\n try {\n var d = JSON.parse(e.data);\n } catch(err) {\n if (cb) {\n cb(err);\n } else {\n throw err;\n }\n }\n\n if (d.a === 'ready') {\n messageTarget.postMessage(req, origin);\n } else if (d.a === 'error') {\n cleanup();\n if (cb) {\n cb(d.d);\n cb = null;\n }\n } else if (d.a === 'response') {\n cleanup();\n if (cb) {\n cb(null, d.d);\n cb = null;\n }\n }\n }\n\n addListener(window, 'message', onMessage);\n\n return {\n close: cleanup,\n focus: function() {\n if (w) {\n try {\n w.focus();\n } catch (e) {\n // IE7 blows up here, do nothing\n }\n }\n }\n };\n },\n onOpen: function(cb) {\n var o = \"*\";\n var msgTarget = isIE ? findRelay() : window.opener;\n if (!msgTarget) throw \"can't find relay frame\";\n function doPost(msg) {\n msg = JSON.stringify(msg);\n if (isIE) msgTarget.doPost(msg, o);\n else msgTarget.postMessage(msg, o);\n }\n\n function onMessage(e) {\n // only one message gets through, but let's make sure it's actually\n // the message we're looking for (other code may be using\n // postmessage) - we do this by ensuring the payload can\n // be parsed, and it's got an 'a' (action) value of 'request'.\n var d;\n try {\n d = JSON.parse(e.data);\n } catch(err) { }\n if (!d || d.a !== 'request') return;\n removeListener(window, 'message', onMessage);\n o = e.origin;\n if (cb) {\n // this setTimeout is critically important for IE8 -\n // in ie8 sometimes addListener for 'message' can synchronously\n // cause your callback to be invoked. awesome.\n setTimeout(function() {\n cb(o, d.d, function(r) {\n cb = undefined;\n doPost({a: 'response', d: r});\n });\n }, 0);\n }\n }\n\n function onDie(e) {\n if (e.data === CLOSE_CMD) {\n try { window.close(); } catch (o_O) {}\n }\n }\n addListener(isIE ? msgTarget : window, 'message', onMessage);\n addListener(isIE ? msgTarget : window, 'message', onDie);\n\n // we cannot post to our parent that we're ready before the iframe\n // is loaded. (IE specific possible failure)\n try {\n doPost({a: \"ready\"});\n } catch(e) {\n // this code should never be exectued outside IE\n addListener(msgTarget, 'load', function(e) {\n doPost({a: \"ready\"});\n });\n }\n\n // if window is unloaded and the client hasn't called cb, it's an error\n var onUnload = function() {\n try {\n // IE8 doesn't like this...\n removeListener(isIE ? msgTarget : window, 'message', onDie);\n } catch (ohWell) { }\n if (cb) doPost({ a: 'error', d: 'client closed window' });\n cb = undefined;\n // explicitly close the window, in case the client is trying to reload or nav\n try { window.close(); } catch (e) { }\n };\n addListener(window, 'unload', onUnload);\n return {\n detach: function() {\n removeListener(window, 'unload', onUnload);\n }\n };\n }\n };\n } else {\n return {\n open: function(url, winopts, arg, cb) {\n setTimeout(function() { cb(\"unsupported browser\"); }, 0);\n },\n onOpen: function(cb) {\n setTimeout(function() { cb(\"unsupported browser\"); }, 0);\n }\n };\n }\n})();\n\nif (typeof module !== 'undefined' && module.exports) {\n module.exports = WinChan;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/winchan/winchan.js\n// module id = 18\n// module chunks = 0","var urljoin = require('url-join');\n\nvar RequestBuilder = require('../helper/request-builder');\nvar qs = require('qs');\nvar objectHelper = require('../helper/object');\nvar assert = require('../helper/assert');\nvar responseHandler = require('../helper/response-handler');\nvar parametersWhitelist = require('../helper/parameters-whitelist');\nvar Warn = require('../helper/warn');\n\nvar PasswordlessAuthentication = require('./passwordless-authentication');\nvar DBConnection = require('./db-connection');\n\n/**\n * Creates a new Auth0 Authentication API client\n * @constructor\n * @param {Object} options\n * @param {String} options.domain your Auth0 domain\n * @param {String} options.clientID your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard\n * @param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorization Response\n * @param {String} [options.responseType] type of the response used by OAuth 2.0 flow. It can be any space separated list of the values `code`, `token`, `id_token`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0}\n * @param {String} [options.responseMode] how the Auth response is encoded and redirected back to the client. Supported values are `query`, `fragment` and `form_post`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes}\n * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email`\n * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth\n * @see {@link https://auth0.com/docs/api/authentication}\n */\nfunction Authentication(options) {\n /* eslint-disable */\n assert.check(\n options,\n { type: 'object', message: 'options parameter is not valid' },\n {\n domain: { type: 'string', message: 'domain option is required' },\n clientID: { type: 'string', message: 'clientID option is required' },\n responseType: { optional: true, type: 'string', message: 'responseType is not valid' },\n responseMode: { optional: true, type: 'string', message: 'responseMode is not valid' },\n redirectUri: { optional: true, type: 'string', message: 'redirectUri is not valid' },\n scope: { optional: true, type: 'string', message: 'scope is not valid' },\n audience: { optional: true, type: 'string', message: 'audience is not valid' },\n _disableDeprecationWarnings: {\n optional: true,\n type: 'boolean',\n message: '_disableDeprecationWarnings option is not valid'\n },\n _sendTelemetry: {\n optional: true,\n type: 'boolean',\n message: '_sendTelemetry option is not valid'\n },\n _telemetryInfo: {\n optional: true,\n type: 'object',\n message: '_telemetryInfo option is not valid'\n }\n }\n );\n /* eslint-enable */\n\n this.baseOptions = options;\n\n this.baseOptions._sendTelemetry = this.baseOptions._sendTelemetry === false\n ? this.baseOptions._sendTelemetry\n : true;\n\n this.baseOptions.rootUrl = 'https://' + this.baseOptions.domain;\n\n this.request = new RequestBuilder(this.baseOptions);\n\n this.passwordless = new PasswordlessAuthentication(this.request, this.baseOptions);\n this.dbConnection = new DBConnection(this.request, this.baseOptions);\n\n this.warn = new Warn({\n disableWarnings: !!options._disableDeprecationWarnings\n });\n}\n\n/**\n * Builds and returns the `/authorize` url in order to initialize a new authN/authZ transaction\n *\n * @method buildAuthorizeUrl\n * @param {Object} options\n * @param {String} [options.domain] your Auth0 domain\n * @param {String} [options.clientID] your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard\n * @param {String} options.redirectUri url that the Auth0 will redirect after Auth with the Authorization Response\n * @param {String} options.responseType type of the response used by OAuth 2.0 flow. It can be any space separated list of the values `code`, `token`, `id_token`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0}\n * @param {String} [options.responseMode] how the Auth response is encoded and redirected back to the client. Supported values are `query`, `fragment` and `form_post`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes}\n * @param {String} [options.state] value used to mitigate XSRF attacks. {@link https://auth0.com/docs/protocols/oauth2/oauth-state}\n * @param {String} [options.nonce] value used to mitigate replay attacks when using Implicit Grant. {@link https://auth0.com/docs/api-auth/tutorials/nonce}\n * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email`\n * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth\n * @see {@link https://auth0.com/docs/api/authentication#authorize-client}\n * @see {@link https://auth0.com/docs/api/authentication#social}\n */\nAuthentication.prototype.buildAuthorizeUrl = function(options) {\n var params;\n var qString;\n\n assert.check(options, { type: 'object', message: 'options parameter is not valid' });\n\n params = objectHelper\n .merge(this.baseOptions, [\n 'clientID',\n 'responseType',\n 'responseMode',\n 'redirectUri',\n 'scope',\n 'audience'\n ])\n .with(options);\n\n /* eslint-disable */\n assert.check(\n params,\n { type: 'object', message: 'options parameter is not valid' },\n {\n clientID: { type: 'string', message: 'clientID option is required' },\n redirectUri: { optional: true, type: 'string', message: 'redirectUri option is required' },\n responseType: { type: 'string', message: 'responseType option is required' },\n nonce: {\n type: 'string',\n message: 'nonce option is required',\n condition: function(o) {\n return o.responseType.indexOf('code') === -1 && o.responseType.indexOf('id_token') !== -1;\n }\n },\n scope: { optional: true, type: 'string', message: 'scope option is required' },\n audience: { optional: true, type: 'string', message: 'audience option is required' }\n }\n );\n /* eslint-enable */\n\n // eslint-disable-next-line\n if (this.baseOptions._sendTelemetry) {\n params.auth0Client = this.request.getTelemetryData();\n }\n\n if (params.connection_scope && assert.isArray(params.connection_scope)) {\n params.connection_scope = params.connection_scope.join(',');\n }\n\n params = objectHelper.toSnakeCase(params, ['auth0Client']);\n params = parametersWhitelist.oauthAuthorizeParams(this.warn, params);\n\n qString = qs.stringify(params);\n\n return urljoin(this.baseOptions.rootUrl, 'authorize', '?' + qString);\n};\n\n/**\n * Builds and returns the Logout url in order to initialize a new authN/authZ transaction\n *\n * If you want to navigate the user to a specific URL after the logout, set that URL at the returnTo parameter. The URL should be included in any the appropriate Allowed Logout URLs list:\n *\n * - If the client_id parameter is included, the returnTo URL must be listed in the Allowed Logout URLs set at the client level (see Setting Allowed Logout URLs at the App Level).\n * - If the client_id parameter is NOT included, the returnTo URL must be listed in the Allowed Logout URLs set at the account level (see Setting Allowed Logout URLs at the Account Level).\n * @method buildLogoutUrl\n * @param {Object} options\n * @param {String} [options.clientID] identifier of your client\n * @param {String} [options.returnTo] URL to be redirected after the logout\n * @param {Boolean} [options.federated] tells Auth0 if it should logout the user also from the IdP.\n * @see {@link https://auth0.com/docs/api/authentication#logout}\n */\nAuthentication.prototype.buildLogoutUrl = function(options) {\n var params;\n var qString;\n\n assert.check(options, {\n optional: true,\n type: 'object',\n message: 'options parameter is not valid'\n });\n\n params = objectHelper.merge(this.baseOptions, ['clientID']).with(options || {});\n\n // eslint-disable-next-line\n if (this.baseOptions._sendTelemetry) {\n params.auth0Client = this.request.getTelemetryData();\n }\n\n params = objectHelper.toSnakeCase(params, ['auth0Client', 'returnTo']);\n\n qString = qs.stringify(params);\n\n return urljoin(this.baseOptions.rootUrl, 'v2', 'logout', '?' + qString);\n};\n\n/**\n * @callback authorizeCallback\n * @param {Error} [err] error returned by Auth0 with the reason of the Auth failure\n * @param {Object} [result] result of the Auth request\n * @param {String} [result.accessToken] token that allows access to the specified resource server (identified by the audience parameter or by default Auth0's /userinfo endpoint)\n * @param {Number} [result.expiresIn] number of seconds until the access token expires\n * @param {String} [result.idToken] token that identifies the user\n * @param {String} [result.refreshToken] token that can be used to get new access tokens from Auth0. Note that not all clients can request them or the resource server might not allow them.\n */\n\n/**\n * @callback tokenCallback\n * @param {Error} [err] error returned by Auth0 with the reason of the Auth failure\n * @param {Object} [result] result of the Auth request\n * @param {String} result.accessToken token that allows access to the specified resource server (identified by the audience parameter or by default Auth0's /userinfo endpoint)\n * @param {Number} result.expiresIn number of seconds until the access token expires\n * @param {String} [result.idToken] token that identifies the user\n * @param {String} [result.refreshToken] token that can be used to get new access tokens from Auth0. Note that not all clients can request them or the resource server might not allow them.\n */\n\n/**\n * Makes a call to the `oauth/token` endpoint with `password` grant type to login to the default directory.\n *\n * @method loginWithDefaultDirectory\n * @param {Object} options\n * @param {String} options.username email or username of the user that will perform Auth\n * @param {String} options.password the password of the user that will perform Auth\n * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email`\n * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth\n * @param {tokenCallback} cb function called with the result of the request\n * @see {@link https://auth0.com/docs/api-auth/grant/password}\n */\nAuthentication.prototype.loginWithDefaultDirectory = function(options, cb) {\n assert.check(\n options,\n { type: 'object', message: 'options parameter is not valid' },\n {\n username: { type: 'string', message: 'username option is required' },\n password: { type: 'string', message: 'password option is required' },\n scope: { optional: true, type: 'string', message: 'scope option is required' },\n audience: { optional: true, type: 'string', message: 'audience option is required' }\n }\n );\n\n options.grantType = 'password';\n\n return this.oauthToken(options, cb);\n};\n\n/**\n * Makes a call to the `oauth/token` endpoint with `password-realm` grant type\n *\n * @method login\n * @param {Object} options\n * @param {String} options.username email or username of the user that will perform Auth\n * @param {String} options.password the password of the user that will perform Auth\n * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email`\n * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth\n * @param {Object} options.realm the HRD domain or the connection name where the user belongs to. e.g. `Username-Password-Authentication`\n * @param {tokenCallback} cb function called with the result of the request\n * @see {@link https://auth0.com/docs/api-auth/grant/password}\n */\nAuthentication.prototype.login = function(options, cb) {\n assert.check(\n options,\n { type: 'object', message: 'options parameter is not valid' },\n {\n username: { type: 'string', message: 'username option is required' },\n password: { type: 'string', message: 'password option is required' },\n realm: { type: 'string', message: 'realm option is required' },\n scope: { optional: true, type: 'string', message: 'scope option is required' },\n audience: { optional: true, type: 'string', message: 'audience option is required' }\n }\n );\n\n options.grantType = 'http://auth0.com/oauth/grant-type/password-realm';\n\n return this.oauthToken(options, cb);\n};\n\n/**\n * Makes a call to the `oauth/token` endpoint\n *\n * @method oauthToken\n * @private\n */\nAuthentication.prototype.oauthToken = function(options, cb) {\n var url;\n var body;\n\n assert.check(options, { type: 'object', message: 'options parameter is not valid' });\n assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\n url = urljoin(this.baseOptions.rootUrl, 'oauth', 'token');\n\n body = objectHelper.merge(this.baseOptions, ['clientID', 'scope', 'audience']).with(options);\n\n assert.check(\n body,\n { type: 'object', message: 'options parameter is not valid' },\n {\n clientID: { type: 'string', message: 'clientID option is required' },\n grantType: { type: 'string', message: 'grantType option is required' },\n scope: { optional: true, type: 'string', message: 'scope option is required' },\n audience: { optional: true, type: 'string', message: 'audience option is required' }\n }\n );\n\n body = objectHelper.toSnakeCase(body, ['auth0Client']);\n body = parametersWhitelist.oauthTokenParams(this.warn, body);\n\n body.grant_type = body.grant_type;\n\n return this.request.post(url).send(body).end(responseHandler(cb));\n};\n\n/**\n * Performs authentication calling `/oauth/ro` endpoint with username\n * and password for a given connection name.\n *\n * This method is not compatible with API Auth so if you need to fetch API tokens with audience\n * you should use {@link login} or {@link loginWithDefaultDirectory}.\n *\n * @method loginWithResourceOwner\n * @param {Object} options\n * @param {String} options.username email or username of the user that will perform Auth\n * @param {String} options.password the password of the user that will perform Auth\n * @param {Object} options.connection the connection name where the user belongs to. e.g. `Username-Password-Authentication`\n * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email`\n * @param {String} [options.device] name of the device/browser where the Auth was requested\n * @param {tokenCallback} cb function called with the result of the request\n */\nAuthentication.prototype.loginWithResourceOwner = function(options, cb) {\n var url;\n var body;\n\n assert.check(\n options,\n { type: 'object', message: 'options parameter is not valid' },\n {\n username: { type: 'string', message: 'username option is required' },\n password: { type: 'string', message: 'password option is required' },\n connection: { type: 'string', message: 'connection option is required' },\n scope: { optional: true, type: 'string', message: 'scope option is required' }\n }\n );\n assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\n url = urljoin(this.baseOptions.rootUrl, 'oauth', 'ro');\n\n body = objectHelper\n .merge(this.baseOptions, ['clientID', 'scope'])\n .with(options, ['username', 'password', 'scope', 'connection', 'device']);\n\n body = objectHelper.toSnakeCase(body, ['auth0Client']);\n\n body.grant_type = body.grant_type || 'password';\n\n return this.request.post(url).send(body).end(responseHandler(cb));\n};\n\n/**\n * Makes a call to the `/ssodata` endpoint.\n * We recommend to avoid using this method and rely on your tenant hosted login page and using prompt=none via {@link renewAuth} method.\n *\n * @method getSSOData\n * @param {Boolean} withActiveDirectories tells Auth0 to return AD data\n * @param {Function} cb\n */\nAuthentication.prototype.getSSOData = function(withActiveDirectories, cb) {\n var url;\n var params = '';\n\n if (typeof withActiveDirectories === 'function') {\n cb = withActiveDirectories;\n withActiveDirectories = false;\n }\n\n assert.check(withActiveDirectories, {\n type: 'boolean',\n message: 'withActiveDirectories parameter is not valid'\n });\n assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\n if (withActiveDirectories) {\n params =\n '?' +\n qs.stringify({\n ldaps: 1,\n client_id: this.baseOptions.clientID\n });\n }\n\n url = urljoin(this.baseOptions.rootUrl, 'user', 'ssodata', params);\n\n return this.request.get(url, { noHeaders: true }).withCredentials().end(responseHandler(cb));\n};\n\n/**\n * @callback userInfoCallback\n * @param {Error} [err] error returned by Auth0\n * @param {Object} [userInfo] user information\n */\n\n/**\n * Makes a call to the `/userinfo` endpoint and returns the user profile\n *\n * @method userInfo\n * @param {String} accessToken token issued to a user after Auth\n * @param {userInfoCallback} cb\n * @see {@link https://auth0.com/docs/api/authentication#get-user-info}\n */\nAuthentication.prototype.userInfo = function(accessToken, cb) {\n var url;\n\n assert.check(accessToken, { type: 'string', message: 'accessToken parameter is not valid' });\n assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\n url = urljoin(this.baseOptions.rootUrl, 'userinfo');\n\n return this.request\n .get(url)\n .set('Authorization', 'Bearer ' + accessToken)\n .end(responseHandler(cb, { ignoreCasing: true }));\n};\n\n/**\n * @callback delegationCallback\n * @param {Error} [err] error returned by Auth0 with the reason why the delegation failed\n * @param {Object} [result] result of the delegation request. The payload depends on what ai type was used\n */\n\n/**\n * Makes a call to the `/delegation` endpoint with either an `id_token` or `refresh_token`\n *\n * @method delegation\n * @param {Object} options\n * @param {String} [options.clientID] client identifier\n * @param {String} options.grantType grant type used for delegation. The only valid value is `urn:ietf:params:oauth:grant-type:jwt-bearer`\n * @param {String} [options.idToken] valid token of the user issued after Auth. If no `refresh_token` is provided this parameter is required\n * @param {String} [options.refreshToken] valid refresh token of the user issued after Auth. If no `id_token` is provided this parameter is required\n * @param {String} [options.target] the target client id of the delegation\n * @param {String} [options.scope] either `openid` or `openid profile email`\n * @param {String} [options.apiType] the api to be called\n * @param {delegationCallback} cb\n * @see {@link https://auth0.com/docs/api/authentication#delegation}\n */\nAuthentication.prototype.delegation = function(options, cb) {\n var url;\n var body;\n\n assert.check(\n options,\n { type: 'object', message: 'options parameter is not valid' },\n {\n grant_type: { type: 'string', message: 'grant_type option is required' }\n }\n );\n assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\n url = urljoin(this.baseOptions.rootUrl, 'delegation');\n\n body = objectHelper.merge(this.baseOptions, ['clientID']).with(options);\n\n body = objectHelper.toSnakeCase(body, ['auth0Client']);\n\n return this.request.post(url).send(body).end(responseHandler(cb));\n};\n\n/**\n * Fetches the user country based on the ip.\n *\n * @method getUserCountry\n * @private\n * @param {Function} cb\n */\nAuthentication.prototype.getUserCountry = function(cb) {\n var url;\n\n assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\n url = urljoin(this.baseOptions.rootUrl, 'user', 'geoloc', 'country');\n\n return this.request.get(url).end(responseHandler(cb));\n};\n\nmodule.exports = Authentication;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/authentication/index.js\n// module id = 19\n// module chunks = 0","var base64 = require('base64-js');\n\nfunction padding(str) {\n var mod = str.length % 4;\n var pad = 4 - mod;\n\n if (mod === 0) {\n return str;\n }\n\n return str + new Array(1 + pad).join('=');\n}\n\nfunction stringToByteArray(str) {\n var arr = new Array(str.length);\n for (var a = 0; a < str.length; a++) {\n arr[a] = str.charCodeAt(a);\n }\n return arr;\n}\n\nfunction byteArrayToString(array) {\n var result = '';\n for (var i = 0; i < array.length; i++) {\n result += String.fromCharCode(array[i]);\n }\n return result;\n}\n\nfunction encode(str) {\n return base64\n .fromByteArray(stringToByteArray(str))\n .replace(/\\+/g, '-') // Convert '+' to '-'\n .replace(/\\//g, '_'); // Convert '/' to '_'\n}\n\nfunction decode(str) {\n str = padding(str)\n .replace(/-/g, '+') // Convert '-' to '+'\n .replace(/_/g, '/'); // Convert '_' to '/'\n\n return byteArrayToString(base64.toByteArray(str));\n}\n\nmodule.exports = {\n encode: encode,\n decode: decode\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/base64_url.js\n// module id = 20\n// module chunks = 0","function buildResponse(error, description) {\n return {\n error: error,\n errorDescription: description\n };\n}\n\nfunction invalidJwt(description) {\n return buildResponse('invalid_token', description);\n}\n\nmodule.exports = {\n buildResponse: buildResponse,\n invalidJwt: invalidJwt\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/error.js\n// module id = 21\n// module chunks = 0","var random = require('../helper/random');\nvar storage = require('../helper/storage');\n\nvar DEFAULT_NAMESPACE = 'com.auth0.auth.';\n\nfunction TransactionManager(options) {\n options = options || {};\n this.namespace = options.namespace || DEFAULT_NAMESPACE;\n this.keyLength = options.keyLength || 32;\n}\n\nTransactionManager.prototype.process = function(options) {\n var transaction;\n\n if (options.responseType.indexOf('code') !== -1) {\n return options;\n }\n\n if (options.responseType.indexOf('id_token') !== -1 && !!options.nonce) {\n return options;\n }\n\n transaction = this.generateTransaction(options.appState, options.state, options.nonce);\n\n options.state = transaction.state;\n\n if (options.responseType.indexOf('id_token') !== -1) {\n options.nonce = transaction.nonce;\n }\n\n return options;\n};\n\nTransactionManager.prototype.generateTransaction = function(appState, state, nonce) {\n var transaction = state || random.randomString(this.keyLength);\n nonce = nonce || random.randomString(this.keyLength);\n\n storage.setItem(this.namespace + transaction, {\n nonce: nonce,\n appState: appState\n });\n\n return {\n state: transaction,\n nonce: nonce\n };\n};\n\nTransactionManager.prototype.getStoredTransaction = function(transaction) {\n var transactionData;\n\n transactionData = storage.getItem(this.namespace + transaction);\n storage.removeItem(this.namespace + transaction);\n return transactionData;\n};\n\nmodule.exports = TransactionManager;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/web-auth/transaction-manager.js\n// module id = 22\n// module chunks = 0","\r\n/**\r\n * Expose `Emitter`.\r\n */\r\n\r\nif (typeof module !== 'undefined') {\r\n module.exports = Emitter;\r\n}\r\n\r\n/**\r\n * Initialize a new `Emitter`.\r\n *\r\n * @api public\r\n */\r\n\r\nfunction Emitter(obj) {\r\n if (obj) return mixin(obj);\r\n};\r\n\r\n/**\r\n * Mixin the emitter properties.\r\n *\r\n * @param {Object} obj\r\n * @return {Object}\r\n * @api private\r\n */\r\n\r\nfunction mixin(obj) {\r\n for (var key in Emitter.prototype) {\r\n obj[key] = Emitter.prototype[key];\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Listen on the given `event` with `fn`.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.on =\r\nEmitter.prototype.addEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n (this._callbacks['$' + event] = this._callbacks['$' + event] || [])\r\n .push(fn);\r\n return this;\r\n};\r\n\r\n/**\r\n * Adds an `event` listener that will be invoked a single\r\n * time then automatically removed.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.once = function(event, fn){\r\n function on() {\r\n this.off(event, on);\r\n fn.apply(this, arguments);\r\n }\r\n\r\n on.fn = fn;\r\n this.on(event, on);\r\n return this;\r\n};\r\n\r\n/**\r\n * Remove the given callback for `event` or all\r\n * registered callbacks.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.off =\r\nEmitter.prototype.removeListener =\r\nEmitter.prototype.removeAllListeners =\r\nEmitter.prototype.removeEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n\r\n // all\r\n if (0 == arguments.length) {\r\n this._callbacks = {};\r\n return this;\r\n }\r\n\r\n // specific event\r\n var callbacks = this._callbacks['$' + event];\r\n if (!callbacks) return this;\r\n\r\n // remove all handlers\r\n if (1 == arguments.length) {\r\n delete this._callbacks['$' + event];\r\n return this;\r\n }\r\n\r\n // remove specific handler\r\n var cb;\r\n for (var i = 0; i < callbacks.length; i++) {\r\n cb = callbacks[i];\r\n if (cb === fn || cb.fn === fn) {\r\n callbacks.splice(i, 1);\r\n break;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emit `event` with the given args.\r\n *\r\n * @param {String} event\r\n * @param {Mixed} ...\r\n * @return {Emitter}\r\n */\r\n\r\nEmitter.prototype.emit = function(event){\r\n this._callbacks = this._callbacks || {};\r\n var args = [].slice.call(arguments, 1)\r\n , callbacks = this._callbacks['$' + event];\r\n\r\n if (callbacks) {\r\n callbacks = callbacks.slice(0);\r\n for (var i = 0, len = callbacks.length; i < len; ++i) {\r\n callbacks[i].apply(this, args);\r\n }\r\n }\r\n\r\n return this;\r\n};\r\n\r\n/**\r\n * Return array of callbacks for `event`.\r\n *\r\n * @param {String} event\r\n * @return {Array}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.listeners = function(event){\r\n this._callbacks = this._callbacks || {};\r\n return this._callbacks['$' + event] || [];\r\n};\r\n\r\n/**\r\n * Check if this emitter has `event` handlers.\r\n *\r\n * @param {String} event\r\n * @return {Boolean}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.hasListeners = function(event){\r\n return !! this.listeners(event).length;\r\n};\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/component-emitter/index.js\n// module id = 23\n// module chunks = 0",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory();\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\troot.CryptoJS = factory();\n\t}\n}(this, function () {\n\n\t/**\n\t * CryptoJS core components.\n\t */\n\tvar CryptoJS = CryptoJS || (function (Math, undefined) {\n\t /*\n\t * Local polyfil of Object.create\n\t */\n\t var create = Object.create || (function () {\n\t function F() {};\n\n\t return function (obj) {\n\t var subtype;\n\n\t F.prototype = obj;\n\n\t subtype = new F();\n\n\t F.prototype = null;\n\n\t return subtype;\n\t };\n\t }())\n\n\t /**\n\t * CryptoJS namespace.\n\t */\n\t var C = {};\n\n\t /**\n\t * Library namespace.\n\t */\n\t var C_lib = C.lib = {};\n\n\t /**\n\t * Base object for prototypal inheritance.\n\t */\n\t var Base = C_lib.Base = (function () {\n\n\n\t return {\n\t /**\n\t * Creates a new object that inherits from this object.\n\t *\n\t * @param {Object} overrides Properties to copy into the new object.\n\t *\n\t * @return {Object} The new object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var MyType = CryptoJS.lib.Base.extend({\n\t * field: 'value',\n\t *\n\t * method: function () {\n\t * }\n\t * });\n\t */\n\t extend: function (overrides) {\n\t // Spawn\n\t var subtype = create(this);\n\n\t // Augment\n\t if (overrides) {\n\t subtype.mixIn(overrides);\n\t }\n\n\t // Create default initializer\n\t if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {\n\t subtype.init = function () {\n\t subtype.$super.init.apply(this, arguments);\n\t };\n\t }\n\n\t // Initializer's prototype is the subtype object\n\t subtype.init.prototype = subtype;\n\n\t // Reference supertype\n\t subtype.$super = this;\n\n\t return subtype;\n\t },\n\n\t /**\n\t * Extends this object and runs the init method.\n\t * Arguments to create() will be passed to init().\n\t *\n\t * @return {Object} The new object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var instance = MyType.create();\n\t */\n\t create: function () {\n\t var instance = this.extend();\n\t instance.init.apply(instance, arguments);\n\n\t return instance;\n\t },\n\n\t /**\n\t * Initializes a newly created object.\n\t * Override this method to add some logic when your objects are created.\n\t *\n\t * @example\n\t *\n\t * var MyType = CryptoJS.lib.Base.extend({\n\t * init: function () {\n\t * // ...\n\t * }\n\t * });\n\t */\n\t init: function () {\n\t },\n\n\t /**\n\t * Copies properties into this object.\n\t *\n\t * @param {Object} properties The properties to mix in.\n\t *\n\t * @example\n\t *\n\t * MyType.mixIn({\n\t * field: 'value'\n\t * });\n\t */\n\t mixIn: function (properties) {\n\t for (var propertyName in properties) {\n\t if (properties.hasOwnProperty(propertyName)) {\n\t this[propertyName] = properties[propertyName];\n\t }\n\t }\n\n\t // IE won't copy toString using the loop above\n\t if (properties.hasOwnProperty('toString')) {\n\t this.toString = properties.toString;\n\t }\n\t },\n\n\t /**\n\t * Creates a copy of this object.\n\t *\n\t * @return {Object} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = instance.clone();\n\t */\n\t clone: function () {\n\t return this.init.prototype.extend(this);\n\t }\n\t };\n\t }());\n\n\t /**\n\t * An array of 32-bit words.\n\t *\n\t * @property {Array} words The array of 32-bit words.\n\t * @property {number} sigBytes The number of significant bytes in this word array.\n\t */\n\t var WordArray = C_lib.WordArray = Base.extend({\n\t /**\n\t * Initializes a newly created word array.\n\t *\n\t * @param {Array} words (Optional) An array of 32-bit words.\n\t * @param {number} sigBytes (Optional) The number of significant bytes in the words.\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.lib.WordArray.create();\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);\n\t */\n\t init: function (words, sigBytes) {\n\t words = this.words = words || [];\n\n\t if (sigBytes != undefined) {\n\t this.sigBytes = sigBytes;\n\t } else {\n\t this.sigBytes = words.length * 4;\n\t }\n\t },\n\n\t /**\n\t * Converts this word array to a string.\n\t *\n\t * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex\n\t *\n\t * @return {string} The stringified word array.\n\t *\n\t * @example\n\t *\n\t * var string = wordArray + '';\n\t * var string = wordArray.toString();\n\t * var string = wordArray.toString(CryptoJS.enc.Utf8);\n\t */\n\t toString: function (encoder) {\n\t return (encoder || Hex).stringify(this);\n\t },\n\n\t /**\n\t * Concatenates a word array to this word array.\n\t *\n\t * @param {WordArray} wordArray The word array to append.\n\t *\n\t * @return {WordArray} This word array.\n\t *\n\t * @example\n\t *\n\t * wordArray1.concat(wordArray2);\n\t */\n\t concat: function (wordArray) {\n\t // Shortcuts\n\t var thisWords = this.words;\n\t var thatWords = wordArray.words;\n\t var thisSigBytes = this.sigBytes;\n\t var thatSigBytes = wordArray.sigBytes;\n\n\t // Clamp excess bits\n\t this.clamp();\n\n\t // Concat\n\t if (thisSigBytes % 4) {\n\t // Copy one byte at a time\n\t for (var i = 0; i < thatSigBytes; i++) {\n\t var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);\n\t }\n\t } else {\n\t // Copy one word at a time\n\t for (var i = 0; i < thatSigBytes; i += 4) {\n\t thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];\n\t }\n\t }\n\t this.sigBytes += thatSigBytes;\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Removes insignificant bits.\n\t *\n\t * @example\n\t *\n\t * wordArray.clamp();\n\t */\n\t clamp: function () {\n\t // Shortcuts\n\t var words = this.words;\n\t var sigBytes = this.sigBytes;\n\n\t // Clamp\n\t words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);\n\t words.length = Math.ceil(sigBytes / 4);\n\t },\n\n\t /**\n\t * Creates a copy of this word array.\n\t *\n\t * @return {WordArray} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = wordArray.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\t clone.words = this.words.slice(0);\n\n\t return clone;\n\t },\n\n\t /**\n\t * Creates a word array filled with random bytes.\n\t *\n\t * @param {number} nBytes The number of random bytes to generate.\n\t *\n\t * @return {WordArray} The random word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.lib.WordArray.random(16);\n\t */\n\t random: function (nBytes) {\n\t var words = [];\n\n\t var r = (function (m_w) {\n\t var m_w = m_w;\n\t var m_z = 0x3ade68b1;\n\t var mask = 0xffffffff;\n\n\t return function () {\n\t m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;\n\t m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;\n\t var result = ((m_z << 0x10) + m_w) & mask;\n\t result /= 0x100000000;\n\t result += 0.5;\n\t return result * (Math.random() > .5 ? 1 : -1);\n\t }\n\t });\n\n\t for (var i = 0, rcache; i < nBytes; i += 4) {\n\t var _r = r((rcache || Math.random()) * 0x100000000);\n\n\t rcache = _r() * 0x3ade67b7;\n\t words.push((_r() * 0x100000000) | 0);\n\t }\n\n\t return new WordArray.init(words, nBytes);\n\t }\n\t });\n\n\t /**\n\t * Encoder namespace.\n\t */\n\t var C_enc = C.enc = {};\n\n\t /**\n\t * Hex encoding strategy.\n\t */\n\t var Hex = C_enc.Hex = {\n\t /**\n\t * Converts a word array to a hex string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The hex string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hexString = CryptoJS.enc.Hex.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var hexChars = [];\n\t for (var i = 0; i < sigBytes; i++) {\n\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t hexChars.push((bite >>> 4).toString(16));\n\t hexChars.push((bite & 0x0f).toString(16));\n\t }\n\n\t return hexChars.join('');\n\t },\n\n\t /**\n\t * Converts a hex string to a word array.\n\t *\n\t * @param {string} hexStr The hex string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Hex.parse(hexString);\n\t */\n\t parse: function (hexStr) {\n\t // Shortcut\n\t var hexStrLength = hexStr.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < hexStrLength; i += 2) {\n\t words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);\n\t }\n\n\t return new WordArray.init(words, hexStrLength / 2);\n\t }\n\t };\n\n\t /**\n\t * Latin1 encoding strategy.\n\t */\n\t var Latin1 = C_enc.Latin1 = {\n\t /**\n\t * Converts a word array to a Latin1 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The Latin1 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var latin1Chars = [];\n\t for (var i = 0; i < sigBytes; i++) {\n\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t latin1Chars.push(String.fromCharCode(bite));\n\t }\n\n\t return latin1Chars.join('');\n\t },\n\n\t /**\n\t * Converts a Latin1 string to a word array.\n\t *\n\t * @param {string} latin1Str The Latin1 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);\n\t */\n\t parse: function (latin1Str) {\n\t // Shortcut\n\t var latin1StrLength = latin1Str.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < latin1StrLength; i++) {\n\t words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);\n\t }\n\n\t return new WordArray.init(words, latin1StrLength);\n\t }\n\t };\n\n\t /**\n\t * UTF-8 encoding strategy.\n\t */\n\t var Utf8 = C_enc.Utf8 = {\n\t /**\n\t * Converts a word array to a UTF-8 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The UTF-8 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t try {\n\t return decodeURIComponent(escape(Latin1.stringify(wordArray)));\n\t } catch (e) {\n\t throw new Error('Malformed UTF-8 data');\n\t }\n\t },\n\n\t /**\n\t * Converts a UTF-8 string to a word array.\n\t *\n\t * @param {string} utf8Str The UTF-8 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);\n\t */\n\t parse: function (utf8Str) {\n\t return Latin1.parse(unescape(encodeURIComponent(utf8Str)));\n\t }\n\t };\n\n\t /**\n\t * Abstract buffered block algorithm template.\n\t *\n\t * The property blockSize must be implemented in a concrete subtype.\n\t *\n\t * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0\n\t */\n\t var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({\n\t /**\n\t * Resets this block algorithm's data buffer to its initial state.\n\t *\n\t * @example\n\t *\n\t * bufferedBlockAlgorithm.reset();\n\t */\n\t reset: function () {\n\t // Initial values\n\t this._data = new WordArray.init();\n\t this._nDataBytes = 0;\n\t },\n\n\t /**\n\t * Adds new data to this block algorithm's buffer.\n\t *\n\t * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.\n\t *\n\t * @example\n\t *\n\t * bufferedBlockAlgorithm._append('data');\n\t * bufferedBlockAlgorithm._append(wordArray);\n\t */\n\t _append: function (data) {\n\t // Convert string to WordArray, else assume WordArray already\n\t if (typeof data == 'string') {\n\t data = Utf8.parse(data);\n\t }\n\n\t // Append\n\t this._data.concat(data);\n\t this._nDataBytes += data.sigBytes;\n\t },\n\n\t /**\n\t * Processes available data blocks.\n\t *\n\t * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.\n\t *\n\t * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.\n\t *\n\t * @return {WordArray} The processed data.\n\t *\n\t * @example\n\t *\n\t * var processedData = bufferedBlockAlgorithm._process();\n\t * var processedData = bufferedBlockAlgorithm._process(!!'flush');\n\t */\n\t _process: function (doFlush) {\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\t var dataSigBytes = data.sigBytes;\n\t var blockSize = this.blockSize;\n\t var blockSizeBytes = blockSize * 4;\n\n\t // Count blocks ready\n\t var nBlocksReady = dataSigBytes / blockSizeBytes;\n\t if (doFlush) {\n\t // Round up to include partial blocks\n\t nBlocksReady = Math.ceil(nBlocksReady);\n\t } else {\n\t // Round down to include only full blocks,\n\t // less the number of blocks that must remain in the buffer\n\t nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);\n\t }\n\n\t // Count words ready\n\t var nWordsReady = nBlocksReady * blockSize;\n\n\t // Count bytes ready\n\t var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);\n\n\t // Process blocks\n\t if (nWordsReady) {\n\t for (var offset = 0; offset < nWordsReady; offset += blockSize) {\n\t // Perform concrete-algorithm logic\n\t this._doProcessBlock(dataWords, offset);\n\t }\n\n\t // Remove processed words\n\t var processedWords = dataWords.splice(0, nWordsReady);\n\t data.sigBytes -= nBytesReady;\n\t }\n\n\t // Return processed words\n\t return new WordArray.init(processedWords, nBytesReady);\n\t },\n\n\t /**\n\t * Creates a copy of this object.\n\t *\n\t * @return {Object} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = bufferedBlockAlgorithm.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\t clone._data = this._data.clone();\n\n\t return clone;\n\t },\n\n\t _minBufferSize: 0\n\t });\n\n\t /**\n\t * Abstract hasher template.\n\t *\n\t * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)\n\t */\n\t var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({\n\t /**\n\t * Configuration options.\n\t */\n\t cfg: Base.extend(),\n\n\t /**\n\t * Initializes a newly created hasher.\n\t *\n\t * @param {Object} cfg (Optional) The configuration options to use for this hash computation.\n\t *\n\t * @example\n\t *\n\t * var hasher = CryptoJS.algo.SHA256.create();\n\t */\n\t init: function (cfg) {\n\t // Apply config defaults\n\t this.cfg = this.cfg.extend(cfg);\n\n\t // Set initial values\n\t this.reset();\n\t },\n\n\t /**\n\t * Resets this hasher to its initial state.\n\t *\n\t * @example\n\t *\n\t * hasher.reset();\n\t */\n\t reset: function () {\n\t // Reset data buffer\n\t BufferedBlockAlgorithm.reset.call(this);\n\n\t // Perform concrete-hasher logic\n\t this._doReset();\n\t },\n\n\t /**\n\t * Updates this hasher with a message.\n\t *\n\t * @param {WordArray|string} messageUpdate The message to append.\n\t *\n\t * @return {Hasher} This hasher.\n\t *\n\t * @example\n\t *\n\t * hasher.update('message');\n\t * hasher.update(wordArray);\n\t */\n\t update: function (messageUpdate) {\n\t // Append\n\t this._append(messageUpdate);\n\n\t // Update the hash\n\t this._process();\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Finalizes the hash computation.\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\n\t *\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @example\n\t *\n\t * var hash = hasher.finalize();\n\t * var hash = hasher.finalize('message');\n\t * var hash = hasher.finalize(wordArray);\n\t */\n\t finalize: function (messageUpdate) {\n\t // Final message update\n\t if (messageUpdate) {\n\t this._append(messageUpdate);\n\t }\n\n\t // Perform concrete-hasher logic\n\t var hash = this._doFinalize();\n\n\t return hash;\n\t },\n\n\t blockSize: 512/32,\n\n\t /**\n\t * Creates a shortcut function to a hasher's object interface.\n\t *\n\t * @param {Hasher} hasher The hasher to create a helper for.\n\t *\n\t * @return {Function} The shortcut function.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);\n\t */\n\t _createHelper: function (hasher) {\n\t return function (message, cfg) {\n\t return new hasher.init(cfg).finalize(message);\n\t };\n\t },\n\n\t /**\n\t * Creates a shortcut function to the HMAC's object interface.\n\t *\n\t * @param {Hasher} hasher The hasher to use in this HMAC helper.\n\t *\n\t * @return {Function} The shortcut function.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);\n\t */\n\t _createHmacHelper: function (hasher) {\n\t return function (message, key) {\n\t return new C_algo.HMAC.init(hasher, key).finalize(message);\n\t };\n\t }\n\t });\n\n\t /**\n\t * Algorithm namespace.\n\t */\n\t var C_algo = C.algo = {};\n\n\t return C;\n\t}(Math));\n\n\n\treturn CryptoJS;\n\n}));\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/crypto-js/core.js\n// module id = 24\n// module chunks = 0",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function (Math) {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var WordArray = C_lib.WordArray;\n\t var Hasher = C_lib.Hasher;\n\t var C_algo = C.algo;\n\n\t // Initialization and round constants tables\n\t var H = [];\n\t var K = [];\n\n\t // Compute constants\n\t (function () {\n\t function isPrime(n) {\n\t var sqrtN = Math.sqrt(n);\n\t for (var factor = 2; factor <= sqrtN; factor++) {\n\t if (!(n % factor)) {\n\t return false;\n\t }\n\t }\n\n\t return true;\n\t }\n\n\t function getFractionalBits(n) {\n\t return ((n - (n | 0)) * 0x100000000) | 0;\n\t }\n\n\t var n = 2;\n\t var nPrime = 0;\n\t while (nPrime < 64) {\n\t if (isPrime(n)) {\n\t if (nPrime < 8) {\n\t H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));\n\t }\n\t K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));\n\n\t nPrime++;\n\t }\n\n\t n++;\n\t }\n\t }());\n\n\t // Reusable object\n\t var W = [];\n\n\t /**\n\t * SHA-256 hash algorithm.\n\t */\n\t var SHA256 = C_algo.SHA256 = Hasher.extend({\n\t _doReset: function () {\n\t this._hash = new WordArray.init(H.slice(0));\n\t },\n\n\t _doProcessBlock: function (M, offset) {\n\t // Shortcut\n\t var H = this._hash.words;\n\n\t // Working variables\n\t var a = H[0];\n\t var b = H[1];\n\t var c = H[2];\n\t var d = H[3];\n\t var e = H[4];\n\t var f = H[5];\n\t var g = H[6];\n\t var h = H[7];\n\n\t // Computation\n\t for (var i = 0; i < 64; i++) {\n\t if (i < 16) {\n\t W[i] = M[offset + i] | 0;\n\t } else {\n\t var gamma0x = W[i - 15];\n\t var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^\n\t ((gamma0x << 14) | (gamma0x >>> 18)) ^\n\t (gamma0x >>> 3);\n\n\t var gamma1x = W[i - 2];\n\t var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^\n\t ((gamma1x << 13) | (gamma1x >>> 19)) ^\n\t (gamma1x >>> 10);\n\n\t W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];\n\t }\n\n\t var ch = (e & f) ^ (~e & g);\n\t var maj = (a & b) ^ (a & c) ^ (b & c);\n\n\t var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));\n\t var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25));\n\n\t var t1 = h + sigma1 + ch + K[i] + W[i];\n\t var t2 = sigma0 + maj;\n\n\t h = g;\n\t g = f;\n\t f = e;\n\t e = (d + t1) | 0;\n\t d = c;\n\t c = b;\n\t b = a;\n\t a = (t1 + t2) | 0;\n\t }\n\n\t // Intermediate hash value\n\t H[0] = (H[0] + a) | 0;\n\t H[1] = (H[1] + b) | 0;\n\t H[2] = (H[2] + c) | 0;\n\t H[3] = (H[3] + d) | 0;\n\t H[4] = (H[4] + e) | 0;\n\t H[5] = (H[5] + f) | 0;\n\t H[6] = (H[6] + g) | 0;\n\t H[7] = (H[7] + h) | 0;\n\t },\n\n\t _doFinalize: function () {\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\n\t var nBitsTotal = this._nDataBytes * 8;\n\t var nBitsLeft = data.sigBytes * 8;\n\n\t // Add padding\n\t dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);\n\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);\n\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;\n\t data.sigBytes = dataWords.length * 4;\n\n\t // Hash final blocks\n\t this._process();\n\n\t // Return final computed hash\n\t return this._hash;\n\t },\n\n\t clone: function () {\n\t var clone = Hasher.clone.call(this);\n\t clone._hash = this._hash.clone();\n\n\t return clone;\n\t }\n\t });\n\n\t /**\n\t * Shortcut function to the hasher's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hash = CryptoJS.SHA256('message');\n\t * var hash = CryptoJS.SHA256(wordArray);\n\t */\n\t C.SHA256 = Hasher._createHelper(SHA256);\n\n\t /**\n\t * Shortcut function to the HMAC's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t * @param {WordArray|string} key The secret key.\n\t *\n\t * @return {WordArray} The HMAC.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hmac = CryptoJS.HmacSHA256(message, key);\n\t */\n\t C.HmacSHA256 = Hasher._createHmacHelper(SHA256);\n\t}(Math));\n\n\n\treturn CryptoJS.SHA256;\n\n}));\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/crypto-js/sha256.js\n// module id = 25\n// module chunks = 0","function DummyCache() {}\n\nDummyCache.prototype.get = function () {\n return null;\n};\n\nDummyCache.prototype.has = function () {\n return false;\n};\n\nDummyCache.prototype.set = function () {\n};\n\nmodule.exports = DummyCache;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/idtoken-verifier/src/helpers/dummy-cache.js\n// module id = 26\n// module chunks = 0","function ConfigurationError(message) {\n this.name = 'ConfigurationError';\n this.message = (message || '');\n}\nConfigurationError.prototype = Error.prototype;\n\nfunction TokenValidationError(message) {\n this.name = 'TokenValidationError';\n this.message = (message || '');\n}\nTokenValidationError.prototype = Error.prototype;\n\nmodule.exports = {\n ConfigurationError: ConfigurationError,\n TokenValidationError: TokenValidationError\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/idtoken-verifier/src/helpers/error.js\n// module id = 27\n// module chunks = 0","var urljoin = require('url-join');\nvar base64 = require('./base64');\nvar request = require('superagent');\n\nfunction process(jwks) {\n var modulus = base64.decodeToHEX(jwks.n);\n var exp = base64.decodeToHEX(jwks.e);\n\n return {\n modulus: modulus,\n exp: exp\n };\n}\n\nfunction getJWKS(options, cb) {\n var url = urljoin(options.iss, '.well-known', 'jwks.json');\n\n return request\n .get(url)\n .end(function (err, data) {\n var matchingKey = null;\n var a;\n var key;\n\n if (err) {\n cb(err);\n }\n\n // eslint-disable-next-line no-plusplus\n for (a = 0; a < data.body.keys.length && matchingKey === null; a++) {\n key = data.body.keys[a];\n if (key.kid === options.kid) {\n matchingKey = key;\n }\n }\n\n cb(null, process(matchingKey));\n });\n}\n\nmodule.exports = {\n process: process,\n getJWKS: getJWKS\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/idtoken-verifier/src/helpers/jwks.js\n// module id = 28\n// module chunks = 0","/*\nBased on the work of Tom Wu\nhttp://www-cs-students.stanford.edu/~tjw/jsbn/\nhttp://www-cs-students.stanford.edu/~tjw/jsbn/LICENSE\n*/\n\nvar BigInteger = require('jsbn').BigInteger;\nvar SHA256 = require('crypto-js/sha256');\n\nvar DigestInfoHead = {\n sha1: '3021300906052b0e03021a05000414',\n sha224: '302d300d06096086480165030402040500041c',\n sha256: '3031300d060960864801650304020105000420',\n sha384: '3041300d060960864801650304020205000430',\n sha512: '3051300d060960864801650304020305000440',\n md2: '3020300c06082a864886f70d020205000410',\n md5: '3020300c06082a864886f70d020505000410',\n ripemd160: '3021300906052b2403020105000414'\n};\n\nvar DigestAlgs = {\n sha256: SHA256\n};\n\nfunction RSAVerifier(modulus, exp) {\n this.n = null;\n this.e = 0;\n\n if (modulus != null && exp != null && modulus.length > 0 && exp.length > 0) {\n this.n = new BigInteger(modulus, 16);\n this.e = parseInt(exp, 16);\n } else {\n throw new Error('Invalid key data');\n }\n}\n\nfunction getAlgorithmFromDigest(hDigestInfo) {\n for (var algName in DigestInfoHead) {\n var head = DigestInfoHead[algName];\n var len = head.length;\n\n if (hDigestInfo.substring(0, len) === head) {\n return {\n alg: algName,\n hash: hDigestInfo.substring(len)\n };\n }\n }\n return [];\n}\n\n\nRSAVerifier.prototype.verify = function (msg, encsig) {\n encsig = encsig.replace(/[^0-9a-f]|[\\s\\n]]/ig, '');\n\n var sig = new BigInteger(encsig, 16);\n if (sig.bitLength() > this.n.bitLength()) {\n throw new Error('Signature does not match with the key modulus.');\n }\n\n var decryptedSig = sig.modPowInt(this.e, this.n);\n var digest = decryptedSig.toString(16).replace(/^1f+00/, '');\n\n var digestInfo = getAlgorithmFromDigest(digest);\n if (digestInfo.length === 0) {\n return false;\n }\n\n if (!DigestAlgs.hasOwnProperty(digestInfo.alg)) {\n throw new Error('Hashing algorithm is not supported.');\n }\n\n var msgHash = DigestAlgs[digestInfo.alg](msg).toString();\n return (digestInfo.hash === msgHash);\n};\n\nmodule.exports = RSAVerifier;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/idtoken-verifier/src/helpers/rsa-verifier.js\n// module id = 29\n// module chunks = 0","var RSAVerifier = require('./helpers/rsa-verifier');\nvar base64 = require('./helpers/base64');\nvar jwks = require('./helpers/jwks');\nvar error = require('./helpers/error');\nvar DummyCache = require('./helpers/dummy-cache');\nvar supportedAlgs = ['RS256'];\n\n/**\n * Creates a new id_token verifier\n * @constructor\n * @param {Object} parameters\n * @param {String} parameters.issuer name of the issuer of the token\n * that should match the `iss` claim in the id_token\n * @param {String} parameters.audience identifies the recipients that the JWT is intended for\n * and should match the `aud` claim\n * @param {Object} [parameters.jwksCache] cache for JSON Web Token Keys. By default it has no cache\n * @param {String} [parameters.expectedAlg='RS256'] algorithm in which the id_token was signed\n * and will be used to validate\n * @param {number} [parameters.leeway=0] number of seconds that the clock can be out of sync\n * while validating expiration of the id_token\n */\nfunction IdTokenVerifier(parameters) {\n var options = parameters || {};\n\n this.jwksCache = options.jwksCache || new DummyCache();\n this.expectedAlg = options.expectedAlg || 'RS256';\n this.issuer = options.issuer;\n this.audience = options.audience;\n this.leeway = options.leeway || 0;\n this.__disableExpirationCheck = options.__disableExpirationCheck || false;\n\n if (this.leeway < 0 || this.leeway > 60) {\n throw new error.ConfigurationError('The leeway should be positive and lower than a minute.');\n }\n\n if (supportedAlgs.indexOf(this.expectedAlg) === -1) {\n throw new error.ConfigurationError('Algorithm ' + this.expectedAlg +\n ' is not supported. (Expected algs: [' + supportedAlgs.join(',') + '])');\n }\n}\n\n/**\n * @callback verifyCallback\n * @param {Error} [err] error returned if the verify cannot be performed\n * @param {boolean} [status] if the token is valid or not\n */\n\n/**\n * Verifies an id_token\n *\n * It will validate:\n * - signature according to the algorithm configured in the verifier.\n * - if nonce is present and matches the one provided\n * - if `iss` and `aud` claims matches the configured issuer and audience\n * - if token is not expired and valid (if the `nbf` claim is in the past)\n *\n * @method verify\n * @param {String} token id_token to verify\n * @param {String} [nonce] nonce value that should match the one in the id_token claims\n * @param {verifyCallback} cb callback used to notify the results of the validation\n */\nIdTokenVerifier.prototype.verify = function (token, nonce, cb) {\n var jwt = this.decode(token);\n\n if (jwt instanceof Error) {\n return cb(jwt, false);\n }\n\n /* eslint-disable vars-on-top */\n var headAndPayload = jwt.encoded.header + '.' + jwt.encoded.payload;\n var signature = base64.decodeToHEX(jwt.encoded.signature);\n\n var alg = jwt.header.alg;\n var kid = jwt.header.kid;\n\n var aud = jwt.payload.aud;\n var iss = jwt.payload.iss;\n var exp = jwt.payload.exp;\n var nbf = jwt.payload.nbf;\n var tnonce = jwt.payload.nonce || null;\n /* eslint-enable vars-on-top */\n\n if (this.issuer !== iss) {\n return cb(new error.TokenValidationError('Issuer ' + iss + ' is not valid.'), false);\n }\n\n if (this.audience !== aud) {\n return cb(new error.TokenValidationError('Audience ' + aud + ' is not valid.'), false);\n }\n\n if (this.expectedAlg !== alg) {\n return cb(new error.TokenValidationError('Algorithm ' + alg +\n ' is not supported. (Expected algs: [' + supportedAlgs.join(',') + '])'), false);\n }\n\n if (tnonce !== nonce) {\n return cb(new error.TokenValidationError('Nonce does not match.'), false);\n }\n\n var expirationError = this.verifyExpAndNbf(exp, nbf); // eslint-disable-line vars-on-top\n\n if (expirationError) {\n return cb(expirationError, false);\n }\n\n return this.getRsaVerifier(iss, kid, function (err, rsaVerifier) {\n if (err) {\n return cb(err);\n }\n if (rsaVerifier.verify(headAndPayload, signature)) {\n return cb(null, jwt.payload);\n }\n return cb(new error.TokenValidationError('Invalid signature.'));\n });\n};\n\n/**\n * Verifies that the `exp` and `nbf` claims are valid in the current moment.\n *\n * @method verifyExpAndNbf\n * @param {String} exp value of `exp` claim\n * @param {String} nbf value of `nbf` claim\n * @return {boolean} if token is valid according to `exp` and `nbf`\n */\nIdTokenVerifier.prototype.verifyExpAndNbf = function (exp, nbf) {\n var now = new Date();\n var expDate = new Date(0);\n var nbfDate = new Date(0);\n\n if (this.__disableExpirationCheck) {\n return null;\n }\n\n expDate.setUTCSeconds(exp + this.leeway);\n\n if (now > expDate) {\n return new error.TokenValidationError('Expired token.');\n }\n\n if (typeof nbf === 'undefined') {\n return null;\n }\n nbfDate.setUTCSeconds(nbf - this.leeway);\n if (now < nbfDate) {\n return new error.TokenValidationError('The token is not valid until later in the future. ' +\n 'Please check your computed clock.');\n }\n\n return null;\n};\n\n/**\n * Verifies that the `exp` and `iat` claims are valid in the current moment.\n *\n * @method verifyExpAndIat\n * @param {String} exp value of `exp` claim\n * @param {String} iat value of `iat` claim\n * @return {boolean} if token is valid according to `exp` and `iat`\n */\nIdTokenVerifier.prototype.verifyExpAndIat = function (exp, iat) {\n var now = new Date();\n var expDate = new Date(0);\n var iatDate = new Date(0);\n\n if (this.__disableExpirationCheck) {\n return null;\n }\n\n expDate.setUTCSeconds(exp + this.leeway);\n\n if (now > expDate) {\n return new error.TokenValidationError('Expired token.');\n }\n\n iatDate.setUTCSeconds(iat - this.leeway);\n\n if (now < iatDate) {\n return new error.TokenValidationError('The token was issued in the future. ' +\n 'Please check your computed clock.');\n }\n return null;\n};\n\nIdTokenVerifier.prototype.getRsaVerifier = function (iss, kid, cb) {\n var _this = this;\n var cachekey = iss + kid;\n\n if (!this.jwksCache.has(cachekey)) {\n jwks.getJWKS({\n iss: iss,\n kid: kid\n }, function (err, keyInfo) {\n if (err) {\n cb(err);\n }\n _this.jwksCache.set(cachekey, keyInfo);\n cb(null, new RSAVerifier(keyInfo.modulus, keyInfo.exp));\n });\n } else {\n var keyInfo = this.jwksCache.get(cachekey); // eslint-disable-line vars-on-top\n cb(null, new RSAVerifier(keyInfo.modulus, keyInfo.exp));\n }\n};\n\n\n/**\n * @typedef DecodedToken\n * @type {Object}\n * @property {Object} header - content of the JWT header.\n * @property {Object} payload - token claims.\n * @property {Object} encoded - encoded parts of the token.\n */\n\n/**\n * Decodes a well formed JWT without any verification\n *\n * @method decode\n * @param {String} token decodes the token\n * @return {DecodedToken} if token is valid according to `exp` and `nbf`\n */\nIdTokenVerifier.prototype.decode = function (token) {\n var parts = token.split('.');\n var header;\n var payload;\n\n if (parts.length !== 3) {\n return new error.TokenValidationError('Cannot decode a malformed JWT');\n }\n\n try {\n header = JSON.parse(base64.decodeToString(parts[0]));\n payload = JSON.parse(base64.decodeToString(parts[1]));\n } catch (e) {\n return new error.TokenValidationError('Token header or payload is not valid JSON');\n }\n\n return {\n header: header,\n payload: payload,\n encoded: {\n header: parts[0],\n payload: parts[1],\n signature: parts[2]\n }\n };\n};\n\nmodule.exports = IdTokenVerifier;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/idtoken-verifier/src/index.js\n// module id = 30\n// module chunks = 0","(function(){\n\n // Copyright (c) 2005 Tom Wu\n // All Rights Reserved.\n // See \"LICENSE\" for details.\n\n // Basic JavaScript BN library - subset useful for RSA encryption.\n\n // Bits per digit\n var dbits;\n\n // JavaScript engine analysis\n var canary = 0xdeadbeefcafe;\n var j_lm = ((canary&0xffffff)==0xefcafe);\n\n // (public) Constructor\n function BigInteger(a,b,c) {\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 // return new, unset BigInteger\n function nbi() { return new BigInteger(null); }\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)\n function 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)\n function am2(i,x,w,j,c,n) {\n var xl = x&0x7fff, 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.\n function am3(i,x,w,j,c,n) {\n var xl = x&0x3fff, 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 var inBrowser = typeof navigator !== \"undefined\";\n if(inBrowser && j_lm && (navigator.appName == \"Microsoft Internet Explorer\")) {\n BigInteger.prototype.am = am2;\n dbits = 30;\n }\n else if(inBrowser && j_lm && (navigator.appName != \"Netscape\")) {\n BigInteger.prototype.am = am1;\n dbits = 26;\n }\n else { // Mozilla/Netscape seems to prefer am3\n BigInteger.prototype.am = am3;\n dbits = 28;\n }\n\n BigInteger.prototype.DB = dbits;\n BigInteger.prototype.DM = ((1<= 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\n function 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+this.DV;\n else this.t = 0;\n }\n\n // return bigint initialized to value\n function nbv(i) { var r = nbi(); r.fromInt(i); return r; }\n\n // (protected) set from string and radix\n function bnpFromString(s,b) {\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 { this.fromRadix(s,b); return; }\n this.t = 0;\n this.s = 0;\n var i = s.length, mi = false, 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 this[this.t++] = x;\n else if(sh+k > this.DB) {\n this[this.t-1] |= (x&((1<<(this.DB-sh))-1))<>(this.DB-sh));\n }\n else\n this[this.t-1] |= x<= this.DB) sh -= this.DB;\n }\n if(k == 8 && (s[0]&0x80) != 0) {\n this.s = -1;\n if(sh > 0) this[this.t-1] |= ((1<<(this.DB-sh))-1)< 0 && this[this.t-1] == c) --this.t;\n }\n\n // (public) return string representation in given radix\n function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().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 this.toRadix(b);\n var km = (1< 0) {\n if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this[i]&((1<>(p+=this.DB-k);\n }\n else {\n d = (this[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\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\n function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; }\n\n // (public) |this|\n function bnAbs() { return (this.s<0)?this.negate():this; }\n\n // (public) return + if this > a, - if this < a, 0 if equal\n function 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) if((r=this[i]-a[i]) != 0) return r;\n return 0;\n }\n\n // returns bit length of the integer x\n function nbits(x) {\n var r = 1, t;\n if((t=x>>>16) != 0) { x = t; r += 16; }\n if((t=x>>8) != 0) { x = t; r += 8; }\n if((t=x>>4) != 0) { x = t; r += 4; }\n if((t=x>>2) != 0) { x = t; r += 2; }\n if((t=x>>1) != 0) { x = t; r += 1; }\n return r;\n }\n\n // (public) return the number of bits in \"this\"\n function 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 // (protected) r = this << n*DB\n function 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\n function 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\n function bnpLShiftTo(n,r) {\n var bs = n%this.DB;\n var cbs = this.DB-bs;\n var bm = (1<= 0; --i) {\n r[i+ds+1] = (this[i]>>cbs)|c;\n c = (this[i]&bm)<= 0; --i) r[i] = 0;\n r[ds] = c;\n r.t = this.t+ds+1;\n r.s = this.s;\n r.clamp();\n }\n\n // (protected) r = this >> n\n function bnpRShiftTo(n,r) {\n r.s = this.s;\n var ds = Math.floor(n/this.DB);\n if(ds >= this.t) { r.t = 0; return; }\n var bs = n%this.DB;\n var cbs = this.DB-bs;\n var bm = (1<>bs;\n for(var i = ds+1; i < this.t; ++i) {\n r[i-ds-1] |= (this[i]&bm)<>bs;\n }\n if(bs > 0) r[this.t-ds-1] |= (this.s&bm)<>= this.DB;\n }\n if(a.t < this.t) {\n c -= a.s;\n while(i < this.t) {\n c += this[i];\n r[i++] = c&this.DM;\n c >>= this.DB;\n }\n c += this.s;\n }\n else {\n c += this.s;\n while(i < a.t) {\n c -= a[i];\n r[i++] = c&this.DM;\n c >>= this.DB;\n }\n c -= a.s;\n }\n r.s = (c<0)?-1:0;\n if(c < -1) r[i++] = this.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.\n function bnpMultiplyTo(a,r) {\n var x = this.abs(), 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)\n function 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.\n function bnpDivRemTo(m,q,r) {\n var pm = m.abs();\n if(pm.t <= 0) return;\n var pt = this.abs();\n if(pt.t < pm.t) {\n if(q != null) q.fromInt(0);\n if(r != null) this.copyTo(r);\n return;\n }\n if(r == null) r = nbi();\n var y = nbi(), ts = this.s, ms = m.s;\n var nsh = this.DB-nbits(pm[pm.t-1]); // normalize modulus\n if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); }\n else { pm.copyTo(y); pt.copyTo(r); }\n var ys = y.t;\n var y0 = y[ys-1];\n if(y0 == 0) return;\n var yt = y0*(1<1)?y[ys-2]>>this.F2:0);\n var d1 = this.FV/yt, d2 = (1<= 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)?this.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\n function bnMod(a) {\n var r = nbi();\n this.abs().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\n function Classic(m) { this.m = m; }\n function cConvert(x) {\n if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m);\n else return x;\n }\n function cRevert(x) { return x; }\n function cReduce(x) { x.divRemTo(this.m,null,x); }\n function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }\n function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); }\n\n Classic.prototype.convert = cConvert;\n Classic.prototype.revert = cRevert;\n Classic.prototype.reduce = cReduce;\n Classic.prototype.mulTo = cMulTo;\n Classic.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.\n function 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\n function 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\n function montConvert(x) {\n var r = nbi();\n x.abs().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\n function montRevert(x) {\n var r = nbi();\n x.copyTo(r);\n this.reduce(r);\n return r;\n }\n\n // x = x/R mod m (HAC 14.32)\n function 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) { x[j] -= x.DV; x[++j]++; }\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\n function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); }\n\n // r = \"xy/R mod m\"; x,y != r\n function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }\n\n Montgomery.prototype.convert = montConvert;\n Montgomery.prototype.revert = montRevert;\n Montgomery.prototype.reduce = montReduce;\n Montgomery.prototype.mulTo = montMulTo;\n Montgomery.prototype.sqrTo = montSqrTo;\n\n // (protected) true iff this is even\n function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; }\n\n // (protected) this^e, e < 2^32, doing sqr and mul with \"r\" (HAC 14.79)\n function bnpExp(e,z) {\n if(e > 0xffffffff || e < 1) return BigInteger.ONE;\n var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1;\n g.copyTo(r);\n while(--i >= 0) {\n z.sqrTo(r,r2);\n if((e&(1< 0) z.mulTo(r2,g,r);\n else { var t = r; r = r2; r2 = t; }\n }\n return z.revert(r);\n }\n\n // (public) this^e % m, 0 <= e < 2^32\n function bnModPowInt(e,m) {\n var z;\n if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m);\n return this.exp(e,z);\n }\n\n // protected\n BigInteger.prototype.copyTo = bnpCopyTo;\n BigInteger.prototype.fromInt = bnpFromInt;\n BigInteger.prototype.fromString = bnpFromString;\n BigInteger.prototype.clamp = bnpClamp;\n BigInteger.prototype.dlShiftTo = bnpDLShiftTo;\n BigInteger.prototype.drShiftTo = bnpDRShiftTo;\n BigInteger.prototype.lShiftTo = bnpLShiftTo;\n BigInteger.prototype.rShiftTo = bnpRShiftTo;\n BigInteger.prototype.subTo = bnpSubTo;\n BigInteger.prototype.multiplyTo = bnpMultiplyTo;\n BigInteger.prototype.squareTo = bnpSquareTo;\n BigInteger.prototype.divRemTo = bnpDivRemTo;\n BigInteger.prototype.invDigit = bnpInvDigit;\n BigInteger.prototype.isEven = bnpIsEven;\n BigInteger.prototype.exp = bnpExp;\n\n // public\n BigInteger.prototype.toString = bnToString;\n BigInteger.prototype.negate = bnNegate;\n BigInteger.prototype.abs = bnAbs;\n BigInteger.prototype.compareTo = bnCompareTo;\n BigInteger.prototype.bitLength = bnBitLength;\n BigInteger.prototype.mod = bnMod;\n BigInteger.prototype.modPowInt = bnModPowInt;\n\n // \"constants\"\n BigInteger.ZERO = nbv(0);\n BigInteger.ONE = nbv(1);\n\n // Copyright (c) 2005-2009 Tom Wu\n // All Rights Reserved.\n // See \"LICENSE\" for details.\n\n // Extended JavaScript BN functions, required for RSA private ops.\n\n // Version 1.1: new BigInteger(\"0\", 10) returns \"proper\" zero\n // Version 1.2: square() API, isProbablePrime fix\n\n // (public)\n function bnClone() { var r = nbi(); this.copyTo(r); return r; }\n\n // (public) return value as integer\n function 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 }\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))<>24; }\n\n // (public) return value as short (assumes DB>=16)\n function bnShortValue() { return (this.t==0)?this.s:(this[0]<<16)>>16; }\n\n // (protected) return x s.t. r^x < DV\n function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); }\n\n // (public) 0 if this == 0, 1 if this > 0\n function 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\n function 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), y = nbi(), z = nbi(), r = \"\";\n this.divRemTo(d,y,z);\n while(y.signum() > 0) {\n r = (a+z.intValue()).toString(b).substr(1) + r;\n y.divRemTo(d,y,z);\n }\n return z.intValue().toString(b) + r;\n }\n\n // (protected) convert from radix string\n function bnpFromRadix(s,b) {\n this.fromInt(0);\n if(b == null) b = 10;\n var cs = this.chunkSize(b);\n var d = Math.pow(b,cs), mi = false, j = 0, 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) == \"-\" && this.signum() == 0) mi = true;\n continue;\n }\n w = b*w+x;\n if(++j >= cs) {\n this.dMultiply(d);\n this.dAddOffset(w,0);\n j = 0;\n w = 0;\n }\n }\n if(j > 0) {\n this.dMultiply(Math.pow(b,j));\n this.dAddOffset(w,0);\n }\n if(mi) BigInteger.ZERO.subTo(this,this);\n }\n\n // (protected) alternate constructor\n function bnpFromNumber(a,b,c) {\n if(\"number\" == typeof b) {\n // new BigInteger(int,int,RNG)\n if(a < 2) this.fromInt(1);\n else {\n this.fromNumber(a,c);\n if(!this.testBit(a-1))\t// force MSB set\n this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this);\n if(this.isEven()) this.dAddOffset(1,0); // force odd\n while(!this.isProbablePrime(b)) {\n this.dAddOffset(2,0);\n if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this);\n }\n }\n }\n else {\n // new BigInteger(int,RNG)\n var x = new Array(), t = a&7;\n x.length = (a>>3)+1;\n b.nextBytes(x);\n if(t > 0) x[0] &= ((1< 0) {\n if(p < this.DB && (d = this[i]>>p) != (this.s&this.DM)>>p)\n r[k++] = d|(this.s<<(this.DB-p));\n while(i >= 0) {\n if(p < 8) {\n d = (this[i]&((1<>(p+=this.DB-8);\n }\n else {\n d = (this[i]>>(p-=8))&0xff;\n if(p <= 0) { p += this.DB; --i; }\n }\n if((d&0x80) != 0) d |= -256;\n if(k == 0 && (this.s&0x80) != (d&0x80)) ++k;\n if(k > 0 || d != this.s) r[k++] = d;\n }\n }\n return r;\n }\n\n function bnEquals(a) { return(this.compareTo(a)==0); }\n function bnMin(a) { return(this.compareTo(a)<0)?this:a; }\n function bnMax(a) { return(this.compareTo(a)>0)?this:a; }\n\n // (protected) r = this op a (bitwise)\n function bnpBitwiseTo(a,op,r) {\n var i, f, m = Math.min(a.t,this.t);\n for(i = 0; i < m; ++i) r[i] = op(this[i],a[i]);\n if(a.t < this.t) {\n f = a.s&this.DM;\n for(i = m; i < this.t; ++i) r[i] = op(this[i],f);\n r.t = this.t;\n }\n else {\n f = this.s&this.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(this.s,a.s);\n r.clamp();\n }\n\n // (public) this & a\n function op_and(x,y) { return x&y; }\n function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; }\n\n // (public) this | a\n function op_or(x,y) { return x|y; }\n function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; }\n\n // (public) this ^ a\n function op_xor(x,y) { return x^y; }\n function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; }\n\n // (public) this & ~a\n function op_andnot(x,y) { return x&~y; }\n function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; }\n\n // (public) ~this\n function bnNot() {\n var r = nbi();\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\n function bnShiftLeft(n) {\n var r = nbi();\n if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r);\n return r;\n }\n\n // (public) this >> n\n function bnShiftRight(n) {\n var r = nbi();\n if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r);\n return r;\n }\n\n // return index of lowest 1-bit in x, x < 2^31\n function lbit(x) {\n if(x == 0) return -1;\n var r = 0;\n if((x&0xffff) == 0) { x >>= 16; r += 16; }\n if((x&0xff) == 0) { x >>= 8; r += 8; }\n if((x&0xf) == 0) { x >>= 4; r += 4; }\n if((x&3) == 0) { x >>= 2; r += 2; }\n if((x&1) == 0) ++r;\n return r;\n }\n\n // (public) returns index of lowest 1-bit (or -1 if none)\n function 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\n function cbit(x) {\n var r = 0;\n while(x != 0) { x &= x-1; ++r; }\n return r;\n }\n\n // (public) return number of set bits\n function bnBitCount() {\n var r = 0, 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\n function 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<>= this.DB;\n }\n if(a.t < this.t) {\n c += a.s;\n while(i < this.t) {\n c += this[i];\n r[i++] = c&this.DM;\n c >>= this.DB;\n }\n c += this.s;\n }\n else {\n c += this.s;\n while(i < a.t) {\n c += a[i];\n r[i++] = c&this.DM;\n c >>= this.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++] = this.DV+c;\n r.t = i;\n r.clamp();\n }\n\n // (public) this + a\n function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; }\n\n // (public) this - a\n function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; }\n\n // (public) this * a\n function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; }\n\n // (public) this^2\n function bnSquare() { var r = nbi(); this.squareTo(r); return r; }\n\n // (public) this / a\n function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }\n\n // (public) this % a\n function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; }\n\n // (public) [this/a,this%a]\n function bnDivideAndRemainder(a) {\n var q = nbi(), r = nbi();\n this.divRemTo(a,q,r);\n return new Array(q,r);\n }\n\n // (protected) this *= n, this >= 0, 1 < n < DV\n function 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\n function 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\n function NullExp() {}\n function nNop(x) { return x; }\n function nMulTo(x,y,r) { x.multiplyTo(y,r); }\n function nSqrTo(x,r) { x.squareTo(r); }\n\n NullExp.prototype.convert = nNop;\n NullExp.prototype.revert = nNop;\n NullExp.prototype.mulTo = nMulTo;\n NullExp.prototype.sqrTo = nSqrTo;\n\n // (public) this^e\n function bnPow(e) { return this.exp(e,new NullExp()); }\n\n // (protected) r = lower n words of \"this * a\", a.t <= n\n // \"this\" should be the larger one if appropriate.\n function 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.\n function 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\n function Barrett(m) {\n // setup Barrett\n this.r2 = nbi();\n this.q3 = nbi();\n BigInteger.ONE.dlShiftTo(2*m.t,this.r2);\n this.mu = this.r2.divide(m);\n this.m = m;\n }\n\n function 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 { var r = nbi(); x.copyTo(r); this.reduce(r); return r; }\n }\n\n function barrettRevert(x) { return x; }\n\n // x = x mod m (HAC 14.42)\n function barrettReduce(x) {\n x.drShiftTo(this.m.t-1,this.r2);\n if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); }\n this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);\n this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);\n while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1);\n x.subTo(this.r2,x);\n while(x.compareTo(this.m) >= 0) x.subTo(this.m,x);\n }\n\n // r = x^2 mod m; x != r\n function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); }\n\n // r = x*y mod m; x,y != r\n function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }\n\n Barrett.prototype.convert = barrettConvert;\n Barrett.prototype.revert = barrettRevert;\n Barrett.prototype.reduce = barrettReduce;\n Barrett.prototype.mulTo = barrettMulTo;\n Barrett.prototype.sqrTo = barrettSqrTo;\n\n // (public) this^e % m (HAC 14.85)\n function bnModPow(e,m) {\n var i = e.bitLength(), k, r = nbv(1), 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 = 3, k1 = k-1, km = (1< 1) {\n var g2 = nbi();\n z.sqrTo(g[1],g2);\n while(n <= km) {\n g[n] = nbi();\n z.mulTo(g2,g[n-2],g[n]);\n n += 2;\n }\n }\n\n var j = e.t-1, w, is1 = true, r2 = nbi(), 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) { w >>= 1; --n; }\n if((i -= n) < 0) { i += this.DB; --j; }\n if(is1) {\t// ret == 1, don't bother squaring or multiplying it\n g[w].copyTo(r);\n is1 = false;\n }\n else {\n while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; }\n if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; }\n z.mulTo(r2,g[w],r);\n }\n\n while(j >= 0 && (e[j]&(1< 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 }\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\n function bnpModInt(n) {\n if(n <= 0) return 0;\n var d = this.DV%n, r = (this.s<0)?n-1:0;\n if(this.t > 0)\n if(d == 0) r = this[0]%n;\n else 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)\n function bnModInverse(m) {\n var ac = m.isEven();\n if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO;\n var u = m.clone(), v = this.clone();\n var a = nbv(1), b = nbv(0), c = nbv(0), 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()) { a.addTo(this,a); b.subTo(m,b); }\n a.rShiftTo(1,a);\n }\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()) { c.addTo(this,c); d.subTo(m,d); }\n c.rShiftTo(1,c);\n }\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 }\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); else return d;\n if(d.signum() < 0) return d.add(m); else return d;\n }\n\n var lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997];\n var lplim = (1<<26)/lowprimes[lowprimes.length-1];\n\n // (public) test primality with certainty >= 1-.5^t\n function 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], 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)\n function 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 = nbi();\n for(var i = 0; i < t; ++i) {\n //Pick bases at random, instead of starting at 2\n a.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]);\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\n BigInteger.prototype.chunkSize = bnpChunkSize;\n BigInteger.prototype.toRadix = bnpToRadix;\n BigInteger.prototype.fromRadix = bnpFromRadix;\n BigInteger.prototype.fromNumber = bnpFromNumber;\n BigInteger.prototype.bitwiseTo = bnpBitwiseTo;\n BigInteger.prototype.changeBit = bnpChangeBit;\n BigInteger.prototype.addTo = bnpAddTo;\n BigInteger.prototype.dMultiply = bnpDMultiply;\n BigInteger.prototype.dAddOffset = bnpDAddOffset;\n BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo;\n BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo;\n BigInteger.prototype.modInt = bnpModInt;\n BigInteger.prototype.millerRabin = bnpMillerRabin;\n\n // public\n BigInteger.prototype.clone = bnClone;\n BigInteger.prototype.intValue = bnIntValue;\n BigInteger.prototype.byteValue = bnByteValue;\n BigInteger.prototype.shortValue = bnShortValue;\n BigInteger.prototype.signum = bnSigNum;\n BigInteger.prototype.toByteArray = bnToByteArray;\n BigInteger.prototype.equals = bnEquals;\n BigInteger.prototype.min = bnMin;\n BigInteger.prototype.max = bnMax;\n BigInteger.prototype.and = bnAnd;\n BigInteger.prototype.or = bnOr;\n BigInteger.prototype.xor = bnXor;\n BigInteger.prototype.andNot = bnAndNot;\n BigInteger.prototype.not = bnNot;\n BigInteger.prototype.shiftLeft = bnShiftLeft;\n BigInteger.prototype.shiftRight = bnShiftRight;\n BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit;\n BigInteger.prototype.bitCount = bnBitCount;\n BigInteger.prototype.testBit = bnTestBit;\n BigInteger.prototype.setBit = bnSetBit;\n BigInteger.prototype.clearBit = bnClearBit;\n BigInteger.prototype.flipBit = bnFlipBit;\n BigInteger.prototype.add = bnAdd;\n BigInteger.prototype.subtract = bnSubtract;\n BigInteger.prototype.multiply = bnMultiply;\n BigInteger.prototype.divide = bnDivide;\n BigInteger.prototype.remainder = bnRemainder;\n BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder;\n BigInteger.prototype.modPow = bnModPow;\n BigInteger.prototype.modInverse = bnModInverse;\n BigInteger.prototype.pow = bnPow;\n BigInteger.prototype.gcd = bnGCD;\n BigInteger.prototype.isProbablePrime = bnIsProbablePrime;\n\n // JSBN-specific extension\n BigInteger.prototype.square = bnSquare;\n\n // Expose the Barrett function\n BigInteger.prototype.Barrett = Barrett\n\n // BigInteger interfaces not implemented in jsbn:\n\n // BigInteger(int signum, byte[] magnitude)\n // double doubleValue()\n // float floatValue()\n // int hashCode()\n // long longValue()\n // static BigInteger valueOf(long val)\n\n\t// Random number generator - requires a PRNG backend, e.g. prng4.js\n\n\t// For best results, put code like\n\t// \n\t// in your main HTML document.\n\n\tvar rng_state;\n\tvar rng_pool;\n\tvar rng_pptr;\n\n\t// Mix in a 32-bit integer into the pool\n\tfunction rng_seed_int(x) {\n\t rng_pool[rng_pptr++] ^= x & 255;\n\t rng_pool[rng_pptr++] ^= (x >> 8) & 255;\n\t rng_pool[rng_pptr++] ^= (x >> 16) & 255;\n\t rng_pool[rng_pptr++] ^= (x >> 24) & 255;\n\t if(rng_pptr >= rng_psize) rng_pptr -= rng_psize;\n\t}\n\n\t// Mix in the current time (w/milliseconds) into the pool\n\tfunction rng_seed_time() {\n\t rng_seed_int(new Date().getTime());\n\t}\n\n\t// Initialize the pool with junk if needed.\n\tif(rng_pool == null) {\n\t rng_pool = new Array();\n\t rng_pptr = 0;\n\t var t;\n\t if(typeof window !== \"undefined\" && window.crypto) {\n\t\tif (window.crypto.getRandomValues) {\n\t\t // Use webcrypto if available\n\t\t var ua = new Uint8Array(32);\n\t\t window.crypto.getRandomValues(ua);\n\t\t for(t = 0; t < 32; ++t)\n\t\t\trng_pool[rng_pptr++] = ua[t];\n\t\t}\n\t\telse if(navigator.appName == \"Netscape\" && navigator.appVersion < \"5\") {\n\t\t // Extract entropy (256 bits) from NS4 RNG if available\n\t\t var z = window.crypto.random(32);\n\t\t for(t = 0; t < z.length; ++t)\n\t\t\trng_pool[rng_pptr++] = z.charCodeAt(t) & 255;\n\t\t}\n\t }\n\t while(rng_pptr < rng_psize) { // extract some randomness from Math.random()\n\t\tt = Math.floor(65536 * Math.random());\n\t\trng_pool[rng_pptr++] = t >>> 8;\n\t\trng_pool[rng_pptr++] = t & 255;\n\t }\n\t rng_pptr = 0;\n\t rng_seed_time();\n\t //rng_seed_int(window.screenX);\n\t //rng_seed_int(window.screenY);\n\t}\n\n\tfunction rng_get_byte() {\n\t if(rng_state == null) {\n\t\trng_seed_time();\n\t\trng_state = prng_newstate();\n\t\trng_state.init(rng_pool);\n\t\tfor(rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr)\n\t\t rng_pool[rng_pptr] = 0;\n\t\trng_pptr = 0;\n\t\t//rng_pool = null;\n\t }\n\t // TODO: allow reseeding after first request\n\t return rng_state.next();\n\t}\n\n\tfunction rng_get_bytes(ba) {\n\t var i;\n\t for(i = 0; i < ba.length; ++i) ba[i] = rng_get_byte();\n\t}\n\n\tfunction SecureRandom() {}\n\n\tSecureRandom.prototype.nextBytes = rng_get_bytes;\n\n\t// prng4.js - uses Arcfour as a PRNG\n\n\tfunction Arcfour() {\n\t this.i = 0;\n\t this.j = 0;\n\t this.S = new Array();\n\t}\n\n\t// Initialize arcfour context from key, an array of ints, each from [0..255]\n\tfunction ARC4init(key) {\n\t var i, j, t;\n\t for(i = 0; i < 256; ++i)\n\t\tthis.S[i] = i;\n\t j = 0;\n\t for(i = 0; i < 256; ++i) {\n\t\tj = (j + this.S[i] + key[i % key.length]) & 255;\n\t\tt = this.S[i];\n\t\tthis.S[i] = this.S[j];\n\t\tthis.S[j] = t;\n\t }\n\t this.i = 0;\n\t this.j = 0;\n\t}\n\n\tfunction ARC4next() {\n\t var t;\n\t this.i = (this.i + 1) & 255;\n\t this.j = (this.j + this.S[this.i]) & 255;\n\t t = this.S[this.i];\n\t this.S[this.i] = this.S[this.j];\n\t this.S[this.j] = t;\n\t return this.S[(t + this.S[this.i]) & 255];\n\t}\n\n\tArcfour.prototype.init = ARC4init;\n\tArcfour.prototype.next = ARC4next;\n\n\t// Plug in your RNG constructor here\n\tfunction prng_newstate() {\n\t return new Arcfour();\n\t}\n\n\t// Pool size must be a multiple of 4 and greater than 32.\n\t// An array of bytes the size of the pool will be passed to init()\n\tvar rng_psize = 256;\n\n BigInteger.SecureRandom = SecureRandom;\n BigInteger.BigInteger = BigInteger;\n if (typeof exports !== 'undefined') {\n exports = module.exports = BigInteger;\n } else {\n this.BigInteger = BigInteger;\n this.SecureRandom = SecureRandom;\n }\n\n}).call(this);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/jsbn/index.js\n// module id = 31\n// module chunks = 0","/**\n * Check if `fn` is a function.\n *\n * @param {Function} fn\n * @return {Boolean}\n * @api private\n */\nvar isObject = require('./is-object');\n\nfunction isFunction(fn) {\n var tag = isObject(fn) ? Object.prototype.toString.call(fn) : '';\n return tag === '[object Function]';\n}\n\nmodule.exports = isFunction;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/superagent/lib/is-function.js\n// module id = 32\n// module chunks = 0","/**\n * Module of mixed-in functions shared between node and client code\n */\nvar isObject = require('./is-object');\n\n/**\n * Expose `RequestBase`.\n */\n\nmodule.exports = RequestBase;\n\n/**\n * Initialize a new `RequestBase`.\n *\n * @api public\n */\n\nfunction RequestBase(obj) {\n if (obj) return mixin(obj);\n}\n\n/**\n * Mixin the prototype properties.\n *\n * @param {Object} obj\n * @return {Object}\n * @api private\n */\n\nfunction mixin(obj) {\n for (var key in RequestBase.prototype) {\n obj[key] = RequestBase.prototype[key];\n }\n return obj;\n}\n\n/**\n * Clear previous timeout.\n *\n * @return {Request} for chaining\n * @api public\n */\n\nRequestBase.prototype.clearTimeout = function _clearTimeout(){\n clearTimeout(this._timer);\n clearTimeout(this._responseTimeoutTimer);\n delete this._timer;\n delete this._responseTimeoutTimer;\n return this;\n};\n\n/**\n * Override default response body parser\n *\n * This function will be called to convert incoming data into request.body\n *\n * @param {Function}\n * @api public\n */\n\nRequestBase.prototype.parse = function parse(fn){\n this._parser = fn;\n return this;\n};\n\n/**\n * Set format of binary response body.\n * In browser valid formats are 'blob' and 'arraybuffer',\n * which return Blob and ArrayBuffer, respectively.\n *\n * In Node all values result in Buffer.\n *\n * Examples:\n *\n * req.get('/')\n * .responseType('blob')\n * .end(callback);\n *\n * @param {String} val\n * @return {Request} for chaining\n * @api public\n */\n\nRequestBase.prototype.responseType = function(val){\n this._responseType = val;\n return this;\n};\n\n/**\n * Override default request body serializer\n *\n * This function will be called to convert data set via .send or .attach into payload to send\n *\n * @param {Function}\n * @api public\n */\n\nRequestBase.prototype.serialize = function serialize(fn){\n this._serializer = fn;\n return this;\n};\n\n/**\n * Set timeouts.\n *\n * - response timeout is time between sending request and receiving the first byte of the response. Includes DNS and connection time.\n * - deadline is the time from start of the request to receiving response body in full. If the deadline is too short large files may not load at all on slow connections.\n *\n * Value of 0 or false means no timeout.\n *\n * @param {Number|Object} ms or {response, read, deadline}\n * @return {Request} for chaining\n * @api public\n */\n\nRequestBase.prototype.timeout = function timeout(options){\n if (!options || 'object' !== typeof options) {\n this._timeout = options;\n this._responseTimeout = 0;\n return this;\n }\n\n for(var option in options) {\n switch(option) {\n case 'deadline':\n this._timeout = options.deadline;\n break;\n case 'response':\n this._responseTimeout = options.response;\n break;\n default:\n console.warn(\"Unknown timeout option\", option);\n }\n }\n return this;\n};\n\n/**\n * Set number of retry attempts on error.\n *\n * Failed requests will be retried 'count' times if timeout or err.code >= 500.\n *\n * @param {Number} count\n * @return {Request} for chaining\n * @api public\n */\n\nRequestBase.prototype.retry = function retry(count){\n // Default to 1 if no count passed or true\n if (arguments.length === 0 || count === true) count = 1;\n if (count <= 0) count = 0;\n this._maxRetries = count;\n this._retries = 0;\n return this;\n};\n\n/**\n * Retry request\n *\n * @return {Request} for chaining\n * @api private\n */\n\nRequestBase.prototype._retry = function() {\n this.clearTimeout();\n\n // node\n if (this.req) {\n this.req = null;\n this.req = this.request();\n }\n\n this._aborted = false;\n this.timedout = false;\n\n return this._end();\n};\n\n/**\n * Promise support\n *\n * @param {Function} resolve\n * @param {Function} [reject]\n * @return {Request}\n */\n\nRequestBase.prototype.then = function then(resolve, reject) {\n if (!this._fullfilledPromise) {\n var self = this;\n if (this._endCalled) {\n console.warn(\"Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises\");\n }\n this._fullfilledPromise = new Promise(function(innerResolve, innerReject){\n self.end(function(err, res){\n if (err) innerReject(err); else innerResolve(res);\n });\n });\n }\n return this._fullfilledPromise.then(resolve, reject);\n}\n\nRequestBase.prototype.catch = function(cb) {\n return this.then(undefined, cb);\n};\n\n/**\n * Allow for extension\n */\n\nRequestBase.prototype.use = function use(fn) {\n fn(this);\n return this;\n}\n\nRequestBase.prototype.ok = function(cb) {\n if ('function' !== typeof cb) throw Error(\"Callback required\");\n this._okCallback = cb;\n return this;\n};\n\nRequestBase.prototype._isResponseOK = function(res) {\n if (!res) {\n return false;\n }\n\n if (this._okCallback) {\n return this._okCallback(res);\n }\n\n return res.status >= 200 && res.status < 300;\n};\n\n\n/**\n * Get request header `field`.\n * Case-insensitive.\n *\n * @param {String} field\n * @return {String}\n * @api public\n */\n\nRequestBase.prototype.get = function(field){\n return this._header[field.toLowerCase()];\n};\n\n/**\n * Get case-insensitive header `field` value.\n * This is a deprecated internal API. Use `.get(field)` instead.\n *\n * (getHeader is no longer used internally by the superagent code base)\n *\n * @param {String} field\n * @return {String}\n * @api private\n * @deprecated\n */\n\nRequestBase.prototype.getHeader = RequestBase.prototype.get;\n\n/**\n * Set header `field` to `val`, or multiple fields with one object.\n * Case-insensitive.\n *\n * Examples:\n *\n * req.get('/')\n * .set('Accept', 'application/json')\n * .set('X-API-Key', 'foobar')\n * .end(callback);\n *\n * req.get('/')\n * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })\n * .end(callback);\n *\n * @param {String|Object} field\n * @param {String} val\n * @return {Request} for chaining\n * @api public\n */\n\nRequestBase.prototype.set = function(field, val){\n if (isObject(field)) {\n for (var key in field) {\n this.set(key, field[key]);\n }\n return this;\n }\n this._header[field.toLowerCase()] = val;\n this.header[field] = val;\n return this;\n};\n\n/**\n * Remove header `field`.\n * Case-insensitive.\n *\n * Example:\n *\n * req.get('/')\n * .unset('User-Agent')\n * .end(callback);\n *\n * @param {String} field\n */\nRequestBase.prototype.unset = function(field){\n delete this._header[field.toLowerCase()];\n delete this.header[field];\n return this;\n};\n\n/**\n * Write the field `name` and `val`, or multiple fields with one object\n * for \"multipart/form-data\" request bodies.\n *\n * ``` js\n * request.post('/upload')\n * .field('foo', 'bar')\n * .end(callback);\n *\n * request.post('/upload')\n * .field({ foo: 'bar', baz: 'qux' })\n * .end(callback);\n * ```\n *\n * @param {String|Object} name\n * @param {String|Blob|File|Buffer|fs.ReadStream} val\n * @return {Request} for chaining\n * @api public\n */\nRequestBase.prototype.field = function(name, val) {\n\n // name should be either a string or an object.\n if (null === name || undefined === name) {\n throw new Error('.field(name, val) name can not be empty');\n }\n\n if (this._data) {\n console.error(\".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()\");\n }\n\n if (isObject(name)) {\n for (var key in name) {\n this.field(key, name[key]);\n }\n return this;\n }\n\n if (Array.isArray(val)) {\n for (var i in val) {\n this.field(name, val[i]);\n }\n return this;\n }\n\n // val should be defined now\n if (null === val || undefined === val) {\n throw new Error('.field(name, val) val can not be empty');\n }\n if ('boolean' === typeof val) {\n val = '' + val;\n }\n this._getFormData().append(name, val);\n return this;\n};\n\n/**\n * Abort the request, and clear potential timeout.\n *\n * @return {Request}\n * @api public\n */\nRequestBase.prototype.abort = function(){\n if (this._aborted) {\n return this;\n }\n this._aborted = true;\n this.xhr && this.xhr.abort(); // browser\n this.req && this.req.abort(); // node\n this.clearTimeout();\n this.emit('abort');\n return this;\n};\n\n/**\n * Enable transmission of cookies with x-domain requests.\n *\n * Note that for this to work the origin must not be\n * using \"Access-Control-Allow-Origin\" with a wildcard,\n * and also must set \"Access-Control-Allow-Credentials\"\n * to \"true\".\n *\n * @api public\n */\n\nRequestBase.prototype.withCredentials = function(on){\n // This is browser-only functionality. Node side is no-op.\n if(on==undefined) on = true;\n this._withCredentials = on;\n return this;\n};\n\n/**\n * Set the max redirects to `n`. Does noting in browser XHR implementation.\n *\n * @param {Number} n\n * @return {Request} for chaining\n * @api public\n */\n\nRequestBase.prototype.redirects = function(n){\n this._maxRedirects = n;\n return this;\n};\n\n/**\n * Convert to a plain javascript object (not JSON string) of scalar properties.\n * Note as this method is designed to return a useful non-this value,\n * it cannot be chained.\n *\n * @return {Object} describing method, url, and data of this request\n * @api public\n */\n\nRequestBase.prototype.toJSON = function(){\n return {\n method: this.method,\n url: this.url,\n data: this._data,\n headers: this._header\n };\n};\n\n\n/**\n * Send `data` as the request body, defaulting the `.type()` to \"json\" when\n * an object is given.\n *\n * Examples:\n *\n * // manual json\n * request.post('/user')\n * .type('json')\n * .send('{\"name\":\"tj\"}')\n * .end(callback)\n *\n * // auto json\n * request.post('/user')\n * .send({ name: 'tj' })\n * .end(callback)\n *\n * // manual x-www-form-urlencoded\n * request.post('/user')\n * .type('form')\n * .send('name=tj')\n * .end(callback)\n *\n * // auto x-www-form-urlencoded\n * request.post('/user')\n * .type('form')\n * .send({ name: 'tj' })\n * .end(callback)\n *\n * // defaults to x-www-form-urlencoded\n * request.post('/user')\n * .send('name=tobi')\n * .send('species=ferret')\n * .end(callback)\n *\n * @param {String|Object} data\n * @return {Request} for chaining\n * @api public\n */\n\nRequestBase.prototype.send = function(data){\n var isObj = isObject(data);\n var type = this._header['content-type'];\n\n if (this._formData) {\n console.error(\".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()\");\n }\n\n if (isObj && !this._data) {\n if (Array.isArray(data)) {\n this._data = [];\n } else if (!this._isHost(data)) {\n this._data = {};\n }\n } else if (data && this._data && this._isHost(this._data)) {\n throw Error(\"Can't merge these send calls\");\n }\n\n // merge\n if (isObj && isObject(this._data)) {\n for (var key in data) {\n this._data[key] = data[key];\n }\n } else if ('string' == typeof data) {\n // default to x-www-form-urlencoded\n if (!type) this.type('form');\n type = this._header['content-type'];\n if ('application/x-www-form-urlencoded' == type) {\n this._data = this._data\n ? this._data + '&' + data\n : data;\n } else {\n this._data = (this._data || '') + data;\n }\n } else {\n this._data = data;\n }\n\n if (!isObj || this._isHost(data)) {\n return this;\n }\n\n // default to json\n if (!type) this.type('json');\n return this;\n};\n\n\n/**\n * Sort `querystring` by the sort function\n *\n *\n * Examples:\n *\n * // default order\n * request.get('/user')\n * .query('name=Nick')\n * .query('search=Manny')\n * .sortQuery()\n * .end(callback)\n *\n * // customized sort function\n * request.get('/user')\n * .query('name=Nick')\n * .query('search=Manny')\n * .sortQuery(function(a, b){\n * return a.length - b.length;\n * })\n * .end(callback)\n *\n *\n * @param {Function} sort\n * @return {Request} for chaining\n * @api public\n */\n\nRequestBase.prototype.sortQuery = function(sort) {\n // _sort default to true but otherwise can be a function or boolean\n this._sort = typeof sort === 'undefined' ? true : sort;\n return this;\n};\n\n/**\n * Invoke callback with timeout error.\n *\n * @api private\n */\n\nRequestBase.prototype._timeoutError = function(reason, timeout, errno){\n if (this._aborted) {\n return;\n }\n var err = new Error(reason + timeout + 'ms exceeded');\n err.timeout = timeout;\n err.code = 'ECONNABORTED';\n err.errno = errno;\n this.timedout = true;\n this.abort();\n this.callback(err);\n};\n\nRequestBase.prototype._setTimeouts = function() {\n var self = this;\n\n // deadline\n if (this._timeout && !this._timer) {\n this._timer = setTimeout(function(){\n self._timeoutError('Timeout of ', self._timeout, 'ETIME');\n }, this._timeout);\n }\n // response timeout\n if (this._responseTimeout && !this._responseTimeoutTimer) {\n this._responseTimeoutTimer = setTimeout(function(){\n self._timeoutError('Response timeout of ', self._responseTimeout, 'ETIMEDOUT');\n }, this._responseTimeout);\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/superagent/lib/request-base.js\n// module id = 33\n// module chunks = 0","\n/**\n * Module dependencies.\n */\n\nvar utils = require('./utils');\n\n/**\n * Expose `ResponseBase`.\n */\n\nmodule.exports = ResponseBase;\n\n/**\n * Initialize a new `ResponseBase`.\n *\n * @api public\n */\n\nfunction ResponseBase(obj) {\n if (obj) return mixin(obj);\n}\n\n/**\n * Mixin the prototype properties.\n *\n * @param {Object} obj\n * @return {Object}\n * @api private\n */\n\nfunction mixin(obj) {\n for (var key in ResponseBase.prototype) {\n obj[key] = ResponseBase.prototype[key];\n }\n return obj;\n}\n\n/**\n * Get case-insensitive `field` value.\n *\n * @param {String} field\n * @return {String}\n * @api public\n */\n\nResponseBase.prototype.get = function(field){\n return this.header[field.toLowerCase()];\n};\n\n/**\n * Set header related properties:\n *\n * - `.type` the content type without params\n *\n * A response of \"Content-Type: text/plain; charset=utf-8\"\n * will provide you with a `.type` of \"text/plain\".\n *\n * @param {Object} header\n * @api private\n */\n\nResponseBase.prototype._setHeaderProperties = function(header){\n // TODO: moar!\n // TODO: make this a util\n\n // content-type\n var ct = header['content-type'] || '';\n this.type = utils.type(ct);\n\n // params\n var params = utils.params(ct);\n for (var key in params) this[key] = params[key];\n\n this.links = {};\n\n // links\n try {\n if (header.link) {\n this.links = utils.parseLinks(header.link);\n }\n } catch (err) {\n // ignore\n }\n};\n\n/**\n * Set flags such as `.ok` based on `status`.\n *\n * For example a 2xx response will give you a `.ok` of __true__\n * whereas 5xx will be __false__ and `.error` will be __true__. The\n * `.clientError` and `.serverError` are also available to be more\n * specific, and `.statusType` is the class of error ranging from 1..5\n * sometimes useful for mapping respond colors etc.\n *\n * \"sugar\" properties are also defined for common cases. Currently providing:\n *\n * - .noContent\n * - .badRequest\n * - .unauthorized\n * - .notAcceptable\n * - .notFound\n *\n * @param {Number} status\n * @api private\n */\n\nResponseBase.prototype._setStatusProperties = function(status){\n var type = status / 100 | 0;\n\n // status / class\n this.status = this.statusCode = status;\n this.statusType = type;\n\n // basics\n this.info = 1 == type;\n this.ok = 2 == type;\n this.redirect = 3 == type;\n this.clientError = 4 == type;\n this.serverError = 5 == type;\n this.error = (4 == type || 5 == type)\n ? this.toError()\n : false;\n\n // sugar\n this.accepted = 202 == status;\n this.noContent = 204 == status;\n this.badRequest = 400 == status;\n this.unauthorized = 401 == status;\n this.notAcceptable = 406 == status;\n this.forbidden = 403 == status;\n this.notFound = 404 == status;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/superagent/lib/response-base.js\n// module id = 34\n// module chunks = 0","var ERROR_CODES = [\n 'ECONNRESET',\n 'ETIMEDOUT',\n 'EADDRINFO',\n 'ESOCKETTIMEDOUT'\n];\n\n/**\n * Determine if a request should be retried.\n * (Borrowed from segmentio/superagent-retry)\n *\n * @param {Error} err\n * @param {Response} [res]\n * @returns {Boolean}\n */\nmodule.exports = function shouldRetry(err, res) {\n if (err && err.code && ~ERROR_CODES.indexOf(err.code)) return true;\n if (res && res.status && res.status >= 500) return true;\n // Superagent timeout\n if (err && 'timeout' in err && err.code == 'ECONNABORTED') return true;\n return false;\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/superagent/lib/should-retry.js\n// module id = 35\n// module chunks = 0","\n/**\n * Return the mime type for the given `str`.\n *\n * @param {String} str\n * @return {String}\n * @api private\n */\n\nexports.type = function(str){\n return str.split(/ *; */).shift();\n};\n\n/**\n * Return header field parameters.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nexports.params = function(str){\n return str.split(/ *; */).reduce(function(obj, str){\n var parts = str.split(/ *= */);\n var key = parts.shift();\n var val = parts.shift();\n\n if (key && val) obj[key] = val;\n return obj;\n }, {});\n};\n\n/**\n * Parse Link header fields.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nexports.parseLinks = function(str){\n return str.split(/ *, */).reduce(function(obj, str){\n var parts = str.split(/ *; */);\n var url = parts[0].slice(1, -1);\n var rel = parts[1].split(/ *= */)[1].slice(1, -1);\n obj[rel] = url;\n return obj;\n }, {});\n};\n\n/**\n * Strip content related fields from `header`.\n *\n * @param {Object} header\n * @return {Object} header\n * @api private\n */\n\nexports.cleanHeader = function(header, shouldStripCookie){\n delete header['content-type'];\n delete header['content-length'];\n delete header['transfer-encoding'];\n delete header['host'];\n if (shouldStripCookie) {\n delete header['cookie'];\n }\n return header;\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/superagent/lib/utils.js\n// module id = 36\n// module chunks = 0","var urljoin = require('url-join');\n\nvar objectHelper = require('../helper/object');\nvar assert = require('../helper/assert');\nvar responseHandler = require('../helper/response-handler');\n\nfunction DBConnection(request, options) {\n this.baseOptions = options;\n this.request = request;\n}\n\n/**\n * @callback signUpCallback\n * @param {Error} [err] error returned by Auth0 with the reason why the signup failed\n * @param {Object} [result] result of the signup request\n * @param {Object} result.email user's email\n * @param {Object} result.emailVerified if the user's email was verified\n */\n\n/**\n * Creates a new user in a Auth0 Database connection\n *\n * @method signup\n * @param {Object} options\n * @param {String} options.email user email address\n * @param {String} options.password user password\n * @param {String} options.connection name of the connection where the user will be created\n * @param {Object} [options.userMetadata] additional signup attributes used for creating the user. Will be stored in `user_metadata`\n * @param {signUpCallback} cb\n * @see {@link https://auth0.com/docs/api/authentication#signup}\n */\nDBConnection.prototype.signup = function(options, cb) {\n var url;\n var body;\n var metadata;\n\n assert.check(\n options,\n { type: 'object', message: 'options parameter is not valid' },\n {\n connection: { type: 'string', message: 'connection option is required' },\n email: { type: 'string', message: 'email option is required' },\n password: { type: 'string', message: 'password option is required' }\n }\n );\n assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\n url = urljoin(this.baseOptions.rootUrl, 'dbconnections', 'signup');\n\n body = objectHelper.merge(this.baseOptions, ['clientID']).with(options);\n\n metadata = body.user_metadata || body.userMetadata;\n\n body = objectHelper.blacklist(body, ['scope', 'userMetadata', 'user_metadata']);\n\n body = objectHelper.toSnakeCase(body, ['auth0Client']);\n\n if (metadata) {\n body.user_metadata = metadata;\n }\n\n return this.request.post(url).send(body).end(responseHandler(cb));\n};\n\n/**\n * @callback changePasswordCallback\n * @param {Error} [err] error returned by Auth0 with the reason why the request failed\n */\n\n/**\n * Request an email with instruction to change a user's password\n *\n * @method changePassword\n * @param {Object} options\n * @param {String} options.email address where the user will recieve the change password email. It should match the user's email in Auth0\n * @param {String} options.connection name of the connection where the user was created\n * @param {changePasswordCallback} cb\n * @see {@link https://auth0.com/docs/api/authentication#change-password}\n */\nDBConnection.prototype.changePassword = function(options, cb) {\n var url;\n var body;\n\n assert.check(\n options,\n { type: 'object', message: 'options parameter is not valid' },\n {\n connection: { type: 'string', message: 'connection option is required' },\n email: { type: 'string', message: 'email option is required' }\n }\n );\n assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\n url = urljoin(this.baseOptions.rootUrl, 'dbconnections', 'change_password');\n\n body = objectHelper.merge(this.baseOptions, ['clientID']).with(options, ['email', 'connection']);\n\n body = objectHelper.toSnakeCase(body, ['auth0Client']);\n\n return this.request.post(url).send(body).end(responseHandler(cb));\n};\n\nmodule.exports = DBConnection;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/authentication/db-connection.js\n// module id = 40\n// module chunks = 0","var urljoin = require('url-join');\n\nvar objectHelper = require('../helper/object');\nvar assert = require('../helper/assert');\nvar qs = require('qs');\nvar responseHandler = require('../helper/response-handler');\n\nfunction PasswordlessAuthentication(request, options) {\n this.baseOptions = options;\n this.request = request;\n}\n\nPasswordlessAuthentication.prototype.buildVerifyUrl = function(options) {\n var params;\n var qString;\n\n /* eslint-disable */\n assert.check(\n options,\n { type: 'object', message: 'options parameter is not valid' },\n {\n connection: { type: 'string', message: 'connection option is required' },\n verificationCode: { type: 'string', message: 'verificationCode option is required' },\n phoneNumber: {\n optional: false,\n type: 'string',\n message: 'phoneNumber option is required',\n condition: function(o) {\n return !o.email;\n }\n },\n email: {\n optional: false,\n type: 'string',\n message: 'email option is required',\n condition: function(o) {\n return !o.phoneNumber;\n }\n }\n }\n );\n /* eslint-enable */\n\n params = objectHelper\n .merge(this.baseOptions, [\n 'clientID',\n 'responseType',\n 'responseMode',\n 'redirectUri',\n 'scope',\n 'audience',\n '_csrf',\n 'state',\n '_intstate',\n 'protocol',\n 'nonce'\n ])\n .with(options);\n\n // eslint-disable-next-line\n if (this.baseOptions._sendTelemetry) {\n params.auth0Client = this.request.getTelemetryData();\n }\n\n params = objectHelper.toSnakeCase(params, ['auth0Client']);\n\n qString = qs.stringify(params);\n\n return urljoin(this.baseOptions.rootUrl, 'passwordless', 'verify_redirect', '?' + qString);\n};\n\nPasswordlessAuthentication.prototype.start = function(options, cb) {\n var url;\n var body;\n\n /* eslint-disable */\n assert.check(\n options,\n { type: 'object', message: 'options parameter is not valid' },\n {\n connection: { type: 'string', message: 'connection option is required' },\n send: {\n type: 'string',\n message: 'send option is required',\n values: ['link', 'code'],\n value_message: 'send is not valid ([link, code])'\n },\n phoneNumber: {\n optional: true,\n type: 'string',\n message: 'phoneNumber option is required',\n condition: function(o) {\n return o.send === 'code' || !o.email;\n }\n },\n email: {\n optional: true,\n type: 'string',\n message: 'email option is required',\n condition: function(o) {\n return o.send === 'link' || !o.phoneNumber;\n }\n },\n authParams: { optional: true, type: 'object', message: 'authParams option is required' }\n }\n );\n /* eslint-enable */\n\n assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\n url = urljoin(this.baseOptions.rootUrl, 'passwordless', 'start');\n\n body = objectHelper\n .merge(this.baseOptions, ['clientID', 'responseType', 'redirectUri', 'scope'])\n .with(options);\n\n if (body.scope) {\n body.authParams = body.authParams || {};\n body.authParams.scope = body.scope;\n }\n\n if (body.redirectUri) {\n body.authParams = body.authParams || {};\n body.authParams.redirect_uri = body.redirectUri;\n }\n\n if (body.responseType) {\n body.authParams = body.authParams || {};\n body.authParams.response_type = body.responseType;\n }\n\n delete body.redirectUri;\n delete body.responseType;\n delete body.scope;\n\n body = objectHelper.toSnakeCase(body, ['auth0Client', 'authParams']);\n\n return this.request.post(url).send(body).end(responseHandler(cb));\n};\n\nPasswordlessAuthentication.prototype.verify = function(options, cb) {\n var url;\n var cleanOption;\n\n /* eslint-disable */\n assert.check(\n options,\n { type: 'object', message: 'options parameter is not valid' },\n {\n connection: { type: 'string', message: 'connection option is required' },\n verificationCode: { type: 'string', message: 'verificationCode option is required' },\n phoneNumber: {\n optional: false,\n type: 'string',\n message: 'phoneNumber option is required',\n condition: function(o) {\n return !o.email;\n }\n },\n email: {\n optional: false,\n type: 'string',\n message: 'email option is required',\n condition: function(o) {\n return !o.phoneNumber;\n }\n }\n }\n );\n /* eslint-enable */\n\n assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\n cleanOption = objectHelper.pick(options, [\n 'connection',\n 'verificationCode',\n 'phoneNumber',\n 'email',\n 'auth0Client'\n ]);\n cleanOption = objectHelper.toSnakeCase(cleanOption, ['auth0Client']);\n\n url = urljoin(this.baseOptions.rootUrl, 'passwordless', 'verify');\n\n return this.request.post(url).send(cleanOption).end(responseHandler(cb));\n};\n\nmodule.exports = PasswordlessAuthentication;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/authentication/passwordless-authentication.js\n// module id = 41\n// module chunks = 0","var windowHandler = require('./window');\nvar base64Url = require('./base64_url');\n\nfunction create(name, value, days) {\n var date;\n var expires;\n\n if (\n windowHandler.getDocument().cookie === undefined ||\n windowHandler.getDocument().cookie === null\n ) {\n throw new Error('cookie storage not available');\n }\n\n if (days) {\n var timeToExpire = days * 24 * 60 * 60 * 1000;\n date = new Date();\n date.setTime(date.getTime() + timeToExpire);\n expires = '; expires=' + date.toGMTString();\n } else {\n expires = '';\n }\n\n windowHandler.getDocument().cookie = name + '=' + base64Url.encode(value) + expires + '; path=/';\n}\n\nfunction read(name) {\n var i;\n var cookie;\n var cookies;\n var nameEQ = name + '=';\n\n if (\n windowHandler.getDocument().cookie === undefined ||\n windowHandler.getDocument().cookie === null\n ) {\n throw new Error('cookie storage not available');\n }\n\n cookies = windowHandler.getDocument().cookie.split(';');\n\n for (i = 0; i < cookies.length; i++) {\n cookie = cookies[i];\n while (cookie.charAt(0) === ' ') {\n cookie = cookie.substring(1, cookie.length);\n }\n if (cookie.indexOf(nameEQ) === 0) {\n return base64Url.decode(cookie.substring(nameEQ.length, cookie.length));\n }\n }\n\n return null;\n}\n\nfunction erase(name) {\n create(name, '', -1);\n}\n\nmodule.exports = {\n create: create,\n read: read,\n erase: erase\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/cookies.js\n// module id = 42\n// module chunks = 0","var windowHelper = require('./window');\n\nfunction IframeHandler(options) {\n this.url = options.url;\n this.callback = options.callback;\n this.timeout = options.timeout || 60 * 1000;\n this.timeoutCallback = options.timeoutCallback || null;\n this.eventListenerType = options.eventListenerType || 'message';\n this.iframe = null;\n this.timeoutHandle = null;\n this._destroyTimeout = null;\n this.transientMessageEventListener = null;\n this.proxyEventListener = null;\n // If no event identifier specified, set default\n this.eventValidator = options.eventValidator || {\n isValid: function() {\n return true;\n }\n };\n\n if (typeof this.callback !== 'function') {\n throw new Error('options.callback must be a function');\n }\n}\n\nIframeHandler.prototype.init = function() {\n var _this = this;\n var _window = windowHelper.getWindow();\n\n this.iframe = _window.document.createElement('iframe');\n this.iframe.style.display = 'none';\n this.iframe.src = this.url;\n\n // Workaround to avoid using bind that does not work in IE8\n this.proxyEventListener = function(e) {\n _this.eventListener(e);\n };\n\n switch (this.eventListenerType) {\n case 'message':\n this.eventSourceObject = _window;\n break;\n case 'load':\n this.eventSourceObject = this.iframe;\n break;\n default:\n throw new Error('Unsupported event listener type: ' + this.eventListenerType);\n }\n\n this.eventSourceObject.addEventListener(this.eventListenerType, this.proxyEventListener, false);\n\n _window.document.body.appendChild(this.iframe);\n\n this.timeoutHandle = setTimeout(function() {\n _this.timeoutHandler();\n }, this.timeout);\n};\n\nIframeHandler.prototype.eventListener = function(event) {\n var eventData = { event: event, sourceObject: this.eventSourceObject };\n\n if (!this.eventValidator.isValid(eventData)) {\n return;\n }\n\n this.destroy();\n this.callback(eventData);\n};\n\nIframeHandler.prototype.timeoutHandler = function() {\n this.destroy();\n if (this.timeoutCallback) {\n this.timeoutCallback();\n }\n};\n\nIframeHandler.prototype.destroy = function() {\n var _this = this;\n var _window = windowHelper.getWindow();\n\n clearTimeout(this.timeoutHandle);\n\n this._destroyTimeout = setTimeout(function() {\n _this.eventSourceObject.removeEventListener(\n _this.eventListenerType,\n _this.proxyEventListener,\n false\n );\n _window.document.body.removeChild(_this.iframe);\n }, 0);\n};\n\nmodule.exports = IframeHandler;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/iframe-handler.js\n// module id = 43\n// module chunks = 0","/* eslint-disable no-continue */\n\nfunction get() {\n if (!Object.assign) {\n return objectAssignPolyfill;\n }\n\n return Object.assign;\n}\n\nfunction objectAssignPolyfill(target) {\n 'use strict';\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert first argument to object');\n }\n\n var to = Object(target);\n for (var i = 1; i < arguments.length; i++) {\n var nextSource = arguments[i];\n if (nextSource === undefined || nextSource === null) {\n continue;\n }\n\n var keysArray = Object.keys(Object(nextSource));\n for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {\n var nextKey = keysArray[nextIndex];\n var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);\n if (desc !== undefined && desc.enumerable) {\n to[nextKey] = nextSource[nextKey];\n }\n }\n }\n return to;\n}\n\nmodule.exports = {\n get: get,\n objectAssignPolyfill: objectAssignPolyfill\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/object-assign.js\n// module id = 44\n// module chunks = 0","var objectHelper = require('./object');\n\nvar tokenParams = [\n // auth0\n 'realm',\n 'audience',\n // oauth2\n 'client_id',\n 'client_secret',\n 'redirect_uri',\n 'scope',\n 'code',\n 'grant_type',\n 'username',\n 'password',\n 'refresh_token',\n 'assertion',\n 'client_assertion',\n 'client_assertion_type',\n 'code_verifier'\n];\n\nvar authorizeParams = [\n // auth0\n 'connection',\n 'connection_scope',\n 'auth0Client',\n 'owp',\n 'device',\n\n 'protocol',\n '_csrf',\n '_intstate',\n 'login_ticket',\n\n // oauth2\n 'client_id',\n 'response_type',\n 'response_mode',\n 'redirect_uri',\n 'audience',\n 'scope',\n 'state',\n 'nonce',\n 'display',\n 'prompt',\n 'max_age',\n 'ui_locales',\n 'claims_locales',\n 'id_token_hint',\n 'login_hint',\n 'acr_values',\n 'claims',\n 'registration',\n 'request',\n 'request_uri',\n 'code_challenge',\n 'code_challenge_method'\n];\n\nfunction oauthAuthorizeParams(warn, params) {\n var notAllowed = objectHelper.getKeysNotIn(params, authorizeParams);\n\n if (notAllowed.length > 0) {\n warn.warning(\n 'Following parameters are not allowed on the `/authorize` endpoint: [' +\n notAllowed.join(',') +\n ']'\n );\n }\n\n return params;\n}\n\nfunction oauthTokenParams(warn, params) {\n return objectHelper.pick(params, tokenParams);\n}\n\nmodule.exports = {\n oauthTokenParams: oauthTokenParams,\n oauthAuthorizeParams: oauthAuthorizeParams\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/parameters-whitelist.js\n// module id = 45\n// module chunks = 0","var version = require('../version');\n\nfunction PluginHandler(webAuth, plugins) {\n this.plugins = plugins;\n\n for (var a = 0; a < this.plugins.length; a++) {\n if (this.plugins[a].version !== version.raw) {\n var pluginName = '';\n\n if (this.plugins[a].constructor && this.plugins[a].constructor.name) {\n pluginName = this.plugins[a].constructor.name;\n }\n\n throw new Error(\n 'Plugin ' +\n pluginName +\n ' version (' +\n this.plugins[a].version +\n ') ' +\n 'is not compatible with the SDK version (' +\n version.raw +\n ')'\n );\n }\n\n this.plugins[a].setWebAuth(webAuth);\n }\n}\n\nPluginHandler.prototype.get = function(extensibilityPoint) {\n for (var a = 0; a < this.plugins.length; a++) {\n if (this.plugins[a].supports(extensibilityPoint)) {\n return this.plugins[a].init();\n }\n }\n\n return null;\n};\n\nmodule.exports = PluginHandler;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/plugins.js\n// module id = 46\n// module chunks = 0","/* eslint-disable no-restricted-syntax */\n/* eslint-disable guard-for-in */\nvar WinChan = require('winchan');\n\nvar windowHandler = require('./window');\nvar objectHelper = require('./object');\nvar qs = require('qs');\n\nfunction PopupHandler() {\n this._current_popup = null;\n}\n\nPopupHandler.prototype.calculatePosition = function(options) {\n var width = options.width || 500;\n var height = options.height || 600;\n var _window = windowHandler.getWindow();\n\n var screenX = typeof _window.screenX !== 'undefined' ? _window.screenX : _window.screenLeft;\n var screenY = typeof _window.screenY !== 'undefined' ? _window.screenY : _window.screenTop;\n\n var outerWidth = typeof _window.outerWidth !== 'undefined'\n ? _window.outerWidth\n : _window.document.body.clientWidth;\n\n var outerHeight = typeof _window.outerHeight !== 'undefined'\n ? _window.outerHeight\n : _window.document.body.clientHeight;\n\n var left = (outerWidth - width) / 2;\n var top = (outerHeight - height) / 2;\n\n return { width: width, height: height, left: screenX + left, top: screenY + top };\n};\n\nPopupHandler.prototype.preload = function(options) {\n var _this = this;\n var _window = windowHandler.getWindow();\n var popupPosition = this.calculatePosition(options.popupOptions || {});\n var popupOptions = objectHelper.merge(popupPosition).with(options.popupOptions);\n var url = options.url || 'about:blank';\n var windowFeatures = qs.stringify(popupOptions, {\n encode: false,\n delimiter: ','\n });\n\n if (this._current_popup && !this._current_popup.closed) {\n return this._current_popup;\n }\n\n this._current_popup = _window.open(url, 'auth0_signup_popup', windowFeatures);\n\n this._current_popup.kill = function() {\n this.close();\n _this._current_popup = null;\n };\n\n return this._current_popup;\n};\n\nPopupHandler.prototype.load = function(url, relayUrl, options, cb) {\n var _this = this;\n var popupPosition = this.calculatePosition(options.popupOptions || {});\n var popupOptions = objectHelper.merge(popupPosition).with(options.popupOptions);\n\n var winchanOptions = objectHelper\n .merge({\n url: url,\n relay_url: relayUrl,\n window_features: qs.stringify(popupOptions, {\n delimiter: ',',\n encode: false\n }),\n popup: this._current_popup\n })\n .with(options);\n\n var popup = WinChan.open(winchanOptions, function(err, data) {\n _this._current_popup = null;\n return cb(err, data);\n });\n\n popup.focus();\n\n return popup;\n};\n\nmodule.exports = PopupHandler;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/popup-handler.js\n// module id = 47\n// module chunks = 0","var windowHelper = require('./window');\n\nfunction randomString(length) {\n // eslint-disable-next-line\n var bytes = new Uint8Array(length);\n var result = [];\n var charset = '0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._~';\n\n var cryptoObj = windowHelper.getWindow().crypto || windowHelper.getWindow().msCrypto;\n if (!cryptoObj) {\n return null;\n }\n\n var random = cryptoObj.getRandomValues(bytes);\n\n for (var a = 0; a < random.length; a++) {\n result.push(charset[random[a] % charset.length]);\n }\n\n return result.join('');\n}\n\nmodule.exports = {\n randomString: randomString\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/random.js\n// module id = 48\n// module chunks = 0","var StorageHandler = require('./storage/handler');\nvar storage;\n\nfunction getStorage(force) {\n if (!storage || force) {\n storage = new StorageHandler();\n }\n return storage;\n}\n\nmodule.exports = {\n getItem: function(key) {\n var value = getStorage().getItem(key);\n return value ? JSON.parse(value) : value;\n },\n removeItem: function(key) {\n return getStorage().removeItem(key);\n },\n setItem: function(key, value) {\n var json = JSON.stringify(value);\n return getStorage().setItem(key, json);\n },\n reload: function() {\n getStorage(true);\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/storage.js\n// module id = 49\n// module chunks = 0","var cookies = require('../cookies');\n\nfunction CookieStorage() {}\n\nCookieStorage.prototype.getItem = function(key) {\n return cookies.read(key);\n};\n\nCookieStorage.prototype.removeItem = function(key) {\n cookies.erase(key);\n};\n\nCookieStorage.prototype.setItem = function(key, value) {\n cookies.create(key, value, 1);\n};\n\nmodule.exports = CookieStorage;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/storage/cookie.js\n// module id = 50\n// module chunks = 0","function DummyStorage() {}\n\nDummyStorage.prototype.getItem = function() {\n return null;\n};\n\nDummyStorage.prototype.removeItem = function() {};\n\nDummyStorage.prototype.setItem = function() {};\n\nmodule.exports = DummyStorage;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/storage/dummy.js\n// module id = 51\n// module chunks = 0","var windowHandler = require('../window');\nvar DummyStorage = require('./dummy');\nvar CookieStorage = require('./cookie');\nvar Warn = require('../warn');\n\nfunction StorageHandler() {\n this.warn = new Warn({});\n this.storage = windowHandler.getWindow().localStorage || new CookieStorage();\n}\n\nStorageHandler.prototype.failover = function() {\n if (this.storage instanceof DummyStorage) {\n this.warn.warning('DummyStorage: ignore failover');\n return;\n } else if (this.storage instanceof CookieStorage) {\n this.warn.warning('CookieStorage: failing over DummyStorage');\n this.storage = new DummyStorage();\n } else {\n this.warn.warning('LocalStorage: failing over CookieStorage');\n this.storage = new CookieStorage();\n }\n};\n\nStorageHandler.prototype.getItem = function(key) {\n try {\n return this.storage.getItem(key);\n } catch (e) {\n this.warn.warning(e);\n this.failover();\n return this.getItem(key);\n }\n};\n\nStorageHandler.prototype.removeItem = function(key) {\n try {\n return this.storage.removeItem(key);\n } catch (e) {\n this.warn.warning(e);\n this.failover();\n return this.removeItem(key);\n }\n};\n\nStorageHandler.prototype.setItem = function(key, value) {\n try {\n return this.storage.setItem(key, value);\n } catch (e) {\n this.warn.warning(e);\n this.failover();\n return this.setItem(key, value);\n }\n};\n\nmodule.exports = StorageHandler;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/storage/handler.js\n// module id = 52\n// module chunks = 0","// given a URL, extract the origin. Taken from: https://github.com/firebase/firebase-simple-login/blob/d2cb95b9f812d8488bdbfba51c3a7c153ba1a074/js/src/simple-login/transports/WinChan.js#L25-L30\nfunction extractOrigin(url) {\n if (!/^https?:\\/\\//.test(url)) url = window.location.href;\n var m = /^(https?:\\/\\/[-_a-zA-Z.0-9:]+)/.exec(url);\n if (m) return m[1];\n return url;\n}\n\nmodule.exports = {\n extractOrigin: extractOrigin\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/url.js\n// module id = 53\n// module chunks = 0","var Authentication = require('./authentication');\nvar Management = require('./management');\nvar WebAuth = require('./web-auth');\nvar version = require('./version');\n\nmodule.exports = {\n Authentication: Authentication,\n Management: Management,\n WebAuth: WebAuth,\n version: version.raw\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/index.js\n// module id = 54\n// module chunks = 0","var urljoin = require('url-join');\n\nvar RequestBuilder = require('../helper/request-builder');\nvar assert = require('../helper/assert');\nvar responseHandler = require('../helper/response-handler');\n\n/**\n * Auth0 Management API Client (methods allowed to be called from the browser only)\n * @constructor\n * @param {Object} options\n * @param {Object} options.domain your Auth0 acount domain\n * @param {Object} options.token a valid API token\n */\nfunction Management(options) {\n /* eslint-disable */\n assert.check(\n options,\n { type: 'object', message: 'options parameter is not valid' },\n {\n domain: { type: 'string', message: 'domain option is required' },\n token: { type: 'string', message: 'token option is required' },\n _sendTelemetry: {\n optional: true,\n type: 'boolean',\n message: '_sendTelemetry option is not valid'\n },\n _telemetryInfo: {\n optional: true,\n type: 'object',\n message: '_telemetryInfo option is not valid'\n }\n }\n );\n /* eslint-enable */\n\n this.baseOptions = options;\n\n this.baseOptions.headers = { Authorization: 'Bearer ' + this.baseOptions.token };\n\n this.request = new RequestBuilder(this.baseOptions);\n this.baseOptions.rootUrl = urljoin('https://' + this.baseOptions.domain, 'api', 'v2');\n}\n\n/**\n * @callback userCallback\n * @param {Error} [err] failure reason for the failed request to Management API\n * @param {Object} [result] user profile\n */\n\n/**\n * Returns the user profile\n *\n * @method getUser\n * @param {String} userId identifier of the user to retrieve\n * @param {userCallback} cb\n * @see https://auth0.com/docs/api/management/v2#!/Users/get_users_by_id\n */\nManagement.prototype.getUser = function(userId, cb) {\n var url;\n\n assert.check(userId, { type: 'string', message: 'userId parameter is not valid' });\n assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\n url = urljoin(this.baseOptions.rootUrl, 'users', userId);\n\n return this.request.get(url).end(responseHandler(cb, { ignoreCasing: true }));\n};\n\n/**\n * Updates the user metdata. It will patch the user metdata with the attributes sent.\n *\n *\n * @method patchUserMetadata\n * @param {String} userId\n * @param {Object} userMetadata\n * @param {userCallback} cb\n * @see {@link https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id}\n */\nManagement.prototype.patchUserMetadata = function(userId, userMetadata, cb) {\n var url;\n\n assert.check(userId, { type: 'string', message: 'userId parameter is not valid' });\n assert.check(userMetadata, { type: 'object', message: 'userMetadata parameter is not valid' });\n assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\n url = urljoin(this.baseOptions.rootUrl, 'users', userId);\n\n return this.request\n .patch(url)\n .send({ user_metadata: userMetadata })\n .end(responseHandler(cb, { ignoreCasing: true }));\n};\n\n/**\n * Link two users\n *\n * @method linkUser\n * @param {String} userId\n * @param {String} secondaryUserToken\n * @param {userCallback} cb\n * @see {@link https://auth0.com/docs/api/management/v2#!/Users/post_identities}\n */\nManagement.prototype.linkUser = function(userId, secondaryUserToken, cb) {\n var url;\n /* eslint-disable */\n assert.check(userId, { type: 'string', message: 'userId parameter is not valid' });\n assert.check(secondaryUserToken, {\n type: 'string',\n message: 'secondaryUserToken parameter is not valid'\n });\n assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n /* eslint-enable */\n\n url = urljoin(this.baseOptions.rootUrl, 'users', userId, 'identities');\n\n return this.request\n .post(url)\n .send({ link_with: secondaryUserToken })\n .end(responseHandler(cb, { ignoreCasing: true }));\n};\n\nmodule.exports = Management;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/management/index.js\n// module id = 55\n// module chunks = 0","var urljoin = require('url-join');\n\nvar windowHelper = require('../helper/window');\nvar objectHelper = require('../helper/object');\nvar RequestBuilder = require('../helper/request-builder');\n\nfunction CrossOriginAuthentication(webAuth, options) {\n this.webAuth = webAuth;\n this.baseOptions = options;\n this.request = new RequestBuilder(options);\n}\n\nfunction getFragment(name) {\n var theWindow = windowHelper.getWindow();\n var value = '&' + theWindow.location.hash.substring(1);\n var parts = value.split('&' + name + '=');\n if (parts.length === 2) {\n return parts.pop().split('&').shift();\n }\n}\n\nfunction createKey(origin, coId) {\n return ['co/verifier', encodeURIComponent(origin), encodeURIComponent(coId)].join('/');\n}\n\n/**\n * Logs in the user with username and password using the cross origin authentication (/co/authenticate) flow. You can use either `username` or `email` to identify the user, but `username` will take precedence over `email`.\n * This only works when 3rd party cookies are enabled in the browser. After the /co/authenticate call, you'll have to use the {@link parseHash} function at the `redirectUri` specified in the constructor.\n *\n * @method login\n * @param {Object} options options used in the {@link authorize} call after the login_ticket is acquired\n * @param {String} [options.username] Username (mutually exclusive with email)\n * @param {String} [options.email] Email (mutually exclusive with username)\n * @param {String} options.password Password\n * @param {String} [options.realm] Realm used to authenticate the user, it can be a realm name or a database connection name\n * @param {crossOriginLoginCallback} cb Callback function called only when an authentication error, like invalid username or password, occurs. For other types of errors, there will be a redirect to the `redirectUri`.\n */\nCrossOriginAuthentication.prototype.login = function(options, cb) {\n var _this = this;\n var theWindow = windowHelper.getWindow();\n var url = urljoin(this.baseOptions.rootUrl, '/co/authenticate');\n var authenticateBody = {\n client_id: options.clientID || this.baseOptions.clientID,\n username: options.username || options.email\n };\n if (options.password) {\n authenticateBody.password = options.password;\n }\n if (options.otp) {\n authenticateBody.otp = options.otp;\n }\n var realm = options.realm || this.baseOptions.realm;\n\n if (realm) {\n var credentialType =\n options.credentialType ||\n this.baseOptions.credentialType ||\n 'http://auth0.com/oauth/grant-type/password-realm';\n authenticateBody.realm = realm;\n authenticateBody.credential_type = credentialType;\n } else {\n authenticateBody.credential_type = 'password';\n }\n this.request.post(url).withCredentials().send(authenticateBody).end(function(err, data) {\n if (err) {\n var errorObject = (err.response && err.response.body) || {\n error: 'request_error',\n error_description: JSON.stringify(err)\n };\n return cb(errorObject);\n }\n options = objectHelper.blacklist(options, ['username', 'password', 'credentialType', 'otp']);\n var authorizeOptions = objectHelper\n .merge(options)\n .with({ loginTicket: data.body.login_ticket });\n var key = createKey(_this.baseOptions.rootUrl, data.body.co_id);\n theWindow.sessionStorage[key] = data.body.co_verifier;\n _this.webAuth.authorize(authorizeOptions);\n });\n};\n\nfunction tryGetVerifier(theWindow, key) {\n try {\n var verifier = theWindow.sessionStorage[key];\n theWindow.sessionStorage.removeItem(key);\n return verifier;\n } catch (e) {\n return '';\n }\n}\n\n/**\n * Runs the callback code for the cross origin authentication call. This method is meant to be called by the cross origin authentication callback url.\n *\n * @method callback\n */\nCrossOriginAuthentication.prototype.callback = function() {\n var targetOrigin = decodeURIComponent(getFragment('origin'));\n var theWindow = windowHelper.getWindow();\n\n theWindow.addEventListener('message', function(evt) {\n if (evt.data.type !== 'co_verifier_request') {\n return;\n }\n var key = createKey(evt.origin, evt.data.request.id);\n var verifier = tryGetVerifier(theWindow, key);\n\n evt.source.postMessage(\n {\n type: 'co_verifier_response',\n response: {\n verifier: verifier\n }\n },\n evt.origin\n );\n });\n\n theWindow.parent.postMessage({ type: 'ready' }, targetOrigin);\n};\n\nmodule.exports = CrossOriginAuthentication;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/web-auth/cross-origin-authentication.js\n// module id = 56\n// module chunks = 0","var IdTokenVerifier = require('idtoken-verifier');\n\nvar assert = require('../helper/assert');\nvar error = require('../helper/error');\nvar qs = require('qs');\nvar PluginHandler = require('../helper/plugins');\nvar windowHelper = require('../helper/window');\nvar objectHelper = require('../helper/object');\nvar TransactionManager = require('./transaction-manager');\nvar Authentication = require('../authentication');\nvar Redirect = require('./redirect');\nvar Popup = require('./popup');\nvar SilentAuthenticationHandler = require('./silent-authentication-handler');\nvar CrossOriginAuthentication = require('./cross-origin-authentication');\n/**\n * Handles all the browser's AuthN/AuthZ flows\n * @constructor\n * @param {Object} options\n * @param {String} options.domain your Auth0 domain\n * @param {String} options.clientID your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard\n * @param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorization Response\n * @param {String} [options.responseType] type of the response used by OAuth 2.0 flow. It can be any space separated list of the values `code`, `token`, `id_token`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0}\n * @param {String} [options.responseMode] how the Auth response is encoded and redirected back to the client. Supported values are `query`, `fragment` and `form_post`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes}\n * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email`\n * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth\n * @param {Array} [options.plugins]\n * @param {Number} [options._timesToRetryFailedRequests] Number of times to retry a failed request, according to {@link https://github.com/visionmedia/superagent/blob/master/lib/should-retry.js}\n * @see {@link https://auth0.com/docs/api/authentication}\n */\nfunction WebAuth(options) {\n /* eslint-disable */\n assert.check(\n options,\n { type: 'object', message: 'options parameter is not valid' },\n {\n domain: { type: 'string', message: 'domain option is required' },\n clientID: { type: 'string', message: 'clientID option is required' },\n responseType: { optional: true, type: 'string', message: 'responseType is not valid' },\n responseMode: { optional: true, type: 'string', message: 'responseMode is not valid' },\n redirectUri: { optional: true, type: 'string', message: 'redirectUri is not valid' },\n scope: { optional: true, type: 'string', message: 'scope is not valid' },\n audience: { optional: true, type: 'string', message: 'audience is not valid' },\n leeway: { optional: true, type: 'number', message: 'leeway is not valid' },\n plugins: { optional: true, type: 'array', message: 'plugins is not valid' },\n _disableDeprecationWarnings: {\n optional: true,\n type: 'boolean',\n message: '_disableDeprecationWarnings option is not valid'\n },\n _sendTelemetry: {\n optional: true,\n type: 'boolean',\n message: '_sendTelemetry option is not valid'\n },\n _telemetryInfo: {\n optional: true,\n type: 'object',\n message: '_telemetryInfo option is not valid'\n },\n _timesToRetryFailedRequests: {\n optional: true,\n type: 'number',\n message: '_timesToRetryFailedRequests option is not valid'\n }\n }\n );\n\n if (options.overrides) {\n assert.check(\n options.overrides,\n { type: 'object', message: 'overrides option is not valid' },\n {\n __tenant: { type: 'string', message: '__tenant option is required' },\n __token_issuer: { type: 'string', message: '__token_issuer option is required' }\n }\n );\n }\n /* eslint-enable */\n\n this.baseOptions = options;\n this.baseOptions.plugins = new PluginHandler(this, this.baseOptions.plugins || []);\n\n this.baseOptions._sendTelemetry = this.baseOptions._sendTelemetry === false\n ? this.baseOptions._sendTelemetry\n : true;\n\n this.baseOptions._timesToRetryFailedRequests = options._timesToRetryFailedRequests\n ? parseInt(options._timesToRetryFailedRequests, 0)\n : 0;\n\n this.baseOptions.tenant =\n (this.baseOptions.overrides && this.baseOptions.overrides.__tenant) ||\n this.baseOptions.domain.split('.')[0];\n\n this.baseOptions.token_issuer =\n (this.baseOptions.overrides && this.baseOptions.overrides.__token_issuer) ||\n 'https://' + this.baseOptions.domain + '/';\n\n this.transactionManager = new TransactionManager(this.baseOptions.transaction);\n\n this.client = new Authentication(this.baseOptions);\n this.redirect = new Redirect(this.client, this.baseOptions);\n this.popup = new Popup(this, this.baseOptions);\n this.crossOriginAuthentication = new CrossOriginAuthentication(this, this.baseOptions);\n}\n\n/**\n * Parse the url hash and extract the Auth response from a Auth flow started with {@link authorize}\n *\n * Only validates id_tokens signed by Auth0 using the RS256 algorithm using the public key exposed\n * by the `/.well-known/jwks.json` endpoint of your account.\n * Tokens signed with other algorithms, e.g. HS256 will not be accepted.\n *\n * @method parseHash\n * @param {Object} options\n * @param {String} options.hash the url hash. If not provided it will extract from window.location.hash\n * @param {String} [options.state] value originally sent in `state` parameter to {@link authorize} to mitigate XSRF\n * @param {String} [options.nonce] value originally sent in `nonce` parameter to {@link authorize} to prevent replay attacks\n * @param {String} [options._idTokenVerification] makes parseHash perform or skip `id_token` verification. We **strongly** recommend validating the `id_token` yourself if you disable the verification.\n * @param {authorizeCallback} cb\n */\nWebAuth.prototype.parseHash = function(options, cb) {\n var parsedQs;\n var err;\n var state;\n var transaction;\n var transactionNonce;\n\n if (!cb && typeof options === 'function') {\n cb = options;\n options = {};\n } else {\n options = options || {};\n }\n\n options._idTokenVerification = !(options._idTokenVerification === false);\n\n var _window = windowHelper.getWindow();\n\n var hashStr = options.hash === undefined ? _window.location.hash : options.hash;\n hashStr = hashStr.replace(/^#?\\/?/, '');\n\n parsedQs = qs.parse(hashStr);\n\n if (parsedQs.hasOwnProperty('error')) {\n err = error.buildResponse(parsedQs.error, parsedQs.error_description);\n\n if (parsedQs.state) {\n err.state = parsedQs.state;\n }\n\n return cb(err);\n }\n\n if (\n !parsedQs.hasOwnProperty('access_token') &&\n !parsedQs.hasOwnProperty('id_token') &&\n !parsedQs.hasOwnProperty('refresh_token')\n ) {\n return cb(null, null);\n }\n\n state = parsedQs.state || options.state;\n\n transaction = this.transactionManager.getStoredTransaction(state);\n transactionNonce = options.nonce || (transaction && transaction.nonce) || null;\n\n var applicationStatus = (transaction && transaction.appStatus) || null;\n if (parsedQs.id_token && options._idTokenVerification) {\n return this.validateToken(parsedQs.id_token, transactionNonce, function(\n validationError,\n payload\n ) {\n if (validationError) {\n return cb(validationError);\n }\n return cb(null, buildParseHashResponse(parsedQs, applicationStatus, payload));\n });\n }\n\n if (parsedQs.id_token) {\n var verifier = new IdTokenVerifier({\n issuer: this.baseOptions.token_issuer,\n audience: this.baseOptions.clientID,\n leeway: this.baseOptions.leeway || 0,\n __disableExpirationCheck: this.baseOptions.__disableExpirationCheck\n });\n\n var decodedToken = verifier.decode(parsedQs.id_token);\n cb(null, buildParseHashResponse(parsedQs, applicationStatus, decodedToken.payload));\n } else {\n cb(null, buildParseHashResponse(parsedQs, applicationStatus, null));\n }\n};\n\nfunction buildParseHashResponse(qsParams, appStatus, token) {\n return {\n accessToken: qsParams.access_token || null,\n idToken: qsParams.id_token || null,\n idTokenPayload: token || null,\n appStatus: appStatus || null,\n refreshToken: qsParams.refresh_token || null,\n state: qsParams.state || null,\n expiresIn: qsParams.expires_in ? parseInt(qsParams.expires_in, 10) : null,\n tokenType: qsParams.token_type || null,\n scope: qsParams.scope || null\n };\n}\n\n/**\n * @callback validateTokenCallback\n * @param {Error} [err] error returned by while validating the token\n * @param {Object} [payload] claims stored in the token\n */\n\n/**\n * Decodes the a JWT and verifies its nonce value\n *\n * @method validateToken\n * @private\n * @param {String} token\n * @param {String} nonce\n * @param {validateTokenCallback} cb\n */\nWebAuth.prototype.validateToken = function(token, nonce, cb) {\n var verifier = new IdTokenVerifier({\n issuer: this.baseOptions.token_issuer,\n audience: this.baseOptions.clientID,\n leeway: this.baseOptions.leeway || 0,\n __disableExpirationCheck: this.baseOptions.__disableExpirationCheck\n });\n\n verifier.verify(token, nonce, function(err, payload) {\n if (err) {\n return cb(error.invalidJwt(err.message));\n }\n\n cb(null, payload);\n });\n};\n\n/**\n * Executes a silent authentication transaction under the hood in order to fetch a new tokens for the current session.\n * This method requires that all Auth is performed with {@link authorize}\n * Watch out! If you're not using the hosted login page to do social logins, you have to use your own [social connection keys](https://manage.auth0.com/#/connections/social). If you use Auth0's dev keys, you'll always get `login_required` as an error when calling this method.\n *\n * @method renewAuth\n * @param {Object} options\n * @param {String} [options.domain] your Auth0 domain\n * @param {String} [options.clientID] your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard\n * @param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorization Response\n * @param {String} [options.responseType] type of the response used by OAuth 2.0 flow. It can be any space separated list of the values `code`, `token`, `id_token`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0}\n * @param {String} [options.responseMode] how the Auth response is encoded and redirected back to the client. Supported values are `query`, `fragment` and `form_post`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes}\n * @param {String} [options.state] value used to mitigate XSRF attacks. {@link https://auth0.com/docs/protocols/oauth2/oauth-state}\n * @param {String} [options.nonce] value used to mitigate replay attacks when using Implicit Grant. {@link https://auth0.com/docs/api-auth/tutorials/nonce}\n * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email`\n * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth\n * @param {String} [options.postMessageDataType] identifier data type to look for in postMessage event data, where events are initiated from silent callback urls, before accepting a message event is the event expected. A value of false means any postMessage event will trigger a callback.\n * @see {@link https://auth0.com/docs/api/authentication#authorize-client}\n */\nWebAuth.prototype.renewAuth = function(options, cb) {\n var handler;\n var usePostMessage = !!options.usePostMessage;\n var postMessageDataType = options.postMessageDataType || false;\n var _this = this;\n\n var params = objectHelper\n .merge(this.baseOptions, [\n 'clientID',\n 'redirectUri',\n 'responseType',\n 'scope',\n 'audience',\n '_csrf',\n 'state',\n '_intstate',\n 'nonce'\n ])\n .with(options);\n\n params.responseType = params.responseType || 'token';\n params.responseMode = params.responseMode || 'fragment';\n if (!options.nonce) {\n params = this.transactionManager.process(params);\n }\n\n assert.check(params, { type: 'object', message: 'options parameter is not valid' });\n assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\n params.prompt = 'none';\n\n params = objectHelper.blacklist(params, ['usePostMessage', 'tenant', 'postMessageDataType']);\n\n handler = SilentAuthenticationHandler.create({\n authenticationUrl: this.client.buildAuthorizeUrl(params),\n postMessageDataType: postMessageDataType\n });\n\n handler.login(usePostMessage, function(err, hash) {\n if (typeof hash === 'object') {\n // hash was already parsed, so we just return it.\n // it's here to be backwards compatible and should be removed in the next major version.\n return cb(err, hash);\n }\n var transaction = _this.transactionManager.getStoredTransaction(params.state);\n var transactionNonce = options.nonce || (transaction && transaction.nonce) || null;\n var transactionState = options.state || (transaction && transaction.state) || null;\n _this.parseHash({ hash: hash, nonce: transactionNonce, state: transactionState }, cb);\n });\n};\n\n/**\n * Request an email with instruction to change a user's password\n *\n * @method changePassword\n * @param {Object} options\n * @param {String} options.email address where the user will recieve the change password email. It should match the user's email in Auth0\n * @param {String} options.connection name of the connection where the user was created\n * @param {changePasswordCallback} cb\n * @see {@link https://auth0.com/docs/api/authentication#change-password}\n */\nWebAuth.prototype.changePassword = function(options, cb) {\n return this.client.dbConnection.changePassword(options, cb);\n};\n\n/**\n * Starts a passwordless authentication transaction.\n *\n * @method passwordlessStart\n * @param {Object} options\n * @param {String} options.send what will be sent via email which could be `link` or `code`. For SMS `code` is the only one valud\n * @param {String} [options.phoneNumber] phone number where to send the `code`. This parameter is mutually exclusive with `email`\n * @param {String} [options.email] email where to send the `code` or `link`. This parameter is mutually exclusive with `phoneNumber`\n * @param {String} options.connection name of the passwordless connection\n * @param {Object} [options.authParams] additional Auth parameters when using `link`\n * @param {Function} cb\n * @see {@link https://auth0.com/docs/api/authentication#passwordless}\n */\nWebAuth.prototype.passwordlessStart = function(options, cb) {\n return this.client.passwordless.start(options, cb);\n};\n\n/**\n * Creates a new user in a Auth0 Database connection\n *\n * @method signup\n * @param {Object} options\n * @param {String} options.email user email address\n * @param {String} options.password user password\n * @param {String} options.connection name of the connection where the user will be created\n * @param {signUpCallback} cb\n * @see {@link https://auth0.com/docs/api/authentication#signup}\n */\nWebAuth.prototype.signup = function(options, cb) {\n return this.client.dbConnection.signup(options, cb);\n};\n\n/**\n * Redirects to the hosted login page (`/authorize`) in order to start a new authN/authZ transaction.\n * After that, you'll have to use the {@link parseHash} function at the specified `redirectUri`.\n *\n * @method authorize\n * @param {Object} options\n * @param {String} [options.domain] your Auth0 domain\n * @param {String} [options.clientID] your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard\n * @param {String} options.redirectUri url that the Auth0 will redirect after Auth with the Authorization Response\n * @param {String} options.responseType type of the response used by OAuth 2.0 flow. It can be any space separated list of the values `code`, `token`, `id_token`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0}\n * @param {String} [options.responseMode] how the Auth response is encoded and redirected back to the client. Supported values are `query`, `fragment` and `form_post`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes}\n * @param {String} [options.state] value used to mitigate XSRF attacks. {@link https://auth0.com/docs/protocols/oauth2/oauth-state}\n * @param {String} [options.nonce] value used to mitigate replay attacks when using Implicit Grant. {@link https://auth0.com/docs/api-auth/tutorials/nonce}\n * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email`\n * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth\n * @see {@link https://auth0.com/docs/api/authentication#authorize-client}\n */\nWebAuth.prototype.authorize = function(options) {\n var params = objectHelper\n .merge(this.baseOptions, [\n 'clientID',\n 'responseType',\n 'responseMode',\n 'redirectUri',\n 'scope',\n 'audience',\n '_csrf',\n 'state',\n '_intstate',\n 'nonce'\n ])\n .with(options);\n\n assert.check(\n params,\n { type: 'object', message: 'options parameter is not valid' },\n {\n responseType: { type: 'string', message: 'responseType option is required' }\n }\n );\n\n params = this.transactionManager.process(params);\n\n windowHelper.redirect(this.client.buildAuthorizeUrl(params));\n};\n\n/**\n * Signs up a new user, automatically logs the user in after the signup and returns the user token.\n * The login will be done using /oauth/token with password-realm grant type.\n *\n * @method signupAndAuthorize\n * @param {Object} options\n * @param {String} options.email user email address\n * @param {String} options.password user password\n * @param {String} options.connection name of the connection where the user will be created\n * @param {tokenCallback} cb\n * @see {@link https://auth0.com/docs/api/authentication#signup}\n * @see {@link https://auth0.com/docs/api-auth/grant/password}\n */\nWebAuth.prototype.signupAndAuthorize = function(options, cb) {\n var _this = this;\n\n return this.client.dbConnection.signup(\n objectHelper.blacklist(options, ['popupHandler']),\n function(err) {\n if (err) {\n return cb(err);\n }\n options.realm = options.connection;\n if (!options.username) {\n options.username = options.email;\n }\n _this.client.login(options, cb);\n }\n );\n};\n\n/**\n * @callback crossOriginLoginCallback\n * @param {Error} [err] Authentication error returned by Auth0 with the reason why the request failed\n */\n\n/**\n * Logs in the user with username and password using the cross origin authentication (/co/authenticate) flow. You can use either `username` or `email` to identify the user, but `username` will take precedence over `email`.\n * This only works when 3rd party cookies are enabled in the browser. After the /co/authenticate call, you'll have to use the {@link parseHash} function at the `redirectUri` specified in the constructor.\n *\n * @method login\n * @param {Object} options options used in the {@link authorize} call after the login_ticket is acquired\n * @param {String} [options.username] Username (mutually exclusive with email)\n * @param {String} [options.email] Email (mutually exclusive with username)\n * @param {String} options.password Password\n * @param {String} [options.realm] Realm used to authenticate the user, it can be a realm name or a database connection name\n * @param {crossOriginLoginCallback} cb Callback function called only when an authentication error, like invalid username or password, occurs. For other types of errors, there will be a redirect to the `redirectUri`.\n */\nWebAuth.prototype.login = function(options, cb) {\n this.crossOriginAuthentication.login(options, cb);\n};\n\n/**\n * Logs in the user by verifying the verification code (OTP) using the cross origin authentication (/co/authenticate) flow. You can use either `phoneNumber` or `email` to identify the user.\n * This only works when 3rd party cookies are enabled in the browser. After the /co/authenticate call, you'll have to use the {@link parseHash} function at the `redirectUri` specified in the constructor.\n *\n * @method login\n * @param {Object} options options used in the {@link authorize} call after the login_ticket is acquired\n * @param {String} [options.phoneNumber] Phone Number (mutually exclusive with email)\n * @param {String} [options.email] Email (mutually exclusive with username)\n * @param {String} options.verificationCode Verification Code (OTP)\n * @param {String} options.connection Passwordless connection to use. It can either be 'sms' or 'email'.\n * @param {crossOriginLoginCallback} cb Callback function called only when an authentication error, like invalid username or password, occurs. For other types of errors, there will be a redirect to the `redirectUri`.\n */\nWebAuth.prototype.passwordlessLogin = function(options, cb) {\n var loginOptions = objectHelper.extend(\n {\n credentialType: 'http://auth0.com/oauth/grant-type/passwordless/otp',\n realm: options.connection,\n username: options.email || options.phoneNumber,\n otp: options.verificationCode\n },\n objectHelper.blacklist(options, ['connection', 'email', 'phoneNumber', 'verificationCode'])\n );\n this.crossOriginAuthentication.login(loginOptions, cb);\n};\n\n/**\n * Runs the callback code for the cross origin authentication call. This method is meant to be called by the cross origin authentication callback url.\n *\n * @method crossOriginAuthenticationCallback\n */\nWebAuth.prototype.crossOriginAuthenticationCallback = function() {\n this.crossOriginAuthentication.callback();\n};\n\n/**\n * Redirects to the auth0 logout endpoint\n *\n * If you want to navigate the user to a specific URL after the logout, set that URL at the returnTo parameter. The URL should be included in any the appropriate Allowed Logout URLs list:\n *\n * - If the client_id parameter is included, the returnTo URL must be listed in the Allowed Logout URLs set at the client level (see Setting Allowed Logout URLs at the App Level).\n * - If the client_id parameter is NOT included, the returnTo URL must be listed in the Allowed Logout URLs set at the account level (see Setting Allowed Logout URLs at the Account Level).\n *\n * @method logout\n * @param {Object} options\n * @param {String} [options.clientID] identifier of your client\n * @param {String} [options.returnTo] URL to be redirected after the logout\n * @param {Boolean} [options.federated] tells Auth0 if it should logout the user also from the IdP.\n * @see {@link https://auth0.com/docs/api/authentication#logout}\n */\nWebAuth.prototype.logout = function(options) {\n windowHelper.redirect(this.client.buildLogoutUrl(options));\n};\n\n/**\n * Verifies the passwordless TOTP and redirects to finish the passwordless transaction\n *\n * @method passwordlessVerify\n * @param {Object} options\n * @param {String} options.type `sms` or `email`\n * @param {String} options.phoneNumber only if type = sms\n * @param {String} options.email only if type = email\n * @param {String} options.connection the connection name\n * @param {String} options.verificationCode the TOTP code\n * @param {Function} cb\n */\nWebAuth.prototype.passwordlessVerify = function(options, cb) {\n var _this = this;\n var params = objectHelper\n .merge(this.baseOptions, [\n 'clientID',\n 'responseType',\n 'responseMode',\n 'redirectUri',\n 'scope',\n 'audience',\n '_csrf',\n 'state',\n '_intstate',\n 'nonce'\n ])\n .with(options);\n\n assert.check(\n params,\n { type: 'object', message: 'options parameter is not valid' },\n {\n responseType: { type: 'string', message: 'responseType option is required' }\n }\n );\n\n params = this.transactionManager.process(params);\n return this.client.passwordless.verify(params, function(err) {\n if (err) {\n return cb(err);\n }\n return windowHelper.redirect(_this.client.passwordless.buildVerifyUrl(params));\n });\n};\n\nmodule.exports = WebAuth;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/web-auth/index.js\n// module id = 57\n// module chunks = 0","var urljoin = require('url-join');\nvar WinChan = require('winchan');\n\nvar urlHelper = require('../helper/url');\nvar assert = require('../helper/assert');\nvar responseHandler = require('../helper/response-handler');\nvar PopupHandler = require('../helper/popup-handler');\nvar objectHelper = require('../helper/object');\nvar Warn = require('../helper/warn');\nvar TransactionManager = require('./transaction-manager');\n\nfunction Popup(webAuth, options) {\n this.baseOptions = options;\n this.client = webAuth.client;\n this.webAuth = webAuth;\n\n this.transactionManager = new TransactionManager(this.baseOptions.transaction);\n this.warn = new Warn({\n disableWarnings: !!options._disableDeprecationWarnings\n });\n}\n\n/**\n * Returns a new instance of the popup handler\n *\n * @method buildPopupHandler\n * @private\n */\nPopup.prototype.buildPopupHandler = function() {\n var pluginHandler = this.baseOptions.plugins.get('popup.getPopupHandler');\n\n if (pluginHandler) {\n return pluginHandler.getPopupHandler();\n }\n\n return new PopupHandler();\n};\n\n/**\n * Initializes the popup window and returns the instance to be used later in order to avoid being blocked by the browser.\n *\n * @method preload\n * @param {Object} options receives the window height and width and any other window feature to be sent to window.open\n */\nPopup.prototype.preload = function(options) {\n options = options || {};\n\n var popup = this.buildPopupHandler();\n\n popup.preload(options);\n return popup;\n};\n\n/**\n * Internal use.\n *\n * @method getPopupHandler\n * @private\n */\nPopup.prototype.getPopupHandler = function(options, preload) {\n if (options.popupHandler) {\n return options.popupHandler;\n }\n\n if (preload) {\n return this.preload(options);\n }\n\n return this.buildPopupHandler();\n};\n\n/**\n * Handles the popup logic for the callback page.\n *\n * @method callback\n * @param {Object} options\n * @param {String} options.hash the url hash. If not provided it will extract from window.location.hash\n * @param {String} [options.state] value originally sent in `state` parameter to {@link authorize} to mitigate XSRF\n * @param {String} [options.nonce] value originally sent in `nonce` parameter to {@link authorize} to prevent replay attacks\n * @param {String} [options._idTokenVerification] makes parseHash perform or skip `id_token` verification. We **strongly** recommend validating the `id_token` yourself if you disable the verification.\n * @see {@link parseHash}\n */\nPopup.prototype.callback = function(options) {\n var _this = this;\n WinChan.onOpen(function(popupOrigin, r, cb) {\n _this.webAuth.parseHash(options || {}, function(err, data) {\n return cb(err || data);\n });\n });\n};\n\n/**\n * Shows inside a new window the hosted login page (`/authorize`) in order to start a new authN/authZ transaction and post its result using `postMessage`.\n *\n * @method authorize\n * @param {Object} options\n * @param {String} [options.domain] your Auth0 domain\n * @param {String} [options.clientID] your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard\n * @param {String} options.redirectUri url that the Auth0 will redirect after Auth with the Authorization Response\n * @param {String} options.responseType type of the response used by OAuth 2.0 flow. It can be any space separated list of the values `code`, `token`, `id_token`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0}\n * @param {String} [options.responseMode] how the Auth response is encoded and redirected back to the client. Supported values are `query`, `fragment` and `form_post`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes}\n * @param {String} [options.state] value used to mitigate XSRF attacks. {@link https://auth0.com/docs/protocols/oauth2/oauth-state}\n * @param {String} [options.nonce] value used to mitigate replay attacks when using Implicit Grant. {@link https://auth0.com/docs/api-auth/tutorials/nonce}\n * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email`\n * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth\n * @param {Boolean} [options.owp] determines if Auth0 should render the relay page or not and the caller is responsible of handling the response.\n * @param {authorizeCallback} cb\n * @see {@link https://auth0.com/docs/api/authentication#authorize-client}\n */\nPopup.prototype.authorize = function(options, cb) {\n var popup;\n var url;\n var relayUrl;\n var popOpts = {};\n\n var pluginHandler = this.baseOptions.plugins.get('popup.authorize');\n\n var params = objectHelper\n .merge(this.baseOptions, [\n 'clientID',\n 'scope',\n 'domain',\n 'audience',\n 'responseType',\n 'redirectUri',\n '_csrf',\n 'state',\n '_intstate',\n 'nonce'\n ])\n .with(objectHelper.blacklist(options, ['popupHandler']));\n\n assert.check(\n params,\n { type: 'object', message: 'options parameter is not valid' },\n {\n responseType: { type: 'string', message: 'responseType option is required' }\n }\n );\n\n // the relay page should not be necesary as long it happens in the same domain\n // (a redirectUri shoul be provided). It is necesary when using OWP\n relayUrl = urljoin(this.baseOptions.rootUrl, 'relay.html');\n\n // if a owp is enabled, it should use the owp flag\n if (options.owp) {\n // used by server to render the relay page instead of sending the chunk in the\n // url to the callback\n params.owp = true;\n } else {\n popOpts.origin = urlHelper.extractOrigin(params.redirectUri);\n relayUrl = params.redirectUri;\n }\n\n if (options.popupOptions) {\n popOpts.popupOptions = objectHelper.pick(options.popupOptions, ['width', 'height']);\n }\n\n if (pluginHandler) {\n params = pluginHandler.processParams(params);\n }\n\n params = this.transactionManager.process(params);\n\n delete params.domain;\n\n url = this.client.buildAuthorizeUrl(params);\n\n popup = this.getPopupHandler(options);\n\n return popup.load(url, relayUrl, popOpts, responseHandler(cb));\n};\n\n/**\n * Performs authentication with username/email and password with a database connection inside a new window\n *\n * This method is not compatible with API Auth so if you need to fetch API tokens with audience\n * you should use {@link authorize} or {@link login}.\n *\n * @method loginWithCredentials\n * @param {Object} options\n * @param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorization Response\n * @param {String} [options.responseType] type of the response used. It can be any of the values `code` and `token`\n * @param {String} [options.responseMode] how the AuthN response is encoded and redirected back to the client. Supported values are `query` and `fragment`\n * @param {String} [options.scope] scopes to be requested during AuthN. e.g. `openid email`\n * @param {credentialsCallback} cb\n */\nPopup.prototype.loginWithCredentials = function(options, cb) {\n var params;\n var popup;\n var url;\n var relayUrl;\n\n /* eslint-disable */\n assert.check(\n options,\n { type: 'object', message: 'options parameter is not valid' },\n {\n clientID: { optional: true, type: 'string', message: 'clientID option is required' },\n redirectUri: { optional: true, type: 'string', message: 'redirectUri option is required' },\n responseType: { optional: true, type: 'string', message: 'responseType option is required' },\n scope: { optional: true, type: 'string', message: 'scope option is required' },\n audience: { optional: true, type: 'string', message: 'audience option is required' }\n }\n );\n /* eslint-enable */\n\n popup = this.getPopupHandler(options);\n\n options = objectHelper\n .merge(this.baseOptions, [\n 'clientID',\n 'scope',\n 'domain',\n 'audience',\n '_csrf',\n 'state',\n '_intstate',\n 'nonce'\n ])\n .with(objectHelper.blacklist(options, ['popupHandler']));\n\n params = objectHelper.pick(options, ['clientID', 'domain']);\n params.options = objectHelper.toSnakeCase(\n objectHelper.pick(options, ['password', 'connection', 'state', 'scope', '_csrf', 'device'])\n );\n params.options.username = options.username || options.email;\n\n url = urljoin(this.baseOptions.rootUrl, 'sso_dbconnection_popup', options.clientID);\n relayUrl = urljoin(this.baseOptions.rootUrl, 'relay.html');\n\n return popup.load(url, relayUrl, { params: params }, responseHandler(cb));\n};\n\n/**\n * Verifies the passwordless TOTP and redirects to finish the passwordless transaction\n *\n * @method passwordlessVerify\n * @param {Object} options\n * @param {String} options.type `sms` or `email`\n * @param {String} options.phoneNumber only if type = sms\n * @param {String} options.email only if type = email\n * @param {String} options.connection the connection name\n * @param {String} options.verificationCode the TOTP code\n * @param {Function} cb\n */\nPopup.prototype.passwordlessVerify = function(options, cb) {\n var _this = this;\n return this.client.passwordless.verify(\n objectHelper.blacklist(options, ['popupHandler']),\n function(err) {\n if (err) {\n return cb(err);\n }\n\n options.username = options.phoneNumber || options.email;\n options.password = options.verificationCode;\n\n delete options.email;\n delete options.phoneNumber;\n delete options.verificationCode;\n delete options.type;\n\n _this.client.loginWithResourceOwner(options, cb);\n }\n );\n};\n\n/**\n * Signs up a new user and automatically logs the user in after the signup.\n *\n * This method is not compatible with API Auth so if you need to fetch API tokens with audience\n * you should use {@link authorize} or {@link signupAndAuthorize}.\n *\n * @method signupAndLogin\n * @param {Object} options\n * @param {String} options.email user email address\n * @param {String} options.password user password\n * @param {String} options.connection name of the connection where the user will be created\n * @param {credentialsCallback} cb\n */\nPopup.prototype.signupAndLogin = function(options, cb) {\n var _this = this;\n\n // Preload popup to avoid the browser to block it since the login happens later\n var popupHandler = this.getPopupHandler(options, true);\n options.popupHandler = popupHandler;\n\n return this.client.dbConnection.signup(\n objectHelper.blacklist(options, ['popupHandler']),\n function(err) {\n if (err) {\n if (popupHandler._current_popup) {\n popupHandler._current_popup.kill();\n }\n return cb(err);\n }\n _this.loginWithCredentials(options, cb);\n }\n );\n};\n\nmodule.exports = Popup;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/web-auth/popup.js\n// module id = 58\n// module chunks = 0","var UsernamePassword = require('./username-password');\nvar objectHelper = require('../helper/object');\nvar Warn = require('../helper/warn');\nvar assert = require('../helper/assert');\n\nfunction Redirect(client, options) {\n this.baseOptions = options;\n this.client = client;\n\n this.warn = new Warn({\n disableWarnings: !!options._disableDeprecationWarnings\n });\n}\n\n/**\n * @callback credentialsCallback\n * @param {Error} [err] error returned by Auth0 with the reason of the Auth failure\n * @param {Object} [result] result of the AuthN request\n * @param {String} result.accessToken token that can be used with {@link userinfo}\n * @param {String} [result.idToken] token that identifies the user\n * @param {String} [result.refreshToken] token that can be used to get new access tokens from Auth0. Note that not all clients can request them or the resource server might not allow them.\n */\n\n/**\n * Performs authentication with username/email and password with a database connection\n *\n * This method is not compatible with API Auth so if you need to fetch API tokens with audience\n * you should use {@link authorize} or {@link login}.\n *\n * @method loginWithCredentials\n * @param {Object} options\n * @param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorization Response\n * @param {String} [options.responseType] type of the response used. It can be any of the values `code` and `token`\n * @param {String} [options.responseMode] how the AuthN response is encoded and redirected back to the client. Supported values are `query` and `fragment`\n * @param {String} [options.scope] scopes to be requested during AuthN. e.g. `openid email`\n * @param {credentialsCallback} cb\n */\nRedirect.prototype.loginWithCredentials = function(options, cb) {\n var usernamePassword;\n\n var params = objectHelper\n .merge(this.baseOptions, [\n 'clientID',\n 'redirectUri',\n 'tenant',\n 'responseType',\n 'responseMode',\n 'scope',\n 'audience',\n '_csrf',\n 'state',\n '_intstate',\n 'nonce'\n ])\n .with(options);\n\n assert.check(\n params,\n { type: 'object', message: 'options parameter is not valid' },\n {\n responseType: { type: 'string', message: 'responseType option is required' }\n }\n );\n\n usernamePassword = new UsernamePassword(this.baseOptions);\n return usernamePassword.login(params, function(err, data) {\n if (err) {\n return cb(err);\n }\n return usernamePassword.callback(data);\n });\n};\n\n/**\n * Signs up a new user and automatically logs the user in after the signup.\n *\n * @method signupAndLogin\n * @param {Object} options\n * @param {String} options.email user email address\n * @param {String} options.password user password\n * @param {String} options.connection name of the connection where the user will be created\n * @param {credentialsCallback} cb\n */\nRedirect.prototype.signupAndLogin = function(options, cb) {\n var _this = this;\n return this.client.dbConnection.signup(options, function(err) {\n if (err) {\n return cb(err);\n }\n return _this.loginWithCredentials(options, cb);\n });\n};\n\nmodule.exports = Redirect;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/web-auth/redirect.js\n// module id = 59\n// module chunks = 0","var IframeHandler = require('../helper/iframe-handler');\n\nfunction SilentAuthenticationHandler(options) {\n this.authenticationUrl = options.authenticationUrl;\n this.timeout = options.timeout || 60 * 1000;\n this.handler = null;\n this.postMessageDataType = options.postMessageDataType || false;\n}\n\nSilentAuthenticationHandler.create = function(options) {\n return new SilentAuthenticationHandler(options);\n};\n\nSilentAuthenticationHandler.prototype.login = function(usePostMessage, callback) {\n this.handler = new IframeHandler({\n auth0: this.auth0,\n url: this.authenticationUrl,\n eventListenerType: usePostMessage ? 'message' : 'load',\n callback: this.getCallbackHandler(callback, usePostMessage),\n timeout: this.timeout,\n eventValidator: this.getEventValidator(),\n timeoutCallback: function() {\n callback(null, '#error=timeout&error_description=Timeout+during+authentication+renew.');\n },\n usePostMessage: usePostMessage || false\n });\n\n this.handler.init();\n};\n\nSilentAuthenticationHandler.prototype.getEventValidator = function() {\n var _this = this;\n return {\n isValid: function(eventData) {\n switch (eventData.event.type) {\n case 'message':\n // Default behaviour, return all message events.\n if (_this.postMessageDataType === false) {\n return true;\n }\n\n return (\n eventData.event.data.type && eventData.event.data.type === _this.postMessageDataType\n );\n\n case 'load': // Fall through to default\n default:\n return true;\n }\n }\n };\n};\n\nSilentAuthenticationHandler.prototype.getCallbackHandler = function(callback, usePostMessage) {\n return function(eventData) {\n var callbackValue;\n if (!usePostMessage) {\n callbackValue = eventData.sourceObject.contentWindow.location.hash;\n } else if (typeof eventData.event.data === 'object' && eventData.event.data.hash) {\n callbackValue = eventData.event.data.hash;\n } else {\n callbackValue = eventData.event.data;\n }\n callback(null, callbackValue);\n };\n};\n\nmodule.exports = SilentAuthenticationHandler;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/web-auth/silent-authentication-handler.js\n// module id = 60\n// module chunks = 0","var urljoin = require('url-join');\n\nvar objectHelper = require('../helper/object');\nvar RequestBuilder = require('../helper/request-builder');\nvar responseHandler = require('../helper/response-handler');\nvar windowHelper = require('../helper/window');\n\nfunction UsernamePassword(options) {\n this.baseOptions = options;\n this.request = new RequestBuilder(options);\n}\n\nUsernamePassword.prototype.login = function(options, cb) {\n var url;\n var body;\n\n url = urljoin(this.baseOptions.rootUrl, 'usernamepassword', 'login');\n\n options.username = options.username || options.email; // eslint-disable-line\n\n options = objectHelper.blacklist(options, ['email']); // eslint-disable-line\n\n body = objectHelper\n .merge(this.baseOptions, [\n 'clientID',\n 'redirectUri',\n 'tenant',\n 'responseType',\n 'responseMode',\n 'scope',\n 'audience'\n ])\n .with(options);\n\n body = objectHelper.toSnakeCase(body, ['auth0Client']);\n\n return this.request.post(url).send(body).end(responseHandler(cb));\n};\n\nUsernamePassword.prototype.callback = function(formHtml) {\n var div;\n var form;\n var _document = windowHelper.getDocument();\n\n div = _document.createElement('div');\n div.innerHTML = formHtml;\n form = _document.body.appendChild(div).children[0];\n\n form.submit();\n};\n\nmodule.exports = UsernamePassword;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/web-auth/username-password.js\n// module id = 61\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/build/cordova-auth0-plugin.js b/build/cordova-auth0-plugin.js new file mode 100644 index 00000000..533e610d --- /dev/null +++ b/build/cordova-auth0-plugin.js @@ -0,0 +1,980 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define("cordova-auth0-plugin", [], factory); + else if(typeof exports === 'object') + exports["cordova-auth0-plugin"] = factory(); + else + root["CordovaAuth0Plugin"] = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; +/******/ +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(37); + + +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (name, context, definition) { + if (typeof module !== 'undefined' && module.exports) module.exports = definition(); + else if (true) !(__WEBPACK_AMD_DEFINE_FACTORY__ = (definition), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + else context[name] = definition(); + })('urljoin', this, function () { + + function normalize (str, options) { + + // make sure protocol is followed by two slashes + str = str.replace(/:\//g, '://'); + + // remove consecutive slashes + str = str.replace(/([^:\s])\/+/g, '$1/'); + + // remove trailing slash before parameters or hash + str = str.replace(/\/(\?|&|#[^!])/g, '$1'); + + // replace ? in parameters with & + str = str.replace(/(\?.+)\?/g, '$1&'); + + return str; + } + + return function () { + var input = arguments; + var options = {}; + + if (typeof arguments[0] === 'object') { + // new syntax with array and options + input = arguments[0]; + options = arguments[1] || {}; + } + + var joined = [].slice.call(input, 0).join('/'); + return normalize(joined, options); + }; + + }); + + +/***/ }, +/* 2 */, +/* 3 */ +/***/ function(module, exports) { + + /* WEBPACK VAR INJECTION */(function(global) {function redirect(url) { + global.window.location = url; + } + + function getDocument() { + return global.window.document; + } + + function getWindow() { + return global.window; + } + + module.exports = { + redirect: redirect, + getDocument: getDocument, + getWindow: getWindow + }; + + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }, +/* 4 */, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var stringify = __webpack_require__(13); + var parse = __webpack_require__(12); + var formats = __webpack_require__(7); + + module.exports = { + formats: formats, + parse: parse, + stringify: stringify + }; + + +/***/ }, +/* 6 */, +/* 7 */ +/***/ function(module, exports) { + + 'use strict'; + + var replace = String.prototype.replace; + var percentTwenties = /%20/g; + + module.exports = { + 'default': 'RFC3986', + formatters: { + RFC1738: function (value) { + return replace.call(value, percentTwenties, '+'); + }, + RFC3986: function (value) { + return value; + } + }, + RFC1738: 'RFC1738', + RFC3986: 'RFC3986' + }; + + +/***/ }, +/* 8 */ +/***/ function(module, exports) { + + 'use strict'; + + var has = Object.prototype.hasOwnProperty; + + var hexTable = (function () { + var array = []; + for (var i = 0; i < 256; ++i) { + array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase()); + } + + return array; + }()); + + exports.arrayToObject = function (source, options) { + var obj = options && options.plainObjects ? Object.create(null) : {}; + for (var i = 0; i < source.length; ++i) { + if (typeof source[i] !== 'undefined') { + obj[i] = source[i]; + } + } + + return obj; + }; + + exports.merge = function (target, source, options) { + if (!source) { + return target; + } + + if (typeof source !== 'object') { + if (Array.isArray(target)) { + target.push(source); + } else if (typeof target === 'object') { + if (options.plainObjects || options.allowPrototypes || !has.call(Object.prototype, source)) { + target[source] = true; + } + } else { + return [target, source]; + } + + return target; + } + + if (typeof target !== 'object') { + return [target].concat(source); + } + + var mergeTarget = target; + if (Array.isArray(target) && !Array.isArray(source)) { + mergeTarget = exports.arrayToObject(target, options); + } + + if (Array.isArray(target) && Array.isArray(source)) { + source.forEach(function (item, i) { + if (has.call(target, i)) { + if (target[i] && typeof target[i] === 'object') { + target[i] = exports.merge(target[i], item, options); + } else { + target.push(item); + } + } else { + target[i] = item; + } + }); + return target; + } + + return Object.keys(source).reduce(function (acc, key) { + var value = source[key]; + + if (Object.prototype.hasOwnProperty.call(acc, key)) { + acc[key] = exports.merge(acc[key], value, options); + } else { + acc[key] = value; + } + return acc; + }, mergeTarget); + }; + + exports.decode = function (str) { + try { + return decodeURIComponent(str.replace(/\+/g, ' ')); + } catch (e) { + return str; + } + }; + + exports.encode = function (str) { + // This code was originally written by Brian White (mscdex) for the io.js core querystring library. + // It has been adapted here for stricter adherence to RFC 3986 + if (str.length === 0) { + return str; + } + + var string = typeof str === 'string' ? str : String(str); + + var out = ''; + for (var i = 0; i < string.length; ++i) { + var c = string.charCodeAt(i); + + if ( + c === 0x2D || // - + c === 0x2E || // . + c === 0x5F || // _ + c === 0x7E || // ~ + (c >= 0x30 && c <= 0x39) || // 0-9 + (c >= 0x41 && c <= 0x5A) || // a-z + (c >= 0x61 && c <= 0x7A) // A-Z + ) { + out += string.charAt(i); + continue; + } + + if (c < 0x80) { + out = out + hexTable[c]; + continue; + } + + if (c < 0x800) { + out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]); + continue; + } + + if (c < 0xD800 || c >= 0xE000) { + out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]); + continue; + } + + i += 1; + c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF)); + out += hexTable[0xF0 | (c >> 18)] + hexTable[0x80 | ((c >> 12) & 0x3F)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]; // eslint-disable-line max-len + } + + return out; + }; + + exports.compact = function (obj, references) { + if (typeof obj !== 'object' || obj === null) { + return obj; + } + + var refs = references || []; + var lookup = refs.indexOf(obj); + if (lookup !== -1) { + return refs[lookup]; + } + + refs.push(obj); + + if (Array.isArray(obj)) { + var compacted = []; + + for (var i = 0; i < obj.length; ++i) { + if (obj[i] && typeof obj[i] === 'object') { + compacted.push(exports.compact(obj[i], refs)); + } else if (typeof obj[i] !== 'undefined') { + compacted.push(obj[i]); + } + } + + return compacted; + } + + var keys = Object.keys(obj); + keys.forEach(function (key) { + obj[key] = exports.compact(obj[key], refs); + }); + + return obj; + }; + + exports.isRegExp = function (obj) { + return Object.prototype.toString.call(obj) === '[object RegExp]'; + }; + + exports.isBuffer = function (obj) { + if (obj === null || typeof obj === 'undefined') { + return false; + } + + return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); + }; + + +/***/ }, +/* 9 */ +/***/ function(module, exports) { + + module.exports = { raw: '8.9.2' }; + + +/***/ }, +/* 10 */, +/* 11 */, +/* 12 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var utils = __webpack_require__(8); + + var has = Object.prototype.hasOwnProperty; + + var defaults = { + allowDots: false, + allowPrototypes: false, + arrayLimit: 20, + decoder: utils.decode, + delimiter: '&', + depth: 5, + parameterLimit: 1000, + plainObjects: false, + strictNullHandling: false + }; + + var parseValues = function parseQueryStringValues(str, options) { + var obj = {}; + var parts = str.split(options.delimiter, options.parameterLimit === Infinity ? undefined : options.parameterLimit); + + for (var i = 0; i < parts.length; ++i) { + var part = parts[i]; + var pos = part.indexOf(']=') === -1 ? part.indexOf('=') : part.indexOf(']=') + 1; + + var key, val; + if (pos === -1) { + key = options.decoder(part); + val = options.strictNullHandling ? null : ''; + } else { + key = options.decoder(part.slice(0, pos)); + val = options.decoder(part.slice(pos + 1)); + } + if (has.call(obj, key)) { + obj[key] = [].concat(obj[key]).concat(val); + } else { + obj[key] = val; + } + } + + return obj; + }; + + var parseObject = function parseObjectRecursive(chain, val, options) { + if (!chain.length) { + return val; + } + + var root = chain.shift(); + + var obj; + if (root === '[]') { + obj = []; + obj = obj.concat(parseObject(chain, val, options)); + } else { + obj = options.plainObjects ? Object.create(null) : {}; + var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root; + var index = parseInt(cleanRoot, 10); + if ( + !isNaN(index) && + root !== cleanRoot && + String(index) === cleanRoot && + index >= 0 && + (options.parseArrays && index <= options.arrayLimit) + ) { + obj = []; + obj[index] = parseObject(chain, val, options); + } else { + obj[cleanRoot] = parseObject(chain, val, options); + } + } + + return obj; + }; + + var parseKeys = function parseQueryStringKeys(givenKey, val, options) { + if (!givenKey) { + return; + } + + // Transform dot notation to bracket notation + var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey; + + // The regex chunks + + var brackets = /(\[[^[\]]*])/; + var child = /(\[[^[\]]*])/g; + + // Get the parent + + var segment = brackets.exec(key); + var parent = segment ? key.slice(0, segment.index) : key; + + // Stash the parent if it exists + + var keys = []; + if (parent) { + // If we aren't using plain objects, optionally prefix keys + // that would overwrite object prototype properties + if (!options.plainObjects && has.call(Object.prototype, parent)) { + if (!options.allowPrototypes) { + return; + } + } + + keys.push(parent); + } + + // Loop through children appending to the array until we hit depth + + var i = 0; + while ((segment = child.exec(key)) !== null && i < options.depth) { + i += 1; + if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) { + if (!options.allowPrototypes) { + return; + } + } + keys.push(segment[1]); + } + + // If there's a remainder, just add whatever is left + + if (segment) { + keys.push('[' + key.slice(segment.index) + ']'); + } + + return parseObject(keys, val, options); + }; + + module.exports = function (str, opts) { + var options = opts || {}; + + if (options.decoder !== null && options.decoder !== undefined && typeof options.decoder !== 'function') { + throw new TypeError('Decoder has to be a function.'); + } + + options.delimiter = typeof options.delimiter === 'string' || utils.isRegExp(options.delimiter) ? options.delimiter : defaults.delimiter; + options.depth = typeof options.depth === 'number' ? options.depth : defaults.depth; + options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : defaults.arrayLimit; + options.parseArrays = options.parseArrays !== false; + options.decoder = typeof options.decoder === 'function' ? options.decoder : defaults.decoder; + options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : defaults.allowDots; + options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : defaults.plainObjects; + options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : defaults.allowPrototypes; + options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : defaults.parameterLimit; + options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling; + + if (str === '' || str === null || typeof str === 'undefined') { + return options.plainObjects ? Object.create(null) : {}; + } + + var tempObj = typeof str === 'string' ? parseValues(str, options) : str; + var obj = options.plainObjects ? Object.create(null) : {}; + + // Iterate over the keys and setup the new object + + var keys = Object.keys(tempObj); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + var newObj = parseKeys(key, tempObj[key], options); + obj = utils.merge(obj, newObj, options); + } + + return utils.compact(obj); + }; + + +/***/ }, +/* 13 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var utils = __webpack_require__(8); + var formats = __webpack_require__(7); + + var arrayPrefixGenerators = { + brackets: function brackets(prefix) { // eslint-disable-line func-name-matching + return prefix + '[]'; + }, + indices: function indices(prefix, key) { // eslint-disable-line func-name-matching + return prefix + '[' + key + ']'; + }, + repeat: function repeat(prefix) { // eslint-disable-line func-name-matching + return prefix; + } + }; + + var toISO = Date.prototype.toISOString; + + var defaults = { + delimiter: '&', + encode: true, + encoder: utils.encode, + encodeValuesOnly: false, + serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching + return toISO.call(date); + }, + skipNulls: false, + strictNullHandling: false + }; + + var stringify = function stringify( // eslint-disable-line func-name-matching + object, + prefix, + generateArrayPrefix, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly + ) { + var obj = object; + if (typeof filter === 'function') { + obj = filter(prefix, obj); + } else if (obj instanceof Date) { + obj = serializeDate(obj); + } else if (obj === null) { + if (strictNullHandling) { + return encoder && !encodeValuesOnly ? encoder(prefix) : prefix; + } + + obj = ''; + } + + if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || utils.isBuffer(obj)) { + if (encoder) { + var keyValue = encodeValuesOnly ? prefix : encoder(prefix); + return [formatter(keyValue) + '=' + formatter(encoder(obj))]; + } + return [formatter(prefix) + '=' + formatter(String(obj))]; + } + + var values = []; + + if (typeof obj === 'undefined') { + return values; + } + + var objKeys; + if (Array.isArray(filter)) { + objKeys = filter; + } else { + var keys = Object.keys(obj); + objKeys = sort ? keys.sort(sort) : keys; + } + + for (var i = 0; i < objKeys.length; ++i) { + var key = objKeys[i]; + + if (skipNulls && obj[key] === null) { + continue; + } + + if (Array.isArray(obj)) { + values = values.concat(stringify( + obj[key], + generateArrayPrefix(prefix, key), + generateArrayPrefix, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly + )); + } else { + values = values.concat(stringify( + obj[key], + prefix + (allowDots ? '.' + key : '[' + key + ']'), + generateArrayPrefix, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly + )); + } + } + + return values; + }; + + module.exports = function (object, opts) { + var obj = object; + var options = opts || {}; + + if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') { + throw new TypeError('Encoder has to be a function.'); + } + + var delimiter = typeof options.delimiter === 'undefined' ? defaults.delimiter : options.delimiter; + var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling; + var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : defaults.skipNulls; + var encode = typeof options.encode === 'boolean' ? options.encode : defaults.encode; + var encoder = typeof options.encoder === 'function' ? options.encoder : defaults.encoder; + var sort = typeof options.sort === 'function' ? options.sort : null; + var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots; + var serializeDate = typeof options.serializeDate === 'function' ? options.serializeDate : defaults.serializeDate; + var encodeValuesOnly = typeof options.encodeValuesOnly === 'boolean' ? options.encodeValuesOnly : defaults.encodeValuesOnly; + if (typeof options.format === 'undefined') { + options.format = formats.default; + } else if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) { + throw new TypeError('Unknown format option provided.'); + } + var formatter = formats.formatters[options.format]; + var objKeys; + var filter; + + if (typeof options.filter === 'function') { + filter = options.filter; + obj = filter('', obj); + } else if (Array.isArray(options.filter)) { + filter = options.filter; + objKeys = filter; + } + + var keys = []; + + if (typeof obj !== 'object' || obj === null) { + return ''; + } + + var arrayFormat; + if (options.arrayFormat in arrayPrefixGenerators) { + arrayFormat = options.arrayFormat; + } else if ('indices' in options) { + arrayFormat = options.indices ? 'indices' : 'repeat'; + } else { + arrayFormat = 'indices'; + } + + var generateArrayPrefix = arrayPrefixGenerators[arrayFormat]; + + if (!objKeys) { + objKeys = Object.keys(obj); + } + + if (sort) { + objKeys.sort(sort); + } + + for (var i = 0; i < objKeys.length; ++i) { + var key = objKeys[i]; + + if (skipNulls && obj[key] === null) { + continue; + } + + keys = keys.concat(stringify( + obj[key], + key, + generateArrayPrefix, + strictNullHandling, + skipNulls, + encode ? encoder : null, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly + )); + } + + return keys.join(delimiter); + }; + + +/***/ }, +/* 14 */, +/* 15 */, +/* 16 */, +/* 17 */, +/* 18 */, +/* 19 */, +/* 20 */, +/* 21 */, +/* 22 */, +/* 23 */, +/* 24 */, +/* 25 */, +/* 26 */, +/* 27 */, +/* 28 */, +/* 29 */, +/* 30 */, +/* 31 */, +/* 32 */, +/* 33 */, +/* 34 */, +/* 35 */, +/* 36 */, +/* 37 */ +/***/ function(module, exports, __webpack_require__) { + + var version = __webpack_require__(9); + var windowHandler = __webpack_require__(3); + var PluginHandler = __webpack_require__(38); + + function CordovaPlugin() { + this.webAuth = null; + this.version = version.raw; + this.extensibilityPoints = [ + 'popup.authorize', + 'popup.getPopupHandler' + ]; + } + + CordovaPlugin.prototype.setWebAuth = function (webAuth) { + this.webAuth = webAuth; + }; + + CordovaPlugin.prototype.supports = function (extensibilityPoint) { + var _window = windowHandler.getWindow(); + return (!!_window.cordova || !!_window.electron) && + this.extensibilityPoints.indexOf(extensibilityPoint) > -1; + }; + + CordovaPlugin.prototype.init = function () { + return new PluginHandler(this.webAuth); + }; + + module.exports = CordovaPlugin; + + +/***/ }, +/* 38 */ +/***/ function(module, exports, __webpack_require__) { + + var urljoin = __webpack_require__(1); + var PopupHandler = __webpack_require__(39); + + function PluginHandler(webAuth) { + this.webAuth = webAuth; + } + + PluginHandler.prototype.processParams = function (params) { + params.redirectUri = urljoin('https://' + params.domain, 'mobile'); + delete params.owp; + return params; + }; + + PluginHandler.prototype.getPopupHandler = function () { + return new PopupHandler(this.webAuth); + }; + + module.exports = PluginHandler; + + +/***/ }, +/* 39 */ +/***/ function(module, exports, __webpack_require__) { + + var windowHandler = __webpack_require__(3); + var qs = __webpack_require__(5); + var urljoin = __webpack_require__(1); + + function PopupHandler(webAuth) { + this.webAuth = webAuth; + this._current_popup = null; + this.options = null; + } + + PopupHandler.prototype.preload = function (options) { + var _this = this; + var _window = windowHandler.getWindow(); + + var url = options.url || 'about:blank'; + var popupOptions = options.popupOptions || {}; + + popupOptions.location = 'yes'; + delete popupOptions.width; + delete popupOptions.height; + + var windowFeatures = qs.stringify(popupOptions, { + encode: false, + delimiter: ',' + }); + + if (this._current_popup && !this._current_popup.closed) { + return this._current_popup; + } + + this._current_popup = _window.open(url, '_blank', windowFeatures); + + this._current_popup.kill = function (success) { + _this._current_popup.success = success; + this.close(); + _this._current_popup = null; + }; + + return this._current_popup; + }; + + PopupHandler.prototype.load = function (url, _, options, cb) { + var _this = this; + this.url = url; + this.options = options; + if (!this._current_popup) { + options.url = url; + this.preload(options); + } else { + this._current_popup.location.href = url; + } + + this.transientErrorHandler = function (event) { + _this.errorHandler(event, cb); + }; + + this.transientStartHandler = function (event) { + _this.startHandler(event, cb); + }; + + this.transientExitHandler = function () { + _this.exitHandler(cb); + }; + + this._current_popup.addEventListener('loaderror', this.transientErrorHandler); + this._current_popup.addEventListener('loadstart', this.transientStartHandler); + this._current_popup.addEventListener('exit', this.transientExitHandler); + }; + + PopupHandler.prototype.errorHandler = function (event, cb) { + if (!this._current_popup) { + return; + } + + this._current_popup.kill(true); + + cb({ error: 'window_error', errorDescription: event.message }); + }; + + PopupHandler.prototype.unhook = function () { + this._current_popup.removeEventListener('loaderror', this.transientErrorHandler); + this._current_popup.removeEventListener('loadstart', this.transientStartHandler); + this._current_popup.removeEventListener('exit', this.transientExitHandler); + }; + + PopupHandler.prototype.exitHandler = function (cb) { + if (!this._current_popup) { + return; + } + + // when the modal is closed, this event is called which ends up removing the + // event listeners. If you move this before closing the modal, it will add ~1 sec + // delay between the user being redirected to the callback and the popup gets closed. + this.unhook(); + + if (!this._current_popup.success) { + cb({ error: 'window_closed', errorDescription: 'Browser window closed' }); + } + }; + + PopupHandler.prototype.startHandler = function (event, cb) { + var _this = this; + + if (!this._current_popup) { + return; + } + + var callbackUrl = urljoin('https:', this.webAuth.baseOptions.domain, '/mobile'); + + if (event.url && !(event.url.indexOf(callbackUrl + '#') === 0)) { return; } + + var parts = event.url.split('#'); + + if (parts.length === 1) { + return; + } + + var opts = { hash: parts.pop(), _idTokenVerification: false }; + + if (this.options.nonce) { + opts.nonce = this.options.nonce; + } + + this.webAuth.parseHash( + opts, + function (error, result) { + if (error || result) { + _this._current_popup.kill(true); + cb(error, result); + } + } + ); + }; + + module.exports = PopupHandler; + + +/***/ } +/******/ ]) +}); +; \ No newline at end of file diff --git a/build/cordova-auth0-plugin.min.js b/build/cordova-auth0-plugin.min.js new file mode 100644 index 00000000..63a1ffc8 --- /dev/null +++ b/build/cordova-auth0-plugin.min.js @@ -0,0 +1,10 @@ +/*! + * cordova-auth0-plugin.min.js v8.9.2 + * + * Author: Auth0 + * Date: 8/17/2017, 9:23:13 PM + * License: MIT + * + */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("cordova-auth0-plugin",[],e):"object"==typeof exports?exports["cordova-auth0-plugin"]=e():t.CordovaAuth0Plugin=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){t.exports=r(37)},function(t,e,r){var n,o;!function(i,a,c){"undefined"!=typeof t&&t.exports?t.exports=c():(n=c,o="function"==typeof n?n.call(e,r,e,t):n,!(void 0!==o&&(t.exports=o)))}("urljoin",this,function(){function t(t,e){return t=t.replace(/:\//g,"://"),t=t.replace(/([^:\s])\/+/g,"$1/"),t=t.replace(/\/(\?|&|#[^!])/g,"$1"),t=t.replace(/(\?.+)\?/g,"$1&")}return function(){var e=arguments,r={};"object"==typeof arguments[0]&&(e=arguments[0],r=arguments[1]||{});var n=[].slice.call(e,0).join("/");return t(n,r)}})},,function(t,e){(function(e){function r(t){e.window.location=t}function n(){return e.window.document}function o(){return e.window}t.exports={redirect:r,getDocument:n,getWindow:o}}).call(e,function(){return this}())},,function(t,e,r){"use strict";var n=r(13),o=r(12),i=r(7);t.exports={formats:i,parse:o,stringify:n}},,function(t,e){"use strict";var r=String.prototype.replace,n=/%20/g;t.exports={default:"RFC3986",formatters:{RFC1738:function(t){return r.call(t,n,"+")},RFC3986:function(t){return t}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},function(t,e){"use strict";var r=Object.prototype.hasOwnProperty,n=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}();e.arrayToObject=function(t,e){for(var r=e&&e.plainObjects?Object.create(null):{},n=0;n=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122?r+=e.charAt(o):i<128?r+=n[i]:i<2048?r+=n[192|i>>6]+n[128|63&i]:i<55296||i>=57344?r+=n[224|i>>12]+n[128|i>>6&63]+n[128|63&i]:(o+=1,i=65536+((1023&i)<<10|1023&e.charCodeAt(o)),r+=n[240|i>>18]+n[128|i>>12&63]+n[128|i>>6&63]+n[128|63&i])}return r},e.compact=function(t,r){if("object"!=typeof t||null===t)return t;var n=r||[],o=n.indexOf(t);if(o!==-1)return n[o];if(n.push(t),Array.isArray(t)){for(var i=[],a=0;a=0&&r.parseArrays&&a<=r.arrayLimit?(n=[],n[a]=c(t,e,r)):n[i]=c(t,e,r)}return n},p=function(t,e,r){if(t){var n=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,i=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,p=i.exec(n),u=p?n.slice(0,p.index):n,l=[];if(u){if(!r.plainObjects&&o.call(Object.prototype,u)&&!r.allowPrototypes)return;l.push(u)}for(var s=0;null!==(p=a.exec(n))&&s-1},n.prototype.init=function(){return new a(this.webAuth)},t.exports=n},function(t,e,r){function n(t){this.webAuth=t}var o=r(1),i=r(39);n.prototype.processParams=function(t){return t.redirectUri=o("https://"+t.domain,"mobile"),delete t.owp,t},n.prototype.getPopupHandler=function(){return new i(this.webAuth)},t.exports=n},function(t,e,r){function n(t){this.webAuth=t,this._current_popup=null,this.options=null}var o=r(3),i=r(5),a=r(1);n.prototype.preload=function(t){var e=this,r=o.getWindow(),n=t.url||"about:blank",a=t.popupOptions||{};a.location="yes",delete a.width,delete a.height;var c=i.stringify(a,{encode:!1,delimiter:","});return this._current_popup&&!this._current_popup.closed?this._current_popup:(this._current_popup=r.open(n,"_blank",c),this._current_popup.kill=function(t){e._current_popup.success=t,this.close(),e._current_popup=null},this._current_popup)},n.prototype.load=function(t,e,r,n){var o=this;this.url=t,this.options=r,this._current_popup?this._current_popup.location.href=t:(r.url=t,this.preload(r)),this.transientErrorHandler=function(t){o.errorHandler(t,n)},this.transientStartHandler=function(t){o.startHandler(t,n)},this.transientExitHandler=function(){o.exitHandler(n)},this._current_popup.addEventListener("loaderror",this.transientErrorHandler),this._current_popup.addEventListener("loadstart",this.transientStartHandler),this._current_popup.addEventListener("exit",this.transientExitHandler)},n.prototype.errorHandler=function(t,e){this._current_popup&&(this._current_popup.kill(!0),e({error:"window_error",errorDescription:t.message}))},n.prototype.unhook=function(){this._current_popup.removeEventListener("loaderror",this.transientErrorHandler),this._current_popup.removeEventListener("loadstart",this.transientStartHandler),this._current_popup.removeEventListener("exit",this.transientExitHandler)},n.prototype.exitHandler=function(t){this._current_popup&&(this.unhook(),this._current_popup.success||t({error:"window_closed",errorDescription:"Browser window closed"}))},n.prototype.startHandler=function(t,e){var r=this;if(this._current_popup){var n=a("https:",this.webAuth.baseOptions.domain,"/mobile");if(!t.url||0===t.url.indexOf(n+"#")){var o=t.url.split("#");if(1!==o.length){var i={hash:o.pop(),_idTokenVerification:!1};this.options.nonce&&(i.nonce=this.options.nonce),this.webAuth.parseHash(i,function(t,n){(t||n)&&(r._current_popup.kill(!0),e(t,n))})}}}},t.exports=n}])}); +//# sourceMappingURL=cordova-auth0-plugin.min.js.map \ No newline at end of file diff --git a/build/cordova-auth0-plugin.min.js.map b/build/cordova-auth0-plugin.min.js.map new file mode 100644 index 00000000..9ca2ee22 --- /dev/null +++ b/build/cordova-auth0-plugin.min.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition?5ca6","webpack:///cordova-auth0-plugin.min.js","webpack:///webpack/bootstrap 88487ab7880081fa1caa?fc82","webpack:///./~/url-join/lib/url-join.js?3d0c","webpack:///./src/helper/window.js?c1da","webpack:///./~/qs/lib/index.js?89fa","webpack:///./~/qs/lib/formats.js?22ff","webpack:///./~/qs/lib/utils.js?681b","webpack:///./src/version.js?901f","webpack:///./~/qs/lib/parse.js?bc9b","webpack:///./~/qs/lib/stringify.js?69d7","webpack:///./plugins/cordova/index.js","webpack:///./plugins/cordova/plugin-handler.js","webpack:///./plugins/cordova/popup-handler.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","__WEBPACK_AMD_DEFINE_FACTORY__","__WEBPACK_AMD_DEFINE_RESULT__","name","context","definition","undefined","normalize","str","options","replace","input","arguments","joined","slice","join","global","redirect","url","window","location","getDocument","document","getWindow","stringify","parse","formats","String","prototype","percentTwenties","default","formatters","RFC1738","value","RFC3986","has","Object","hasOwnProperty","hexTable","array","i","push","toString","toUpperCase","arrayToObject","source","obj","plainObjects","create","length","merge","target","Array","isArray","allowPrototypes","concat","mergeTarget","forEach","item","keys","reduce","acc","key","decode","decodeURIComponent","e","encode","string","out","charCodeAt","charAt","compact","references","refs","lookup","indexOf","compacted","isRegExp","isBuffer","constructor","raw","utils","defaults","allowDots","arrayLimit","decoder","delimiter","depth","parameterLimit","strictNullHandling","parseValues","parts","split","Infinity","val","part","pos","parseObject","chain","shift","cleanRoot","index","parseInt","isNaN","parseArrays","parseKeys","givenKey","brackets","child","segment","exec","parent","opts","TypeError","tempObj","newObj","arrayPrefixGenerators","prefix","indices","repeat","toISO","Date","toISOString","encoder","encodeValuesOnly","serializeDate","date","skipNulls","object","generateArrayPrefix","filter","sort","formatter","keyValue","values","objKeys","format","arrayFormat","CordovaPlugin","webAuth","version","extensibilityPoints","windowHandler","PluginHandler","setWebAuth","supports","extensibilityPoint","_window","cordova","electron","init","urljoin","PopupHandler","processParams","params","redirectUri","domain","owp","getPopupHandler","_current_popup","qs","preload","_this","popupOptions","width","height","windowFeatures","closed","open","kill","success","close","load","_","cb","href","transientErrorHandler","event","errorHandler","transientStartHandler","startHandler","transientExitHandler","exitHandler","addEventListener","error","errorDescription","message","unhook","removeEventListener","callbackUrl","baseOptions","hash","pop","_idTokenVerification","nonce","parseHash","result"],"mappings":";;;;;;;;CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,OAAA,0BAAAH,GACA,gBAAAC,SACAA,QAAA,wBAAAD,IAEAD,EAAA,mBAAAC,KACCK,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAP,OAGA,IAAAC,GAAAO,EAAAD,IACAP,WACAS,GAAAF,EACAG,QAAA,EAUA,OANAL,GAAAE,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAS,QAAA,EAGAT,EAAAD,QAvBA,GAAAQ,KAqCA,OATAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,GAGAR,EAAA,KDgBM,SAASL,EAAQD,EAASM,GAE/BL,EAAOD,QAAUM,EAAoB,KAKhC,SAASL,EAAQD,EAASM,GE7DhC,GAAAS,GAAAC,GAAA,SAAAC,EAAAC,EAAAC,GACA,mBAAAlB,MAAAD,QAAAC,EAAAD,QAAAmB,KACAJ,EAAA,EAAAC,EAAA,kBAAAD,KAAAJ,KAAAX,EAAAM,EAAAN,EAAAC,GAAAc,IAAAK,SAAAJ,IAAAf,EAAAD,QAAAgB,MAEC,UAAAZ,KAAA,WAED,QAAAiB,GAAAC,EAAAC,GAcA,MAXAD,KAAAE,QAAA,cAGAF,IAAAE,QAAA,sBAGAF,IAAAE,QAAA,wBAGAF,IAAAE,QAAA,mBAKA,kBACA,GAAAC,GAAAC,UACAH,IAEA,iBAAAG,WAAA,KAEAD,EAAAC,UAAA,GACAH,EAAAG,UAAA,OAGA,IAAAC,MAAAC,MAAAjB,KAAAc,EAAA,GAAAI,KAAA,IACA,OAAAR,GAAAM,EAAAJ,OFsEO,CAED,SAAStB,EAAQD,IG1GvB,SAAA8B,GAAA,QAAAC,GAAAC,GACAF,EAAAG,OAAAC,SAAAF,EAGA,QAAAG,KACA,MAAAL,GAAAG,OAAAG,SAGA,QAAAC,KACA,MAAAP,GAAAG,OAGAhC,EAAAD,SACA+B,WACAI,cACAE,eH+G8B1B,KAAKX,EAAU,WAAa,MAAOI,WAG1D,CAED,SAASH,EAAQD,EAASM,GInIhC,YAEA,IAAAgC,GAAAhC,EAAA,IACAiC,EAAAjC,EAAA,IACAkC,EAAAlC,EAAA,EAEAL,GAAAD,SACAwC,UACAD,QACAD,cJ0IO,CAED,SAASrC,EAAQD,GKrJvB,YAEA,IAAAwB,GAAAiB,OAAAC,UAAAlB,QACAmB,EAAA,MAEA1C,GAAAD,SACA4C,QAAA,UACAC,YACAC,QAAA,SAAAC,GACA,MAAAvB,GAAAb,KAAAoC,EAAAJ,EAAA,MAEAK,QAAA,SAAAD,GACA,MAAAA,KAGAD,QAAA,UACAE,QAAA,YL6JM,SAAS/C,EAAQD,GM7KvB,YAEA,IAAAiD,GAAAC,OAAAR,UAAAS,eAEAC,EAAA,WAEA,OADAC,MACAC,EAAA,EAAmBA,EAAA,MAASA,EAC5BD,EAAAE,KAAA,MAAAD,EAAA,WAAAA,EAAAE,SAAA,KAAAC,cAGA,OAAAJ,KAGArD,GAAA0D,cAAA,SAAAC,EAAApC,GAEA,OADAqC,GAAArC,KAAAsC,aAAAX,OAAAY,OAAA,SACAR,EAAA,EAAmBA,EAAAK,EAAAI,SAAmBT,EACtC,mBAAAK,GAAAL,KACAM,EAAAN,GAAAK,EAAAL,GAIA,OAAAM,IAGA5D,EAAAgE,MAAA,SAAAC,EAAAN,EAAApC,GACA,IAAAoC,EACA,MAAAM,EAGA,oBAAAN,GAAA,CACA,GAAAO,MAAAC,QAAAF,GACAA,EAAAV,KAAAI,OACS,oBAAAM,GAKT,OAAAA,EAAAN,IAJApC,EAAAsC,cAAAtC,EAAA6C,kBAAAnB,EAAAtC,KAAAuC,OAAAR,UAAAiB,MACAM,EAAAN,IAAA,GAMA,MAAAM,GAGA,mBAAAA,GACA,OAAAA,GAAAI,OAAAV,EAGA,IAAAW,GAAAL,CAKA,OAJAC,OAAAC,QAAAF,KAAAC,MAAAC,QAAAR,KACAW,EAAAtE,EAAA0D,cAAAO,EAAA1C,IAGA2C,MAAAC,QAAAF,IAAAC,MAAAC,QAAAR,IACAA,EAAAY,QAAA,SAAAC,EAAAlB,GACAL,EAAAtC,KAAAsD,EAAAX,GACAW,EAAAX,IAAA,gBAAAW,GAAAX,GACAW,EAAAX,GAAAtD,EAAAgE,MAAAC,EAAAX,GAAAkB,EAAAjD,GAEA0C,EAAAV,KAAAiB,GAGAP,EAAAX,GAAAkB,IAGAP,GAGAf,OAAAuB,KAAAd,GAAAe,OAAA,SAAAC,EAAAC,GACA,GAAA7B,GAAAY,EAAAiB,EAOA,OALA1B,QAAAR,UAAAS,eAAAxC,KAAAgE,EAAAC,GACAD,EAAAC,GAAA5E,EAAAgE,MAAAW,EAAAC,GAAA7B,EAAAxB,GAEAoD,EAAAC,GAAA7B,EAEA4B,GACKL,IAGLtE,EAAA6E,OAAA,SAAAvD,GACA,IACA,MAAAwD,oBAAAxD,EAAAE,QAAA,YACK,MAAAuD,GACL,MAAAzD,KAIAtB,EAAAgF,OAAA,SAAA1D,GAGA,OAAAA,EAAAyC,OACA,MAAAzC,EAMA,QAHA2D,GAAA,gBAAA3D,KAAAmB,OAAAnB,GAEA4D,EAAA,GACA5B,EAAA,EAAmBA,EAAA2B,EAAAlB,SAAmBT,EAAA,CACtC,GAAAzC,GAAAoE,EAAAE,WAAA7B,EAGA,MAAAzC,GACA,KAAAA,GACA,KAAAA,GACA,MAAAA,GACAA,GAAA,IAAAA,GAAA,IACAA,GAAA,IAAAA,GAAA,IACAA,GAAA,IAAAA,GAAA,IAEAqE,GAAAD,EAAAG,OAAA9B,GAIAzC,EAAA,IACAqE,GAAA9B,EAAAvC,GAIAA,EAAA,KACAqE,GAAA9B,EAAA,IAAAvC,GAAA,GAAAuC,EAAA,OAAAvC,GAIAA,EAAA,OAAAA,GAAA,MACAqE,GAAA9B,EAAA,IAAAvC,GAAA,IAAAuC,EAAA,IAAAvC,GAAA,MAAAuC,EAAA,OAAAvC,IAIAyC,GAAA,EACAzC,EAAA,aAAAA,IAAA,QAAAoE,EAAAE,WAAA7B,IACA4B,GAAA9B,EAAA,IAAAvC,GAAA,IAAAuC,EAAA,IAAAvC,GAAA,OAAAuC,EAAA,IAAAvC,GAAA,MAAAuC,EAAA,OAAAvC,IAGA,MAAAqE,IAGAlF,EAAAqF,QAAA,SAAAzB,EAAA0B,GACA,mBAAA1B,IAAA,OAAAA,EACA,MAAAA,EAGA,IAAA2B,GAAAD,MACAE,EAAAD,EAAAE,QAAA7B,EACA,IAAA4B,KAAA,EACA,MAAAD,GAAAC,EAKA,IAFAD,EAAAhC,KAAAK,GAEAM,MAAAC,QAAAP,GAAA,CAGA,OAFA8B,MAEApC,EAAA,EAAuBA,EAAAM,EAAAG,SAAgBT,EACvCM,EAAAN,IAAA,gBAAAM,GAAAN,GACAoC,EAAAnC,KAAAvD,EAAAqF,QAAAzB,EAAAN,GAAAiC,IACa,mBAAA3B,GAAAN,IACboC,EAAAnC,KAAAK,EAAAN,GAIA,OAAAoC,GAGA,GAAAjB,GAAAvB,OAAAuB,KAAAb,EAKA,OAJAa,GAAAF,QAAA,SAAAK,GACAhB,EAAAgB,GAAA5E,EAAAqF,QAAAzB,EAAAgB,GAAAW,KAGA3B,GAGA5D,EAAA2F,SAAA,SAAA/B,GACA,0BAAAV,OAAAR,UAAAc,SAAA7C,KAAAiD,IAGA5D,EAAA4F,SAAA,SAAAhC,GACA,cAAAA,GAAA,mBAAAA,OAIAA,EAAAiC,aAAAjC,EAAAiC,YAAAD,UAAAhC,EAAAiC,YAAAD,SAAAhC,MNqLM,SAAS3D,EAAQD,GOzWvBC,EAAAD,SAAkB8F,IAAA,UP+WV,CACA,CAEF,SAAS7F,EAAQD,EAASM,GQlXhC,YAEA,IAAAyF,GAAAzF,EAAA,GAEA2C,EAAAC,OAAAR,UAAAS,eAEA6C,GACAC,WAAA,EACA7B,iBAAA,EACA8B,WAAA,GACAC,QAAAJ,EAAAlB,OACAuB,UAAA,IACAC,MAAA,EACAC,eAAA,IACAzC,cAAA,EACA0C,oBAAA,GAGAC,EAAA,SAAAlF,EAAAC,GAIA,OAHAqC,MACA6C,EAAAnF,EAAAoF,MAAAnF,EAAA6E,UAAA7E,EAAA+E,iBAAAK,IAAAvF,OAAAG,EAAA+E,gBAEAhD,EAAA,EAAmBA,EAAAmD,EAAA1C,SAAkBT,EAAA,CACrC,GAGAsB,GAAAgC,EAHAC,EAAAJ,EAAAnD,GACAwD,EAAAD,EAAApB,QAAA,WAAAoB,EAAApB,QAAA,KAAAoB,EAAApB,QAAA,OAGAqB,MAAA,GACAlC,EAAArD,EAAA4E,QAAAU,GACAD,EAAArF,EAAAgF,mBAAA,UAEA3B,EAAArD,EAAA4E,QAAAU,EAAAjF,MAAA,EAAAkF,IACAF,EAAArF,EAAA4E,QAAAU,EAAAjF,MAAAkF,EAAA,KAEA7D,EAAAtC,KAAAiD,EAAAgB,GACAhB,EAAAgB,MAAAP,OAAAT,EAAAgB,IAAAP,OAAAuC,GAEAhD,EAAAgB,GAAAgC,EAIA,MAAAhD,IAGAmD,EAAA,SAAAC,EAAAJ,EAAArF,GACA,IAAAyF,EAAAjD,OACA,MAAA6C,EAGA,IAEAhD,GAFA9D,EAAAkH,EAAAC,OAGA,WAAAnH,EACA8D,KACAA,IAAAS,OAAA0C,EAAAC,EAAAJ,EAAArF,QACK,CACLqC,EAAArC,EAAAsC,aAAAX,OAAAY,OAAA,QACA,IAAAoD,GAAA,MAAApH,EAAAsF,OAAA,UAAAtF,EAAAsF,OAAAtF,EAAAiE,OAAA,GAAAjE,EAAA8B,MAAA,MAAA9B,EACAqH,EAAAC,SAAAF,EAAA,KAEAG,MAAAF,IACArH,IAAAoH,GACAzE,OAAA0E,KAAAD,GACAC,GAAA,GACA5F,EAAA+F,aAAAH,GAAA5F,EAAA2E,YAEAtC,KACAA,EAAAuD,GAAAJ,EAAAC,EAAAJ,EAAArF,IAEAqC,EAAAsD,GAAAH,EAAAC,EAAAJ,EAAArF,GAIA,MAAAqC,IAGA2D,EAAA,SAAAC,EAAAZ,EAAArF,GACA,GAAAiG,EAAA,CAKA,GAAA5C,GAAArD,EAAA0E,UAAAuB,EAAAhG,QAAA,sBAAAgG,EAIAC,EAAA,eACAC,EAAA,gBAIAC,EAAAF,EAAAG,KAAAhD,GACAiD,EAAAF,EAAA/C,EAAAhD,MAAA,EAAA+F,EAAAR,OAAAvC,EAIAH,IACA,IAAAoD,EAAA,CAGA,IAAAtG,EAAAsC,cAAAZ,EAAAtC,KAAAuC,OAAAR,UAAAmF,KACAtG,EAAA6C,gBACA,MAIAK,GAAAlB,KAAAsE,GAMA,IADA,GAAAvE,GAAA,EACA,QAAAqE,EAAAD,EAAAE,KAAAhD,KAAAtB,EAAA/B,EAAA8E,OAAA,CAEA,GADA/C,GAAA,GACA/B,EAAAsC,cAAAZ,EAAAtC,KAAAuC,OAAAR,UAAAiF,EAAA,GAAA/F,MAAA,SACAL,EAAA6C,gBACA,MAGAK,GAAAlB,KAAAoE,EAAA,IASA,MAJAA,IACAlD,EAAAlB,KAAA,IAAAqB,EAAAhD,MAAA+F,EAAAR,OAAA,KAGAJ,EAAAtC,EAAAmC,EAAArF,IAGAtB,GAAAD,QAAA,SAAAsB,EAAAwG,GACA,GAAAvG,GAAAuG,KAEA,WAAAvG,EAAA4E,SAAA/E,SAAAG,EAAA4E,SAAA,kBAAA5E,GAAA4E,QACA,SAAA4B,WAAA,gCAcA,IAXAxG,EAAA6E,UAAA,gBAAA7E,GAAA6E,WAAAL,EAAAJ,SAAApE,EAAA6E,WAAA7E,EAAA6E,UAAAJ,EAAAI,UACA7E,EAAA8E,MAAA,gBAAA9E,GAAA8E,MAAA9E,EAAA8E,MAAAL,EAAAK,MACA9E,EAAA2E,WAAA,gBAAA3E,GAAA2E,WAAA3E,EAAA2E,WAAAF,EAAAE,WACA3E,EAAA+F,YAAA/F,EAAA+F,eAAA,EACA/F,EAAA4E,QAAA,kBAAA5E,GAAA4E,QAAA5E,EAAA4E,QAAAH,EAAAG,QACA5E,EAAA0E,UAAA,iBAAA1E,GAAA0E,UAAA1E,EAAA0E,UAAAD,EAAAC,UACA1E,EAAAsC,aAAA,iBAAAtC,GAAAsC,aAAAtC,EAAAsC,aAAAmC,EAAAnC,aACAtC,EAAA6C,gBAAA,iBAAA7C,GAAA6C,gBAAA7C,EAAA6C,gBAAA4B,EAAA5B,gBACA7C,EAAA+E,eAAA,gBAAA/E,GAAA+E,eAAA/E,EAAA+E,eAAAN,EAAAM,eACA/E,EAAAgF,mBAAA,iBAAAhF,GAAAgF,mBAAAhF,EAAAgF,mBAAAP,EAAAO,mBAEA,KAAAjF,GAAA,OAAAA,GAAA,mBAAAA,GACA,MAAAC,GAAAsC,aAAAX,OAAAY,OAAA,QASA,QANAkE,GAAA,gBAAA1G,GAAAkF,EAAAlF,EAAAC,GAAAD,EACAsC,EAAArC,EAAAsC,aAAAX,OAAAY,OAAA,SAIAW,EAAAvB,OAAAuB,KAAAuD,GACA1E,EAAA,EAAmBA,EAAAmB,EAAAV,SAAiBT,EAAA,CACpC,GAAAsB,GAAAH,EAAAnB,GACA2E,EAAAV,EAAA3C,EAAAoD,EAAApD,GAAArD,EACAqC,GAAAmC,EAAA/B,MAAAJ,EAAAqE,EAAA1G,GAGA,MAAAwE,GAAAV,QAAAzB,KR0XM,SAAS3D,EAAQD,EAASM,GS/hBhC,YAEA,IAAAyF,GAAAzF,EAAA,GACAkC,EAAAlC,EAAA,GAEA4H,GACAT,SAAA,SAAAU,GACA,MAAAA,GAAA,MAEAC,QAAA,SAAAD,EAAAvD,GACA,MAAAuD,GAAA,IAAAvD,EAAA,KAEAyD,OAAA,SAAAF,GACA,MAAAA,KAIAG,EAAAC,KAAA7F,UAAA8F,YAEAxC,GACAI,UAAA,IACApB,QAAA,EACAyD,QAAA1C,EAAAf,OACA0D,kBAAA,EACAC,cAAA,SAAAC,GACA,MAAAN,GAAA3H,KAAAiI,IAEAC,WAAA,EACAtC,oBAAA,GAGAjE,EAAA,QAAAA,GACAwG,EACAX,EACAY,EACAxC,EACAsC,EACAJ,EACAO,EACAC,EACAhD,EACA0C,EACAO,EACAR,GAEA,GAAA9E,GAAAkF,CACA,sBAAAE,GACApF,EAAAoF,EAAAb,EAAAvE,OACK,IAAAA,YAAA2E,MACL3E,EAAA+E,EAAA/E,OACK,WAAAA,EAAA,CACL,GAAA2C,EACA,MAAAkC,KAAAC,EAAAD,EAAAN,IAGAvE,GAAA,GAGA,mBAAAA,IAAA,gBAAAA,IAAA,iBAAAA,IAAAmC,EAAAH,SAAAhC,GAAA,CACA,GAAA6E,EAAA,CACA,GAAAU,GAAAT,EAAAP,EAAAM,EAAAN,EACA,QAAAe,EAAAC,GAAA,IAAAD,EAAAT,EAAA7E,KAEA,OAAAsF,EAAAf,GAAA,IAAAe,EAAAzG,OAAAmB,KAGA,GAAAwF,KAEA,uBAAAxF,GACA,MAAAwF,EAGA,IAAAC,EACA,IAAAnF,MAAAC,QAAA6E,GACAK,EAAAL,MACK,CACL,GAAAvE,GAAAvB,OAAAuB,KAAAb,EACAyF,GAAAJ,EAAAxE,EAAAwE,QAAAxE,EAGA,OAAAnB,GAAA,EAAmBA,EAAA+F,EAAAtF,SAAoBT,EAAA,CACvC,GAAAsB,GAAAyE,EAAA/F,EAEAuF,IAAA,OAAAjF,EAAAgB,KAKAwE,EADAlF,MAAAC,QAAAP,GACAwF,EAAA/E,OAAA/B,EACAsB,EAAAgB,GACAmE,EAAAZ,EAAAvD,GACAmE,EACAxC,EACAsC,EACAJ,EACAO,EACAC,EACAhD,EACA0C,EACAO,EACAR,IAGAU,EAAA/E,OAAA/B,EACAsB,EAAAgB,GACAuD,GAAAlC,EAAA,IAAArB,EAAA,IAAAA,EAAA,KACAmE,EACAxC,EACAsC,EACAJ,EACAO,EACAC,EACAhD,EACA0C,EACAO,EACAR,KAKA,MAAAU,GAGAnJ,GAAAD,QAAA,SAAA8I,EAAAhB,GACA,GAAAlE,GAAAkF,EACAvH,EAAAuG,KAEA,WAAAvG,EAAAkH,SAAArH,SAAAG,EAAAkH,SAAA,kBAAAlH,GAAAkH,QACA,SAAAV,WAAA,gCAGA,IAAA3B,GAAA,mBAAA7E,GAAA6E,UAAAJ,EAAAI,UAAA7E,EAAA6E,UACAG,EAAA,iBAAAhF,GAAAgF,mBAAAhF,EAAAgF,mBAAAP,EAAAO,mBACAsC,EAAA,iBAAAtH,GAAAsH,UAAAtH,EAAAsH,UAAA7C,EAAA6C,UACA7D,EAAA,iBAAAzD,GAAAyD,OAAAzD,EAAAyD,OAAAgB,EAAAhB,OACAyD,EAAA,kBAAAlH,GAAAkH,QAAAlH,EAAAkH,QAAAzC,EAAAyC,QACAQ,EAAA,kBAAA1H,GAAA0H,KAAA1H,EAAA0H,KAAA,KACAhD,EAAA,mBAAA1E,GAAA0E,WAAA1E,EAAA0E,UACA0C,EAAA,kBAAApH,GAAAoH,cAAApH,EAAAoH,cAAA3C,EAAA2C,cACAD,EAAA,iBAAAnH,GAAAmH,iBAAAnH,EAAAmH,iBAAA1C,EAAA0C,gBACA,uBAAAnH,GAAA+H,OACA/H,EAAA+H,OAAA9G,EAAAI,YACK,KAAAM,OAAAR,UAAAS,eAAAxC,KAAA6B,EAAAK,WAAAtB,EAAA+H,QACL,SAAAvB,WAAA,kCAEA,IACAsB,GACAL,EAFAE,EAAA1G,EAAAK,WAAAtB,EAAA+H,OAIA,mBAAA/H,GAAAyH,QACAA,EAAAzH,EAAAyH,OACApF,EAAAoF,EAAA,GAAApF,IACKM,MAAAC,QAAA5C,EAAAyH,UACLA,EAAAzH,EAAAyH,OACAK,EAAAL,EAGA,IAAAvE,KAEA,oBAAAb,IAAA,OAAAA,EACA,QAGA,IAAA2F,EAEAA,GADAhI,EAAAgI,cAAArB,GACA3G,EAAAgI,YACK,WAAAhI,GACLA,EAAA6G,QAAA,mBAEA,SAGA,IAAAW,GAAAb,EAAAqB,EAEAF,KACAA,EAAAnG,OAAAuB,KAAAb,IAGAqF,GACAI,EAAAJ,OAGA,QAAA3F,GAAA,EAAmBA,EAAA+F,EAAAtF,SAAoBT,EAAA,CACvC,GAAAsB,GAAAyE,EAAA/F,EAEAuF,IAAA,OAAAjF,EAAAgB,KAIAH,IAAAJ,OAAA/B,EACAsB,EAAAgB,GACAA,EACAmE,EACAxC,EACAsC,EACA7D,EAAAyD,EAAA,KACAO,EACAC,EACAhD,EACA0C,EACAO,EACAR,KAIA,MAAAjE,GAAA5C,KAAAuE,KTsiBQ,CACA,CACA,CACA,CACA,CACA,CACA,CACA,CACA,CACA,CACA,CACA,CACA,CACA,CACA,CACA,CACA,CACA,CACA,CACA,CACA,CACA,CACA,CAEF,SAASnG,EAAQD,EAASM,GUvwBhC,QAAAkJ,KACApJ,KAAAqJ,QAAA,KACArJ,KAAAsJ,UAAA5D,IACA1F,KAAAuJ,qBACA,kBACA,yBATA,GAAAD,GAAApJ,EAAA,GACAsJ,EAAAtJ,EAAA,GACAuJ,EAAAvJ,EAAA,GAWAkJ,GAAA9G,UAAAoH,WAAA,SAAAL,GACArJ,KAAAqJ,WAGAD,EAAA9G,UAAAqH,SAAA,SAAAC,GACA,GAAAC,GAAAL,EAAAvH,WACA,UAAA4H,EAAAC,WAAAD,EAAAE,WACA/J,KAAAuJ,oBAAAlE,QAAAuE,IAAA,GAGAR,EAAA9G,UAAA0H,KAAA,WACA,UAAAP,GAAAzJ,KAAAqJ,UAGAxJ,EAAAD,QAAAwJ,GVkxBM,SAASvJ,EAAQD,EAASM,GW1yBhC,QAAAuJ,GAAAJ,GACArJ,KAAAqJ,UAJA,GAAAY,GAAA/J,EAAA,GACAgK,EAAAhK,EAAA,GAMAuJ,GAAAnH,UAAA6H,cAAA,SAAAC,GAGA,MAFAA,GAAAC,YAAAJ,EAAA,WAAAG,EAAAE,OAAA,gBACAF,GAAAG,IACAH,GAGAX,EAAAnH,UAAAkI,gBAAA,WACA,UAAAN,GAAAlK,KAAAqJ,UAGAxJ,EAAAD,QAAA6J,GXozBM,SAAS5J,EAAQD,EAASM,GYj0BhC,QAAAgK,GAAAb,GACArJ,KAAAqJ,UACArJ,KAAAyK,eAAA,KACAzK,KAAAmB,QAAA,KAPA,GAAAqI,GAAAtJ,EAAA,GACAwK,EAAAxK,EAAA,GACA+J,EAAA/J,EAAA,EAQAgK,GAAA5H,UAAAqI,QAAA,SAAAxJ,GACA,GAAAyJ,GAAA5K,KACA6J,EAAAL,EAAAvH,YAEAL,EAAAT,EAAAS,KAAA,cACAiJ,EAAA1J,EAAA0J,gBAEAA,GAAA/I,SAAA,YACA+I,GAAAC,YACAD,GAAAE,MAEA,IAAAC,GAAAN,EAAAxI,UAAA2I,GACAjG,QAAA,EACAoB,UAAA,KAGA,OAAAhG,MAAAyK,iBAAAzK,KAAAyK,eAAAQ,OACAjL,KAAAyK,gBAGAzK,KAAAyK,eAAAZ,EAAAqB,KAAAtJ,EAAA,SAAAoJ,GAEAhL,KAAAyK,eAAAU,KAAA,SAAAC,GACAR,EAAAH,eAAAW,UACApL,KAAAqL,QACAT,EAAAH,eAAA,MAGAzK,KAAAyK,iBAGAP,EAAA5H,UAAAgJ,KAAA,SAAA1J,EAAA2J,EAAApK,EAAAqK,GACA,GAAAZ,GAAA5K,IACAA,MAAA4B,MACA5B,KAAAmB,UACAnB,KAAAyK,eAIAzK,KAAAyK,eAAA3I,SAAA2J,KAAA7J,GAHAT,EAAAS,MACA5B,KAAA2K,QAAAxJ,IAKAnB,KAAA0L,sBAAA,SAAAC,GACAf,EAAAgB,aAAAD,EAAAH,IAGAxL,KAAA6L,sBAAA,SAAAF,GACAf,EAAAkB,aAAAH,EAAAH,IAGAxL,KAAA+L,qBAAA,WACAnB,EAAAoB,YAAAR,IAGAxL,KAAAyK,eAAAwB,iBAAA,YAAAjM,KAAA0L,uBACA1L,KAAAyK,eAAAwB,iBAAA,YAAAjM,KAAA6L,uBACA7L,KAAAyK,eAAAwB,iBAAA,OAAAjM,KAAA+L,uBAGA7B,EAAA5H,UAAAsJ,aAAA,SAAAD,EAAAH,GACAxL,KAAAyK,iBAIAzK,KAAAyK,eAAAU,MAAA,GAEAK,GAAMU,MAAA,eAAAC,iBAAAR,EAAAS,YAGNlC,EAAA5H,UAAA+J,OAAA,WACArM,KAAAyK,eAAA6B,oBAAA,YAAAtM,KAAA0L,uBACA1L,KAAAyK,eAAA6B,oBAAA,YAAAtM,KAAA6L,uBACA7L,KAAAyK,eAAA6B,oBAAA,OAAAtM,KAAA+L,uBAGA7B,EAAA5H,UAAA0J,YAAA,SAAAR,GACAxL,KAAAyK,iBAOAzK,KAAAqM,SAEArM,KAAAyK,eAAAW,SACAI,GAAQU,MAAA,gBAAAC,iBAAA,4BAIRjC,EAAA5H,UAAAwJ,aAAA,SAAAH,EAAAH,GACA,GAAAZ,GAAA5K,IAEA,IAAAA,KAAAyK,eAAA,CAIA,GAAA8B,GAAAtC,EAAA,SAAAjK,KAAAqJ,QAAAmD,YAAAlC,OAAA,UAEA,KAAAqB,EAAA/J,KAAA,IAAA+J,EAAA/J,IAAAyD,QAAAkH,EAAA,MAEA,GAAAlG,GAAAsF,EAAA/J,IAAA0E,MAAA,IAEA,QAAAD,EAAA1C,OAAA,CAIA,GAAA+D,IAAc+E,KAAApG,EAAAqG,MAAAC,sBAAA,EAEd3M,MAAAmB,QAAAyL,QACAlF,EAAAkF,MAAA5M,KAAAmB,QAAAyL,OAGA5M,KAAAqJ,QAAAwD,UACAnF,EACA,SAAAwE,EAAAY,IACAZ,GAAAY,KACAlC,EAAAH,eAAAU,MAAA,GACAK,EAAAU,EAAAY,UAMAjN,EAAAD,QAAAsK","file":"cordova-auth0-plugin.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"cordova-auth0-plugin\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"cordova-auth0-plugin\"] = factory();\n\telse\n\t\troot[\"CordovaAuth0Plugin\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"cordova-auth0-plugin\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"cordova-auth0-plugin\"] = factory();\n\telse\n\t\troot[\"CordovaAuth0Plugin\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tmodule.exports = __webpack_require__(37);\n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (name, context, definition) {\n\t if (typeof module !== 'undefined' && module.exports) module.exports = definition();\n\t else if (true) !(__WEBPACK_AMD_DEFINE_FACTORY__ = (definition), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t else context[name] = definition();\n\t})('urljoin', this, function () {\n\t\n\t function normalize (str, options) {\n\t\n\t // make sure protocol is followed by two slashes\n\t str = str.replace(/:\\//g, '://');\n\t\n\t // remove consecutive slashes\n\t str = str.replace(/([^:\\s])\\/+/g, '$1/');\n\t\n\t // remove trailing slash before parameters or hash\n\t str = str.replace(/\\/(\\?|&|#[^!])/g, '$1');\n\t\n\t // replace ? in parameters with &\n\t str = str.replace(/(\\?.+)\\?/g, '$1&');\n\t\n\t return str;\n\t }\n\t\n\t return function () {\n\t var input = arguments;\n\t var options = {};\n\t\n\t if (typeof arguments[0] === 'object') {\n\t // new syntax with array and options\n\t input = arguments[0];\n\t options = arguments[1] || {};\n\t }\n\t\n\t var joined = [].slice.call(input, 0).join('/');\n\t return normalize(joined, options);\n\t };\n\t\n\t});\n\n\n/***/ },\n/* 2 */,\n/* 3 */\n/***/ function(module, exports) {\n\n\t/* WEBPACK VAR INJECTION */(function(global) {function redirect(url) {\n\t global.window.location = url;\n\t}\n\t\n\tfunction getDocument() {\n\t return global.window.document;\n\t}\n\t\n\tfunction getWindow() {\n\t return global.window;\n\t}\n\t\n\tmodule.exports = {\n\t redirect: redirect,\n\t getDocument: getDocument,\n\t getWindow: getWindow\n\t};\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/***/ },\n/* 4 */,\n/* 5 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar stringify = __webpack_require__(13);\n\tvar parse = __webpack_require__(12);\n\tvar formats = __webpack_require__(7);\n\t\n\tmodule.exports = {\n\t formats: formats,\n\t parse: parse,\n\t stringify: stringify\n\t};\n\n\n/***/ },\n/* 6 */,\n/* 7 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tvar replace = String.prototype.replace;\n\tvar percentTwenties = /%20/g;\n\t\n\tmodule.exports = {\n\t 'default': 'RFC3986',\n\t formatters: {\n\t RFC1738: function (value) {\n\t return replace.call(value, percentTwenties, '+');\n\t },\n\t RFC3986: function (value) {\n\t return value;\n\t }\n\t },\n\t RFC1738: 'RFC1738',\n\t RFC3986: 'RFC3986'\n\t};\n\n\n/***/ },\n/* 8 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tvar has = Object.prototype.hasOwnProperty;\n\t\n\tvar hexTable = (function () {\n\t var array = [];\n\t for (var i = 0; i < 256; ++i) {\n\t array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());\n\t }\n\t\n\t return array;\n\t}());\n\t\n\texports.arrayToObject = function (source, options) {\n\t var obj = options && options.plainObjects ? Object.create(null) : {};\n\t for (var i = 0; i < source.length; ++i) {\n\t if (typeof source[i] !== 'undefined') {\n\t obj[i] = source[i];\n\t }\n\t }\n\t\n\t return obj;\n\t};\n\t\n\texports.merge = function (target, source, options) {\n\t if (!source) {\n\t return target;\n\t }\n\t\n\t if (typeof source !== 'object') {\n\t if (Array.isArray(target)) {\n\t target.push(source);\n\t } else if (typeof target === 'object') {\n\t if (options.plainObjects || options.allowPrototypes || !has.call(Object.prototype, source)) {\n\t target[source] = true;\n\t }\n\t } else {\n\t return [target, source];\n\t }\n\t\n\t return target;\n\t }\n\t\n\t if (typeof target !== 'object') {\n\t return [target].concat(source);\n\t }\n\t\n\t var mergeTarget = target;\n\t if (Array.isArray(target) && !Array.isArray(source)) {\n\t mergeTarget = exports.arrayToObject(target, options);\n\t }\n\t\n\t if (Array.isArray(target) && Array.isArray(source)) {\n\t source.forEach(function (item, i) {\n\t if (has.call(target, i)) {\n\t if (target[i] && typeof target[i] === 'object') {\n\t target[i] = exports.merge(target[i], item, options);\n\t } else {\n\t target.push(item);\n\t }\n\t } else {\n\t target[i] = item;\n\t }\n\t });\n\t return target;\n\t }\n\t\n\t return Object.keys(source).reduce(function (acc, key) {\n\t var value = source[key];\n\t\n\t if (Object.prototype.hasOwnProperty.call(acc, key)) {\n\t acc[key] = exports.merge(acc[key], value, options);\n\t } else {\n\t acc[key] = value;\n\t }\n\t return acc;\n\t }, mergeTarget);\n\t};\n\t\n\texports.decode = function (str) {\n\t try {\n\t return decodeURIComponent(str.replace(/\\+/g, ' '));\n\t } catch (e) {\n\t return str;\n\t }\n\t};\n\t\n\texports.encode = function (str) {\n\t // This code was originally written by Brian White (mscdex) for the io.js core querystring library.\n\t // It has been adapted here for stricter adherence to RFC 3986\n\t if (str.length === 0) {\n\t return str;\n\t }\n\t\n\t var string = typeof str === 'string' ? str : String(str);\n\t\n\t var out = '';\n\t for (var i = 0; i < string.length; ++i) {\n\t var c = string.charCodeAt(i);\n\t\n\t if (\n\t c === 0x2D || // -\n\t c === 0x2E || // .\n\t c === 0x5F || // _\n\t c === 0x7E || // ~\n\t (c >= 0x30 && c <= 0x39) || // 0-9\n\t (c >= 0x41 && c <= 0x5A) || // a-z\n\t (c >= 0x61 && c <= 0x7A) // A-Z\n\t ) {\n\t out += string.charAt(i);\n\t continue;\n\t }\n\t\n\t if (c < 0x80) {\n\t out = out + hexTable[c];\n\t continue;\n\t }\n\t\n\t if (c < 0x800) {\n\t out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);\n\t continue;\n\t }\n\t\n\t if (c < 0xD800 || c >= 0xE000) {\n\t out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);\n\t continue;\n\t }\n\t\n\t i += 1;\n\t c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));\n\t out += hexTable[0xF0 | (c >> 18)] + hexTable[0x80 | ((c >> 12) & 0x3F)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]; // eslint-disable-line max-len\n\t }\n\t\n\t return out;\n\t};\n\t\n\texports.compact = function (obj, references) {\n\t if (typeof obj !== 'object' || obj === null) {\n\t return obj;\n\t }\n\t\n\t var refs = references || [];\n\t var lookup = refs.indexOf(obj);\n\t if (lookup !== -1) {\n\t return refs[lookup];\n\t }\n\t\n\t refs.push(obj);\n\t\n\t if (Array.isArray(obj)) {\n\t var compacted = [];\n\t\n\t for (var i = 0; i < obj.length; ++i) {\n\t if (obj[i] && typeof obj[i] === 'object') {\n\t compacted.push(exports.compact(obj[i], refs));\n\t } else if (typeof obj[i] !== 'undefined') {\n\t compacted.push(obj[i]);\n\t }\n\t }\n\t\n\t return compacted;\n\t }\n\t\n\t var keys = Object.keys(obj);\n\t keys.forEach(function (key) {\n\t obj[key] = exports.compact(obj[key], refs);\n\t });\n\t\n\t return obj;\n\t};\n\t\n\texports.isRegExp = function (obj) {\n\t return Object.prototype.toString.call(obj) === '[object RegExp]';\n\t};\n\t\n\texports.isBuffer = function (obj) {\n\t if (obj === null || typeof obj === 'undefined') {\n\t return false;\n\t }\n\t\n\t return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));\n\t};\n\n\n/***/ },\n/* 9 */\n/***/ function(module, exports) {\n\n\tmodule.exports = { raw: '8.9.2' };\n\n\n/***/ },\n/* 10 */,\n/* 11 */,\n/* 12 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(8);\n\t\n\tvar has = Object.prototype.hasOwnProperty;\n\t\n\tvar defaults = {\n\t allowDots: false,\n\t allowPrototypes: false,\n\t arrayLimit: 20,\n\t decoder: utils.decode,\n\t delimiter: '&',\n\t depth: 5,\n\t parameterLimit: 1000,\n\t plainObjects: false,\n\t strictNullHandling: false\n\t};\n\t\n\tvar parseValues = function parseQueryStringValues(str, options) {\n\t var obj = {};\n\t var parts = str.split(options.delimiter, options.parameterLimit === Infinity ? undefined : options.parameterLimit);\n\t\n\t for (var i = 0; i < parts.length; ++i) {\n\t var part = parts[i];\n\t var pos = part.indexOf(']=') === -1 ? part.indexOf('=') : part.indexOf(']=') + 1;\n\t\n\t var key, val;\n\t if (pos === -1) {\n\t key = options.decoder(part);\n\t val = options.strictNullHandling ? null : '';\n\t } else {\n\t key = options.decoder(part.slice(0, pos));\n\t val = options.decoder(part.slice(pos + 1));\n\t }\n\t if (has.call(obj, key)) {\n\t obj[key] = [].concat(obj[key]).concat(val);\n\t } else {\n\t obj[key] = val;\n\t }\n\t }\n\t\n\t return obj;\n\t};\n\t\n\tvar parseObject = function parseObjectRecursive(chain, val, options) {\n\t if (!chain.length) {\n\t return val;\n\t }\n\t\n\t var root = chain.shift();\n\t\n\t var obj;\n\t if (root === '[]') {\n\t obj = [];\n\t obj = obj.concat(parseObject(chain, val, options));\n\t } else {\n\t obj = options.plainObjects ? Object.create(null) : {};\n\t var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;\n\t var index = parseInt(cleanRoot, 10);\n\t if (\n\t !isNaN(index) &&\n\t root !== cleanRoot &&\n\t String(index) === cleanRoot &&\n\t index >= 0 &&\n\t (options.parseArrays && index <= options.arrayLimit)\n\t ) {\n\t obj = [];\n\t obj[index] = parseObject(chain, val, options);\n\t } else {\n\t obj[cleanRoot] = parseObject(chain, val, options);\n\t }\n\t }\n\t\n\t return obj;\n\t};\n\t\n\tvar parseKeys = function parseQueryStringKeys(givenKey, val, options) {\n\t if (!givenKey) {\n\t return;\n\t }\n\t\n\t // Transform dot notation to bracket notation\n\t var key = options.allowDots ? givenKey.replace(/\\.([^.[]+)/g, '[$1]') : givenKey;\n\t\n\t // The regex chunks\n\t\n\t var brackets = /(\\[[^[\\]]*])/;\n\t var child = /(\\[[^[\\]]*])/g;\n\t\n\t // Get the parent\n\t\n\t var segment = brackets.exec(key);\n\t var parent = segment ? key.slice(0, segment.index) : key;\n\t\n\t // Stash the parent if it exists\n\t\n\t var keys = [];\n\t if (parent) {\n\t // If we aren't using plain objects, optionally prefix keys\n\t // that would overwrite object prototype properties\n\t if (!options.plainObjects && has.call(Object.prototype, parent)) {\n\t if (!options.allowPrototypes) {\n\t return;\n\t }\n\t }\n\t\n\t keys.push(parent);\n\t }\n\t\n\t // Loop through children appending to the array until we hit depth\n\t\n\t var i = 0;\n\t while ((segment = child.exec(key)) !== null && i < options.depth) {\n\t i += 1;\n\t if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {\n\t if (!options.allowPrototypes) {\n\t return;\n\t }\n\t }\n\t keys.push(segment[1]);\n\t }\n\t\n\t // If there's a remainder, just add whatever is left\n\t\n\t if (segment) {\n\t keys.push('[' + key.slice(segment.index) + ']');\n\t }\n\t\n\t return parseObject(keys, val, options);\n\t};\n\t\n\tmodule.exports = function (str, opts) {\n\t var options = opts || {};\n\t\n\t if (options.decoder !== null && options.decoder !== undefined && typeof options.decoder !== 'function') {\n\t throw new TypeError('Decoder has to be a function.');\n\t }\n\t\n\t options.delimiter = typeof options.delimiter === 'string' || utils.isRegExp(options.delimiter) ? options.delimiter : defaults.delimiter;\n\t options.depth = typeof options.depth === 'number' ? options.depth : defaults.depth;\n\t options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : defaults.arrayLimit;\n\t options.parseArrays = options.parseArrays !== false;\n\t options.decoder = typeof options.decoder === 'function' ? options.decoder : defaults.decoder;\n\t options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : defaults.allowDots;\n\t options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : defaults.plainObjects;\n\t options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : defaults.allowPrototypes;\n\t options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : defaults.parameterLimit;\n\t options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;\n\t\n\t if (str === '' || str === null || typeof str === 'undefined') {\n\t return options.plainObjects ? Object.create(null) : {};\n\t }\n\t\n\t var tempObj = typeof str === 'string' ? parseValues(str, options) : str;\n\t var obj = options.plainObjects ? Object.create(null) : {};\n\t\n\t // Iterate over the keys and setup the new object\n\t\n\t var keys = Object.keys(tempObj);\n\t for (var i = 0; i < keys.length; ++i) {\n\t var key = keys[i];\n\t var newObj = parseKeys(key, tempObj[key], options);\n\t obj = utils.merge(obj, newObj, options);\n\t }\n\t\n\t return utils.compact(obj);\n\t};\n\n\n/***/ },\n/* 13 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(8);\n\tvar formats = __webpack_require__(7);\n\t\n\tvar arrayPrefixGenerators = {\n\t brackets: function brackets(prefix) { // eslint-disable-line func-name-matching\n\t return prefix + '[]';\n\t },\n\t indices: function indices(prefix, key) { // eslint-disable-line func-name-matching\n\t return prefix + '[' + key + ']';\n\t },\n\t repeat: function repeat(prefix) { // eslint-disable-line func-name-matching\n\t return prefix;\n\t }\n\t};\n\t\n\tvar toISO = Date.prototype.toISOString;\n\t\n\tvar defaults = {\n\t delimiter: '&',\n\t encode: true,\n\t encoder: utils.encode,\n\t encodeValuesOnly: false,\n\t serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching\n\t return toISO.call(date);\n\t },\n\t skipNulls: false,\n\t strictNullHandling: false\n\t};\n\t\n\tvar stringify = function stringify( // eslint-disable-line func-name-matching\n\t object,\n\t prefix,\n\t generateArrayPrefix,\n\t strictNullHandling,\n\t skipNulls,\n\t encoder,\n\t filter,\n\t sort,\n\t allowDots,\n\t serializeDate,\n\t formatter,\n\t encodeValuesOnly\n\t) {\n\t var obj = object;\n\t if (typeof filter === 'function') {\n\t obj = filter(prefix, obj);\n\t } else if (obj instanceof Date) {\n\t obj = serializeDate(obj);\n\t } else if (obj === null) {\n\t if (strictNullHandling) {\n\t return encoder && !encodeValuesOnly ? encoder(prefix) : prefix;\n\t }\n\t\n\t obj = '';\n\t }\n\t\n\t if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || utils.isBuffer(obj)) {\n\t if (encoder) {\n\t var keyValue = encodeValuesOnly ? prefix : encoder(prefix);\n\t return [formatter(keyValue) + '=' + formatter(encoder(obj))];\n\t }\n\t return [formatter(prefix) + '=' + formatter(String(obj))];\n\t }\n\t\n\t var values = [];\n\t\n\t if (typeof obj === 'undefined') {\n\t return values;\n\t }\n\t\n\t var objKeys;\n\t if (Array.isArray(filter)) {\n\t objKeys = filter;\n\t } else {\n\t var keys = Object.keys(obj);\n\t objKeys = sort ? keys.sort(sort) : keys;\n\t }\n\t\n\t for (var i = 0; i < objKeys.length; ++i) {\n\t var key = objKeys[i];\n\t\n\t if (skipNulls && obj[key] === null) {\n\t continue;\n\t }\n\t\n\t if (Array.isArray(obj)) {\n\t values = values.concat(stringify(\n\t obj[key],\n\t generateArrayPrefix(prefix, key),\n\t generateArrayPrefix,\n\t strictNullHandling,\n\t skipNulls,\n\t encoder,\n\t filter,\n\t sort,\n\t allowDots,\n\t serializeDate,\n\t formatter,\n\t encodeValuesOnly\n\t ));\n\t } else {\n\t values = values.concat(stringify(\n\t obj[key],\n\t prefix + (allowDots ? '.' + key : '[' + key + ']'),\n\t generateArrayPrefix,\n\t strictNullHandling,\n\t skipNulls,\n\t encoder,\n\t filter,\n\t sort,\n\t allowDots,\n\t serializeDate,\n\t formatter,\n\t encodeValuesOnly\n\t ));\n\t }\n\t }\n\t\n\t return values;\n\t};\n\t\n\tmodule.exports = function (object, opts) {\n\t var obj = object;\n\t var options = opts || {};\n\t\n\t if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') {\n\t throw new TypeError('Encoder has to be a function.');\n\t }\n\t\n\t var delimiter = typeof options.delimiter === 'undefined' ? defaults.delimiter : options.delimiter;\n\t var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;\n\t var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : defaults.skipNulls;\n\t var encode = typeof options.encode === 'boolean' ? options.encode : defaults.encode;\n\t var encoder = typeof options.encoder === 'function' ? options.encoder : defaults.encoder;\n\t var sort = typeof options.sort === 'function' ? options.sort : null;\n\t var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots;\n\t var serializeDate = typeof options.serializeDate === 'function' ? options.serializeDate : defaults.serializeDate;\n\t var encodeValuesOnly = typeof options.encodeValuesOnly === 'boolean' ? options.encodeValuesOnly : defaults.encodeValuesOnly;\n\t if (typeof options.format === 'undefined') {\n\t options.format = formats.default;\n\t } else if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) {\n\t throw new TypeError('Unknown format option provided.');\n\t }\n\t var formatter = formats.formatters[options.format];\n\t var objKeys;\n\t var filter;\n\t\n\t if (typeof options.filter === 'function') {\n\t filter = options.filter;\n\t obj = filter('', obj);\n\t } else if (Array.isArray(options.filter)) {\n\t filter = options.filter;\n\t objKeys = filter;\n\t }\n\t\n\t var keys = [];\n\t\n\t if (typeof obj !== 'object' || obj === null) {\n\t return '';\n\t }\n\t\n\t var arrayFormat;\n\t if (options.arrayFormat in arrayPrefixGenerators) {\n\t arrayFormat = options.arrayFormat;\n\t } else if ('indices' in options) {\n\t arrayFormat = options.indices ? 'indices' : 'repeat';\n\t } else {\n\t arrayFormat = 'indices';\n\t }\n\t\n\t var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];\n\t\n\t if (!objKeys) {\n\t objKeys = Object.keys(obj);\n\t }\n\t\n\t if (sort) {\n\t objKeys.sort(sort);\n\t }\n\t\n\t for (var i = 0; i < objKeys.length; ++i) {\n\t var key = objKeys[i];\n\t\n\t if (skipNulls && obj[key] === null) {\n\t continue;\n\t }\n\t\n\t keys = keys.concat(stringify(\n\t obj[key],\n\t key,\n\t generateArrayPrefix,\n\t strictNullHandling,\n\t skipNulls,\n\t encode ? encoder : null,\n\t filter,\n\t sort,\n\t allowDots,\n\t serializeDate,\n\t formatter,\n\t encodeValuesOnly\n\t ));\n\t }\n\t\n\t return keys.join(delimiter);\n\t};\n\n\n/***/ },\n/* 14 */,\n/* 15 */,\n/* 16 */,\n/* 17 */,\n/* 18 */,\n/* 19 */,\n/* 20 */,\n/* 21 */,\n/* 22 */,\n/* 23 */,\n/* 24 */,\n/* 25 */,\n/* 26 */,\n/* 27 */,\n/* 28 */,\n/* 29 */,\n/* 30 */,\n/* 31 */,\n/* 32 */,\n/* 33 */,\n/* 34 */,\n/* 35 */,\n/* 36 */,\n/* 37 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar version = __webpack_require__(9);\n\tvar windowHandler = __webpack_require__(3);\n\tvar PluginHandler = __webpack_require__(38);\n\t\n\tfunction CordovaPlugin() {\n\t this.webAuth = null;\n\t this.version = version.raw;\n\t this.extensibilityPoints = [\n\t 'popup.authorize',\n\t 'popup.getPopupHandler'\n\t ];\n\t}\n\t\n\tCordovaPlugin.prototype.setWebAuth = function (webAuth) {\n\t this.webAuth = webAuth;\n\t};\n\t\n\tCordovaPlugin.prototype.supports = function (extensibilityPoint) {\n\t var _window = windowHandler.getWindow();\n\t return (!!_window.cordova || !!_window.electron) &&\n\t this.extensibilityPoints.indexOf(extensibilityPoint) > -1;\n\t};\n\t\n\tCordovaPlugin.prototype.init = function () {\n\t return new PluginHandler(this.webAuth);\n\t};\n\t\n\tmodule.exports = CordovaPlugin;\n\n\n/***/ },\n/* 38 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar urljoin = __webpack_require__(1);\n\tvar PopupHandler = __webpack_require__(39);\n\t\n\tfunction PluginHandler(webAuth) {\n\t this.webAuth = webAuth;\n\t}\n\t\n\tPluginHandler.prototype.processParams = function (params) {\n\t params.redirectUri = urljoin('https://' + params.domain, 'mobile');\n\t delete params.owp;\n\t return params;\n\t};\n\t\n\tPluginHandler.prototype.getPopupHandler = function () {\n\t return new PopupHandler(this.webAuth);\n\t};\n\t\n\tmodule.exports = PluginHandler;\n\n\n/***/ },\n/* 39 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar windowHandler = __webpack_require__(3);\n\tvar qs = __webpack_require__(5);\n\tvar urljoin = __webpack_require__(1);\n\t\n\tfunction PopupHandler(webAuth) {\n\t this.webAuth = webAuth;\n\t this._current_popup = null;\n\t this.options = null;\n\t}\n\t\n\tPopupHandler.prototype.preload = function (options) {\n\t var _this = this;\n\t var _window = windowHandler.getWindow();\n\t\n\t var url = options.url || 'about:blank';\n\t var popupOptions = options.popupOptions || {};\n\t\n\t popupOptions.location = 'yes';\n\t delete popupOptions.width;\n\t delete popupOptions.height;\n\t\n\t var windowFeatures = qs.stringify(popupOptions, {\n\t encode: false,\n\t delimiter: ','\n\t });\n\t\n\t if (this._current_popup && !this._current_popup.closed) {\n\t return this._current_popup;\n\t }\n\t\n\t this._current_popup = _window.open(url, '_blank', windowFeatures);\n\t\n\t this._current_popup.kill = function (success) {\n\t _this._current_popup.success = success;\n\t this.close();\n\t _this._current_popup = null;\n\t };\n\t\n\t return this._current_popup;\n\t};\n\t\n\tPopupHandler.prototype.load = function (url, _, options, cb) {\n\t var _this = this;\n\t this.url = url;\n\t this.options = options;\n\t if (!this._current_popup) {\n\t options.url = url;\n\t this.preload(options);\n\t } else {\n\t this._current_popup.location.href = url;\n\t }\n\t\n\t this.transientErrorHandler = function (event) {\n\t _this.errorHandler(event, cb);\n\t };\n\t\n\t this.transientStartHandler = function (event) {\n\t _this.startHandler(event, cb);\n\t };\n\t\n\t this.transientExitHandler = function () {\n\t _this.exitHandler(cb);\n\t };\n\t\n\t this._current_popup.addEventListener('loaderror', this.transientErrorHandler);\n\t this._current_popup.addEventListener('loadstart', this.transientStartHandler);\n\t this._current_popup.addEventListener('exit', this.transientExitHandler);\n\t};\n\t\n\tPopupHandler.prototype.errorHandler = function (event, cb) {\n\t if (!this._current_popup) {\n\t return;\n\t }\n\t\n\t this._current_popup.kill(true);\n\t\n\t cb({ error: 'window_error', errorDescription: event.message });\n\t};\n\t\n\tPopupHandler.prototype.unhook = function () {\n\t this._current_popup.removeEventListener('loaderror', this.transientErrorHandler);\n\t this._current_popup.removeEventListener('loadstart', this.transientStartHandler);\n\t this._current_popup.removeEventListener('exit', this.transientExitHandler);\n\t};\n\t\n\tPopupHandler.prototype.exitHandler = function (cb) {\n\t if (!this._current_popup) {\n\t return;\n\t }\n\t\n\t // when the modal is closed, this event is called which ends up removing the\n\t // event listeners. If you move this before closing the modal, it will add ~1 sec\n\t // delay between the user being redirected to the callback and the popup gets closed.\n\t this.unhook();\n\t\n\t if (!this._current_popup.success) {\n\t cb({ error: 'window_closed', errorDescription: 'Browser window closed' });\n\t }\n\t};\n\t\n\tPopupHandler.prototype.startHandler = function (event, cb) {\n\t var _this = this;\n\t\n\t if (!this._current_popup) {\n\t return;\n\t }\n\t\n\t var callbackUrl = urljoin('https:', this.webAuth.baseOptions.domain, '/mobile');\n\t\n\t if (event.url && !(event.url.indexOf(callbackUrl + '#') === 0)) { return; }\n\t\n\t var parts = event.url.split('#');\n\t\n\t if (parts.length === 1) {\n\t return;\n\t }\n\t\n\t var opts = { hash: parts.pop(), _idTokenVerification: false };\n\t\n\t if (this.options.nonce) {\n\t opts.nonce = this.options.nonce;\n\t }\n\t\n\t this.webAuth.parseHash(\n\t opts,\n\t function (error, result) {\n\t if (error || result) {\n\t _this._current_popup.kill(true);\n\t cb(error, result);\n\t }\n\t }\n\t );\n\t};\n\t\n\tmodule.exports = PopupHandler;\n\n\n/***/ }\n/******/ ])\n});\n;\n\n\n// WEBPACK FOOTER //\n// cordova-auth0-plugin.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 88487ab7880081fa1caa","(function (name, context, definition) {\n if (typeof module !== 'undefined' && module.exports) module.exports = definition();\n else if (typeof define === 'function' && define.amd) define(definition);\n else context[name] = definition();\n})('urljoin', this, function () {\n\n function normalize (str, options) {\n\n // make sure protocol is followed by two slashes\n str = str.replace(/:\\//g, '://');\n\n // remove consecutive slashes\n str = str.replace(/([^:\\s])\\/+/g, '$1/');\n\n // remove trailing slash before parameters or hash\n str = str.replace(/\\/(\\?|&|#[^!])/g, '$1');\n\n // replace ? in parameters with &\n str = str.replace(/(\\?.+)\\?/g, '$1&');\n\n return str;\n }\n\n return function () {\n var input = arguments;\n var options = {};\n\n if (typeof arguments[0] === 'object') {\n // new syntax with array and options\n input = arguments[0];\n options = arguments[1] || {};\n }\n\n var joined = [].slice.call(input, 0).join('/');\n return normalize(joined, options);\n };\n\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/url-join/lib/url-join.js\n// module id = 1\n// module chunks = 0 1","function redirect(url) {\n global.window.location = url;\n}\n\nfunction getDocument() {\n return global.window.document;\n}\n\nfunction getWindow() {\n return global.window;\n}\n\nmodule.exports = {\n redirect: redirect,\n getDocument: getDocument,\n getWindow: getWindow\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/window.js\n// module id = 3\n// module chunks = 0 1","'use strict';\n\nvar stringify = require('./stringify');\nvar parse = require('./parse');\nvar formats = require('./formats');\n\nmodule.exports = {\n formats: formats,\n parse: parse,\n stringify: stringify\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/qs/lib/index.js\n// module id = 5\n// module chunks = 0 1","'use strict';\n\nvar replace = String.prototype.replace;\nvar percentTwenties = /%20/g;\n\nmodule.exports = {\n 'default': 'RFC3986',\n formatters: {\n RFC1738: function (value) {\n return replace.call(value, percentTwenties, '+');\n },\n RFC3986: function (value) {\n return value;\n }\n },\n RFC1738: 'RFC1738',\n RFC3986: 'RFC3986'\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/qs/lib/formats.js\n// module id = 7\n// module chunks = 0 1","'use strict';\n\nvar has = Object.prototype.hasOwnProperty;\n\nvar hexTable = (function () {\n var array = [];\n for (var i = 0; i < 256; ++i) {\n array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());\n }\n\n return array;\n}());\n\nexports.arrayToObject = function (source, options) {\n var obj = options && options.plainObjects ? Object.create(null) : {};\n for (var i = 0; i < source.length; ++i) {\n if (typeof source[i] !== 'undefined') {\n obj[i] = source[i];\n }\n }\n\n return obj;\n};\n\nexports.merge = function (target, source, options) {\n if (!source) {\n return target;\n }\n\n if (typeof source !== 'object') {\n if (Array.isArray(target)) {\n target.push(source);\n } else if (typeof target === 'object') {\n if (options.plainObjects || options.allowPrototypes || !has.call(Object.prototype, source)) {\n target[source] = true;\n }\n } else {\n return [target, source];\n }\n\n return target;\n }\n\n if (typeof target !== 'object') {\n return [target].concat(source);\n }\n\n var mergeTarget = target;\n if (Array.isArray(target) && !Array.isArray(source)) {\n mergeTarget = exports.arrayToObject(target, options);\n }\n\n if (Array.isArray(target) && Array.isArray(source)) {\n source.forEach(function (item, i) {\n if (has.call(target, i)) {\n if (target[i] && typeof target[i] === 'object') {\n target[i] = exports.merge(target[i], item, options);\n } else {\n target.push(item);\n }\n } else {\n target[i] = item;\n }\n });\n return target;\n }\n\n return Object.keys(source).reduce(function (acc, key) {\n var value = source[key];\n\n if (Object.prototype.hasOwnProperty.call(acc, key)) {\n acc[key] = exports.merge(acc[key], value, options);\n } else {\n acc[key] = value;\n }\n return acc;\n }, mergeTarget);\n};\n\nexports.decode = function (str) {\n try {\n return decodeURIComponent(str.replace(/\\+/g, ' '));\n } catch (e) {\n return str;\n }\n};\n\nexports.encode = function (str) {\n // This code was originally written by Brian White (mscdex) for the io.js core querystring library.\n // It has been adapted here for stricter adherence to RFC 3986\n if (str.length === 0) {\n return str;\n }\n\n var string = typeof str === 'string' ? str : String(str);\n\n var out = '';\n for (var i = 0; i < string.length; ++i) {\n var c = string.charCodeAt(i);\n\n if (\n c === 0x2D || // -\n c === 0x2E || // .\n c === 0x5F || // _\n c === 0x7E || // ~\n (c >= 0x30 && c <= 0x39) || // 0-9\n (c >= 0x41 && c <= 0x5A) || // a-z\n (c >= 0x61 && c <= 0x7A) // A-Z\n ) {\n out += string.charAt(i);\n continue;\n }\n\n if (c < 0x80) {\n out = out + hexTable[c];\n continue;\n }\n\n if (c < 0x800) {\n out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);\n continue;\n }\n\n if (c < 0xD800 || c >= 0xE000) {\n out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);\n continue;\n }\n\n i += 1;\n c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));\n out += hexTable[0xF0 | (c >> 18)] + hexTable[0x80 | ((c >> 12) & 0x3F)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]; // eslint-disable-line max-len\n }\n\n return out;\n};\n\nexports.compact = function (obj, references) {\n if (typeof obj !== 'object' || obj === null) {\n return obj;\n }\n\n var refs = references || [];\n var lookup = refs.indexOf(obj);\n if (lookup !== -1) {\n return refs[lookup];\n }\n\n refs.push(obj);\n\n if (Array.isArray(obj)) {\n var compacted = [];\n\n for (var i = 0; i < obj.length; ++i) {\n if (obj[i] && typeof obj[i] === 'object') {\n compacted.push(exports.compact(obj[i], refs));\n } else if (typeof obj[i] !== 'undefined') {\n compacted.push(obj[i]);\n }\n }\n\n return compacted;\n }\n\n var keys = Object.keys(obj);\n keys.forEach(function (key) {\n obj[key] = exports.compact(obj[key], refs);\n });\n\n return obj;\n};\n\nexports.isRegExp = function (obj) {\n return Object.prototype.toString.call(obj) === '[object RegExp]';\n};\n\nexports.isBuffer = function (obj) {\n if (obj === null || typeof obj === 'undefined') {\n return false;\n }\n\n return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/qs/lib/utils.js\n// module id = 8\n// module chunks = 0 1","module.exports = { raw: '8.9.2' };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/version.js\n// module id = 9\n// module chunks = 0 1","'use strict';\n\nvar utils = require('./utils');\n\nvar has = Object.prototype.hasOwnProperty;\n\nvar defaults = {\n allowDots: false,\n allowPrototypes: false,\n arrayLimit: 20,\n decoder: utils.decode,\n delimiter: '&',\n depth: 5,\n parameterLimit: 1000,\n plainObjects: false,\n strictNullHandling: false\n};\n\nvar parseValues = function parseQueryStringValues(str, options) {\n var obj = {};\n var parts = str.split(options.delimiter, options.parameterLimit === Infinity ? undefined : options.parameterLimit);\n\n for (var i = 0; i < parts.length; ++i) {\n var part = parts[i];\n var pos = part.indexOf(']=') === -1 ? part.indexOf('=') : part.indexOf(']=') + 1;\n\n var key, val;\n if (pos === -1) {\n key = options.decoder(part);\n val = options.strictNullHandling ? null : '';\n } else {\n key = options.decoder(part.slice(0, pos));\n val = options.decoder(part.slice(pos + 1));\n }\n if (has.call(obj, key)) {\n obj[key] = [].concat(obj[key]).concat(val);\n } else {\n obj[key] = val;\n }\n }\n\n return obj;\n};\n\nvar parseObject = function parseObjectRecursive(chain, val, options) {\n if (!chain.length) {\n return val;\n }\n\n var root = chain.shift();\n\n var obj;\n if (root === '[]') {\n obj = [];\n obj = obj.concat(parseObject(chain, val, options));\n } else {\n obj = options.plainObjects ? Object.create(null) : {};\n var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;\n var index = parseInt(cleanRoot, 10);\n if (\n !isNaN(index) &&\n root !== cleanRoot &&\n String(index) === cleanRoot &&\n index >= 0 &&\n (options.parseArrays && index <= options.arrayLimit)\n ) {\n obj = [];\n obj[index] = parseObject(chain, val, options);\n } else {\n obj[cleanRoot] = parseObject(chain, val, options);\n }\n }\n\n return obj;\n};\n\nvar parseKeys = function parseQueryStringKeys(givenKey, val, options) {\n if (!givenKey) {\n return;\n }\n\n // Transform dot notation to bracket notation\n var key = options.allowDots ? givenKey.replace(/\\.([^.[]+)/g, '[$1]') : givenKey;\n\n // The regex chunks\n\n var brackets = /(\\[[^[\\]]*])/;\n var child = /(\\[[^[\\]]*])/g;\n\n // Get the parent\n\n var segment = brackets.exec(key);\n var parent = segment ? key.slice(0, segment.index) : key;\n\n // Stash the parent if it exists\n\n var keys = [];\n if (parent) {\n // If we aren't using plain objects, optionally prefix keys\n // that would overwrite object prototype properties\n if (!options.plainObjects && has.call(Object.prototype, parent)) {\n if (!options.allowPrototypes) {\n return;\n }\n }\n\n keys.push(parent);\n }\n\n // Loop through children appending to the array until we hit depth\n\n var i = 0;\n while ((segment = child.exec(key)) !== null && i < options.depth) {\n i += 1;\n if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {\n if (!options.allowPrototypes) {\n return;\n }\n }\n keys.push(segment[1]);\n }\n\n // If there's a remainder, just add whatever is left\n\n if (segment) {\n keys.push('[' + key.slice(segment.index) + ']');\n }\n\n return parseObject(keys, val, options);\n};\n\nmodule.exports = function (str, opts) {\n var options = opts || {};\n\n if (options.decoder !== null && options.decoder !== undefined && typeof options.decoder !== 'function') {\n throw new TypeError('Decoder has to be a function.');\n }\n\n options.delimiter = typeof options.delimiter === 'string' || utils.isRegExp(options.delimiter) ? options.delimiter : defaults.delimiter;\n options.depth = typeof options.depth === 'number' ? options.depth : defaults.depth;\n options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : defaults.arrayLimit;\n options.parseArrays = options.parseArrays !== false;\n options.decoder = typeof options.decoder === 'function' ? options.decoder : defaults.decoder;\n options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : defaults.allowDots;\n options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : defaults.plainObjects;\n options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : defaults.allowPrototypes;\n options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : defaults.parameterLimit;\n options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;\n\n if (str === '' || str === null || typeof str === 'undefined') {\n return options.plainObjects ? Object.create(null) : {};\n }\n\n var tempObj = typeof str === 'string' ? parseValues(str, options) : str;\n var obj = options.plainObjects ? Object.create(null) : {};\n\n // Iterate over the keys and setup the new object\n\n var keys = Object.keys(tempObj);\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n var newObj = parseKeys(key, tempObj[key], options);\n obj = utils.merge(obj, newObj, options);\n }\n\n return utils.compact(obj);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/qs/lib/parse.js\n// module id = 12\n// module chunks = 0 1","'use strict';\n\nvar utils = require('./utils');\nvar formats = require('./formats');\n\nvar arrayPrefixGenerators = {\n brackets: function brackets(prefix) { // eslint-disable-line func-name-matching\n return prefix + '[]';\n },\n indices: function indices(prefix, key) { // eslint-disable-line func-name-matching\n return prefix + '[' + key + ']';\n },\n repeat: function repeat(prefix) { // eslint-disable-line func-name-matching\n return prefix;\n }\n};\n\nvar toISO = Date.prototype.toISOString;\n\nvar defaults = {\n delimiter: '&',\n encode: true,\n encoder: utils.encode,\n encodeValuesOnly: false,\n serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching\n return toISO.call(date);\n },\n skipNulls: false,\n strictNullHandling: false\n};\n\nvar stringify = function stringify( // eslint-disable-line func-name-matching\n object,\n prefix,\n generateArrayPrefix,\n strictNullHandling,\n skipNulls,\n encoder,\n filter,\n sort,\n allowDots,\n serializeDate,\n formatter,\n encodeValuesOnly\n) {\n var obj = object;\n if (typeof filter === 'function') {\n obj = filter(prefix, obj);\n } else if (obj instanceof Date) {\n obj = serializeDate(obj);\n } else if (obj === null) {\n if (strictNullHandling) {\n return encoder && !encodeValuesOnly ? encoder(prefix) : prefix;\n }\n\n obj = '';\n }\n\n if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || utils.isBuffer(obj)) {\n if (encoder) {\n var keyValue = encodeValuesOnly ? prefix : encoder(prefix);\n return [formatter(keyValue) + '=' + formatter(encoder(obj))];\n }\n return [formatter(prefix) + '=' + formatter(String(obj))];\n }\n\n var values = [];\n\n if (typeof obj === 'undefined') {\n return values;\n }\n\n var objKeys;\n if (Array.isArray(filter)) {\n objKeys = filter;\n } else {\n var keys = Object.keys(obj);\n objKeys = sort ? keys.sort(sort) : keys;\n }\n\n for (var i = 0; i < objKeys.length; ++i) {\n var key = objKeys[i];\n\n if (skipNulls && obj[key] === null) {\n continue;\n }\n\n if (Array.isArray(obj)) {\n values = values.concat(stringify(\n obj[key],\n generateArrayPrefix(prefix, key),\n generateArrayPrefix,\n strictNullHandling,\n skipNulls,\n encoder,\n filter,\n sort,\n allowDots,\n serializeDate,\n formatter,\n encodeValuesOnly\n ));\n } else {\n values = values.concat(stringify(\n obj[key],\n prefix + (allowDots ? '.' + key : '[' + key + ']'),\n generateArrayPrefix,\n strictNullHandling,\n skipNulls,\n encoder,\n filter,\n sort,\n allowDots,\n serializeDate,\n formatter,\n encodeValuesOnly\n ));\n }\n }\n\n return values;\n};\n\nmodule.exports = function (object, opts) {\n var obj = object;\n var options = opts || {};\n\n if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') {\n throw new TypeError('Encoder has to be a function.');\n }\n\n var delimiter = typeof options.delimiter === 'undefined' ? defaults.delimiter : options.delimiter;\n var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;\n var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : defaults.skipNulls;\n var encode = typeof options.encode === 'boolean' ? options.encode : defaults.encode;\n var encoder = typeof options.encoder === 'function' ? options.encoder : defaults.encoder;\n var sort = typeof options.sort === 'function' ? options.sort : null;\n var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots;\n var serializeDate = typeof options.serializeDate === 'function' ? options.serializeDate : defaults.serializeDate;\n var encodeValuesOnly = typeof options.encodeValuesOnly === 'boolean' ? options.encodeValuesOnly : defaults.encodeValuesOnly;\n if (typeof options.format === 'undefined') {\n options.format = formats.default;\n } else if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) {\n throw new TypeError('Unknown format option provided.');\n }\n var formatter = formats.formatters[options.format];\n var objKeys;\n var filter;\n\n if (typeof options.filter === 'function') {\n filter = options.filter;\n obj = filter('', obj);\n } else if (Array.isArray(options.filter)) {\n filter = options.filter;\n objKeys = filter;\n }\n\n var keys = [];\n\n if (typeof obj !== 'object' || obj === null) {\n return '';\n }\n\n var arrayFormat;\n if (options.arrayFormat in arrayPrefixGenerators) {\n arrayFormat = options.arrayFormat;\n } else if ('indices' in options) {\n arrayFormat = options.indices ? 'indices' : 'repeat';\n } else {\n arrayFormat = 'indices';\n }\n\n var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];\n\n if (!objKeys) {\n objKeys = Object.keys(obj);\n }\n\n if (sort) {\n objKeys.sort(sort);\n }\n\n for (var i = 0; i < objKeys.length; ++i) {\n var key = objKeys[i];\n\n if (skipNulls && obj[key] === null) {\n continue;\n }\n\n keys = keys.concat(stringify(\n obj[key],\n key,\n generateArrayPrefix,\n strictNullHandling,\n skipNulls,\n encode ? encoder : null,\n filter,\n sort,\n allowDots,\n serializeDate,\n formatter,\n encodeValuesOnly\n ));\n }\n\n return keys.join(delimiter);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/qs/lib/stringify.js\n// module id = 13\n// module chunks = 0 1","var version = require('../../src/version');\nvar windowHandler = require('../../src/helper/window');\nvar PluginHandler = require('./plugin-handler');\n\nfunction CordovaPlugin() {\n this.webAuth = null;\n this.version = version.raw;\n this.extensibilityPoints = [\n 'popup.authorize',\n 'popup.getPopupHandler'\n ];\n}\n\nCordovaPlugin.prototype.setWebAuth = function (webAuth) {\n this.webAuth = webAuth;\n};\n\nCordovaPlugin.prototype.supports = function (extensibilityPoint) {\n var _window = windowHandler.getWindow();\n return (!!_window.cordova || !!_window.electron) &&\n this.extensibilityPoints.indexOf(extensibilityPoint) > -1;\n};\n\nCordovaPlugin.prototype.init = function () {\n return new PluginHandler(this.webAuth);\n};\n\nmodule.exports = CordovaPlugin;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./plugins/cordova/index.js\n// module id = 37\n// module chunks = 1","var urljoin = require('url-join');\nvar PopupHandler = require('./popup-handler');\n\nfunction PluginHandler(webAuth) {\n this.webAuth = webAuth;\n}\n\nPluginHandler.prototype.processParams = function (params) {\n params.redirectUri = urljoin('https://' + params.domain, 'mobile');\n delete params.owp;\n return params;\n};\n\nPluginHandler.prototype.getPopupHandler = function () {\n return new PopupHandler(this.webAuth);\n};\n\nmodule.exports = PluginHandler;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./plugins/cordova/plugin-handler.js\n// module id = 38\n// module chunks = 1","var windowHandler = require('../../src/helper/window');\nvar qs = require('qs');\nvar urljoin = require('url-join');\n\nfunction PopupHandler(webAuth) {\n this.webAuth = webAuth;\n this._current_popup = null;\n this.options = null;\n}\n\nPopupHandler.prototype.preload = function (options) {\n var _this = this;\n var _window = windowHandler.getWindow();\n\n var url = options.url || 'about:blank';\n var popupOptions = options.popupOptions || {};\n\n popupOptions.location = 'yes';\n delete popupOptions.width;\n delete popupOptions.height;\n\n var windowFeatures = qs.stringify(popupOptions, {\n encode: false,\n delimiter: ','\n });\n\n if (this._current_popup && !this._current_popup.closed) {\n return this._current_popup;\n }\n\n this._current_popup = _window.open(url, '_blank', windowFeatures);\n\n this._current_popup.kill = function (success) {\n _this._current_popup.success = success;\n this.close();\n _this._current_popup = null;\n };\n\n return this._current_popup;\n};\n\nPopupHandler.prototype.load = function (url, _, options, cb) {\n var _this = this;\n this.url = url;\n this.options = options;\n if (!this._current_popup) {\n options.url = url;\n this.preload(options);\n } else {\n this._current_popup.location.href = url;\n }\n\n this.transientErrorHandler = function (event) {\n _this.errorHandler(event, cb);\n };\n\n this.transientStartHandler = function (event) {\n _this.startHandler(event, cb);\n };\n\n this.transientExitHandler = function () {\n _this.exitHandler(cb);\n };\n\n this._current_popup.addEventListener('loaderror', this.transientErrorHandler);\n this._current_popup.addEventListener('loadstart', this.transientStartHandler);\n this._current_popup.addEventListener('exit', this.transientExitHandler);\n};\n\nPopupHandler.prototype.errorHandler = function (event, cb) {\n if (!this._current_popup) {\n return;\n }\n\n this._current_popup.kill(true);\n\n cb({ error: 'window_error', errorDescription: event.message });\n};\n\nPopupHandler.prototype.unhook = function () {\n this._current_popup.removeEventListener('loaderror', this.transientErrorHandler);\n this._current_popup.removeEventListener('loadstart', this.transientStartHandler);\n this._current_popup.removeEventListener('exit', this.transientExitHandler);\n};\n\nPopupHandler.prototype.exitHandler = function (cb) {\n if (!this._current_popup) {\n return;\n }\n\n // when the modal is closed, this event is called which ends up removing the\n // event listeners. If you move this before closing the modal, it will add ~1 sec\n // delay between the user being redirected to the callback and the popup gets closed.\n this.unhook();\n\n if (!this._current_popup.success) {\n cb({ error: 'window_closed', errorDescription: 'Browser window closed' });\n }\n};\n\nPopupHandler.prototype.startHandler = function (event, cb) {\n var _this = this;\n\n if (!this._current_popup) {\n return;\n }\n\n var callbackUrl = urljoin('https:', this.webAuth.baseOptions.domain, '/mobile');\n\n if (event.url && !(event.url.indexOf(callbackUrl + '#') === 0)) { return; }\n\n var parts = event.url.split('#');\n\n if (parts.length === 1) {\n return;\n }\n\n var opts = { hash: parts.pop(), _idTokenVerification: false };\n\n if (this.options.nonce) {\n opts.nonce = this.options.nonce;\n }\n\n this.webAuth.parseHash(\n opts,\n function (error, result) {\n if (error || result) {\n _this._current_popup.kill(true);\n cb(error, result);\n }\n }\n );\n};\n\nmodule.exports = PopupHandler;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./plugins/cordova/popup-handler.js\n// module id = 39\n// module chunks = 1"],"sourceRoot":""} \ No newline at end of file