diff --git a/.gitignore b/.gitignore index 6ec76520..37d4b3f7 100644 --- a/.gitignore +++ b/.gitignore @@ -23,10 +23,9 @@ release .DS_Store -build example/auth0.js .gitignore coverage -.idea/ \ No newline at end of file +.idea/ diff --git a/build/auth0.js b/build/auth0.js new file mode 100644 index 00000000..ed18e03a --- /dev/null +++ b/build/auth0.js @@ -0,0 +1,7774 @@ +(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__) { + + var Authentication = __webpack_require__(13); + var Management = __webpack_require__(44); + var WebAuth = __webpack_require__(45); + var version = __webpack_require__(16); + + module.exports = { + Authentication: Authentication, + Management: Management, + WebAuth: WebAuth, + version: version.raw + }; + + +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + /* eslint-disable no-param-reassign */ + + var assert = __webpack_require__(2); + var objectAssign = __webpack_require__(36); + + function pick(object, keys) { + return keys.reduce(function (prev, key) { + if (object[key]) { + prev[key] = object[key]; + } + return prev; + }, {}); + } + + 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, + extend: extend + }; + + +/***/ }, +/* 2 */ +/***/ function(module, exports) { + + var toString = Object.prototype.toString; + + function attribute(o, attr, type, text) { + 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 + * @public + */ + 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 + }; + + +/***/ }, +/* 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, __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); + }; + + }); + + +/***/ }, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { + + var error = __webpack_require__(15); + var objectHelper = __webpack_require__(1); + + 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) { + 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.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; + + +/***/ }, +/* 6 */ +/***/ function(module, exports) { + + function Warn(options) { + this.disableWarnings = options.disableWarnings; + } + + Warn.prototype.warning = function (message) { + if (this.disableWarnings) { + return; + } + + console.warn(message); + }; + + module.exports = Warn; + +/***/ }, +/* 7 */ +/***/ 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; + + +/***/ }, +/* 8 */ +/***/ function(module, exports) { + + function build(params) { + return Object.keys(params).reduce(function (arr, key) { + if (typeof params[key] !== 'undefined') { + arr.push(key + '=' + encodeURIComponent(params[key])); + } + return arr; + }, []).join('&'); + } + + function parse(qs) { + return qs.split('&').reduce(function (prev, curr) { + var param = curr.split('='); + prev[param[0]] = param[1]; + return prev; + }, {}); + } + + module.exports = { + build: build, + parse: parse + }; + + +/***/ }, +/* 9 */ +/***/ function(module, exports, __webpack_require__) { + + /* eslint-disable no-param-reassign */ + var request = __webpack_require__(12); + var base64Url = __webpack_require__(14); + var version = __webpack_require__(16); + + // ------------------------------------------------ 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.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()); + } + 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; + + +/***/ }, +/* 10 */ +/***/ 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('') + } + + +/***/ }, +/* 11 */ +/***/ function(module, exports, __webpack_require__) { + + var base64 = __webpack_require__(10); + + 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 base64.fromByteArray(stringToByteArray(str)) + .replace(/\+/g, '-') // Convert '+' to '-' + .replace(/\//g, '_'); // Convert '/' to '_' + } + + + function decodeToString(str) { + str = padding(str) + .replace(/\-/g, '+') // Convert '-' to '+' + .replace(/_/g, '/'); // Convert '_' to '/' + + return byteArrayToString(base64.toByteArray(str)); + } + + + 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 + }; + + +/***/ }, +/* 12 */ +/***/ 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__(30); + var RequestBase = __webpack_require__(27); + var isObject = __webpack_require__(7); + var isFunction = __webpack_require__(26); + var ResponseBase = __webpack_require__(28); + + /** + * 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, options) { + options = options || {}; + 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 + * @param {Object} options with 'type' property 'auto' or 'basic' (default 'basic') + * @return {Request} for chaining + * @api public + */ + + Request.prototype.auth = function(user, pass, options){ + 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; + } + 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 (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){ + var fn = this._callback; + this.clearTimeout(); + + if (err) { + 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){ + var self = this; + var xhr = this.xhr = request.getXHR(); + var data = this._formData || this._data; + + 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; + + // 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 + } + } + + // querystring + this._appendQueryString(); + + this._setTimeouts(); + + // 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 callback `fn(res)`. + * + * @param {String} url + * @param {Function} [fn] + * @return {Request} + * @api public + */ + + function del(url, fn){ + var req = request('DELETE', url); + 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; + }; + + +/***/ }, +/* 13 */ +/***/ function(module, exports, __webpack_require__) { + + var urljoin = __webpack_require__(4); + + var RequestBuilder = __webpack_require__(9); + var qs = __webpack_require__(8); + var objectHelper = __webpack_require__(1); + var assert = __webpack_require__(2); + var responseHandler = __webpack_require__(5); + var parametersWhitelist = __webpack_require__(37); + var Warn = __webpack_require__(6); + + var PasswordlessAuthentication = __webpack_require__(33); + var DBConnection = __webpack_require__(32); + + /** + * Auth0 Authentication API client + * @constructor + * @param {Object} options + * @param {Object} options.domain + * @param {Object} options.clienID + * @param {Object} options.responseType + * @param {Object} options.responseMode + * @param {Object} options.scope + * @param {Object} options.audience + * @param {Object} options._disableDeprecationWarnings + */ + 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: https://auth0.com/docs/api/authentication#!#get--authorize_db + * @param {Function} cb + */ + 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: { 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(params); + + qString = qs.build(params); + + return urljoin(this.baseOptions.rootUrl, 'authorize', '?' + qString); + }; + + /** + * Builds and returns the Logout url in order to initialize a new authN/authZ transaction + * + * @method buildLogoutUrl + * @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-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.build(params); + + return urljoin(this.baseOptions.rootUrl, 'v2', 'logout', '?' + qString); + }; + + /** + * Makes a call to the `oauth/token` endpoint with `password` grant type + * + * @method loginWithDefaultDirectory + * @param {Object} options: https://auth0.com/docs/api-auth/grant/password + * @param {Function} cb + */ + 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 {Object} options.username + * @param {Object} options.password + * @param {Object} options.scope + * @param {Object} options.audience + * @param {Object} options.realm: the HRD domain or the connection name + * @param {Function} cb + */ + 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 + * @param {Object} options: + * @param {Object} options.username + * @param {Object} options.password + * @param {Object} options.scope + * @param {Object} options.audience + * @param {Object} options.grantType + * @param {Function} cb + */ + 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(body); + + body.grant_type = body.grant_type; + + return this.request + .post(url) + .send(body) + .end(responseHandler(cb)); + }; + + /** + * Makes a call to the `/ro` endpoint + * + * @method loginWithResourceOwner + * @param {Object} options: + * @param {Object} options.username + * @param {Object} options.password + * @param {Object} options.connection + * @param {Object} options.scope + * @param {Object} options.audience + * @param {Function} cb + * @deprecated `loginWithResourceOwner` will be soon deprecated, user `login` instead. + */ + Authentication.prototype.loginWithResourceOwner = function (options, cb) { + var url; + var body; + + this.warn.warning('`loginWithResourceOwner` will be soon deprecated, user `login` instead.'); + + 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' }, + audience: { optional: true, type: 'string', message: 'audience 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', + 'audience' + ]).with(options); + + 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 + * + * @method getSSOData + * @param {Boolean} withActiveDirectories + * @param {Function} cb + * @deprecated `getSSOData` will be soon deprecated. + */ + Authentication.prototype.getSSOData = function (withActiveDirectories, cb) { + var url; + var params = ''; + + this.warn.warning('`getSSOData` will be soon deprecated.'); + + 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.build({ + 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)); + }; + + /** + * Makes a call to the `/userinfo` endpoint and returns the user profile + * + * @method userInfo + * @param {String} accessToken + * @param {Function} cb + */ + 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 })); + }; + + /** + * Makes a call to the `/delegation` endpoint + * + * @method delegation + * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--delegation + * @param {Function} cb + * @deprecated `delegation` will be soon deprecated. + */ + Authentication.prototype.delegation = function (options, cb) { + var url; + var body; + + this.warn.warning('`delegation` will be soon deprecated.'); + + 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 + * @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; + + +/***/ }, +/* 14 */ +/***/ function(module, exports, __webpack_require__) { + + var base64 = __webpack_require__(10); + + 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 + }; + + +/***/ }, +/* 15 */ +/***/ 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 + }; + + +/***/ }, +/* 16 */ +/***/ function(module, exports) { + + module.exports = {raw:"8.1.1"}; + + +/***/ }, +/* 17 */ +/***/ function(module, exports, __webpack_require__) { + + var random = __webpack_require__(39); + var storage = __webpack_require__(40); + + 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; + var nonce; + + 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; + + +/***/ }, +/* 18 */ +/***/ 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; + + })); + +/***/ }, +/* 19 */ +/***/ function(module, exports, __webpack_require__) { + + ;(function (root, factory) { + if (true) { + // CommonJS + module.exports = exports = factory(__webpack_require__(18)); + } + 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; + + })); + +/***/ }, +/* 20 */ +/***/ 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; + + if (true) { + exports = module.exports = { + BigInteger: BigInteger, + SecureRandom: SecureRandom, + }; + } else { + this.BigInteger = BigInteger; + this.SecureRandom = SecureRandom; + } + + }).call(this); + + +/***/ }, +/* 21 */ +/***/ function(module, exports) { + + function DummyCache() {} + + DummyCache.prototype.get = function (key) { + return null; + }; + + DummyCache.prototype.has = function (key) { + return false; + }; + + DummyCache.prototype.set = function (key, value) { + }; + + module.exports = DummyCache; + + +/***/ }, +/* 22 */ +/***/ 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 + }; + + +/***/ }, +/* 23 */ +/***/ function(module, exports, __webpack_require__) { + + var urljoin = __webpack_require__(4); + var base64 = __webpack_require__(11); + var request = __webpack_require__(12); + + 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) { + if (err) { + cb(err); + } + + var matchingKey = null; + + for (var a = 0; a < data.body.keys.length && matchingKey === null; a ++) { + var key = data.body.keys[a]; + if (key.kid === options.kid) { + matchingKey = key; + } + } + + cb(null, process(matchingKey)); + }); + } + + module.exports = { + process: process, + getJWKS: getJWKS + }; + + +/***/ }, +/* 24 */ +/***/ 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__(20).BigInteger; + var SHA256 = __webpack_require__(19); + + 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; + + +/***/ }, +/* 25 */ +/***/ function(module, exports, __webpack_require__) { + + var RSAVerifier = __webpack_require__(24); + var base64 = __webpack_require__(11); + var jwks = __webpack_require__(23); + var error = __webpack_require__(22); + var DummyCache = __webpack_require__(21); + var supportedAlgs = ['RS256']; + + function IdTokenVerifier(options) { + options = options || {}; + + 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(',') + '])'); + } + } + + IdTokenVerifier.prototype.verify = function (token, nonce, cb) { + var jwt = this.decode(token); + + if (jwt instanceof Error) { + return cb(jwt, false); + } + + 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 iat = jwt.payload.iat; + var tnonce = jwt.payload.nonce || null; + + 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.verifyExpAndIat(exp, iat); + + if (expirationError) { + return cb(expirationError, false); + } + + this.getRsaVerifier(iss, kid, function (err, rsaVerifier) { + if (err) { + return cb(err); + } + if (rsaVerifier.verify(headAndPayload, signature)) { + cb(null, jwt.payload); + } else { + cb(new error.TokenValidationError('Invalid signature.')); + } + }); + }; + + IdTokenVerifier.prototype.verifyExpAndIat = function (exp, iat) { + if (this.__disableExpirationCheck) { + return null; + } + + var now = new Date(); + + var expDate = new Date(0); + expDate.setUTCSeconds(exp + this.leeway); + + if (now > expDate) { + return new error.TokenValidationError('Expired token.'); + } + + var iatDate = new Date(0); + 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); + cb(null, new RSAVerifier(keyInfo.modulus, keyInfo.exp)); + } + }; + + 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; + + +/***/ }, +/* 26 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Check if `fn` is a function. + * + * @param {Function} fn + * @return {Boolean} + * @api private + */ + var isObject = __webpack_require__(7); + + function isFunction(fn) { + var tag = isObject(fn) ? Object.prototype.toString.call(fn) : ''; + return tag === '[object Function]'; + } + + module.exports = isFunction; + + +/***/ }, +/* 27 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Module of mixed-in functions shared between node and client code + */ + var isObject = __webpack_require__(7); + + /** + * 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(){ + this._timeout = 0; + this._responseTimeout = 0; + clearTimeout(this._timer); + clearTimeout(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; + } + + if ('undefined' !== typeof options.deadline) { + this._timeout = options.deadline; + } + if ('undefined' !== typeof options.response) { + this._responseTimeout = options.response; + } + return this; + }; + + /** + * 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(){ + // This is browser-only functionality. Node side is no-op. + this._withCredentials = true; + 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){ + if (this._aborted) { + return; + } + var err = new Error(reason + timeout + 'ms exceeded'); + err.timeout = timeout; + err.code = 'ECONNABORTED'; + 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); + }, this._timeout); + } + // response timeout + if (this._responseTimeout && !this._responseTimeoutTimer) { + this._responseTimeoutTimer = setTimeout(function(){ + self._timeoutError('Response timeout of ', self._responseTimeout); + }, this._responseTimeout); + } + } + + +/***/ }, +/* 28 */ +/***/ function(module, exports, __webpack_require__) { + + + /** + * Module dependencies. + */ + + var utils = __webpack_require__(29); + + /** + * 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; + }; + + +/***/ }, +/* 29 */ +/***/ 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; + }; + + +/***/ }, +/* 30 */ +/***/ 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; + }; + + +/***/ }, +/* 31 */ +/***/ 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 = 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); + 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; + } + } + } catch(err) { } + } + + 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; + } + + +/***/ }, +/* 32 */ +/***/ function(module, exports, __webpack_require__) { + + var urljoin = __webpack_require__(4); + + var objectHelper = __webpack_require__(1); + var assert = __webpack_require__(2); + var responseHandler = __webpack_require__(5); + + function DBConnection(request, options) { + this.baseOptions = options; + this.request = request; + } + + /** + * Signup a new user + * + * @method signup + * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup + * @param {Function} cb + */ + DBConnection.prototype.signup = 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' }, + 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); + + body = objectHelper.blacklist(body, ['scope']); + + body = objectHelper.toSnakeCase(body, ['auth0Client']); + + return this.request + .post(url) + .send(body) + .end(responseHandler(cb)); + }; + + /** + * Initializes the change password flow + * + * @method signup + * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password + * @param {Function} cb + */ + 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; + + +/***/ }, +/* 33 */ +/***/ function(module, exports, __webpack_require__) { + + var urljoin = __webpack_require__(4); + + var objectHelper = __webpack_require__(1); + var assert = __webpack_require__(2); + var qs = __webpack_require__(8); + var responseHandler = __webpack_require__(5); + + function PasswordlessAuthentication(request, options) { + this.baseOptions = options; + this.request = request; + } + + /** + * Builds and returns the passwordless TOTP verify url in order to initialize a new authN/authZ transaction + * + * @method buildVerifyUrl + * @param {Object} options + * @param {Function} cb + */ + 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' + ]).with(options); + + // eslint-disable-next-line + if (this.baseOptions._sendTelemetry) { + params.auth0Client = this.request.getTelemetryData(); + } + + params = objectHelper.toSnakeCase(params, ['auth0Client']); + + qString = qs.build(params); + + return urljoin(this.baseOptions.rootUrl, 'passwordless', 'verify_redirect', '?' + qString); + }; + + /** + * Initializes a new passwordless authN/authZ transaction + * + * @method start + * @param {Object} options: https://auth0.com/docs/api/authentication#passwordless + * @param {Function} cb + */ + 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)); + }; + + /** + * Verifies the passwordless TOTP and returns an error if any. + * + * @method buildVerifyUrl + * @param {Object} options + * @param {Function} 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.toSnakeCase(options, ['auth0Client']); + + url = urljoin(this.baseOptions.rootUrl, 'passwordless', 'verify'); + + return this.request + .post(url) + .send(cleanOption) + .end(responseHandler(cb)); + }; + + module.exports = PasswordlessAuthentication; + + +/***/ }, +/* 34 */ +/***/ function(module, exports, __webpack_require__) { + + var windowHandler = __webpack_require__(3); + var base64Url = __webpack_require__(14); + + 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) { + date = new Date(); + date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); + 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 + }; + + +/***/ }, +/* 35 */ +/***/ function(module, exports, __webpack_require__) { + + var windowHelper = __webpack_require__(3); + + function IframeHandler(options) { + this.auth0 = options.auth0; + this.url = options.url; + this.callback = options.callback; + this.timeout = options.timeout || 60 * 1000; + this.timeoutCallback = options.timeoutCallback || null; + this.usePostMessage = options.usePostMessage || false; + this.iframe = null; + this.timeoutHandle = null; + this._destroyTimeout = null; + this.transientMessageEventListener = null; + this.transientEventListener = null; + } + + 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; + + if (this.usePostMessage) { + // Workaround to avoid using bind that does not work in IE8 + this.transientMessageEventListener = function (e) { + _this.messageEventListener(e); + }; + + _window.addEventListener('message', this.transientMessageEventListener, false); + } else { + // Workaround to avoid using bind that does not work in IE8 + this.transientEventListener = function () { + _this.loadEventListener(); + }; + + this.iframe.addEventListener('load', this.transientEventListener, false); + } + + _window.document.body.appendChild(this.iframe); + + this.timeoutHandle = setTimeout(function () { + _this.timeoutHandler(); + }, this.timeout); + }; + + IframeHandler.prototype.messageEventListener = function (e) { + this.destroy(); + this.callbackHandler(e.data); + }; + + IframeHandler.prototype.loadEventListener = function () { + var _this = this; + this.auth0.parseHash( + { hash: this.iframe.contentWindow.location.hash }, + function (error, result) { + if (error || result) { + _this.destroy(); + _this.callback(error, result); + } + } + ); + }; + + IframeHandler.prototype.callbackHandler = function (result) { + var error = null; + + if (result.error) { + error = result; + result = null; + } + + this.callback(error, result); + }; + + 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 () { + if (_this.usePostMessage) { + _window.removeEventListener('message', _this.transientMessageEventListener, false); + } else { + _this.iframe.removeEventListener('load', _this.transientEventListener, false); + } + + _window.document.body.removeChild(_this.iframe); + }, 0); + }; + + module.exports = IframeHandler; + + +/***/ }, +/* 36 */ +/***/ function(module, exports) { + + 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 + }; + +/***/ }, +/* 37 */ +/***/ function(module, exports, __webpack_require__) { + + var objectHelper = __webpack_require__(1); + + var token_params = [ + // 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 authorize_params = [ + // auth0 + 'connection', + 'connection_scope', + 'auth0Client', + 'owp', + 'device', + // 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(params) { + return objectHelper.pick(params, authorize_params); + } + + function oauthTokenParams(params) { + return objectHelper.pick(params, token_params); + } + + module.exports = { + oauthTokenParams: oauthTokenParams, + oauthAuthorizeParams: oauthAuthorizeParams + }; + + +/***/ }, +/* 38 */ +/***/ function(module, exports, __webpack_require__) { + + var WinChan = __webpack_require__(31); + + var windowHandler = __webpack_require__(3); + var objectHelper = __webpack_require__(1); + + function PopupHandler() { + this._current_popup = null; + } + + PopupHandler.prototype.stringifyPopupSettings = function (options) { + var settings = ''; + + for (var key in options) { + settings += key + '=' + options[key] + ','; + } + + return settings.slice(0, -1); + }; + + 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 = screenX + ((outerWidth - width) / 2); + var top = screenY + ((outerHeight - height) / 2); + + return { width: width, height: height, left: left, top: 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 = this.stringifyPopupSettings(popupOptions); + + 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 = { + url: url, + relay_url: relayUrl, + window_features: this.stringifyPopupSettings(popupOptions), + popup: this._current_popup, + params: options + }; + + var popup = WinChan.open(winchanOptions, function (err, data) { + _this._current_popup = null; + return cb(err, data); + }); + + popup.focus(); + + return popup; + }; + + module.exports = PopupHandler; + + +/***/ }, +/* 39 */ +/***/ function(module, exports, __webpack_require__) { + + var windowHelper = __webpack_require__(3); + + function randomString(length) { + 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 + }; + + +/***/ }, +/* 40 */ +/***/ function(module, exports, __webpack_require__) { + + var StorageHandler = __webpack_require__(43); + 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); + } + }; + + +/***/ }, +/* 41 */ +/***/ function(module, exports, __webpack_require__) { + + var windowHandler = __webpack_require__(3); + var cookies = __webpack_require__(34); + + 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; + +/***/ }, +/* 42 */ +/***/ function(module, exports) { + + function DummyStorage() {} + + DummyStorage.prototype.getItem = function (key) { return null; }; + + DummyStorage.prototype.removeItem = function (key) {}; + + DummyStorage.prototype.setItem = function (key, value) {}; + + module.exports = DummyStorage; + +/***/ }, +/* 43 */ +/***/ function(module, exports, __webpack_require__) { + + var windowHandler = __webpack_require__(3); + var DummyStorage = __webpack_require__(42); + var CookieStorage = __webpack_require__(41); + var Warn = __webpack_require__(6); + + 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; + + +/***/ }, +/* 44 */ +/***/ function(module, exports, __webpack_require__) { + + var urljoin = __webpack_require__(4); + + var RequestBuilder = __webpack_require__(9); + var assert = __webpack_require__(2); + var responseHandler = __webpack_require__(5); + + /** + * Auth0 Management API Client (methods allowed to be called from the browser only) + * @constructor + * @param {Object} options + * @param {Object} options.domain + * @param {Object} options.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'); + } + + /** + * Returns the user profile. https://auth0.com/docs/api/management/v2#!/Users/get_users_by_id + * + * @method getUser + * @param {String} userId + * @param {Function} cb + */ + 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. + * https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id + * + * @method patchUserMetadata + * @param {String} userId + * @param {Object} userMetadata + * @param {Function} cb + */ + 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. https://auth0.com/docs/api/management/v2#!/Users/post_identities + * + * @method linkUser + * @param {String} userId + * @param {Object} secondaryUserToken + * @param {Function} cb + */ + 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; + + +/***/ }, +/* 45 */ +/***/ function(module, exports, __webpack_require__) { + + var IdTokenVerifier = __webpack_require__(25); + + var assert = __webpack_require__(2); + var error = __webpack_require__(15); + var qs = __webpack_require__(8); + var windowHelper = __webpack_require__(3); + var objectHelper = __webpack_require__(1); + var TransactionManager = __webpack_require__(17); + var Authentication = __webpack_require__(13); + var Redirect = __webpack_require__(47); + var Popup = __webpack_require__(46); + var SilentAuthenticationHandler = __webpack_require__(48); + + /** + * Handles all the browser's authentication flows + * @constructor + * @param {Object} options + * @param {Object} options.domain + * @param {Object} options.clienID + * @param {Object} options.responseType + * @param {Object} options.responseMode + * @param {Object} options.scope + * @param {Object} options.audience + * @param {Object} options._disableDeprecationWarnings + */ + 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' }, + _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' } + }); + + 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._sendTelemetry = this.baseOptions._sendTelemetry === false ? + this.baseOptions._sendTelemetry : true; + + this.baseOptions.tenant = (this.overrides && this.overrides.__tenant) + || this.baseOptions.domain.split('.')[0]; + + this.baseOptions.token_issuer = (this.overrides && this.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.client, this.baseOptions); + } + + /** + * Parse the url hash and extract the returned tokens depending on the transaction. + * + * Only validates id_tokens signed by Auth0 using the RS256 algorithm using the public key exposed + * by the `/.well-known/jwks.json` endpoint. Id tokens signed with other algorithms will not be + * accepted. + * + * @method parseHash + * @param {Object} options: + * @param {String} options.state [OPTIONAL] to verify the response + * @param {String} options.nonce [OPTIONAL] to verify the id_token + * @param {String} options.hash [OPTIONAL] the url hash. If not provided it will extract from window.location.hash + * @param {Function} cb: function(err, token_payload) + */ + WebAuth.prototype.parseHash = function (options, cb) { + var parsedQs; + var err; + var state; + var transaction; + var transactionNonce; + var transactionState; + + if (!cb && typeof options === 'function') { + cb = options; + options = {}; + } else { + options = options || {}; + } + + 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; + transactionState = options.state || (transaction && transaction.state) || null; + + if (parsedQs.id_token) { + this.validateToken( + parsedQs.id_token, + transactionState, + transactionNonce, + function (validationError, payload) { + if (validationError) { + return cb(validationError); + } + + return cb(null, buildParseHashResponse(parsedQs, (transaction && transaction.appStatus) || null, payload)); + }); + } else { + cb(null, buildParseHashResponse(parsedQs, (transaction && transaction.appStatus) || null, null)); + } + }; + + function buildParseHashResponse(qs, appStatus, token) { + return { + accessToken: qs.access_token || null, + idToken: qs.id_token || null, + idTokenPayload: token || null, + appStatus: appStatus || null, + refreshToken: qs.refresh_token || null, + state: qs.state || null, + expiresIn: qs.expires_in ? parseInt(qs.expires_in, 10) : null, + tokenType: qs.token_type || null + }; + } + + /** + * Decodes the id_token and verifies the nonce. + * + * @method validateToken + * @param {String} token + * @param {String} state + * @param {String} nonce + * @param {Function} cb: function(err, {payload, transaction}) + */ + WebAuth.prototype.validateToken = function (token, state, 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 token. + * + * @method renewAuth + * @param {Object} options: any valid oauth2 parameter to be sent to the `/authorize` endpoint + * @param {Function} cb + */ + WebAuth.prototype.renewAuth = function (options, cb) { + var handler; + var prof; + var usePostMessage = !!options.usePostMessage; + var _this = this; + + var params = objectHelper.merge(this.baseOptions, [ + 'clientID', + 'redirectUri', + 'responseType', + 'scope', + 'audience' + ]).with(options); + + params.responseType = params.responseType || 'token'; + params.responseMode = params.responseMode || 'fragment'; + + 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']); + + handler = new SilentAuthenticationHandler(this, this.client.buildAuthorizeUrl(params)); + + handler.login(usePostMessage, function (err, data) { + if (err) { + return cb(err); + } + + var transaction = _this.transactionManager.getStoredTransaction(params.state); + var transactionNonce = options.nonce || (transaction && transaction.nonce) || null; + var transactionState = options.state || (transaction && transaction.state) || null; + + if (data.id_token) { + return _this.validateToken(data.id_token, transactionState, transactionNonce, function (err, payload) { + if (err) { + return cb(err); + } + + data.idTokenPayload = payload; + + return cb(null, data); + }); + } + + return cb(err, data); + }); + }; + + /** + * Initialices a change password transaction + * + * @method changePassword + * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password + * @param {Function} cb + */ + WebAuth.prototype.changePassword = function (options, cb) { + return this.client.dbConnection.changePassword(options, cb); + }; + + /** + * Initialices a passwordless authentication transaction + * + * @method passwordlessStart + * @param {Object} options: https://auth0.com/docs/api/authentication#passwordless + * @param {Object} options.type: `sms` or `email` + * @param {Object} options.phoneNumber: only if type = sms + * @param {Object} options.email: only if type = email + * @param {Function} cb + */ + WebAuth.prototype.passwordlessStart = function (options, cb) { + return this.client.passwordless.start(options, cb); + }; + + /** + * Signs up a new user + * + * @method signup + * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup + * @param {Function} cb + */ + WebAuth.prototype.signup = function (options, cb) { + return this.client.dbConnection.signup(options, cb); + }; + + /** + * Redirects to the hosted login page (`/authorize`) in order to initialize a new authN/authZ transaction + * + * @method authorize + * @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db + * @param {Function} cb + */ + WebAuth.prototype.authorize = function (options) { + var params = objectHelper.merge(this.baseOptions, [ + 'clientID', + 'responseType', + 'responseMode', + 'redirectUri', + 'scope', + 'audience' + ]).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: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup + * @param {Function} cb + */ + 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); + }); + }; + + /** + * Redirects to the auth0 logout page + * + * @method logout + * @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-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 {Object} options.type: `sms` or `email` + * @param {Object} options.phoneNumber: only if type = sms + * @param {Object} options.email: only if type = email + * @param {Object} options.connection: the connection name + * @param {Object} options.verificationCode: the TOTP code + * @param {Function} cb + */ + WebAuth.prototype.passwordlessVerify = function (options, cb) { + var _this = this; + return this.client.passwordless.verify(options, function (err) { + if (err) { + return cb(err); + } + return windowHelper.redirect(_this.client.passwordless.buildVerifyUrl(options)); + }); + }; + + module.exports = WebAuth; + + +/***/ }, +/* 46 */ +/***/ function(module, exports, __webpack_require__) { + + var urljoin = __webpack_require__(4); + + var assert = __webpack_require__(2); + var responseHandler = __webpack_require__(5); + var PopupHandler = __webpack_require__(38); + var objectHelper = __webpack_require__(1); + var Warn = __webpack_require__(6); + var TransactionManager = __webpack_require__(17); + + function Popup(client, options) { + this.baseOptions = options; + this.client = client; + + this.transactionManager = new TransactionManager(this.baseOptions.transaction); + this.warn = new Warn({ + disableWarnings: !!options._disableDeprecationWarnings + }); + } + + /** + * 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) { + var popup = new PopupHandler(); + popup.preload(options || {}); + return popup; + }; + + /** + * Internal use. + * + * @method getPopupHandler + */ + Popup.prototype.getPopupHandler = function (options, preload) { + if (options.popupHandler) { + return options.popupHandler; + } + return !!preload ? this.preload(options) : new PopupHandler(); + }; + + /** + * Opens in a popup the hosted login page (`/authorize`) in order to initialize a new authN/authZ transaction + * + * @method authorize + * @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db + * @param {Function} cb + */ + Popup.prototype.authorize = function (options, cb) { + var popup; + var url; + var relayUrl; + + var params = objectHelper.merge(this.baseOptions, [ + 'clientID', + 'scope', + 'audience', + 'responseType' + ]).with(objectHelper.blacklist(options, ['popupHandler'])); + + assert.check(params, { type: 'object', message: 'options parameter is not valid' }, { + responseType: { type: 'string', message: 'responseType option is required' } + }); + + // used by server to render the relay page instead of sending the chunk in the + // url to the callback + params.owp = true; + + params = this.transactionManager.process(params); + + url = this.client.buildAuthorizeUrl(params); + + popup = this.getPopupHandler(options); + + relayUrl = urljoin(this.baseOptions.rootUrl, 'relay.html'); + + return popup.load(url, relayUrl, {}, responseHandler(cb)); + }; + + /** + * Initializes the legacy Lock login flow in a popup + * + * @method loginWithCredentials + * @param {Object} options + * @param {Function} cb + * @deprecated `webauth.popup.loginWithCredentials` will be soon deprecated, use `webauth.client.login` instead. + */ + Popup.prototype.loginWithCredentials = function (options, cb) { + var params; + var popup; + var url; + var relayUrl; + + this.warn.warning('`webauth.popup.loginWithCredentials` will be soon deprecated, use `webauth.client.login` instead.'); + + /* 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' + ]).with(objectHelper.blacklist(options, ['popupHandler'])); + + params = objectHelper.pick(options, ['clientID', 'domain']); + params.options = objectHelper.toSnakeCase( + objectHelper.blacklist(options, ['clientID', 'domain']) + ); + + url = urljoin(this.baseOptions.rootUrl, 'sso_dbconnection_popup', options.clientID); + relayUrl = urljoin(this.baseOptions.rootUrl, 'relay.html'); + + return popup.load(url, relayUrl, params, responseHandler(cb)); + }; + + /** + * Verifies the passwordless TOTP and returns the requested token + * + * @method passwordlessVerify + * @param {Object} options: + * @param {Object} options.type: `sms` or `email` + * @param {Object} options.phoneNumber: only if type = sms + * @param {Object} options.email: only if type = email + * @param {Object} options.connection: the connection name + * @param {Object} 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. + * + * @method signupAndLogin + * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup + * @param {Function} 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; + +/***/ }, +/* 47 */ +/***/ function(module, exports, __webpack_require__) { + + var UsernamePassword = __webpack_require__(49); + var objectHelper = __webpack_require__(1); + var Warn = __webpack_require__(6); + var assert = __webpack_require__(2); + + function Redirect(client, options) { + this.baseOptions = options; + this.client = client; + + this.warn = new Warn({ + disableWarnings: !!options._disableDeprecationWarnings + }); + } + + /** + * Initializes the legacy Lock login flow in redirect mode + * + * @method loginWithCredentials + * @param {Object} options + * @param {Function} cb + * @deprecated `webauth.redirect.loginWithCredentials` will be soon deprecated, use `webauth.login` instead. + */ + Redirect.prototype.loginWithCredentials = function (options, cb) { + var usernamePassword; + + var params = objectHelper.merge(this.baseOptions, [ + 'clientID', + 'redirectUri', + 'tenant', + 'responseType', + 'responseMode', + 'scope', + 'audience' + ]).with(options); + + this.warn.warning('`webauth.redirect.loginWithCredentials` will be soon deprecated, use `webauth.login` instead.'); + + 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: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup + * @param {Function} 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; + + +/***/ }, +/* 48 */ +/***/ function(module, exports, __webpack_require__) { + + var IframeHandler = __webpack_require__(35); + + function SilentAuthenticationHandler(auth0, authenticationUrl, timeout) { + this.auth0 = auth0; + this.authenticationUrl = authenticationUrl; + this.timeout = timeout || 60 * 1000; + this.handler = null; + } + + SilentAuthenticationHandler.prototype.login = function (usePostMessage, callback) { + this.handler = new IframeHandler({ + auth0: this.auth0, + url: this.authenticationUrl, + callback: callback, + timeout: this.timeout, + timeoutCallback: function () { + callback({ + error: 'timeout', + description: 'Timeout during authentication renew.' + }); + }, + usePostMessage: usePostMessage || false + }); + + this.handler.init(); + }; + + module.exports = SilentAuthenticationHandler; + + +/***/ }, +/* 49 */ +/***/ function(module, exports, __webpack_require__) { + + var urljoin = __webpack_require__(4); + + var objectHelper = __webpack_require__(1); + var RequestBuilder = __webpack_require__(9); + var responseHandler = __webpack_require__(5); + 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..445aaa0f --- /dev/null +++ b/build/auth0.min.js @@ -0,0 +1,12 @@ +/*! + * auth0.min.js v8.1.1 + * + * Author: Auth0 + * Date: 1/17/2017, 5:05:07 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(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return t[i].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){var i=n(13),r=n(44),o=n(45),s=n(16);t.exports={Authentication:i,Management:r,WebAuth:o,version:s.raw}},function(t,e,n){function i(t,e){return e.reduce(function(e,n){return t[n]&&(e[n]=t[n]),e},{})}function r(t){var e=[];for(var n in t)e.push(t[n]);return e}function o(){var t=r(arguments);return t.unshift({}),d.get().apply(void 0,t)}function s(t,e){return{base:e?i(t,e):t,with:function(t,e){return t=e?i(t,e):t,o(this.base,t)}}}function a(t,e){return Object.keys(t).reduce(function(n,i){return e.indexOf(i)===-1&&(n[i]=t[i]),n},{})}function u(t){for(var e,n="",i=0,r=!0,o=!0;i=65&&e<=90||!r&&e>=48&&e<=57?(n+="_",n+=t[i].toLowerCase()):n+=t[i].toLowerCase(),r=e>=48&&e<=57,o=e>=65&&e<=90,i++;return n}function p(t){var e=t.split("_");return e.reduce(function(t,e){return t+e.charAt(0).toUpperCase()+e.slice(1)},e.shift())}function c(t,e){return"object"!=typeof t||l.isArray(t)||null===!t?t:(e=e||[],Object.keys(t).reduce(function(n,i){var r=e.indexOf(i)===-1?u(i):i;return n[r]=c(t[i]),n},{}))}function h(t,e){return"object"!=typeof t||l.isArray(t)||null===!t?t:(e=e||[],Object.keys(t).reduce(function(n,i){var r=e.indexOf(i)===-1?p(i):i;return n[r]=h(t[i]),n},{}))}var l=n(2),d=n(36);t.exports={toSnakeCase:c,toCamelCase:h,blacklist:a,merge:s,pick:i,extend:o}},function(t,e){function n(t,e,n,i){if(t&&typeof t[e]!==n)throw new Error(i)}function i(t,e,n){if(typeof t!==e)throw new Error(n)}function r(t,e,n){if(e.indexOf(t)===-1)throw new Error(n)}function o(t,e,o){if(e.optional&&!t||i(t,e.type,e.message),"object"===e.type&&o)for(var s=Object.keys(o),a=0;a0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return 3*t.length/4-n(t)}function r(t){var e,i,r,o,s,a,u=t.length;s=n(t),a=new c(3*u/4-s),r=s>0?u-4:u;var h=0;for(e=0,i=0;e>16&255,a[h++]=o>>8&255,a[h++]=255&o;return 2===s?(o=p[t.charCodeAt(e)]<<2|p[t.charCodeAt(e+1)]>>4,a[h++]=255&o):1===s&&(o=p[t.charCodeAt(e)]<<10|p[t.charCodeAt(e+1)]<<4|p[t.charCodeAt(e+2)]>>2,a[h++]=o>>8&255,a[h++]=255&o),a}function o(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function s(t,e,n){for(var i,r=[],s=e;sc?c:p+a));return 1===i?(e=t[n-1],r+=u[e>>2],r+=u[e<<4&63],r+="=="):2===i&&(e=(t[n-2]<<8)+t[n-1],r+=u[e>>10],r+=u[e>>4&63],r+=u[e<<2&63],r+="="),o.push(r),o.join("")}e.byteLength=i,e.toByteArray=r,e.fromByteArray=a;for(var u=[],p=[],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){var e=this,n=this.xhr=v.getXHR(),r=this._formData||this._data;this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=t||i,n.onreadystatechange=function(){var t=n.readyState;if(t>=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4==t){var i;try{i=n.status}catch(t){i=0}if(!i){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var o=function(t,n){n.total>0&&(n.percent=n.loaded/n.total*100),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{n.onprogress=o.bind(null,"download"),n.upload&&(n.upload.onprogress=o.bind(null,"upload"))}catch(t){}this._appendQueryString(),this._setTimeouts();try{this.username&&this.password?n.open(this.method,this.url,!0,this.username,this.password):n.open(this.method,this.url,!0)}catch(t){return this.callback(t)}if(this._withCredentials&&(n.withCredentials=!0),!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof r&&!this._isHost(r)){var s=this._header["content-type"],a=this._serializer||v.serialize[s?s.split(";")[0]:""];!a&&u(s)&&(a=v.serialize["application/json"]),a&&(r=a(r))}for(var p in this.header)null!=this.header[p]&&n.setRequestHeader(p,this.header[p]);return this._responseType&&(n.responseType=this._responseType),this.emit("request",this),n.send("undefined"!=typeof r?r:null),this},v.get=function(t,e,n){var i=v("GET",t);return"function"==typeof e&&(n=e,e=null),e&&i.query(e),n&&i.end(n),i},v.head=function(t,e,n){var i=v("HEAD",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},v.options=function(t,e,n){var i=v("OPTIONS",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},v.del=h,v.delete=h,v.patch=function(t,e,n){var i=v("PATCH",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},v.post=function(t,e,n){var i=v("POST",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},v.put=function(t,e,n){var i=v("PUT",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i}},function(t,e,n){function i(t){u.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 r=n(4),o=n(9),s=n(8),a=n(1),u=n(2),p=n(5),c=n(37),h=n(6),l=n(33),d=n(32);i.prototype.buildAuthorizeUrl=function(t){var e,n;return u.check(t,{type:"object",message:"options parameter is not valid"}),e=a.merge(this.baseOptions,["clientID","responseType","responseMode","redirectUri","scope","audience"]).with(t),u.check(e,{type:"object",message:"options parameter is not valid"},{clientID:{type:"string",message:"clientID option is required"},redirectUri:{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&&u.isArray(e.connection_scope)&&(e.connection_scope=e.connection_scope.join(",")),e=a.toSnakeCase(e,["auth0Client"]),e=c.oauthAuthorizeParams(e),n=s.build(e),r(this.baseOptions.rootUrl,"authorize","?"+n)},i.prototype.buildLogoutUrl=function(t){var e,n;return u.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.build(e),r(this.baseOptions.rootUrl,"v2","logout","?"+n)},i.prototype.loginWithDefaultDirectory=function(t,e){return u.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)},i.prototype.login=function(t,e){return u.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)},i.prototype.oauthToken=function(t,e){var n,i;return u.check(t,{type:"object",message:"options parameter is not valid"}),u.check(e,{type:"function",message:"cb parameter is not valid"}),n=r(this.baseOptions.rootUrl,"oauth","token"),i=a.merge(this.baseOptions,["clientID","scope","audience"]).with(t),u.check(i,{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"}}),i=a.toSnakeCase(i,["auth0Client"]),i=c.oauthTokenParams(i),i.grant_type=i.grant_type,this.request.post(n).send(i).end(p(e))},i.prototype.loginWithResourceOwner=function(t,e){var n,i;return this.warn.warning("`loginWithResourceOwner` will be soon deprecated, user `login` instead."),u.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"},audience:{optional:!0,type:"string",message:"audience option is required"}}),u.check(e,{type:"function",message:"cb parameter is not valid"}),n=r(this.baseOptions.rootUrl,"oauth","ro"),i=a.merge(this.baseOptions,["clientID","scope","audience"]).with(t),i=a.toSnakeCase(i,["auth0Client"]),i.grant_type=i.grant_type||"password",this.request.post(n).send(i).end(p(e))},i.prototype.getSSOData=function(t,e){var n,i="";return this.warn.warning("`getSSOData` will be soon deprecated."),"function"==typeof t&&(e=t,t=!1),u.check(t,{type:"boolean",message:"withActiveDirectories parameter is not valid"}),u.check(e,{type:"function",message:"cb parameter is not valid"}),t&&(i="?"+s.build({ldaps:1,client_id:this.baseOptions.clientID})),n=r(this.baseOptions.rootUrl,"user","ssodata",i),this.request.get(n,{noHeaders:!0}).withCredentials().end(p(e))},i.prototype.userInfo=function(t,e){var n;return u.check(t,{type:"string",message:"accessToken parameter is not valid"}),u.check(e,{type:"function",message:"cb parameter is not valid"}),n=r(this.baseOptions.rootUrl,"userinfo"),this.request.get(n).set("Authorization","Bearer "+t).end(p(e,{ignoreCasing:!0}))},i.prototype.delegation=function(t,e){var n,i;return this.warn.warning("`delegation` will be soon deprecated."),u.check(t,{type:"object",message:"options parameter is not valid"},{grant_type:{type:"string",message:"grant_type option is required"}}),u.check(e,{type:"function",message:"cb parameter is not valid"}),n=r(this.baseOptions.rootUrl,"delegation"),i=a.merge(this.baseOptions,["clientID"]).with(t),i=a.toSnakeCase(i,["auth0Client"]),this.request.post(n).send(i).end(p(e))},i.prototype.getUserCountry=function(t){var e;return u.check(t,{type:"function",message:"cb parameter is not valid"}),e=r(this.baseOptions.rootUrl,"user","geoloc","country"),this.request.get(e).end(p(t))},t.exports=i},function(t,e,n){function i(t){var e=t.length%4,n=4-e;return 0===e?t:t+new Array(1+n).join("=")}function r(t){for(var e=new Array(t.length),n=0;n>>2]>>>24-o%4*8&255;e[i+o>>>2]|=s<<24-(i+o)%4*8}else for(var o=0;o>>2]=n[o>>>2];return this.sigBytes+=r,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,i=[],r=function(e){var e=e,n=987654321,i=4294967295;return function(){n=36969*(65535&n)+(n>>16)&i,e=18e3*(65535&e)+(e>>16)&i;var r=(n<<16)+e&i;return r/=4294967296,r+=.5,r*(t.random()>.5?1:-1)}},o=0;o>>2]>>>24-r%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(t){for(var e=t.length,n=[],i=0;i>>3]|=parseInt(t.substr(i,2),16)<<24-i%8*4;return new s.init(n,e/2)}},p=a.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,i=[],r=0;r>>2]>>>24-r%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(t){for(var e=t.length,n=[],i=0;i>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;return new s.init(n,e)}},c=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(p.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return p.parse(unescape(encodeURIComponent(t)))}},h=r.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,i=n.words,r=n.sigBytes,o=this.blockSize,a=4*o,u=r/a;u=e?t.ceil(u):t.max((0|u)-this._minBufferSize,0);var p=u*o,c=t.min(4*p,r);if(p){for(var h=0;h>>7)^(f<<14|f>>>18)^f>>>3,m=p[d-2],g=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;p[d]=y+p[d-7]+g+p[d-16]}var v=a&c^~a&h,w=i&r^i&o^r&o,b=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),T=(a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25),_=l+T+v+u[d]+p[d],k=b+w;l=h,h=c,c=a,a=s+_|0,s=o,o=r,r=i,i=_+k|0}n[0]=n[0]+i|0,n[1]=n[1]+r|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,i=8*this._nDataBytes,r=8*t.sigBytes;return n[r>>>5]|=128<<24-r%32,n[(r+64>>>9<<4)+14]=e.floor(i/4294967296),n[(r+64>>>9<<4)+15]=i,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,n){(function(){function n(t,e,n){null!=t&&("number"==typeof t?this.fromNumber(t,e,n):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function i(){return new n(null)}function r(t,e,n,i,r,o){for(;--o>=0;){var s=e*this[t++]+n[i]+r;r=Math.floor(s/67108864),n[i++]=67108863&s}return r}function o(t,e,n,i,r,o){for(var s=32767&e,a=e>>15;--o>=0;){var u=32767&this[t],p=this[t++]>>15,c=a*u+p*s;u=s*u+((32767&c)<<15)+n[i]+(1073741823&r),r=(u>>>30)+(c>>>15)+a*p+(r>>>30),n[i++]=1073741823&u}return r}function s(t,e,n,i,r,o){for(var s=16383&e,a=e>>14;--o>=0;){var u=16383&this[t],p=this[t++]>>14,c=a*u+p*s;u=s*u+((16383&c)<<14)+n[i]+r,r=(u>>28)+(c>>14)+a*p,n[i++]=268435455&u}return r}function a(t){return me.charAt(t)}function u(t,e){var n=ge[t.charCodeAt(e)];return null==n?-1:n}function p(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=i();return e.fromInt(t),e}function l(t,e){var i;if(16==e)i=4;else if(8==e)i=3;else if(256==e)i=8;else if(2==e)i=1;else if(32==e)i=5;else{if(4!=e)return void this.fromRadix(t,e);i=2}this.t=0,this.s=0;for(var r=t.length,o=!1,s=0;--r>=0;){var a=8==i?255&t[r]:u(t,r);a<0?"-"==t.charAt(r)&&(o=!0):(o=!1,0==s?this[this.t++]=a:s+i>this.DB?(this[this.t-1]|=(a&(1<>this.DB-s):this[this.t-1]|=a<=this.DB&&(s-=this.DB))}8==i&&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,i=(1<0)for(u>u)>0&&(r=!0,o=a(n));s>=0;)u>(u+=this.DB-e)):(n=this[s]>>(u-=e)&i,u<=0&&(u+=this.DB,--s)),n>0&&(r=!0),r&&(o+=a(n));return r?o:"0"}function y(){var t=i();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 w(){return this.t<=0?0:this.DB*(this.t-1)+v(this[this.t-1]^this.s&this.DM)} +function b(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(t,e){for(var n=t;n=0;--n)e[n+s+1]=this[n]>>r|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 i=t%this.DB,r=this.DB-i,o=(1<>i;for(var s=n+1;s>i;i>0&&(e[this.t-n-1]|=(this.s&o)<>=this.DB;if(t.t>=this.DB;i+=this.s}else{for(i+=this.s;n>=this.DB;i-=t.s}e.s=i<0?-1:0,i<-1?e[n++]=this.DV+i:i>0&&(e[n++]=i),e.t=n,e.clamp()}function O(t,e){var i=this.abs(),r=t.abs(),o=i.t;for(e.t=o+r.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 S(t,e,r){var o=t.abs();if(!(o.t<=0)){var s=this.abs();if(s.t0?(o.lShiftTo(c,a),s.lShiftTo(c,r)):(o.copyTo(a),s.copyTo(r));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&&(r[r.t++]=1,r.subTo(b,r)),n.ONE.dlShiftTo(h,b),b.subTo(a,a);a.t=0;){var T=r[--g]==l?this.DM:Math.floor(r[g]*f+(r[g-1]+m)*y);if((r[g]+=a.am(0,T,r,w,0,h))0&&r.rShiftTo(c,r),u<0&&n.ZERO.subTo(r,r)}}}function D(t){var e=i();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(n.ZERO)>0&&t.subTo(e,e),e}function q(t){this.m=t}function E(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function A(t){return t}function I(t){t.divRemTo(this.m,null,t)}function j(t,e,n){t.multiplyTo(e,n),this.reduce(n)}function B(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 P(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 U(t){var e=i();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,i,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 W(){return 0==(this.t>0?1&this[0]:this.s)}function V(t,e){if(t>4294967295||t<1)return n.ONE;var r=i(),o=i(),s=e.convert(this),a=v(t)-1;for(s.copyTo(r);--a>=0;)if(e.sqrTo(r,o),(t&1<0)e.mulTo(o,s,r);else{var u=r;r=o,o=u}return e.revert(r)}function z(t,e){var n;return n=t<256||e.isEven()?new q(e):new P(e),this.exp(t,n)}function F(){var t=i();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 G(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function K(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),r=h(n),o=i(),s=i(),a="";for(this.divRemTo(r,o,s);o.signum()>0;)a=(n+s.intValue()).toString(t).substr(1)+a,o.divRemTo(r,o,s);return s.intValue().toString(t)+a}function Q(t,e){this.fromInt(0),null==e&&(e=10);for(var i=this.chunkSize(e),r=Math.pow(e,i),o=!1,s=0,a=0,p=0;p=i&&(this.dMultiply(r),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,i){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,i),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 r=new Array,o=7&t;r.length=(t>>3)+1,e.nextBytes(r),o>0?r[0]&=(1<0)for(i>i)!=(this.s&this.DM)>>i&&(e[r++]=n|this.s<=0;)i<8?(n=(this[t]&(1<>(i+=this.DB-8)):(n=this[t]>>(i-=8)&255,i<=0&&(i+=this.DB,--t)),0!=(128&n)&&(n|=-256),0==r&&(128&this.s)!=(128&n)&&++r,(r>0||n!=this.s)&&(e[r++]=n);return e}function et(t){return 0==this.compareTo(t)}function nt(t){return this.compareTo(t)<0?this:t}function it(t){return this.compareTo(t)>0?this:t}function rt(t,e,n){var i,r,o=Math.min(t.t,this.t);for(i=0;i>=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;i+=this.s}else{for(i+=this.s;n>=this.DB;i+=t.s}e.s=i<0?-1:0,i>0?e[n++]=i:i<-1&&(e[n++]=this.DV+i),e.t=n,e.clamp()}function Ct(t){var e=i();return this.addTo(t,e),e}function St(t){var e=i();return this.subTo(t,e),e}function Dt(t){var e=i();return this.multiplyTo(t,e),e}function qt(){var t=i();return this.squareTo(t),t}function Et(t){var e=i();return this.divRemTo(t,e,null),e}function At(t){var e=i();return this.divRemTo(t,null,e),e}function It(t){var e=i(),n=i();return this.divRemTo(t,e,n),new Array(e,n)}function jt(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function Bt(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 Pt(t){return t}function Rt(t,e,n){t.multiplyTo(e,n)}function Ut(t,e){t.squareTo(e)}function Ht(t){return this.exp(t,new Mt)}function Lt(t,e,n){var i=Math.min(this.t+t.t,e);for(n.s=0,n.t=i;i>0;)n[--i]=0;var r;for(r=n.t-this.t;i=0;)n[i]=0;for(i=Math.max(e-this.t,0);i2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=i();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,r,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,r=o<8?new q(e):e.isEven()?new Wt(e):new P(e);var a=new Array,u=3,p=n-1,c=(1<1){var l=i();for(r.sqrTo(a[1],l);u<=c;)a[u]=i(),r.mulTo(l,a[u-2],a[u]),u+=2}var d,f,y=t.t-1,m=!0,g=i();for(o=v(t[y])-1;y>=0;){for(o>=p?d=t[y]>>o-p&c:(d=(t[y]&(1<0&&(d|=t[y-1]>>this.DB+o-p)),u=n;0==(1&d);)d>>=1,--u;if((o-=u)<0&&(o+=this.DB,--y),m)a[d].copyTo(s),m=!1;else{for(;u>1;)r.sqrTo(s,g),r.sqrTo(g,s),u-=2;u>0?r.sqrTo(s,g):(f=s,s=g,g=f),r.mulTo(g,a[d],s)}for(;y>=0&&0==(t[y]&1<0&&(e.rShiftTo(o,e),n.rShiftTo(o,n));e.signum()>0;)(r=e.getLowestSetBit())>0&&e.rShiftTo(r,e),(r=n.getLowestSetBit())>0&&n.rShiftTo(r,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 Gt(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 i=this.t-1;i>=0;--i)n=(e*n+this[i])%t;return n}function Kt(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return n.ZERO;for(var i=t.clone(),r=this.clone(),o=h(1),s=h(0),a=h(0),u=h(1);0!=i.signum();){for(;i.isEven();)i.rShiftTo(1,i),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(;r.isEven();)r.rShiftTo(1,r),e?(a.isEven()&&u.isEven()||(a.addTo(this,a),u.subTo(t,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(t,u),u.rShiftTo(1,u);i.compareTo(r)>=0?(i.subTo(r,i),e&&o.subTo(a,o),s.subTo(u,s)):(r.subTo(i,r),e&&a.subTo(o,a),u.subTo(s,u))}return 0!=r.compareTo(n.ONE)?n.ZERO:u.compareTo(t)>=0?u.subtract(t):u.signum()<0?(u.addTo(t,u),u.signum()<0?u.add(t):u):u}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=i(),a=0;a>8&255,Te[_e++]^=t>>16&255,Te[_e++]^=t>>24&255,_e>=Ce&&(_e-=Ce)}function ee(){te((new Date).getTime())}function ne(){if(null==be){for(ee(),be=ue(),be.init(Te),_e=0;_e>>8,Te[_e++]=255&ke;_e=0,ee()}re.prototype.nextBytes=ie,oe.prototype.init=se,oe.prototype.next=ae;var Ce=256;e=t.exports={BigInteger:n,SecureRandom:re}}).call(this)},function(t,e){function n(){}n.prototype.get=function(t){return null},n.prototype.has=function(t){return!1},n.prototype.set=function(t,e){},t.exports=n},function(t,e){function n(t){this.name="ConfigurationError",this.message=t||""}function i(t){this.name="TokenValidationError",this.message=t||""}n.prototype=Error.prototype,i.prototype=Error.prototype,t.exports={ConfigurationError:n,TokenValidationError:i}},function(t,e,n){function i(t){var e=s.decodeToHEX(t.n),n=s.decodeToHEX(t.e);return{modulus:e,exp:n}}function r(t,e){var n=o(t.iss,".well-known","jwks.json");return a.get(n).end(function(n,r){n&&e(n);for(var o=null,s=0;s0&&e.length>0))throw new Error("Invalid key data");this.n=new o(t,16),this.e=parseInt(e,16)}function r(t){for(var e in a){var n=a[e],i=n.length;if(t.substring(0,i)===n)return{alg:e,hash:t.substring(i)}}return[]}var o=n(20).BigInteger,s=n(19),a={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},u={sha256:s};i.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 i=n.modPowInt(this.e,this.n),s=i.toString(16).replace(/^1f+00/,""),a=r(s);if(0===a.length)return!1;if(!u.hasOwnProperty(a.alg))throw new Error("Hashing algorithm is not supported.");var p=u[a.alg](t).toString();return a.hash===p},t.exports=i},function(t,e,n){function i(t){if(t=t||{},this.jwksCache=t.jwksCache||new u,this.expectedAlg=t.expectedAlg||"RS256",this.issuer=t.issuer,this.audience=t.audience,this.leeway=t.leeway||0,this.__disableExpirationCheck=t.__disableExpirationCheck||!1,this.leeway<0||this.leeway>60)throw new a.ConfigurationError("The leeway should be positive and lower than a minute.");if(p.indexOf(this.expectedAlg)===-1)throw new a.ConfigurationError("Algorithm "+this.expectedAlg+" is not supported. (Expected algs: ["+p.join(",")+"])")}var r=n(24),o=n(11),s=n(23),a=n(22),u=n(21),p=["RS256"];i.prototype.verify=function(t,e,n){var i=this.decode(t);if(i instanceof Error)return n(i,!1);var r=i.encoded.header+"."+i.encoded.payload,s=o.decodeToHEX(i.encoded.signature),u=i.header.alg,c=i.header.kid,h=i.payload.aud,l=i.payload.iss,d=i.payload.exp,f=i.payload.iat,y=i.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!==u)return n(new a.TokenValidationError("Algorithm "+u+" is not supported. (Expected algs: ["+p.join(",")+"])"),!1);if(y!==e)return n(new a.TokenValidationError("Nonce does not match."),!1);var m=this.verifyExpAndIat(d,f);return m?n(m,!1):void this.getRsaVerifier(l,c,function(t,e){return t?n(t):void(e.verify(r,s)?n(null,i.payload):n(new a.TokenValidationError("Invalid signature.")))})},i.prototype.verifyExpAndIat=function(t,e){if(this.__disableExpirationCheck)return null;var n=new Date,i=new Date(0);if(i.setUTCSeconds(t+this.leeway),n>i)return new a.TokenValidationError("Expired token.");var r=new Date(0);return r.setUTCSeconds(e-this.leeway),n=200&&t.status<300)},i.prototype.get=function(t){return this._header[t.toLowerCase()]},i.prototype.getHeader=i.prototype.get,i.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},i.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},i.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 i in e)this.field(t,e[i]);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},i.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)},i.prototype.withCredentials=function(){return this._withCredentials=!0,this},i.prototype.redirects=function(t){return this._maxRedirects=t,this},i.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},i.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 i in t)this._data[i]=t[i];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)},i.prototype.sortQuery=function(t){return this._sort="undefined"==typeof t||t,this},i.prototype._timeoutError=function(t,e){if(!this._aborted){var n=new Error(t+e+"ms exceeded");n.timeout=e,n.code="ECONNABORTED",this.timedout=!0,this.abort(),this.callback(n)}},i.prototype._setTimeouts=function(){var t=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){t._timeoutError("Timeout of ",t._timeout)},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){t._timeoutError("Response timeout of ",t._responseTimeout)},this._responseTimeout))}},function(t,e,n){function i(t){if(t)return r(t)}function r(t){for(var e in i.prototype)t[e]=i.prototype[e];return t}var o=n(29);t.exports=i,i.prototype.get=function(t){return this.header[t.toLowerCase()]},i.prototype._setHeaderProperties=function(t){var e=t["content-type"]||"";this.type=o.type(e);var n=o.params(e);for(var i in n)this[i]=n[i];this.links={};try{t.link&&(this.links=o.parseLinks(t.link))}catch(t){}},i.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){e.type=function(t){return t.split(/ *; */).shift()},e.params=function(t){return t.split(/ *; */).reduce(function(t,e){var n=e.split(/ *= */),i=n.shift(),r=n.shift();return i&&r&&(t[i]=r),t},{})},e.parseLinks=function(t){return t.split(/ *, */).reduce(function(t,e){var n=e.split(/ *; */),i=n[0].slice(1,-1),r=n[1].split(/ *= */)[1].slice(1,-1);return t[r]=i,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 i(t){if(t)return r(t)}function r(t){for(var e in i.prototype)t[e]=i.prototype[e];return t}t.exports=i,i.prototype.on=i.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},i.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},i.prototype.off=i.prototype.removeListener=i.prototype.removeAllListeners=i.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var i,r=0;r-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 i(){try{var t=navigator.userAgent;return t.indexOf("Fennec/")!=-1||t.indexOf("Firefox/")!=-1&&t.indexOf("Android")!=-1}catch(t){}return!1}function r(){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",u="die",p=n();return r()?{open:function(n,r){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(u,d)}y=f=void 0}function c(t){if(t.origin===d)try{var e=JSON.parse(t.data);"ready"===e.a?f.postMessage(g,d):"error"===e.a?(s(),r&&(r(e.d),r=null)):"response"===e.a&&(s(),r&&(r(null,e.d),r=null))}catch(t){}}if(!r)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(){r(h)},0),n.window_name||(n.window_name=null),n.window_features&&!i()||(n.window_features=void 0);var l,d=o(n.url);if(d!==o(n.relay_url))return setTimeout(function(){r("invalid arguments: origin of url and relay_url must match")},0);var f;p&&(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(),r&&(r("User closed the popup window"),r=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 i(t){t=JSON.stringify(t),p?c.doPost(t,a):c.postMessage(t,a)}function r(t){var o;try{o=JSON.parse(t.data)}catch(t){}o&&"request"===o.a&&(e(window,"message",r),a=t.origin,n&&setTimeout(function(){n(a,o.d,function(t){n=void 0,i({a:"response",d:t})})},0))}function o(t){if(t.data===u)try{window.close()}catch(t){}}var a="*",c=p?s():window.opener;if(!c)throw"can't find relay frame";t(p?c:window,"message",r),t(p?c:window,"message",o);try{i({a:"ready"})}catch(e){t(c,"load",function(t){i({a:"ready"})})}var h=function(){try{e(p?c:window,"message",o)}catch(t){}n&&i({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,i){setTimeout(function(){i("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 i(t,e){this.baseOptions=e,this.request=t}var r=n(4),o=n(1),s=n(2),a=n(5);i.prototype.signup=function(t,e){var n,i;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=r(this.baseOptions.rootUrl,"dbconnections","signup"),i=o.merge(this.baseOptions,["clientID"]).with(t),i=o.blacklist(i,["scope"]),i=o.toSnakeCase(i,["auth0Client"]),this.request.post(n).send(i).end(a(e))},i.prototype.changePassword=function(t,e){var n,i;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=r(this.baseOptions.rootUrl,"dbconnections","change_password"),i=o.merge(this.baseOptions,["clientID"]).with(t,["email","connection"]),i=o.toSnakeCase(i,["auth0Client"]),this.request.post(n).send(i).end(a(e))},t.exports=i},function(t,e,n){function i(t,e){this.baseOptions=e,this.request=t}var r=n(4),o=n(1),s=n(2),a=n(8),u=n(5);i.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"]).with(t),this.baseOptions._sendTelemetry&&(e.auth0Client=this.request.getTelemetryData()),e=o.toSnakeCase(e,["auth0Client"]),n=a.build(e),r(this.baseOptions.rootUrl,"passwordless","verify_redirect","?"+n)},i.prototype.start=function(t,e){var n,i;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=r(this.baseOptions.rootUrl,"passwordless","start"),i=o.merge(this.baseOptions,["clientID","responseType","redirectUri","scope"]).with(t),i.scope&&(i.authParams=i.authParams||{},i.authParams.scope=i.scope),i.redirectUri&&(i.authParams=i.authParams||{},i.authParams.redirect_uri=i.redirectUri),i.responseType&&(i.authParams=i.authParams||{},i.authParams.response_type=i.responseType),delete i.redirectUri,delete i.responseType,delete i.scope,i=o.toSnakeCase(i,["auth0Client","authParams"]),this.request.post(n).send(i).end(u(e))},i.prototype.verify=function(t,e){var n,i;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"}),i=o.toSnakeCase(t,["auth0Client"]),n=r(this.baseOptions.rootUrl,"passwordless","verify"),this.request.post(n).send(i).end(u(e))},t.exports=i},function(t,e,n){function i(t,e,n){var i,r;if(void 0===s.getDocument().cookie||null===s.getDocument().cookie)throw new Error("cookie storage not available");n?(i=new Date,i.setTime(i.getTime()+24*n*60*60*1e3),r="; expires="+i.toGMTString()):r="",s.getDocument().cookie=t+"="+a.encode(e)+r+"; path=/"}function r(t){var e,n,i,r=t+"=";if(void 0===s.getDocument().cookie||null===s.getDocument().cookie)throw new Error("cookie storage not available");for(i=s.getDocument().cookie.split(";"),e=0;e= 65 && code <= 90) || (!wasPrevNumber && code >= 48 && code <= 57)) {\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\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\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 extend: extend\n\t};\n\n\n/***/ },\n/* 2 */\n/***/ function(module, exports) {\n\n\tvar toString = Object.prototype.toString;\n\t\n\tfunction attribute(o, attr, type, text) {\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/**\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 * @public\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/* 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, __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/* 5 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar error = __webpack_require__(15);\n\tvar objectHelper = __webpack_require__(1);\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) {\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 = err.error_description || err.description || err.error || err.details || err.err || 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/* 6 */\n/***/ function(module, exports) {\n\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/* 7 */\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/* 8 */\n/***/ function(module, exports) {\n\n\tfunction build(params) {\n\t return Object.keys(params).reduce(function (arr, key) {\n\t if (typeof params[key] !== 'undefined') {\n\t arr.push(key + '=' + encodeURIComponent(params[key]));\n\t }\n\t return arr;\n\t }, []).join('&');\n\t}\n\t\n\tfunction parse(qs) {\n\t return qs.split('&').reduce(function (prev, curr) {\n\t var param = curr.split('=');\n\t prev[param[0]] = param[1];\n\t return prev;\n\t }, {});\n\t}\n\t\n\tmodule.exports = {\n\t build: build,\n\t parse: parse\n\t};\n\n\n/***/ },\n/* 9 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* eslint-disable no-param-reassign */\n\tvar request = __webpack_require__(12);\n\tvar base64Url = __webpack_require__(14);\n\tvar version = __webpack_require__(16);\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.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 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/* 10 */\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/* 11 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar base64 = __webpack_require__(10);\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 base64.fromByteArray(stringToByteArray(str))\n\t .replace(/\\+/g, '-') // Convert '+' to '-'\n\t .replace(/\\//g, '_'); // Convert '/' to '_'\n\t}\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 byteArrayToString(base64.toByteArray(str));\n\t}\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/* 12 */\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__(30);\n\tvar RequestBase = __webpack_require__(27);\n\tvar isObject = __webpack_require__(7);\n\tvar isFunction = __webpack_require__(26);\n\tvar ResponseBase = __webpack_require__(28);\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, options) {\n\t options = options || {};\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\n\t * @param {Object} options with 'type' property 'auto' or 'basic' (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 (!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 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 (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 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 var fn = this._callback;\n\t this.clearTimeout();\n\t\n\t if (err) {\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 var self = this;\n\t var xhr = this.xhr = request.getXHR();\n\t var data = this._formData || this._data;\n\t\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 // 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 // querystring\n\t this._appendQueryString();\n\t\n\t this._setTimeouts();\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 callback `fn(res)`.\n\t *\n\t * @param {String} url\n\t * @param {Function} [fn]\n\t * @return {Request}\n\t * @api public\n\t */\n\t\n\tfunction del(url, fn){\n\t var req = request('DELETE', url);\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/* 13 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar urljoin = __webpack_require__(4);\n\t\n\tvar RequestBuilder = __webpack_require__(9);\n\tvar qs = __webpack_require__(8);\n\tvar objectHelper = __webpack_require__(1);\n\tvar assert = __webpack_require__(2);\n\tvar responseHandler = __webpack_require__(5);\n\tvar parametersWhitelist = __webpack_require__(37);\n\tvar Warn = __webpack_require__(6);\n\t\n\tvar PasswordlessAuthentication = __webpack_require__(33);\n\tvar DBConnection = __webpack_require__(32);\n\t\n\t/**\n\t * Auth0 Authentication API client\n\t * @constructor\n\t * @param {Object} options\n\t * @param {Object} options.domain\n\t * @param {Object} options.clienID\n\t * @param {Object} options.responseType\n\t * @param {Object} options.responseMode\n\t * @param {Object} options.scope\n\t * @param {Object} options.audience\n\t * @param {Object} options._disableDeprecationWarnings\n\t */\n\tfunction Authentication(options) {\n\t /* eslint-disable */\n\t assert.check(options, { type: 'object', message: 'options parameter is not valid' }, {\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: { optional: true, type: 'boolean', message: '_disableDeprecationWarnings option is not valid' },\n\t _sendTelemetry: { optional: true, type: 'boolean', message: '_sendTelemetry option is not valid' },\n\t _telemetryInfo: { optional: true, type: 'object', message: '_telemetryInfo option is not valid' }\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 : 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: https://auth0.com/docs/api/authentication#!#get--authorize_db\n\t * @param {Function} cb\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.merge(this.baseOptions, [\n\t 'clientID',\n\t 'responseType',\n\t 'responseMode',\n\t 'redirectUri',\n\t 'scope',\n\t 'audience'\n\t ]).with(options);\n\t\n\t /* eslint-disable */\n\t assert.check(params, { type: 'object', message: 'options parameter is not valid' }, {\n\t clientID: { type: 'string', message: 'clientID option is required' },\n\t redirectUri: { type: 'string', message: 'redirectUri option is required' },\n\t responseType: { type: 'string', message: 'responseType option is required' },\n\t nonce: { type: 'string', message: 'nonce option is required', condition: function(o) {\n\t return o.responseType.indexOf('code') === -1 && o.responseType.indexOf('id_token') !== -1;\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 /* 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(params);\n\t\n\t qString = qs.build(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 * @method buildLogoutUrl\n\t * @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-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'])\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', 'returnTo']);\n\t\n\t qString = qs.build(params);\n\t\n\t return urljoin(this.baseOptions.rootUrl, 'v2', 'logout', '?' + qString);\n\t};\n\t\n\t/**\n\t * Makes a call to the `oauth/token` endpoint with `password` grant type\n\t *\n\t * @method loginWithDefaultDirectory\n\t * @param {Object} options: https://auth0.com/docs/api-auth/grant/password\n\t * @param {Function} cb\n\t */\n\tAuthentication.prototype.loginWithDefaultDirectory = function (options, cb) {\n\t assert.check(options, { type: 'object', message: 'options parameter is not valid' }, {\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 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 {Object} options.username\n\t * @param {Object} options.password\n\t * @param {Object} options.scope\n\t * @param {Object} options.audience\n\t * @param {Object} options.realm: the HRD domain or the connection name\n\t * @param {Function} cb\n\t */\n\tAuthentication.prototype.login = function (options, cb) {\n\t assert.check(options, { type: 'object', message: 'options parameter is not valid' }, {\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 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 * @param {Object} options:\n\t * @param {Object} options.username\n\t * @param {Object} options.password\n\t * @param {Object} options.scope\n\t * @param {Object} options.audience\n\t * @param {Object} options.grantType\n\t * @param {Function} cb\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, [\n\t 'clientID',\n\t 'scope',\n\t 'audience'\n\t ]).with(options);\n\t\n\t assert.check(body, { type: 'object', message: 'options parameter is not valid' }, {\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 body = objectHelper.toSnakeCase(body, ['auth0Client']);\n\t body = parametersWhitelist.oauthTokenParams(body);\n\t\n\t body.grant_type = body.grant_type;\n\t\n\t return this.request\n\t .post(url)\n\t .send(body)\n\t .end(responseHandler(cb));\n\t};\n\t\n\t/**\n\t * Makes a call to the `/ro` endpoint\n\t *\n\t * @method loginWithResourceOwner\n\t * @param {Object} options:\n\t * @param {Object} options.username\n\t * @param {Object} options.password\n\t * @param {Object} options.connection\n\t * @param {Object} options.scope\n\t * @param {Object} options.audience\n\t * @param {Function} cb\n\t * @deprecated `loginWithResourceOwner` will be soon deprecated, user `login` instead.\n\t */\n\tAuthentication.prototype.loginWithResourceOwner = function (options, cb) {\n\t var url;\n\t var body;\n\t\n\t this.warn.warning('`loginWithResourceOwner` will be soon deprecated, user `login` instead.');\n\t\n\t assert.check(options, { type: 'object', message: 'options parameter is not valid' }, {\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 audience: { optional: true, type: 'string', message: 'audience option is required' }\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.merge(this.baseOptions, [\n\t 'clientID',\n\t 'scope',\n\t 'audience'\n\t ]).with(options);\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\n\t .post(url)\n\t .send(body)\n\t .end(responseHandler(cb));\n\t};\n\t\n\t/**\n\t * Makes a call to the `/ssodata` endpoint\n\t *\n\t * @method getSSOData\n\t * @param {Boolean} withActiveDirectories\n\t * @param {Function} cb\n\t * @deprecated `getSSOData` will be soon deprecated.\n\t */\n\tAuthentication.prototype.getSSOData = function (withActiveDirectories, cb) {\n\t var url;\n\t var params = '';\n\t\n\t this.warn.warning('`getSSOData` will be soon deprecated.');\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, { type: 'boolean', message: 'withActiveDirectories parameter is not valid' });\n\t assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\t\n\t if (withActiveDirectories) {\n\t params = '?' + qs.build({\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\n\t .get(url, {noHeaders: true})\n\t .withCredentials()\n\t .end(responseHandler(cb));\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\n\t * @param {Function} cb\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 * Makes a call to the `/delegation` endpoint\n\t *\n\t * @method delegation\n\t * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--delegation\n\t * @param {Function} cb\n\t * @deprecated `delegation` will be soon deprecated.\n\t */\n\tAuthentication.prototype.delegation = function (options, cb) {\n\t var url;\n\t var body;\n\t\n\t this.warn.warning('`delegation` will be soon deprecated.');\n\t\n\t assert.check(options, { type: 'object', message: 'options parameter is not valid' }, {\n\t grant_type: { type: 'string', message: 'grant_type option is required' }\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'])\n\t .with(options);\n\t\n\t body = objectHelper.toSnakeCase(body, ['auth0Client']);\n\t\n\t return this.request\n\t .post(url)\n\t .send(body)\n\t .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 * @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\n\t .get(url)\n\t .end(responseHandler(cb));\n\t};\n\t\n\tmodule.exports = Authentication;\n\n\n/***/ },\n/* 14 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar base64 = __webpack_require__(10);\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.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/* 15 */\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/* 16 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {raw:\"8.1.1\"};\n\n\n/***/ },\n/* 17 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar random = __webpack_require__(39);\n\tvar storage = __webpack_require__(40);\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;\n\t var nonce;\n\t\n\t 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/* 18 */\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/* 19 */\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__(18));\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/* 20 */\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 if (true) {\n\t exports = module.exports = {\n\t\t\t\tBigInteger: BigInteger,\n\t\t\t\tSecureRandom: SecureRandom,\n\t\t\t};\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/* 21 */\n/***/ function(module, exports) {\n\n\tfunction DummyCache() {}\n\t\n\tDummyCache.prototype.get = function (key) {\n\t return null;\n\t};\n\t\n\tDummyCache.prototype.has = function (key) {\n\t return false;\n\t};\n\t\n\tDummyCache.prototype.set = function (key, value) {\n\t};\n\t\n\tmodule.exports = DummyCache;\n\n\n/***/ },\n/* 22 */\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/* 23 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar urljoin = __webpack_require__(4);\n\tvar base64 = __webpack_require__(11);\n\tvar request = __webpack_require__(12);\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 if (err) {\n\t cb(err);\n\t }\n\t\n\t var matchingKey = null;\n\t\n\t for (var a = 0; a < data.body.keys.length && matchingKey === null; a ++) {\n\t var 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/* 24 */\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__(20).BigInteger;\n\tvar SHA256 = __webpack_require__(19);\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/* 25 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar RSAVerifier = __webpack_require__(24);\n\tvar base64 = __webpack_require__(11);\n\tvar jwks = __webpack_require__(23);\n\tvar error = __webpack_require__(22);\n\tvar DummyCache = __webpack_require__(21);\n\tvar supportedAlgs = ['RS256'];\n\t\n\tfunction IdTokenVerifier(options) {\n\t options = options || {};\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\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 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 iat = jwt.payload.iat;\n\t var tnonce = jwt.payload.nonce || null;\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.verifyExpAndIat(exp, iat);\n\t\n\t if (expirationError) {\n\t return cb(expirationError, false);\n\t }\n\t\n\t 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 cb(null, jwt.payload);\n\t } else {\n\t cb(new error.TokenValidationError('Invalid signature.'));\n\t }\n\t });\n\t};\n\t\n\tIdTokenVerifier.prototype.verifyExpAndIat = function (exp, iat) {\n\t if (this.__disableExpirationCheck) {\n\t return null;\n\t }\n\t\n\t var now = new Date();\n\t\n\t var expDate = new Date(0);\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 var iatDate = new Date(0);\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\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);\n\t cb(null, new RSAVerifier(keyInfo.modulus, keyInfo.exp));\n\t }\n\t};\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/* 26 */\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__(7);\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/* 27 */\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__(7);\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 this._timeout = 0;\n\t this._responseTimeout = 0;\n\t clearTimeout(this._timer);\n\t clearTimeout(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 if ('undefined' !== typeof options.deadline) {\n\t this._timeout = options.deadline;\n\t }\n\t if ('undefined' !== typeof options.response) {\n\t this._responseTimeout = options.response;\n\t }\n\t return this;\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(){\n\t // This is browser-only functionality. Node side is no-op.\n\t this._withCredentials = true;\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){\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 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);\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);\n\t }, this._responseTimeout);\n\t }\n\t}\n\n\n/***/ },\n/* 28 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar utils = __webpack_require__(29);\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/* 29 */\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/***/ },\n/* 30 */\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/* 31 */\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 = 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 if (d.a === 'ready') 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 } catch(err) { }\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/* 32 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar urljoin = __webpack_require__(4);\n\t\n\tvar objectHelper = __webpack_require__(1);\n\tvar assert = __webpack_require__(2);\n\tvar responseHandler = __webpack_require__(5);\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 * Signup a new user\n\t *\n\t * @method signup\n\t * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup\n\t * @param {Function} cb\n\t */\n\tDBConnection.prototype.signup = 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 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 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'])\n\t .with(options);\n\t\n\t body = objectHelper.blacklist(body, ['scope']);\n\t\n\t body = objectHelper.toSnakeCase(body, ['auth0Client']);\n\t\n\t return this.request\n\t .post(url)\n\t .send(body)\n\t .end(responseHandler(cb));\n\t};\n\t\n\t/**\n\t * Initializes the change password flow\n\t *\n\t * @method signup\n\t * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password\n\t * @param {Function} cb\n\t */\n\tDBConnection.prototype.changePassword = 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 connection: { type: 'string', message: 'connection option is required' },\n\t email: { type: 'string', message: 'email option is required' }\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'])\n\t .with(options, ['email', 'connection']);\n\t\n\t body = objectHelper.toSnakeCase(body, ['auth0Client']);\n\t\n\t return this.request\n\t .post(url)\n\t .send(body)\n\t .end(responseHandler(cb));\n\t};\n\t\n\tmodule.exports = DBConnection;\n\n\n/***/ },\n/* 33 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar urljoin = __webpack_require__(4);\n\t\n\tvar objectHelper = __webpack_require__(1);\n\tvar assert = __webpack_require__(2);\n\tvar qs = __webpack_require__(8);\n\tvar responseHandler = __webpack_require__(5);\n\t\n\tfunction PasswordlessAuthentication(request, options) {\n\t this.baseOptions = options;\n\t this.request = request;\n\t}\n\t\n\t/**\n\t * Builds and returns the passwordless TOTP verify url in order to initialize a new authN/authZ transaction\n\t *\n\t * @method buildVerifyUrl\n\t * @param {Object} options\n\t * @param {Function} cb\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(options, { type: 'object', message: 'options parameter is not valid' }, {\n\t connection: { type: 'string', message: 'connection option is required' },\n\t verificationCode: { type: 'string', message: 'verificationCode option is required' },\n\t phoneNumber: { optional: false, type: 'string', message: 'phoneNumber option is required',\n\t condition: function (o) { return !o.email; } },\n\t email: { optional: false, type: 'string', message: 'email option is required',\n\t condition: function (o) { return !o.phoneNumber; } }\n\t });\n\t /* eslint-enable */\n\t\n\t params = objectHelper.merge(this.baseOptions, [\n\t 'clientID',\n\t 'responseType',\n\t 'responseMode',\n\t 'redirectUri',\n\t 'scope',\n\t 'audience'\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.build(params);\n\t\n\t return urljoin(this.baseOptions.rootUrl, 'passwordless', 'verify_redirect', '?' + qString);\n\t};\n\t\n\t/**\n\t * Initializes a new passwordless authN/authZ transaction\n\t *\n\t * @method start\n\t * @param {Object} options: https://auth0.com/docs/api/authentication#passwordless\n\t * @param {Function} cb\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(options, { type: 'object', message: 'options parameter is not valid' }, {\n\t connection: { type: 'string', message: 'connection option is required' },\n\t send: { type: 'string', message: 'send option is required', values: ['link', 'code'],\n\t value_message: 'send is not valid ([link, code])' },\n\t phoneNumber: { optional: true, type: 'string', message: 'phoneNumber option is required',\n\t condition: function (o) { return o.send === 'code' || !o.email; } },\n\t email: { optional: true, type: 'string', message: 'email option is required',\n\t condition: function (o) { return o.send === 'link' || !o.phoneNumber; } },\n\t authParams: { optional: true, type: 'object', message: 'authParams option is required' }\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.merge(this.baseOptions, [\n\t 'clientID',\n\t 'responseType',\n\t 'redirectUri',\n\t '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\n\t .post(url)\n\t .send(body)\n\t .end(responseHandler(cb));\n\t};\n\t\n\t/**\n\t * Verifies the passwordless TOTP and returns an error if any.\n\t *\n\t * @method buildVerifyUrl\n\t * @param {Object} options\n\t * @param {Function} cb\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(options, { type: 'object', message: 'options parameter is not valid' }, {\n\t connection: { type: 'string', message: 'connection option is required' },\n\t verificationCode: { type: 'string', message: 'verificationCode option is required' },\n\t phoneNumber: { optional: false, type: 'string', message: 'phoneNumber option is required',\n\t condition: function (o) { return !o.email; } },\n\t email: { optional: false, type: 'string', message: 'email option is required',\n\t condition: function (o) { return !o.phoneNumber; } }\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.toSnakeCase(options, ['auth0Client']);\n\t\n\t url = urljoin(this.baseOptions.rootUrl, 'passwordless', 'verify');\n\t\n\t return this.request\n\t .post(url)\n\t .send(cleanOption)\n\t .end(responseHandler(cb));\n\t};\n\t\n\tmodule.exports = PasswordlessAuthentication;\n\n\n/***/ },\n/* 34 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar windowHandler = __webpack_require__(3);\n\tvar base64Url = __webpack_require__(14);\n\t\n\tfunction create(name, value, days) {\n\t var date;\n\t var expires;\n\t\n\t if (windowHandler.getDocument().cookie === undefined\n\t || windowHandler.getDocument().cookie === null) {\n\t throw new Error('cookie storage not available');\n\t }\n\t\n\t if (days) {\n\t date = new Date();\n\t date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));\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 (windowHandler.getDocument().cookie === undefined\n\t || windowHandler.getDocument().cookie === null) {\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/* 35 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar windowHelper = __webpack_require__(3);\n\t\n\tfunction IframeHandler(options) {\n\t this.auth0 = options.auth0;\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.usePostMessage = options.usePostMessage || false;\n\t this.iframe = null;\n\t this.timeoutHandle = null;\n\t this._destroyTimeout = null;\n\t this.transientMessageEventListener = null;\n\t this.transientEventListener = null;\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 if (this.usePostMessage) {\n\t // Workaround to avoid using bind that does not work in IE8\n\t this.transientMessageEventListener = function (e) {\n\t _this.messageEventListener(e);\n\t };\n\t\n\t _window.addEventListener('message', this.transientMessageEventListener, false);\n\t } else {\n\t // Workaround to avoid using bind that does not work in IE8\n\t this.transientEventListener = function () {\n\t _this.loadEventListener();\n\t };\n\t\n\t this.iframe.addEventListener('load', this.transientEventListener, false);\n\t }\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.messageEventListener = function (e) {\n\t this.destroy();\n\t this.callbackHandler(e.data);\n\t};\n\t\n\tIframeHandler.prototype.loadEventListener = function () {\n\t var _this = this;\n\t this.auth0.parseHash(\n\t { hash: this.iframe.contentWindow.location.hash },\n\t function (error, result) {\n\t if (error || result) {\n\t _this.destroy();\n\t _this.callback(error, result);\n\t }\n\t }\n\t );\n\t};\n\t\n\tIframeHandler.prototype.callbackHandler = function (result) {\n\t var error = null;\n\t\n\t if (result.error) {\n\t error = result;\n\t result = null;\n\t }\n\t\n\t this.callback(error, result);\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 if (_this.usePostMessage) {\n\t _window.removeEventListener('message', _this.transientMessageEventListener, false);\n\t } else {\n\t _this.iframe.removeEventListener('load', _this.transientEventListener, false);\n\t }\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/* 36 */\n/***/ function(module, exports) {\n\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/* 37 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar objectHelper = __webpack_require__(1);\n\t\n\tvar token_params = [\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 authorize_params = [\n\t// auth0\n\t 'connection',\n\t 'connection_scope',\n\t 'auth0Client',\n\t 'owp',\n\t 'device',\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(params) {\n\t return objectHelper.pick(params, authorize_params);\n\t}\n\t\n\tfunction oauthTokenParams(params) {\n\t return objectHelper.pick(params, token_params);\n\t}\n\t\n\tmodule.exports = {\n\t oauthTokenParams: oauthTokenParams,\n\t oauthAuthorizeParams: oauthAuthorizeParams\n\t};\n\n\n/***/ },\n/* 38 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar WinChan = __webpack_require__(31);\n\t\n\tvar windowHandler = __webpack_require__(3);\n\tvar objectHelper = __webpack_require__(1);\n\t\n\tfunction PopupHandler() {\n\t this._current_popup = null;\n\t}\n\t\n\tPopupHandler.prototype.stringifyPopupSettings = function (options) {\n\t var settings = '';\n\t\n\t for (var key in options) {\n\t settings += key + '=' + options[key] + ',';\n\t }\n\t\n\t return settings.slice(0, -1);\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 = screenX + ((outerWidth - width) / 2);\n\t var top = screenY + ((outerHeight - height) / 2);\n\t\n\t return { width: width, height: height, left: left, top: 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 = this.stringifyPopupSettings(popupOptions);\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 = {\n\t url: url,\n\t relay_url: relayUrl,\n\t window_features: this.stringifyPopupSettings(popupOptions),\n\t popup: this._current_popup,\n\t params: options\n\t };\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/* 39 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar windowHelper = __webpack_require__(3);\n\t\n\tfunction randomString(length) {\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/* 40 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar StorageHandler = __webpack_require__(43);\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/* 41 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar windowHandler = __webpack_require__(3);\n\tvar cookies = __webpack_require__(34);\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/* 42 */\n/***/ function(module, exports) {\n\n\tfunction DummyStorage() {}\n\t\n\tDummyStorage.prototype.getItem = function (key) { return null; };\n\t\n\tDummyStorage.prototype.removeItem = function (key) {};\n\t\n\tDummyStorage.prototype.setItem = function (key, value) {};\n\t\n\tmodule.exports = DummyStorage;\n\n/***/ },\n/* 43 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar windowHandler = __webpack_require__(3);\n\tvar DummyStorage = __webpack_require__(42);\n\tvar CookieStorage = __webpack_require__(41);\n\tvar Warn = __webpack_require__(6);\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/* 44 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar urljoin = __webpack_require__(4);\n\t\n\tvar RequestBuilder = __webpack_require__(9);\n\tvar assert = __webpack_require__(2);\n\tvar responseHandler = __webpack_require__(5);\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\n\t * @param {Object} options.token\n\t */\n\tfunction Management(options) {\n\t /* eslint-disable */\n\t assert.check(options, { type: 'object', message: 'options parameter is not valid' }, {\n\t domain: { type: 'string', message: 'domain option is required' },\n\t token: { type: 'string', message: 'token option is required' },\n\t _sendTelemetry: { optional: true, type: 'boolean', message: '_sendTelemetry option is not valid' },\n\t _telemetryInfo: { optional: true, type: 'object', message: '_telemetryInfo option is not valid' }\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 * Returns the user profile. https://auth0.com/docs/api/management/v2#!/Users/get_users_by_id\n\t *\n\t * @method getUser\n\t * @param {String} userId\n\t * @param {Function} cb\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\n\t .get(url)\n\t .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 * https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id\n\t *\n\t * @method patchUserMetadata\n\t * @param {String} userId\n\t * @param {Object} userMetadata\n\t * @param {Function} cb\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. https://auth0.com/docs/api/management/v2#!/Users/post_identities\n\t *\n\t * @method linkUser\n\t * @param {String} userId\n\t * @param {Object} secondaryUserToken\n\t * @param {Function} cb\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, { type: 'string',\n\t message: 'secondaryUserToken parameter is not valid' });\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/* 45 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar IdTokenVerifier = __webpack_require__(25);\n\t\n\tvar assert = __webpack_require__(2);\n\tvar error = __webpack_require__(15);\n\tvar qs = __webpack_require__(8);\n\tvar windowHelper = __webpack_require__(3);\n\tvar objectHelper = __webpack_require__(1);\n\tvar TransactionManager = __webpack_require__(17);\n\tvar Authentication = __webpack_require__(13);\n\tvar Redirect = __webpack_require__(47);\n\tvar Popup = __webpack_require__(46);\n\tvar SilentAuthenticationHandler = __webpack_require__(48);\n\t\n\t/**\n\t * Handles all the browser's authentication flows\n\t * @constructor\n\t * @param {Object} options\n\t * @param {Object} options.domain\n\t * @param {Object} options.clienID\n\t * @param {Object} options.responseType\n\t * @param {Object} options.responseMode\n\t * @param {Object} options.scope\n\t * @param {Object} options.audience\n\t * @param {Object} options._disableDeprecationWarnings\n\t */\n\tfunction WebAuth(options) {\n\t /* eslint-disable */\n\t assert.check(options, { type: 'object', message: 'options parameter is not valid' }, {\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 _disableDeprecationWarnings: { optional: true, type: 'boolean', message: '_disableDeprecationWarnings option is not valid' },\n\t _sendTelemetry: { optional: true, type: 'boolean', message: '_sendTelemetry option is not valid' },\n\t _telemetryInfo: { optional: true, type: 'object', message: '_telemetryInfo option is not valid' }\n\t });\n\t\n\t if (options.overrides) {\n\t assert.check(options.overrides, { type: 'object', message: 'overrides option is not valid' }, {\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 /* 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 : true;\n\t\n\t this.baseOptions.tenant = (this.overrides && this.overrides.__tenant)\n\t || this.baseOptions.domain.split('.')[0];\n\t\n\t this.baseOptions.token_issuer = (this.overrides && this.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.client, this.baseOptions);\n\t}\n\t\n\t/**\n\t * Parse the url hash and extract the returned tokens depending on the transaction.\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. Id tokens signed with other algorithms will not be\n\t * accepted.\n\t *\n\t * @method parseHash\n\t * @param {Object} options:\n\t * @param {String} options.state [OPTIONAL] to verify the response\n\t * @param {String} options.nonce [OPTIONAL] to verify the id_token\n\t * @param {String} options.hash [OPTIONAL] the url hash. If not provided it will extract from window.location.hash\n\t * @param {Function} cb: function(err, token_payload)\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 var transactionState;\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 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 (!parsedQs.hasOwnProperty('access_token')\n\t && !parsedQs.hasOwnProperty('id_token')\n\t && !parsedQs.hasOwnProperty('refresh_token')) {\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 transactionState = options.state || (transaction && transaction.state) || null;\n\t\n\t if (parsedQs.id_token) {\n\t this.validateToken(\n\t parsedQs.id_token,\n\t transactionState,\n\t transactionNonce,\n\t function (validationError, payload) {\n\t if (validationError) {\n\t return cb(validationError);\n\t }\n\t\n\t return cb(null, buildParseHashResponse(parsedQs, (transaction && transaction.appStatus) || null, payload));\n\t });\n\t } else {\n\t cb(null, buildParseHashResponse(parsedQs, (transaction && transaction.appStatus) || null, null));\n\t }\n\t};\n\t\n\tfunction buildParseHashResponse(qs, appStatus, token) {\n\t return {\n\t accessToken: qs.access_token || null,\n\t idToken: qs.id_token || null,\n\t idTokenPayload: token || null,\n\t appStatus: appStatus || null,\n\t refreshToken: qs.refresh_token || null,\n\t state: qs.state || null,\n\t expiresIn: qs.expires_in ? parseInt(qs.expires_in, 10) : null,\n\t tokenType: qs.token_type || null\n\t };\n\t}\n\t\n\t/**\n\t * Decodes the id_token and verifies the nonce.\n\t *\n\t * @method validateToken\n\t * @param {String} token\n\t * @param {String} state\n\t * @param {String} nonce\n\t * @param {Function} cb: function(err, {payload, transaction})\n\t */\n\tWebAuth.prototype.validateToken = function (token, state, 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 token.\n\t *\n\t * @method renewAuth\n\t * @param {Object} options: any valid oauth2 parameter to be sent to the `/authorize` endpoint\n\t * @param {Function} cb\n\t */\n\tWebAuth.prototype.renewAuth = function (options, cb) {\n\t var handler;\n\t var prof;\n\t var usePostMessage = !!options.usePostMessage;\n\t var _this = this;\n\t\n\t var params = objectHelper.merge(this.baseOptions, [\n\t 'clientID',\n\t 'redirectUri',\n\t 'responseType',\n\t 'scope',\n\t 'audience'\n\t ]).with(options);\n\t\n\t params.responseType = params.responseType || 'token';\n\t params.responseMode = params.responseMode || 'fragment';\n\t\n\t params = this.transactionManager.process(params);\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']);\n\t\n\t handler = new SilentAuthenticationHandler(this, this.client.buildAuthorizeUrl(params));\n\t\n\t handler.login(usePostMessage, function (err, data) {\n\t if (err) {\n\t return cb(err);\n\t }\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\n\t if (data.id_token) {\n\t return _this.validateToken(data.id_token, transactionState, transactionNonce, function (err, payload) {\n\t if (err) {\n\t return cb(err);\n\t }\n\t\n\t data.idTokenPayload = payload;\n\t\n\t return cb(null, data);\n\t });\n\t }\n\t\n\t return cb(err, data);\n\t });\n\t};\n\t\n\t/**\n\t * Initialices a change password transaction\n\t *\n\t * @method changePassword\n\t * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password\n\t * @param {Function} cb\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 * Initialices a passwordless authentication transaction\n\t *\n\t * @method passwordlessStart\n\t * @param {Object} options: https://auth0.com/docs/api/authentication#passwordless\n\t * @param {Object} options.type: `sms` or `email`\n\t * @param {Object} options.phoneNumber: only if type = sms\n\t * @param {Object} options.email: only if type = email\n\t * @param {Function} cb\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 * Signs up a new user\n\t *\n\t * @method signup\n\t * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup\n\t * @param {Function} cb\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 initialize a new authN/authZ transaction\n\t *\n\t * @method authorize\n\t * @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db\n\t * @param {Function} cb\n\t */\n\tWebAuth.prototype.authorize = function (options) {\n\t var params = objectHelper.merge(this.baseOptions, [\n\t 'clientID',\n\t 'responseType',\n\t 'responseMode',\n\t 'redirectUri',\n\t 'scope',\n\t 'audience'\n\t ]).with(options);\n\t\n\t assert.check(params, { type: 'object', message: 'options parameter is not valid' }, {\n\t responseType: { type: 'string', message: 'responseType option is required' }\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: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup\n\t * @param {Function} cb\n\t */\n\tWebAuth.prototype.signupAndAuthorize = function (options, cb) {\n\t var _this = this;\n\t\n\t return this.client.dbConnection.signup(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 * Redirects to the auth0 logout page\n\t *\n\t * @method logout\n\t * @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-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 {Object} options.type: `sms` or `email`\n\t * @param {Object} options.phoneNumber: only if type = sms\n\t * @param {Object} options.email: only if type = email\n\t * @param {Object} options.connection: the connection name\n\t * @param {Object} 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 return this.client.passwordless.verify(options, function (err) {\n\t if (err) {\n\t return cb(err);\n\t }\n\t return windowHelper.redirect(_this.client.passwordless.buildVerifyUrl(options));\n\t });\n\t};\n\t\n\tmodule.exports = WebAuth;\n\n\n/***/ },\n/* 46 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar urljoin = __webpack_require__(4);\n\t\n\tvar assert = __webpack_require__(2);\n\tvar responseHandler = __webpack_require__(5);\n\tvar PopupHandler = __webpack_require__(38);\n\tvar objectHelper = __webpack_require__(1);\n\tvar Warn = __webpack_require__(6);\n\tvar TransactionManager = __webpack_require__(17);\n\t\n\tfunction Popup(client, options) {\n\t this.baseOptions = options;\n\t this.client = client;\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 * 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 var popup = new PopupHandler();\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 */\n\tPopup.prototype.getPopupHandler = function (options, preload) {\n\t if (options.popupHandler) {\n\t return options.popupHandler;\n\t }\n\t return !!preload ? this.preload(options) : new PopupHandler();\n\t};\n\t\n\t/**\n\t * Opens in a popup the hosted login page (`/authorize`) in order to initialize a new authN/authZ transaction\n\t *\n\t * @method authorize\n\t * @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db\n\t * @param {Function} cb\n\t */\n\tPopup.prototype.authorize = function (options, cb) {\n\t var popup;\n\t var url;\n\t var relayUrl;\n\t\n\t var params = objectHelper.merge(this.baseOptions, [\n\t 'clientID',\n\t 'scope',\n\t 'audience',\n\t 'responseType'\n\t ]).with(objectHelper.blacklist(options, ['popupHandler']));\n\t\n\t assert.check(params, { type: 'object', message: 'options parameter is not valid' }, {\n\t responseType: { type: 'string', message: 'responseType option is required' }\n\t });\n\t\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\n\t params = this.transactionManager.process(params);\n\t\n\t url = this.client.buildAuthorizeUrl(params);\n\t\n\t popup = this.getPopupHandler(options);\n\t\n\t relayUrl = urljoin(this.baseOptions.rootUrl, 'relay.html');\n\t\n\t return popup.load(url, relayUrl, {}, responseHandler(cb));\n\t};\n\t\n\t/**\n\t * Initializes the legacy Lock login flow in a popup\n\t *\n\t * @method loginWithCredentials\n\t * @param {Object} options\n\t * @param {Function} cb\n\t * @deprecated `webauth.popup.loginWithCredentials` will be soon deprecated, use `webauth.client.login` instead.\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 this.warn.warning('`webauth.popup.loginWithCredentials` will be soon deprecated, use `webauth.client.login` instead.');\n\t\n\t /* eslint-disable */\n\t assert.check(options, { type: 'object', message: 'options parameter is not valid' }, {\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 /* eslint-enable */\n\t\n\t popup = this.getPopupHandler(options);\n\t\n\t options = objectHelper.merge(this.baseOptions, [\n\t 'clientID',\n\t 'scope',\n\t 'domain',\n\t 'audience'\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.blacklist(options, ['clientID', 'domain'])\n\t );\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, responseHandler(cb));\n\t};\n\t\n\t/**\n\t * Verifies the passwordless TOTP and returns the requested token\n\t *\n\t * @method passwordlessVerify\n\t * @param {Object} options:\n\t * @param {Object} options.type: `sms` or `email`\n\t * @param {Object} options.phoneNumber: only if type = sms\n\t * @param {Object} options.email: only if type = email\n\t * @param {Object} options.connection: the connection name\n\t * @param {Object} 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(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 * 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: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup\n\t * @param {Function} 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(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\tmodule.exports = Popup;\n\n/***/ },\n/* 47 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar UsernamePassword = __webpack_require__(49);\n\tvar objectHelper = __webpack_require__(1);\n\tvar Warn = __webpack_require__(6);\n\tvar assert = __webpack_require__(2);\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 * Initializes the legacy Lock login flow in redirect mode\n\t *\n\t * @method loginWithCredentials\n\t * @param {Object} options\n\t * @param {Function} cb\n\t * @deprecated `webauth.redirect.loginWithCredentials` will be soon deprecated, use `webauth.login` instead.\n\t */\n\tRedirect.prototype.loginWithCredentials = function (options, cb) {\n\t var usernamePassword;\n\t\n\t var params = objectHelper.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 ]).with(options);\n\t\n\t this.warn.warning('`webauth.redirect.loginWithCredentials` will be soon deprecated, use `webauth.login` instead.');\n\t\n\t assert.check(params, { type: 'object', message: 'options parameter is not valid' }, {\n\t responseType: { type: 'string', message: 'responseType option is required' }\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: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup\n\t * @param {Function} 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/* 48 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar IframeHandler = __webpack_require__(35);\n\t\n\tfunction SilentAuthenticationHandler(auth0, authenticationUrl, timeout) {\n\t this.auth0 = auth0;\n\t this.authenticationUrl = authenticationUrl;\n\t this.timeout = timeout || 60 * 1000;\n\t this.handler = null;\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 callback: callback,\n\t timeout: this.timeout,\n\t timeoutCallback: function () {\n\t callback({\n\t error: 'timeout',\n\t description: 'Timeout during authentication renew.'\n\t });\n\t },\n\t usePostMessage: usePostMessage || false\n\t });\n\t\n\t this.handler.init();\n\t};\n\t\n\tmodule.exports = SilentAuthenticationHandler;\n\n\n/***/ },\n/* 49 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar urljoin = __webpack_require__(4);\n\t\n\tvar objectHelper = __webpack_require__(1);\n\tvar RequestBuilder = __webpack_require__(9);\n\tvar responseHandler = __webpack_require__(5);\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.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 ]).with(options);\n\t\n\t body = objectHelper.toSnakeCase(body, ['auth0Client']);\n\t\n\t return this.request\n\t .post(url)\n\t .send(body)\n\t .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 cbfb0103e553ec9dc107","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 = 0\n// module chunks = 0","/* eslint-disable no-param-reassign */\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 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 ((!wasPrevUppercase && code >= 65 && code <= 90) || (!wasPrevNumber && code >= 48 && code <= 57)) {\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\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\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 extend: extend\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/object.js\n// module id = 1\n// module chunks = 0","var toString = Object.prototype.toString;\n\nfunction attribute(o, attr, type, text) {\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/**\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 * @public\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 = 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","(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 = 4\n// module chunks = 0","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) {\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 = err.error_description || err.description || err.error || err.details || err.err || 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 = 5\n// module chunks = 0","function 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// WEBPACK FOOTER\n// ./src/helper/warn.js\n// module id = 6\n// module chunks = 0","/**\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 = 7\n// module chunks = 0","function build(params) {\n return Object.keys(params).reduce(function (arr, key) {\n if (typeof params[key] !== 'undefined') {\n arr.push(key + '=' + encodeURIComponent(params[key]));\n }\n return arr;\n }, []).join('&');\n}\n\nfunction parse(qs) {\n return qs.split('&').reduce(function (prev, curr) {\n var param = curr.split('=');\n prev[param[0]] = param[1];\n return prev;\n }, {});\n}\n\nmodule.exports = {\n build: build,\n parse: parse\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/qs.js\n// module id = 8\n// module chunks = 0","/* 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.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 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 = 9\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 = 10\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 base64.fromByteArray(stringToByteArray(str))\n .replace(/\\+/g, '-') // Convert '+' to '-'\n .replace(/\\//g, '_'); // Convert '/' to '_'\n}\n\n\nfunction decodeToString(str) {\n str = padding(str)\n .replace(/\\-/g, '+') // Convert '-' to '+'\n .replace(/_/g, '/'); // Convert '_' to '/'\n\n return byteArrayToString(base64.toByteArray(str));\n}\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 = 11\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('emitter');\nvar RequestBase = require('./request-base');\nvar isObject = require('./is-object');\nvar isFunction = require('./is-function');\nvar ResponseBase = require('./response-base');\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, options) {\n options = options || {};\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\n * @param {Object} options with 'type' property 'auto' or 'basic' (default 'basic')\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.auth = function(user, pass, options){\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 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 (this._data) {\n throw Error(\"superagent can't mix .send() and .attach()\");\n }\n\n this._getFormData().append(field, file, options || file.name);\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 var fn = this._callback;\n this.clearTimeout();\n\n if (err) {\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 var self = this;\n var xhr = this.xhr = request.getXHR();\n var data = this._formData || this._data;\n\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 // 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 // querystring\n this._appendQueryString();\n\n this._setTimeouts();\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 callback `fn(res)`.\n *\n * @param {String} url\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nfunction del(url, fn){\n var req = request('DELETE', url);\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 = 12\n// module chunks = 0","var urljoin = require('url-join');\n\nvar RequestBuilder = require('../helper/request-builder');\nvar qs = require('../helper/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 * Auth0 Authentication API client\n * @constructor\n * @param {Object} options\n * @param {Object} options.domain\n * @param {Object} options.clienID\n * @param {Object} options.responseType\n * @param {Object} options.responseMode\n * @param {Object} options.scope\n * @param {Object} options.audience\n * @param {Object} options._disableDeprecationWarnings\n */\nfunction Authentication(options) {\n /* eslint-disable */\n assert.check(options, { type: 'object', message: 'options parameter is not valid' }, {\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: { optional: true, type: 'boolean', message: '_disableDeprecationWarnings option is not valid' },\n _sendTelemetry: { optional: true, type: 'boolean', message: '_sendTelemetry option is not valid' },\n _telemetryInfo: { optional: true, type: 'object', message: '_telemetryInfo option is not valid' }\n });\n /* eslint-enable */\n\n this.baseOptions = options;\n\n this.baseOptions._sendTelemetry = this.baseOptions._sendTelemetry === false ?\n this.baseOptions._sendTelemetry : 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: https://auth0.com/docs/api/authentication#!#get--authorize_db\n * @param {Function} cb\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.merge(this.baseOptions, [\n 'clientID',\n 'responseType',\n 'responseMode',\n 'redirectUri',\n 'scope',\n 'audience'\n ]).with(options);\n\n /* eslint-disable */\n assert.check(params, { type: 'object', message: 'options parameter is not valid' }, {\n clientID: { type: 'string', message: 'clientID option is required' },\n redirectUri: { type: 'string', message: 'redirectUri option is required' },\n responseType: { type: 'string', message: 'responseType option is required' },\n nonce: { type: 'string', message: 'nonce option is required', condition: function(o) {\n return o.responseType.indexOf('code') === -1 && o.responseType.indexOf('id_token') !== -1;\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 /* 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(params);\n\n qString = qs.build(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 * @method buildLogoutUrl\n * @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-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'])\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', 'returnTo']);\n\n qString = qs.build(params);\n\n return urljoin(this.baseOptions.rootUrl, 'v2', 'logout', '?' + qString);\n};\n\n/**\n * Makes a call to the `oauth/token` endpoint with `password` grant type\n *\n * @method loginWithDefaultDirectory\n * @param {Object} options: https://auth0.com/docs/api-auth/grant/password\n * @param {Function} cb\n */\nAuthentication.prototype.loginWithDefaultDirectory = function (options, cb) {\n assert.check(options, { type: 'object', message: 'options parameter is not valid' }, {\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 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 {Object} options.username\n * @param {Object} options.password\n * @param {Object} options.scope\n * @param {Object} options.audience\n * @param {Object} options.realm: the HRD domain or the connection name\n * @param {Function} cb\n */\nAuthentication.prototype.login = function (options, cb) {\n assert.check(options, { type: 'object', message: 'options parameter is not valid' }, {\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 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 * @param {Object} options:\n * @param {Object} options.username\n * @param {Object} options.password\n * @param {Object} options.scope\n * @param {Object} options.audience\n * @param {Object} options.grantType\n * @param {Function} cb\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, [\n 'clientID',\n 'scope',\n 'audience'\n ]).with(options);\n\n assert.check(body, { type: 'object', message: 'options parameter is not valid' }, {\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 body = objectHelper.toSnakeCase(body, ['auth0Client']);\n body = parametersWhitelist.oauthTokenParams(body);\n\n body.grant_type = body.grant_type;\n\n return this.request\n .post(url)\n .send(body)\n .end(responseHandler(cb));\n};\n\n/**\n * Makes a call to the `/ro` endpoint\n *\n * @method loginWithResourceOwner\n * @param {Object} options:\n * @param {Object} options.username\n * @param {Object} options.password\n * @param {Object} options.connection\n * @param {Object} options.scope\n * @param {Object} options.audience\n * @param {Function} cb\n * @deprecated `loginWithResourceOwner` will be soon deprecated, user `login` instead.\n */\nAuthentication.prototype.loginWithResourceOwner = function (options, cb) {\n var url;\n var body;\n\n this.warn.warning('`loginWithResourceOwner` will be soon deprecated, user `login` instead.');\n\n assert.check(options, { type: 'object', message: 'options parameter is not valid' }, {\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 audience: { optional: true, type: 'string', message: 'audience option is required' }\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.merge(this.baseOptions, [\n 'clientID',\n 'scope',\n 'audience'\n ]).with(options);\n\n body = objectHelper.toSnakeCase(body, ['auth0Client']);\n\n body.grant_type = body.grant_type || 'password';\n\n return this.request\n .post(url)\n .send(body)\n .end(responseHandler(cb));\n};\n\n/**\n * Makes a call to the `/ssodata` endpoint\n *\n * @method getSSOData\n * @param {Boolean} withActiveDirectories\n * @param {Function} cb\n * @deprecated `getSSOData` will be soon deprecated.\n */\nAuthentication.prototype.getSSOData = function (withActiveDirectories, cb) {\n var url;\n var params = '';\n\n this.warn.warning('`getSSOData` will be soon deprecated.');\n\n if (typeof withActiveDirectories === 'function') {\n cb = withActiveDirectories;\n withActiveDirectories = false;\n }\n\n assert.check(withActiveDirectories, { type: 'boolean', message: 'withActiveDirectories parameter is not valid' });\n assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\n if (withActiveDirectories) {\n params = '?' + qs.build({\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\n .get(url, {noHeaders: true})\n .withCredentials()\n .end(responseHandler(cb));\n};\n\n/**\n * Makes a call to the `/userinfo` endpoint and returns the user profile\n *\n * @method userInfo\n * @param {String} accessToken\n * @param {Function} cb\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 * Makes a call to the `/delegation` endpoint\n *\n * @method delegation\n * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--delegation\n * @param {Function} cb\n * @deprecated `delegation` will be soon deprecated.\n */\nAuthentication.prototype.delegation = function (options, cb) {\n var url;\n var body;\n\n this.warn.warning('`delegation` will be soon deprecated.');\n\n assert.check(options, { type: 'object', message: 'options parameter is not valid' }, {\n grant_type: { type: 'string', message: 'grant_type option is required' }\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'])\n .with(options);\n\n body = objectHelper.toSnakeCase(body, ['auth0Client']);\n\n return this.request\n .post(url)\n .send(body)\n .end(responseHandler(cb));\n};\n\n/**\n * Fetches the user country based on the ip.\n *\n * @method getUserCountry\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\n .get(url)\n .end(responseHandler(cb));\n};\n\nmodule.exports = Authentication;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/authentication/index.js\n// module id = 13\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.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 = 14\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 = 15\n// module chunks = 0","module.exports = {raw:\"8.1.1\"};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/version.js\n// module id = 16\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;\n var nonce;\n\n 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 = 17\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// ./~/idtoken-verifier/~/crypto-js/core.js\n// module id = 18\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// ./~/idtoken-verifier/~/crypto-js/sha256.js\n// module id = 19\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 if (typeof exports !== 'undefined') {\n exports = module.exports = {\n\t\t\tBigInteger: BigInteger,\n\t\t\tSecureRandom: SecureRandom,\n\t\t};\n } else {\n this.BigInteger = BigInteger;\n this.SecureRandom = SecureRandom;\n }\n\n}).call(this);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/idtoken-verifier/~/jsbn/index.js\n// module id = 20\n// module chunks = 0","function DummyCache() {}\n\nDummyCache.prototype.get = function (key) {\n return null;\n};\n\nDummyCache.prototype.has = function (key) {\n return false;\n};\n\nDummyCache.prototype.set = function (key, value) {\n};\n\nmodule.exports = DummyCache;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/idtoken-verifier/src/helpers/dummy-cache.js\n// module id = 21\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 = 22\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 if (err) {\n cb(err);\n }\n\n var matchingKey = null;\n\n for (var a = 0; a < data.body.keys.length && matchingKey === null; a ++) {\n var 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 = 23\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 = 24\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\nfunction IdTokenVerifier(options) {\n options = options || {};\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\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 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 iat = jwt.payload.iat;\n var tnonce = jwt.payload.nonce || null;\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.verifyExpAndIat(exp, iat);\n\n if (expirationError) {\n return cb(expirationError, false);\n }\n\n this.getRsaVerifier(iss, kid, function (err, rsaVerifier) {\n if (err) {\n return cb(err);\n }\n if (rsaVerifier.verify(headAndPayload, signature)) {\n cb(null, jwt.payload);\n } else {\n cb(new error.TokenValidationError('Invalid signature.'));\n }\n });\n};\n\nIdTokenVerifier.prototype.verifyExpAndIat = function (exp, iat) {\n if (this.__disableExpirationCheck) {\n return null;\n }\n\n var now = new Date();\n\n var expDate = new Date(0);\n expDate.setUTCSeconds(exp + this.leeway);\n\n if (now > expDate) {\n return new error.TokenValidationError('Expired token.');\n }\n\n var iatDate = new Date(0);\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\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);\n cb(null, new RSAVerifier(keyInfo.modulus, keyInfo.exp));\n }\n};\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 = 25\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 = 26\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 this._timeout = 0;\n this._responseTimeout = 0;\n clearTimeout(this._timer);\n clearTimeout(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 if ('undefined' !== typeof options.deadline) {\n this._timeout = options.deadline;\n }\n if ('undefined' !== typeof options.response) {\n this._responseTimeout = options.response;\n }\n return this;\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(){\n // This is browser-only functionality. Node side is no-op.\n this._withCredentials = true;\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){\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 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);\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);\n }, this._responseTimeout);\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/superagent/lib/request-base.js\n// module id = 27\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 = 28\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//////////////////\n// WEBPACK FOOTER\n// ./~/superagent/lib/utils.js\n// module id = 29\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// ./~/superagent/~/component-emitter/index.js\n// module id = 30\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 = 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 if (d.a === 'ready') 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 } catch(err) { }\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 = 31\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 * Signup a new user\n *\n * @method signup\n * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup\n * @param {Function} cb\n */\nDBConnection.prototype.signup = function (options, cb) {\n var url;\n var body;\n\n assert.check(options, { type: 'object', message: 'options parameter is not valid' }, {\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 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'])\n .with(options);\n\n body = objectHelper.blacklist(body, ['scope']);\n\n body = objectHelper.toSnakeCase(body, ['auth0Client']);\n\n return this.request\n .post(url)\n .send(body)\n .end(responseHandler(cb));\n};\n\n/**\n * Initializes the change password flow\n *\n * @method signup\n * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password\n * @param {Function} cb\n */\nDBConnection.prototype.changePassword = function (options, cb) {\n var url;\n var body;\n\n assert.check(options, { type: 'object', message: 'options parameter is not valid' }, {\n connection: { type: 'string', message: 'connection option is required' },\n email: { type: 'string', message: 'email option is required' }\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'])\n .with(options, ['email', 'connection']);\n\n body = objectHelper.toSnakeCase(body, ['auth0Client']);\n\n return this.request\n .post(url)\n .send(body)\n .end(responseHandler(cb));\n};\n\nmodule.exports = DBConnection;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/authentication/db-connection.js\n// module id = 32\n// module chunks = 0","var urljoin = require('url-join');\n\nvar objectHelper = require('../helper/object');\nvar assert = require('../helper/assert');\nvar qs = require('../helper/qs');\nvar responseHandler = require('../helper/response-handler');\n\nfunction PasswordlessAuthentication(request, options) {\n this.baseOptions = options;\n this.request = request;\n}\n\n/**\n * Builds and returns the passwordless TOTP verify url in order to initialize a new authN/authZ transaction\n *\n * @method buildVerifyUrl\n * @param {Object} options\n * @param {Function} cb\n */\nPasswordlessAuthentication.prototype.buildVerifyUrl = function (options) {\n var params;\n var qString;\n\n /* eslint-disable */\n assert.check(options, { type: 'object', message: 'options parameter is not valid' }, {\n connection: { type: 'string', message: 'connection option is required' },\n verificationCode: { type: 'string', message: 'verificationCode option is required' },\n phoneNumber: { optional: false, type: 'string', message: 'phoneNumber option is required',\n condition: function (o) { return !o.email; } },\n email: { optional: false, type: 'string', message: 'email option is required',\n condition: function (o) { return !o.phoneNumber; } }\n });\n /* eslint-enable */\n\n params = objectHelper.merge(this.baseOptions, [\n 'clientID',\n 'responseType',\n 'responseMode',\n 'redirectUri',\n 'scope',\n 'audience'\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.build(params);\n\n return urljoin(this.baseOptions.rootUrl, 'passwordless', 'verify_redirect', '?' + qString);\n};\n\n/**\n * Initializes a new passwordless authN/authZ transaction\n *\n * @method start\n * @param {Object} options: https://auth0.com/docs/api/authentication#passwordless\n * @param {Function} cb\n */\nPasswordlessAuthentication.prototype.start = function (options, cb) {\n var url;\n var body;\n\n /* eslint-disable */\n assert.check(options, { type: 'object', message: 'options parameter is not valid' }, {\n connection: { type: 'string', message: 'connection option is required' },\n send: { type: 'string', message: 'send option is required', values: ['link', 'code'],\n value_message: 'send is not valid ([link, code])' },\n phoneNumber: { optional: true, type: 'string', message: 'phoneNumber option is required',\n condition: function (o) { return o.send === 'code' || !o.email; } },\n email: { optional: true, type: 'string', message: 'email option is required',\n condition: function (o) { return o.send === 'link' || !o.phoneNumber; } },\n authParams: { optional: true, type: 'object', message: 'authParams option is required' }\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.merge(this.baseOptions, [\n 'clientID',\n 'responseType',\n 'redirectUri',\n '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\n .post(url)\n .send(body)\n .end(responseHandler(cb));\n};\n\n/**\n * Verifies the passwordless TOTP and returns an error if any.\n *\n * @method buildVerifyUrl\n * @param {Object} options\n * @param {Function} cb\n */\nPasswordlessAuthentication.prototype.verify = function (options, cb) {\n var url;\n var cleanOption;\n\n /* eslint-disable */\n assert.check(options, { type: 'object', message: 'options parameter is not valid' }, {\n connection: { type: 'string', message: 'connection option is required' },\n verificationCode: { type: 'string', message: 'verificationCode option is required' },\n phoneNumber: { optional: false, type: 'string', message: 'phoneNumber option is required',\n condition: function (o) { return !o.email; } },\n email: { optional: false, type: 'string', message: 'email option is required',\n condition: function (o) { return !o.phoneNumber; } }\n });\n /* eslint-enable */\n\n assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });\n\n cleanOption = objectHelper.toSnakeCase(options, ['auth0Client']);\n\n url = urljoin(this.baseOptions.rootUrl, 'passwordless', 'verify');\n\n return this.request\n .post(url)\n .send(cleanOption)\n .end(responseHandler(cb));\n};\n\nmodule.exports = PasswordlessAuthentication;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/authentication/passwordless-authentication.js\n// module id = 33\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 (windowHandler.getDocument().cookie === undefined\n || windowHandler.getDocument().cookie === null) {\n throw new Error('cookie storage not available');\n }\n\n if (days) {\n date = new Date();\n date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));\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 (windowHandler.getDocument().cookie === undefined\n || windowHandler.getDocument().cookie === null) {\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 = 34\n// module chunks = 0","var windowHelper = require('./window');\n\nfunction IframeHandler(options) {\n this.auth0 = options.auth0;\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.usePostMessage = options.usePostMessage || false;\n this.iframe = null;\n this.timeoutHandle = null;\n this._destroyTimeout = null;\n this.transientMessageEventListener = null;\n this.transientEventListener = null;\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 if (this.usePostMessage) {\n // Workaround to avoid using bind that does not work in IE8\n this.transientMessageEventListener = function (e) {\n _this.messageEventListener(e);\n };\n\n _window.addEventListener('message', this.transientMessageEventListener, false);\n } else {\n // Workaround to avoid using bind that does not work in IE8\n this.transientEventListener = function () {\n _this.loadEventListener();\n };\n\n this.iframe.addEventListener('load', this.transientEventListener, false);\n }\n\n _window.document.body.appendChild(this.iframe);\n\n this.timeoutHandle = setTimeout(function () {\n _this.timeoutHandler();\n }, this.timeout);\n};\n\nIframeHandler.prototype.messageEventListener = function (e) {\n this.destroy();\n this.callbackHandler(e.data);\n};\n\nIframeHandler.prototype.loadEventListener = function () {\n var _this = this;\n this.auth0.parseHash(\n { hash: this.iframe.contentWindow.location.hash },\n function (error, result) {\n if (error || result) {\n _this.destroy();\n _this.callback(error, result);\n }\n }\n );\n};\n\nIframeHandler.prototype.callbackHandler = function (result) {\n var error = null;\n\n if (result.error) {\n error = result;\n result = null;\n }\n\n this.callback(error, result);\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 if (_this.usePostMessage) {\n _window.removeEventListener('message', _this.transientMessageEventListener, false);\n } else {\n _this.iframe.removeEventListener('load', _this.transientEventListener, false);\n }\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 = 35\n// module chunks = 0","function 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// WEBPACK FOOTER\n// ./src/helper/object-assign.js\n// module id = 36\n// module chunks = 0","var objectHelper = require('../helper/object');\n\nvar token_params = [\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 authorize_params = [\n// auth0\n 'connection',\n 'connection_scope',\n 'auth0Client',\n 'owp',\n 'device',\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(params) {\n return objectHelper.pick(params, authorize_params);\n}\n\nfunction oauthTokenParams(params) {\n return objectHelper.pick(params, token_params);\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 = 37\n// module chunks = 0","var WinChan = require('winchan');\n\nvar windowHandler = require('../helper/window');\nvar objectHelper = require('../helper/object');\n\nfunction PopupHandler() {\n this._current_popup = null;\n}\n\nPopupHandler.prototype.stringifyPopupSettings = function (options) {\n var settings = '';\n\n for (var key in options) {\n settings += key + '=' + options[key] + ',';\n }\n\n return settings.slice(0, -1);\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 = screenX + ((outerWidth - width) / 2);\n var top = screenY + ((outerHeight - height) / 2);\n\n return { width: width, height: height, left: left, top: 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 = this.stringifyPopupSettings(popupOptions);\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 = {\n url: url,\n relay_url: relayUrl,\n window_features: this.stringifyPopupSettings(popupOptions),\n popup: this._current_popup,\n params: options\n };\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 = 38\n// module chunks = 0","var windowHelper = require('./window');\n\nfunction randomString(length) {\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 = 39\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 = 40\n// module chunks = 0","var windowHandler = require('../window');\nvar 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// WEBPACK FOOTER\n// ./src/helper/storage/cookie.js\n// module id = 41\n// module chunks = 0","function DummyStorage() {}\n\nDummyStorage.prototype.getItem = function (key) { return null; };\n\nDummyStorage.prototype.removeItem = function (key) {};\n\nDummyStorage.prototype.setItem = function (key, value) {};\n\nmodule.exports = DummyStorage;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/helper/storage/dummy.js\n// module id = 42\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 = 43\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\n * @param {Object} options.token\n */\nfunction Management(options) {\n /* eslint-disable */\n assert.check(options, { type: 'object', message: 'options parameter is not valid' }, {\n domain: { type: 'string', message: 'domain option is required' },\n token: { type: 'string', message: 'token option is required' },\n _sendTelemetry: { optional: true, type: 'boolean', message: '_sendTelemetry option is not valid' },\n _telemetryInfo: { optional: true, type: 'object', message: '_telemetryInfo option is not valid' }\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 * Returns the user profile. https://auth0.com/docs/api/management/v2#!/Users/get_users_by_id\n *\n * @method getUser\n * @param {String} userId\n * @param {Function} cb\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\n .get(url)\n .end(responseHandler(cb, { ignoreCasing: true }));\n};\n\n/**\n * Updates the user metdata. It will patch the user metdata with the attributes sent.\n * https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id\n *\n * @method patchUserMetadata\n * @param {String} userId\n * @param {Object} userMetadata\n * @param {Function} cb\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. https://auth0.com/docs/api/management/v2#!/Users/post_identities\n *\n * @method linkUser\n * @param {String} userId\n * @param {Object} secondaryUserToken\n * @param {Function} cb\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, { type: 'string',\n message: 'secondaryUserToken parameter is not valid' });\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 = 44\n// module chunks = 0","var IdTokenVerifier = require('idtoken-verifier');\n\nvar assert = require('../helper/assert');\nvar error = require('../helper/error');\nvar qs = require('../helper/qs');\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');\n\n/**\n * Handles all the browser's authentication flows\n * @constructor\n * @param {Object} options\n * @param {Object} options.domain\n * @param {Object} options.clienID\n * @param {Object} options.responseType\n * @param {Object} options.responseMode\n * @param {Object} options.scope\n * @param {Object} options.audience\n * @param {Object} options._disableDeprecationWarnings\n */\nfunction WebAuth(options) {\n /* eslint-disable */\n assert.check(options, { type: 'object', message: 'options parameter is not valid' }, {\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 _disableDeprecationWarnings: { optional: true, type: 'boolean', message: '_disableDeprecationWarnings option is not valid' },\n _sendTelemetry: { optional: true, type: 'boolean', message: '_sendTelemetry option is not valid' },\n _telemetryInfo: { optional: true, type: 'object', message: '_telemetryInfo option is not valid' }\n });\n\n if (options.overrides) {\n assert.check(options.overrides, { type: 'object', message: 'overrides option is not valid' }, {\n __tenant: { type: 'string', message: '__tenant option is required' },\n __token_issuer: { type: 'string', message: '__token_issuer option is required' }\n });\n }\n /* eslint-enable */\n\n this.baseOptions = options;\n\n this.baseOptions._sendTelemetry = this.baseOptions._sendTelemetry === false ?\n this.baseOptions._sendTelemetry : true;\n\n this.baseOptions.tenant = (this.overrides && this.overrides.__tenant)\n || this.baseOptions.domain.split('.')[0];\n\n this.baseOptions.token_issuer = (this.overrides && this.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.client, this.baseOptions);\n}\n\n/**\n * Parse the url hash and extract the returned tokens depending on the transaction.\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. Id tokens signed with other algorithms will not be\n * accepted.\n *\n * @method parseHash\n * @param {Object} options:\n * @param {String} options.state [OPTIONAL] to verify the response\n * @param {String} options.nonce [OPTIONAL] to verify the id_token\n * @param {String} options.hash [OPTIONAL] the url hash. If not provided it will extract from window.location.hash\n * @param {Function} cb: function(err, token_payload)\n */\nWebAuth.prototype.parseHash = function (options, cb) {\n var parsedQs;\n var err;\n var state;\n var transaction;\n var transactionNonce;\n var transactionState;\n\n if (!cb && typeof options === 'function') {\n cb = options;\n options = {};\n } else {\n options = options || {};\n }\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 (!parsedQs.hasOwnProperty('access_token')\n && !parsedQs.hasOwnProperty('id_token')\n && !parsedQs.hasOwnProperty('refresh_token')) {\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 transactionState = options.state || (transaction && transaction.state) || null;\n\n if (parsedQs.id_token) {\n this.validateToken(\n parsedQs.id_token,\n transactionState,\n transactionNonce,\n function (validationError, payload) {\n if (validationError) {\n return cb(validationError);\n }\n\n return cb(null, buildParseHashResponse(parsedQs, (transaction && transaction.appStatus) || null, payload));\n });\n } else {\n cb(null, buildParseHashResponse(parsedQs, (transaction && transaction.appStatus) || null, null));\n }\n};\n\nfunction buildParseHashResponse(qs, appStatus, token) {\n return {\n accessToken: qs.access_token || null,\n idToken: qs.id_token || null,\n idTokenPayload: token || null,\n appStatus: appStatus || null,\n refreshToken: qs.refresh_token || null,\n state: qs.state || null,\n expiresIn: qs.expires_in ? parseInt(qs.expires_in, 10) : null,\n tokenType: qs.token_type || null\n };\n}\n\n/**\n * Decodes the id_token and verifies the nonce.\n *\n * @method validateToken\n * @param {String} token\n * @param {String} state\n * @param {String} nonce\n * @param {Function} cb: function(err, {payload, transaction})\n */\nWebAuth.prototype.validateToken = function (token, state, 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 token.\n *\n * @method renewAuth\n * @param {Object} options: any valid oauth2 parameter to be sent to the `/authorize` endpoint\n * @param {Function} cb\n */\nWebAuth.prototype.renewAuth = function (options, cb) {\n var handler;\n var prof;\n var usePostMessage = !!options.usePostMessage;\n var _this = this;\n\n var params = objectHelper.merge(this.baseOptions, [\n 'clientID',\n 'redirectUri',\n 'responseType',\n 'scope',\n 'audience'\n ]).with(options);\n\n params.responseType = params.responseType || 'token';\n params.responseMode = params.responseMode || 'fragment';\n\n params = this.transactionManager.process(params);\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']);\n\n handler = new SilentAuthenticationHandler(this, this.client.buildAuthorizeUrl(params));\n\n handler.login(usePostMessage, function (err, data) {\n if (err) {\n return cb(err);\n }\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\n if (data.id_token) {\n return _this.validateToken(data.id_token, transactionState, transactionNonce, function (err, payload) {\n if (err) {\n return cb(err);\n }\n\n data.idTokenPayload = payload;\n\n return cb(null, data);\n });\n }\n\n return cb(err, data);\n });\n};\n\n/**\n * Initialices a change password transaction\n *\n * @method changePassword\n * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password\n * @param {Function} cb\n */\nWebAuth.prototype.changePassword = function (options, cb) {\n return this.client.dbConnection.changePassword(options, cb);\n};\n\n/**\n * Initialices a passwordless authentication transaction\n *\n * @method passwordlessStart\n * @param {Object} options: https://auth0.com/docs/api/authentication#passwordless\n * @param {Object} options.type: `sms` or `email`\n * @param {Object} options.phoneNumber: only if type = sms\n * @param {Object} options.email: only if type = email\n * @param {Function} cb\n */\nWebAuth.prototype.passwordlessStart = function (options, cb) {\n return this.client.passwordless.start(options, cb);\n};\n\n/**\n * Signs up a new user\n *\n * @method signup\n * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup\n * @param {Function} cb\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 initialize a new authN/authZ transaction\n *\n * @method authorize\n * @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db\n * @param {Function} cb\n */\nWebAuth.prototype.authorize = function (options) {\n var params = objectHelper.merge(this.baseOptions, [\n 'clientID',\n 'responseType',\n 'responseMode',\n 'redirectUri',\n 'scope',\n 'audience'\n ]).with(options);\n\n assert.check(params, { type: 'object', message: 'options parameter is not valid' }, {\n responseType: { type: 'string', message: 'responseType option is required' }\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: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup\n * @param {Function} cb\n */\nWebAuth.prototype.signupAndAuthorize = function (options, cb) {\n var _this = this;\n\n return this.client.dbConnection.signup(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 * Redirects to the auth0 logout page\n *\n * @method logout\n * @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-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 {Object} options.type: `sms` or `email`\n * @param {Object} options.phoneNumber: only if type = sms\n * @param {Object} options.email: only if type = email\n * @param {Object} options.connection: the connection name\n * @param {Object} options.verificationCode: the TOTP code\n * @param {Function} cb\n */\nWebAuth.prototype.passwordlessVerify = function (options, cb) {\n var _this = this;\n return this.client.passwordless.verify(options, function (err) {\n if (err) {\n return cb(err);\n }\n return windowHelper.redirect(_this.client.passwordless.buildVerifyUrl(options));\n });\n};\n\nmodule.exports = WebAuth;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/web-auth/index.js\n// module id = 45\n// module chunks = 0","var urljoin = require('url-join');\n\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(client, options) {\n this.baseOptions = options;\n this.client = client;\n\n this.transactionManager = new TransactionManager(this.baseOptions.transaction);\n this.warn = new Warn({\n disableWarnings: !!options._disableDeprecationWarnings\n });\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 var popup = new PopupHandler();\n popup.preload(options || {});\n return popup;\n};\n\n/**\n * Internal use.\n *\n * @method getPopupHandler\n */\nPopup.prototype.getPopupHandler = function (options, preload) {\n if (options.popupHandler) {\n return options.popupHandler;\n }\n return !!preload ? this.preload(options) : new PopupHandler();\n};\n\n/**\n * Opens in a popup the hosted login page (`/authorize`) in order to initialize a new authN/authZ transaction\n *\n * @method authorize\n * @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db\n * @param {Function} cb\n */\nPopup.prototype.authorize = function (options, cb) {\n var popup;\n var url;\n var relayUrl;\n\n var params = objectHelper.merge(this.baseOptions, [\n 'clientID',\n 'scope',\n 'audience',\n 'responseType'\n ]).with(objectHelper.blacklist(options, ['popupHandler']));\n\n assert.check(params, { type: 'object', message: 'options parameter is not valid' }, {\n responseType: { type: 'string', message: 'responseType option is required' }\n });\n\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\n params = this.transactionManager.process(params);\n\n url = this.client.buildAuthorizeUrl(params);\n\n popup = this.getPopupHandler(options);\n\n relayUrl = urljoin(this.baseOptions.rootUrl, 'relay.html');\n\n return popup.load(url, relayUrl, {}, responseHandler(cb));\n};\n\n/**\n * Initializes the legacy Lock login flow in a popup\n *\n * @method loginWithCredentials\n * @param {Object} options\n * @param {Function} cb\n * @deprecated `webauth.popup.loginWithCredentials` will be soon deprecated, use `webauth.client.login` instead.\n */\nPopup.prototype.loginWithCredentials = function (options, cb) {\n var params;\n var popup;\n var url;\n var relayUrl;\n\n this.warn.warning('`webauth.popup.loginWithCredentials` will be soon deprecated, use `webauth.client.login` instead.');\n\n /* eslint-disable */\n assert.check(options, { type: 'object', message: 'options parameter is not valid' }, {\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 /* eslint-enable */\n\n popup = this.getPopupHandler(options);\n\n options = objectHelper.merge(this.baseOptions, [\n 'clientID',\n 'scope',\n 'domain',\n 'audience'\n ]).with(objectHelper.blacklist(options, ['popupHandler']));\n\n params = objectHelper.pick(options, ['clientID', 'domain']);\n params.options = objectHelper.toSnakeCase(\n objectHelper.blacklist(options, ['clientID', 'domain'])\n );\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, responseHandler(cb));\n};\n\n/**\n * Verifies the passwordless TOTP and returns the requested token\n *\n * @method passwordlessVerify\n * @param {Object} options:\n * @param {Object} options.type: `sms` or `email`\n * @param {Object} options.phoneNumber: only if type = sms\n * @param {Object} options.email: only if type = email\n * @param {Object} options.connection: the connection name\n * @param {Object} 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(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 * Signs up a new user and automatically logs the user in after the signup.\n *\n * @method signupAndLogin\n * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup\n * @param {Function} 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(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\nmodule.exports = Popup;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/web-auth/popup.js\n// module id = 46\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 * Initializes the legacy Lock login flow in redirect mode\n *\n * @method loginWithCredentials\n * @param {Object} options\n * @param {Function} cb\n * @deprecated `webauth.redirect.loginWithCredentials` will be soon deprecated, use `webauth.login` instead.\n */\nRedirect.prototype.loginWithCredentials = function (options, cb) {\n var usernamePassword;\n\n var params = objectHelper.merge(this.baseOptions, [\n 'clientID',\n 'redirectUri',\n 'tenant',\n 'responseType',\n 'responseMode',\n 'scope',\n 'audience'\n ]).with(options);\n\n this.warn.warning('`webauth.redirect.loginWithCredentials` will be soon deprecated, use `webauth.login` instead.');\n\n assert.check(params, { type: 'object', message: 'options parameter is not valid' }, {\n responseType: { type: 'string', message: 'responseType option is required' }\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: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup\n * @param {Function} 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 = 47\n// module chunks = 0","var IframeHandler = require('../helper/iframe-handler');\n\nfunction SilentAuthenticationHandler(auth0, authenticationUrl, timeout) {\n this.auth0 = auth0;\n this.authenticationUrl = authenticationUrl;\n this.timeout = timeout || 60 * 1000;\n this.handler = null;\n}\n\nSilentAuthenticationHandler.prototype.login = function (usePostMessage, callback) {\n this.handler = new IframeHandler({\n auth0: this.auth0,\n url: this.authenticationUrl,\n callback: callback,\n timeout: this.timeout,\n timeoutCallback: function () {\n callback({\n error: 'timeout',\n description: 'Timeout during authentication renew.'\n });\n },\n usePostMessage: usePostMessage || false\n });\n\n this.handler.init();\n};\n\nmodule.exports = SilentAuthenticationHandler;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/web-auth/silent-authentication-handler.js\n// module id = 48\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.merge(this.baseOptions, [\n 'clientID',\n 'redirectUri',\n 'tenant',\n 'responseType',\n 'responseMode',\n 'scope',\n 'audience'\n ]).with(options);\n\n body = objectHelper.toSnakeCase(body, ['auth0Client']);\n\n return this.request\n .post(url)\n .send(body)\n .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 = 49\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file