From ef5dbf3b2b45640028bbcbd34710a224f37e8896 Mon Sep 17 00:00:00 2001 From: Jason Flax Date: Mon, 29 Jan 2018 13:31:33 -0500 Subject: [PATCH] Release 3.0.0 --- dist/node/admin.js | 98 +- dist/node/auth/common.js | 6 +- dist/node/auth/index.js | 326 ++- dist/node/auth/providers.js | 137 +- dist/node/auth/storage.js | 121 +- dist/node/client.js | 385 ++- dist/node/common.js | 28 +- dist/node/index.js | 13 +- dist/node/services/mongodb/collection.js | 15 + dist/node/util.js | 17 +- dist/web/stitch.js | 3346 ++++++++++++---------- dist/web/stitch.js.map | 2 +- dist/web/stitch.min.js | 6 +- dist/web/stitch.min.js.map | 2 +- package.json | 2 +- 15 files changed, 2578 insertions(+), 1926 deletions(-) diff --git a/dist/node/admin.js b/dist/node/admin.js index bddca3e42..ec77ec105 100644 --- a/dist/node/admin.js +++ b/dist/node/admin.js @@ -3,17 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true }); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +exports.StitchAdminClient = exports.StitchAdminClientFactory = undefined; var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* global window, fetch */ +/* eslint no-labels: ['error', { 'allowLoop': true }] */ + + require('fetch-everywhere'); var _client = require('./client'); -var _client2 = _interopRequireDefault(_client); - var _common = require('./common'); var _common2 = _interopRequireDefault(_common); @@ -22,27 +23,45 @@ var _common3 = require('./auth/common'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* global window, fetch */ -/* eslint no-labels: ['error', { 'allowLoop': true }] */ +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var v2 = 2; var v3 = 3; -var Admin = function (_StitchClient) { - _inherits(Admin, _StitchClient); +var StitchAdminClientFactory = exports.StitchAdminClientFactory = function () { + function StitchAdminClientFactory() { + _classCallCheck(this, StitchAdminClientFactory); + + throw new StitchError('StitchAdminClient can only be made from the StitchAdminClientFactory.create function'); + } + + _createClass(StitchAdminClientFactory, null, [{ + key: 'create', + value: function create(baseUrl) { + return (0, _client.newStitchClient)(StitchAdminClient.prototype, '', { baseUrl: baseUrl, authCodec: _common3.ADMIN_CLIENT_CODEC }); + } + }]); + + return StitchAdminClientFactory; +}(); + +var StitchAdminClient = exports.StitchAdminClient = function (_StitchClient) { + _inherits(StitchAdminClient, _StitchClient); + + function StitchAdminClient() { + _classCallCheck(this, StitchAdminClient); - function Admin(baseUrl) { - _classCallCheck(this, Admin); + var _this = _possibleConstructorReturn(this, (StitchAdminClient.__proto__ || Object.getPrototypeOf(StitchAdminClient)).call(this)); - return _possibleConstructorReturn(this, (Admin.__proto__ || Object.getPrototypeOf(Admin)).call(this, '', { baseUrl: baseUrl, authCodec: _common3.ADMIN_CLIENT_CODEC })); + throw new StitchError('StitchAdminClient can only be made from the StitchAdminClientFactory.create function'); + return _this; } - _createClass(Admin, [{ + _createClass(StitchAdminClient, [{ key: 'logout', @@ -54,7 +73,7 @@ var Admin = function (_StitchClient) { value: function logout() { var _this2 = this; - return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', this).call(this, '/auth/session', 'DELETE', { refreshOnFailure: false, useRefreshToken: true, apiVersion: v3 }).then(function () { + return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', this).call(this, '/auth/session', 'DELETE', { refreshOnFailure: false, useRefreshToken: true, apiVersion: v3 }).then(function () { return _this2.auth.clear(); }); } @@ -80,7 +99,7 @@ var Admin = function (_StitchClient) { }, { key: 'getAuthProviders', value: function getAuthProviders() { - return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', this).call(this, '/auth/providers', 'GET', { noAuth: true, apiVersion: v3 }).then(function (response) { + return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', this).call(this, '/auth/providers', 'GET', { noAuth: true, apiVersion: v3 }).then(function (response) { return response.json(); }); } @@ -94,7 +113,7 @@ var Admin = function (_StitchClient) { }, { key: 'doSessionPost', value: function doSessionPost() { - return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', this).call(this, '/auth/session', 'POST', { refreshOnFailure: false, useRefreshToken: true, apiVersion: v3 }).then(function (response) { + return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', this).call(this, '/auth/session', 'POST', { refreshOnFailure: false, useRefreshToken: true, apiVersion: v3 }).then(function (response) { return response.json(); }); } @@ -288,9 +307,22 @@ var Admin = function (_StitchClient) { get: function get() { return api._get(appUrl + '/users/' + uid); }, + devices: function devices() { + return { + get: function get() { + return api._get(appUrl + '/users/' + uid + '/devices'); + } + }; + }, logout: function logout() { return api._put(appUrl + '/users/' + uid + '/logout'); }, + enable: function enable() { + return api._put(appUrl + '/users/' + uid + '/enable'); + }, + disable: function disable() { + return api._put(appUrl + '/users/' + uid + '/disable'); + }, remove: function remove() { return api._delete(appUrl + '/users/' + uid); } @@ -741,19 +773,19 @@ var Admin = function (_StitchClient) { logs: function logs() { return { get: function get(filter) { - return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', _this3).call(_this3, '/admin/logs', 'GET', { useRefreshToken: true, queryParams: filter }); + return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', _this3).call(_this3, '/admin/logs', 'GET', { useRefreshToken: true, queryParams: filter }); } }; }, users: function users() { return { list: function list(filter) { - return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', _this3).call(_this3, '/admin/users', 'GET', { useRefreshToken: true, queryParams: filter }); + return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', _this3).call(_this3, '/admin/users', 'GET', { useRefreshToken: true, queryParams: filter }); }, user: function user(uid) { return { logout: function logout() { - return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', _this3).call(_this3, '/admin/users/' + uid + '/logout', 'PUT', { useRefreshToken: true }); + return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', _this3).call(_this3, '/admin/users/' + uid + '/logout', 'PUT', { useRefreshToken: true }); } }; } @@ -761,21 +793,6 @@ var Admin = function (_StitchClient) { } }; } - }, { - key: '_isImpersonatingUser', - value: function _isImpersonatingUser() { - return this.auth.isImpersonatingUser(); - } - }, { - key: '_startImpersonation', - value: function _startImpersonation(userId) { - return this.auth.startImpersonation(this, userId); - } - }, { - key: '_stopImpersonation', - value: function _stopImpersonation() { - return this.auth.stopImpersonation(); - } }, { key: 'type', get: function get() { @@ -787,7 +804,7 @@ var Admin = function (_StitchClient) { var _this4 = this; var v3do = function v3do(url, method, options) { - return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', _this4).call(_this4, url, method, Object.assign({}, { apiVersion: v3 }, options)).then(function (response) { + return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', _this4).call(_this4, url, method, Object.assign({}, { apiVersion: v3 }, options)).then(function (response) { var contentHeader = response.headers.get('content-type') || ''; if (contentHeader.split(',').indexOf('application/json') >= 0) { return response.json(); @@ -820,7 +837,7 @@ var Admin = function (_StitchClient) { var _this5 = this; var v2do = function v2do(url, method, options) { - return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', _this5).call(_this5, url, method, Object.assign({}, { apiVersion: v2 }, options)).then(function (response) { + return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', _this5).call(_this5, url, method, Object.assign({}, { apiVersion: v2 }, options)).then(function (response) { var contentHeader = response.headers.get('content-type') || ''; if (contentHeader.split(',').indexOf('application/json') >= 0) { return response.json(); @@ -849,8 +866,5 @@ var Admin = function (_StitchClient) { } }]); - return Admin; -}(_client2.default); - -exports.default = Admin; -module.exports = exports['default']; \ No newline at end of file + return StitchAdminClient; +}(_client.StitchClient); \ No newline at end of file diff --git a/dist/node/auth/common.js b/dist/node/auth/common.js index fa327098e..8eacf9405 100644 --- a/dist/node/auth/common.js +++ b/dist/node/auth/common.js @@ -7,12 +7,12 @@ var USER_AUTH_KEY = exports.USER_AUTH_KEY = '_stitch_ua'; var REFRESH_TOKEN_KEY = exports.REFRESH_TOKEN_KEY = '_stitch_rt'; var DEVICE_ID_KEY = exports.DEVICE_ID_KEY = '_stitch_did'; var STATE_KEY = exports.STATE_KEY = '_stitch_state'; -var IMPERSONATION_ACTIVE_KEY = exports.IMPERSONATION_ACTIVE_KEY = '_stitch_impers_active'; -var IMPERSONATION_USER_KEY = exports.IMPERSONATION_USER_KEY = '_stitch_impers_user'; -var IMPERSONATION_REAL_USER_AUTH_KEY = exports.IMPERSONATION_REAL_USER_AUTH_KEY = '_stitch_impers_real_ua'; var USER_AUTH_COOKIE_NAME = exports.USER_AUTH_COOKIE_NAME = 'stitch_ua'; var STITCH_ERROR_KEY = exports.STITCH_ERROR_KEY = '_stitch_error'; var STITCH_LINK_KEY = exports.STITCH_LINK_KEY = '_stitch_link'; +var USER_LOGGED_IN_PT_KEY = exports.USER_LOGGED_IN_PT_KEY = '_stitch_pt'; +var STITCH_REDIRECT_PROVIDER = exports.STITCH_REDIRECT_PROVIDER = '_stitch_rp'; + var DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS = exports.DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS = 10; var APP_CLIENT_CODEC = exports.APP_CLIENT_CODEC = { diff --git a/dist/node/auth/index.js b/dist/node/auth/index.js index 5e0b2f461..cfdd358fa 100644 --- a/dist/node/auth/index.js +++ b/dist/node/auth/index.js @@ -3,9 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true }); +exports.Auth = exports.AuthFactory = undefined; + +var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* global window, document, fetch */ +exports.newAuth = newAuth; + var _storage = require('./storage'); var _providers = require('./providers'); @@ -20,6 +25,10 @@ var _common2 = require('../common'); var common = _interopRequireWildcard(_common2); +var _detectBrowser = require('detect-browser'); + +var _platform = _interopRequireWildcard(_detectBrowser); + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } @@ -30,23 +39,99 @@ var jwtDecode = require('jwt-decode'); var EMBEDDED_USER_AUTH_DATA_PARTS = 4; -var Auth = function () { +var AuthFactory = exports.AuthFactory = function () { + function AuthFactory() { + _classCallCheck(this, AuthFactory); + + throw new _errors.StitchError('Auth can only be made from the AuthFactory.create function'); + } + + _createClass(AuthFactory, null, [{ + key: 'create', + value: function create(client, rootUrl, options) { + return newAuth(client, rootUrl, options); + } + }]); + + return AuthFactory; +}(); + +function newAuth(client, rootUrl, options) { + var auth = Object.create(Auth.prototype); + var namespace = void 0; + if (!client || client.clientAppID === '') { + namespace = 'admin'; + } else { + namespace = 'client.' + client.clientAppID; + } + + options = Object.assign({ + codec: authCommon.APP_CLIENT_CODEC, + namespace: namespace, + storageType: 'localStorage' + }, options); + + auth.client = client; + auth.rootUrl = rootUrl; + auth.codec = options.codec; + auth.platform = options.platform || _platform; + auth.storage = (0, _storage.createStorage)(options); + auth.providers = (0, _providers.createProviders)(auth, options); + + return Promise.all([auth._get(), auth.storage.get(authCommon.REFRESH_TOKEN_KEY), auth.storage.get(authCommon.USER_LOGGED_IN_PT_KEY), auth.storage.get(authCommon.DEVICE_ID_KEY)]).then(function (_ref) { + var _ref2 = _slicedToArray(_ref, 4), + authObj = _ref2[0], + rt = _ref2[1], + loggedInProviderType = _ref2[2], + deviceId = _ref2[3]; + + auth.auth = authObj; + auth.authedId = authObj.userId; + auth.rt = rt; + auth.loggedInProviderType = loggedInProviderType; + auth.deviceId = deviceId; + + return auth; + }); +} + +var Auth = exports.Auth = function () { function Auth(client, rootUrl, options) { _classCallCheck(this, Auth); - options = Object.assign({}, { - storageType: 'localStorage', - codec: authCommon.APP_CLIENT_CODEC - }, options); - - this.client = client; - this.rootUrl = rootUrl; - this.codec = options.codec; - this.storage = (0, _storage.createStorage)(options.storageType); - this.providers = (0, _providers.createProviders)(this); + throw new _errors.StitchError('Auth can only be made from the AuthFactory.create function'); } + /** + * Create the device info for this client. + * + * @memberof module:auth + * @method getDeviceInfo + * @param {String} appId The app ID for this client + * @param {String} appVersion The version of the app + * @returns {Object} The device info object + */ + + _createClass(Auth, [{ + key: 'getDeviceInfo', + value: function getDeviceInfo(deviceId, appId) { + var appVersion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; + + var deviceInfo = { appId: appId, appVersion: appVersion, sdkVersion: common.SDK_VERSION }; + + if (deviceId) { + deviceInfo.deviceId = deviceId; + } + + if (this.platform) { + deviceInfo.platform = this.platform.name; + deviceInfo.platformVersion = this.platform.version; + } + + return deviceInfo; + } + }, { key: 'provider', value: function provider(name) { if (!this.providers.hasOwnProperty(name)) { @@ -60,10 +145,6 @@ var Auth = function () { value: function refreshToken() { var _this = this; - if (this.isImpersonatingUser()) { - return this.refreshImpersonation(this.client); - } - return this.client.doSessionPost().then(function (json) { return _this.set(json); }); @@ -89,6 +170,8 @@ var Auth = function () { }, { key: 'handleRedirect', value: function handleRedirect() { + var _this2 = this; + if (typeof window === 'undefined') { // This means we're running in some environment other // than a browser - so handling a redirect makes no sense here. @@ -98,35 +181,46 @@ var Auth = function () { return; } - var ourState = this.storage.get(authCommon.STATE_KEY); - var redirectFragment = window.location.hash.substring(1); - var redirectState = this.parseRedirectFragment(redirectFragment, ourState); - if (redirectState.lastError) { - console.error('StitchClient: error from redirect: ' + redirectState.lastError); - this._error = redirectState.lastError; - window.history.replaceState(null, '', this.pageRootUrl()); - return; - } + var redirectProvider = void 0; + return Promise.all([this.storage.get(authCommon.STATE_KEY), this.storage.get(authCommon.STITCH_REDIRECT_PROVIDER)]).then(function (_ref3) { + var _ref4 = _slicedToArray(_ref3, 2), + ourState = _ref4[0], + _redirectProvider = _ref4[1]; + + var redirectFragment = window.location.hash.substring(1); + redirectProvider = _redirectProvider; + var redirectState = _this2.parseRedirectFragment(redirectFragment, ourState); + if (redirectState.lastError || !redirectProvider) { + console.error('StitchClient: error from redirect: ' + (redirectState.lastError ? redirectState.lastError : 'provider type not set')); + _this2._error = redirectState.lastError; + window.history.replaceState(null, '', _this2.pageRootUrl()); + return; + } - if (!redirectState.found) { - return; - } + if (!redirectState.found) { + return; + } - this.storage.remove(authCommon.STATE_KEY); - if (!redirectState.stateValid) { - console.error('StitchClient: state values did not match!'); - window.history.replaceState(null, '', this.pageRootUrl()); - return; - } + return Promise.all([_this2.storage.remove(authCommon.STATE_KEY), _this2.storage.remove(authCommon.STITCH_REDIRECT_PROVIDER)]).then(function () { + return redirectState; + }); + }).then(function (redirectState) { + if (!redirectState.stateValid) { + console.error('StitchClient: state values did not match!'); + window.history.replaceState(null, '', _this2.pageRootUrl()); + return; + } - if (!redirectState.ua) { - console.error('StitchClient: no UA value was returned from redirect!'); - return; - } + if (!redirectState.ua) { + console.error('StitchClient: no UA value was returned from redirect!'); + return; + } - // If we get here, the state is valid - set auth appropriately. - this.set(redirectState.ua); - window.history.replaceState(null, '', this.pageRootUrl()); + // If we get here, the state is valid - set auth appropriately. + return _this2.set(redirectState.ua, redirectProvider); + }).then(function () { + return window.history.replaceState(null, '', _this2.pageRootUrl()); + }); } }, { key: 'getCookie', @@ -148,6 +242,8 @@ var Auth = function () { }, { key: 'handleCookie', value: function handleCookie() { + var _this3 = this; + if (typeof window === 'undefined' || typeof document === 'undefined') { // This means we're running in some environment other // than a browser - so handling a cookie makes no sense here. @@ -164,20 +260,24 @@ var Auth = function () { document.cookie = authCommon.USER_AUTH_COOKIE_NAME + '=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT;'; var userAuth = this.unmarshallUserAuth(uaCookie); - this.set(userAuth); - window.history.replaceState(null, '', this.pageRootUrl()); + return this.set(userAuth, _providers.PROVIDER_TYPE_MONGODB_CLOUD).then(function () { + return window.history.replaceState(null, '', _this3.pageRootUrl()); + }); } }, { key: 'clear', value: function clear() { - this.storage.remove(authCommon.USER_AUTH_KEY); - this.storage.remove(authCommon.REFRESH_TOKEN_KEY); - this.clearImpersonation(); + this.auth = null; + this.authedId = null; + this.rt = null; + this.loggedInProviderType = null; + + return Promise.all([this.storage.remove(authCommon.USER_AUTH_KEY), this.storage.remove(authCommon.REFRESH_TOKEN_KEY), this.storage.remove(authCommon.USER_LOGGED_IN_PT_KEY), this.storage.remove(authCommon.STITCH_REDIRECT_PROVIDER)]); } }, { key: 'getDeviceId', value: function getDeviceId() { - return this.storage.get(authCommon.DEVICE_ID_KEY); + return this.deviceId; } // Returns whether or not the access token is expired or is going to expire within 'withinSeconds' @@ -209,30 +309,42 @@ var Auth = function () { }, { key: 'getAccessToken', value: function getAccessToken() { - return this._get().accessToken; + return this.auth.accessToken; } }, { key: 'getRefreshToken', value: function getRefreshToken() { - return this.storage.get(authCommon.REFRESH_TOKEN_KEY); + return this.rt; } }, { key: 'set', value: function set(json) { + var _this4 = this; + + var authType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + if (!json) { return; } + var newUserAuth = {}; + var setters = []; + + if (authType) { + this.loggedInProviderType = authType; + setters.push(this.storage.set(authCommon.USER_LOGGED_IN_PT_KEY, authType)); + } + if (json[this.codec.refreshToken]) { - var rt = json[this.codec.refreshToken]; + this.rt = json[this.codec.refreshToken]; delete json[this.codec.refreshToken]; - this.storage.set(authCommon.REFRESH_TOKEN_KEY, rt); + setters.push(this.storage.set(authCommon.REFRESH_TOKEN_KEY, this.rt)); } if (json[this.codec.deviceId]) { - var deviceId = json[this.codec.deviceId]; + this.deviceId = json[this.codec.deviceId]; delete json[this.codec.deviceId]; - this.storage.set(authCommon.DEVICE_ID_KEY, deviceId); + setters.push(this.storage.set(authCommon.DEVICE_ID_KEY, this.deviceId)); } // Merge in new fields with old fields. Typically the first json value @@ -240,98 +352,45 @@ var Auth = function () { // do not include everything. This merging behavior is safe so long as json // value responses with absent fields do not indicate that the field should // be unset. - var newUserAuth = {}; if (json[this.codec.accessToken]) { newUserAuth.accessToken = json[this.codec.accessToken]; } if (json[this.codec.userId]) { newUserAuth.userId = json[this.codec.userId]; } - newUserAuth = Object.assign(this._get(), newUserAuth); - this.storage.set(authCommon.USER_AUTH_KEY, JSON.stringify(newUserAuth)); - } - }, { - key: '_get', - value: function _get() { - var data = this.storage.get(authCommon.USER_AUTH_KEY); - if (!data) { - return {}; - } - - try { - return JSON.parse(data); - } catch (e) { - // Need to back out and clear auth otherwise we will never - // be able to do anything useful. - this.clear(); - throw new _errors.StitchError('Failure retrieving stored auth'); - } - } - }, { - key: 'authedId', - value: function authedId() { - return this._get().userId; - } - }, { - key: 'isImpersonatingUser', - value: function isImpersonatingUser() { - return this.storage.get(authCommon.IMPERSONATION_ACTIVE_KEY) === 'true'; - } - }, { - key: 'refreshImpersonation', - value: function refreshImpersonation(client) { - var _this2 = this; - var userId = this.storage.get(authCommon.IMPERSONATION_USER_KEY); - return client._do('/admin/users/' + userId + '/impersonate', 'POST', { refreshOnFailure: false, useRefreshToken: true }).then(function (response) { - return response.json(); - }).then(function (json) { - return _this2.set(json); - }).catch(function (e) { - _this2.stopImpersonation(); - throw e; // rethrow + this.auth = Object.assign(this.auth ? this.auth : {}, newUserAuth); + this.authedId = this.auth.userId; + setters.push(this.storage.set(authCommon.USER_AUTH_KEY, JSON.stringify(this.auth))); + return Promise.all(setters).then(function () { + return _this4.auth; }); } }, { - key: 'startImpersonation', - value: function startImpersonation(client, userId) { - if (!this.authedId()) { - return Promise.reject(new _errors.StitchError('Must auth first')); - } - - if (this.isImpersonatingUser()) { - return Promise.reject(new _errors.StitchError('Already impersonating a user')); - } - - this.storage.set(authCommon.IMPERSONATION_ACTIVE_KEY, 'true'); - this.storage.set(authCommon.IMPERSONATION_USER_KEY, userId); - - var realUserAuth = JSON.parse(this.storage.get(authCommon.USER_AUTH_KEY)); - this.storage.set(authCommon.IMPERSONATION_REAL_USER_AUTH_KEY, JSON.stringify(realUserAuth)); - return this.refreshImpersonation(client); - } - }, { - key: 'stopImpersonation', - value: function stopImpersonation() { - var _this3 = this; + key: '_get', + value: function _get() { + var _this5 = this; - if (!this.isImpersonatingUser()) { - throw new _errors.StitchError('Not impersonating a user'); - } + return this.storage.get(authCommon.USER_AUTH_KEY).then(function (data) { + if (!data) { + return {}; + } - return new Promise(function (resolve, reject) { - var realUserAuth = JSON.parse(_this3.storage.get(authCommon.IMPERSONATION_REAL_USER_AUTH_KEY)); - _this3.set(realUserAuth); - _this3.clearImpersonation(); - resolve(); + try { + return JSON.parse(data); + } catch (e) { + // Need to back out and clear auth otherwise we will never + // be able to do anything useful. + return _this5.clear().then(function () { + throw new _errors.StitchError('Failure retrieving stored auth'); + }); + } }); } }, { - key: 'clearImpersonation', - value: function clearImpersonation() { - this.storage.remove(authCommon.IMPERSONATION_ACTIVE_KEY); - this.storage.remove(authCommon.IMPERSONATION_USER_KEY); - this.storage.remove(authCommon.IMPERSONATION_REAL_USER_AUTH_KEY); + key: 'getLoggedInProviderType', + value: function getLoggedInProviderType() { + return this.loggedInProviderType; } }, { key: 'parseRedirectFragment', @@ -380,19 +439,16 @@ var Auth = function () { }, { key: 'unmarshallUserAuth', value: function unmarshallUserAuth(data) { - var _ref; + var _ref5; var parts = data.split('$'); if (parts.length !== EMBEDDED_USER_AUTH_DATA_PARTS) { throw new RangeError('invalid user auth data provided: ' + data); } - return _ref = {}, _defineProperty(_ref, this.codec.accessToken, parts[0]), _defineProperty(_ref, this.codec.refreshToken, parts[1]), _defineProperty(_ref, this.codec.userId, parts[2]), _defineProperty(_ref, this.codec.deviceId, parts[3]), _ref; + return _ref5 = {}, _defineProperty(_ref5, this.codec.accessToken, parts[0]), _defineProperty(_ref5, this.codec.refreshToken, parts[1]), _defineProperty(_ref5, this.codec.userId, parts[2]), _defineProperty(_ref5, this.codec.deviceId, parts[3]), _ref5; } }]); return Auth; -}(); - -exports.default = Auth; -module.exports = exports['default']; \ No newline at end of file +}(); \ No newline at end of file diff --git a/dist/node/auth/providers.js b/dist/node/auth/providers.js index 610e12d1d..253aea939 100644 --- a/dist/node/auth/providers.js +++ b/dist/node/auth/providers.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.createProviders = undefined; +exports.createProviders = exports.PROVIDER_TYPE_MONGODB_CLOUD = exports.PROVIDER_TYPE_FACEBOOK = exports.PROVIDER_TYPE_GOOGLE = exports.PROVIDER_TYPE_APIKEY = exports.PROVIDER_TYPE_USERPASS = exports.PROVIDER_TYPE_CUSTOM = exports.PROVIDER_TYPE_ANON = undefined; var _common = require('../common'); @@ -17,38 +17,20 @@ var _util = require('../util'); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } -/** - * Create the device info for this client. - * - * @memberof module:auth - * @method getDeviceInfo - * @param {String} appId The app ID for this client - * @param {String} appVersion The version of the app - * @returns {Object} The device info object - */ -function getDeviceInfo(deviceId, appId) { - var appVersion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; - - var deviceInfo = { appId: appId, appVersion: appVersion, sdkVersion: common.SDK_VERSION }; - - if (deviceId) { - deviceInfo.deviceId = deviceId; - } - - var platform = (0, _util.getPlatform)(); +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /** @module auth */ - if (platform) { - deviceInfo.platform = platform.name; - deviceInfo.platformVersion = platform.version; - } - return deviceInfo; -} +var PROVIDER_TYPE_ANON = exports.PROVIDER_TYPE_ANON = 'anon'; +var PROVIDER_TYPE_CUSTOM = exports.PROVIDER_TYPE_CUSTOM = 'custom'; +var PROVIDER_TYPE_USERPASS = exports.PROVIDER_TYPE_USERPASS = 'userpass'; +var PROVIDER_TYPE_APIKEY = exports.PROVIDER_TYPE_APIKEY = 'apiKey'; +var PROVIDER_TYPE_GOOGLE = exports.PROVIDER_TYPE_GOOGLE = 'google'; +var PROVIDER_TYPE_FACEBOOK = exports.PROVIDER_TYPE_FACEBOOK = 'facebook'; +var PROVIDER_TYPE_MONGODB_CLOUD = exports.PROVIDER_TYPE_MONGODB_CLOUD = 'mongodbCloud'; /** * @namespace */ -/** @module auth */ function anonProvider(auth) { return { /** @@ -59,14 +41,15 @@ function anonProvider(auth) { * @returns {Promise} a promise that resolves when authentication succeeds. */ authenticate: function authenticate() { - var device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID); + var deviceId = auth.getDeviceId(); + var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID); var fetchArgs = common.makeFetchArgs('GET'); fetchArgs.cors = true; return fetch(auth.rootUrl + '/providers/anon-user/login?device=' + (0, _util.uriEncodeObject)(device), fetchArgs).then(common.checkStatus).then(function (response) { return response.json(); }).then(function (json) { - return auth.set(json); + return auth.set(json, PROVIDER_TYPE_ANON); }); } }; @@ -89,7 +72,8 @@ function customProvider(auth) { * @returns {Promise} a promise that resolves when authentication succeeds. */ authenticate: function authenticate(token) { - var device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID); + var deviceId = auth.getDeviceId(); + var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID); var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ token: token, options: { device: device } })); fetchArgs.cors = true; @@ -97,7 +81,7 @@ function customProvider(auth) { return fetch(auth.rootUrl + '/' + loginRoute, fetchArgs).then(common.checkStatus).then(function (response) { return response.json(); }).then(function (json) { - return auth.set(json); + return auth.set(json, PROVIDER_TYPE_CUSTOM); }); } }; @@ -124,7 +108,8 @@ function userPassProvider(auth) { var username = _ref.username, password = _ref.password; - var device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID); + var deviceId = auth.getDeviceId(); + var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID); var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ username: username, password: password, options: { device: device } })); fetchArgs.cors = true; @@ -132,7 +117,7 @@ function userPassProvider(auth) { return fetch(auth.rootUrl + '/' + loginRoute, fetchArgs).then(common.checkStatus).then(function (response) { return response.json(); }).then(function (json) { - return auth.set(json); + return auth.set(json, PROVIDER_TYPE_USERPASS); }); }, @@ -246,14 +231,14 @@ function apiKeyProvider(auth) { * @returns {Promise} a promise that resolves when authentication succeeds. */ authenticate: function authenticate(key) { - var device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID); + var deviceId = auth.getDeviceId(); + var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID); var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ 'key': key, 'options': { device: device } })); fetchArgs.cors = true; - return fetch(auth.rootUrl + '/' + loginRoute, fetchArgs).then(common.checkStatus).then(function (response) { return response.json(); }).then(function (json) { - return auth.set(json); + return auth.set(json, PROVIDER_TYPE_APIKEY); }); } }; @@ -283,16 +268,20 @@ function getOAuthLoginURL(auth, providerName, redirectUrl) { } var state = generateState(); - auth.storage.set(authCommon.STATE_KEY, state); - - var device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID); - - var result = auth.rootUrl + '/providers/oauth2-' + providerName + '/login?redirect=' + encodeURI(redirectUrl) + '&state=' + state + '&device=' + (0, _util.uriEncodeObject)(device); - return result; + return auth.storage.set(authCommon.STATE_KEY, state).then(function () { + return auth.getDeviceId(); + }).then(function (deviceId) { + var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID); + + var result = auth.rootUrl + '/providers/oauth2-' + providerName + '/login?redirect=' + encodeURI(redirectUrl) + '&state=' + state + '&device=' + (0, _util.uriEncodeObject)(device); + return result; + }); } /** @namespace */ function googleProvider(auth) { + var loginRoute = auth.isAppClient() ? 'providers/oauth2-google/login' : 'providers/oauth2-google/login'; + return { /** * Login to a stitch application using google authentication @@ -303,15 +292,35 @@ function googleProvider(auth) { * @returns {Promise} a promise that resolves when authentication succeeds. */ authenticate: function authenticate(data) { + var authCode = data.authCode; + + if (authCode) { + var deviceId = auth.getDeviceId(); + var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID); + + var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ authCode: authCode, options: { device: device } })); + + return fetch(auth.rootUrl + '/' + loginRoute, fetchArgs).then(common.checkStatus).then(function (response) { + return response.json(); + }).then(function (json) { + return auth.set(json, PROVIDER_TYPE_GOOGLE); + }); + } + var redirectUrl = data && data.redirectUrl ? data.redirectUrl : undefined; - window.location.replace(getOAuthLoginURL(auth, 'google', redirectUrl)); - return Promise.resolve(); + return auth.storage.set(authCommon.STITCH_REDIRECT_PROVIDER, PROVIDER_TYPE_GOOGLE).then(function () { + return getOAuthLoginURL(auth, PROVIDER_TYPE_GOOGLE, redirectUrl); + }).then(function (res) { + return window.location.replace(res); + }); } }; } /** @namespace */ function facebookProvider(auth) { + var loginRoute = auth.isAppClient() ? 'providers/oauth2-facebook/login' : 'providers/oauth2-facebook/login'; + return { /** * Login to a stitch application using facebook authentication @@ -322,9 +331,28 @@ function facebookProvider(auth) { * @returns {Promise} a promise that resolves when authentication succeeds. */ authenticate: function authenticate(data) { + var accessToken = data.accessToken; + + + if (accessToken) { + var deviceId = auth.getDeviceId(); + var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID); + + var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ accessToken: accessToken, options: { device: device } })); + + return fetch(auth.rootUrl + '/' + loginRoute, fetchArgs).then(common.checkStatus).then(function (response) { + return response.json(); + }).then(function (json) { + return auth.set(json, PROVIDER_TYPE_FACEBOOK); + }); + } + var redirectUrl = data && data.redirectUrl ? data.redirectUrl : undefined; - window.location.replace(getOAuthLoginURL(auth, 'facebook', redirectUrl)); - return Promise.resolve(); + return auth.storage.set(authCommon.STITCH_REDIRECT_PROVIDER, PROVIDER_TYPE_FACEBOOK).then(function () { + return getOAuthLoginURL(auth, PROVIDER_TYPE_FACEBOOK, redirectUrl); + }).then(function (res) { + return window.location.replace(res); + }); } }; } @@ -351,7 +379,8 @@ function mongodbCloudProvider(auth) { cookie = data.cookie; var options = Object.assign({}, { cors: true, cookie: false }, { cors: cors, cookie: cookie }); - var device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID); + var deviceId = auth.getDeviceId(); + var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID); var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ username: username, apiKey: apiKey, options: { device: device } })); fetchArgs.cors = true; // TODO: shouldn't this use the passed in `cors` value? fetchArgs.credentials = 'include'; @@ -364,7 +393,7 @@ function mongodbCloudProvider(auth) { return fetch(url, fetchArgs).then(common.checkStatus).then(function (response) { return response.json(); }).then(function (json) { - return auth.set(json); + return auth.set(json, PROVIDER_TYPE_MONGODB_CLOUD); }); } }; @@ -372,17 +401,11 @@ function mongodbCloudProvider(auth) { // TODO: support auth-specific options function createProviders(auth) { + var _ref2; + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - return { - anon: anonProvider(auth), - apiKey: apiKeyProvider(auth), - google: googleProvider(auth), - facebook: facebookProvider(auth), - mongodbCloud: mongodbCloudProvider(auth), - userpass: userPassProvider(auth), - custom: customProvider(auth) - }; + return _ref2 = {}, _defineProperty(_ref2, PROVIDER_TYPE_ANON, anonProvider(auth)), _defineProperty(_ref2, PROVIDER_TYPE_APIKEY, apiKeyProvider(auth)), _defineProperty(_ref2, PROVIDER_TYPE_GOOGLE, googleProvider(auth)), _defineProperty(_ref2, PROVIDER_TYPE_FACEBOOK, facebookProvider(auth)), _defineProperty(_ref2, PROVIDER_TYPE_MONGODB_CLOUD, mongodbCloudProvider(auth)), _defineProperty(_ref2, PROVIDER_TYPE_USERPASS, userPassProvider(auth)), _defineProperty(_ref2, PROVIDER_TYPE_CUSTOM, customProvider(auth)), _ref2; } exports.createProviders = createProviders; \ No newline at end of file diff --git a/dist/node/auth/storage.js b/dist/node/auth/storage.js index 2cff4d67e..2341ac53a 100644 --- a/dist/node/auth/storage.js +++ b/dist/node/auth/storage.js @@ -3,18 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true }); +exports.MemoryStorage = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); exports.createStorage = createStorage; +var _common = require('./common'); + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var MemoryStorage = function () { +var MemoryStorage = exports.MemoryStorage = function () { function MemoryStorage() { _classCallCheck(this, MemoryStorage); this._data = {}; + this._orderedKeys = []; + this.length = 0; } _createClass(MemoryStorage, [{ @@ -25,69 +30,145 @@ var MemoryStorage = function () { }, { key: 'setItem', value: function setItem(key, value) { + this._orderedKeys.push(key); this._data[key] = value; + this.length++; return this._data[key]; } }, { key: 'removeItem', value: function removeItem(key) { + this._orderedKeys.pop(key); delete this._data[key]; + this.length--; return undefined; } }, { - key: 'clear', - value: function clear() { - this._data = {}; - return this._data; + key: 'key', + value: function key(index) { + return this._orderedKeys[index]; } }]); return MemoryStorage; }(); +var _VERSION = 1; +var _VERSION_KEY = '__stitch_storage_version__'; + +/** + * Run a migration on the currently used storage + * that checks to see if the current version is up to date. + * If the version has not been set, this method will migrate + * to the latest version. + * @param {Integer} version version number of storage + * @param {Object} storage storage class being checked + * @returns {Promise} nullable promise containing migration logic + */ +function _runMigration(version, storage) { + switch (version) { + case null: + case undefined: + // return a promise, + // mapping each of the store's keys to a Promise + // that fetches the each value for each key, + // sets the old value to the new "namespaced" key + // remove the old key value pair, + // and set the version number + var migrations = [_common.USER_AUTH_KEY, _common.REFRESH_TOKEN_KEY, _common.DEVICE_ID_KEY, _common.STATE_KEY].map(function (key) { + return Promise.resolve(storage.store.getItem(key)).then(function (item) { + return !!item && storage.store.setItem(storage._generateKey(key), item); + }).then(function () { + return storage.store.removeItem(key); + }); + }); + return Promise.all(migrations).then(function () { + return storage.store.setItem(_VERSION_KEY, _VERSION); + }); + // in future versions, `case 1:`, `case 2:` and so on + // could be added to perform similar migrations + default: + break; + } +} + var Storage = function () { - function Storage(store) { + /** + * @param {Storage} store implementer of Storage interface + * @param {String} namespace clientAppID to be used for namespacing + * @param + */ + function Storage(store, namespace) { + var _this = this; + _classCallCheck(this, Storage); this.store = store; + this.namespace = '_stitch.' + namespace; + + this._migration = Promise.resolve(this.store.getItem(_VERSION_KEY)).then(function (version) { + return _runMigration(version, _this); + }); } _createClass(Storage, [{ + key: '_generateKey', + value: function _generateKey(key) { + return this.namespace + '.' + key; + } + }, { key: 'get', value: function get(key) { - return this.store.getItem(key); + var _this2 = this; + + return Promise.resolve(this._migration).then(function () { + return _this2.store.getItem(_this2._generateKey(key)); + }); } }, { key: 'set', value: function set(key, value) { - return this.store.setItem(key, value); + var _this3 = this; + + return Promise.resolve(this._migration).then(function () { + return _this3.store.setItem(_this3._generateKey(key), value); + }).then(function () { + return value; + }); } }, { key: 'remove', value: function remove(key) { - return this.store.removeItem(key); - } - }, { - key: 'clear', - value: function clear() { - return this.store.clear(); + var _this4 = this; + + return Promise.resolve(this._migration).then(function () { + return _this4.store.removeItem(_this4._generateKey(key)); + }); } }]); return Storage; }(); -function createStorage(type) { - if (type === 'localStorage') { +function createStorage(options) { + var storageType = options.storageType, + storage = options.storage, + namespace = options.namespace; + + + if (storageType === 'localStorage') { if (typeof window !== 'undefined' && 'localStorage' in window && window.localStorage !== null) { - return new Storage(window.localStorage); + return new Storage(window.localStorage, namespace); } - } else if (type === 'sessionStorage') { + } else if (storageType === 'sessionStorage') { if (typeof window !== 'undefined' && 'sessionStorage' in window && window.sessionStorage !== null) { - return new Storage(window.sessionStorage); + return new Storage(window.sessionStorage, namespace); } + } else if (storageType == 'customStorage') { + //eslint-disable-line eqeqeq + return new Storage(storage, namespace); } // default to memory storage - return new Storage(new MemoryStorage()); + return new Storage(new MemoryStorage(), namespace); } \ No newline at end of file diff --git a/dist/node/client.js b/dist/node/client.js index 65d04f244..cf52901b2 100644 --- a/dist/node/client.js +++ b/dist/node/client.js @@ -3,16 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true }); +exports.StitchClient = exports.StitchClientFactory = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* global window, fetch */ /* eslint no-labels: ['error', { 'allowLoop': true }] */ +exports.newStitchClient = newStitchClient; + require('fetch-everywhere'); var _auth = require('./auth'); -var _auth2 = _interopRequireDefault(_auth); +var _providers = require('./auth/providers'); var _common = require('./auth/common'); @@ -32,8 +35,6 @@ var _queryString = require('query-string'); var _queryString2 = _interopRequireDefault(_queryString); -var _util = require('./util'); - var _errors = require('./errors'); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } @@ -53,57 +54,81 @@ var API_TYPE_CLIENT = 'client'; var API_TYPE_APP = 'app'; /** - * Create a new StitchClient instance. - * - * @class - * @return {StitchClient} a StitchClient instance. - */ + * Factory class to create a new StitchClient asynchronously. + */ -var StitchClient = function () { - function StitchClient(clientAppID, options) { - var _v, - _v2, - _v3, - _rootURLsByAPIVersion, - _this = this; +var StitchClientFactory = exports.StitchClientFactory = function () { + function StitchClientFactory() { + _classCallCheck(this, StitchClientFactory); - _classCallCheck(this, StitchClient); + throw new _errors.StitchError('StitchClient can only be made from the StitchClientFactory.create function'); + } + + _createClass(StitchClientFactory, null, [{ + key: 'create', + value: function create(clientAppID) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var baseUrl = common.DEFAULT_STITCH_SERVER_URL; - if (options && options.baseUrl) { - baseUrl = options.baseUrl; + return newStitchClient(StitchClient.prototype, clientAppID, options); } + }]); + + return StitchClientFactory; +}(); - this.clientAppID = clientAppID; +function newStitchClient(prototype, clientAppID) { + var _v, _v2, _v3, _stitchClient$rootURL; - this.authUrl = clientAppID ? baseUrl + '/api/client/v2.0/app/' + clientAppID + '/auth' : baseUrl + '/api/admin/v3.0/auth'; + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - this.rootURLsByAPIVersion = (_rootURLsByAPIVersion = {}, _defineProperty(_rootURLsByAPIVersion, v1, (_v = {}, _defineProperty(_v, API_TYPE_PUBLIC, baseUrl + '/api/public/v1.0'), _defineProperty(_v, API_TYPE_CLIENT, baseUrl + '/api/client/v1.0'), _defineProperty(_v, API_TYPE_PRIVATE, baseUrl + '/api/private/v1.0'), _defineProperty(_v, API_TYPE_APP, clientAppID ? baseUrl + '/api/client/v1.0/app/' + clientAppID : baseUrl + '/api/public/v1.0'), _v)), _defineProperty(_rootURLsByAPIVersion, v2, (_v2 = {}, _defineProperty(_v2, API_TYPE_PUBLIC, baseUrl + '/api/public/v2.0'), _defineProperty(_v2, API_TYPE_CLIENT, baseUrl + '/api/client/v2.0'), _defineProperty(_v2, API_TYPE_PRIVATE, baseUrl + '/api/private/v2.0'), _defineProperty(_v2, API_TYPE_APP, clientAppID ? baseUrl + '/api/client/v2.0/app/' + clientAppID : baseUrl + '/api/public/v2.0'), _v2)), _defineProperty(_rootURLsByAPIVersion, v3, (_v3 = {}, _defineProperty(_v3, API_TYPE_PUBLIC, baseUrl + '/api/public/v3.0'), _defineProperty(_v3, API_TYPE_CLIENT, baseUrl + '/api/client/v3.0'), _defineProperty(_v3, API_TYPE_APP, clientAppID ? baseUrl + '/api/client/v3.0/app/' + clientAppID : baseUrl + '/api/admin/v3.0'), _v3)), _rootURLsByAPIVersion); + var stitchClient = Object.create(prototype); + var baseUrl = common.DEFAULT_STITCH_SERVER_URL; + if (options.baseUrl) { + baseUrl = options.baseUrl; + } - var authOptions = { codec: _common.APP_CLIENT_CODEC }; - if (options && options.authCodec) { - authOptions.codec = options.authCodec; - } - this.auth = new _auth2.default(this, this.authUrl, authOptions); - this.auth.handleRedirect(); - this.auth.handleCookie(); - - // deprecated API - this.authManager = { - apiKeyAuth: function apiKeyAuth(key) { - return _this.authenticate('apiKey', key); - }, - localAuth: function localAuth(email, password) { - return _this.login(email, password); - }, - mongodbCloudAuth: function mongodbCloudAuth(username, apiKey, opts) { - return _this.authenticate('mongodbCloud', Object.assign({ username: username, apiKey: apiKey }, opts)); - } - }; + stitchClient.clientAppID = clientAppID; + + stitchClient.authUrl = clientAppID ? baseUrl + '/api/client/v2.0/app/' + clientAppID + '/auth' : baseUrl + '/api/admin/v3.0/auth'; + + stitchClient.rootURLsByAPIVersion = (_stitchClient$rootURL = {}, _defineProperty(_stitchClient$rootURL, v1, (_v = {}, _defineProperty(_v, API_TYPE_PUBLIC, baseUrl + '/api/public/v1.0'), _defineProperty(_v, API_TYPE_CLIENT, baseUrl + '/api/client/v1.0'), _defineProperty(_v, API_TYPE_PRIVATE, baseUrl + '/api/private/v1.0'), _defineProperty(_v, API_TYPE_APP, clientAppID ? baseUrl + '/api/client/v1.0/app/' + clientAppID : baseUrl + '/api/public/v1.0'), _v)), _defineProperty(_stitchClient$rootURL, v2, (_v2 = {}, _defineProperty(_v2, API_TYPE_PUBLIC, baseUrl + '/api/public/v2.0'), _defineProperty(_v2, API_TYPE_CLIENT, baseUrl + '/api/client/v2.0'), _defineProperty(_v2, API_TYPE_PRIVATE, baseUrl + '/api/private/v2.0'), _defineProperty(_v2, API_TYPE_APP, clientAppID ? baseUrl + '/api/client/v2.0/app/' + clientAppID : baseUrl + '/api/public/v2.0'), _v2)), _defineProperty(_stitchClient$rootURL, v3, (_v3 = {}, _defineProperty(_v3, API_TYPE_PUBLIC, baseUrl + '/api/public/v3.0'), _defineProperty(_v3, API_TYPE_CLIENT, baseUrl + '/api/client/v3.0'), _defineProperty(_v3, API_TYPE_APP, clientAppID ? baseUrl + '/api/client/v3.0/app/' + clientAppID : baseUrl + '/api/admin/v3.0'), _v3)), _stitchClient$rootURL); + + var authOptions = { + codec: _common.APP_CLIENT_CODEC, + storage: options.storage + }; + + if (options.storageType) { + authOptions.storageType = options.storageType; + } + if (options.platform) { + authOptions.platform = options.platform; + } + if (options.authCodec) { + authOptions.codec = options.authCodec; + } - this.authManager.apiKeyAuth = (0, _util.deprecate)(this.authManager.apiKeyAuth, 'use `client.authenticate("apiKey", "key")` instead of `client.authManager.apiKey`'); - this.authManager.localAuth = (0, _util.deprecate)(this.authManager.localAuth, 'use `client.login` instead of `client.authManager.localAuth`'); - this.authManager.mongodbCloudAuth = (0, _util.deprecate)(this.authManager.mongodbCloudAuth, 'use `client.authenticate("mongodbCloud", opts)` instead of `client.authManager.mongodbCloudAuth`'); + var authPromise = _auth.AuthFactory.create(stitchClient, stitchClient.authUrl, authOptions); + return authPromise.then(function (auth) { + stitchClient.auth = auth; + return Promise.all([stitchClient.auth.handleRedirect(), stitchClient.auth.handleCookie()]); + }).then(function () { + return stitchClient; + }); +} +/** + * Prototype for StitchClient class. + * This is the internal implementation for StitchClient and should not + * be exposed. + * + * @class + */ + +var StitchClient = exports.StitchClient = function () { + function StitchClient() { + _classCallCheck(this, StitchClient); + + throw new _errors.StitchError('StitchClient can only be made from the StitchClientFactory.create function'); } _createClass(StitchClient, [{ @@ -123,7 +148,7 @@ var StitchClient = function () { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; if (email === undefined || password === undefined) { - return this.authenticate('anon', options); + return this.authenticate(_providers.PROVIDER_TYPE_ANON, options); } return this.authenticate('userpass', Object.assign({ username: email, password: password }, options)); @@ -163,18 +188,29 @@ var StitchClient = function () { }, { key: 'authenticate', value: function authenticate(providerType) { - var _this2 = this; + var _this = this; var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; // reuse existing auth if present - if (this.auth.getAccessToken()) { - return Promise.resolve(this.auth.authedId()); + var authenticateFn = function authenticateFn() { + return _this.auth.provider(providerType).authenticate(options).then(function () { + return _this.authedId(); + }); + }; + + if (this.isAuthenticated()) { + if (providerType === _providers.PROVIDER_TYPE_ANON && this.auth.getLoggedInProviderType() === _providers.PROVIDER_TYPE_ANON) { + return Promise.resolve(this.auth.authedId); // is authenticated, skip log in + } + + return this.logout().then(function () { + return authenticateFn(); + }); // will not be authenticated, continue log in } - return this.auth.provider(providerType).authenticate(options).then(function () { - return _this2.auth.authedId(); - }); + // is not authenticated, continue log in + return authenticateFn(); } /** @@ -186,14 +222,16 @@ var StitchClient = function () { }, { key: 'logout', value: function logout() { - var _this3 = this; + var _this2 = this; return this._do('/auth/session', 'DELETE', { refreshOnFailure: false, useRefreshToken: true, rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT] }).then(function () { - return _this3.auth.clear(); + return _this2.auth.clear(); + }, function () { + return _this2.auth.clear(); }); } @@ -220,14 +258,25 @@ var StitchClient = function () { return response.json(); }); } + /** - * @return {String} Returns the currently authed user's ID. + * @return {Boolean} whether or not the current client is authenticated + */ + + }, { + key: 'isAuthenticated', + value: function isAuthenticated() { + return !!this.authedId(); + } + + /** + * @return {String} Returns a string of the currently authed user's ID. */ }, { key: 'authedId', value: function authedId() { - return this.auth.authedId(); + return this.auth.authedId; } /** @@ -329,52 +378,111 @@ var StitchClient = function () { return response.json(); }); } + + /** + * Returns an array of api keys + * + * @returns {Promise} + */ + }, { - key: '_do', - value: function _do(resource, method, options) { - var _this4 = this; + key: 'getApiKeys', + value: function getApiKeys() { + return this._do('/auth/api_keys', 'GET', { + rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT], + useRefreshToken: true + }).then(function (response) { + return response.json(); + }); + } - options = Object.assign({}, { - refreshOnFailure: true, - useRefreshToken: false, - apiVersion: v2, - apiType: API_TYPE_APP, - rootURL: undefined - }, options); + /** + * Creates a user api key + * + * @param {String} userApiKeyName the user defined name of the userApiKey + * @returns {Promise} + */ - if (!options.noAuth) { - if (!this.authedId()) { - return Promise.reject(new _errors.StitchError('Must auth first', _errors.ErrUnauthorized)); - } + }, { + key: 'createApiKey', + value: function createApiKey(userApiKeyName) { + return this._do('/auth/api_keys', 'POST', { rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT], + useRefreshToken: true, + body: JSON.stringify({ 'name': userApiKeyName }) + }).then(function (response) { + return response.json(); + }); + } - // If access token is expired, proactively get a new one - if (!options.useRefreshToken && this.auth.isAccessTokenExpired()) { - return this.auth.refreshToken().then(function () { - options.refreshOnFailure = false; - return _this4._do(resource, method, options); - }); - } - } + /** + * Returns a user api key + * + * @param {String} keyID the ID of the key + * @returns {Promise} + */ - var appURL = this.rootURLsByAPIVersion[options.apiVersion][options.apiType]; - var url = '' + appURL + resource; - if (options.rootURL) { - url = '' + options.rootURL + resource; - } - var fetchArgs = common.makeFetchArgs(method, options.body); + }, { + key: 'getApiKeyByID', + value: function getApiKeyByID(keyID) { + return this._do('/auth/api_keys/' + keyID, 'GET', { + rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT], + useRefreshToken: true + }).then(function (response) { + return response.json(); + }); + } - if (!!options.headers) { - Object.assign(fetchArgs.headers, options.headers); - } + /** + * Deletes a user api key + * + * @param {String} keyID the ID of the key + * @returns {Promise} + */ - if (!options.noAuth) { - var token = options.useRefreshToken ? this.auth.getRefreshToken() : this.auth.getAccessToken(); - fetchArgs.headers.Authorization = 'Bearer ' + token; - } + }, { + key: 'deleteApiKeyByID', + value: function deleteApiKeyByID(keyID) { + return this._do('/auth/api_keys/' + keyID, 'DELETE', { + rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT], + useRefreshToken: true + }); + } - if (options.queryParams) { - url = url + '?' + _queryString2.default.stringify(options.queryParams); - } + /** + * Enable a user api key + * + * @param {String} keyID the ID of the key + * @returns {Promise} + */ + + }, { + key: 'enableApiKeyByID', + value: function enableApiKeyByID(keyID) { + return this._do('/auth/api_keys/' + keyID + '/enable', 'PUT', { + rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT], + useRefreshToken: true + }); + } + + /** + * Disable a user api key + * + * @param {String} keyID the ID of the key + * @returns {Promise} + */ + + }, { + key: 'disableApiKeyByID', + value: function disableApiKeyByID(keyID) { + return this._do('/auth/api_keys/' + keyID + '/disable', 'PUT', { + rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT], + useRefreshToken: true + }); + } + }, { + key: '_fetch', + value: function _fetch(url, fetchArgs, resource, method, options) { + var _this3 = this; return fetch(url, fetchArgs).then(function (response) { // Okay: passthrough @@ -387,16 +495,17 @@ var StitchClient = function () { // Only want to try refreshing token when there's an invalid session if ('error_code' in json && json.error_code === _errors.ErrInvalidSession) { if (!options.refreshOnFailure) { - _this4.auth.clear(); - var _error = new _errors.StitchError(json.error, json.error_code); - _error.response = response; - _error.json = json; - throw _error; + return _this3.auth.clear().then(function () { + var error = new _errors.StitchError(json.error, json.error_code); + error.response = response; + error.json = json; + throw error; + }); } - return _this4.auth.refreshToken().then(function () { + return _this3.auth.refreshToken().then(function () { options.refreshOnFailure = false; - return _this4._do(resource, method, options); + return _this3._do(resource, method, options); }); } @@ -412,18 +521,67 @@ var StitchClient = function () { return Promise.reject(error); }); } + }, { + key: '_fetchArgs', + value: function _fetchArgs(resource, method, options) { + var appURL = this.rootURLsByAPIVersion[options.apiVersion][options.apiType]; + var url = '' + appURL + resource; + if (options.rootURL) { + url = '' + options.rootURL + resource; + } + var fetchArgs = common.makeFetchArgs(method, options.body); - // Deprecated API + if (!!options.headers) { + Object.assign(fetchArgs.headers, options.headers); + } - }, { - key: 'authWithOAuth', - value: function authWithOAuth(providerType, redirectUrl) { - return this.auth.provider(providerType).authenticate({ redirectUrl: redirectUrl }); + if (options.queryParams) { + url = url + '?' + _queryString2.default.stringify(options.queryParams); + } + + return { url: url, fetchArgs: fetchArgs }; } }, { - key: 'anonymousAuth', - value: function anonymousAuth() { - return this.authenticate('anon'); + key: '_do', + value: function _do(resource, method, options) { + var _this4 = this; + + options = Object.assign({}, { + refreshOnFailure: true, + useRefreshToken: false, + apiVersion: v2, + apiType: API_TYPE_APP, + rootURL: undefined + }, options); + + var _fetchArgs2 = this._fetchArgs(resource, method, options), + url = _fetchArgs2.url, + fetchArgs = _fetchArgs2.fetchArgs; + + if (options.noAuth) { + return this._fetch(url, fetchArgs, resource, method, options); + } + + if (!this.isAuthenticated()) { + return Promise.reject(new _errors.StitchError('Must auth first', _errors.ErrUnauthorized)); + } + var token = options.useRefreshToken ? this.auth.getRefreshToken() : this.auth.getAccessToken(); + + // If access token is expired, proactively get a new one + if (!options.useRefreshToken) { + if (this.auth.isAccessTokenExpired()) { + return this.auth.refreshToken().then(function () { + options.refreshOnFailure = false; + return _this4._do(resource, method, options); + }); + } + + fetchArgs.headers.Authorization = 'Bearer ' + token; + return this._fetch(url, fetchArgs, resource, method, options); + } + + fetchArgs.headers.Authorization = 'Bearer ' + token; + return this._fetch(url, fetchArgs, resource, method, options); } }, { key: 'type', @@ -433,11 +591,4 @@ var StitchClient = function () { }]); return StitchClient; -}(); - -exports.default = StitchClient; - - -StitchClient.prototype.authWithOAuth = (0, _util.deprecate)(StitchClient.prototype.authWithOAuth, 'use `authenticate` instead of `authWithOAuth`'); -StitchClient.prototype.anonymousAuth = (0, _util.deprecate)(StitchClient.prototype.anonymousAuth, 'use `login()` instead of `anonymousAuth`'); -module.exports = exports['default']; \ No newline at end of file +}(); \ No newline at end of file diff --git a/dist/node/common.js b/dist/node/common.js index 3bb9fe1d3..2de261872 100644 --- a/dist/node/common.js +++ b/dist/node/common.js @@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeFetchArgs = exports.checkStatus = exports.SDK_VERSION = exports.DEFAULT_STITCH_SERVER_URL = exports.ADMIN_CLIENT_TYPE = exports.APP_CLIENT_TYPE = exports.JSONTYPE = undefined; + +var _errors = require('./errors'); + var JSONTYPE = exports.JSONTYPE = 'application/json'; var APP_CLIENT_TYPE = exports.APP_CLIENT_TYPE = 'app'; var ADMIN_CLIENT_TYPE = exports.ADMIN_CLIENT_TYPE = 'admin'; @@ -10,8 +14,8 @@ var DEFAULT_STITCH_SERVER_URL = exports.DEFAULT_STITCH_SERVER_URL = 'https://sti // VERSION is substituted with the package.json version number at build time var version = 'unknown'; -if (typeof "2.3.1" !== 'undefined') { - version = "2.3.1"; +if (typeof "3.0.0" !== 'undefined') { + version = "3.0.0"; } var SDK_VERSION = exports.SDK_VERSION = version; @@ -20,18 +24,18 @@ var checkStatus = exports.checkStatus = function checkStatus(response) { return response; } + if (response.headers.get('Content-Type') === JSONTYPE) { + return response.json().then(function (json) { + var error = new _errors.StitchError(json.error, json.error_code); + error.response = response; + error.json = json; + return Promise.reject(error); + }); + } + var error = new Error(response.statusText); error.response = response; - - // set error to statusText by default; this will be overwritten when (and if) - // the response is successfully parsed into json below - error.error = response.statusText; - - return response.json().catch(function () { - return Promise.reject(error); - }).then(function (json) { - return Promise.reject(Object.assign(error, json)); - }); + return Promise.reject(error); }; var makeFetchArgs = exports.makeFetchArgs = function makeFetchArgs(method, body) { diff --git a/dist/node/index.js b/dist/node/index.js index d885e01ab..fe29fecb9 100644 --- a/dist/node/index.js +++ b/dist/node/index.js @@ -3,17 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.Admin = exports.StitchClient = undefined; +exports.BSON = exports.StitchAdminClientFactory = exports.StitchClientFactory = undefined; var _client = require('./client'); -var _client2 = _interopRequireDefault(_client); - var _admin = require('./admin'); -var _admin2 = _interopRequireDefault(_admin); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _mongodbExtjson = require('mongodb-extjson'); -exports.StitchClient = _client2.default; -exports.Admin = _admin2.default; \ No newline at end of file +exports.StitchClientFactory = _client.StitchClientFactory; +exports.StitchAdminClientFactory = _admin.StitchAdminClientFactory; +exports.BSON = _mongodbExtjson.BSON; \ No newline at end of file diff --git a/dist/node/services/mongodb/collection.js b/dist/node/services/mongodb/collection.js index d5ea63925..496957fa5 100644 --- a/dist/node/services/mongodb/collection.js +++ b/dist/node/services/mongodb/collection.js @@ -135,6 +135,21 @@ var Collection = function () { return new MongoQuery(this, query, project); } + /** + * Finds one document. + * + * @method + * @param {Object} query The query used to match documents. + * @param {Object} [project] The query document projection. + * @return {Promise} Returns a Promise for the operation + */ + + }, { + key: 'findOne', + value: function findOne(query, project) { + return buildResponse('findOne', this, buildArgs(this, { query: query, project: project })); + } + /** * Executes an aggregation pipeline. * diff --git a/dist/node/util.js b/dist/node/util.js index 3561f9245..d0d3942a7 100644 --- a/dist/node/util.js +++ b/dist/node/util.js @@ -3,14 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.uriEncodeObject = exports.getPlatform = exports.serviceResponse = exports.deprecate = exports.collectMetadata = undefined; +exports.uriEncodeObject = exports.serviceResponse = exports.deprecate = exports.collectMetadata = undefined; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; -var _detectBrowser = require('detect-browser'); - -var platform = _interopRequireWildcard(_detectBrowser); - var _Base = require('Base64'); var base64 = _interopRequireWildcard(_Base); @@ -102,16 +98,6 @@ function serviceResponse(service, _ref) { return client.executeServiceFunction(serviceName, action, args); } -/** - * Utility function to get the platform. - * - * @memberof util - * @returns {Object} An object of the form {name: ..., version: ...}, or null - */ -function getPlatform() { - return platform ? platform : null; -} - /** * Utility function to encode a JSON object into a valid string that can be * inserted in a URI. The object is first stringified, then encoded in base64, @@ -127,5 +113,4 @@ function uriEncodeObject(obj) { exports.deprecate = deprecate; exports.serviceResponse = serviceResponse; -exports.getPlatform = getPlatform; exports.uriEncodeObject = uriEncodeObject; \ No newline at end of file diff --git a/dist/web/stitch.js b/dist/web/stitch.js index d09a85cd7..0723ff844 100644 --- a/dist/web/stitch.js +++ b/dist/web/stitch.js @@ -73,7 +73,7 @@ return /******/ (function(modules) { // webpackBootstrap /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 33); +/******/ return __webpack_require__(__webpack_require__.s = 34); /******/ }) /************************************************************************/ /******/ ([ @@ -2015,15 +2015,11 @@ exports.writeIEEE754 = writeIEEE754; Object.defineProperty(exports, "__esModule", { value: true }); -exports.uriEncodeObject = exports.getPlatform = exports.serviceResponse = exports.deprecate = exports.collectMetadata = undefined; +exports.uriEncodeObject = exports.serviceResponse = exports.deprecate = exports.collectMetadata = undefined; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; -var _detectBrowser = __webpack_require__(59); - -var platform = _interopRequireWildcard(_detectBrowser); - -var _Base = __webpack_require__(25); +var _Base = __webpack_require__(27); var base64 = _interopRequireWildcard(_Base); @@ -2114,16 +2110,6 @@ function serviceResponse(service, _ref) { return client.executeServiceFunction(serviceName, action, args); } -/** - * Utility function to get the platform. - * - * @memberof util - * @returns {Object} An object of the form {name: ..., version: ...}, or null - */ -function getPlatform() { - return platform ? platform : null; -} - /** * Utility function to encode a JSON object into a valid string that can be * inserted in a URI. The object is first stringified, then encoded in base64, @@ -2139,7 +2125,6 @@ function uriEncodeObject(obj) { exports.deprecate = deprecate; exports.serviceResponse = serviceResponse; -exports.getPlatform = getPlatform; exports.uriEncodeObject = uriEncodeObject; /***/ }), @@ -3001,6 +2986,42 @@ module.exports.Long = Long; /* 4 */ /***/ (function(module, exports, __webpack_require__) { +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +var USER_AUTH_KEY = exports.USER_AUTH_KEY = '_stitch_ua'; +var REFRESH_TOKEN_KEY = exports.REFRESH_TOKEN_KEY = '_stitch_rt'; +var DEVICE_ID_KEY = exports.DEVICE_ID_KEY = '_stitch_did'; +var STATE_KEY = exports.STATE_KEY = '_stitch_state'; +var USER_AUTH_COOKIE_NAME = exports.USER_AUTH_COOKIE_NAME = 'stitch_ua'; +var STITCH_ERROR_KEY = exports.STITCH_ERROR_KEY = '_stitch_error'; +var STITCH_LINK_KEY = exports.STITCH_LINK_KEY = '_stitch_link'; +var USER_LOGGED_IN_PT_KEY = exports.USER_LOGGED_IN_PT_KEY = '_stitch_pt'; +var STITCH_REDIRECT_PROVIDER = exports.STITCH_REDIRECT_PROVIDER = '_stitch_rp'; + +var DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS = exports.DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS = 10; + +var APP_CLIENT_CODEC = exports.APP_CLIENT_CODEC = { + 'accessToken': 'access_token', + 'refreshToken': 'refresh_token', + 'deviceId': 'device_id', + 'userId': 'user_id' +}; + +var ADMIN_CLIENT_CODEC = exports.ADMIN_CLIENT_CODEC = { + 'accessToken': 'access_token', + 'refreshToken': 'refresh_token', + 'deviceId': 'device_id', + 'userId': 'user_id' +}; + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { + "use strict"; /* WEBPACK VAR INJECTION */(function(global) { @@ -3350,7 +3371,7 @@ module.exports.Binary = Binary; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(17))) /***/ }), -/* 5 */ +/* 6 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3382,7 +3403,7 @@ module.exports = Code; module.exports.Code = Code; /***/ }), -/* 6 */ +/* 7 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3422,7 +3443,7 @@ module.exports = DBRef; module.exports.DBRef = DBRef; /***/ }), -/* 7 */ +/* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4149,7 +4170,7 @@ module.exports.Decimal128 = Decimal128; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }), -/* 8 */ +/* 9 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4190,7 +4211,7 @@ module.exports = Double; module.exports.Double = Double; /***/ }), -/* 9 */ +/* 10 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4212,7 +4233,7 @@ module.exports = MaxKey; module.exports.MaxKey = MaxKey; /***/ }), -/* 10 */ +/* 11 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4234,7 +4255,7 @@ module.exports = MinKey; module.exports.MinKey = MinKey; /***/ }), -/* 11 */ +/* 12 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4603,10 +4624,10 @@ Object.defineProperty(ObjectID.prototype, "generationTime", { module.exports = ObjectID; module.exports.ObjectID = ObjectID; module.exports.ObjectId = ObjectID; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer, __webpack_require__(23))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer, __webpack_require__(25))) /***/ }), -/* 12 */ +/* 13 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4638,7 +4659,7 @@ module.exports = BSONRegExp; module.exports.BSONRegExp = BSONRegExp; /***/ }), -/* 13 */ +/* 14 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4693,7 +4714,7 @@ module.exports = _Symbol; module.exports.Symbol = _Symbol; /***/ }), -/* 14 */ +/* 15 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5548,7 +5569,7 @@ module.exports = Timestamp; module.exports.Timestamp = Timestamp; /***/ }), -/* 15 */ +/* 16 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5557,42 +5578,10 @@ module.exports.Timestamp = Timestamp; Object.defineProperty(exports, "__esModule", { value: true }); -var USER_AUTH_KEY = exports.USER_AUTH_KEY = '_stitch_ua'; -var REFRESH_TOKEN_KEY = exports.REFRESH_TOKEN_KEY = '_stitch_rt'; -var DEVICE_ID_KEY = exports.DEVICE_ID_KEY = '_stitch_did'; -var STATE_KEY = exports.STATE_KEY = '_stitch_state'; -var IMPERSONATION_ACTIVE_KEY = exports.IMPERSONATION_ACTIVE_KEY = '_stitch_impers_active'; -var IMPERSONATION_USER_KEY = exports.IMPERSONATION_USER_KEY = '_stitch_impers_user'; -var IMPERSONATION_REAL_USER_AUTH_KEY = exports.IMPERSONATION_REAL_USER_AUTH_KEY = '_stitch_impers_real_ua'; -var USER_AUTH_COOKIE_NAME = exports.USER_AUTH_COOKIE_NAME = 'stitch_ua'; -var STITCH_ERROR_KEY = exports.STITCH_ERROR_KEY = '_stitch_error'; -var STITCH_LINK_KEY = exports.STITCH_LINK_KEY = '_stitch_link'; -var DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS = exports.DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS = 10; - -var APP_CLIENT_CODEC = exports.APP_CLIENT_CODEC = { - 'accessToken': 'access_token', - 'refreshToken': 'refresh_token', - 'deviceId': 'device_id', - 'userId': 'user_id' -}; +exports.makeFetchArgs = exports.checkStatus = exports.SDK_VERSION = exports.DEFAULT_STITCH_SERVER_URL = exports.ADMIN_CLIENT_TYPE = exports.APP_CLIENT_TYPE = exports.JSONTYPE = undefined; -var ADMIN_CLIENT_CODEC = exports.ADMIN_CLIENT_CODEC = { - 'accessToken': 'access_token', - 'refreshToken': 'refresh_token', - 'deviceId': 'device_id', - 'userId': 'user_id' -}; - -/***/ }), -/* 16 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +var _errors = __webpack_require__(19); - -Object.defineProperty(exports, "__esModule", { - value: true -}); var JSONTYPE = exports.JSONTYPE = 'application/json'; var APP_CLIENT_TYPE = exports.APP_CLIENT_TYPE = 'app'; var ADMIN_CLIENT_TYPE = exports.ADMIN_CLIENT_TYPE = 'admin'; @@ -5601,7 +5590,7 @@ var DEFAULT_STITCH_SERVER_URL = exports.DEFAULT_STITCH_SERVER_URL = 'https://sti // VERSION is substituted with the package.json version number at build time var version = 'unknown'; if (true) { - version = "2.3.1"; + version = "3.0.0"; } var SDK_VERSION = exports.SDK_VERSION = version; @@ -5610,18 +5599,18 @@ var checkStatus = exports.checkStatus = function checkStatus(response) { return response; } + if (response.headers.get('Content-Type') === JSONTYPE) { + return response.json().then(function (json) { + var error = new _errors.StitchError(json.error, json.error_code); + error.response = response; + error.json = json; + return Promise.reject(error); + }); + } + var error = new Error(response.statusText); error.response = response; - - // set error to statusText by default; this will be overwritten when (and if) - // the response is successfully parsed into json below - error.error = response.statusText; - - return response.json().catch(function () { - return Promise.reject(error); - }).then(function (json) { - return Promise.reject(Object.assign(error, json)); - }); + return Promise.reject(error); }; var makeFetchArgs = exports.makeFetchArgs = function makeFetchArgs(method, body) { @@ -5710,19 +5699,107 @@ Object.defineProperty(exports, "__esModule", { value: true }); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +function _extendableBuiltin(cls) { + function ExtendableBuiltin() { + var instance = Reflect.construct(cls, Array.from(arguments)); + Object.setPrototypeOf(instance, Object.getPrototypeOf(this)); + return instance; + } + + ExtendableBuiltin.prototype = Object.create(cls.prototype, { + constructor: { + value: cls, + enumerable: false, + writable: true, + configurable: true + } + }); + + if (Object.setPrototypeOf) { + Object.setPrototypeOf(ExtendableBuiltin, cls); + } else { + ExtendableBuiltin.__proto__ = cls; + } + + return ExtendableBuiltin; +} + +/** + * Creates a new StitchError + * + * @class + * @augments Error + * @param {String} message The error message. + * @param {Object} code The error code. + * @return {StitchError} A StitchError instance. + */ +var StitchError = function (_extendableBuiltin2) { + _inherits(StitchError, _extendableBuiltin2); + + function StitchError(message, code) { + _classCallCheck(this, StitchError); + + var _this = _possibleConstructorReturn(this, (StitchError.__proto__ || Object.getPrototypeOf(StitchError)).call(this, message)); + + _this.name = 'StitchError'; + _this.message = message; + if (code !== undefined) { + _this.code = code; + } + + if (typeof Error.captureStackTrace === 'function') { + Error.captureStackTrace(_this, _this.constructor); + } else { + _this.stack = new Error(message).stack; + } + return _this; + } + + return StitchError; +}(_extendableBuiltin(Error)); + +var ErrAuthProviderNotFound = 'AuthProviderNotFound'; +var ErrInvalidSession = 'InvalidSession'; +var ErrUnauthorized = 'Unauthorized'; + +exports.StitchError = StitchError; +exports.ErrAuthProviderNotFound = ErrAuthProviderNotFound; +exports.ErrInvalidSession = ErrInvalidSession; +exports.ErrUnauthorized = ErrUnauthorized; + +/***/ }), +/* 20 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.StitchClient = exports.StitchClientFactory = undefined; + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* global window, fetch */ /* eslint no-labels: ['error', { 'allowLoop': true }] */ -__webpack_require__(22); +exports.newStitchClient = newStitchClient; + +__webpack_require__(24); -var _auth = __webpack_require__(30); +var _auth = __webpack_require__(32); -var _auth2 = _interopRequireDefault(_auth); +var _providers = __webpack_require__(23); -var _common = __webpack_require__(15); +var _common = __webpack_require__(4); -var _services = __webpack_require__(37); +var _services = __webpack_require__(38); var _services2 = _interopRequireDefault(_services); @@ -5730,7 +5807,7 @@ var _common2 = __webpack_require__(16); var common = _interopRequireWildcard(_common2); -var _mongodbExtjson = __webpack_require__(42); +var _mongodbExtjson = __webpack_require__(21); var _mongodbExtjson2 = _interopRequireDefault(_mongodbExtjson); @@ -5738,9 +5815,7 @@ var _queryString = __webpack_require__(69); var _queryString2 = _interopRequireDefault(_queryString); -var _util = __webpack_require__(2); - -var _errors = __webpack_require__(21); +var _errors = __webpack_require__(19); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } @@ -5759,57 +5834,81 @@ var API_TYPE_CLIENT = 'client'; var API_TYPE_APP = 'app'; /** - * Create a new StitchClient instance. - * - * @class - * @return {StitchClient} a StitchClient instance. - */ + * Factory class to create a new StitchClient asynchronously. + */ -var StitchClient = function () { - function StitchClient(clientAppID, options) { - var _v, - _v2, - _v3, - _rootURLsByAPIVersion, - _this = this; +var StitchClientFactory = exports.StitchClientFactory = function () { + function StitchClientFactory() { + _classCallCheck(this, StitchClientFactory); - _classCallCheck(this, StitchClient); + throw new _errors.StitchError('StitchClient can only be made from the StitchClientFactory.create function'); + } - var baseUrl = common.DEFAULT_STITCH_SERVER_URL; - if (options && options.baseUrl) { - baseUrl = options.baseUrl; + _createClass(StitchClientFactory, null, [{ + key: 'create', + value: function create(clientAppID) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + return newStitchClient(StitchClient.prototype, clientAppID, options); } + }]); + + return StitchClientFactory; +}(); - this.clientAppID = clientAppID; +function newStitchClient(prototype, clientAppID) { + var _v, _v2, _v3, _stitchClient$rootURL; - this.authUrl = clientAppID ? baseUrl + '/api/client/v2.0/app/' + clientAppID + '/auth' : baseUrl + '/api/admin/v3.0/auth'; + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - this.rootURLsByAPIVersion = (_rootURLsByAPIVersion = {}, _defineProperty(_rootURLsByAPIVersion, v1, (_v = {}, _defineProperty(_v, API_TYPE_PUBLIC, baseUrl + '/api/public/v1.0'), _defineProperty(_v, API_TYPE_CLIENT, baseUrl + '/api/client/v1.0'), _defineProperty(_v, API_TYPE_PRIVATE, baseUrl + '/api/private/v1.0'), _defineProperty(_v, API_TYPE_APP, clientAppID ? baseUrl + '/api/client/v1.0/app/' + clientAppID : baseUrl + '/api/public/v1.0'), _v)), _defineProperty(_rootURLsByAPIVersion, v2, (_v2 = {}, _defineProperty(_v2, API_TYPE_PUBLIC, baseUrl + '/api/public/v2.0'), _defineProperty(_v2, API_TYPE_CLIENT, baseUrl + '/api/client/v2.0'), _defineProperty(_v2, API_TYPE_PRIVATE, baseUrl + '/api/private/v2.0'), _defineProperty(_v2, API_TYPE_APP, clientAppID ? baseUrl + '/api/client/v2.0/app/' + clientAppID : baseUrl + '/api/public/v2.0'), _v2)), _defineProperty(_rootURLsByAPIVersion, v3, (_v3 = {}, _defineProperty(_v3, API_TYPE_PUBLIC, baseUrl + '/api/public/v3.0'), _defineProperty(_v3, API_TYPE_CLIENT, baseUrl + '/api/client/v3.0'), _defineProperty(_v3, API_TYPE_APP, clientAppID ? baseUrl + '/api/client/v3.0/app/' + clientAppID : baseUrl + '/api/admin/v3.0'), _v3)), _rootURLsByAPIVersion); + var stitchClient = Object.create(prototype); + var baseUrl = common.DEFAULT_STITCH_SERVER_URL; + if (options.baseUrl) { + baseUrl = options.baseUrl; + } - var authOptions = { codec: _common.APP_CLIENT_CODEC }; - if (options && options.authCodec) { - authOptions.codec = options.authCodec; - } - this.auth = new _auth2.default(this, this.authUrl, authOptions); - this.auth.handleRedirect(); - this.auth.handleCookie(); + stitchClient.clientAppID = clientAppID; - // deprecated API - this.authManager = { - apiKeyAuth: function apiKeyAuth(key) { - return _this.authenticate('apiKey', key); - }, - localAuth: function localAuth(email, password) { - return _this.login(email, password); - }, - mongodbCloudAuth: function mongodbCloudAuth(username, apiKey, opts) { - return _this.authenticate('mongodbCloud', Object.assign({ username: username, apiKey: apiKey }, opts)); - } - }; + stitchClient.authUrl = clientAppID ? baseUrl + '/api/client/v2.0/app/' + clientAppID + '/auth' : baseUrl + '/api/admin/v3.0/auth'; + + stitchClient.rootURLsByAPIVersion = (_stitchClient$rootURL = {}, _defineProperty(_stitchClient$rootURL, v1, (_v = {}, _defineProperty(_v, API_TYPE_PUBLIC, baseUrl + '/api/public/v1.0'), _defineProperty(_v, API_TYPE_CLIENT, baseUrl + '/api/client/v1.0'), _defineProperty(_v, API_TYPE_PRIVATE, baseUrl + '/api/private/v1.0'), _defineProperty(_v, API_TYPE_APP, clientAppID ? baseUrl + '/api/client/v1.0/app/' + clientAppID : baseUrl + '/api/public/v1.0'), _v)), _defineProperty(_stitchClient$rootURL, v2, (_v2 = {}, _defineProperty(_v2, API_TYPE_PUBLIC, baseUrl + '/api/public/v2.0'), _defineProperty(_v2, API_TYPE_CLIENT, baseUrl + '/api/client/v2.0'), _defineProperty(_v2, API_TYPE_PRIVATE, baseUrl + '/api/private/v2.0'), _defineProperty(_v2, API_TYPE_APP, clientAppID ? baseUrl + '/api/client/v2.0/app/' + clientAppID : baseUrl + '/api/public/v2.0'), _v2)), _defineProperty(_stitchClient$rootURL, v3, (_v3 = {}, _defineProperty(_v3, API_TYPE_PUBLIC, baseUrl + '/api/public/v3.0'), _defineProperty(_v3, API_TYPE_CLIENT, baseUrl + '/api/client/v3.0'), _defineProperty(_v3, API_TYPE_APP, clientAppID ? baseUrl + '/api/client/v3.0/app/' + clientAppID : baseUrl + '/api/admin/v3.0'), _v3)), _stitchClient$rootURL); + + var authOptions = { + codec: _common.APP_CLIENT_CODEC, + storage: options.storage + }; + + if (options.storageType) { + authOptions.storageType = options.storageType; + } + if (options.platform) { + authOptions.platform = options.platform; + } + if (options.authCodec) { + authOptions.codec = options.authCodec; + } + + var authPromise = _auth.AuthFactory.create(stitchClient, stitchClient.authUrl, authOptions); + return authPromise.then(function (auth) { + stitchClient.auth = auth; + return Promise.all([stitchClient.auth.handleRedirect(), stitchClient.auth.handleCookie()]); + }).then(function () { + return stitchClient; + }); +} +/** + * Prototype for StitchClient class. + * This is the internal implementation for StitchClient and should not + * be exposed. + * + * @class + */ - this.authManager.apiKeyAuth = (0, _util.deprecate)(this.authManager.apiKeyAuth, 'use `client.authenticate("apiKey", "key")` instead of `client.authManager.apiKey`'); - this.authManager.localAuth = (0, _util.deprecate)(this.authManager.localAuth, 'use `client.login` instead of `client.authManager.localAuth`'); - this.authManager.mongodbCloudAuth = (0, _util.deprecate)(this.authManager.mongodbCloudAuth, 'use `client.authenticate("mongodbCloud", opts)` instead of `client.authManager.mongodbCloudAuth`'); +var StitchClient = exports.StitchClient = function () { + function StitchClient() { + _classCallCheck(this, StitchClient); + + throw new _errors.StitchError('StitchClient can only be made from the StitchClientFactory.create function'); } _createClass(StitchClient, [{ @@ -5829,7 +5928,7 @@ var StitchClient = function () { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; if (email === undefined || password === undefined) { - return this.authenticate('anon', options); + return this.authenticate(_providers.PROVIDER_TYPE_ANON, options); } return this.authenticate('userpass', Object.assign({ username: email, password: password }, options)); @@ -5869,18 +5968,29 @@ var StitchClient = function () { }, { key: 'authenticate', value: function authenticate(providerType) { - var _this2 = this; + var _this = this; var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; // reuse existing auth if present - if (this.auth.getAccessToken()) { - return Promise.resolve(this.auth.authedId()); + var authenticateFn = function authenticateFn() { + return _this.auth.provider(providerType).authenticate(options).then(function () { + return _this.authedId(); + }); + }; + + if (this.isAuthenticated()) { + if (providerType === _providers.PROVIDER_TYPE_ANON && this.auth.getLoggedInProviderType() === _providers.PROVIDER_TYPE_ANON) { + return Promise.resolve(this.auth.authedId); // is authenticated, skip log in + } + + return this.logout().then(function () { + return authenticateFn(); + }); // will not be authenticated, continue log in } - return this.auth.provider(providerType).authenticate(options).then(function () { - return _this2.auth.authedId(); - }); + // is not authenticated, continue log in + return authenticateFn(); } /** @@ -5892,14 +6002,16 @@ var StitchClient = function () { }, { key: 'logout', value: function logout() { - var _this3 = this; + var _this2 = this; return this._do('/auth/session', 'DELETE', { refreshOnFailure: false, useRefreshToken: true, rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT] }).then(function () { - return _this3.auth.clear(); + return _this2.auth.clear(); + }, function () { + return _this2.auth.clear(); }); } @@ -5926,14 +6038,25 @@ var StitchClient = function () { return response.json(); }); } + + /** + * @return {Boolean} whether or not the current client is authenticated + */ + + }, { + key: 'isAuthenticated', + value: function isAuthenticated() { + return !!this.authedId(); + } + /** - * @return {String} Returns the currently authed user's ID. + * @return {String} Returns a string of the currently authed user's ID. */ }, { key: 'authedId', value: function authedId() { - return this.auth.authedId(); + return this.auth.authedId; } /** @@ -6035,52 +6158,111 @@ var StitchClient = function () { return response.json(); }); } - }, { - key: '_do', - value: function _do(resource, method, options) { - var _this4 = this; - options = Object.assign({}, { - refreshOnFailure: true, - useRefreshToken: false, - apiVersion: v2, - apiType: API_TYPE_APP, - rootURL: undefined - }, options); + /** + * Returns an array of api keys + * + * @returns {Promise} + */ - if (!options.noAuth) { - if (!this.authedId()) { - return Promise.reject(new _errors.StitchError('Must auth first', _errors.ErrUnauthorized)); - } + }, { + key: 'getApiKeys', + value: function getApiKeys() { + return this._do('/auth/api_keys', 'GET', { + rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT], + useRefreshToken: true + }).then(function (response) { + return response.json(); + }); + } - // If access token is expired, proactively get a new one - if (!options.useRefreshToken && this.auth.isAccessTokenExpired()) { - return this.auth.refreshToken().then(function () { - options.refreshOnFailure = false; - return _this4._do(resource, method, options); - }); - } - } + /** + * Creates a user api key + * + * @param {String} userApiKeyName the user defined name of the userApiKey + * @returns {Promise} + */ - var appURL = this.rootURLsByAPIVersion[options.apiVersion][options.apiType]; - var url = '' + appURL + resource; - if (options.rootURL) { - url = '' + options.rootURL + resource; - } - var fetchArgs = common.makeFetchArgs(method, options.body); + }, { + key: 'createApiKey', + value: function createApiKey(userApiKeyName) { + return this._do('/auth/api_keys', 'POST', { rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT], + useRefreshToken: true, + body: JSON.stringify({ 'name': userApiKeyName }) + }).then(function (response) { + return response.json(); + }); + } - if (!!options.headers) { - Object.assign(fetchArgs.headers, options.headers); - } + /** + * Returns a user api key + * + * @param {String} keyID the ID of the key + * @returns {Promise} + */ - if (!options.noAuth) { - var token = options.useRefreshToken ? this.auth.getRefreshToken() : this.auth.getAccessToken(); - fetchArgs.headers.Authorization = 'Bearer ' + token; - } + }, { + key: 'getApiKeyByID', + value: function getApiKeyByID(keyID) { + return this._do('/auth/api_keys/' + keyID, 'GET', { + rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT], + useRefreshToken: true + }).then(function (response) { + return response.json(); + }); + } - if (options.queryParams) { - url = url + '?' + _queryString2.default.stringify(options.queryParams); - } + /** + * Deletes a user api key + * + * @param {String} keyID the ID of the key + * @returns {Promise} + */ + + }, { + key: 'deleteApiKeyByID', + value: function deleteApiKeyByID(keyID) { + return this._do('/auth/api_keys/' + keyID, 'DELETE', { + rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT], + useRefreshToken: true + }); + } + + /** + * Enable a user api key + * + * @param {String} keyID the ID of the key + * @returns {Promise} + */ + + }, { + key: 'enableApiKeyByID', + value: function enableApiKeyByID(keyID) { + return this._do('/auth/api_keys/' + keyID + '/enable', 'PUT', { + rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT], + useRefreshToken: true + }); + } + + /** + * Disable a user api key + * + * @param {String} keyID the ID of the key + * @returns {Promise} + */ + + }, { + key: 'disableApiKeyByID', + value: function disableApiKeyByID(keyID) { + return this._do('/auth/api_keys/' + keyID + '/disable', 'PUT', { + rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT], + useRefreshToken: true + }); + } + }, { + key: '_fetch', + value: function _fetch(url, fetchArgs, resource, method, options) { + var _this3 = this; return fetch(url, fetchArgs).then(function (response) { // Okay: passthrough @@ -6093,16 +6275,17 @@ var StitchClient = function () { // Only want to try refreshing token when there's an invalid session if ('error_code' in json && json.error_code === _errors.ErrInvalidSession) { if (!options.refreshOnFailure) { - _this4.auth.clear(); - var _error = new _errors.StitchError(json.error, json.error_code); - _error.response = response; - _error.json = json; - throw _error; + return _this3.auth.clear().then(function () { + var error = new _errors.StitchError(json.error, json.error_code); + error.response = response; + error.json = json; + throw error; + }); } - return _this4.auth.refreshToken().then(function () { + return _this3.auth.refreshToken().then(function () { options.refreshOnFailure = false; - return _this4._do(resource, method, options); + return _this3._do(resource, method, options); }); } @@ -6118,18 +6301,67 @@ var StitchClient = function () { return Promise.reject(error); }); } + }, { + key: '_fetchArgs', + value: function _fetchArgs(resource, method, options) { + var appURL = this.rootURLsByAPIVersion[options.apiVersion][options.apiType]; + var url = '' + appURL + resource; + if (options.rootURL) { + url = '' + options.rootURL + resource; + } + var fetchArgs = common.makeFetchArgs(method, options.body); + + if (!!options.headers) { + Object.assign(fetchArgs.headers, options.headers); + } - // Deprecated API + if (options.queryParams) { + url = url + '?' + _queryString2.default.stringify(options.queryParams); + } - }, { - key: 'authWithOAuth', - value: function authWithOAuth(providerType, redirectUrl) { - return this.auth.provider(providerType).authenticate({ redirectUrl: redirectUrl }); + return { url: url, fetchArgs: fetchArgs }; } }, { - key: 'anonymousAuth', - value: function anonymousAuth() { - return this.authenticate('anon'); + key: '_do', + value: function _do(resource, method, options) { + var _this4 = this; + + options = Object.assign({}, { + refreshOnFailure: true, + useRefreshToken: false, + apiVersion: v2, + apiType: API_TYPE_APP, + rootURL: undefined + }, options); + + var _fetchArgs2 = this._fetchArgs(resource, method, options), + url = _fetchArgs2.url, + fetchArgs = _fetchArgs2.fetchArgs; + + if (options.noAuth) { + return this._fetch(url, fetchArgs, resource, method, options); + } + + if (!this.isAuthenticated()) { + return Promise.reject(new _errors.StitchError('Must auth first', _errors.ErrUnauthorized)); + } + var token = options.useRefreshToken ? this.auth.getRefreshToken() : this.auth.getAccessToken(); + + // If access token is expired, proactively get a new one + if (!options.useRefreshToken) { + if (this.auth.isAccessTokenExpired()) { + return this.auth.refreshToken().then(function () { + options.refreshOnFailure = false; + return _this4._do(resource, method, options); + }); + } + + fetchArgs.headers.Authorization = 'Bearer ' + token; + return this._fetch(url, fetchArgs, resource, method, options); + } + + fetchArgs.headers.Authorization = 'Bearer ' + token; + return this._fetch(url, fetchArgs, resource, method, options); } }, { key: 'type', @@ -6141,15 +6373,19 @@ var StitchClient = function () { return StitchClient; }(); -exports.default = StitchClient; +/***/ }), +/* 21 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; -StitchClient.prototype.authWithOAuth = (0, _util.deprecate)(StitchClient.prototype.authWithOAuth, 'use `authenticate` instead of `authWithOAuth`'); -StitchClient.prototype.anonymousAuth = (0, _util.deprecate)(StitchClient.prototype.anonymousAuth, 'use `login()` instead of `anonymousAuth`'); -module.exports = exports['default']; +var ExtJSON = __webpack_require__(57); + +module.exports = ExtJSON; /***/ }), -/* 20 */ +/* 22 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6285,7 +6521,7 @@ if (typeof global.Map !== 'undefined') { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(17))) /***/ }), -/* 21 */ +/* 23 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6294,388 +6530,739 @@ if (typeof global.Map !== 'undefined') { Object.defineProperty(exports, "__esModule", { value: true }); +exports.createProviders = exports.PROVIDER_TYPE_MONGODB_CLOUD = exports.PROVIDER_TYPE_FACEBOOK = exports.PROVIDER_TYPE_GOOGLE = exports.PROVIDER_TYPE_APIKEY = exports.PROVIDER_TYPE_USERPASS = exports.PROVIDER_TYPE_CUSTOM = exports.PROVIDER_TYPE_ANON = undefined; -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +var _common = __webpack_require__(16); -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } +var common = _interopRequireWildcard(_common); -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } +var _common2 = __webpack_require__(4); -function _extendableBuiltin(cls) { - function ExtendableBuiltin() { - var instance = Reflect.construct(cls, Array.from(arguments)); - Object.setPrototypeOf(instance, Object.getPrototypeOf(this)); - return instance; - } +var authCommon = _interopRequireWildcard(_common2); - ExtendableBuiltin.prototype = Object.create(cls.prototype, { - constructor: { - value: cls, - enumerable: false, - writable: true, - configurable: true - } - }); +var _util = __webpack_require__(2); - if (Object.setPrototypeOf) { - Object.setPrototypeOf(ExtendableBuiltin, cls); - } else { - ExtendableBuiltin.__proto__ = cls; - } +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /** @module auth */ - return ExtendableBuiltin; -} + +var PROVIDER_TYPE_ANON = exports.PROVIDER_TYPE_ANON = 'anon'; +var PROVIDER_TYPE_CUSTOM = exports.PROVIDER_TYPE_CUSTOM = 'custom'; +var PROVIDER_TYPE_USERPASS = exports.PROVIDER_TYPE_USERPASS = 'userpass'; +var PROVIDER_TYPE_APIKEY = exports.PROVIDER_TYPE_APIKEY = 'apiKey'; +var PROVIDER_TYPE_GOOGLE = exports.PROVIDER_TYPE_GOOGLE = 'google'; +var PROVIDER_TYPE_FACEBOOK = exports.PROVIDER_TYPE_FACEBOOK = 'facebook'; +var PROVIDER_TYPE_MONGODB_CLOUD = exports.PROVIDER_TYPE_MONGODB_CLOUD = 'mongodbCloud'; /** - * Creates a new StitchError - * - * @class - * @augments Error - * @param {String} message The error message. - * @param {Object} code The error code. - * @return {StitchError} A StitchError instance. + * @namespace */ -var StitchError = function (_extendableBuiltin2) { - _inherits(StitchError, _extendableBuiltin2); +function anonProvider(auth) { + return { + /** + * Login to a stitch application using anonymous authentication + * + * @memberof anonProvider + * @instance + * @returns {Promise} a promise that resolves when authentication succeeds. + */ + authenticate: function authenticate() { + var deviceId = auth.getDeviceId(); + var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID); + var fetchArgs = common.makeFetchArgs('GET'); + fetchArgs.cors = true; - function StitchError(message, code) { - _classCallCheck(this, StitchError); + return fetch(auth.rootUrl + '/providers/anon-user/login?device=' + (0, _util.uriEncodeObject)(device), fetchArgs).then(common.checkStatus).then(function (response) { + return response.json(); + }).then(function (json) { + return auth.set(json, PROVIDER_TYPE_ANON); + }); + } + }; +} - var _this = _possibleConstructorReturn(this, (StitchError.__proto__ || Object.getPrototypeOf(StitchError)).call(this, message)); +/** + * @namespace + */ +function customProvider(auth) { + var providerRoute = 'providers/custom-token'; + var loginRoute = providerRoute + '/login'; - _this.name = 'StitchError'; - _this.message = message; - if (code !== undefined) { - _this.code = code; - } + return { + /** + * Login to a stitch application using custom authentication + * + * @memberof customProvider + * @instance + * @param {String} JWT token to use for authentication + * @returns {Promise} a promise that resolves when authentication succeeds. + */ + authenticate: function authenticate(token) { + var deviceId = auth.getDeviceId(); + var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID); - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(_this, _this.constructor); - } else { - _this.stack = new Error(message).stack; + var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ token: token, options: { device: device } })); + fetchArgs.cors = true; + + return fetch(auth.rootUrl + '/' + loginRoute, fetchArgs).then(common.checkStatus).then(function (response) { + return response.json(); + }).then(function (json) { + return auth.set(json, PROVIDER_TYPE_CUSTOM); + }); } - return _this; - } + }; +} - return StitchError; -}(_extendableBuiltin(Error)); +/** @namespace */ +function userPassProvider(auth) { + // The ternary expression here is redundant but is just preserving previous behavior based on whether or not + // the client is for the admin or client API. + var providerRoute = auth.isAppClient() ? 'providers/local-userpass' : 'providers/local-userpass'; + var loginRoute = auth.isAppClient() ? providerRoute + '/login' : providerRoute + '/login'; -var ErrAuthProviderNotFound = 'AuthProviderNotFound'; -var ErrInvalidSession = 'InvalidSession'; -var ErrUnauthorized = 'Unauthorized'; + return { + /** + * Login to a stitch application using username and password authentication + * + * @memberof userPassProvider + * @instance + * @param {String} username the username to use for authentication + * @param {String} password the password to use for authentication + * @returns {Promise} a promise that resolves when authentication succeeds. + */ + authenticate: function authenticate(_ref) { + var username = _ref.username, + password = _ref.password; -exports.StitchError = StitchError; -exports.ErrAuthProviderNotFound = ErrAuthProviderNotFound; -exports.ErrInvalidSession = ErrInvalidSession; -exports.ErrUnauthorized = ErrUnauthorized; + var deviceId = auth.getDeviceId(); + var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID); -/***/ }), -/* 22 */ -/***/ (function(module, exports, __webpack_require__) { - -// the whatwg-fetch polyfill installs the fetch() function -// on the global object (window or self) -// -// Return that as the export for use in Webpack, Browserify etc. -__webpack_require__(73); -var globalObj = typeof self !== 'undefined' && self || this; -module.exports = globalObj.fetch.bind(globalObj); + var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ username: username, password: password, options: { device: device } })); + fetchArgs.cors = true; + return fetch(auth.rootUrl + '/' + loginRoute, fetchArgs).then(common.checkStatus).then(function (response) { + return response.json(); + }).then(function (json) { + return auth.set(json, PROVIDER_TYPE_USERPASS); + }); + }, -/***/ }), -/* 23 */ -/***/ (function(module, exports) { + /** + * Completes the confirmation workflow from the stitch server + * @memberof userPassProvider + * @instance + * @param {String} tokenId the tokenId provided by the stitch server + * @param {String} token the token provided by the stitch server + * @returns {Promise} + */ + emailConfirm: function emailConfirm(tokenId, token) { + var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ tokenId: tokenId, token: token })); + fetchArgs.cors = true; -// shim for using process in browser -var process = module.exports = {}; + return fetch(auth.rootUrl + '/' + providerRoute + '/confirm', fetchArgs).then(common.checkStatus).then(function (response) { + return response.json(); + }); + }, -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. + /** + * Request that the stitch server send another email confirmation + * for account creation. + * + * @memberof userPassProvider + * @instance + * @param {String} email the email to send a confirmation email for + * @returns {Promise} + */ + sendEmailConfirm: function sendEmailConfirm(email) { + var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email: email })); + fetchArgs.cors = true; -var cachedSetTimeout; -var cachedClearTimeout; + return fetch(auth.rootUrl + '/' + providerRoute + '/confirm/send', fetchArgs).then(common.checkStatus).then(function (response) { + return response.json(); + }); + }, -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); -} -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } + /** + * Sends a password reset request to the stitch server + * + * @memberof userPassProvider + * @instance + * @param {String} email the email of the account to reset the password for + * @returns {Promise} + */ + sendPasswordReset: function sendPasswordReset(email) { + var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email: email })); + fetchArgs.cors = true; + return fetch(auth.rootUrl + '/' + providerRoute + '/reset/send', fetchArgs).then(common.checkStatus).then(function (response) { + return response.json(); + }); + }, -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } + /** + * Use information returned from the stitch server to complete the password + * reset flow for a given email account, providing a new password for the account. + * + * @memberof userPassProvider + * @instance + * @param {String} tokenId the tokenId provided by the stitch server + * @param {String} token the token provided by the stitch server + * @param {String} password the new password requested for this account + * @returns {Promise} + */ + passwordReset: function passwordReset(tokenId, token, password) { + var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ tokenId: tokenId, token: token, password: password })); + fetchArgs.cors = true; + return fetch(auth.rootUrl + '/' + providerRoute + '/reset', fetchArgs).then(common.checkStatus).then(function (response) { + return response.json(); + }); + }, + /** + * Will trigger an email to the requested account containing a link with the + * token and tokenId that must be returned to the server using emailConfirm() + * to activate the account. + * + * @memberof userPassProvider + * @instance + * @param {String} email the requested email for the account + * @param {String} password the requested password for the account + * @returns {Promise} + */ + register: function register(email, password) { + var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email: email, password: password })); + fetchArgs.cors = true; + return fetch(auth.rootUrl + '/' + providerRoute + '/register', fetchArgs).then(common.checkStatus).then(function (response) { + return response.json(); + }); + } + }; } -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); +/** @namespace */ +function apiKeyProvider(auth) { + // The ternary expression here is redundant but is just preserving previous behavior based on whether or not + // the client is for the admin or client API. + var loginRoute = auth.isAppClient() ? 'providers/api-key/login' : 'providers/api-key/login'; + + return { + /** + * Login to a stitch application using an api key + * + * @memberof apiKeyProvider + * @instance + * @param {String} key the key for authentication + * @returns {Promise} a promise that resolves when authentication succeeds. + */ + authenticate: function authenticate(key) { + var deviceId = auth.getDeviceId(); + var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID); + var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ 'key': key, 'options': { device: device } })); + fetchArgs.cors = true; + return fetch(auth.rootUrl + '/' + loginRoute, fetchArgs).then(common.checkStatus).then(function (response) { + return response.json(); + }).then(function (json) { + return auth.set(json, PROVIDER_TYPE_APIKEY); + }); } + }; } -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; +// The state we generate is to be used for any kind of request where we will +// complete an authentication flow via a redirect. We store the generate in +// a local storage bound to the app's origin. This ensures that any time we +// receive a redirect, there must be a state parameter and it must match +// what we ourselves have generated. This state MUST only be sent to +// a trusted Stitch endpoint in order to preserve its integrity. Stitch will +// store it in some way on its origin (currently a cookie stored on this client) +// and use that state at the end of an auth flow as a parameter in the redirect URI. +var alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; +function generateState() { + var state = ''; + for (var i = 0; i < 64; ++i) { + state += alpha.charAt(Math.floor(Math.random() * alpha.length)); + } - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); + return state; } -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; +function getOAuthLoginURL(auth, providerName, redirectUrl) { + if (redirectUrl === undefined) { + redirectUrl = auth.pageRootUrl(); + } -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; + var state = generateState(); + return auth.storage.set(authCommon.STATE_KEY, state).then(function () { + return auth.getDeviceId(); + }).then(function (deviceId) { + var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID); -function noop() {} + var result = auth.rootUrl + '/providers/oauth2-' + providerName + '/login?redirect=' + encodeURI(redirectUrl) + '&state=' + state + '&device=' + (0, _util.uriEncodeObject)(device); + return result; + }); +} -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; +/** @namespace */ +function googleProvider(auth) { + var loginRoute = auth.isAppClient() ? 'providers/oauth2-google/login' : 'providers/oauth2-google/login'; -process.listeners = function (name) { return [] } + return { + /** + * Login to a stitch application using google authentication + * + * @memberof googleProvider + * @instance + * @param {Object} data the redirectUrl data to use for authentication + * @returns {Promise} a promise that resolves when authentication succeeds. + */ + authenticate: function authenticate(data) { + var authCode = data.authCode; -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; + if (authCode) { + var deviceId = auth.getDeviceId(); + var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID); -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; + var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ authCode: authCode, options: { device: device } })); + return fetch(auth.rootUrl + '/' + loginRoute, fetchArgs).then(common.checkStatus).then(function (response) { + return response.json(); + }).then(function (json) { + return auth.set(json, PROVIDER_TYPE_GOOGLE); + }); + } -/***/ }), -/* 24 */ -/***/ (function(module, exports, __webpack_require__) { + var redirectUrl = data && data.redirectUrl ? data.redirectUrl : undefined; + return auth.storage.set(authCommon.STITCH_REDIRECT_PROVIDER, PROVIDER_TYPE_GOOGLE).then(function () { + return getOAuthLoginURL(auth, PROVIDER_TYPE_GOOGLE, redirectUrl); + }).then(function (res) { + return window.location.replace(res); + }); + } + }; +} -"use strict"; +/** @namespace */ +function facebookProvider(auth) { + var loginRoute = auth.isAppClient() ? 'providers/oauth2-facebook/login' : 'providers/oauth2-facebook/login'; + return { + /** + * Login to a stitch application using facebook authentication + * + * @memberof facebookProvider + * @instance + * @param {Object} data the redirectUrl data to use for authentication + * @returns {Promise} a promise that resolves when authentication succeeds. + */ + authenticate: function authenticate(data) { + var accessToken = data.accessToken; -Object.defineProperty(exports, "__esModule", { - value: true -}); -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + if (accessToken) { + var deviceId = auth.getDeviceId(); + var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID); -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ accessToken: accessToken, options: { device: device } })); -__webpack_require__(22); + return fetch(auth.rootUrl + '/' + loginRoute, fetchArgs).then(common.checkStatus).then(function (response) { + return response.json(); + }).then(function (json) { + return auth.set(json, PROVIDER_TYPE_FACEBOOK); + }); + } -var _client = __webpack_require__(19); + var redirectUrl = data && data.redirectUrl ? data.redirectUrl : undefined; + return auth.storage.set(authCommon.STITCH_REDIRECT_PROVIDER, PROVIDER_TYPE_FACEBOOK).then(function () { + return getOAuthLoginURL(auth, PROVIDER_TYPE_FACEBOOK, redirectUrl); + }).then(function (res) { + return window.location.replace(res); + }); + } + }; +} -var _client2 = _interopRequireDefault(_client); +/** @namespace */ +function mongodbCloudProvider(auth) { + // The ternary expression here is redundant but is just preserving previous behavior based on whether or not + // the client is for the admin or client API. + var loginRoute = auth.isAppClient() ? 'providers/mongodb-cloud/login' : 'providers/mongodb-cloud/login'; -var _common = __webpack_require__(16); + return { + /** + * Login to a stitch application using mongodb cloud authentication + * + * @memberof mongodbCloudProvider + * @instance + * @param {Object} data the username, apiKey, cors, and cookie data to use for authentication + * @returns {Promise} a promise that resolves when authentication succeeds. + */ + authenticate: function authenticate(data) { + var username = data.username, + apiKey = data.apiKey, + cors = data.cors, + cookie = data.cookie; -var _common2 = _interopRequireDefault(_common); + var options = Object.assign({}, { cors: true, cookie: false }, { cors: cors, cookie: cookie }); + var deviceId = auth.getDeviceId(); + var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID); + var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ username: username, apiKey: apiKey, options: { device: device } })); + fetchArgs.cors = true; // TODO: shouldn't this use the passed in `cors` value? + fetchArgs.credentials = 'include'; -var _common3 = __webpack_require__(15); + var url = auth.rootUrl + '/' + loginRoute; + if (options.cookie) { + return fetch(url + '?cookie=true', fetchArgs).then(common.checkStatus); + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + return fetch(url, fetchArgs).then(common.checkStatus).then(function (response) { + return response.json(); + }).then(function (json) { + return auth.set(json, PROVIDER_TYPE_MONGODB_CLOUD); + }); + } + }; +} -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +// TODO: support auth-specific options +function createProviders(auth) { + var _ref2; -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* global window, fetch */ -/* eslint no-labels: ['error', { 'allowLoop': true }] */ + return _ref2 = {}, _defineProperty(_ref2, PROVIDER_TYPE_ANON, anonProvider(auth)), _defineProperty(_ref2, PROVIDER_TYPE_APIKEY, apiKeyProvider(auth)), _defineProperty(_ref2, PROVIDER_TYPE_GOOGLE, googleProvider(auth)), _defineProperty(_ref2, PROVIDER_TYPE_FACEBOOK, facebookProvider(auth)), _defineProperty(_ref2, PROVIDER_TYPE_MONGODB_CLOUD, mongodbCloudProvider(auth)), _defineProperty(_ref2, PROVIDER_TYPE_USERPASS, userPassProvider(auth)), _defineProperty(_ref2, PROVIDER_TYPE_CUSTOM, customProvider(auth)), _ref2; +} +exports.createProviders = createProviders; -var v2 = 2; -var v3 = 3; +/***/ }), +/* 24 */ +/***/ (function(module, exports, __webpack_require__) { -var Admin = function (_StitchClient) { - _inherits(Admin, _StitchClient); +// the whatwg-fetch polyfill installs the fetch() function +// on the global object (window or self) +// +// Return that as the export for use in Webpack, Browserify etc. +__webpack_require__(73); +var globalObj = typeof self !== 'undefined' && self || this; +module.exports = globalObj.fetch.bind(globalObj); - function Admin(baseUrl) { - _classCallCheck(this, Admin); - return _possibleConstructorReturn(this, (Admin.__proto__ || Object.getPrototypeOf(Admin)).call(this, '', { baseUrl: baseUrl, authCodec: _common3.ADMIN_CLIENT_CODEC })); - } +/***/ }), +/* 25 */ +/***/ (function(module, exports) { - _createClass(Admin, [{ - key: 'logout', +// shim for using process in browser +var process = module.exports = {}; +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. - /** - * Ends the session for the current user. - * - * @returns {Promise} - */ - value: function logout() { - var _this2 = this; +var cachedSetTimeout; +var cachedClearTimeout; - return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', this).call(this, '/auth/session', 'DELETE', { refreshOnFailure: false, useRefreshToken: true, apiVersion: v3 }).then(function () { - return _this2.auth.clear(); - }); +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; } - - /** - * Returns profile information for the currently logged in user - * - * @returns {Promise} - */ - - }, { - key: 'userProfile', - value: function userProfile() { - return this._v3._get('/auth/profile'); + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; } - - /** - * Returns available providers for the currently logged in admin - * - * @returns {Promise} - */ - - }, { - key: 'getAuthProviders', - value: function getAuthProviders() { - return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', this).call(this, '/auth/providers', 'GET', { noAuth: true, apiVersion: v3 }).then(function (response) { - return response.json(); - }); +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } } - /** - * Returns an access token for the user - * - * @returns {Promise} - */ - }, { - key: 'doSessionPost', - value: function doSessionPost() { - return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', this).call(this, '/auth/session', 'POST', { refreshOnFailure: false, useRefreshToken: true, apiVersion: v3 }).then(function (response) { - return response.json(); - }); +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + + +/***/ }), +/* 26 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.StitchAdminClient = exports.StitchAdminClientFactory = undefined; + +var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* global window, fetch */ +/* eslint no-labels: ['error', { 'allowLoop': true }] */ + + +__webpack_require__(24); + +var _client = __webpack_require__(20); + +var _common = __webpack_require__(16); + +var _common2 = _interopRequireDefault(_common); + +var _common3 = __webpack_require__(4); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var v2 = 2; +var v3 = 3; + +var StitchAdminClientFactory = exports.StitchAdminClientFactory = function () { + function StitchAdminClientFactory() { + _classCallCheck(this, StitchAdminClientFactory); + + throw new StitchError('StitchAdminClient can only be made from the StitchAdminClientFactory.create function'); + } + + _createClass(StitchAdminClientFactory, null, [{ + key: 'create', + value: function create(baseUrl) { + return (0, _client.newStitchClient)(StitchAdminClient.prototype, '', { baseUrl: baseUrl, authCodec: _common3.ADMIN_CLIENT_CODEC }); + } + }]); + + return StitchAdminClientFactory; +}(); + +var StitchAdminClient = exports.StitchAdminClient = function (_StitchClient) { + _inherits(StitchAdminClient, _StitchClient); + + function StitchAdminClient() { + _classCallCheck(this, StitchAdminClient); + + var _this = _possibleConstructorReturn(this, (StitchAdminClient.__proto__ || Object.getPrototypeOf(StitchAdminClient)).call(this)); + + throw new StitchError('StitchAdminClient can only be made from the StitchAdminClientFactory.create function'); + return _this; + } + + _createClass(StitchAdminClient, [{ + key: 'logout', + + + /** + * Ends the session for the current user. + * + * @returns {Promise} + */ + value: function logout() { + var _this2 = this; + + return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', this).call(this, '/auth/session', 'DELETE', { refreshOnFailure: false, useRefreshToken: true, apiVersion: v3 }).then(function () { + return _this2.auth.clear(); + }); + } + + /** + * Returns profile information for the currently logged in user + * + * @returns {Promise} + */ + + }, { + key: 'userProfile', + value: function userProfile() { + return this._v3._get('/auth/profile'); + } + + /** + * Returns available providers for the currently logged in admin + * + * @returns {Promise} + */ + + }, { + key: 'getAuthProviders', + value: function getAuthProviders() { + return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', this).call(this, '/auth/providers', 'GET', { noAuth: true, apiVersion: v3 }).then(function (response) { + return response.json(); + }); + } + + /** + * Returns an access token for the user + * + * @returns {Promise} + */ + + }, { + key: 'doSessionPost', + value: function doSessionPost() { + return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', this).call(this, '/auth/session', 'POST', { refreshOnFailure: false, useRefreshToken: true, apiVersion: v3 }).then(function (response) { + return response.json(); + }); } /* Examples of how to access admin API with this client: @@ -6867,9 +7454,22 @@ var Admin = function (_StitchClient) { get: function get() { return api._get(appUrl + '/users/' + uid); }, + devices: function devices() { + return { + get: function get() { + return api._get(appUrl + '/users/' + uid + '/devices'); + } + }; + }, logout: function logout() { return api._put(appUrl + '/users/' + uid + '/logout'); }, + enable: function enable() { + return api._put(appUrl + '/users/' + uid + '/enable'); + }, + disable: function disable() { + return api._put(appUrl + '/users/' + uid + '/disable'); + }, remove: function remove() { return api._delete(appUrl + '/users/' + uid); } @@ -7320,19 +7920,19 @@ var Admin = function (_StitchClient) { logs: function logs() { return { get: function get(filter) { - return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', _this3).call(_this3, '/admin/logs', 'GET', { useRefreshToken: true, queryParams: filter }); + return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', _this3).call(_this3, '/admin/logs', 'GET', { useRefreshToken: true, queryParams: filter }); } }; }, users: function users() { return { list: function list(filter) { - return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', _this3).call(_this3, '/admin/users', 'GET', { useRefreshToken: true, queryParams: filter }); + return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', _this3).call(_this3, '/admin/users', 'GET', { useRefreshToken: true, queryParams: filter }); }, user: function user(uid) { return { logout: function logout() { - return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', _this3).call(_this3, '/admin/users/' + uid + '/logout', 'PUT', { useRefreshToken: true }); + return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', _this3).call(_this3, '/admin/users/' + uid + '/logout', 'PUT', { useRefreshToken: true }); } }; } @@ -7340,21 +7940,6 @@ var Admin = function (_StitchClient) { } }; } - }, { - key: '_isImpersonatingUser', - value: function _isImpersonatingUser() { - return this.auth.isImpersonatingUser(); - } - }, { - key: '_startImpersonation', - value: function _startImpersonation(userId) { - return this.auth.startImpersonation(this, userId); - } - }, { - key: '_stopImpersonation', - value: function _stopImpersonation() { - return this.auth.stopImpersonation(); - } }, { key: 'type', get: function get() { @@ -7366,7 +7951,7 @@ var Admin = function (_StitchClient) { var _this4 = this; var v3do = function v3do(url, method, options) { - return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', _this4).call(_this4, url, method, Object.assign({}, { apiVersion: v3 }, options)).then(function (response) { + return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', _this4).call(_this4, url, method, Object.assign({}, { apiVersion: v3 }, options)).then(function (response) { var contentHeader = response.headers.get('content-type') || ''; if (contentHeader.split(',').indexOf('application/json') >= 0) { return response.json(); @@ -7399,7 +7984,7 @@ var Admin = function (_StitchClient) { var _this5 = this; var v2do = function v2do(url, method, options) { - return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', _this5).call(_this5, url, method, Object.assign({}, { apiVersion: v2 }, options)).then(function (response) { + return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', _this5).call(_this5, url, method, Object.assign({}, { apiVersion: v2 }, options)).then(function (response) { var contentHeader = response.headers.get('content-type') || ''; if (contentHeader.split(',').indexOf('application/json') >= 0) { return response.json(); @@ -7428,14 +8013,11 @@ var Admin = function (_StitchClient) { } }]); - return Admin; -}(_client2.default); - -exports.default = Admin; -module.exports = exports['default']; + return StitchAdminClient; +}(_client.StitchClient); /***/ }), -/* 25 */ +/* 27 */ /***/ (function(module, exports, __webpack_require__) { ;(function () { @@ -7506,7 +8088,7 @@ module.exports = exports['default']; /***/ }), -/* 26 */ +/* 28 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7514,25 +8096,25 @@ module.exports = exports['default']; var writeIEEE754 = __webpack_require__(1).writeIEEE754, readIEEE754 = __webpack_require__(1).readIEEE754, - Map = __webpack_require__(20), + Map = __webpack_require__(22), Long = __webpack_require__(3), - Double = __webpack_require__(8), - Timestamp = __webpack_require__(14), - ObjectID = __webpack_require__(11), - BSONRegExp = __webpack_require__(12), - _Symbol = __webpack_require__(13), + Double = __webpack_require__(9), + Timestamp = __webpack_require__(15), + ObjectID = __webpack_require__(12), + BSONRegExp = __webpack_require__(13), + _Symbol = __webpack_require__(14), Int32 = __webpack_require__(18), - Code = __webpack_require__(5), - Decimal128 = __webpack_require__(7), - MinKey = __webpack_require__(10), - MaxKey = __webpack_require__(9), - DBRef = __webpack_require__(6), - Binary = __webpack_require__(4); + Code = __webpack_require__(6), + Decimal128 = __webpack_require__(8), + MinKey = __webpack_require__(11), + MaxKey = __webpack_require__(10), + DBRef = __webpack_require__(7), + Binary = __webpack_require__(5); // Parts of the parser -var deserialize = __webpack_require__(28), - serializer = __webpack_require__(29), - calculateObjectSize = __webpack_require__(27); +var deserialize = __webpack_require__(30), + serializer = __webpack_require__(31), + calculateObjectSize = __webpack_require__(29); /** * @ignore @@ -7861,7 +8443,7 @@ module.exports.Decimal128 = Decimal128; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }), -/* 27 */ +/* 29 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7872,17 +8454,17 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol var writeIEEE754 = __webpack_require__(1).writeIEEE754, readIEEE754 = __webpack_require__(1).readIEEE754, Long = __webpack_require__(3).Long, - Double = __webpack_require__(8).Double, - Timestamp = __webpack_require__(14).Timestamp, - ObjectID = __webpack_require__(11).ObjectID, - _Symbol = __webpack_require__(13).Symbol, - BSONRegExp = __webpack_require__(12).BSONRegExp, - Code = __webpack_require__(5).Code, - Decimal128 = __webpack_require__(7), - MinKey = __webpack_require__(10).MinKey, - MaxKey = __webpack_require__(9).MaxKey, - DBRef = __webpack_require__(6).DBRef, - Binary = __webpack_require__(4).Binary; + Double = __webpack_require__(9).Double, + Timestamp = __webpack_require__(15).Timestamp, + ObjectID = __webpack_require__(12).ObjectID, + _Symbol = __webpack_require__(14).Symbol, + BSONRegExp = __webpack_require__(13).BSONRegExp, + Code = __webpack_require__(6).Code, + Decimal128 = __webpack_require__(8), + MinKey = __webpack_require__(11).MinKey, + MaxKey = __webpack_require__(10).MaxKey, + DBRef = __webpack_require__(7).DBRef, + Binary = __webpack_require__(5).Binary; // To ensure that 0.4 of node works correctly var isDate = function isDate(d) { @@ -8020,7 +8602,7 @@ module.exports = calculateObjectSize; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }), -/* 28 */ +/* 30 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -8029,18 +8611,18 @@ module.exports = calculateObjectSize; var readIEEE754 = __webpack_require__(1).readIEEE754, f = __webpack_require__(72).format, Long = __webpack_require__(3).Long, - Double = __webpack_require__(8).Double, - Timestamp = __webpack_require__(14).Timestamp, - ObjectID = __webpack_require__(11).ObjectID, - _Symbol = __webpack_require__(13).Symbol, - Code = __webpack_require__(5).Code, - MinKey = __webpack_require__(10).MinKey, - MaxKey = __webpack_require__(9).MaxKey, - Decimal128 = __webpack_require__(7), + Double = __webpack_require__(9).Double, + Timestamp = __webpack_require__(15).Timestamp, + ObjectID = __webpack_require__(12).ObjectID, + _Symbol = __webpack_require__(14).Symbol, + Code = __webpack_require__(6).Code, + MinKey = __webpack_require__(11).MinKey, + MaxKey = __webpack_require__(10).MaxKey, + Decimal128 = __webpack_require__(8), Int32 = __webpack_require__(18), - DBRef = __webpack_require__(6).DBRef, - BSONRegExp = __webpack_require__(12).BSONRegExp, - Binary = __webpack_require__(4).Binary; + DBRef = __webpack_require__(7).DBRef, + BSONRegExp = __webpack_require__(13).BSONRegExp, + Binary = __webpack_require__(5).Binary; var deserialize = function deserialize(buffer, options, isArray) { options = options == null ? {} : options; @@ -8681,7 +9263,7 @@ module.exports = deserialize; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }), -/* 29 */ +/* 31 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -8692,19 +9274,19 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol var writeIEEE754 = __webpack_require__(1).writeIEEE754, readIEEE754 = __webpack_require__(1).readIEEE754, Long = __webpack_require__(3).Long, - Map = __webpack_require__(20), - Double = __webpack_require__(8).Double, - Timestamp = __webpack_require__(14).Timestamp, - ObjectID = __webpack_require__(11).ObjectID, - _Symbol = __webpack_require__(13).Symbol, - Code = __webpack_require__(5).Code, - BSONRegExp = __webpack_require__(12).BSONRegExp, + Map = __webpack_require__(22), + Double = __webpack_require__(9).Double, + Timestamp = __webpack_require__(15).Timestamp, + ObjectID = __webpack_require__(12).ObjectID, + _Symbol = __webpack_require__(14).Symbol, + Code = __webpack_require__(6).Code, + BSONRegExp = __webpack_require__(13).BSONRegExp, Int32 = __webpack_require__(18).Int32, - MinKey = __webpack_require__(10).MinKey, - MaxKey = __webpack_require__(9).MaxKey, - Decimal128 = __webpack_require__(7), - DBRef = __webpack_require__(6).DBRef, - Binary = __webpack_require__(4).Binary; + MinKey = __webpack_require__(11).MinKey, + MaxKey = __webpack_require__(10).MaxKey, + Decimal128 = __webpack_require__(8), + DBRef = __webpack_require__(7).DBRef, + Binary = __webpack_require__(5).Binary; try { var _Buffer = Uint8Array; @@ -9541,559 +10123,155 @@ BSON.BSON_DATA_ARRAY = 4; * Binary BSON Type * * @classconstant BSON_DATA_BINARY - **/ -BSON.BSON_DATA_BINARY = 5; -/** - * ObjectID BSON Type, deprecated - * - * @classconstant BSON_DATA_UNDEFINED - **/ -BSON.BSON_DATA_UNDEFINED = 6; -/** - * ObjectID BSON Type - * - * @classconstant BSON_DATA_OID - **/ -BSON.BSON_DATA_OID = 7; -/** - * Boolean BSON Type - * - * @classconstant BSON_DATA_BOOLEAN - **/ -BSON.BSON_DATA_BOOLEAN = 8; -/** - * Date BSON Type - * - * @classconstant BSON_DATA_DATE - **/ -BSON.BSON_DATA_DATE = 9; -/** - * null BSON Type - * - * @classconstant BSON_DATA_NULL - **/ -BSON.BSON_DATA_NULL = 10; -/** - * RegExp BSON Type - * - * @classconstant BSON_DATA_REGEXP - **/ -BSON.BSON_DATA_REGEXP = 11; -/** - * Code BSON Type - * - * @classconstant BSON_DATA_CODE - **/ -BSON.BSON_DATA_CODE = 13; -/** - * Symbol BSON Type - * - * @classconstant BSON_DATA_SYMBOL - **/ -BSON.BSON_DATA_SYMBOL = 14; -/** - * Code with Scope BSON Type - * - * @classconstant BSON_DATA_CODE_W_SCOPE - **/ -BSON.BSON_DATA_CODE_W_SCOPE = 15; -/** - * 32 bit Integer BSON Type - * - * @classconstant BSON_DATA_INT - **/ -BSON.BSON_DATA_INT = 16; -/** - * Timestamp BSON Type - * - * @classconstant BSON_DATA_TIMESTAMP - **/ -BSON.BSON_DATA_TIMESTAMP = 17; -/** - * Long BSON Type - * - * @classconstant BSON_DATA_LONG - **/ -BSON.BSON_DATA_LONG = 18; -/** - * Long BSON Type - * - * @classconstant BSON_DATA_DECIMAL128 - **/ -BSON.BSON_DATA_DECIMAL128 = 19; -/** - * MinKey BSON Type - * - * @classconstant BSON_DATA_MIN_KEY - **/ -BSON.BSON_DATA_MIN_KEY = 0xff; -/** - * MaxKey BSON Type - * - * @classconstant BSON_DATA_MAX_KEY - **/ -BSON.BSON_DATA_MAX_KEY = 0x7f; -/** - * Binary Default Type - * - * @classconstant BSON_BINARY_SUBTYPE_DEFAULT - **/ -BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; -/** - * Binary Function Type - * - * @classconstant BSON_BINARY_SUBTYPE_FUNCTION - **/ -BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; -/** - * Binary Byte Array Type - * - * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY - **/ -BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; -/** - * Binary UUID Type - * - * @classconstant BSON_BINARY_SUBTYPE_UUID - **/ -BSON.BSON_BINARY_SUBTYPE_UUID = 3; -/** - * Binary MD5 Type - * - * @classconstant BSON_BINARY_SUBTYPE_MD5 - **/ -BSON.BSON_BINARY_SUBTYPE_MD5 = 4; -/** - * Binary User Defined Type - * - * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED - **/ -BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; - -// BSON MAX VALUES -BSON.BSON_INT32_MAX = 0x7FFFFFFF; -BSON.BSON_INT32_MIN = -0x80000000; - -BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; -BSON.BSON_INT64_MIN = -Math.pow(2, 63); - -// JS MAX PRECISE VALUES -BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. -BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. - -// Internal long versions -var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. -var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. - -module.exports = serializeInto; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) - -/***/ }), -/* 30 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* global window, document, fetch */ - -var _storage = __webpack_require__(32); - -var _providers = __webpack_require__(31); - -var _errors = __webpack_require__(21); - -var _common = __webpack_require__(15); - -var authCommon = _interopRequireWildcard(_common); - -var _common2 = __webpack_require__(16); - -var common = _interopRequireWildcard(_common2); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var jwtDecode = __webpack_require__(67); - -var EMBEDDED_USER_AUTH_DATA_PARTS = 4; - -var Auth = function () { - function Auth(client, rootUrl, options) { - _classCallCheck(this, Auth); - - options = Object.assign({}, { - storageType: 'localStorage', - codec: authCommon.APP_CLIENT_CODEC - }, options); - - this.client = client; - this.rootUrl = rootUrl; - this.codec = options.codec; - this.storage = (0, _storage.createStorage)(options.storageType); - this.providers = (0, _providers.createProviders)(this); - } - - _createClass(Auth, [{ - key: 'provider', - value: function provider(name) { - if (!this.providers.hasOwnProperty(name)) { - throw new Error('Invalid auth provider specified: ' + name); - } - - return this.providers[name]; - } - }, { - key: 'refreshToken', - value: function refreshToken() { - var _this = this; - - if (this.isImpersonatingUser()) { - return this.refreshImpersonation(this.client); - } - - return this.client.doSessionPost().then(function (json) { - return _this.set(json); - }); - } - }, { - key: 'pageRootUrl', - value: function pageRootUrl() { - return [window.location.protocol, '//', window.location.host, window.location.pathname].join(''); - } - }, { - key: 'error', - value: function error() { - return this._error; - } - }, { - key: 'isAppClient', - value: function isAppClient() { - if (!this.client) { - return true; // Handle the case where Auth is constructed with null - } - return this.client.type === common.APP_CLIENT_TYPE; - } - }, { - key: 'handleRedirect', - value: function handleRedirect() { - if (typeof window === 'undefined') { - // This means we're running in some environment other - // than a browser - so handling a redirect makes no sense here. - return; - } - if (!window.location || !window.location.hash) { - return; - } - - var ourState = this.storage.get(authCommon.STATE_KEY); - var redirectFragment = window.location.hash.substring(1); - var redirectState = this.parseRedirectFragment(redirectFragment, ourState); - if (redirectState.lastError) { - console.error('StitchClient: error from redirect: ' + redirectState.lastError); - this._error = redirectState.lastError; - window.history.replaceState(null, '', this.pageRootUrl()); - return; - } - - if (!redirectState.found) { - return; - } - - this.storage.remove(authCommon.STATE_KEY); - if (!redirectState.stateValid) { - console.error('StitchClient: state values did not match!'); - window.history.replaceState(null, '', this.pageRootUrl()); - return; - } - - if (!redirectState.ua) { - console.error('StitchClient: no UA value was returned from redirect!'); - return; - } - - // If we get here, the state is valid - set auth appropriately. - this.set(redirectState.ua); - window.history.replaceState(null, '', this.pageRootUrl()); - } - }, { - key: 'getCookie', - value: function getCookie(name) { - var splitCookies = document.cookie.split(' '); - for (var i = 0; i < splitCookies.length; i++) { - var cookie = splitCookies[i]; - var sepIdx = cookie.indexOf('='); - var cookieName = cookie.substring(0, sepIdx); - if (cookieName === name) { - var cookieVal = cookie.substring(sepIdx + 1, cookie.length); - if (cookieVal[cookieVal.length - 1] === ';') { - return cookieVal.substring(0, cookie.length - 1); - } - return cookieVal; - } - } - } - }, { - key: 'handleCookie', - value: function handleCookie() { - if (typeof window === 'undefined' || typeof document === 'undefined') { - // This means we're running in some environment other - // than a browser - so handling a cookie makes no sense here. - return; - } - if (!document.cookie) { - return; - } - - var uaCookie = this.getCookie(authCommon.USER_AUTH_COOKIE_NAME); - if (!uaCookie) { - return; - } - - document.cookie = authCommon.USER_AUTH_COOKIE_NAME + '=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT;'; - var userAuth = this.unmarshallUserAuth(uaCookie); - this.set(userAuth); - window.history.replaceState(null, '', this.pageRootUrl()); - } - }, { - key: 'clear', - value: function clear() { - this.storage.remove(authCommon.USER_AUTH_KEY); - this.storage.remove(authCommon.REFRESH_TOKEN_KEY); - this.clearImpersonation(); - } - }, { - key: 'getDeviceId', - value: function getDeviceId() { - return this.storage.get(authCommon.DEVICE_ID_KEY); - } - - // Returns whether or not the access token is expired or is going to expire within 'withinSeconds' - // seconds, according to current system time. Returns false if the token is malformed in any way. - - }, { - key: 'isAccessTokenExpired', - value: function isAccessTokenExpired() { - var withinSeconds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : authCommon.DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS; - - var token = this.getAccessToken(); - if (!token) { - return false; - } - - var decodedToken = void 0; - try { - decodedToken = jwtDecode(token); - } catch (e) { - return false; - } - - if (!decodedToken) { - return false; - } - - return decodedToken.exp && Math.floor(Date.now() / 1000) >= decodedToken.exp - withinSeconds; - } - }, { - key: 'getAccessToken', - value: function getAccessToken() { - return this._get().accessToken; - } - }, { - key: 'getRefreshToken', - value: function getRefreshToken() { - return this.storage.get(authCommon.REFRESH_TOKEN_KEY); - } - }, { - key: 'set', - value: function set(json) { - if (!json) { - return; - } - - if (json[this.codec.refreshToken]) { - var rt = json[this.codec.refreshToken]; - delete json[this.codec.refreshToken]; - this.storage.set(authCommon.REFRESH_TOKEN_KEY, rt); - } - - if (json[this.codec.deviceId]) { - var deviceId = json[this.codec.deviceId]; - delete json[this.codec.deviceId]; - this.storage.set(authCommon.DEVICE_ID_KEY, deviceId); - } - - // Merge in new fields with old fields. Typically the first json value - // is complete with every field inside a user auth, but subsequent requests - // do not include everything. This merging behavior is safe so long as json - // value responses with absent fields do not indicate that the field should - // be unset. - var newUserAuth = {}; - if (json[this.codec.accessToken]) { - newUserAuth.accessToken = json[this.codec.accessToken]; - } - if (json[this.codec.userId]) { - newUserAuth.userId = json[this.codec.userId]; - } - newUserAuth = Object.assign(this._get(), newUserAuth); - this.storage.set(authCommon.USER_AUTH_KEY, JSON.stringify(newUserAuth)); - } - }, { - key: '_get', - value: function _get() { - var data = this.storage.get(authCommon.USER_AUTH_KEY); - if (!data) { - return {}; - } - - try { - return JSON.parse(data); - } catch (e) { - // Need to back out and clear auth otherwise we will never - // be able to do anything useful. - this.clear(); - throw new _errors.StitchError('Failure retrieving stored auth'); - } - } - }, { - key: 'authedId', - value: function authedId() { - return this._get().userId; - } - }, { - key: 'isImpersonatingUser', - value: function isImpersonatingUser() { - return this.storage.get(authCommon.IMPERSONATION_ACTIVE_KEY) === 'true'; - } - }, { - key: 'refreshImpersonation', - value: function refreshImpersonation(client) { - var _this2 = this; - - var userId = this.storage.get(authCommon.IMPERSONATION_USER_KEY); - return client._do('/admin/users/' + userId + '/impersonate', 'POST', { refreshOnFailure: false, useRefreshToken: true }).then(function (response) { - return response.json(); - }).then(function (json) { - return _this2.set(json); - }).catch(function (e) { - _this2.stopImpersonation(); - throw e; // rethrow - }); - } - }, { - key: 'startImpersonation', - value: function startImpersonation(client, userId) { - if (!this.authedId()) { - return Promise.reject(new _errors.StitchError('Must auth first')); - } - - if (this.isImpersonatingUser()) { - return Promise.reject(new _errors.StitchError('Already impersonating a user')); - } - - this.storage.set(authCommon.IMPERSONATION_ACTIVE_KEY, 'true'); - this.storage.set(authCommon.IMPERSONATION_USER_KEY, userId); - - var realUserAuth = JSON.parse(this.storage.get(authCommon.USER_AUTH_KEY)); - this.storage.set(authCommon.IMPERSONATION_REAL_USER_AUTH_KEY, JSON.stringify(realUserAuth)); - return this.refreshImpersonation(client); - } - }, { - key: 'stopImpersonation', - value: function stopImpersonation() { - var _this3 = this; - - if (!this.isImpersonatingUser()) { - throw new _errors.StitchError('Not impersonating a user'); - } - - return new Promise(function (resolve, reject) { - var realUserAuth = JSON.parse(_this3.storage.get(authCommon.IMPERSONATION_REAL_USER_AUTH_KEY)); - _this3.set(realUserAuth); - _this3.clearImpersonation(); - resolve(); - }); - } - }, { - key: 'clearImpersonation', - value: function clearImpersonation() { - this.storage.remove(authCommon.IMPERSONATION_ACTIVE_KEY); - this.storage.remove(authCommon.IMPERSONATION_USER_KEY); - this.storage.remove(authCommon.IMPERSONATION_REAL_USER_AUTH_KEY); - } - }, { - key: 'parseRedirectFragment', - value: function parseRedirectFragment(fragment, ourState) { - // After being redirected from oauth, the URL will look like: - // https://todo.examples.stitch.mongodb.com/#_stitch_state=...&_stitch_ua=... - // This function parses out stitch-specific tokens from the fragment and - // builds an object describing the result. - var vars = fragment.split('&'); - var result = { ua: null, found: false, stateValid: false, lastError: null }; - var shouldBreak = false; - for (var i = 0; i < vars.length && !shouldBreak; ++i) { - var pairParts = vars[i].split('='); - var pairKey = decodeURIComponent(pairParts[0]); - switch (pairKey) { - case authCommon.STITCH_ERROR_KEY: - result.lastError = decodeURIComponent(pairParts[1]); - result.found = true; - shouldBreak = true; - break; - case authCommon.USER_AUTH_KEY: - try { - result.ua = this.unmarshallUserAuth(decodeURIComponent(pairParts[1])); - result.found = true; - } catch (e) { - result.lastError = e; - } - continue; - case authCommon.STITCH_LINK_KEY: - result.found = true; - continue; - case authCommon.STATE_KEY: - result.found = true; - var theirState = decodeURIComponent(pairParts[1]); - if (ourState && ourState === theirState) { - result.stateValid = true; - } - continue; - default: - continue; - } - } + **/ +BSON.BSON_DATA_BINARY = 5; +/** + * ObjectID BSON Type, deprecated + * + * @classconstant BSON_DATA_UNDEFINED + **/ +BSON.BSON_DATA_UNDEFINED = 6; +/** + * ObjectID BSON Type + * + * @classconstant BSON_DATA_OID + **/ +BSON.BSON_DATA_OID = 7; +/** + * Boolean BSON Type + * + * @classconstant BSON_DATA_BOOLEAN + **/ +BSON.BSON_DATA_BOOLEAN = 8; +/** + * Date BSON Type + * + * @classconstant BSON_DATA_DATE + **/ +BSON.BSON_DATA_DATE = 9; +/** + * null BSON Type + * + * @classconstant BSON_DATA_NULL + **/ +BSON.BSON_DATA_NULL = 10; +/** + * RegExp BSON Type + * + * @classconstant BSON_DATA_REGEXP + **/ +BSON.BSON_DATA_REGEXP = 11; +/** + * Code BSON Type + * + * @classconstant BSON_DATA_CODE + **/ +BSON.BSON_DATA_CODE = 13; +/** + * Symbol BSON Type + * + * @classconstant BSON_DATA_SYMBOL + **/ +BSON.BSON_DATA_SYMBOL = 14; +/** + * Code with Scope BSON Type + * + * @classconstant BSON_DATA_CODE_W_SCOPE + **/ +BSON.BSON_DATA_CODE_W_SCOPE = 15; +/** + * 32 bit Integer BSON Type + * + * @classconstant BSON_DATA_INT + **/ +BSON.BSON_DATA_INT = 16; +/** + * Timestamp BSON Type + * + * @classconstant BSON_DATA_TIMESTAMP + **/ +BSON.BSON_DATA_TIMESTAMP = 17; +/** + * Long BSON Type + * + * @classconstant BSON_DATA_LONG + **/ +BSON.BSON_DATA_LONG = 18; +/** + * Long BSON Type + * + * @classconstant BSON_DATA_DECIMAL128 + **/ +BSON.BSON_DATA_DECIMAL128 = 19; +/** + * MinKey BSON Type + * + * @classconstant BSON_DATA_MIN_KEY + **/ +BSON.BSON_DATA_MIN_KEY = 0xff; +/** + * MaxKey BSON Type + * + * @classconstant BSON_DATA_MAX_KEY + **/ +BSON.BSON_DATA_MAX_KEY = 0x7f; +/** + * Binary Default Type + * + * @classconstant BSON_BINARY_SUBTYPE_DEFAULT + **/ +BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; +/** + * Binary Function Type + * + * @classconstant BSON_BINARY_SUBTYPE_FUNCTION + **/ +BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; +/** + * Binary Byte Array Type + * + * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY + **/ +BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; +/** + * Binary UUID Type + * + * @classconstant BSON_BINARY_SUBTYPE_UUID + **/ +BSON.BSON_BINARY_SUBTYPE_UUID = 3; +/** + * Binary MD5 Type + * + * @classconstant BSON_BINARY_SUBTYPE_MD5 + **/ +BSON.BSON_BINARY_SUBTYPE_MD5 = 4; +/** + * Binary User Defined Type + * + * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED + **/ +BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; - return result; - } - }, { - key: 'unmarshallUserAuth', - value: function unmarshallUserAuth(data) { - var _ref; +// BSON MAX VALUES +BSON.BSON_INT32_MAX = 0x7FFFFFFF; +BSON.BSON_INT32_MIN = -0x80000000; - var parts = data.split('$'); - if (parts.length !== EMBEDDED_USER_AUTH_DATA_PARTS) { - throw new RangeError('invalid user auth data provided: ' + data); - } +BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; +BSON.BSON_INT64_MIN = -Math.pow(2, 63); - return _ref = {}, _defineProperty(_ref, this.codec.accessToken, parts[0]), _defineProperty(_ref, this.codec.refreshToken, parts[1]), _defineProperty(_ref, this.codec.userId, parts[2]), _defineProperty(_ref, this.codec.deviceId, parts[3]), _ref; - } - }]); +// JS MAX PRECISE VALUES +BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. +BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. - return Auth; -}(); +// Internal long versions +var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. +var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. -exports.default = Auth; -module.exports = exports['default']; +module.exports = serializeInto; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }), -/* 31 */ +/* 32 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -10102,392 +10280,458 @@ module.exports = exports['default']; Object.defineProperty(exports, "__esModule", { value: true }); -exports.createProviders = undefined; +exports.Auth = exports.AuthFactory = undefined; -var _common = __webpack_require__(16); +var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); -var common = _interopRequireWildcard(_common); +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* global window, document, fetch */ -var _common2 = __webpack_require__(15); +exports.newAuth = newAuth; -var authCommon = _interopRequireWildcard(_common2); +var _storage = __webpack_require__(33); -var _util = __webpack_require__(2); +var _providers = __webpack_require__(23); -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } +var _errors = __webpack_require__(19); -/** - * Create the device info for this client. - * - * @memberof module:auth - * @method getDeviceInfo - * @param {String} appId The app ID for this client - * @param {String} appVersion The version of the app - * @returns {Object} The device info object - */ -function getDeviceInfo(deviceId, appId) { - var appVersion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; +var _common = __webpack_require__(4); - var deviceInfo = { appId: appId, appVersion: appVersion, sdkVersion: common.SDK_VERSION }; +var authCommon = _interopRequireWildcard(_common); - if (deviceId) { - deviceInfo.deviceId = deviceId; - } +var _common2 = __webpack_require__(16); - var platform = (0, _util.getPlatform)(); +var common = _interopRequireWildcard(_common2); - if (platform) { - deviceInfo.platform = platform.name; - deviceInfo.platformVersion = platform.version; - } +var _detectBrowser = __webpack_require__(59); - return deviceInfo; -} +var _platform = _interopRequireWildcard(_detectBrowser); -/** - * @namespace - */ -/** @module auth */ -function anonProvider(auth) { - return { - /** - * Login to a stitch application using anonymous authentication - * - * @memberof anonProvider - * @instance - * @returns {Promise} a promise that resolves when authentication succeeds. - */ - authenticate: function authenticate() { - var device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID); - var fetchArgs = common.makeFetchArgs('GET'); - fetchArgs.cors = true; +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - return fetch(auth.rootUrl + '/providers/anon-user/login?device=' + (0, _util.uriEncodeObject)(device), fetchArgs).then(common.checkStatus).then(function (response) { - return response.json(); - }).then(function (json) { - return auth.set(json); - }); - } - }; -} +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -/** - * @namespace - */ -function customProvider(auth) { - var providerRoute = 'providers/custom-token'; - var loginRoute = providerRoute + '/login'; +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - return { - /** - * Login to a stitch application using custom authentication - * - * @memberof customProvider - * @instance - * @param {String} JWT token to use for authentication - * @returns {Promise} a promise that resolves when authentication succeeds. - */ - authenticate: function authenticate(token) { - var device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID); +var jwtDecode = __webpack_require__(67); - var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ token: token, options: { device: device } })); - fetchArgs.cors = true; +var EMBEDDED_USER_AUTH_DATA_PARTS = 4; - return fetch(auth.rootUrl + '/' + loginRoute, fetchArgs).then(common.checkStatus).then(function (response) { - return response.json(); - }).then(function (json) { - return auth.set(json); - }); +var AuthFactory = exports.AuthFactory = function () { + function AuthFactory() { + _classCallCheck(this, AuthFactory); + + throw new _errors.StitchError('Auth can only be made from the AuthFactory.create function'); + } + + _createClass(AuthFactory, null, [{ + key: 'create', + value: function create(client, rootUrl, options) { + return newAuth(client, rootUrl, options); } - }; + }]); + + return AuthFactory; +}(); + +function newAuth(client, rootUrl, options) { + var auth = Object.create(Auth.prototype); + var namespace = void 0; + if (!client || client.clientAppID === '') { + namespace = 'admin'; + } else { + namespace = 'client.' + client.clientAppID; + } + + options = Object.assign({ + codec: authCommon.APP_CLIENT_CODEC, + namespace: namespace, + storageType: 'localStorage' + }, options); + + auth.client = client; + auth.rootUrl = rootUrl; + auth.codec = options.codec; + auth.platform = options.platform || _platform; + auth.storage = (0, _storage.createStorage)(options); + auth.providers = (0, _providers.createProviders)(auth, options); + + return Promise.all([auth._get(), auth.storage.get(authCommon.REFRESH_TOKEN_KEY), auth.storage.get(authCommon.USER_LOGGED_IN_PT_KEY), auth.storage.get(authCommon.DEVICE_ID_KEY)]).then(function (_ref) { + var _ref2 = _slicedToArray(_ref, 4), + authObj = _ref2[0], + rt = _ref2[1], + loggedInProviderType = _ref2[2], + deviceId = _ref2[3]; + + auth.auth = authObj; + auth.authedId = authObj.userId; + auth.rt = rt; + auth.loggedInProviderType = loggedInProviderType; + auth.deviceId = deviceId; + + return auth; + }); } -/** @namespace */ -function userPassProvider(auth) { - // The ternary expression here is redundant but is just preserving previous behavior based on whether or not - // the client is for the admin or client API. - var providerRoute = auth.isAppClient() ? 'providers/local-userpass' : 'providers/local-userpass'; - var loginRoute = auth.isAppClient() ? providerRoute + '/login' : providerRoute + '/login'; +var Auth = exports.Auth = function () { + function Auth(client, rootUrl, options) { + _classCallCheck(this, Auth); - return { - /** - * Login to a stitch application using username and password authentication - * - * @memberof userPassProvider - * @instance - * @param {String} username the username to use for authentication - * @param {String} password the password to use for authentication - * @returns {Promise} a promise that resolves when authentication succeeds. - */ - authenticate: function authenticate(_ref) { - var username = _ref.username, - password = _ref.password; + throw new _errors.StitchError('Auth can only be made from the AuthFactory.create function'); + } + + /** + * Create the device info for this client. + * + * @memberof module:auth + * @method getDeviceInfo + * @param {String} appId The app ID for this client + * @param {String} appVersion The version of the app + * @returns {Object} The device info object + */ - var device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID); - var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ username: username, password: password, options: { device: device } })); - fetchArgs.cors = true; + _createClass(Auth, [{ + key: 'getDeviceInfo', + value: function getDeviceInfo(deviceId, appId) { + var appVersion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; - return fetch(auth.rootUrl + '/' + loginRoute, fetchArgs).then(common.checkStatus).then(function (response) { - return response.json(); - }).then(function (json) { - return auth.set(json); - }); - }, + var deviceInfo = { appId: appId, appVersion: appVersion, sdkVersion: common.SDK_VERSION }; - /** - * Completes the confirmation workflow from the stitch server - * @memberof userPassProvider - * @instance - * @param {String} tokenId the tokenId provided by the stitch server - * @param {String} token the token provided by the stitch server - * @returns {Promise} - */ - emailConfirm: function emailConfirm(tokenId, token) { - var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ tokenId: tokenId, token: token })); - fetchArgs.cors = true; + if (deviceId) { + deviceInfo.deviceId = deviceId; + } - return fetch(auth.rootUrl + '/' + providerRoute + '/confirm', fetchArgs).then(common.checkStatus).then(function (response) { - return response.json(); - }); - }, + if (this.platform) { + deviceInfo.platform = this.platform.name; + deviceInfo.platformVersion = this.platform.version; + } - /** - * Request that the stitch server send another email confirmation - * for account creation. - * - * @memberof userPassProvider - * @instance - * @param {String} email the email to send a confirmation email for - * @returns {Promise} - */ - sendEmailConfirm: function sendEmailConfirm(email) { - var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email: email })); - fetchArgs.cors = true; + return deviceInfo; + } + }, { + key: 'provider', + value: function provider(name) { + if (!this.providers.hasOwnProperty(name)) { + throw new Error('Invalid auth provider specified: ' + name); + } - return fetch(auth.rootUrl + '/' + providerRoute + '/confirm/send', fetchArgs).then(common.checkStatus).then(function (response) { - return response.json(); + return this.providers[name]; + } + }, { + key: 'refreshToken', + value: function refreshToken() { + var _this = this; + + return this.client.doSessionPost().then(function (json) { + return _this.set(json); }); - }, + } + }, { + key: 'pageRootUrl', + value: function pageRootUrl() { + return [window.location.protocol, '//', window.location.host, window.location.pathname].join(''); + } + }, { + key: 'error', + value: function error() { + return this._error; + } + }, { + key: 'isAppClient', + value: function isAppClient() { + if (!this.client) { + return true; // Handle the case where Auth is constructed with null + } + return this.client.type === common.APP_CLIENT_TYPE; + } + }, { + key: 'handleRedirect', + value: function handleRedirect() { + var _this2 = this; - /** - * Sends a password reset request to the stitch server - * - * @memberof userPassProvider - * @instance - * @param {String} email the email of the account to reset the password for - * @returns {Promise} - */ - sendPasswordReset: function sendPasswordReset(email) { - var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email: email })); - fetchArgs.cors = true; + if (typeof window === 'undefined') { + // This means we're running in some environment other + // than a browser - so handling a redirect makes no sense here. + return; + } + if (!window.location || !window.location.hash) { + return; + } - return fetch(auth.rootUrl + '/' + providerRoute + '/reset/send', fetchArgs).then(common.checkStatus).then(function (response) { - return response.json(); - }); - }, + var redirectProvider = void 0; + return Promise.all([this.storage.get(authCommon.STATE_KEY), this.storage.get(authCommon.STITCH_REDIRECT_PROVIDER)]).then(function (_ref3) { + var _ref4 = _slicedToArray(_ref3, 2), + ourState = _ref4[0], + _redirectProvider = _ref4[1]; + + var redirectFragment = window.location.hash.substring(1); + redirectProvider = _redirectProvider; + var redirectState = _this2.parseRedirectFragment(redirectFragment, ourState); + if (redirectState.lastError || !redirectProvider) { + console.error('StitchClient: error from redirect: ' + (redirectState.lastError ? redirectState.lastError : 'provider type not set')); + _this2._error = redirectState.lastError; + window.history.replaceState(null, '', _this2.pageRootUrl()); + return; + } - /** - * Use information returned from the stitch server to complete the password - * reset flow for a given email account, providing a new password for the account. - * - * @memberof userPassProvider - * @instance - * @param {String} tokenId the tokenId provided by the stitch server - * @param {String} token the token provided by the stitch server - * @param {String} password the new password requested for this account - * @returns {Promise} - */ - passwordReset: function passwordReset(tokenId, token, password) { - var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ tokenId: tokenId, token: token, password: password })); - fetchArgs.cors = true; + if (!redirectState.found) { + return; + } - return fetch(auth.rootUrl + '/' + providerRoute + '/reset', fetchArgs).then(common.checkStatus).then(function (response) { - return response.json(); - }); - }, + return Promise.all([_this2.storage.remove(authCommon.STATE_KEY), _this2.storage.remove(authCommon.STITCH_REDIRECT_PROVIDER)]).then(function () { + return redirectState; + }); + }).then(function (redirectState) { + if (!redirectState.stateValid) { + console.error('StitchClient: state values did not match!'); + window.history.replaceState(null, '', _this2.pageRootUrl()); + return; + } - /** - * Will trigger an email to the requested account containing a link with the - * token and tokenId that must be returned to the server using emailConfirm() - * to activate the account. - * - * @memberof userPassProvider - * @instance - * @param {String} email the requested email for the account - * @param {String} password the requested password for the account - * @returns {Promise} - */ - register: function register(email, password) { - var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email: email, password: password })); - fetchArgs.cors = true; + if (!redirectState.ua) { + console.error('StitchClient: no UA value was returned from redirect!'); + return; + } - return fetch(auth.rootUrl + '/' + providerRoute + '/register', fetchArgs).then(common.checkStatus).then(function (response) { - return response.json(); + // If we get here, the state is valid - set auth appropriately. + return _this2.set(redirectState.ua, redirectProvider); + }).then(function () { + return window.history.replaceState(null, '', _this2.pageRootUrl()); }); } - }; -} + }, { + key: 'getCookie', + value: function getCookie(name) { + var splitCookies = document.cookie.split(' '); + for (var i = 0; i < splitCookies.length; i++) { + var cookie = splitCookies[i]; + var sepIdx = cookie.indexOf('='); + var cookieName = cookie.substring(0, sepIdx); + if (cookieName === name) { + var cookieVal = cookie.substring(sepIdx + 1, cookie.length); + if (cookieVal[cookieVal.length - 1] === ';') { + return cookieVal.substring(0, cookie.length - 1); + } + return cookieVal; + } + } + } + }, { + key: 'handleCookie', + value: function handleCookie() { + var _this3 = this; -/** @namespace */ -function apiKeyProvider(auth) { - // The ternary expression here is redundant but is just preserving previous behavior based on whether or not - // the client is for the admin or client API. - var loginRoute = auth.isAppClient() ? 'providers/api-key/login' : 'providers/api-key/login'; + if (typeof window === 'undefined' || typeof document === 'undefined') { + // This means we're running in some environment other + // than a browser - so handling a cookie makes no sense here. + return; + } + if (!document.cookie) { + return; + } - return { - /** - * Login to a stitch application using an api key - * - * @memberof apiKeyProvider - * @instance - * @param {String} key the key for authentication - * @returns {Promise} a promise that resolves when authentication succeeds. - */ - authenticate: function authenticate(key) { - var device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID); - var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ 'key': key, 'options': { device: device } })); - fetchArgs.cors = true; + var uaCookie = this.getCookie(authCommon.USER_AUTH_COOKIE_NAME); + if (!uaCookie) { + return; + } - return fetch(auth.rootUrl + '/' + loginRoute, fetchArgs).then(common.checkStatus).then(function (response) { - return response.json(); - }).then(function (json) { - return auth.set(json); + document.cookie = authCommon.USER_AUTH_COOKIE_NAME + '=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT;'; + var userAuth = this.unmarshallUserAuth(uaCookie); + return this.set(userAuth, _providers.PROVIDER_TYPE_MONGODB_CLOUD).then(function () { + return window.history.replaceState(null, '', _this3.pageRootUrl()); }); } - }; -} + }, { + key: 'clear', + value: function clear() { + this.auth = null; + this.authedId = null; + this.rt = null; + this.loggedInProviderType = null; -// The state we generate is to be used for any kind of request where we will -// complete an authentication flow via a redirect. We store the generate in -// a local storage bound to the app's origin. This ensures that any time we -// receive a redirect, there must be a state parameter and it must match -// what we ourselves have generated. This state MUST only be sent to -// a trusted Stitch endpoint in order to preserve its integrity. Stitch will -// store it in some way on its origin (currently a cookie stored on this client) -// and use that state at the end of an auth flow as a parameter in the redirect URI. -var alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; -function generateState() { - var state = ''; - for (var i = 0; i < 64; ++i) { - state += alpha.charAt(Math.floor(Math.random() * alpha.length)); - } + return Promise.all([this.storage.remove(authCommon.USER_AUTH_KEY), this.storage.remove(authCommon.REFRESH_TOKEN_KEY), this.storage.remove(authCommon.USER_LOGGED_IN_PT_KEY), this.storage.remove(authCommon.STITCH_REDIRECT_PROVIDER)]); + } + }, { + key: 'getDeviceId', + value: function getDeviceId() { + return this.deviceId; + } - return state; -} + // Returns whether or not the access token is expired or is going to expire within 'withinSeconds' + // seconds, according to current system time. Returns false if the token is malformed in any way. + + }, { + key: 'isAccessTokenExpired', + value: function isAccessTokenExpired() { + var withinSeconds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : authCommon.DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS; + + var token = this.getAccessToken(); + if (!token) { + return false; + } + + var decodedToken = void 0; + try { + decodedToken = jwtDecode(token); + } catch (e) { + return false; + } + + if (!decodedToken) { + return false; + } + + return decodedToken.exp && Math.floor(Date.now() / 1000) >= decodedToken.exp - withinSeconds; + } + }, { + key: 'getAccessToken', + value: function getAccessToken() { + return this.auth.accessToken; + } + }, { + key: 'getRefreshToken', + value: function getRefreshToken() { + return this.rt; + } + }, { + key: 'set', + value: function set(json) { + var _this4 = this; -function getOAuthLoginURL(auth, providerName, redirectUrl) { - if (redirectUrl === undefined) { - redirectUrl = auth.pageRootUrl(); - } + var authType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; - var state = generateState(); - auth.storage.set(authCommon.STATE_KEY, state); + if (!json) { + return; + } - var device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID); + var newUserAuth = {}; + var setters = []; - var result = auth.rootUrl + '/providers/oauth2-' + providerName + '/login?redirect=' + encodeURI(redirectUrl) + '&state=' + state + '&device=' + (0, _util.uriEncodeObject)(device); - return result; -} + if (authType) { + this.loggedInProviderType = authType; + setters.push(this.storage.set(authCommon.USER_LOGGED_IN_PT_KEY, authType)); + } -/** @namespace */ -function googleProvider(auth) { - return { - /** - * Login to a stitch application using google authentication - * - * @memberof googleProvider - * @instance - * @param {Object} data the redirectUrl data to use for authentication - * @returns {Promise} a promise that resolves when authentication succeeds. - */ - authenticate: function authenticate(data) { - var redirectUrl = data && data.redirectUrl ? data.redirectUrl : undefined; - window.location.replace(getOAuthLoginURL(auth, 'google', redirectUrl)); - return Promise.resolve(); - } - }; -} + if (json[this.codec.refreshToken]) { + this.rt = json[this.codec.refreshToken]; + delete json[this.codec.refreshToken]; + setters.push(this.storage.set(authCommon.REFRESH_TOKEN_KEY, this.rt)); + } -/** @namespace */ -function facebookProvider(auth) { - return { - /** - * Login to a stitch application using facebook authentication - * - * @memberof facebookProvider - * @instance - * @param {Object} data the redirectUrl data to use for authentication - * @returns {Promise} a promise that resolves when authentication succeeds. - */ - authenticate: function authenticate(data) { - var redirectUrl = data && data.redirectUrl ? data.redirectUrl : undefined; - window.location.replace(getOAuthLoginURL(auth, 'facebook', redirectUrl)); - return Promise.resolve(); - } - }; -} + if (json[this.codec.deviceId]) { + this.deviceId = json[this.codec.deviceId]; + delete json[this.codec.deviceId]; + setters.push(this.storage.set(authCommon.DEVICE_ID_KEY, this.deviceId)); + } -/** @namespace */ -function mongodbCloudProvider(auth) { - // The ternary expression here is redundant but is just preserving previous behavior based on whether or not - // the client is for the admin or client API. - var loginRoute = auth.isAppClient() ? 'providers/mongodb-cloud/login' : 'providers/mongodb-cloud/login'; + // Merge in new fields with old fields. Typically the first json value + // is complete with every field inside a user auth, but subsequent requests + // do not include everything. This merging behavior is safe so long as json + // value responses with absent fields do not indicate that the field should + // be unset. + if (json[this.codec.accessToken]) { + newUserAuth.accessToken = json[this.codec.accessToken]; + } + if (json[this.codec.userId]) { + newUserAuth.userId = json[this.codec.userId]; + } - return { - /** - * Login to a stitch application using mongodb cloud authentication - * - * @memberof mongodbCloudProvider - * @instance - * @param {Object} data the username, apiKey, cors, and cookie data to use for authentication - * @returns {Promise} a promise that resolves when authentication succeeds. - */ - authenticate: function authenticate(data) { - var username = data.username, - apiKey = data.apiKey, - cors = data.cors, - cookie = data.cookie; + this.auth = Object.assign(this.auth ? this.auth : {}, newUserAuth); + this.authedId = this.auth.userId; + setters.push(this.storage.set(authCommon.USER_AUTH_KEY, JSON.stringify(this.auth))); + return Promise.all(setters).then(function () { + return _this4.auth; + }); + } + }, { + key: '_get', + value: function _get() { + var _this5 = this; - var options = Object.assign({}, { cors: true, cookie: false }, { cors: cors, cookie: cookie }); - var device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID); - var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ username: username, apiKey: apiKey, options: { device: device } })); - fetchArgs.cors = true; // TODO: shouldn't this use the passed in `cors` value? - fetchArgs.credentials = 'include'; + return this.storage.get(authCommon.USER_AUTH_KEY).then(function (data) { + if (!data) { + return {}; + } - var url = auth.rootUrl + '/' + loginRoute; - if (options.cookie) { - return fetch(url + '?cookie=true', fetchArgs).then(common.checkStatus); + try { + return JSON.parse(data); + } catch (e) { + // Need to back out and clear auth otherwise we will never + // be able to do anything useful. + return _this5.clear().then(function () { + throw new _errors.StitchError('Failure retrieving stored auth'); + }); + } + }); + } + }, { + key: 'getLoggedInProviderType', + value: function getLoggedInProviderType() { + return this.loggedInProviderType; + } + }, { + key: 'parseRedirectFragment', + value: function parseRedirectFragment(fragment, ourState) { + // After being redirected from oauth, the URL will look like: + // https://todo.examples.stitch.mongodb.com/#_stitch_state=...&_stitch_ua=... + // This function parses out stitch-specific tokens from the fragment and + // builds an object describing the result. + var vars = fragment.split('&'); + var result = { ua: null, found: false, stateValid: false, lastError: null }; + var shouldBreak = false; + for (var i = 0; i < vars.length && !shouldBreak; ++i) { + var pairParts = vars[i].split('='); + var pairKey = decodeURIComponent(pairParts[0]); + switch (pairKey) { + case authCommon.STITCH_ERROR_KEY: + result.lastError = decodeURIComponent(pairParts[1]); + result.found = true; + shouldBreak = true; + break; + case authCommon.USER_AUTH_KEY: + try { + result.ua = this.unmarshallUserAuth(decodeURIComponent(pairParts[1])); + result.found = true; + } catch (e) { + result.lastError = e; + } + continue; + case authCommon.STITCH_LINK_KEY: + result.found = true; + continue; + case authCommon.STATE_KEY: + result.found = true; + var theirState = decodeURIComponent(pairParts[1]); + if (ourState && ourState === theirState) { + result.stateValid = true; + } + continue; + default: + continue; + } } - return fetch(url, fetchArgs).then(common.checkStatus).then(function (response) { - return response.json(); - }).then(function (json) { - return auth.set(json); - }); + return result; } - }; -} + }, { + key: 'unmarshallUserAuth', + value: function unmarshallUserAuth(data) { + var _ref5; -// TODO: support auth-specific options -function createProviders(auth) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var parts = data.split('$'); + if (parts.length !== EMBEDDED_USER_AUTH_DATA_PARTS) { + throw new RangeError('invalid user auth data provided: ' + data); + } - return { - anon: anonProvider(auth), - apiKey: apiKeyProvider(auth), - google: googleProvider(auth), - facebook: facebookProvider(auth), - mongodbCloud: mongodbCloudProvider(auth), - userpass: userPassProvider(auth), - custom: customProvider(auth) - }; -} + return _ref5 = {}, _defineProperty(_ref5, this.codec.accessToken, parts[0]), _defineProperty(_ref5, this.codec.refreshToken, parts[1]), _defineProperty(_ref5, this.codec.userId, parts[2]), _defineProperty(_ref5, this.codec.deviceId, parts[3]), _ref5; + } + }]); -exports.createProviders = createProviders; + return Auth; +}(); /***/ }), -/* 32 */ +/* 33 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -10496,18 +10740,23 @@ exports.createProviders = createProviders; Object.defineProperty(exports, "__esModule", { value: true }); +exports.MemoryStorage = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); exports.createStorage = createStorage; +var _common = __webpack_require__(4); + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var MemoryStorage = function () { +var MemoryStorage = exports.MemoryStorage = function () { function MemoryStorage() { _classCallCheck(this, MemoryStorage); this._data = {}; + this._orderedKeys = []; + this.length = 0; } _createClass(MemoryStorage, [{ @@ -10518,75 +10767,151 @@ var MemoryStorage = function () { }, { key: 'setItem', value: function setItem(key, value) { + this._orderedKeys.push(key); this._data[key] = value; + this.length++; return this._data[key]; } }, { key: 'removeItem', value: function removeItem(key) { + this._orderedKeys.pop(key); delete this._data[key]; + this.length--; return undefined; } }, { - key: 'clear', - value: function clear() { - this._data = {}; - return this._data; + key: 'key', + value: function key(index) { + return this._orderedKeys[index]; } }]); return MemoryStorage; }(); +var _VERSION = 1; +var _VERSION_KEY = '__stitch_storage_version__'; + +/** + * Run a migration on the currently used storage + * that checks to see if the current version is up to date. + * If the version has not been set, this method will migrate + * to the latest version. + * @param {Integer} version version number of storage + * @param {Object} storage storage class being checked + * @returns {Promise} nullable promise containing migration logic + */ +function _runMigration(version, storage) { + switch (version) { + case null: + case undefined: + // return a promise, + // mapping each of the store's keys to a Promise + // that fetches the each value for each key, + // sets the old value to the new "namespaced" key + // remove the old key value pair, + // and set the version number + var migrations = [_common.USER_AUTH_KEY, _common.REFRESH_TOKEN_KEY, _common.DEVICE_ID_KEY, _common.STATE_KEY].map(function (key) { + return Promise.resolve(storage.store.getItem(key)).then(function (item) { + return !!item && storage.store.setItem(storage._generateKey(key), item); + }).then(function () { + return storage.store.removeItem(key); + }); + }); + return Promise.all(migrations).then(function () { + return storage.store.setItem(_VERSION_KEY, _VERSION); + }); + // in future versions, `case 1:`, `case 2:` and so on + // could be added to perform similar migrations + default: + break; + } +} + var Storage = function () { - function Storage(store) { + /** + * @param {Storage} store implementer of Storage interface + * @param {String} namespace clientAppID to be used for namespacing + * @param + */ + function Storage(store, namespace) { + var _this = this; + _classCallCheck(this, Storage); this.store = store; + this.namespace = '_stitch.' + namespace; + + this._migration = Promise.resolve(this.store.getItem(_VERSION_KEY)).then(function (version) { + return _runMigration(version, _this); + }); } _createClass(Storage, [{ + key: '_generateKey', + value: function _generateKey(key) { + return this.namespace + '.' + key; + } + }, { key: 'get', value: function get(key) { - return this.store.getItem(key); + var _this2 = this; + + return Promise.resolve(this._migration).then(function () { + return _this2.store.getItem(_this2._generateKey(key)); + }); } }, { key: 'set', value: function set(key, value) { - return this.store.setItem(key, value); + var _this3 = this; + + return Promise.resolve(this._migration).then(function () { + return _this3.store.setItem(_this3._generateKey(key), value); + }).then(function () { + return value; + }); } }, { key: 'remove', value: function remove(key) { - return this.store.removeItem(key); - } - }, { - key: 'clear', - value: function clear() { - return this.store.clear(); + var _this4 = this; + + return Promise.resolve(this._migration).then(function () { + return _this4.store.removeItem(_this4._generateKey(key)); + }); } }]); return Storage; }(); -function createStorage(type) { - if (type === 'localStorage') { +function createStorage(options) { + var storageType = options.storageType, + storage = options.storage, + namespace = options.namespace; + + + if (storageType === 'localStorage') { if (typeof window !== 'undefined' && 'localStorage' in window && window.localStorage !== null) { - return new Storage(window.localStorage); + return new Storage(window.localStorage, namespace); } - } else if (type === 'sessionStorage') { + } else if (storageType === 'sessionStorage') { if (typeof window !== 'undefined' && 'sessionStorage' in window && window.sessionStorage !== null) { - return new Storage(window.sessionStorage); + return new Storage(window.sessionStorage, namespace); } + } else if (storageType == 'customStorage') { + //eslint-disable-line eqeqeq + return new Storage(storage, namespace); } // default to memory storage - return new Storage(new MemoryStorage()); + return new Storage(new MemoryStorage(), namespace); } /***/ }), -/* 33 */ +/* 34 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -10595,23 +10920,20 @@ function createStorage(type) { Object.defineProperty(exports, "__esModule", { value: true }); -exports.Admin = exports.StitchClient = undefined; +exports.BSON = exports.StitchAdminClientFactory = exports.StitchClientFactory = undefined; -var _client = __webpack_require__(19); +var _client = __webpack_require__(20); -var _client2 = _interopRequireDefault(_client); +var _admin = __webpack_require__(26); -var _admin = __webpack_require__(24); +var _mongodbExtjson = __webpack_require__(21); -var _admin2 = _interopRequireDefault(_admin); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.StitchClient = _client2.default; -exports.Admin = _admin2.default; +exports.StitchClientFactory = _client.StitchClientFactory; +exports.StitchAdminClientFactory = _admin.StitchAdminClientFactory; +exports.BSON = _mongodbExtjson.BSON; /***/ }), -/* 34 */ +/* 35 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -10690,7 +11012,7 @@ exports.default = S3Service; module.exports = exports['default']; /***/ }), -/* 35 */ +/* 36 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -10749,7 +11071,7 @@ exports.default = SESService; module.exports = exports['default']; /***/ }), -/* 36 */ +/* 37 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -10909,7 +11231,7 @@ exports.default = HTTPService; module.exports = exports['default']; /***/ }), -/* 37 */ +/* 38 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -10919,23 +11241,23 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _s3_service = __webpack_require__(34); +var _s3_service = __webpack_require__(35); var _s3_service2 = _interopRequireDefault(_s3_service); -var _ses_service = __webpack_require__(35); +var _ses_service = __webpack_require__(36); var _ses_service2 = _interopRequireDefault(_ses_service); -var _http_service = __webpack_require__(36); +var _http_service = __webpack_require__(37); var _http_service2 = _interopRequireDefault(_http_service); -var _mongodb_service = __webpack_require__(40); +var _mongodb_service = __webpack_require__(41); var _mongodb_service2 = _interopRequireDefault(_mongodb_service); -var _twilio_service = __webpack_require__(41); +var _twilio_service = __webpack_require__(42); var _twilio_service2 = _interopRequireDefault(_twilio_service); @@ -10951,7 +11273,7 @@ exports.default = { module.exports = exports['default']; /***/ }), -/* 38 */ +/* 39 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11092,6 +11414,21 @@ var Collection = function () { return new MongoQuery(this, query, project); } + /** + * Finds one document. + * + * @method + * @param {Object} query The query used to match documents. + * @param {Object} [project] The query document projection. + * @return {Promise} Returns a Promise for the operation + */ + + }, { + key: 'findOne', + value: function findOne(query, project) { + return buildResponse('findOne', this, buildArgs(this, { query: query, project: project })); + } + /** * Executes an aggregation pipeline. * @@ -11206,7 +11543,7 @@ exports.default = Collection; module.exports = exports['default']; /***/ }), -/* 39 */ +/* 40 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11218,7 +11555,7 @@ Object.defineProperty(exports, "__esModule", { var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _collection = __webpack_require__(38); +var _collection = __webpack_require__(39); var _collection2 = _interopRequireDefault(_collection); @@ -11266,7 +11603,7 @@ exports.default = DB; module.exports = exports['default']; /***/ }), -/* 40 */ +/* 41 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11278,7 +11615,7 @@ Object.defineProperty(exports, "__esModule", { var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _db = __webpack_require__(39); +var _db = __webpack_require__(40); var _db2 = _interopRequireDefault(_db); @@ -11326,7 +11663,7 @@ exports.default = MongoDBService; module.exports = exports['default']; /***/ }), -/* 41 */ +/* 42 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11383,17 +11720,6 @@ var TwilioService = function () { exports.default = TwilioService; module.exports = exports['default']; -/***/ }), -/* 42 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var ExtJSON = __webpack_require__(57); - -module.exports = ExtJSON; - /***/ }), /* 43 */ /***/ (function(module, exports, __webpack_require__) { @@ -11746,7 +12072,7 @@ module.exports = { var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var codecs = __webpack_require__(48), - BSON = __webpack_require__(26); + BSON = __webpack_require__(28); var BSONTypes = ['Binary', 'Code', 'DBRef', 'Decimal128', 'Double', 'Int32', 'Long', 'MaxKey', 'MinKey', 'ObjectID', 'BSONRegExp', 'Symbol', 'Timestamp']; @@ -13452,7 +13778,7 @@ function hasOwnProperty(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(17), __webpack_require__(23))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(17), __webpack_require__(25))) /***/ }), /* 73 */ diff --git a/dist/web/stitch.js.map b/dist/web/stitch.js.map index fd3ceda07..d6a9e5884 100644 --- a/dist/web/stitch.js.map +++ b/dist/web/stitch.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap c88e3cc5e72bb6476aac","webpack:///./~/buffer/index.js","webpack:///./~/bson/lib/bson/float_parser.js","webpack:///./src/util.js","webpack:///./~/bson/lib/bson/long.js","webpack:///./~/bson/lib/bson/binary.js","webpack:///./~/bson/lib/bson/code.js","webpack:///./~/bson/lib/bson/db_ref.js","webpack:///./~/bson/lib/bson/decimal128.js","webpack:///./~/bson/lib/bson/double.js","webpack:///./~/bson/lib/bson/max_key.js","webpack:///./~/bson/lib/bson/min_key.js","webpack:///./~/bson/lib/bson/objectid.js","webpack:///./~/bson/lib/bson/regexp.js","webpack:///./~/bson/lib/bson/symbol.js","webpack:///./~/bson/lib/bson/timestamp.js","webpack:///./src/auth/common.js","webpack:///./src/common.js","webpack:///(webpack)/buildin/global.js","webpack:///./~/bson/lib/bson/int_32.js","webpack:///./src/client.js","webpack:///./~/bson/lib/bson/map.js","webpack:///./src/errors.js","webpack:///./~/fetch-everywhere/fetch-npm-browserify.js","webpack:///./~/process/browser.js","webpack:///./src/admin.js","webpack:///./~/Base64/base64.js","webpack:///./~/bson/lib/bson/bson.js","webpack:///./~/bson/lib/bson/parser/calculate_size.js","webpack:///./~/bson/lib/bson/parser/deserializer.js","webpack:///./~/bson/lib/bson/parser/serializer.js","webpack:///./src/auth/index.js","webpack:///./src/auth/providers.js","webpack:///./src/auth/storage.js","webpack:///./src/index.js","webpack:///./src/services/aws/s3_service.js","webpack:///./src/services/aws/ses_service.js","webpack:///./src/services/http/http_service.js","webpack:///./src/services/index.js","webpack:///./src/services/mongodb/collection.js","webpack:///./src/services/mongodb/db.js","webpack:///./src/services/mongodb/mongodb_service.js","webpack:///./src/services/twilio/twilio_service.js","webpack:///./~/mongodb-extjson/index.js","webpack:///./~/mongodb-extjson/lib/bson/binary.js","webpack:///./~/mongodb-extjson/lib/bson/code.js","webpack:///./~/mongodb-extjson/lib/bson/db_ref.js","webpack:///./~/mongodb-extjson/lib/bson/decimal128.js","webpack:///./~/mongodb-extjson/lib/bson/double.js","webpack:///./~/mongodb-extjson/lib/bson/index.js","webpack:///./~/mongodb-extjson/lib/bson/int_32.js","webpack:///./~/mongodb-extjson/lib/bson/long.js","webpack:///./~/mongodb-extjson/lib/bson/max_key.js","webpack:///./~/mongodb-extjson/lib/bson/min_key.js","webpack:///./~/mongodb-extjson/lib/bson/objectid.js","webpack:///./~/mongodb-extjson/lib/bson/regexp.js","webpack:///./~/mongodb-extjson/lib/bson/symbol.js","webpack:///./~/mongodb-extjson/lib/bson/timestamp.js","webpack:///./~/mongodb-extjson/lib/ext_json.js","webpack:///./~/base64-js/index.js","webpack:///./~/detect-browser/browser.js","webpack:///./~/detect-browser/lib/detectBrowser.js","webpack:///./~/detect-browser/lib/detectOS.js","webpack:///./~/ieee754/index.js","webpack:///./~/inherits/inherits_browser.js","webpack:///./~/isarray/index.js","webpack:///./~/jwt-decode/lib/atob.js","webpack:///./~/jwt-decode/lib/base64_url_decode.js","webpack:///./~/jwt-decode/lib/index.js","webpack:///./~/object-assign/index.js","webpack:///./~/query-string/index.js","webpack:///./~/strict-uri-encode/index.js","webpack:///./~/util/support/isBufferBrowser.js","webpack:///./~/util/util.js","webpack:///./~/whatwg-fetch/fetch.js"],"names":["readIEEE754","buffer","offset","endian","mLen","nBytes","e","m","bBE","eLen","eMax","eBias","nBits","i","d","s","NaN","Infinity","Math","pow","writeIEEE754","value","c","rt","abs","isNaN","floor","log","LN2","exports","platform","base64","RESULT_METADATA_KEY","collectMetadata","func","attachMetadata","res","Object","prototype","hasOwnProperty","call","defineProperty","enumerable","configurable","writable","metadata","Promise","resolve","captureMetadata","data","warnings","then","deprecate","fn","msg","alreadyWarned","deprecated","console","warn","apply","arguments","__proto__","serviceResponse","service","serviceName","action","args","client","Error","executeServiceFunction","getPlatform","uriEncodeObject","obj","encodeURIComponent","btoa","JSON","stringify","Long","low","high","_bsontype","low_","high_","toInt","toNumber","TWO_PWR_32_DBL_","getLowBitsUnsigned","toJSON","toString","opt_radix","radix","isZero","isNegative","equals","MIN_VALUE","radixLong","fromNumber","div","rem","multiply","subtract","negate","radixToPower","result","remDiv","intval","digits","length","getHighBits","getLowBits","getNumBitsAbs","val","bit","isOdd","other","notEquals","lessThan","compare","lessThanOrEqual","greaterThan","greaterThanOrEqual","thisNeg","otherNeg","not","add","ONE","a48","a32","a16","a00","b48","b32","b16","b00","c48","c32","c16","c00","fromBits","ZERO","TWO_PWR_24_","NEG_ONE","halfThis","shiftRight","approx","shiftLeft","max","log2","ceil","delta","approxRes","approxRem","modulo","and","or","xor","numBits","shiftRightUnsigned","fromInt","cachedObj","INT_CACHE_","isFinite","TWO_PWR_63_DBL_","MAX_VALUE","lowBits","highBits","fromString","str","charAt","substring","indexOf","size","min","parseInt","power","TWO_PWR_16_DBL_","TWO_PWR_24_DBL_","TWO_PWR_31_DBL_","TWO_PWR_48_DBL_","TWO_PWR_64_DBL_","module","global","Buffer","require","Binary","subType","Number","sub_type","position","BSON_BINARY_SUBTYPE_DEFAULT","Uint8Array","writeStringToArray","BUFFER_SIZE","ArrayBuffer","Array","put","byte_value","decoded_byte","charCodeAt","isBuffer","copy","write","string","read","slice","asRaw","newBuffer","convertArraytoUtf8BinaryString","format","byteArray","startIndex","endIndex","String","fromCharCode","SUBTYPE_DEFAULT","SUBTYPE_FUNCTION","SUBTYPE_BYTE_ARRAY","SUBTYPE_UUID_OLD","SUBTYPE_UUID","SUBTYPE_MD5","SUBTYPE_USER_DEFINED","Code","code","scope","DBRef","namespace","oid","db","PARSE_STRING_REGEXP","PARSE_INF_REGEXP","PARSE_NAN_REGEXP","EXPONENT_MAX","EXPONENT_MIN","EXPONENT_BIAS","MAX_DIGITS","NAN_BUFFER","reverse","INF_NEGATIVE_BUFFER","INF_POSITIVE_BUFFER","EXPONENT_REGEX","isDigit","divideu128","DIVISOR","_rem","parts","quotient","multiply64x2","left","right","leftHigh","leftLow","rightHigh","rightLow","productHigh","productMid","productMid2","productLow","uhleft","uhright","ulleft","ulright","longtoHex","index","int32toHex","Decimal128","bytes","sawRadix","foundNonZero","significantDigits","nDigitsRead","nDigits","radixPosition","firstNonZero","nDigitsStored","digitsInsert","firstDigit","lastDigit","exponent","significandHigh","significandLow","biasedExponent","trim","stringMatch","match","infMatch","nanMatch","undefined","substr","digitsString","join","endOfString","roundDigit","roundBit","dIdx","significand","dec","COMBINATION_MASK","EXPONENT_MASK","COMBINATION_INFINITY","COMBINATION_NAN","COMBINATION_SNAN","midh","midl","combination","biased_exponent","significand_digits","scientific_exponent","is_zero","significand_msb","significand128","j","k","push","least_digits","radix_position","Double","valueOf","MaxKey","MinKey","MACHINE_ID","random","checkForHexRegExp","RegExp","hasBufferType","from","err","ObjectID","id","generate","cacheHexString","__id","valid","isValid","createFromHexString","toHexString","ObjectId","hexTable","hexString","_Buffer","convertToHex","get_inc","getInc","time","Date","now","pid","process","inc","inspect","otherId","toLowerCase","getTimestamp","timestamp","setTime","createPk","createFromTime","encodeLookup","split","decodeLookup","array","n","test","get","set","BSONRegExp","pattern","options","Symbol","Timestamp","radixTimestamp","USER_AUTH_KEY","REFRESH_TOKEN_KEY","DEVICE_ID_KEY","STATE_KEY","IMPERSONATION_ACTIVE_KEY","IMPERSONATION_USER_KEY","IMPERSONATION_REAL_USER_AUTH_KEY","USER_AUTH_COOKIE_NAME","STITCH_ERROR_KEY","STITCH_LINK_KEY","DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS","APP_CLIENT_CODEC","ADMIN_CLIENT_CODEC","JSONTYPE","APP_CLIENT_TYPE","ADMIN_CLIENT_TYPE","DEFAULT_STITCH_SERVER_URL","version","SDK_VERSION","checkStatus","response","status","error","statusText","json","catch","reject","assign","makeFetchArgs","method","body","init","headers","cors","Int32","common","v1","v2","v3","API_TYPE_PUBLIC","API_TYPE_PRIVATE","API_TYPE_CLIENT","API_TYPE_APP","StitchClient","clientAppID","baseUrl","authUrl","rootURLsByAPIVersion","authOptions","codec","authCodec","auth","handleRedirect","handleCookie","authManager","apiKeyAuth","key","authenticate","localAuth","email","password","login","mongodbCloudAuth","username","apiKey","opts","provider","register","providerType","getAccessToken","authedId","_do","refreshOnFailure","useRefreshToken","rootURL","clear","type","name","constructor","ServiceType","_doFunctionCall","request","responseDecoder","parse","strict","responseEncoder","text","resource","apiVersion","apiType","noAuth","isAccessTokenExpired","refreshToken","appURL","url","fetchArgs","token","getRefreshToken","Authorization","queryParams","fetch","error_code","redirectUrl","authWithOAuth","anonymousAuth","Map","_keys","_values","entry","v","delete","splice","entries","self","next","done","forEach","callback","has","keys","values","StitchError","message","captureStackTrace","stack","ErrAuthProviderNotFound","ErrInvalidSession","ErrUnauthorized","Admin","_v3","_get","groupId","api","groupUrl","list","create","query","defaults","_post","app","appId","appUrl","remove","_delete","valueId","valueUrl","update","_put","services","serviceId","runCommand","commandName","config","_patch","rules","rule","ruleId","ruleUrl","incomingWebhooks","incomingWebhook","incomingWebhookId","webhookUrl","pushNotifications","filter","pushNotification","messageId","send","users","user","uid","logout","debug","executeFunction","userId","user_id","executeFunctionSource","source","evalSource","authProviders","authProvider","providerId","enable","disable","security","allowedRequestOrigins","logs","apiKeys","apiKeyId","functions","function","functionId","_v2","apps","pipelines","pipeline","pipelineId","pipelineUrl","setType","dev","executePipeline","isImpersonatingUser","startImpersonation","stopImpersonation","v3do","contentHeader","v2do","deserialize","serializer","calculateObjectSize","MAXSIZE","BSON","serialize","object","checkKeys","serializeFunctions","ignoreUndefined","serializationIndex","finishedBuffer","serializeWithBufferAndIndex","finalBuffer","deserializeStream","numberOfDocuments","documents","docStartIndex","BSON_INT32_MAX","BSON_INT32_MIN","BSON_INT64_MAX","BSON_INT64_MIN","JS_INT_MAX","JS_INT_MIN","JS_INT_MAX_LONG","JS_INT_MIN_LONG","BSON_DATA_NUMBER","BSON_DATA_STRING","BSON_DATA_OBJECT","BSON_DATA_ARRAY","BSON_DATA_BINARY","BSON_DATA_OID","BSON_DATA_BOOLEAN","BSON_DATA_DATE","BSON_DATA_NULL","BSON_DATA_REGEXP","BSON_DATA_CODE","BSON_DATA_SYMBOL","BSON_DATA_CODE_W_SCOPE","BSON_DATA_INT","BSON_DATA_TIMESTAMP","BSON_DATA_LONG","BSON_DATA_MIN_KEY","BSON_DATA_MAX_KEY","BSON_BINARY_SUBTYPE_FUNCTION","BSON_BINARY_SUBTYPE_BYTE_ARRAY","BSON_BINARY_SUBTYPE_UUID","BSON_BINARY_SUBTYPE_MD5","BSON_BINARY_SUBTYPE_USER_DEFINED","isDate","totalLength","isArray","calculateElement","toBSON","byteLength","ordered_values","ignoreCase","multiline","f","deserializeObject","evalFunctions","cacheFunctions","cacheFunctionsCrc32","fieldsAsRaw","raw","bsonRegExp","promoteBuffers","promoteLongs","promoteValues","arrayIndex","elementType","stringSize","readDoubleLE","_index","objectSize","arrayOptions","stopIndex","BSON_DATA_UNDEFINED","long","BSON_DATA_DECIMAL128","decimal128","toObject","binarySize","totalBinarySize","_buffer","regExpOptions","optionsArray","functionString","hash","crc32","isolateEvalWithHash","functionCache","isolateEval","totalSize","scopeObject","BSON_DATA_DBPOINTER","oidBuffer","shift","collection","eval","bind","regexp","isRegExp","serializeString","numberOfWrittenBytes","serializeNumber","longVal","serializeNull","serializeBoolean","serializeDate","dateInMilis","getTime","serializeRegExp","serializeBSONRegExp","sort","serializeMinMax","serializeObjectId","serializeBuffer","serializeObject","depth","path","serializeInto","pop","serializeDecimal128","serializeLong","serializeInt32","serializeDouble","serializeFunction","serializeCode","codeSize","serializeBinary","serializeSymbol","serializeDBRef","startingIndex","iterator","authCommon","jwtDecode","EMBEDDED_USER_AUTH_DATA_PARTS","Auth","rootUrl","storageType","storage","providers","refreshImpersonation","doSessionPost","window","location","protocol","host","pathname","_error","ourState","redirectFragment","redirectState","parseRedirectFragment","lastError","history","replaceState","pageRootUrl","found","stateValid","ua","splitCookies","document","cookie","sepIdx","cookieName","cookieVal","uaCookie","getCookie","userAuth","unmarshallUserAuth","clearImpersonation","withinSeconds","decodedToken","exp","accessToken","deviceId","newUserAuth","realUserAuth","fragment","vars","shouldBreak","pairParts","pairKey","decodeURIComponent","theirState","RangeError","getDeviceInfo","appVersion","deviceInfo","sdkVersion","platformVersion","anonProvider","device","getDeviceId","customProvider","providerRoute","loginRoute","userPassProvider","isAppClient","emailConfirm","tokenId","sendEmailConfirm","sendPasswordReset","passwordReset","apiKeyProvider","alpha","generateState","state","getOAuthLoginURL","providerName","encodeURI","googleProvider","replace","facebookProvider","mongodbCloudProvider","credentials","createProviders","anon","google","facebook","mongodbCloud","userpass","custom","createStorage","MemoryStorage","_data","Storage","store","getItem","setItem","removeItem","localStorage","sessionStorage","S3Service","stitchClient","bucket","acl","contentType","SESService","to","subject","HTTPService","urlOrOptions","buildResponse","buildArgs","Collection","doc","docs","updateOp","project","MongoQuery","aggregateOp","outgoingOptions","limit","count","isMulti","upsert","findOp","database","execute","DB","MongoDBService","databaseName","TwilioService","ExtJSON","convert","integer","toExtendedJSON","base64String","$binary","fromExtendedJSON","$code","$scope","o","$ref","$id","$db","fields","$numberDecimal","relaxed","$numberDouble","parseFloat","$numberInt","$numberLong","$maxKey","$minKey","$oid","$regularExpression","$symbol","$timestamp","t","codecs","BSONTypes","setBSONModule","keysToCodecs","deserializeValue","int32Range","int64Range","$undefined","startsWith","$date","date","$dbPointer","dollarKeys","reducer","indents","serializeArray","serializeDocument","map","serializeValue","getISOString","isoStr","toISOString","getUTCMilliseconds","dateNum","inRange","tempScope","tempDoc","tempId","_doc","tempVal"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,mDAAmD;AACxE;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,UAAU;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,uCAAuC,SAAS;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;;AAEA;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gDAAgD,EAAE;AAClD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAwB,eAAe;AACvC;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,wBAAwB,QAAQ;AAChC;AACA,qBAAqB,eAAe;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,mBAAmB,cAAc;AACjC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uDAAuD,OAAO;AAC9D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA,uDAAuD,OAAO;AAC9D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,qBAAqB,QAAQ;AAC7B;AACA;AACA,GAAG;AACH;AACA,eAAe,SAAS;AACxB;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,YAAY;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,iBAAiB,gBAAgB;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,gBAAgB;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;;AC5vDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAIA,cAAc,SAAdA,WAAc,CAASC,MAAT,EAAiBC,MAAjB,EAAyBC,MAAzB,EAAiCC,IAAjC,EAAuCC,MAAvC,EAA+C;AAC/D,MAAIC,CAAJ;AAAA,MAAOC,CAAP;AAAA,MACIC,MAAOL,WAAW,KADtB;AAAA,MAEIM,OAAOJ,SAAS,CAAT,GAAaD,IAAb,GAAoB,CAF/B;AAAA,MAGIM,OAAO,CAAC,KAAKD,IAAN,IAAc,CAHzB;AAAA,MAIIE,QAAQD,QAAQ,CAJpB;AAAA,MAKIE,QAAQ,CAAC,CALb;AAAA,MAMIC,IAAIL,MAAM,CAAN,GAAWH,SAAS,CAN5B;AAAA,MAOIS,IAAIN,MAAM,CAAN,GAAU,CAAC,CAPnB;AAAA,MAQIO,IAAId,OAAOC,SAASW,CAAhB,CARR;;AAUAA,OAAKC,CAA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AAb,EAAwB;AACtB,YAAKhE,IAAL,GAAYA,IAAZ;AACD;;AAED,QAAI,OAAO1J,MAAMya,iBAAb,KAAmC,UAAvC,EAAmD;AACjDza,YAAMya,iBAAN,QAA8B,MAAK7C,WAAnC;AACD,KAFD,MAEO;AACL,YAAK8C,KAAL,GAAc,IAAI1a,KAAJ,CAAUwa,OAAV,CAAD,CAAqBE,KAAlC;AACD;AAZwB;AAa1B;;;qBAduB1a,K;;AAiB1B,IAAM2a,0BAA0B,sBAAhC;AACA,IAAMC,oBAAoB,gBAA1B;AACA,IAAMC,kBAAkB,cAAxB;;QAIEN,W,GAAAA,W;QACAI,uB,GAAAA,uB;QACAC,iB,GAAAA,iB;QACAC,e,GAAAA,e;;;;;;ACnCF;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACNA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;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AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0CAA0C,UAAU;AACpD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;;;;;;ACjHA;;AAEA;;AAEA;AACA;AACA;;AAEA;;;;;;;ACRA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA,oBAAoB;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;;;;;;AC1CA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;;;;;;AC/GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,QAAQ,WAAW;;AAEnB;AACA;AACA;AACA,QAAQ,WAAW;;AAEnB;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA,QAAQ,WAAW;;AAEnB;AACA;AACA,QAAQ,UAAU;;AAElB;AACA;;;;;;;ACnFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACtBA,iBAAiB;;AAEjB;AACA;AACA;;;;;;;ACJA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;;;;;ACrCA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;;;;;;;;AChCA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;;;;;;;;ACzBA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH,kCAAkC;AAClC;AACA;AACA;;AAEA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,gBAAgB,sBAAsB;AACtC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;ACzFA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,sBAAsB,oBAAoB;;AAE1C;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,IAAI;;AAEJ;AACA;;AAEA;AACA,EAAE;AACF;AACA,EAAE;AACF;;;;;;;;AC5MA;AACA;AACA;AACA;AACA,EAAE;AACF;;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA,C;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,sBAAsB;AACzC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,uBAAuB,SAAS;AAChC;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,4CAA4C,KAAK;;AAEjD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA;AACA,mCAAmC,OAAO;AAC1C;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;;AAGA;AACA;AACA,yDAAyD;AACzD;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA,WAAW;AACX;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA,WAAW,SAAS;AACpB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;ACzkBA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wCAAwC,mBAAmB;AAC3D;AACA;;AAEA;AACA;AACA,kCAAkC,oBAAoB;AACtD;AACA;;AAEA;AACA;AACA,wCAAwC,4BAA4B;AACpE;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA,uDAAuD;AACvD,SAAS;AACT;AACA,SAAS;AACT,8EAA8E;AAC9E;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,8BAA8B,uBAAuB;AACrD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA,uCAAuC,0BAA0B;AACjE;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,+BAA+B,0BAA0B,eAAe;AACxE;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,OAAO;;AAEP;AACA,KAAK;AACL;AACA;AACA,CAAC","file":"stitch.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"stitch\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"stitch\"] = factory();\n\telse\n\t\troot[\"stitch\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \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 \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\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.l = 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// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 33);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap c88e3cc5e72bb6476aac","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/buffer/index.js\n// module id = 0\n// module chunks = 0","// Copyright (c) 2008, Fair Oaks Labs, Inc.\n// All rights reserved.\n// \n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are met:\n// \n// * Redistributions of source code must retain the above copyright notice,\n// this list of conditions and the following disclaimer.\n// \n// * Redistributions in binary form must reproduce the above copyright notice,\n// this list of conditions and the following disclaimer in the documentation\n// and/or other materials provided with the distribution.\n// \n// * Neither the name of Fair Oaks Labs, Inc. nor the names of its contributors\n// may be used to endorse or promote products derived from this software\n// without specific prior written permission.\n// \n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n// POSSIBILITY OF SUCH DAMAGE.\n//\n//\n// Modifications to writeIEEE754 to support negative zeroes made by Brian White\n\nvar readIEEE754 = function(buffer, offset, endian, mLen, nBytes) {\n var e, m,\n bBE = (endian === 'big'),\n eLen = nBytes * 8 - mLen - 1,\n eMax = (1 << eLen) - 1,\n eBias = eMax >> 1,\n nBits = -7,\n i = bBE ? 0 : (nBytes - 1),\n d = bBE ? 1 : -1,\n s = buffer[offset + i];\n\n i += d;\n\n e = s & ((1 << (-nBits)) - 1);\n s >>= (-nBits);\n nBits += eLen;\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8);\n\n m = e & ((1 << (-nBits)) - 1);\n e >>= (-nBits);\n nBits += mLen;\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8);\n\n if (e === 0) {\n e = 1 - eBias;\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity);\n } else {\n m = m + Math.pow(2, mLen);\n e = e - eBias;\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen);\n};\n\nvar writeIEEE754 = function(buffer, value, offset, endian, mLen, nBytes) {\n var e, m, c,\n bBE = (endian === 'big'),\n eLen = nBytes * 8 - mLen - 1,\n eMax = (1 << eLen) - 1,\n eBias = eMax >> 1,\n rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),\n i = bBE ? (nBytes-1) : 0,\n d = bBE ? -1 : 1,\n s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;\n\n value = Math.abs(value);\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0;\n e = eMax;\n } else {\n e = Math.floor(Math.log(value) / Math.LN2);\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--;\n c *= 2;\n }\n if (e+eBias >= 1) {\n value += rt / c;\n } else {\n value += rt * Math.pow(2, 1 - eBias);\n }\n if (value * c >= 2) {\n e++;\n c /= 2;\n }\n\n if (e + eBias >= eMax) {\n m = 0;\n e = eMax;\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen);\n e = e + eBias;\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);\n e = 0;\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8);\n\n e = (e << mLen) | m;\n eLen += mLen;\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8);\n\n buffer[offset + i - d] |= s * 128;\n};\n\nexports.readIEEE754 = readIEEE754;\nexports.writeIEEE754 = writeIEEE754;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/float_parser.js","import * as platform from 'detect-browser';\nimport * as base64 from 'Base64';\n\nconst RESULT_METADATA_KEY = '_stitch_metadata';\n\n/** @namespace util */\n\n/**\n * Utility which creates a function that extracts metadata\n * from the server in the response to a pipeline request,\n * and attaches it to the final result after the finalizer has been applied.\n *\n * @memberof util\n * @param {Function} [func] optional finalizer to transform the response data\n */\nexport const collectMetadata = (func) => {\n const attachMetadata = metadata => (res) => {\n if (typeof res === 'object' && !Object.prototype.hasOwnProperty.call(res, RESULT_METADATA_KEY)) {\n Object.defineProperty(\n res,\n RESULT_METADATA_KEY,\n {enumerable: false, configurable: false, writable: false, value: metadata}\n );\n }\n return Promise.resolve(res);\n };\n const captureMetadata = (data) => {\n let metadata = {};\n if (data.warnings) {\n // Metadata is not yet attached to result, grab any data that needs to be added.\n metadata.warnings = data.warnings;\n }\n if (!func) {\n return Promise.resolve(data).then(attachMetadata(metadata));\n }\n return Promise.resolve(data).then(func).then(attachMetadata(metadata));\n };\n return captureMetadata;\n};\n\n/**\n * Utility function for displaying deprecation notices\n *\n * @memberof util\n * @param {Function} fn the function to deprecate\n * @param {String} msg the message to display to the user regarding deprecation\n */\nfunction deprecate(fn, msg) {\n let alreadyWarned = false;\n function deprecated() {\n if (!alreadyWarned) {\n alreadyWarned = true;\n console.warn('DeprecationWarning: ' + msg);\n }\n\n return fn.apply(this, arguments);\n }\n\n deprecated.__proto__ = fn; // eslint-disable-line\n if (fn.prototype) {\n deprecated.prototype = fn.prototype;\n }\n\n return deprecated;\n}\n\n/**\n * Utility method for executing a service action as a function call.\n *\n * @memberof util\n * @param {Object} service the service to execute the action on\n * @param {String} action the service action to execute\n * @param {Array} args the arguments to supply to the service action invocation\n * @returns {Promise} the API response from the executed service action\n */\nfunction serviceResponse(service, { serviceName = service.serviceName, action, args }) {\n const { client } = service;\n\n if (!client) {\n throw new Error('Service has no client');\n }\n\n return client.executeServiceFunction(serviceName, action, args);\n}\n\n/**\n * Utility function to get the platform.\n *\n * @memberof util\n * @returns {Object} An object of the form {name: ..., version: ...}, or null\n */\nfunction getPlatform() {\n return platform ? platform : null;\n}\n\n/**\n * Utility function to encode a JSON object into a valid string that can be\n * inserted in a URI. The object is first stringified, then encoded in base64,\n * and finally encoded via the builtin encodeURIComponent function.\n *\n * @memberof util\n * @param {Object} obj The object to encode\n * @returns {String} The encoded object\n */\nfunction uriEncodeObject(obj) {\n return encodeURIComponent(base64.btoa(JSON.stringify(obj)));\n}\n\nexport {\n deprecate,\n serviceResponse,\n getPlatform,\n uriEncodeObject\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/util.js","// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n// Copyright 2009 Google Inc. All Rights Reserved\n\n/**\n * Defines a Long class for representing a 64-bit two's-complement\n * integer value, which faithfully simulates the behavior of a Java \"Long\". This\n * implementation is derived from LongLib in GWT.\n *\n * Constructs a 64-bit two's-complement integer, given its low and high 32-bit\n * values as *signed* integers. See the from* functions below for more\n * convenient ways of constructing Longs.\n *\n * The internal representation of a Long is the two given signed, 32-bit values.\n * We use 32-bit pieces because these are the size of integers on which\n * Javascript performs bit-operations. For operations like addition and\n * multiplication, we split each number into 16-bit pieces, which can easily be\n * multiplied within Javascript's floating-point representation without overflow\n * or change in sign.\n *\n * In the algorithms below, we frequently reduce the negative case to the\n * positive case by negating the input(s) and then post-processing the result.\n * Note that we must ALWAYS check specially whether those values are MIN_VALUE\n * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\n * a positive number, it overflows back into a negative). Not handling this\n * case would often result in infinite recursion.\n *\n * @class\n * @param {number} low the low (signed) 32 bits of the Long.\n * @param {number} high the high (signed) 32 bits of the Long.\n * @return {Long}\n */\nfunction Long(low, high) {\n if(!(this instanceof Long)) return new Long(low, high);\n \n this._bsontype = 'Long';\n /**\n * @type {number}\n * @ignore\n */\n this.low_ = low | 0; // force into 32 signed bits.\n\n /**\n * @type {number}\n * @ignore\n */\n this.high_ = high | 0; // force into 32 signed bits.\n};\n\n/**\n * Return the int value.\n *\n * @method\n * @return {number} the value, assuming it is a 32-bit integer.\n */\nLong.prototype.toInt = function() {\n return this.low_;\n};\n\n/**\n * Return the Number value.\n *\n * @method\n * @return {number} the closest floating-point representation to this value.\n */\nLong.prototype.toNumber = function() {\n return this.high_ * Long.TWO_PWR_32_DBL_ +\n this.getLowBitsUnsigned();\n};\n\n/**\n * Return the JSON value.\n *\n * @method\n * @return {string} the JSON representation.\n */\nLong.prototype.toJSON = function() {\n return this.toString();\n}\n\n/**\n * Return the String value.\n *\n * @method\n * @param {number} [opt_radix] the radix in which the text should be written.\n * @return {string} the textual representation of this value.\n */\nLong.prototype.toString = function(opt_radix) {\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (this.isZero()) {\n return '0';\n }\n\n if (this.isNegative()) {\n if (this.equals(Long.MIN_VALUE)) {\n // We need to change the Long value before it can be negated, so we remove\n // the bottom-most digit in this base and then recurse to do the rest.\n var radixLong = Long.fromNumber(radix);\n var div = this.div(radixLong);\n var rem = div.multiply(radixLong).subtract(this);\n return div.toString(radix) + rem.toInt().toString(radix);\n } else {\n return '-' + this.negate().toString(radix);\n }\n }\n\n // Do several (6) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Long.fromNumber(Math.pow(radix, 6));\n\n var rem = this;\n var result = '';\n while (true) {\n var remDiv = rem.div(radixToPower);\n var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt();\n var digits = intval.toString(radix);\n\n rem = remDiv;\n if (rem.isZero()) {\n return digits + result;\n } else {\n while (digits.length < 6) {\n digits = '0' + digits;\n }\n result = '' + digits + result;\n }\n }\n};\n\n/**\n * Return the high 32-bits value.\n *\n * @method\n * @return {number} the high 32-bits as a signed value.\n */\nLong.prototype.getHighBits = function() {\n return this.high_;\n};\n\n/**\n * Return the low 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as a signed value.\n */\nLong.prototype.getLowBits = function() {\n return this.low_;\n};\n\n/**\n * Return the low unsigned 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as an unsigned value.\n */\nLong.prototype.getLowBitsUnsigned = function() {\n return (this.low_ >= 0) ?\n this.low_ : Long.TWO_PWR_32_DBL_ + this.low_;\n};\n\n/**\n * Returns the number of bits needed to represent the absolute value of this Long.\n *\n * @method\n * @return {number} Returns the number of bits needed to represent the absolute value of this Long.\n */\nLong.prototype.getNumBitsAbs = function() {\n if (this.isNegative()) {\n if (this.equals(Long.MIN_VALUE)) {\n return 64;\n } else {\n return this.negate().getNumBitsAbs();\n }\n } else {\n var val = this.high_ != 0 ? this.high_ : this.low_;\n for (var bit = 31; bit > 0; bit--) {\n if ((val & (1 << bit)) != 0) {\n break;\n }\n }\n return this.high_ != 0 ? bit + 33 : bit + 1;\n }\n};\n\n/**\n * Return whether this value is zero.\n *\n * @method\n * @return {boolean} whether this value is zero.\n */\nLong.prototype.isZero = function() {\n return this.high_ == 0 && this.low_ == 0;\n};\n\n/**\n * Return whether this value is negative.\n *\n * @method\n * @return {boolean} whether this value is negative.\n */\nLong.prototype.isNegative = function() {\n return this.high_ < 0;\n};\n\n/**\n * Return whether this value is odd.\n *\n * @method\n * @return {boolean} whether this value is odd.\n */\nLong.prototype.isOdd = function() {\n return (this.low_ & 1) == 1;\n};\n\n/**\n * Return whether this Long equals the other\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long equals the other\n */\nLong.prototype.equals = function(other) {\n return (this.high_ == other.high_) && (this.low_ == other.low_);\n};\n\n/**\n * Return whether this Long does not equal the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long does not equal the other.\n */\nLong.prototype.notEquals = function(other) {\n return (this.high_ != other.high_) || (this.low_ != other.low_);\n};\n\n/**\n * Return whether this Long is less than the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is less than the other.\n */\nLong.prototype.lessThan = function(other) {\n return this.compare(other) < 0;\n};\n\n/**\n * Return whether this Long is less than or equal to the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is less than or equal to the other.\n */\nLong.prototype.lessThanOrEqual = function(other) {\n return this.compare(other) <= 0;\n};\n\n/**\n * Return whether this Long is greater than the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is greater than the other.\n */\nLong.prototype.greaterThan = function(other) {\n return this.compare(other) > 0;\n};\n\n/**\n * Return whether this Long is greater than or equal to the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is greater than or equal to the other.\n */\nLong.prototype.greaterThanOrEqual = function(other) {\n return this.compare(other) >= 0;\n};\n\n/**\n * Compares this Long with the given one.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater.\n */\nLong.prototype.compare = function(other) {\n if (this.equals(other)) {\n return 0;\n }\n\n var thisNeg = this.isNegative();\n var otherNeg = other.isNegative();\n if (thisNeg && !otherNeg) {\n return -1;\n }\n if (!thisNeg && otherNeg) {\n return 1;\n }\n\n // at this point, the signs are the same, so subtraction will not overflow\n if (this.subtract(other).isNegative()) {\n return -1;\n } else {\n return 1;\n }\n};\n\n/**\n * The negation of this value.\n *\n * @method\n * @return {Long} the negation of this value.\n */\nLong.prototype.negate = function() {\n if (this.equals(Long.MIN_VALUE)) {\n return Long.MIN_VALUE;\n } else {\n return this.not().add(Long.ONE);\n }\n};\n\n/**\n * Returns the sum of this and the given Long.\n *\n * @method\n * @param {Long} other Long to add to this one.\n * @return {Long} the sum of this and the given Long.\n */\nLong.prototype.add = function(other) {\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 + b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 + b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 + b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 + b48;\n c48 &= 0xFFFF;\n return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32);\n};\n\n/**\n * Returns the difference of this and the given Long.\n *\n * @method\n * @param {Long} other Long to subtract from this.\n * @return {Long} the difference of this and the given Long.\n */\nLong.prototype.subtract = function(other) {\n return this.add(other.negate());\n};\n\n/**\n * Returns the product of this and the given Long.\n *\n * @method\n * @param {Long} other Long to multiply with this.\n * @return {Long} the product of this and the other.\n */\nLong.prototype.multiply = function(other) {\n if (this.isZero()) {\n return Long.ZERO;\n } else if (other.isZero()) {\n return Long.ZERO;\n }\n\n if (this.equals(Long.MIN_VALUE)) {\n return other.isOdd() ? Long.MIN_VALUE : Long.ZERO;\n } else if (other.equals(Long.MIN_VALUE)) {\n return this.isOdd() ? Long.MIN_VALUE : Long.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().multiply(other.negate());\n } else {\n return this.negate().multiply(other).negate();\n }\n } else if (other.isNegative()) {\n return this.multiply(other.negate()).negate();\n }\n\n // If both Longs are small, use float multiplication\n if (this.lessThan(Long.TWO_PWR_24_) &&\n other.lessThan(Long.TWO_PWR_24_)) {\n return Long.fromNumber(this.toNumber() * other.toNumber());\n }\n\n // Divide each Long into 4 chunks of 16 bits, and then add up 4x4 products.\n // We can skip products that would overflow.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 * b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 * b00;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c16 += a00 * b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 * b00;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a16 * b16;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a00 * b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\n c48 &= 0xFFFF;\n return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32);\n};\n\n/**\n * Returns this Long divided by the given one.\n *\n * @method\n * @param {Long} other Long by which to divide.\n * @return {Long} this Long divided by the given one.\n */\nLong.prototype.div = function(other) {\n if (other.isZero()) {\n throw Error('division by zero');\n } else if (this.isZero()) {\n return Long.ZERO;\n }\n\n if (this.equals(Long.MIN_VALUE)) {\n if (other.equals(Long.ONE) ||\n other.equals(Long.NEG_ONE)) {\n return Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\n } else if (other.equals(Long.MIN_VALUE)) {\n return Long.ONE;\n } else {\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\n var halfThis = this.shiftRight(1);\n var approx = halfThis.div(other).shiftLeft(1);\n if (approx.equals(Long.ZERO)) {\n return other.isNegative() ? Long.ONE : Long.NEG_ONE;\n } else {\n var rem = this.subtract(other.multiply(approx));\n var result = approx.add(rem.div(other));\n return result;\n }\n }\n } else if (other.equals(Long.MIN_VALUE)) {\n return Long.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().div(other.negate());\n } else {\n return this.negate().div(other).negate();\n }\n } else if (other.isNegative()) {\n return this.div(other.negate()).negate();\n }\n\n // Repeat the following until the remainder is less than other: find a\n // floating-point that approximates remainder / other *from below*, add this\n // into the result, and subtract it from the remainder. It is critical that\n // the approximate value is less than or equal to the real value so that the\n // remainder never becomes negative.\n var res = Long.ZERO;\n var rem = this;\n while (rem.greaterThanOrEqual(other)) {\n // Approximate the result of division. This may be a little greater or\n // smaller than the actual value.\n var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber()));\n\n // We will tweak the approximate result by changing it in the 48-th digit or\n // the smallest non-fractional digit, whichever is larger.\n var log2 = Math.ceil(Math.log(approx) / Math.LN2);\n var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48);\n\n // Decrease the approximation until it is smaller than the remainder. Note\n // that if it is too large, the product overflows and is negative.\n var approxRes = Long.fromNumber(approx);\n var approxRem = approxRes.multiply(other);\n while (approxRem.isNegative() || approxRem.greaterThan(rem)) {\n approx -= delta;\n approxRes = Long.fromNumber(approx);\n approxRem = approxRes.multiply(other);\n }\n\n // We know the answer can't be zero... and actually, zero would cause\n // infinite recursion since we would make no progress.\n if (approxRes.isZero()) {\n approxRes = Long.ONE;\n }\n\n res = res.add(approxRes);\n rem = rem.subtract(approxRem);\n }\n return res;\n};\n\n/**\n * Returns this Long modulo the given one.\n *\n * @method\n * @param {Long} other Long by which to mod.\n * @return {Long} this Long modulo the given one.\n */\nLong.prototype.modulo = function(other) {\n return this.subtract(this.div(other).multiply(other));\n};\n\n/**\n * The bitwise-NOT of this value.\n *\n * @method\n * @return {Long} the bitwise-NOT of this value.\n */\nLong.prototype.not = function() {\n return Long.fromBits(~this.low_, ~this.high_);\n};\n\n/**\n * Returns the bitwise-AND of this Long and the given one.\n *\n * @method\n * @param {Long} other the Long with which to AND.\n * @return {Long} the bitwise-AND of this and the other.\n */\nLong.prototype.and = function(other) {\n return Long.fromBits(this.low_ & other.low_, this.high_ & other.high_);\n};\n\n/**\n * Returns the bitwise-OR of this Long and the given one.\n *\n * @method\n * @param {Long} other the Long with which to OR.\n * @return {Long} the bitwise-OR of this and the other.\n */\nLong.prototype.or = function(other) {\n return Long.fromBits(this.low_ | other.low_, this.high_ | other.high_);\n};\n\n/**\n * Returns the bitwise-XOR of this Long and the given one.\n *\n * @method\n * @param {Long} other the Long with which to XOR.\n * @return {Long} the bitwise-XOR of this and the other.\n */\nLong.prototype.xor = function(other) {\n return Long.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_);\n};\n\n/**\n * Returns this Long with bits shifted to the left by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Long} this shifted to the left by the given amount.\n */\nLong.prototype.shiftLeft = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var low = this.low_;\n if (numBits < 32) {\n var high = this.high_;\n return Long.fromBits(\n low << numBits,\n (high << numBits) | (low >>> (32 - numBits)));\n } else {\n return Long.fromBits(0, low << (numBits - 32));\n }\n }\n};\n\n/**\n * Returns this Long with bits shifted to the right by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Long} this shifted to the right by the given amount.\n */\nLong.prototype.shiftRight = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Long.fromBits(\n (low >>> numBits) | (high << (32 - numBits)),\n high >> numBits);\n } else {\n return Long.fromBits(\n high >> (numBits - 32),\n high >= 0 ? 0 : -1);\n }\n }\n};\n\n/**\n * Returns this Long with bits shifted to the right by the given amount, with the new top bits matching the current sign bit.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Long} this shifted to the right by the given amount, with zeros placed into the new leading bits.\n */\nLong.prototype.shiftRightUnsigned = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Long.fromBits(\n (low >>> numBits) | (high << (32 - numBits)),\n high >>> numBits);\n } else if (numBits == 32) {\n return Long.fromBits(high, 0);\n } else {\n return Long.fromBits(high >>> (numBits - 32), 0);\n }\n }\n};\n\n/**\n * Returns a Long representing the given (32-bit) integer value.\n *\n * @method\n * @param {number} value the 32-bit integer in question.\n * @return {Long} the corresponding Long value.\n */\nLong.fromInt = function(value) {\n if (-128 <= value && value < 128) {\n var cachedObj = Long.INT_CACHE_[value];\n if (cachedObj) {\n return cachedObj;\n }\n }\n\n var obj = new Long(value | 0, value < 0 ? -1 : 0);\n if (-128 <= value && value < 128) {\n Long.INT_CACHE_[value] = obj;\n }\n return obj;\n};\n\n/**\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n *\n * @method\n * @param {number} value the number in question.\n * @return {Long} the corresponding Long value.\n */\nLong.fromNumber = function(value) {\n if (isNaN(value) || !isFinite(value)) {\n return Long.ZERO;\n } else if (value <= -Long.TWO_PWR_63_DBL_) {\n return Long.MIN_VALUE;\n } else if (value + 1 >= Long.TWO_PWR_63_DBL_) {\n return Long.MAX_VALUE;\n } else if (value < 0) {\n return Long.fromNumber(-value).negate();\n } else {\n return new Long(\n (value % Long.TWO_PWR_32_DBL_) | 0,\n (value / Long.TWO_PWR_32_DBL_) | 0);\n }\n};\n\n/**\n * Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits.\n *\n * @method\n * @param {number} lowBits the low 32-bits.\n * @param {number} highBits the high 32-bits.\n * @return {Long} the corresponding Long value.\n */\nLong.fromBits = function(lowBits, highBits) {\n return new Long(lowBits, highBits);\n};\n\n/**\n * Returns a Long representation of the given string, written using the given radix.\n *\n * @method\n * @param {string} str the textual representation of the Long.\n * @param {number} opt_radix the radix in which the text is written.\n * @return {Long} the corresponding Long value.\n */\nLong.fromString = function(str, opt_radix) {\n if (str.length == 0) {\n throw Error('number format error: empty string');\n }\n\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (str.charAt(0) == '-') {\n return Long.fromString(str.substring(1), radix).negate();\n } else if (str.indexOf('-') >= 0) {\n throw Error('number format error: interior \"-\" character: ' + str);\n }\n\n // Do several (8) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Long.fromNumber(Math.pow(radix, 8));\n\n var result = Long.ZERO;\n for (var i = 0; i < str.length; i += 8) {\n var size = Math.min(8, str.length - i);\n var value = parseInt(str.substring(i, i + size), radix);\n if (size < 8) {\n var power = Long.fromNumber(Math.pow(radix, size));\n result = result.multiply(power).add(Long.fromNumber(value));\n } else {\n result = result.multiply(radixToPower);\n result = result.add(Long.fromNumber(value));\n }\n }\n return result;\n};\n\n// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the\n// from* methods on which they depend.\n\n\n/**\n * A cache of the Long representations of small integer values.\n * @type {Object}\n * @ignore\n */\nLong.INT_CACHE_ = {};\n\n// NOTE: the compiler should inline these constant values below and then remove\n// these variables, so there should be no runtime penalty for these.\n\n/**\n * Number used repeated below in calculations. This must appear before the\n * first call to any from* function below.\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_16_DBL_ = 1 << 16;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_24_DBL_ = 1 << 24;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_32_DBL_ = Long.TWO_PWR_16_DBL_ * Long.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_31_DBL_ = Long.TWO_PWR_32_DBL_ / 2;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_48_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_64_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_32_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_63_DBL_ = Long.TWO_PWR_64_DBL_ / 2;\n\n/** @type {Long} */\nLong.ZERO = Long.fromInt(0);\n\n/** @type {Long} */\nLong.ONE = Long.fromInt(1);\n\n/** @type {Long} */\nLong.NEG_ONE = Long.fromInt(-1);\n\n/** @type {Long} */\nLong.MAX_VALUE =\n Long.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0);\n\n/** @type {Long} */\nLong.MIN_VALUE = Long.fromBits(0, 0x80000000 | 0);\n\n/**\n * @type {Long}\n * @ignore\n */\nLong.TWO_PWR_24_ = Long.fromInt(1 << 24);\n\n/**\n * Expose.\n */\nmodule.exports = Long;\nmodule.exports.Long = Long;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/long.js","/**\n * Module dependencies.\n * @ignore\n */\n\n// Test if we're in Node via presence of \"global\" not absence of \"window\"\n// to support hybrid environments like Electron\nif(typeof global !== 'undefined') {\n var Buffer = require('buffer').Buffer; // TODO just use global Buffer\n}\n\n/**\n * A class representation of the BSON Binary type.\n *\n * Sub types\n * - **BSON.BSON_BINARY_SUBTYPE_DEFAULT**, default BSON type.\n * - **BSON.BSON_BINARY_SUBTYPE_FUNCTION**, BSON function type.\n * - **BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY**, BSON byte array type.\n * - **BSON.BSON_BINARY_SUBTYPE_UUID**, BSON uuid type.\n * - **BSON.BSON_BINARY_SUBTYPE_MD5**, BSON md5 type.\n * - **BSON.BSON_BINARY_SUBTYPE_USER_DEFINED**, BSON user defined type.\n *\n * @class\n * @param {Buffer} buffer a buffer object containing the binary data.\n * @param {Number} [subType] the option binary type.\n * @return {Binary}\n */\nfunction Binary(buffer, subType) {\n if(!(this instanceof Binary)) return new Binary(buffer, subType);\n\n this._bsontype = 'Binary';\n\n if(buffer instanceof Number) {\n this.sub_type = buffer;\n this.position = 0;\n } else {\n this.sub_type = subType == null ? BSON_BINARY_SUBTYPE_DEFAULT : subType;\n this.position = 0;\n }\n\n if(buffer != null && !(buffer instanceof Number)) {\n // Only accept Buffer, Uint8Array or Arrays\n if(typeof buffer == 'string') {\n // Different ways of writing the length of the string for the different types\n if(typeof Buffer != 'undefined') {\n this.buffer = new Buffer(buffer);\n } else if(typeof Uint8Array != 'undefined' || (Object.prototype.toString.call(buffer) == '[object Array]')) {\n this.buffer = writeStringToArray(buffer);\n } else {\n throw new Error(\"only String, Buffer, Uint8Array or Array accepted\");\n }\n } else {\n this.buffer = buffer;\n }\n this.position = buffer.length;\n } else {\n if(typeof Buffer != 'undefined') {\n this.buffer = new Buffer(Binary.BUFFER_SIZE);\n } else if(typeof Uint8Array != 'undefined'){\n this.buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE));\n } else {\n this.buffer = new Array(Binary.BUFFER_SIZE);\n }\n // Set position to start of buffer\n this.position = 0;\n }\n};\n\n/**\n * Updates this binary with byte_value.\n *\n * @method\n * @param {string} byte_value a single byte we wish to write.\n */\nBinary.prototype.put = function put(byte_value) {\n // If it's a string and a has more than one character throw an error\n if(byte_value['length'] != null && typeof byte_value != 'number' && byte_value.length != 1) throw new Error(\"only accepts single character String, Uint8Array or Array\");\n if(typeof byte_value != 'number' && byte_value < 0 || byte_value > 255) throw new Error(\"only accepts number in a valid unsigned byte range 0-255\");\n\n // Decode the byte value once\n var decoded_byte = null;\n if(typeof byte_value == 'string') {\n decoded_byte = byte_value.charCodeAt(0);\n } else if(byte_value['length'] != null) {\n decoded_byte = byte_value[0];\n } else {\n decoded_byte = byte_value;\n }\n\n if(this.buffer.length > this.position) {\n this.buffer[this.position++] = decoded_byte;\n } else {\n if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) {\n // Create additional overflow buffer\n var buffer = new Buffer(Binary.BUFFER_SIZE + this.buffer.length);\n // Combine the two buffers together\n this.buffer.copy(buffer, 0, 0, this.buffer.length);\n this.buffer = buffer;\n this.buffer[this.position++] = decoded_byte;\n } else {\n var buffer = null;\n // Create a new buffer (typed or normal array)\n if(Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') {\n buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE + this.buffer.length));\n } else {\n buffer = new Array(Binary.BUFFER_SIZE + this.buffer.length);\n }\n\n // We need to copy all the content to the new array\n for(var i = 0; i < this.buffer.length; i++) {\n buffer[i] = this.buffer[i];\n }\n\n // Reassign the buffer\n this.buffer = buffer;\n // Write the byte\n this.buffer[this.position++] = decoded_byte;\n }\n }\n};\n\n/**\n * Writes a buffer or string to the binary.\n *\n * @method\n * @param {(Buffer|string)} string a string or buffer to be written to the Binary BSON object.\n * @param {number} offset specify the binary of where to write the content.\n * @return {null}\n */\nBinary.prototype.write = function write(string, offset) {\n offset = typeof offset == 'number' ? offset : this.position;\n\n // If the buffer is to small let's extend the buffer\n if(this.buffer.length < offset + string.length) {\n var buffer = null;\n // If we are in node.js\n if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) {\n buffer = new Buffer(this.buffer.length + string.length);\n this.buffer.copy(buffer, 0, 0, this.buffer.length);\n } else if(Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') {\n // Create a new buffer\n buffer = new Uint8Array(new ArrayBuffer(this.buffer.length + string.length))\n // Copy the content\n for(var i = 0; i < this.position; i++) {\n buffer[i] = this.buffer[i];\n }\n }\n\n // Assign the new buffer\n this.buffer = buffer;\n }\n\n if(typeof Buffer != 'undefined' && Buffer.isBuffer(string) && Buffer.isBuffer(this.buffer)) {\n string.copy(this.buffer, offset, 0, string.length);\n this.position = (offset + string.length) > this.position ? (offset + string.length) : this.position;\n // offset = string.length\n } else if(typeof Buffer != 'undefined' && typeof string == 'string' && Buffer.isBuffer(this.buffer)) {\n this.buffer.write(string, offset, 'binary');\n this.position = (offset + string.length) > this.position ? (offset + string.length) : this.position;\n // offset = string.length;\n } else if(Object.prototype.toString.call(string) == '[object Uint8Array]'\n || Object.prototype.toString.call(string) == '[object Array]' && typeof string != 'string') {\n for(var i = 0; i < string.length; i++) {\n this.buffer[offset++] = string[i];\n }\n\n this.position = offset > this.position ? offset : this.position;\n } else if(typeof string == 'string') {\n for(var i = 0; i < string.length; i++) {\n this.buffer[offset++] = string.charCodeAt(i);\n }\n\n this.position = offset > this.position ? offset : this.position;\n }\n};\n\n/**\n * Reads **length** bytes starting at **position**.\n *\n * @method\n * @param {number} position read from the given position in the Binary.\n * @param {number} length the number of bytes to read.\n * @return {Buffer}\n */\nBinary.prototype.read = function read(position, length) {\n length = length && length > 0\n ? length\n : this.position;\n\n // Let's return the data based on the type we have\n if(this.buffer['slice']) {\n return this.buffer.slice(position, position + length);\n } else {\n // Create a buffer to keep the result\n var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(length)) : new Array(length);\n for(var i = 0; i < length; i++) {\n buffer[i] = this.buffer[position++];\n }\n }\n // Return the buffer\n return buffer;\n};\n\n/**\n * Returns the value of this binary as a string.\n *\n * @method\n * @return {string}\n */\nBinary.prototype.value = function value(asRaw) {\n asRaw = asRaw == null ? false : asRaw;\n\n // Optimize to serialize for the situation where the data == size of buffer\n if(asRaw && typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer) && this.buffer.length == this.position)\n return this.buffer;\n\n // If it's a node.js buffer object\n if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) {\n return asRaw ? this.buffer.slice(0, this.position) : this.buffer.toString('binary', 0, this.position);\n } else {\n if(asRaw) {\n // we support the slice command use it\n if(this.buffer['slice'] != null) {\n return this.buffer.slice(0, this.position);\n } else {\n // Create a new buffer to copy content to\n var newBuffer = Object.prototype.toString.call(this.buffer) == '[object Uint8Array]' ? new Uint8Array(new ArrayBuffer(this.position)) : new Array(this.position);\n // Copy content\n for(var i = 0; i < this.position; i++) {\n newBuffer[i] = this.buffer[i];\n }\n // Return the buffer\n return newBuffer;\n }\n } else {\n return convertArraytoUtf8BinaryString(this.buffer, 0, this.position);\n }\n }\n};\n\n/**\n * Length.\n *\n * @method\n * @return {number} the length of the binary.\n */\nBinary.prototype.length = function length() {\n return this.position;\n};\n\n/**\n * @ignore\n */\nBinary.prototype.toJSON = function() {\n return this.buffer != null ? this.buffer.toString('base64') : '';\n}\n\n/**\n * @ignore\n */\nBinary.prototype.toString = function(format) {\n return this.buffer != null ? this.buffer.slice(0, this.position).toString(format) : '';\n}\n\n/**\n * Binary default subtype\n * @ignore\n */\nvar BSON_BINARY_SUBTYPE_DEFAULT = 0;\n\n/**\n * @ignore\n */\nvar writeStringToArray = function(data) {\n // Create a buffer\n var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(data.length)) : new Array(data.length);\n // Write the content to the buffer\n for(var i = 0; i < data.length; i++) {\n buffer[i] = data.charCodeAt(i);\n }\n // Write the string to the buffer\n return buffer;\n}\n\n/**\n * Convert Array ot Uint8Array to Binary String\n *\n * @ignore\n */\nvar convertArraytoUtf8BinaryString = function(byteArray, startIndex, endIndex) {\n var result = \"\";\n for(var i = startIndex; i < endIndex; i++) {\n result = result + String.fromCharCode(byteArray[i]);\n }\n return result;\n};\n\nBinary.BUFFER_SIZE = 256;\n\n/**\n * Default BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_DEFAULT = 0;\n/**\n * Function BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_FUNCTION = 1;\n/**\n * Byte Array BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_BYTE_ARRAY = 2;\n/**\n * OLD UUID BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_UUID_OLD = 3;\n/**\n * UUID BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_UUID = 4;\n/**\n * MD5 BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_MD5 = 5;\n/**\n * User BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_USER_DEFINED = 128;\n\n/**\n * Expose.\n */\nmodule.exports = Binary;\nmodule.exports.Binary = Binary;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/binary.js","/**\n * A class representation of the BSON Code type.\n *\n * @class\n * @param {(string|function)} code a string or function.\n * @param {Object} [scope] an optional scope for the function.\n * @return {Code}\n */\nvar Code = function Code(code, scope) {\n if(!(this instanceof Code)) return new Code(code, scope);\n this._bsontype = 'Code';\n this.code = code;\n this.scope = scope;\n};\n\n/**\n * @ignore\n */\nCode.prototype.toJSON = function() {\n return {scope:this.scope, code:this.code};\n}\n\nmodule.exports = Code;\nmodule.exports.Code = Code;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/code.js","/**\n * A class representation of the BSON DBRef type.\n *\n * @class\n * @param {string} namespace the collection name.\n * @param {ObjectID} oid the reference ObjectID.\n * @param {string} [db] optional db name, if omitted the reference is local to the current db.\n * @return {DBRef}\n */\nfunction DBRef(namespace, oid, db) {\n if(!(this instanceof DBRef)) return new DBRef(namespace, oid, db);\n \n this._bsontype = 'DBRef';\n this.namespace = namespace;\n this.oid = oid;\n this.db = db;\n};\n\n/**\n * @ignore\n * @api private\n */\nDBRef.prototype.toJSON = function() {\n return {\n '$ref':this.namespace,\n '$id':this.oid,\n '$db':this.db == null ? '' : this.db\n };\n}\n\nmodule.exports = DBRef;\nmodule.exports.DBRef = DBRef;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/db_ref.js","\"use strict\"\n\nvar Long = require('./long');\n\nvar PARSE_STRING_REGEXP = /^(\\+|\\-)?(\\d+|(\\d*\\.\\d*))?(E|e)?([\\-\\+])?(\\d+)?$/;\nvar PARSE_INF_REGEXP = /^(\\+|\\-)?(Infinity|inf)$/i;\nvar PARSE_NAN_REGEXP = /^(\\+|\\-)?NaN$/i;\n\nvar EXPONENT_MAX = 6111;\nvar EXPONENT_MIN = -6176;\nvar EXPONENT_BIAS = 6176;\nvar MAX_DIGITS = 34;\n\n// Nan value bits as 32 bit values (due to lack of longs)\nvar NAN_BUFFER = [0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].reverse();\n// Infinity value bits 32 bit values (due to lack of longs)\nvar INF_NEGATIVE_BUFFER = [0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].reverse();\nvar INF_POSITIVE_BUFFER = [0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].reverse();\n\nvar EXPONENT_REGEX = /^([\\-\\+])?(\\d+)?$/;\n\n\n// Detect if the value is a digit\nvar isDigit = function(value) {\n return !isNaN(parseInt(value, 10));\n}\n\n// Divide two uint128 values\nvar divideu128 = function(value) {\n var DIVISOR = Long.fromNumber(1000 * 1000 * 1000);\n var _rem = Long.fromNumber(0);\n var i = 0;\n\n if(!value.parts[0] && !value.parts[1] &&\n !value.parts[2] && !value.parts[3]) {\n return { quotient: value, rem: _rem };\n }\n\n for(var i = 0; i <= 3; i++) {\n // Adjust remainder to match value of next dividend\n _rem = _rem.shiftLeft(32);\n // Add the divided to _rem\n _rem = _rem.add(new Long(value.parts[i], 0));\n value.parts[i] = _rem.div(DIVISOR).low_;\n _rem = _rem.modulo(DIVISOR);\n }\n\n return { quotient: value, rem: _rem };\n}\n\n// Multiply two Long values and return the 128 bit value\nvar multiply64x2 = function(left, right) {\n if(!left && !right) {\n return {high: Long.fromNumber(0), low: Long.fromNumber(0)};\n }\n\n var leftHigh = left.shiftRightUnsigned(32);\n var leftLow = new Long(left.getLowBits(), 0);\n var rightHigh = right.shiftRightUnsigned(32);\n var rightLow = new Long(right.getLowBits(), 0);\n\n var productHigh = leftHigh.multiply(rightHigh);\n var productMid = leftHigh.multiply(rightLow);\n var productMid2 = leftLow.multiply(rightHigh);\n var productLow = leftLow.multiply(rightLow);\n\n productHigh = productHigh.add(productMid.shiftRightUnsigned(32));\n productMid = new Long(productMid.getLowBits(), 0)\n .add(productMid2)\n .add(productLow.shiftRightUnsigned(32));\n\n productHigh = productHigh.add(productMid.shiftRightUnsigned(32));\n productLow = productMid.shiftLeft(32).add(new Long(productLow.getLowBits(), 0));\n\n // Return the 128 bit result\n return {high: productHigh, low: productLow};\n}\n\nvar lessThan = function(left, right) {\n // Make values unsigned\n var uhleft = left.high_ >>> 0;\n var uhright = right.high_ >>> 0;\n\n // Compare high bits first\n if(uhleft < uhright) {\n return true\n } else if(uhleft == uhright) {\n var ulleft = left.low_ >>> 0;\n var ulright = right.low_ >>> 0;\n if(ulleft < ulright) return true;\n }\n\n return false;\n}\n\nvar longtoHex = function(value) {\n var buffer = new Buffer(8);\n var index = 0;\n // Encode the low 64 bits of the decimal\n // Encode low bits\n buffer[index++] = value.low_ & 0xff;\n buffer[index++] = (value.low_ >> 8) & 0xff;\n buffer[index++] = (value.low_ >> 16) & 0xff;\n buffer[index++] = (value.low_ >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = value.high_ & 0xff;\n buffer[index++] = (value.high_ >> 8) & 0xff;\n buffer[index++] = (value.high_ >> 16) & 0xff;\n buffer[index++] = (value.high_ >> 24) & 0xff;\n return buffer.reverse().toString('hex');\n}\n\nvar int32toHex = function(value) {\n var buffer = new Buffer(4);\n var index = 0;\n // Encode the low 64 bits of the decimal\n // Encode low bits\n buffer[index++] = value & 0xff;\n buffer[index++] = (value >> 8) & 0xff;\n buffer[index++] = (value >> 16) & 0xff;\n buffer[index++] = (value >> 24) & 0xff;\n return buffer.reverse().toString('hex');\n}\n\nvar Decimal128 = function(bytes) {\n this._bsontype = 'Decimal128';\n this.bytes = bytes;\n}\n\nDecimal128.fromString = function(string) {\n // Parse state tracking\n var isNegative = false;\n var sawRadix = false;\n var foundNonZero = false;\n\n // Total number of significant digits (no leading or trailing zero)\n var significantDigits = 0;\n // Total number of significand digits read\n var nDigitsRead = 0;\n // Total number of digits (no leading zeros)\n var nDigits = 0;\n // The number of the digits after radix\n var radixPosition = 0;\n // The index of the first non-zero in *str*\n var firstNonZero = 0;\n\n // Digits Array\n var digits = [0];\n // The number of digits in digits\n var nDigitsStored = 0;\n // Insertion pointer for digits\n var digitsInsert = 0;\n // The index of the first non-zero digit\n var firstDigit = 0;\n // The index of the last digit\n var lastDigit = 0;\n\n // Exponent\n var exponent = 0;\n // loop index over array\n var i = 0;\n // The high 17 digits of the significand\n var significandHigh = [0, 0];\n // The low 17 digits of the significand\n var significandLow = [0, 0];\n // The biased exponent\n var biasedExponent = 0;\n\n // Read index\n var index = 0;\n\n // Trim the string\n string = string.trim();\n\n // Results\n var stringMatch = string.match(PARSE_STRING_REGEXP);\n var infMatch = string.match(PARSE_INF_REGEXP);\n var nanMatch = string.match(PARSE_NAN_REGEXP);\n\n // Validate the string\n if(!stringMatch\n && ! infMatch\n && ! nanMatch || string.length == 0) {\n throw new Error(\"\" + string + \" not a valid Decimal128 string\");\n }\n\n // Check if we have an illegal exponent format\n if(stringMatch && stringMatch[4] && stringMatch[2] === undefined) {\n throw new Error(\"\" + string + \" not a valid Decimal128 string\");\n }\n\n // Get the negative or positive sign\n if(string[index] == '+' || string[index] == '-') {\n isNegative = string[index++] == '-';\n }\n\n // Check if user passed Infinity or NaN\n if(!isDigit(string[index]) && string[index] != '.') {\n if(string[index] == 'i' || string[index] == 'I') {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER));\n } else if(string[index] == 'N') {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n }\n\n // Read all the digits\n while(isDigit(string[index]) || string[index] == '.') {\n if(string[index] == '.') {\n if(sawRadix) {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n\n sawRadix = true;\n index = index + 1;\n continue;\n }\n\n if(nDigitsStored < 34) {\n if(string[index] != '0' || foundNonZero) {\n if(!foundNonZero) {\n firstNonZero = nDigitsRead;\n }\n\n foundNonZero = true;\n\n // Only store 34 digits\n digits[digitsInsert++] = parseInt(string[index], 10);\n nDigitsStored = nDigitsStored + 1;\n }\n }\n\n if(foundNonZero) {\n nDigits = nDigits + 1;\n }\n\n if(sawRadix) {\n radixPosition = radixPosition + 1;\n }\n\n nDigitsRead = nDigitsRead + 1;\n index = index + 1;\n }\n\n if(sawRadix && !nDigitsRead) {\n throw new Error(\"\" + string + \" not a valid Decimal128 string\");\n }\n\n // Read exponent if exists\n if(string[index] == 'e' || string[index] == 'E') {\n // Read exponent digits\n var match = string.substr(++index).match(EXPONENT_REGEX);\n\n // No digits read\n if(!match || !match[2]) {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n\n // Get exponent\n exponent = parseInt(match[0], 10);\n\n // Adjust the index\n index = index + match[0].length;\n }\n\n // Return not a number\n if(string[index]) {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n\n // Done reading input\n // Find first non-zero digit in digits\n firstDigit = 0;\n\n if(!nDigitsStored) {\n firstDigit = 0;\n lastDigit = 0;\n digits[0] = 0;\n nDigits = 1;\n nDigitsStored = 1;\n significantDigits = 0;\n } else {\n lastDigit = nDigitsStored - 1;\n significantDigits = nDigits;\n\n if(exponent != 0 && significantDigits != 1) {\n while(string[firstNonZero + significantDigits - 1] == '0') {\n significantDigits = significantDigits - 1;\n }\n }\n }\n\n // Normalization of exponent\n // Correct exponent based on radix position, and shift significand as needed\n // to represent user input\n\n // Overflow prevention\n if(exponent <= radixPosition && radixPosition - exponent > (1 << 14)) {\n exponent = EXPONENT_MIN;\n } else {\n exponent = exponent - radixPosition;\n }\n\n // Attempt to normalize the exponent\n while(exponent > EXPONENT_MAX) {\n // Shift exponent to significand and decrease\n lastDigit = lastDigit + 1;\n\n if(lastDigit - firstDigit > MAX_DIGITS) {\n // Check if we have a zero then just hard clamp, otherwise fail\n var digitsString = digits.join('');\n if(digitsString.match(/^0+$/)) {\n exponent = EXPONENT_MAX;\n break;\n } else {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER));\n }\n }\n\n exponent = exponent - 1;\n }\n\n while(exponent < EXPONENT_MIN || nDigitsStored < nDigits) {\n // Shift last digit\n if(lastDigit == 0) {\n exponent = EXPONENT_MIN;\n significantDigits = 0;\n break;\n }\n\n if(nDigitsStored < nDigits) {\n // adjust to match digits not stored\n nDigits = nDigits - 1;\n } else {\n // adjust to round\n lastDigit = lastDigit - 1;\n }\n\n if(exponent < EXPONENT_MAX) {\n exponent = exponent + 1;\n } else {\n // Check if we have a zero then just hard clamp, otherwise fail\n var digitsString = digits.join('');\n if(digitsString.match(/^0+$/)) {\n exponent = EXPONENT_MAX;\n break;\n } else {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER))\n }\n }\n }\n\n\n // Round\n // We've normalized the exponent, but might still need to round.\n if((lastDigit - firstDigit + 1 < significantDigits) && string[significantDigits] != '0') {\n var endOfString = nDigitsRead;\n\n // If we have seen a radix point, 'string' is 1 longer than we have\n // documented with ndigits_read, so inc the position of the first nonzero\n // digit and the position that digits are read to.\n if(sawRadix && exponent == EXPONENT_MIN) {\n firstNonZero = firstNonZero + 1;\n endOfString = endOfString + 1;\n }\n\n var roundDigit = parseInt(string[firstNonZero + lastDigit + 1], 10);\n var roundBit = 0;\n\n if(roundDigit >= 5) {\n roundBit = 1;\n\n if(roundDigit == 5) {\n roundBit = digits[lastDigit] % 2 == 1;\n\n for(var i = firstNonZero + lastDigit + 2; i < endOfString; i++) {\n if(parseInt(string[i], 10)) {\n roundBit = 1;\n break;\n }\n }\n }\n }\n\n if(roundBit) {\n var dIdx = lastDigit;\n\n for(; dIdx >= 0; dIdx--) {\n if(++digits[dIdx] > 9) {\n digits[dIdx] = 0;\n\n // overflowed most significant digit\n if(dIdx == 0) {\n if(exponent < EXPONENT_MAX) {\n exponent = exponent + 1;\n digits[dIdx] = 1;\n } else {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER))\n }\n }\n } else {\n break;\n }\n }\n }\n }\n\n // Encode significand\n // The high 17 digits of the significand\n significandHigh = Long.fromNumber(0);\n // The low 17 digits of the significand\n significandLow = Long.fromNumber(0);\n\n // read a zero\n if(significantDigits == 0) {\n significandHigh = Long.fromNumber(0);\n significandLow = Long.fromNumber(0);\n } else if(lastDigit - firstDigit < 17) {\n var dIdx = firstDigit;\n significandLow = Long.fromNumber(digits[dIdx++]);\n significandHigh = new Long(0, 0);\n\n for(; dIdx <= lastDigit; dIdx++) {\n significandLow = significandLow.multiply(Long.fromNumber(10));\n significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));\n }\n } else {\n var dIdx = firstDigit;\n significandHigh = Long.fromNumber(digits[dIdx++]);\n\n for(; dIdx <= lastDigit - 17; dIdx++) {\n significandHigh = significandHigh.multiply(Long.fromNumber(10));\n significandHigh = significandHigh.add(Long.fromNumber(digits[dIdx]));\n }\n\n significandLow = Long.fromNumber(digits[dIdx++]);\n\n for(; dIdx <= lastDigit; dIdx++) {\n significandLow = significandLow.multiply(Long.fromNumber(10));\n significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));\n }\n }\n\n var significand = multiply64x2(significandHigh, Long.fromString(\"100000000000000000\"));\n\n significand.low = significand.low.add(significandLow);\n\n if(lessThan(significand.low, significandLow)) {\n significand.high = significand.high.add(Long.fromNumber(1));\n }\n\n // Biased exponent\n var biasedExponent = (exponent + EXPONENT_BIAS);\n var dec = { low: Long.fromNumber(0), high: Long.fromNumber(0) };\n\n // Encode combination, exponent, and significand.\n if(significand.high.shiftRightUnsigned(49).and(Long.fromNumber(1)).equals(Long.fromNumber)) {\n // Encode '11' into bits 1 to 3\n dec.high = dec.high.or(Long.fromNumber(0x3).shiftLeft(61));\n dec.high = dec.high.or(Long.fromNumber(biasedExponent).and(Long.fromNumber(0x3fff).shiftLeft(47)));\n dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x7fffffffffff)));\n } else {\n dec.high = dec.high.or(Long.fromNumber(biasedExponent & 0x3fff).shiftLeft(49));\n dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x1ffffffffffff)));\n }\n\n dec.low = significand.low;\n\n // Encode sign\n if(isNegative) {\n dec.high = dec.high.or(Long.fromString('9223372036854775808'));\n }\n\n // Encode into a buffer\n var buffer = new Buffer(16);\n var index = 0;\n\n // Encode the low 64 bits of the decimal\n // Encode low bits\n buffer[index++] = dec.low.low_ & 0xff;\n buffer[index++] = (dec.low.low_ >> 8) & 0xff;\n buffer[index++] = (dec.low.low_ >> 16) & 0xff;\n buffer[index++] = (dec.low.low_ >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = dec.low.high_ & 0xff;\n buffer[index++] = (dec.low.high_ >> 8) & 0xff;\n buffer[index++] = (dec.low.high_ >> 16) & 0xff;\n buffer[index++] = (dec.low.high_ >> 24) & 0xff;\n\n // Encode the high 64 bits of the decimal\n // Encode low bits\n buffer[index++] = dec.high.low_ & 0xff;\n buffer[index++] = (dec.high.low_ >> 8) & 0xff;\n buffer[index++] = (dec.high.low_ >> 16) & 0xff;\n buffer[index++] = (dec.high.low_ >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = dec.high.high_ & 0xff;\n buffer[index++] = (dec.high.high_ >> 8) & 0xff;\n buffer[index++] = (dec.high.high_ >> 16) & 0xff;\n buffer[index++] = (dec.high.high_ >> 24) & 0xff;\n\n // Return the new Decimal128\n return new Decimal128(buffer);\n}\n\n// Extract least significant 5 bits\nvar COMBINATION_MASK = 0x1f;\n// Extract least significant 14 bits\nvar EXPONENT_MASK = 0x3fff;\n// Value of combination field for Inf\nvar COMBINATION_INFINITY = 30;\n// Value of combination field for NaN\nvar COMBINATION_NAN = 31;\n// Value of combination field for NaN\nvar COMBINATION_SNAN = 32;\n// decimal128 exponent bias\nvar EXPONENT_BIAS = 6176;\n\nDecimal128.prototype.toString = function() {\n // Note: bits in this routine are referred to starting at 0,\n // from the sign bit, towards the coefficient.\n\n // bits 0 - 31\n var high;\n // bits 32 - 63\n var midh;\n // bits 64 - 95\n var midl;\n // bits 96 - 127\n var low;\n // bits 1 - 5\n var combination;\n // decoded biased exponent (14 bits)\n var biased_exponent;\n // the number of significand digits\n var significand_digits = 0;\n // the base-10 digits in the significand\n var significand = new Array(36);\n for(var i = 0; i < significand.length; i++) significand[i] = 0;\n // read pointer into significand\n var index = 0;\n\n // unbiased exponent\n var exponent;\n // the exponent if scientific notation is used\n var scientific_exponent;\n\n // true if the number is zero\n var is_zero = false;\n\n // the most signifcant significand bits (50-46)\n var significand_msb;\n // temporary storage for significand decoding\n var significand128 = {parts: new Array(4)};\n // indexing variables\n var i;\n var j, k;\n\n // Output string\n var string = [];\n\n // Unpack index\n var index = 0;\n\n // Buffer reference\n var buffer = this.bytes;\n\n // Unpack the low 64bits into a long\n low = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n midl = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n // Unpack the high 64bits into a long\n midh = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n high = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n // Unpack index\n var index = 0;\n\n // Create the state of the decimal\n var dec = {\n low: new Long(low, midl),\n high: new Long(midh, high) };\n\n if(dec.high.lessThan(Long.ZERO)) {\n string.push('-');\n }\n\n // Decode combination field and exponent\n combination = (high >> 26) & COMBINATION_MASK;\n\n if((combination >> 3) == 3) {\n // Check for 'special' values\n if(combination == COMBINATION_INFINITY) {\n return string.join('') + \"Infinity\";\n } else if(combination == COMBINATION_NAN) {\n return \"NaN\";\n } else {\n biased_exponent = (high >> 15) & EXPONENT_MASK;\n significand_msb = 0x08 + ((high >> 14) & 0x01);\n }\n } else {\n significand_msb = (high >> 14) & 0x07;\n biased_exponent = (high >> 17) & EXPONENT_MASK;\n }\n\n exponent = biased_exponent - EXPONENT_BIAS;\n\n // Create string of significand digits\n\n // Convert the 114-bit binary number represented by\n // (significand_high, significand_low) to at most 34 decimal\n // digits through modulo and division.\n significand128.parts[0] = (high & 0x3fff) + ((significand_msb & 0xf) << 14);\n significand128.parts[1] = midh;\n significand128.parts[2] = midl;\n significand128.parts[3] = low;\n\n if(significand128.parts[0] == 0 && significand128.parts[1] == 0\n && significand128.parts[2] == 0 && significand128.parts[3] == 0) {\n is_zero = true;\n } else {\n for(var k = 3; k >= 0; k--) {\n var least_digits = 0;\n // Peform the divide\n var result = divideu128(significand128);\n significand128 = result.quotient;\n least_digits = result.rem.low_;\n\n // We now have the 9 least significant digits (in base 2).\n // Convert and output to string.\n if(!least_digits) continue;\n\n for(var j = 8; j >= 0; j--) {\n // significand[k * 9 + j] = Math.round(least_digits % 10);\n significand[k * 9 + j] = least_digits % 10;\n // least_digits = Math.round(least_digits / 10);\n least_digits = Math.floor(least_digits / 10);\n }\n }\n }\n\n // Output format options:\n // Scientific - [-]d.dddE(+/-)dd or [-]dE(+/-)dd\n // Regular - ddd.ddd\n\n if(is_zero) {\n significand_digits = 1;\n significand[index] = 0;\n } else {\n significand_digits = 36;\n var i = 0;\n\n while(!significand[index]) {\n i++;\n significand_digits = significand_digits - 1;\n index = index + 1;\n }\n }\n\n scientific_exponent = significand_digits - 1 + exponent;\n\n // The scientific exponent checks are dictated by the string conversion\n // specification and are somewhat arbitrary cutoffs.\n //\n // We must check exponent > 0, because if this is the case, the number\n // has trailing zeros. However, we *cannot* output these trailing zeros,\n // because doing so would change the precision of the value, and would\n // change stored data if the string converted number is round tripped.\n\n if(scientific_exponent >= 34 || scientific_exponent <= -7 ||\n exponent > 0) {\n // Scientific format\n string.push(significand[index++]);\n significand_digits = significand_digits - 1;\n\n if(significand_digits) {\n string.push('.');\n }\n\n for(var i = 0; i < significand_digits; i++) {\n string.push(significand[index++]);\n }\n\n // Exponent\n string.push('E');\n if(scientific_exponent > 0) {\n string.push('+' + scientific_exponent);\n } else {\n string.push(scientific_exponent);\n }\n } else {\n // Regular format with no decimal place\n if(exponent >= 0) {\n for(var i = 0; i < significand_digits; i++) {\n string.push(significand[index++]);\n }\n } else {\n var radix_position = significand_digits + exponent;\n\n // non-zero digits before radix\n if(radix_position > 0) {\n for(var i = 0; i < radix_position; i++) {\n string.push(significand[index++]);\n }\n } else {\n string.push('0');\n }\n\n string.push('.');\n // add leading zeros after radix\n while(radix_position++ < 0) {\n string.push('0');\n }\n\n for(var i = 0; i < significand_digits - Math.max(radix_position - 1, 0); i++) {\n string.push(significand[index++]);\n }\n }\n }\n\n return string.join('');\n}\n\nDecimal128.prototype.toJSON = function() {\n return { \"$numberDecimal\": this.toString() };\n}\n\nmodule.exports = Decimal128;\nmodule.exports.Decimal128 = Decimal128;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/decimal128.js","/**\n * A class representation of the BSON Double type.\n *\n * @class\n * @param {number} value the number we want to represent as a double.\n * @return {Double}\n */\nfunction Double(value) {\n if(!(this instanceof Double)) return new Double(value);\n\n this._bsontype = 'Double';\n this.value = value;\n}\n\n/**\n * Access the number value.\n *\n * @method\n * @return {number} returns the wrapped double number.\n */\nDouble.prototype.valueOf = function() {\n return this.value;\n};\n\n/**\n * @ignore\n */\nDouble.prototype.toJSON = function() {\n return this.value;\n}\n\nmodule.exports = Double;\nmodule.exports.Double = Double;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/double.js","/**\n * A class representation of the BSON MaxKey type.\n *\n * @class\n * @return {MaxKey} A MaxKey instance\n */\nfunction MaxKey() {\n if(!(this instanceof MaxKey)) return new MaxKey();\n \n this._bsontype = 'MaxKey'; \n}\n\nmodule.exports = MaxKey;\nmodule.exports.MaxKey = MaxKey;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/max_key.js","/**\n * A class representation of the BSON MinKey type.\n *\n * @class\n * @return {MinKey} A MinKey instance\n */\nfunction MinKey() {\n if(!(this instanceof MinKey)) return new MinKey();\n \n this._bsontype = 'MinKey';\n}\n\nmodule.exports = MinKey;\nmodule.exports.MinKey = MinKey;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/min_key.js","/**\n * Machine id.\n *\n * Create a random 3-byte value (i.e. unique for this\n * process). Other drivers use a md5 of the machine id here, but\n * that would mean an asyc call to gethostname, so we don't bother.\n * @ignore\n */\nvar MACHINE_ID = parseInt(Math.random() * 0xFFFFFF, 10);\n\n// Regular expression that checks for hex value\nvar checkForHexRegExp = new RegExp(\"^[0-9a-fA-F]{24}$\");\nvar hasBufferType = false;\n\n// Check if buffer exists\ntry {\n if(Buffer && Buffer.from) hasBufferType = true;\n} catch(err) {};\n\n/**\n* Create a new ObjectID instance\n*\n* @class\n* @param {(string|number)} id Can be a 24 byte hex string, 12 byte binary string or a Number.\n* @property {number} generationTime The generation time of this ObjectId instance\n* @return {ObjectID} instance of ObjectID.\n*/\nvar ObjectID = function ObjectID(id) {\n // Duck-typing to support ObjectId from different npm packages\n if(id instanceof ObjectID) return id;\n if(!(this instanceof ObjectID)) return new ObjectID(id);\n\n this._bsontype = 'ObjectID';\n\n // The most common usecase (blank id, new objectId instance)\n if(id == null || typeof id == 'number') {\n // Generate a new id\n this.id = this.generate(id);\n // If we are caching the hex string\n if(ObjectID.cacheHexString) this.__id = this.toString('hex');\n // Return the object\n return;\n }\n\n // Check if the passed in id is valid\n var valid = ObjectID.isValid(id);\n\n // Throw an error if it's not a valid setup\n if(!valid && id != null){\n throw new Error(\"Argument passed in must be a single String of 12 bytes or a string of 24 hex characters\");\n } else if(valid && typeof id == 'string' && id.length == 24 && hasBufferType) {\n return new ObjectID(new Buffer(id, 'hex'));\n } else if(valid && typeof id == 'string' && id.length == 24) {\n return ObjectID.createFromHexString(id);\n } else if(id != null && id.length === 12) {\n // assume 12 byte string\n this.id = id;\n } else if(id != null && id.toHexString) {\n // Duck-typing to support ObjectId from different npm packages\n return id;\n } else {\n throw new Error(\"Argument passed in must be a single String of 12 bytes or a string of 24 hex characters\");\n }\n\n if(ObjectID.cacheHexString) this.__id = this.toString('hex');\n};\n\n// Allow usage of ObjectId as well as ObjectID\nvar ObjectId = ObjectID;\n\n// Precomputed hex table enables speedy hex string conversion\nvar hexTable = [];\nfor (var i = 0; i < 256; i++) {\n hexTable[i] = (i <= 15 ? '0' : '') + i.toString(16);\n}\n\n/**\n* Return the ObjectID id as a 24 byte hex string representation\n*\n* @method\n* @return {string} return the 24 byte hex string representation.\n*/\nObjectID.prototype.toHexString = function() {\n if(ObjectID.cacheHexString && this.__id) return this.__id;\n\n var hexString = '';\n if(!this.id || !this.id.length) {\n throw new Error('invalid ObjectId, ObjectId.id must be either a string or a Buffer, but is [' + JSON.stringify(this.id) + ']');\n }\n\n if(this.id instanceof _Buffer) {\n hexString = convertToHex(this.id);\n if(ObjectID.cacheHexString) this.__id = hexString;\n return hexString;\n }\n\n for (var i = 0; i < this.id.length; i++) {\n hexString += hexTable[this.id.charCodeAt(i)];\n }\n\n if(ObjectID.cacheHexString) this.__id = hexString;\n return hexString;\n};\n\n/**\n* Update the ObjectID index used in generating new ObjectID's on the driver\n*\n* @method\n* @return {number} returns next index value.\n* @ignore\n*/\nObjectID.prototype.get_inc = function() {\n return ObjectID.index = (ObjectID.index + 1) % 0xFFFFFF;\n};\n\n/**\n* Update the ObjectID index used in generating new ObjectID's on the driver\n*\n* @method\n* @return {number} returns next index value.\n* @ignore\n*/\nObjectID.prototype.getInc = function() {\n return this.get_inc();\n};\n\n/**\n* Generate a 12 byte id buffer used in ObjectID's\n*\n* @method\n* @param {number} [time] optional parameter allowing to pass in a second based timestamp.\n* @return {Buffer} return the 12 byte id buffer string.\n*/\nObjectID.prototype.generate = function(time) {\n if ('number' != typeof time) {\n time = ~~(Date.now()/1000);\n }\n\n // Use pid\n var pid = (typeof process === 'undefined' ? Math.floor(Math.random() * 100000) : process.pid) % 0xFFFF;\n var inc = this.get_inc();\n // Buffer used\n var buffer = new Buffer(12);\n // Encode time\n buffer[3] = time & 0xff;\n buffer[2] = (time >> 8) & 0xff;\n buffer[1] = (time >> 16) & 0xff;\n buffer[0] = (time >> 24) & 0xff;\n // Encode machine\n buffer[6] = MACHINE_ID & 0xff;\n buffer[5] = (MACHINE_ID >> 8) & 0xff;\n buffer[4] = (MACHINE_ID >> 16) & 0xff;\n // Encode pid\n buffer[8] = pid & 0xff;\n buffer[7] = (pid >> 8) & 0xff;\n // Encode index\n buffer[11] = inc & 0xff;\n buffer[10] = (inc >> 8) & 0xff;\n buffer[9] = (inc >> 16) & 0xff;\n // Return the buffer\n return buffer;\n};\n\n/**\n* Converts the id into a 24 byte hex string for printing\n*\n* @param {String} format The Buffer toString format parameter.\n* @return {String} return the 24 byte hex string representation.\n* @ignore\n*/\nObjectID.prototype.toString = function(format) {\n // Is the id a buffer then use the buffer toString method to return the format\n if(this.id && this.id.copy) {\n return this.id.toString(typeof format === 'string' ? format : 'hex');\n }\n\n // if(this.buffer )\n return this.toHexString();\n};\n\n/**\n* Converts to a string representation of this Id.\n*\n* @return {String} return the 24 byte hex string representation.\n* @ignore\n*/\nObjectID.prototype.inspect = ObjectID.prototype.toString;\n\n/**\n* Converts to its JSON representation.\n*\n* @return {String} return the 24 byte hex string representation.\n* @ignore\n*/\nObjectID.prototype.toJSON = function() {\n return this.toHexString();\n};\n\n/**\n* Compares the equality of this ObjectID with `otherID`.\n*\n* @method\n* @param {object} otherID ObjectID instance to compare against.\n* @return {boolean} the result of comparing two ObjectID's\n*/\nObjectID.prototype.equals = function equals (otherId) {\n var id;\n\n if(otherId instanceof ObjectID) {\n return this.toString() == otherId.toString();\n } else if(typeof otherId == 'string' && ObjectID.isValid(otherId) && otherId.length == 12 && this.id instanceof _Buffer) {\n return otherId === this.id.toString('binary');\n } else if(typeof otherId == 'string' && ObjectID.isValid(otherId) && otherId.length == 24) {\n return otherId.toLowerCase() === this.toHexString();\n } else if(typeof otherId == 'string' && ObjectID.isValid(otherId) && otherId.length == 12) {\n return otherId === this.id;\n } else if(otherId != null && (otherId instanceof ObjectID || otherId.toHexString)) {\n return otherId.toHexString() === this.toHexString();\n } else {\n return false;\n }\n}\n\n/**\n* Returns the generation date (accurate up to the second) that this ID was generated.\n*\n* @method\n* @return {date} the generation date\n*/\nObjectID.prototype.getTimestamp = function() {\n var timestamp = new Date();\n var time = this.id[3] | this.id[2] << 8 | this.id[1] << 16 | this.id[0] << 24;\n timestamp.setTime(Math.floor(time) * 1000);\n return timestamp;\n}\n\n/**\n* @ignore\n*/\nObjectID.index = ~~(Math.random() * 0xFFFFFF);\n\n/**\n* @ignore\n*/\nObjectID.createPk = function createPk () {\n return new ObjectID();\n};\n\n/**\n* Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID.\n*\n* @method\n* @param {number} time an integer number representing a number of seconds.\n* @return {ObjectID} return the created ObjectID\n*/\nObjectID.createFromTime = function createFromTime (time) {\n var buffer = new Buffer([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);\n // Encode time into first 4 bytes\n buffer[3] = time & 0xff;\n buffer[2] = (time >> 8) & 0xff;\n buffer[1] = (time >> 16) & 0xff;\n buffer[0] = (time >> 24) & 0xff;\n // Return the new objectId\n return new ObjectID(buffer);\n};\n\n// Lookup tables\nvar encodeLookup = '0123456789abcdef'.split('')\nvar decodeLookup = []\nvar i = 0\nwhile (i < 10) decodeLookup[0x30 + i] = i++\nwhile (i < 16) decodeLookup[0x41 - 10 + i] = decodeLookup[0x61 - 10 + i] = i++\n\nvar _Buffer = Buffer;\nvar convertToHex = function(bytes) {\n return bytes.toString('hex');\n}\n\n/**\n* Creates an ObjectID from a hex string representation of an ObjectID.\n*\n* @method\n* @param {string} hexString create a ObjectID from a passed in 24 byte hexstring.\n* @return {ObjectID} return the created ObjectID\n*/\nObjectID.createFromHexString = function createFromHexString (string) {\n // Throw an error if it's not a valid setup\n if(typeof string === 'undefined' || string != null && string.length != 24) {\n throw new Error(\"Argument passed in must be a single String of 12 bytes or a string of 24 hex characters\");\n }\n\n // Use Buffer.from method if available\n if(hasBufferType) return new ObjectID(new Buffer(string, 'hex'));\n\n // Calculate lengths\n var array = new _Buffer(12);\n var n = 0;\n var i = 0;\n\n while (i < 24) {\n array[n++] = decodeLookup[string.charCodeAt(i++)] << 4 | decodeLookup[string.charCodeAt(i++)]\n }\n\n return new ObjectID(array);\n};\n\n/**\n* Checks if a value is a valid bson ObjectId\n*\n* @method\n* @return {boolean} return true if the value is a valid bson ObjectId, return false otherwise.\n*/\nObjectID.isValid = function isValid(id) {\n if(id == null) return false;\n\n if(typeof id == 'number') {\n return true;\n }\n\n if(typeof id == 'string') {\n return id.length == 12 || (id.length == 24 && checkForHexRegExp.test(id));\n }\n\n if(id instanceof ObjectID) {\n return true;\n }\n\n if(id instanceof _Buffer) {\n return true;\n }\n\n // Duck-Typing detection of ObjectId like objects\n if(id.toHexString) {\n return id.id.length == 12 || (id.id.length == 24 && checkForHexRegExp.test(id.id));\n }\n\n return false;\n};\n\n/**\n* @ignore\n*/\nObject.defineProperty(ObjectID.prototype, \"generationTime\", {\n enumerable: true\n , get: function () {\n return this.id[3] | this.id[2] << 8 | this.id[1] << 16 | this.id[0] << 24;\n }\n , set: function (value) {\n // Encode time into first 4 bytes\n this.id[3] = value & 0xff;\n this.id[2] = (value >> 8) & 0xff;\n this.id[1] = (value >> 16) & 0xff;\n this.id[0] = (value >> 24) & 0xff;\n }\n});\n\n/**\n * Expose.\n */\nmodule.exports = ObjectID;\nmodule.exports.ObjectID = ObjectID;\nmodule.exports.ObjectId = ObjectID;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/objectid.js","/**\n * A class representation of the BSON RegExp type.\n *\n * @class\n * @return {BSONRegExp} A MinKey instance\n */\nfunction BSONRegExp(pattern, options) {\n if(!(this instanceof BSONRegExp)) return new BSONRegExp();\n\n // Execute\n this._bsontype = 'BSONRegExp';\n this.pattern = pattern || '';\n this.options = options || '';\n\n // Validate options\n for(var i = 0; i < this.options.length; i++) {\n if(!(this.options[i] == 'i'\n || this.options[i] == 'm'\n || this.options[i] == 'x'\n || this.options[i] == 'l'\n || this.options[i] == 's'\n || this.options[i] == 'u'\n )) {\n throw new Error('the regular expression options [' + this.options[i] + \"] is not supported\");\n }\n }\n}\n\nmodule.exports = BSONRegExp;\nmodule.exports.BSONRegExp = BSONRegExp;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/regexp.js","/**\n * A class representation of the BSON Symbol type.\n *\n * @class\n * @deprecated\n * @param {string} value the string representing the symbol.\n * @return {Symbol}\n */\nfunction Symbol(value) {\n if(!(this instanceof Symbol)) return new Symbol(value);\n this._bsontype = 'Symbol';\n this.value = value;\n}\n\n/**\n * Access the wrapped string value.\n *\n * @method\n * @return {String} returns the wrapped string.\n */\nSymbol.prototype.valueOf = function() {\n return this.value;\n};\n\n/**\n * @ignore\n */\nSymbol.prototype.toString = function() {\n return this.value;\n}\n\n/**\n * @ignore\n */\nSymbol.prototype.inspect = function() {\n return this.value;\n}\n\n/**\n * @ignore\n */\nSymbol.prototype.toJSON = function() {\n return this.value;\n}\n\nmodule.exports = Symbol;\nmodule.exports.Symbol = Symbol;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/symbol.js","// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n// Copyright 2009 Google Inc. All Rights Reserved\n\n/**\n * This type is for INTERNAL use in MongoDB only and should not be used in applications.\n * The appropriate corresponding type is the JavaScript Date type.\n * \n * Defines a Timestamp class for representing a 64-bit two's-complement\n * integer value, which faithfully simulates the behavior of a Java \"Timestamp\". This\n * implementation is derived from TimestampLib in GWT.\n *\n * Constructs a 64-bit two's-complement integer, given its low and high 32-bit\n * values as *signed* integers. See the from* functions below for more\n * convenient ways of constructing Timestamps.\n *\n * The internal representation of a Timestamp is the two given signed, 32-bit values.\n * We use 32-bit pieces because these are the size of integers on which\n * Javascript performs bit-operations. For operations like addition and\n * multiplication, we split each number into 16-bit pieces, which can easily be\n * multiplied within Javascript's floating-point representation without overflow\n * or change in sign.\n *\n * In the algorithms below, we frequently reduce the negative case to the\n * positive case by negating the input(s) and then post-processing the result.\n * Note that we must ALWAYS check specially whether those values are MIN_VALUE\n * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\n * a positive number, it overflows back into a negative). Not handling this\n * case would often result in infinite recursion.\n *\n * @class\n * @param {number} low the low (signed) 32 bits of the Timestamp.\n * @param {number} high the high (signed) 32 bits of the Timestamp.\n */\nfunction Timestamp(low, high) {\n if(!(this instanceof Timestamp)) return new Timestamp(low, high);\n this._bsontype = 'Timestamp';\n /**\n * @type {number}\n * @ignore\n */\n this.low_ = low | 0; // force into 32 signed bits.\n\n /**\n * @type {number}\n * @ignore\n */\n this.high_ = high | 0; // force into 32 signed bits.\n};\n\n/**\n * Return the int value.\n *\n * @return {number} the value, assuming it is a 32-bit integer.\n */\nTimestamp.prototype.toInt = function() {\n return this.low_;\n};\n\n/**\n * Return the Number value.\n *\n * @method\n * @return {number} the closest floating-point representation to this value.\n */\nTimestamp.prototype.toNumber = function() {\n return this.high_ * Timestamp.TWO_PWR_32_DBL_ +\n this.getLowBitsUnsigned();\n};\n\n/**\n * Return the JSON value.\n *\n * @method\n * @return {string} the JSON representation.\n */\nTimestamp.prototype.toJSON = function() {\n return this.toString();\n}\n\n/**\n * Return the String value.\n *\n * @method\n * @param {number} [opt_radix] the radix in which the text should be written.\n * @return {string} the textual representation of this value.\n */\nTimestamp.prototype.toString = function(opt_radix) {\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (this.isZero()) {\n return '0';\n }\n\n if (this.isNegative()) {\n if (this.equals(Timestamp.MIN_VALUE)) {\n // We need to change the Timestamp value before it can be negated, so we remove\n // the bottom-most digit in this base and then recurse to do the rest.\n var radixTimestamp = Timestamp.fromNumber(radix);\n var div = this.div(radixTimestamp);\n var rem = div.multiply(radixTimestamp).subtract(this);\n return div.toString(radix) + rem.toInt().toString(radix);\n } else {\n return '-' + this.negate().toString(radix);\n }\n }\n\n // Do several (6) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Timestamp.fromNumber(Math.pow(radix, 6));\n\n var rem = this;\n var result = '';\n while (true) {\n var remDiv = rem.div(radixToPower);\n var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt();\n var digits = intval.toString(radix);\n\n rem = remDiv;\n if (rem.isZero()) {\n return digits + result;\n } else {\n while (digits.length < 6) {\n digits = '0' + digits;\n }\n result = '' + digits + result;\n }\n }\n};\n\n/**\n * Return the high 32-bits value.\n *\n * @method\n * @return {number} the high 32-bits as a signed value.\n */\nTimestamp.prototype.getHighBits = function() {\n return this.high_;\n};\n\n/**\n * Return the low 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as a signed value.\n */\nTimestamp.prototype.getLowBits = function() {\n return this.low_;\n};\n\n/**\n * Return the low unsigned 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as an unsigned value.\n */\nTimestamp.prototype.getLowBitsUnsigned = function() {\n return (this.low_ >= 0) ?\n this.low_ : Timestamp.TWO_PWR_32_DBL_ + this.low_;\n};\n\n/**\n * Returns the number of bits needed to represent the absolute value of this Timestamp.\n *\n * @method\n * @return {number} Returns the number of bits needed to represent the absolute value of this Timestamp.\n */\nTimestamp.prototype.getNumBitsAbs = function() {\n if (this.isNegative()) {\n if (this.equals(Timestamp.MIN_VALUE)) {\n return 64;\n } else {\n return this.negate().getNumBitsAbs();\n }\n } else {\n var val = this.high_ != 0 ? this.high_ : this.low_;\n for (var bit = 31; bit > 0; bit--) {\n if ((val & (1 << bit)) != 0) {\n break;\n }\n }\n return this.high_ != 0 ? bit + 33 : bit + 1;\n }\n};\n\n/**\n * Return whether this value is zero.\n *\n * @method\n * @return {boolean} whether this value is zero.\n */\nTimestamp.prototype.isZero = function() {\n return this.high_ == 0 && this.low_ == 0;\n};\n\n/**\n * Return whether this value is negative.\n *\n * @method\n * @return {boolean} whether this value is negative.\n */\nTimestamp.prototype.isNegative = function() {\n return this.high_ < 0;\n};\n\n/**\n * Return whether this value is odd.\n *\n * @method\n * @return {boolean} whether this value is odd.\n */\nTimestamp.prototype.isOdd = function() {\n return (this.low_ & 1) == 1;\n};\n\n/**\n * Return whether this Timestamp equals the other\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp equals the other\n */\nTimestamp.prototype.equals = function(other) {\n return (this.high_ == other.high_) && (this.low_ == other.low_);\n};\n\n/**\n * Return whether this Timestamp does not equal the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp does not equal the other.\n */\nTimestamp.prototype.notEquals = function(other) {\n return (this.high_ != other.high_) || (this.low_ != other.low_);\n};\n\n/**\n * Return whether this Timestamp is less than the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is less than the other.\n */\nTimestamp.prototype.lessThan = function(other) {\n return this.compare(other) < 0;\n};\n\n/**\n * Return whether this Timestamp is less than or equal to the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is less than or equal to the other.\n */\nTimestamp.prototype.lessThanOrEqual = function(other) {\n return this.compare(other) <= 0;\n};\n\n/**\n * Return whether this Timestamp is greater than the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is greater than the other.\n */\nTimestamp.prototype.greaterThan = function(other) {\n return this.compare(other) > 0;\n};\n\n/**\n * Return whether this Timestamp is greater than or equal to the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is greater than or equal to the other.\n */\nTimestamp.prototype.greaterThanOrEqual = function(other) {\n return this.compare(other) >= 0;\n};\n\n/**\n * Compares this Timestamp with the given one.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater.\n */\nTimestamp.prototype.compare = function(other) {\n if (this.equals(other)) {\n return 0;\n }\n\n var thisNeg = this.isNegative();\n var otherNeg = other.isNegative();\n if (thisNeg && !otherNeg) {\n return -1;\n }\n if (!thisNeg && otherNeg) {\n return 1;\n }\n\n // at this point, the signs are the same, so subtraction will not overflow\n if (this.subtract(other).isNegative()) {\n return -1;\n } else {\n return 1;\n }\n};\n\n/**\n * The negation of this value.\n *\n * @method\n * @return {Timestamp} the negation of this value.\n */\nTimestamp.prototype.negate = function() {\n if (this.equals(Timestamp.MIN_VALUE)) {\n return Timestamp.MIN_VALUE;\n } else {\n return this.not().add(Timestamp.ONE);\n }\n};\n\n/**\n * Returns the sum of this and the given Timestamp.\n *\n * @method\n * @param {Timestamp} other Timestamp to add to this one.\n * @return {Timestamp} the sum of this and the given Timestamp.\n */\nTimestamp.prototype.add = function(other) {\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 + b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 + b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 + b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 + b48;\n c48 &= 0xFFFF;\n return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32);\n};\n\n/**\n * Returns the difference of this and the given Timestamp.\n *\n * @method\n * @param {Timestamp} other Timestamp to subtract from this.\n * @return {Timestamp} the difference of this and the given Timestamp.\n */\nTimestamp.prototype.subtract = function(other) {\n return this.add(other.negate());\n};\n\n/**\n * Returns the product of this and the given Timestamp.\n *\n * @method\n * @param {Timestamp} other Timestamp to multiply with this.\n * @return {Timestamp} the product of this and the other.\n */\nTimestamp.prototype.multiply = function(other) {\n if (this.isZero()) {\n return Timestamp.ZERO;\n } else if (other.isZero()) {\n return Timestamp.ZERO;\n }\n\n if (this.equals(Timestamp.MIN_VALUE)) {\n return other.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO;\n } else if (other.equals(Timestamp.MIN_VALUE)) {\n return this.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().multiply(other.negate());\n } else {\n return this.negate().multiply(other).negate();\n }\n } else if (other.isNegative()) {\n return this.multiply(other.negate()).negate();\n }\n\n // If both Timestamps are small, use float multiplication\n if (this.lessThan(Timestamp.TWO_PWR_24_) &&\n other.lessThan(Timestamp.TWO_PWR_24_)) {\n return Timestamp.fromNumber(this.toNumber() * other.toNumber());\n }\n\n // Divide each Timestamp into 4 chunks of 16 bits, and then add up 4x4 products.\n // We can skip products that would overflow.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 * b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 * b00;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c16 += a00 * b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 * b00;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a16 * b16;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a00 * b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\n c48 &= 0xFFFF;\n return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32);\n};\n\n/**\n * Returns this Timestamp divided by the given one.\n *\n * @method\n * @param {Timestamp} other Timestamp by which to divide.\n * @return {Timestamp} this Timestamp divided by the given one.\n */\nTimestamp.prototype.div = function(other) {\n if (other.isZero()) {\n throw Error('division by zero');\n } else if (this.isZero()) {\n return Timestamp.ZERO;\n }\n\n if (this.equals(Timestamp.MIN_VALUE)) {\n if (other.equals(Timestamp.ONE) ||\n other.equals(Timestamp.NEG_ONE)) {\n return Timestamp.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\n } else if (other.equals(Timestamp.MIN_VALUE)) {\n return Timestamp.ONE;\n } else {\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\n var halfThis = this.shiftRight(1);\n var approx = halfThis.div(other).shiftLeft(1);\n if (approx.equals(Timestamp.ZERO)) {\n return other.isNegative() ? Timestamp.ONE : Timestamp.NEG_ONE;\n } else {\n var rem = this.subtract(other.multiply(approx));\n var result = approx.add(rem.div(other));\n return result;\n }\n }\n } else if (other.equals(Timestamp.MIN_VALUE)) {\n return Timestamp.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().div(other.negate());\n } else {\n return this.negate().div(other).negate();\n }\n } else if (other.isNegative()) {\n return this.div(other.negate()).negate();\n }\n\n // Repeat the following until the remainder is less than other: find a\n // floating-point that approximates remainder / other *from below*, add this\n // into the result, and subtract it from the remainder. It is critical that\n // the approximate value is less than or equal to the real value so that the\n // remainder never becomes negative.\n var res = Timestamp.ZERO;\n var rem = this;\n while (rem.greaterThanOrEqual(other)) {\n // Approximate the result of division. This may be a little greater or\n // smaller than the actual value.\n var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber()));\n\n // We will tweak the approximate result by changing it in the 48-th digit or\n // the smallest non-fractional digit, whichever is larger.\n var log2 = Math.ceil(Math.log(approx) / Math.LN2);\n var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48);\n\n // Decrease the approximation until it is smaller than the remainder. Note\n // that if it is too large, the product overflows and is negative.\n var approxRes = Timestamp.fromNumber(approx);\n var approxRem = approxRes.multiply(other);\n while (approxRem.isNegative() || approxRem.greaterThan(rem)) {\n approx -= delta;\n approxRes = Timestamp.fromNumber(approx);\n approxRem = approxRes.multiply(other);\n }\n\n // We know the answer can't be zero... and actually, zero would cause\n // infinite recursion since we would make no progress.\n if (approxRes.isZero()) {\n approxRes = Timestamp.ONE;\n }\n\n res = res.add(approxRes);\n rem = rem.subtract(approxRem);\n }\n return res;\n};\n\n/**\n * Returns this Timestamp modulo the given one.\n *\n * @method\n * @param {Timestamp} other Timestamp by which to mod.\n * @return {Timestamp} this Timestamp modulo the given one.\n */\nTimestamp.prototype.modulo = function(other) {\n return this.subtract(this.div(other).multiply(other));\n};\n\n/**\n * The bitwise-NOT of this value.\n *\n * @method\n * @return {Timestamp} the bitwise-NOT of this value.\n */\nTimestamp.prototype.not = function() {\n return Timestamp.fromBits(~this.low_, ~this.high_);\n};\n\n/**\n * Returns the bitwise-AND of this Timestamp and the given one.\n *\n * @method\n * @param {Timestamp} other the Timestamp with which to AND.\n * @return {Timestamp} the bitwise-AND of this and the other.\n */\nTimestamp.prototype.and = function(other) {\n return Timestamp.fromBits(this.low_ & other.low_, this.high_ & other.high_);\n};\n\n/**\n * Returns the bitwise-OR of this Timestamp and the given one.\n *\n * @method\n * @param {Timestamp} other the Timestamp with which to OR.\n * @return {Timestamp} the bitwise-OR of this and the other.\n */\nTimestamp.prototype.or = function(other) {\n return Timestamp.fromBits(this.low_ | other.low_, this.high_ | other.high_);\n};\n\n/**\n * Returns the bitwise-XOR of this Timestamp and the given one.\n *\n * @method\n * @param {Timestamp} other the Timestamp with which to XOR.\n * @return {Timestamp} the bitwise-XOR of this and the other.\n */\nTimestamp.prototype.xor = function(other) {\n return Timestamp.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_);\n};\n\n/**\n * Returns this Timestamp with bits shifted to the left by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Timestamp} this shifted to the left by the given amount.\n */\nTimestamp.prototype.shiftLeft = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var low = this.low_;\n if (numBits < 32) {\n var high = this.high_;\n return Timestamp.fromBits(\n low << numBits,\n (high << numBits) | (low >>> (32 - numBits)));\n } else {\n return Timestamp.fromBits(0, low << (numBits - 32));\n }\n }\n};\n\n/**\n * Returns this Timestamp with bits shifted to the right by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Timestamp} this shifted to the right by the given amount.\n */\nTimestamp.prototype.shiftRight = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Timestamp.fromBits(\n (low >>> numBits) | (high << (32 - numBits)),\n high >> numBits);\n } else {\n return Timestamp.fromBits(\n high >> (numBits - 32),\n high >= 0 ? 0 : -1);\n }\n }\n};\n\n/**\n * Returns this Timestamp with bits shifted to the right by the given amount, with the new top bits matching the current sign bit.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Timestamp} this shifted to the right by the given amount, with zeros placed into the new leading bits.\n */\nTimestamp.prototype.shiftRightUnsigned = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Timestamp.fromBits(\n (low >>> numBits) | (high << (32 - numBits)),\n high >>> numBits);\n } else if (numBits == 32) {\n return Timestamp.fromBits(high, 0);\n } else {\n return Timestamp.fromBits(high >>> (numBits - 32), 0);\n }\n }\n};\n\n/**\n * Returns a Timestamp representing the given (32-bit) integer value.\n *\n * @method\n * @param {number} value the 32-bit integer in question.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromInt = function(value) {\n if (-128 <= value && value < 128) {\n var cachedObj = Timestamp.INT_CACHE_[value];\n if (cachedObj) {\n return cachedObj;\n }\n }\n\n var obj = new Timestamp(value | 0, value < 0 ? -1 : 0);\n if (-128 <= value && value < 128) {\n Timestamp.INT_CACHE_[value] = obj;\n }\n return obj;\n};\n\n/**\n * Returns a Timestamp representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n *\n * @method\n * @param {number} value the number in question.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromNumber = function(value) {\n if (isNaN(value) || !isFinite(value)) {\n return Timestamp.ZERO;\n } else if (value <= -Timestamp.TWO_PWR_63_DBL_) {\n return Timestamp.MIN_VALUE;\n } else if (value + 1 >= Timestamp.TWO_PWR_63_DBL_) {\n return Timestamp.MAX_VALUE;\n } else if (value < 0) {\n return Timestamp.fromNumber(-value).negate();\n } else {\n return new Timestamp(\n (value % Timestamp.TWO_PWR_32_DBL_) | 0,\n (value / Timestamp.TWO_PWR_32_DBL_) | 0);\n }\n};\n\n/**\n * Returns a Timestamp representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits.\n *\n * @method\n * @param {number} lowBits the low 32-bits.\n * @param {number} highBits the high 32-bits.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromBits = function(lowBits, highBits) {\n return new Timestamp(lowBits, highBits);\n};\n\n/**\n * Returns a Timestamp representation of the given string, written using the given radix.\n *\n * @method\n * @param {string} str the textual representation of the Timestamp.\n * @param {number} opt_radix the radix in which the text is written.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromString = function(str, opt_radix) {\n if (str.length == 0) {\n throw Error('number format error: empty string');\n }\n\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (str.charAt(0) == '-') {\n return Timestamp.fromString(str.substring(1), radix).negate();\n } else if (str.indexOf('-') >= 0) {\n throw Error('number format error: interior \"-\" character: ' + str);\n }\n\n // Do several (8) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Timestamp.fromNumber(Math.pow(radix, 8));\n\n var result = Timestamp.ZERO;\n for (var i = 0; i < str.length; i += 8) {\n var size = Math.min(8, str.length - i);\n var value = parseInt(str.substring(i, i + size), radix);\n if (size < 8) {\n var power = Timestamp.fromNumber(Math.pow(radix, size));\n result = result.multiply(power).add(Timestamp.fromNumber(value));\n } else {\n result = result.multiply(radixToPower);\n result = result.add(Timestamp.fromNumber(value));\n }\n }\n return result;\n};\n\n// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the\n// from* methods on which they depend.\n\n\n/**\n * A cache of the Timestamp representations of small integer values.\n * @type {Object}\n * @ignore\n */\nTimestamp.INT_CACHE_ = {};\n\n// NOTE: the compiler should inline these constant values below and then remove\n// these variables, so there should be no runtime penalty for these.\n\n/**\n * Number used repeated below in calculations. This must appear before the\n * first call to any from* function below.\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_16_DBL_ = 1 << 16;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_24_DBL_ = 1 << 24;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_32_DBL_ = Timestamp.TWO_PWR_16_DBL_ * Timestamp.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_31_DBL_ = Timestamp.TWO_PWR_32_DBL_ / 2;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_48_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_64_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_32_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_63_DBL_ = Timestamp.TWO_PWR_64_DBL_ / 2;\n\n/** @type {Timestamp} */\nTimestamp.ZERO = Timestamp.fromInt(0);\n\n/** @type {Timestamp} */\nTimestamp.ONE = Timestamp.fromInt(1);\n\n/** @type {Timestamp} */\nTimestamp.NEG_ONE = Timestamp.fromInt(-1);\n\n/** @type {Timestamp} */\nTimestamp.MAX_VALUE =\n Timestamp.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0);\n\n/** @type {Timestamp} */\nTimestamp.MIN_VALUE = Timestamp.fromBits(0, 0x80000000 | 0);\n\n/**\n * @type {Timestamp}\n * @ignore\n */\nTimestamp.TWO_PWR_24_ = Timestamp.fromInt(1 << 24);\n\n/**\n * Expose.\n */\nmodule.exports = Timestamp;\nmodule.exports.Timestamp = Timestamp;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/timestamp.js","export const USER_AUTH_KEY = '_stitch_ua';\nexport const REFRESH_TOKEN_KEY = '_stitch_rt';\nexport const DEVICE_ID_KEY = '_stitch_did';\nexport const STATE_KEY = '_stitch_state';\nexport const IMPERSONATION_ACTIVE_KEY = '_stitch_impers_active';\nexport const IMPERSONATION_USER_KEY = '_stitch_impers_user';\nexport const IMPERSONATION_REAL_USER_AUTH_KEY = '_stitch_impers_real_ua';\nexport const USER_AUTH_COOKIE_NAME = 'stitch_ua';\nexport const STITCH_ERROR_KEY = '_stitch_error';\nexport const STITCH_LINK_KEY = '_stitch_link';\nexport const DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS = 10;\n\nexport const APP_CLIENT_CODEC = {\n 'accessToken': 'access_token',\n 'refreshToken': 'refresh_token',\n 'deviceId': 'device_id',\n 'userId': 'user_id'\n};\n\nexport const ADMIN_CLIENT_CODEC = {\n 'accessToken': 'access_token',\n 'refreshToken': 'refresh_token',\n 'deviceId': 'device_id',\n 'userId': 'user_id'\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/auth/common.js","export const JSONTYPE = 'application/json';\nexport const APP_CLIENT_TYPE = 'app';\nexport const ADMIN_CLIENT_TYPE = 'admin';\nexport const DEFAULT_STITCH_SERVER_URL = 'https://stitch.mongodb.com';\n\n// VERSION is substituted with the package.json version number at build time\nlet version = 'unknown';\nif (typeof VERSION !== 'undefined') {\n version = VERSION;\n}\nexport const SDK_VERSION = version;\n\nexport const checkStatus = (response) => {\n if (response.status >= 200 && response.status < 300) {\n return response;\n }\n\n let error = new Error(response.statusText);\n error.response = response;\n\n // set error to statusText by default; this will be overwritten when (and if)\n // the response is successfully parsed into json below\n error.error = response.statusText;\n\n return response.json()\n .catch(() => Promise.reject(error))\n .then(json => Promise.reject(Object.assign(error, json)));\n};\n\nexport const makeFetchArgs = (method, body) => {\n const init = {\n method: method,\n headers: { 'Accept': JSONTYPE, 'Content-Type': JSONTYPE }\n };\n\n if (body) {\n init.body = body;\n }\n\n init.cors = true;\n return init;\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/common.js","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 17\n// module chunks = 0","var Int32 = function(value) {\n if(!(this instanceof Int32)) return new Int32(value);\n\n this._bsontype = 'Int32';\n this.value = value;\n}\n\n/**\n * Access the number value.\n *\n * @method\n * @return {number} returns the wrapped int32 number.\n */\nInt32.prototype.valueOf = function() {\n return this.value;\n};\n\n/**\n * @ignore\n */\nInt32.prototype.toJSON = function() {\n return this.value;\n}\n\nmodule.exports = Int32;\nmodule.exports.Int32 = Int32;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/int_32.js","/* global window, fetch */\n/* eslint no-labels: ['error', { 'allowLoop': true }] */\nimport 'fetch-everywhere';\nimport Auth from './auth';\nimport { APP_CLIENT_CODEC } from './auth/common';\nimport ServiceRegistry from './services';\nimport * as common from './common';\nimport ExtJSON from 'mongodb-extjson';\nimport queryString from 'query-string';\nimport { deprecate } from './util';\nimport {\n StitchError,\n ErrInvalidSession,\n ErrUnauthorized\n} from './errors';\n\nconst v1 = 1;\nconst v2 = 2;\nconst v3 = 3;\nconst API_TYPE_PUBLIC = 'public';\nconst API_TYPE_PRIVATE = 'private';\nconst API_TYPE_CLIENT = 'client';\nconst API_TYPE_APP = 'app';\n\n/**\n * Create a new StitchClient instance.\n *\n * @class\n * @return {StitchClient} a StitchClient instance.\n */\nexport default class StitchClient {\n constructor(clientAppID, options) {\n let baseUrl = common.DEFAULT_STITCH_SERVER_URL;\n if (options && options.baseUrl) {\n baseUrl = options.baseUrl;\n }\n\n this.clientAppID = clientAppID;\n\n this.authUrl = (\n clientAppID ?\n `${baseUrl}/api/client/v2.0/app/${clientAppID}/auth` :\n `${baseUrl}/api/admin/v3.0/auth`\n );\n\n this.rootURLsByAPIVersion = {\n [v1]: {\n [API_TYPE_PUBLIC]: `${baseUrl}/api/public/v1.0`,\n [API_TYPE_CLIENT]: `${baseUrl}/api/client/v1.0`,\n [API_TYPE_PRIVATE]: `${baseUrl}/api/private/v1.0`,\n [API_TYPE_APP]: (clientAppID ?\n `${baseUrl}/api/client/v1.0/app/${clientAppID}` :\n `${baseUrl}/api/public/v1.0`)\n },\n [v2]: {\n [API_TYPE_PUBLIC]: `${baseUrl}/api/public/v2.0`,\n [API_TYPE_CLIENT]: `${baseUrl}/api/client/v2.0`,\n [API_TYPE_PRIVATE]: `${baseUrl}/api/private/v2.0`,\n [API_TYPE_APP]: (clientAppID ?\n `${baseUrl}/api/client/v2.0/app/${clientAppID}` :\n `${baseUrl}/api/public/v2.0`)\n },\n [v3]: {\n [API_TYPE_PUBLIC]: `${baseUrl}/api/public/v3.0`,\n [API_TYPE_CLIENT]: `${baseUrl}/api/client/v3.0`,\n [API_TYPE_APP]: (clientAppID ?\n `${baseUrl}/api/client/v3.0/app/${clientAppID}` :\n `${baseUrl}/api/admin/v3.0`)\n }\n };\n\n const authOptions = {codec: APP_CLIENT_CODEC};\n if (options && options.authCodec) {\n authOptions.codec = options.authCodec;\n }\n this.auth = new Auth(this, this.authUrl, authOptions);\n this.auth.handleRedirect();\n this.auth.handleCookie();\n\n // deprecated API\n this.authManager = {\n apiKeyAuth: (key) => this.authenticate('apiKey', key),\n localAuth: (email, password) => this.login(email, password),\n mongodbCloudAuth: (username, apiKey, opts) =>\n this.authenticate('mongodbCloud', Object.assign({ username, apiKey }, opts))\n };\n\n this.authManager.apiKeyAuth =\n deprecate(this.authManager.apiKeyAuth, 'use `client.authenticate(\"apiKey\", \"key\")` instead of `client.authManager.apiKey`');\n this.authManager.localAuth =\n deprecate(this.authManager.localAuth, 'use `client.login` instead of `client.authManager.localAuth`');\n this.authManager.mongodbCloudAuth =\n deprecate(this.authManager.mongodbCloudAuth, 'use `client.authenticate(\"mongodbCloud\", opts)` instead of `client.authManager.mongodbCloudAuth`');\n }\n\n get type() {\n return common.APP_CLIENT_TYPE;\n }\n\n /**\n * Login to stitch instance, optionally providing a username and password. In\n * the event that these are omitted, anonymous authentication is used.\n *\n * @param {String} [email] the email address used for login\n * @param {String} [password] the password for the provided email address\n * @param {Object} [options] additional authentication options\n * @returns {Promise}\n */\n login(email, password, options = {}) {\n if (email === undefined || password === undefined) {\n return this.authenticate('anon', options);\n }\n\n return this.authenticate('userpass', Object.assign({ username: email, password }, options));\n }\n\n /**\n * Send a request to the server indicating the provided email would like\n * to sign up for an account. This will trigger a confirmation email containing\n * a token which must be used with the `emailConfirm` method of the `userpass`\n * auth provider in order to complete registration. The user will not be able\n * to log in until that flow has been completed.\n *\n * @param {String} email the email used to sign up for the app\n * @param {String} password the password used to sign up for the app\n * @param {Object} [options] additional authentication options\n * @returns {Promise}\n */\n register(email, password, options = {}) {\n return this.auth.provider('userpass').register(email, password, options);\n }\n\n /**\n * Submits an authentication request to the specified provider providing any\n * included options (read: user data). If auth data already exists and the\n * existing auth data has an access token, then these credentials are returned.\n *\n * @param {String} providerType the provider used for authentication (e.g. 'userpass', 'facebook', 'google')\n * @param {Object} [options] additional authentication options\n * @returns {Promise} which resolves to a String value: the authed userId\n */\n authenticate(providerType, options = {}) {\n // reuse existing auth if present\n if (this.auth.getAccessToken()) {\n return Promise.resolve(this.auth.authedId());\n }\n\n return this.auth.provider(providerType).authenticate(options)\n .then(() => this.auth.authedId());\n }\n\n /**\n * Ends the session for the current user.\n *\n * @returns {Promise}\n */\n logout() {\n return this._do(\n '/auth/session',\n 'DELETE',\n {\n refreshOnFailure: false,\n useRefreshToken: true,\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT]\n }\n ).then(() => this.auth.clear());\n }\n\n /**\n * @return {*} Returns any error from the Stitch authentication system.\n */\n authError() {\n return this.auth.error();\n }\n\n /**\n * Returns profile information for the currently logged in user\n *\n * @returns {Promise}\n */\n userProfile() {\n return this._do(\n '/auth/profile',\n 'GET',\n {rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT]},\n )\n .then(response => response.json());\n }\n /**\n * @return {String} Returns the currently authed user's ID.\n */\n authedId() {\n return this.auth.authedId();\n }\n\n /**\n * Factory method for accessing Stitch services.\n *\n * @method\n * @param {String} type The service type [mongodb, {String}]\n * @param {String} name The service name.\n * @return {Object} returns a named service.\n */\n service(type, name) {\n if (this.constructor !== StitchClient) {\n throw new StitchError('`service` is a factory method, do not use `new`');\n }\n\n if (!ServiceRegistry.hasOwnProperty(type)) {\n throw new StitchError('Invalid service type specified: ' + type);\n }\n\n const ServiceType = ServiceRegistry[type];\n return new ServiceType(this, name);\n }\n\n /**\n * Executes a function.\n *\n * @param {String} name The name of the function.\n * @param {...*} args Arguments to pass to the function.\n */\n executeFunction(name, ...args) {\n return this._doFunctionCall({\n name,\n arguments: args\n });\n }\n\n /**\n * Executes a service function.\n *\n * @param {String} service The name of the service.\n * @param {String} action The name of the service action.\n * @param {...*} args Arguments to pass to the service action.\n */\n executeServiceFunction(service, action, ...args) {\n return this._doFunctionCall({\n service,\n name: action,\n arguments: args\n });\n }\n\n _doFunctionCall(request) {\n let responseDecoder = (d) => ExtJSON.parse(d, { strict: false });\n let responseEncoder = (d) => ExtJSON.stringify(d);\n\n return this._do('/functions/call', 'POST', { body: responseEncoder(request) })\n .then(response => response.text())\n .then(body => responseDecoder(body));\n }\n\n /**\n * Returns an access token for the user\n *\n * @returns {Promise}\n */\n doSessionPost() {\n return this._do(\n '/auth/session',\n 'POST',\n {\n refreshOnFailure: false,\n useRefreshToken: true,\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT]\n }\n )\n .then(response => response.json());\n }\n\n _do(resource, method, options) {\n options = Object.assign({}, {\n refreshOnFailure: true,\n useRefreshToken: false,\n apiVersion: v2,\n apiType: API_TYPE_APP,\n rootURL: undefined\n }, options);\n\n if (!options.noAuth) {\n if (!this.authedId()) {\n return Promise.reject(new StitchError('Must auth first', ErrUnauthorized));\n }\n\n // If access token is expired, proactively get a new one\n if (!options.useRefreshToken && this.auth.isAccessTokenExpired()) {\n return this.auth.refreshToken().then(() => {\n options.refreshOnFailure = false;\n return this._do(resource, method, options);\n });\n }\n }\n\n const appURL = this.rootURLsByAPIVersion[options.apiVersion][options.apiType];\n let url = `${appURL}${resource}`;\n if (options.rootURL) {\n url = `${options.rootURL}${resource}`;\n }\n let fetchArgs = common.makeFetchArgs(method, options.body);\n\n if (!!options.headers) {\n Object.assign(fetchArgs.headers, options.headers);\n }\n\n if (!options.noAuth) {\n let token =\n options.useRefreshToken ? this.auth.getRefreshToken() : this.auth.getAccessToken();\n fetchArgs.headers.Authorization = `Bearer ${token}`;\n }\n\n if (options.queryParams) {\n url = `${url}?${queryString.stringify(options.queryParams)}`;\n }\n\n return fetch(url, fetchArgs)\n .then((response) => {\n // Okay: passthrough\n if (response.status >= 200 && response.status < 300) {\n return Promise.resolve(response);\n }\n\n if (response.headers.get('Content-Type') === common.JSONTYPE) {\n return response.json()\n .then((json) => {\n // Only want to try refreshing token when there's an invalid session\n if ('error_code' in json && json.error_code === ErrInvalidSession) {\n if (!options.refreshOnFailure) {\n this.auth.clear();\n const error = new StitchError(json.error, json.error_code);\n error.response = response;\n error.json = json;\n throw error;\n }\n\n return this.auth.refreshToken()\n .then(() => {\n options.refreshOnFailure = false;\n return this._do(resource, method, options);\n });\n }\n\n const error = new StitchError(json.error, json.error_code);\n error.response = response;\n error.json = json;\n return Promise.reject(error);\n });\n }\n\n const error = new Error(response.statusText);\n error.response = response;\n return Promise.reject(error);\n });\n }\n\n // Deprecated API\n authWithOAuth(providerType, redirectUrl) {\n return this.auth.provider(providerType).authenticate({ redirectUrl });\n }\n\n anonymousAuth() {\n return this.authenticate('anon');\n }\n}\n\nStitchClient.prototype.authWithOAuth =\n deprecate(StitchClient.prototype.authWithOAuth, 'use `authenticate` instead of `authWithOAuth`');\nStitchClient.prototype.anonymousAuth =\n deprecate(StitchClient.prototype.anonymousAuth, 'use `login()` instead of `anonymousAuth`');\n\n\n\n// WEBPACK FOOTER //\n// ./src/client.js","\"use strict\"\n\n// We have an ES6 Map available, return the native instance\nif(typeof global.Map !== 'undefined') {\n module.exports = global.Map;\n module.exports.Map = global.Map;\n} else {\n // We will return a polyfill\n var Map = function(array) {\n this._keys = [];\n this._values = {};\n\n for(var i = 0; i < array.length; i++) {\n if(array[i] == null) continue; // skip null and undefined\n var entry = array[i];\n var key = entry[0];\n var value = entry[1];\n // Add the key to the list of keys in order\n this._keys.push(key);\n // Add the key and value to the values dictionary with a point\n // to the location in the ordered keys list\n this._values[key] = {v: value, i: this._keys.length - 1};\n }\n }\n\n Map.prototype.clear = function() {\n this._keys = [];\n this._values = {};\n }\n\n Map.prototype.delete = function(key) {\n var value = this._values[key];\n if(value == null) return false;\n // Delete entry\n delete this._values[key];\n // Remove the key from the ordered keys list\n this._keys.splice(value.i, 1);\n return true;\n }\n\n Map.prototype.entries = function() {\n var self = this;\n var index = 0;\n\n return {\n next: function() {\n var key = self._keys[index++];\n return {\n value: key !== undefined ? [key, self._values[key].v] : undefined,\n done: key !== undefined ? false : true\n }\n }\n };\n }\n\n Map.prototype.forEach = function(callback, self) {\n self = self || this;\n\n for(var i = 0; i < this._keys.length; i++) {\n var key = this._keys[i];\n // Call the forEach callback\n callback.call(self, this._values[key].v, key, self);\n }\n }\n\n Map.prototype.get = function(key) {\n return this._values[key] ? this._values[key].v : undefined;\n }\n\n Map.prototype.has = function(key) {\n return this._values[key] != null;\n }\n\n Map.prototype.keys = function(key) {\n var self = this;\n var index = 0;\n\n return {\n next: function() {\n var key = self._keys[index++];\n return {\n value: key !== undefined ? key : undefined,\n done: key !== undefined ? false : true\n }\n }\n };\n }\n\n Map.prototype.set = function(key, value) {\n if(this._values[key]) {\n this._values[key].v = value;\n return this;\n }\n\n // Add the key to the list of keys in order\n this._keys.push(key);\n // Add the key and value to the values dictionary with a point\n // to the location in the ordered keys list\n this._values[key] = {v: value, i: this._keys.length - 1};\n return this;\n }\n\n Map.prototype.values = function(key, value) {\n var self = this;\n var index = 0;\n\n return {\n next: function() {\n var key = self._keys[index++];\n return {\n value: key !== undefined ? self._values[key].v : undefined,\n done: key !== undefined ? false : true\n }\n }\n };\n }\n\n // Last ismaster\n Object.defineProperty(Map.prototype, 'size', {\n enumerable:true,\n get: function() { return this._keys.length; }\n });\n\n module.exports = Map;\n module.exports.Map = Map;\n}\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/map.js","/**\n * Creates a new StitchError\n *\n * @class\n * @augments Error\n * @param {String} message The error message.\n * @param {Object} code The error code.\n * @return {StitchError} A StitchError instance.\n */\nclass StitchError extends Error {\n constructor(message, code) {\n super(message);\n this.name = 'StitchError';\n this.message = message;\n if (code !== undefined) {\n this.code = code;\n }\n\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(this, this.constructor);\n } else {\n this.stack = (new Error(message)).stack;\n }\n }\n}\n\nconst ErrAuthProviderNotFound = 'AuthProviderNotFound';\nconst ErrInvalidSession = 'InvalidSession';\nconst ErrUnauthorized = 'Unauthorized';\n\n\nexport {\n StitchError,\n ErrAuthProviderNotFound,\n ErrInvalidSession,\n ErrUnauthorized\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/errors.js","// the whatwg-fetch polyfill installs the fetch() function\n// on the global object (window or self)\n//\n// Return that as the export for use in Webpack, Browserify etc.\nrequire('whatwg-fetch');\nvar globalObj = typeof self !== 'undefined' && self || this;\nmodule.exports = globalObj.fetch.bind(globalObj);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/fetch-everywhere/fetch-npm-browserify.js\n// module id = 22\n// module chunks = 0","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/process/browser.js\n// module id = 23\n// module chunks = 0","/* global window, fetch */\n/* eslint no-labels: ['error', { 'allowLoop': true }] */\nimport 'fetch-everywhere';\nimport StitchClient from './client';\nimport ADMIN_CLIENT_TYPE from './common';\nimport { ADMIN_CLIENT_CODEC } from './auth/common';\n\nconst v2 = 2;\nconst v3 = 3;\n\nexport default class Admin extends StitchClient {\n constructor(baseUrl) {\n super('', {baseUrl, authCodec: ADMIN_CLIENT_CODEC});\n }\n\n get type() {\n return ADMIN_CLIENT_TYPE;\n }\n\n get _v3() {\n const v3do = (url, method, options) =>\n super._do(\n url,\n method,\n Object.assign({}, { apiVersion: v3 }, options)\n ).then(response => {\n const contentHeader = response.headers.get('content-type') || '';\n if (contentHeader.split(',').indexOf('application/json') >= 0) {\n return response.json();\n }\n return response;\n });\n\n return {\n _get: (url, queryParams) => v3do(url, 'GET', {queryParams}),\n _put: (url, data) =>\n (data ?\n v3do(url, 'PUT', {body: JSON.stringify(data)}) :\n v3do(url, 'PUT')),\n _patch: (url, data) =>\n (data ?\n v3do(url, 'PATCH', {body: JSON.stringify(data)}) :\n v3do(url, 'PATCH')),\n _delete: (url) => v3do(url, 'DELETE'),\n _post: (url, body, queryParams) =>\n (queryParams ?\n v3do(url, 'POST', { body: JSON.stringify(body), queryParams }) :\n v3do(url, 'POST', { body: JSON.stringify(body) }))\n };\n }\n\n get _v2() {\n const v2do = (url, method, options) =>\n super._do(\n url,\n method,\n Object.assign({}, { apiVersion: v2 }, options)\n ).then(response => {\n const contentHeader = response.headers.get('content-type') || '';\n if (contentHeader.split(',').indexOf('application/json') >= 0) {\n return response.json();\n }\n return response;\n });\n\n return {\n _get: (url, queryParams) => v2do(url, 'GET', {queryParams}),\n _put: (url, data) =>\n (data ?\n v2do(url, 'PUT', {body: JSON.stringify(data)}) :\n v2do(url, 'PUT')),\n _patch: (url, data) =>\n (data ?\n v2do(url, 'PATCH', {body: JSON.stringify(data)}) :\n v2do(url, 'PATCH')),\n _delete: (url) => v2do(url, 'DELETE'),\n _post: (url, body, queryParams) =>\n (queryParams ?\n v2do(url, 'POST', { body: JSON.stringify(body), queryParams }) :\n v2do(url, 'POST', { body: JSON.stringify(body) }))\n };\n }\n\n /**\n * Ends the session for the current user.\n *\n * @returns {Promise}\n */\n logout() {\n return super._do('/auth/session', 'DELETE', { refreshOnFailure: false, useRefreshToken: true, apiVersion: v3 })\n .then(() => this.auth.clear());\n }\n\n /**\n * Returns profile information for the currently logged in user\n *\n * @returns {Promise}\n */\n userProfile() {\n return this._v3._get('/auth/profile');\n }\n\n /**\n * Returns available providers for the currently logged in admin\n *\n * @returns {Promise}\n */\n getAuthProviders() {\n return super._do('/auth/providers', 'GET', { noAuth: true, apiVersion: v3 })\n .then(response => response.json());\n }\n\n /**\n * Returns an access token for the user\n *\n * @returns {Promise}\n */\n doSessionPost() {\n return super._do('/auth/session', 'POST', { refreshOnFailure: false, useRefreshToken: true, apiVersion: v3 })\n .then(response => response.json());\n }\n\n /* Examples of how to access admin API with this client:\n *\n * List all apps\n * a.apps('580e6d055b199c221fcb821c').list()\n *\n * Fetch app under name 'planner'\n * a.apps('580e6d055b199c221fcb821c').app('planner').get()\n *\n * List services under the app 'planner'\n * a.apps('580e6d055b199c221fcb821c').app('planner').services().list()\n *\n * Delete a rule by ID\n * a.apps('580e6d055b199c221fcb821c').app('planner').services().service('mdb1').rules().rule('580e6d055b199c221fcb821d').remove()\n *\n */\n apps(groupId) {\n const api = this._v3;\n const groupUrl = `/groups/${groupId}/apps`;\n return {\n list: () => api._get(groupUrl),\n create: (data, options) => {\n let query = (options && options.defaults) ? '?defaults=true' : '';\n return api._post(groupUrl + query, data);\n },\n\n app: (appId) => {\n const appUrl = `${groupUrl}/${appId}`;\n return {\n get: () => api._get(appUrl),\n remove: () => api._delete(appUrl),\n\n values: () => ({\n list: () => api._get(`${appUrl}/values`),\n create: (data) => api._post( `${appUrl}/values`, data),\n value: (valueId) => {\n const valueUrl = `${appUrl}/values/${valueId}`;\n return {\n get: ()=> api._get(valueUrl),\n remove: ()=> api._delete(valueUrl),\n update: (data) => api._put(valueUrl, data)\n };\n }\n }),\n\n services: () => ({\n list: () => api._get(`${appUrl}/services`),\n create: (data) => api._post(`${appUrl}/services`, data),\n service: (serviceId) => ({\n get: () => api._get(`${appUrl}/services/${serviceId}`),\n remove: () => api._delete(`${appUrl}/services/${serviceId}`),\n runCommand: (commandName, data) => api._post(`${appUrl}/services/${serviceId}/commands/${commandName}`, data),\n config: ()=> ({\n get: () => api._get(`${appUrl}/services/${serviceId}/config`),\n update: (data) => api._patch(`${appUrl}/services/${serviceId}/config`, data)\n }),\n\n rules: () => ({\n list: () => api._get(`${appUrl}/services/${serviceId}/rules`),\n create: (data) => api._post(`${appUrl}/services/${serviceId}/rules`, data),\n rule: (ruleId) => {\n const ruleUrl = `${appUrl}/services/${serviceId}/rules/${ruleId}`;\n return {\n get: () => api._get(ruleUrl),\n update: (data) => api._put(ruleUrl, data),\n remove: () => api._delete(ruleUrl)\n };\n }\n }),\n\n incomingWebhooks: () => ({\n list: () => api._get(`${appUrl}/services/${serviceId}/incoming_webhooks`),\n create: (data) => api._post(`${appUrl}/services/${serviceId}/incoming_webhooks`, data),\n incomingWebhook: (incomingWebhookId) => {\n const webhookUrl = `${appUrl}/services/${serviceId}/incoming_webhooks/${incomingWebhookId}`;\n return {\n get: () => api._get(webhookUrl),\n update: (data) => api._put(webhookUrl, data),\n remove: () => api._delete(webhookUrl)\n };\n }\n })\n })\n }),\n\n pushNotifications: () => ({\n list: (filter) => api._get(`${appUrl}/push/notifications`, filter),\n create: (data) => api._post(`${appUrl}/push/notifications`, data),\n pushNotification: (messageId) => ({\n get: () => api._get(`${appUrl}/push/notifications/${messageId}`),\n update: (data) => api._put(`${appUrl}/push/notifications/${messageId}`, data),\n remove: () => api._delete(`${appUrl}/push/notifications/${messageId}`),\n send: () => api._post(`${appUrl}/push/notifications/${messageId}/send`)\n })\n }),\n\n users: () => ({\n list: (filter) => api._get(`${appUrl}/users`, filter),\n create: (user) => api._post(`${appUrl}/users`, user),\n user: (uid) => ({\n get: () => api._get(`${appUrl}/users/${uid}`),\n logout: () => api._put(`${appUrl}/users/${uid}/logout`),\n remove: () => api._delete(`${appUrl}/users/${uid}`)\n })\n }),\n\n debug: () => ({\n executeFunction: (userId, name = '', ...args) => {\n return api._post(\n `${appUrl}/debug/execute_function`,\n {name, 'arguments': args},\n { user_id: userId });\n },\n executeFunctionSource: (userId, source = '', evalSource = '') => {\n return api._post(\n `${appUrl}/debug/execute_function_source`,\n {source, 'eval_source': evalSource},\n { user_id: userId });\n }\n }),\n\n authProviders: () => ({\n list: () => api._get(`${appUrl}/auth_providers`),\n create: (data) => api._post(`${appUrl}/auth_providers`, data),\n authProvider: (providerId) => ({\n get: () => api._get(`${appUrl}/auth_providers/${providerId}`),\n update: (data) => api._patch(`${appUrl}/auth_providers/${providerId}`, data),\n enable: () => api._put(`${appUrl}/auth_providers/${providerId}/enable`),\n disable: () => api._put(`${appUrl}/auth_providers/${providerId}/disable`),\n remove: () => api._delete(`${appUrl}/auth_providers/${providerId}`)\n })\n }),\n\n security: () => ({\n allowedRequestOrigins: () => ({\n get: () => api._get(`${appUrl}/security/allowed_request_origins`),\n update: (data) => api._post(`${appUrl}/security/allowed_request_origins`, data)\n })\n }),\n\n logs: () => ({\n list: (filter) => api._get(`${appUrl}/logs`, filter)\n }),\n\n apiKeys: () => ({\n list: () => api._get(`${appUrl}/api_keys`),\n create: (data) => api._post(`${appUrl}/api_keys`, data),\n apiKey: (apiKeyId) => ({\n get: () => api._get(`${appUrl}/api_keys/${apiKeyId}`),\n remove: () => api._delete(`${appUrl}/api_keys/${apiKeyId}`),\n enable: () => api._put(`${appUrl}/api_keys/${apiKeyId}/enable`),\n disable: () => api._put(`${appUrl}/api_keys/${apiKeyId}/disable`)\n })\n }),\n\n functions: () => ({\n list: () => api._get(`${appUrl}/functions`),\n create: (data) => api._post(`${appUrl}/functions`, data),\n function: (functionId) => ({\n get: () => api._get(`${appUrl}/functions/${functionId}`),\n update: (data) => api._put(`${appUrl}/functions/${functionId}`, data),\n remove: () => api._delete(`${appUrl}/functions/${functionId}`)\n })\n })\n };\n }\n };\n }\n\n v2() {\n const api = this._v2;\n return {\n\n apps: (groupId) => {\n const groupUrl = `/groups/${groupId}/apps`;\n return {\n list: () => api._get(groupUrl),\n create: (data, options) => {\n let query = (options && options.defaults) ? '?defaults=true' : '';\n return api._post(groupUrl + query, data);\n },\n\n app: (appId) => {\n const appUrl = `${groupUrl}/${appId}`;\n return {\n get: () => api._get(appUrl),\n remove: () => api._delete(appUrl),\n\n pipelines: () => ({\n list: () => api._get(`${appUrl}/pipelines`),\n create: (data) => api._post( `${appUrl}/pipelines`, data),\n pipeline: (pipelineId) => {\n const pipelineUrl = `${appUrl}/pipelines/${pipelineId}`;\n return {\n get: ()=> api._get(pipelineUrl),\n remove: ()=> api._delete(pipelineUrl),\n update: (data) => api._put(pipelineUrl, data)\n };\n }\n }),\n\n values: () => ({\n list: () => api._get(`${appUrl}/values`),\n create: (data) => api._post( `${appUrl}/values`, data),\n value: (valueId) => {\n const valueUrl = `${appUrl}/values/${valueId}`;\n return {\n get: ()=> api._get(valueUrl),\n remove: ()=> api._delete(valueUrl),\n update: (data) => api._put(valueUrl, data)\n };\n }\n }),\n\n services: () => ({\n list: () => api._get(`${appUrl}/services`),\n create: (data) => api._post(`${appUrl}/services`, data),\n service: (serviceId) => ({\n get: () => api._get(`${appUrl}/services/${serviceId}`),\n remove: () => api._delete(`${appUrl}/services/${serviceId}`),\n runCommand: (commandName, data) => api._post(`${appUrl}/services/${serviceId}/commands/${commandName}`, data),\n config: ()=> ({\n get: () => api._get(`${appUrl}/services/${serviceId}/config`),\n update: (data) => api._patch(`${appUrl}/services/${serviceId}/config`, data)\n }),\n\n rules: () => ({\n list: () => api._get(`${appUrl}/services/${serviceId}/rules`),\n create: (data) => api._post(`${appUrl}/services/${serviceId}/rules`, data),\n rule: (ruleId) => {\n const ruleUrl = `${appUrl}/services/${serviceId}/rules/${ruleId}`;\n return {\n get: () => api._get(ruleUrl),\n update: (data) => api._put(ruleUrl, data),\n remove: () => api._delete(ruleUrl)\n };\n }\n }),\n\n incomingWebhooks: () => ({\n list: () => api._get(`${appUrl}/services/${serviceId}/incoming_webhooks`),\n create: (data) => api._post(`${appUrl}/services/${serviceId}/incoming_webhooks`, data),\n incomingWebhook: (incomingWebhookId) => {\n const webhookUrl = `${appUrl}/services/${serviceId}/incoming_webhooks/${incomingWebhookId}`;\n return {\n get: () => api._get(webhookUrl),\n update: (data) => api._put(webhookUrl, data),\n remove: () => api._delete(webhookUrl)\n };\n }\n })\n\n })\n }),\n\n pushNotifications: () => ({\n list: (filter) => api._get(`${appUrl}/push/notifications`, filter),\n create: (data) => api._post(`${appUrl}/push/notifications`, data),\n pushNotification: (messageId) => ({\n get: () => api._get(`${appUrl}/push/notifications/${messageId}`),\n update: (data) => api._put(`${appUrl}/push/notifications/${messageId}`, data),\n setType: (type) => api._put(`${appUrl}/push/notifications/${messageId}/type`, { type }),\n remove: () => api._delete(`${appUrl}/push/notifications/${messageId}`)\n })\n }),\n\n users: () => ({\n list: (filter) => api._get(`${appUrl}/users`, filter),\n create: (user) => api._post(`${appUrl}/users`, user),\n user: (uid) => ({\n get: () => api._get(`${appUrl}/users/${uid}`),\n logout: () => api._put(`${appUrl}/users/${uid}/logout`),\n remove: () => api._delete(`${appUrl}/users/${uid}`)\n })\n }),\n\n dev: () => ({\n executePipeline: (body, userId, options) => {\n return api._post(\n `${appUrl}/dev/pipeline`,\n body,\n Object.assign({}, options, { user_id: userId }));\n }\n }),\n\n authProviders: () => ({\n list: () => api._get(`${appUrl}/auth_providers`),\n create: (data) => api._post(`${appUrl}/auth_providers`, data),\n authProvider: (providerId) => ({\n get: () => api._get(`${appUrl}/auth_providers/${providerId}`),\n update: (data) => api._patch(`${appUrl}/auth_providers/${providerId}`, data),\n enable: () => api._put(`${appUrl}/auth_providers/${providerId}/enable`),\n disable: () => api._put(`${appUrl}/auth_providers/${providerId}/disable`),\n remove: () => api._delete(`${appUrl}/auth_providers/${providerId}`)\n })\n }),\n\n security: () => ({\n allowedRequestOrigins: () => ({\n get: () => api._get(`${appUrl}/security/allowed_request_origins`),\n update: (data) => api._post(`${appUrl}/security/allowed_request_origins`, data)\n })\n }),\n\n logs: () => ({\n list: (filter) => api._get(`${appUrl}/logs`, filter)\n }),\n\n apiKeys: () => ({\n list: () => api._get(`${appUrl}/api_keys`),\n create: (data) => api._post(`${appUrl}/api_keys`, data),\n apiKey: (apiKeyId) => ({\n get: () => api._get(`${appUrl}/api_keys/${apiKeyId}`),\n remove: () => api._delete(`${appUrl}/api_keys/${apiKeyId}`),\n enable: () => api._put(`${appUrl}/api_keys/${apiKeyId}/enable`),\n disable: () => api._put(`${appUrl}/api_keys/${apiKeyId}/disable`)\n })\n })\n };\n }\n };\n }\n };\n }\n\n _admin() {\n return {\n logs: () => ({\n get: (filter) => super._do('/admin/logs', 'GET', { useRefreshToken: true, queryParams: filter })\n }),\n users: () => ({\n list: (filter) => super._do('/admin/users', 'GET', { useRefreshToken: true, queryParams: filter }),\n user: (uid) => ({\n logout: () => super._do(`/admin/users/${uid}/logout`, 'PUT', { useRefreshToken: true })\n })\n })\n };\n }\n\n _isImpersonatingUser() {\n return this.auth.isImpersonatingUser();\n }\n\n _startImpersonation(userId) {\n return this.auth.startImpersonation(this, userId);\n }\n\n _stopImpersonation() {\n return this.auth.stopImpersonation();\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/admin.js",";(function () {\n\n var object =\n typeof exports != 'undefined' ? exports :\n typeof self != 'undefined' ? self : // #8: web workers\n $.global; // #31: ExtendScript\n\n var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n function InvalidCharacterError(message) {\n this.message = message;\n }\n InvalidCharacterError.prototype = new Error;\n InvalidCharacterError.prototype.name = 'InvalidCharacterError';\n\n // encoder\n // [https://gist.github.com/999166] by [https://github.com/nignag]\n object.btoa || (\n object.btoa = function (input) {\n var str = String(input);\n for (\n // initialize result and counter\n var block, charCode, idx = 0, map = chars, output = '';\n // if the next str index does not exist:\n // change the mapping table to \"=\"\n // check if d has no fractional digits\n str.charAt(idx | 0) || (map = '=', idx % 1);\n // \"8 - idx % 1 * 8\" generates the sequence 2, 4, 6, 8\n output += map.charAt(63 & block >> 8 - idx % 1 * 8)\n ) {\n charCode = str.charCodeAt(idx += 3/4);\n if (charCode > 0xFF) {\n throw new InvalidCharacterError(\"'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.\");\n }\n block = block << 8 | charCode;\n }\n return output;\n });\n\n // decoder\n // [https://gist.github.com/1020396] by [https://github.com/atk]\n object.atob || (\n object.atob = function (input) {\n var str = String(input).replace(/[=]+$/, ''); // #31: ExtendScript bad parse of /=\n if (str.length % 4 == 1) {\n throw new InvalidCharacterError(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = '';\n // get next character\n buffer = str.charAt(idx++);\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n return output;\n });\n\n}());\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/Base64/base64.js\n// module id = 25\n// module chunks = 0","\"use strict\"\n\nvar writeIEEE754 = require('./float_parser').writeIEEE754,\n\treadIEEE754 = require('./float_parser').readIEEE754,\n Map = require('./map'),\n\tLong = require('./long'),\n Double = require('./double'),\n Timestamp = require('./timestamp'),\n ObjectID = require('./objectid'),\n BSONRegExp = require('./regexp'),\n Symbol = require('./symbol'),\n\tInt32 = require('./int_32'),\n Code = require('./code'),\n\tDecimal128 = require('./decimal128'),\n MinKey = require('./min_key'),\n MaxKey = require('./max_key'),\n DBRef = require('./db_ref'),\n Binary = require('./binary');\n\n// Parts of the parser\nvar deserialize = require('./parser/deserializer'),\n\tserializer = require('./parser/serializer'),\n\tcalculateObjectSize = require('./parser/calculate_size');\n\n/**\n * @ignore\n * @api private\n */\n// Max Size\nvar MAXSIZE = (1024*1024*17);\n// Max Document Buffer size\nvar buffer = new Buffer(MAXSIZE);\n\nvar BSON = function() {\n}\n\n/**\n * Serialize a Javascript object.\n *\n * @param {Object} object the Javascript object to serialize.\n * @param {Boolean} [options.checkKeys] the serializer will check if keys are valid.\n * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**.\n * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**.\n * @return {Buffer} returns the Buffer object containing the serialized object.\n * @api public\n */\nBSON.prototype.serialize = function serialize(object, options) {\n\toptions = options || {};\n\t// Unpack the options\n\tvar checkKeys = typeof options.checkKeys == 'boolean'\n\t\t? options.checkKeys : false;\n\tvar serializeFunctions = typeof options.serializeFunctions == 'boolean'\n\t\t? options.serializeFunctions : false;\n\tvar ignoreUndefined = typeof options.ignoreUndefined == 'boolean'\n\t\t? options.ignoreUndefined : true;\n\n\t// Attempt to serialize\n\tvar serializationIndex = serializer(buffer, object, checkKeys, 0, 0, serializeFunctions, ignoreUndefined, []);\n\t// Create the final buffer\n\tvar finishedBuffer = new Buffer(serializationIndex);\n\t// Copy into the finished buffer\n\tbuffer.copy(finishedBuffer, 0, 0, finishedBuffer.length);\n\t// Return the buffer\n\treturn finishedBuffer;\n}\n\n/**\n * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization.\n *\n * @param {Object} object the Javascript object to serialize.\n * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object.\n * @param {Boolean} [options.checkKeys] the serializer will check if keys are valid.\n * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**.\n * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**.\n * @param {Number} [options.index] the index in the buffer where we wish to start serializing into.\n * @return {Number} returns the index pointing to the last written byte in the buffer.\n * @api public\n */\nBSON.prototype.serializeWithBufferAndIndex = function(object, finalBuffer, options) {\n\toptions = options || {};\n\t// Unpack the options\n\tvar checkKeys = typeof options.checkKeys == 'boolean'\n\t\t? options.checkKeys : false;\n\tvar serializeFunctions = typeof options.serializeFunctions == 'boolean'\n\t\t? options.serializeFunctions : false;\n\tvar ignoreUndefined = typeof options.ignoreUndefined == 'boolean'\n\t\t? options.ignoreUndefined : true;\n\tvar startIndex = typeof options.index == 'number'\n\t\t? options.index : 0;\n\n\t// Attempt to serialize\n\tvar serializationIndex = serializer(buffer, object, checkKeys, startIndex || 0, 0, serializeFunctions, ignoreUndefined);\n\tbuffer.copy(finalBuffer, startIndex, 0, serializationIndex);\n\n\t// Return the index\n\treturn serializationIndex - 1;\n}\n\n/**\n * Deserialize data as BSON.\n *\n * @param {Buffer} buffer the buffer containing the serialized set of BSON documents.\n * @param {Object} [options.evalFunctions=false] evaluate functions in the BSON document scoped to the object deserialized.\n * @param {Object} [options.cacheFunctions=false] cache evaluated functions for reuse.\n * @param {Object} [options.cacheFunctionsCrc32=false] use a crc32 code for caching, otherwise use the string of the function.\n * @param {Object} [options.promoteLongs=true] when deserializing a Long will fit it into a Number if it's smaller than 53 bits\n * @param {Object} [options.promoteBuffers=false] when deserializing a Binary will return it as a node.js Buffer instance.\n * @param {Object} [options.promoteValues=false] when deserializing will promote BSON values to their Node.js closest equivalent types.\n * @param {Object} [options.fieldsAsRaw=null] allow to specify if there what fields we wish to return as unserialized raw buffer.\n * @param {Object} [options.bsonRegExp=false] return BSON regular expressions as BSONRegExp instances.\n * @return {Object} returns the deserialized Javascript Object.\n * @api public\n */\nBSON.prototype.deserialize = function(buffer, options) {\n return deserialize(buffer, options);\n}\n\n/**\n * Calculate the bson size for a passed in Javascript object.\n *\n * @param {Object} object the Javascript object to calculate the BSON byte size for.\n * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**.\n * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**.\n * @return {Number} returns the number of bytes the BSON object will take up.\n * @api public\n */\nBSON.prototype.calculateObjectSize = function(object, options) {\n\toptions = options || {};\n\n\tvar serializeFunctions = typeof options.serializeFunctions == 'boolean'\n\t\t? options.serializeFunctions : false;\n\tvar ignoreUndefined = typeof options.ignoreUndefined == 'boolean'\n\t\t? options.ignoreUndefined : true;\n\n return calculateObjectSize(object, serializeFunctions, ignoreUndefined);\n}\n\n/**\n * Deserialize stream data as BSON documents.\n *\n * @param {Buffer} data the buffer containing the serialized set of BSON documents.\n * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start.\n * @param {Number} numberOfDocuments number of documents to deserialize.\n * @param {Array} documents an array where to store the deserialized documents.\n * @param {Number} docStartIndex the index in the documents array from where to start inserting documents.\n * @param {Object} [options] additional options used for the deserialization.\n * @param {Object} [options.evalFunctions=false] evaluate functions in the BSON document scoped to the object deserialized.\n * @param {Object} [options.cacheFunctions=false] cache evaluated functions for reuse.\n * @param {Object} [options.cacheFunctionsCrc32=false] use a crc32 code for caching, otherwise use the string of the function.\n * @param {Object} [options.promoteLongs=true] when deserializing a Long will fit it into a Number if it's smaller than 53 bits\n * @param {Object} [options.promoteBuffers=false] when deserializing a Binary will return it as a node.js Buffer instance.\n * @param {Object} [options.promoteValues=false] when deserializing will promote BSON values to their Node.js closest equivalent types.\n * @param {Object} [options.fieldsAsRaw=null] allow to specify if there what fields we wish to return as unserialized raw buffer.\n * @param {Object} [options.bsonRegExp=false] return BSON regular expressions as BSONRegExp instances.\n * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents.\n * @api public\n */\nBSON.prototype.deserializeStream = function(data, startIndex, numberOfDocuments, documents, docStartIndex, options) {\n options = options != null ? options : {};\n var index = startIndex;\n // Loop over all documents\n for(var i = 0; i < numberOfDocuments; i++) {\n // Find size of the document\n var size = data[index] | data[index + 1] << 8 | data[index + 2] << 16 | data[index + 3] << 24;\n // Update options with index\n options['index'] = index;\n // Parse the document at this point\n documents[docStartIndex + i] = this.deserialize(data, options);\n // Adjust index by the document size\n index = index + size;\n }\n\n // Return object containing end index of parsing and list of documents\n return index;\n}\n\n/**\n * @ignore\n * @api private\n */\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\nBSON.BSON_INT64_MAX = Math.pow(2, 63) - 1;\nBSON.BSON_INT64_MIN = -Math.pow(2, 63);\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\n// Internal long versions\nvar JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double.\nvar JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double.\n\n/**\n * Number BSON Type\n *\n * @classconstant BSON_DATA_NUMBER\n **/\nBSON.BSON_DATA_NUMBER = 1;\n/**\n * String BSON Type\n *\n * @classconstant BSON_DATA_STRING\n **/\nBSON.BSON_DATA_STRING = 2;\n/**\n * Object BSON Type\n *\n * @classconstant BSON_DATA_OBJECT\n **/\nBSON.BSON_DATA_OBJECT = 3;\n/**\n * Array BSON Type\n *\n * @classconstant BSON_DATA_ARRAY\n **/\nBSON.BSON_DATA_ARRAY = 4;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_BINARY\n **/\nBSON.BSON_DATA_BINARY = 5;\n/**\n * ObjectID BSON Type\n *\n * @classconstant BSON_DATA_OID\n **/\nBSON.BSON_DATA_OID = 7;\n/**\n * Boolean BSON Type\n *\n * @classconstant BSON_DATA_BOOLEAN\n **/\nBSON.BSON_DATA_BOOLEAN = 8;\n/**\n * Date BSON Type\n *\n * @classconstant BSON_DATA_DATE\n **/\nBSON.BSON_DATA_DATE = 9;\n/**\n * null BSON Type\n *\n * @classconstant BSON_DATA_NULL\n **/\nBSON.BSON_DATA_NULL = 10;\n/**\n * RegExp BSON Type\n *\n * @classconstant BSON_DATA_REGEXP\n **/\nBSON.BSON_DATA_REGEXP = 11;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_CODE\n **/\nBSON.BSON_DATA_CODE = 13;\n/**\n * Symbol BSON Type\n *\n * @classconstant BSON_DATA_SYMBOL\n **/\nBSON.BSON_DATA_SYMBOL = 14;\n/**\n * Code with Scope BSON Type\n *\n * @classconstant BSON_DATA_CODE_W_SCOPE\n **/\nBSON.BSON_DATA_CODE_W_SCOPE = 15;\n/**\n * 32 bit Integer BSON Type\n *\n * @classconstant BSON_DATA_INT\n **/\nBSON.BSON_DATA_INT = 16;\n/**\n * Timestamp BSON Type\n *\n * @classconstant BSON_DATA_TIMESTAMP\n **/\nBSON.BSON_DATA_TIMESTAMP = 17;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_LONG\n **/\nBSON.BSON_DATA_LONG = 18;\n/**\n * MinKey BSON Type\n *\n * @classconstant BSON_DATA_MIN_KEY\n **/\nBSON.BSON_DATA_MIN_KEY = 0xff;\n/**\n * MaxKey BSON Type\n *\n * @classconstant BSON_DATA_MAX_KEY\n **/\nBSON.BSON_DATA_MAX_KEY = 0x7f;\n\n/**\n * Binary Default Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_DEFAULT\n **/\nBSON.BSON_BINARY_SUBTYPE_DEFAULT = 0;\n/**\n * Binary Function Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_FUNCTION\n **/\nBSON.BSON_BINARY_SUBTYPE_FUNCTION = 1;\n/**\n * Binary Byte Array Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY\n **/\nBSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;\n/**\n * Binary UUID Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_UUID\n **/\nBSON.BSON_BINARY_SUBTYPE_UUID = 3;\n/**\n * Binary MD5 Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_MD5\n **/\nBSON.BSON_BINARY_SUBTYPE_MD5 = 4;\n/**\n * Binary User Defined Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED\n **/\nBSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128;\n\n// Return BSON\nmodule.exports = BSON;\nmodule.exports.Code = Code;\nmodule.exports.Map = Map;\nmodule.exports.Symbol = Symbol;\nmodule.exports.BSON = BSON;\nmodule.exports.DBRef = DBRef;\nmodule.exports.Binary = Binary;\nmodule.exports.ObjectID = ObjectID;\nmodule.exports.Long = Long;\nmodule.exports.Timestamp = Timestamp;\nmodule.exports.Double = Double;\nmodule.exports.Int32 = Int32;\nmodule.exports.MinKey = MinKey;\nmodule.exports.MaxKey = MaxKey;\nmodule.exports.BSONRegExp = BSONRegExp;\nmodule.exports.Decimal128 = Decimal128;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/bson.js","\"use strict\"\n\nvar writeIEEE754 = require('../float_parser').writeIEEE754\n\t, readIEEE754 = require('../float_parser').readIEEE754\n\t, Long = require('../long').Long\n , Double = require('../double').Double\n , Timestamp = require('../timestamp').Timestamp\n , ObjectID = require('../objectid').ObjectID\n , Symbol = require('../symbol').Symbol\n , BSONRegExp = require('../regexp').BSONRegExp\n , Code = require('../code').Code\n\t, Decimal128 = require('../decimal128')\n , MinKey = require('../min_key').MinKey\n , MaxKey = require('../max_key').MaxKey\n , DBRef = require('../db_ref').DBRef\n , Binary = require('../binary').Binary;\n\n// To ensure that 0.4 of node works correctly\nvar isDate = function isDate(d) {\n return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]';\n}\n\nvar calculateObjectSize = function calculateObjectSize(object, serializeFunctions, ignoreUndefined) {\n var totalLength = (4 + 1);\n\n if(Array.isArray(object)) {\n for(var i = 0; i < object.length; i++) {\n totalLength += calculateElement(i.toString(), object[i], serializeFunctions, true, ignoreUndefined)\n }\n } else {\n\t\t// If we have toBSON defined, override the current object\n\t\tif(object.toBSON) {\n\t\t\tobject = object.toBSON();\n\t\t}\n\n\t\t// Calculate size\n for(var key in object) {\n totalLength += calculateElement(key, object[key], serializeFunctions, false, ignoreUndefined)\n }\n }\n\n return totalLength;\n}\n\n/**\n * @ignore\n * @api private\n */\nfunction calculateElement(name, value, serializeFunctions, isArray, ignoreUndefined) {\n\t// If we have toBSON defined, override the current object\n if(value && value.toBSON){\n value = value.toBSON();\n }\n\n switch(typeof value) {\n case 'string':\n return 1 + Buffer.byteLength(name, 'utf8') + 1 + 4 + Buffer.byteLength(value, 'utf8') + 1;\n case 'number':\n if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) {\n if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { // 32 bit\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (4 + 1);\n } else {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1);\n }\n } else { // 64 bit\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1);\n }\n case 'undefined':\n if(isArray || !ignoreUndefined) return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1);\n return 0;\n case 'boolean':\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1 + 1);\n case 'object':\n if(value == null || value instanceof MinKey || value instanceof MaxKey || value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1);\n } else if(value instanceof ObjectID || value['_bsontype'] == 'ObjectID') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (12 + 1);\n } else if(value instanceof Date || isDate(value)) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1);\n } else if(typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1 + 4 + 1) + value.length;\n } else if(value instanceof Long || value instanceof Double || value instanceof Timestamp\n || value['_bsontype'] == 'Long' || value['_bsontype'] == 'Double' || value['_bsontype'] == 'Timestamp') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1);\n\t\t\t} else if(value instanceof Decimal128 || value['_bsontype'] == 'Decimal128') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (16 + 1);\n } else if(value instanceof Code || value['_bsontype'] == 'Code') {\n // Calculate size depending on the availability of a scope\n if(value.scope != null && Object.keys(value.scope).length > 0) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + 4 + Buffer.byteLength(value.code.toString(), 'utf8') + 1 + calculateObjectSize(value.scope, serializeFunctions, ignoreUndefined);\n } else {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + Buffer.byteLength(value.code.toString(), 'utf8') + 1;\n }\n } else if(value instanceof Binary || value['_bsontype'] == 'Binary') {\n // Check what kind of subtype we have\n if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (value.position + 1 + 4 + 1 + 4);\n } else {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (value.position + 1 + 4 + 1);\n }\n } else if(value instanceof Symbol || value['_bsontype'] == 'Symbol') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + Buffer.byteLength(value.value, 'utf8') + 4 + 1 + 1;\n } else if(value instanceof DBRef || value['_bsontype'] == 'DBRef') {\n // Set up correct object for serialization\n var ordered_values = {\n '$ref': value.namespace\n , '$id' : value.oid\n };\n\n // Add db reference if it exists\n if(null != value.db) {\n ordered_values['$db'] = value.db;\n }\n\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + calculateObjectSize(ordered_values, serializeFunctions, ignoreUndefined);\n } else if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + Buffer.byteLength(value.source, 'utf8') + 1\n + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1\n } else if(value instanceof BSONRegExp || value['_bsontype'] == 'BSONRegExp') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + Buffer.byteLength(value.pattern, 'utf8') + 1\n + Buffer.byteLength(value.options, 'utf8') + 1\n } else {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + calculateObjectSize(value, serializeFunctions, ignoreUndefined) + 1;\n }\n case 'function':\n // WTF for 0.4.X where typeof /someregexp/ === 'function'\n if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]' || String.call(value) == '[object RegExp]') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + Buffer.byteLength(value.source, 'utf8') + 1\n + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1\n } else {\n if(serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + 4 + Buffer.byteLength(value.toString(), 'utf8') + 1 + calculateObjectSize(value.scope, serializeFunctions, ignoreUndefined);\n } else if(serializeFunctions) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + Buffer.byteLength(value.toString(), 'utf8') + 1;\n }\n }\n }\n\n return 0;\n}\n\nvar BSON = {};\n\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\nmodule.exports = calculateObjectSize;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/parser/calculate_size.js","\"use strict\"\n\nvar readIEEE754 = require('../float_parser').readIEEE754,\n\tf = require('util').format,\n\tLong = require('../long').Long,\n Double = require('../double').Double,\n Timestamp = require('../timestamp').Timestamp,\n ObjectID = require('../objectid').ObjectID,\n Symbol = require('../symbol').Symbol,\n Code = require('../code').Code,\n MinKey = require('../min_key').MinKey,\n MaxKey = require('../max_key').MaxKey,\n\tDecimal128 = require('../decimal128'),\n\tInt32 = require('../int_32'),\n DBRef = require('../db_ref').DBRef,\n BSONRegExp = require('../regexp').BSONRegExp,\n Binary = require('../binary').Binary;\n\nvar deserialize = function(buffer, options, isArray) {\n\toptions = options == null ? {} : options;\n\tvar index = options && options.index ? options.index : 0;\n\t// Read the document size\n var size = buffer[index] | buffer[index+1] << 8 | buffer[index+2] << 16 | buffer[index+3] << 24;\n\n\t// Ensure buffer is valid size\n if(size < 5 || buffer.length < size || (size + index) > buffer.length) {\n\t\tthrow new Error(\"corrupt bson message\");\n\t}\n\n\t// Illegal end value\n\tif(buffer[index + size - 1] != 0) {\n\t\tthrow new Error(\"One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00\");\n\t}\n\n\t// Start deserializtion\n\treturn deserializeObject(buffer, index, options, isArray);\n}\n\nvar deserializeObject = function(buffer, index, options, isArray) {\n\tvar evalFunctions = options['evalFunctions'] == null ? false : options['evalFunctions'];\n var cacheFunctions = options['cacheFunctions'] == null ? false : options['cacheFunctions'];\n var cacheFunctionsCrc32 = options['cacheFunctionsCrc32'] == null ? false : options['cacheFunctionsCrc32'];\n\tvar fieldsAsRaw = options['fieldsAsRaw'] == null ? null : options['fieldsAsRaw'];\n\n\t// Return raw bson buffer instead of parsing it\n\tvar raw = options['raw'] == null ? false : options['raw'];\n\n\t// Return BSONRegExp objects instead of native regular expressions\n var bsonRegExp = typeof options['bsonRegExp'] == 'boolean' ? options['bsonRegExp'] : false;\n\n\t// Controls the promotion of values vs wrapper classes\n\tvar promoteBuffers = options['promoteBuffers'] == null ? false : options['promoteBuffers'];\n\tvar promoteLongs = options['promoteLongs'] == null ? true : options['promoteLongs'];\n\tvar promoteValues = options['promoteValues'] == null ? true : options['promoteValues'];\n\n\t// Set the start index\n\tvar startIndex = index;\n\n // Validate that we have at least 4 bytes of buffer\n if(buffer.length < 5) throw new Error(\"corrupt bson message < 5 bytes long\");\n\n\t// Read the document size\n var size = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n\t// Ensure buffer is valid size\n if(size < 5 || size > buffer.length) throw new Error(\"corrupt bson message\");\n\n // Create holding object\n var object = isArray ? [] : {};\n\t// Used for arrays to skip having to perform utf8 decoding\n\tvar arrayIndex = 0;\n\n // While we have more left data left keep parsing\n while(true) {\n // Read the type\n var elementType = buffer[index++];\n // If we get a zero it's the last byte, exit\n if(elementType == 0) {\n\t\t\tbreak;\n\t\t}\n\n\t\t// Get the start search index\n\t\tvar i = index;\n\t\t// Locate the end of the c string\n\t\twhile(buffer[i] !== 0x00 && i < buffer.length) {\n\t\t\ti++\n\t\t}\n\n\t\t// If are at the end of the buffer there is a problem with the document\n\t\tif(i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\")\n\t\tvar name = isArray ? arrayIndex++ : buffer.toString('utf8', index, i);\n\n\t\tindex = i + 1;\n\n\t\tif(elementType == BSON.BSON_DATA_STRING) {\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\tif(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n object[name] = buffer.toString('utf8', index, index + stringSize - 1);\n index = index + stringSize;\n\t\t} else if(elementType == BSON.BSON_DATA_OID) {\n\t\t\tvar oid = new Buffer(12);\n\t\t\tbuffer.copy(oid, 0, index, index + 12);\n object[name] = new ObjectID(oid);\n index = index + 12;\n\t\t} else if(elementType == BSON.BSON_DATA_INT && promoteValues == false) {\n\t\t\tobject[name] = new Int32(buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24);\n\t\t} else if(elementType == BSON.BSON_DATA_INT) {\n object[name] = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t} else if(elementType == BSON.BSON_DATA_NUMBER && promoteValues == false) {\n\t\t\tobject[name] = new Double(buffer.readDoubleLE(index));\n\t\t\tindex = index + 8;\n\t\t} else if(elementType == BSON.BSON_DATA_NUMBER) {\n\t\t\tobject[name] = buffer.readDoubleLE(index);\n index = index + 8;\n\t\t} else if(elementType == BSON.BSON_DATA_DATE) {\n var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n object[name] = new Date(new Long(lowBits, highBits).toNumber());\n\t\t} else if(elementType == BSON.BSON_DATA_BOOLEAN) {\n\t\t\tif(buffer[index] != 0 && buffer[index] != 1) throw new Error('illegal boolean type value');\n object[name] = buffer[index++] == 1;\n\t\t} else if(elementType == BSON.BSON_DATA_OBJECT) {\n\t\t\tvar _index = index;\n var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;\n\t\t\tif(objectSize <= 0 || objectSize > (buffer.length - index)) throw new Error(\"bad embedded document length in bson\");\n\n\t\t\t// We have a raw value\n\t\t\tif(raw) {\n\t object[name] = buffer.slice(index, index + objectSize);\n\t\t\t} else {\n\t object[name] = deserializeObject(buffer, _index, options, false);\n\t\t\t}\n\n index = index + objectSize;\n\t\t} else if(elementType == BSON.BSON_DATA_ARRAY) {\n\t\t\tvar _index = index;\n var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;\n\t\t\tvar arrayOptions = options;\n\n\t\t\t// Stop index\n\t\t\tvar stopIndex = index + objectSize;\n\n\t\t\t// All elements of array to be returned as raw bson\n\t\t\tif(fieldsAsRaw && fieldsAsRaw[name]) {\n\t\t\t\tarrayOptions = {};\n\t\t\t\tfor(var n in options) arrayOptions[n] = options[n];\n\t\t\t\tarrayOptions['raw'] = true;\n\t\t\t}\n\n object[name] = deserializeObject(buffer, _index, arrayOptions, true);\n index = index + objectSize;\n\n\t\t\tif(buffer[index - 1] != 0) throw new Error('invalid array terminator byte');\n\t\t\tif(index != stopIndex) throw new Error('corrupted array bson');\n\t\t} else if(elementType == BSON.BSON_DATA_UNDEFINED) {\n object[name] = undefined;\n\t\t} else if(elementType == BSON.BSON_DATA_NULL) {\n\t\t\tobject[name] = null;\n\t\t} else if(elementType == BSON.BSON_DATA_LONG) {\n // Unpack the low and high bits\n var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var long = new Long(lowBits, highBits);\n // Promote the long if possible\n if(promoteLongs && promoteValues == true) {\n object[name] = long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG) ? long.toNumber() : long;\n } else {\n object[name] = long;\n }\n\t\t} else if(elementType == BSON.BSON_DATA_DECIMAL128) {\n\t\t\t// Buffer to contain the decimal bytes\n\t\t\tvar bytes = new Buffer(16);\n\t\t\t// Copy the next 16 bytes into the bytes buffer\n\t\t\tbuffer.copy(bytes, 0, index, index + 16);\n\t\t\t// Update index\n\t\t\tindex = index + 16;\n\t\t\t// Assign the new Decimal128 value\n\t\t\tvar decimal128 = new Decimal128(bytes);\n\t\t\t// If we have an alternative mapper use that\n\t\t\tobject[name] = decimal128.toObject ? decimal128.toObject() : decimal128;\n\t\t} else if(elementType == BSON.BSON_DATA_BINARY) {\n var binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\tvar totalBinarySize = binarySize;\n var subType = buffer[index++];\n\n\t\t\t// Did we have a negative binary size, throw\n\t\t\tif(binarySize < 0) throw new Error('Negative binary type element size found');\n\n\t\t\t// Is the length longer than the document\n\t\t\tif(binarySize > buffer.length) throw new Error('Binary type size larger than document size');\n\n\t\t\t// Decode as raw Buffer object if options specifies it\n if(buffer['slice'] != null) {\n // If we have subtype 2 skip the 4 bytes for the size\n if(subType == Binary.SUBTYPE_BYTE_ARRAY) {\n binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\t\t\tif(binarySize < 0) throw new Error('Negative binary type element size found for subtype 0x02');\n\t\t\t\t\tif(binarySize > (totalBinarySize - 4)) throw new Error('Binary type with subtype 0x02 contains to long binary size');\n\t\t\t\t\tif(binarySize < (totalBinarySize - 4)) throw new Error('Binary type with subtype 0x02 contains to short binary size');\n }\n\n if(promoteBuffers && promoteValues) {\n object[name] = buffer.slice(index, index + binarySize);\n } else {\n object[name] = new Binary(buffer.slice(index, index + binarySize), subType);\n }\n } else {\n var _buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(binarySize)) : new Array(binarySize);\n // If we have subtype 2 skip the 4 bytes for the size\n if(subType == Binary.SUBTYPE_BYTE_ARRAY) {\n binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\t\t\tif(binarySize < 0) throw new Error('Negative binary type element size found for subtype 0x02');\n\t\t\t\t\tif(binarySize > (totalBinarySize - 4)) throw new Error('Binary type with subtype 0x02 contains to long binary size');\n\t\t\t\t\tif(binarySize < (totalBinarySize - 4)) throw new Error('Binary type with subtype 0x02 contains to short binary size');\n }\n\n // Copy the data\n for(var i = 0; i < binarySize; i++) {\n _buffer[i] = buffer[index + i];\n }\n\n if(promoteBuffers && promoteValues) {\n object[name] = _buffer;\n } else {\n object[name] = new Binary(_buffer, subType);\n }\n }\n\n // Update the index\n index = index + binarySize;\n\t\t} else if(elementType == BSON.BSON_DATA_REGEXP && bsonRegExp == false) {\n\t\t\t// Get the start search index\n\t\t\tvar i = index;\n\t\t\t// Locate the end of the c string\n\t\t\twhile(buffer[i] !== 0x00 && i < buffer.length) {\n\t\t\t\ti++\n\t\t\t}\n\t\t\t// If are at the end of the buffer there is a problem with the document\n\t\t\tif(i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\")\n\t\t\t// Return the C string\n\t\t\tvar source = buffer.toString('utf8', index, i);\n // Create the regexp\n\t\t\tindex = i + 1;\n\n\t\t\t// Get the start search index\n\t\t\tvar i = index;\n\t\t\t// Locate the end of the c string\n\t\t\twhile(buffer[i] !== 0x00 && i < buffer.length) {\n\t\t\t\ti++\n\t\t\t}\n\t\t\t// If are at the end of the buffer there is a problem with the document\n\t\t\tif(i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\")\n\t\t\t// Return the C string\n\t\t\tvar regExpOptions = buffer.toString('utf8', index, i);\n\t\t\tindex = i + 1;\n\n // For each option add the corresponding one for javascript\n var optionsArray = new Array(regExpOptions.length);\n\n // Parse options\n for(var i = 0; i < regExpOptions.length; i++) {\n switch(regExpOptions[i]) {\n case 'm':\n optionsArray[i] = 'm';\n break;\n case 's':\n optionsArray[i] = 'g';\n break;\n case 'i':\n optionsArray[i] = 'i';\n break;\n }\n }\n\n object[name] = new RegExp(source, optionsArray.join(''));\n } else if(elementType == BSON.BSON_DATA_REGEXP && bsonRegExp == true) {\n\t\t\t// Get the start search index\n\t\t\tvar i = index;\n\t\t\t// Locate the end of the c string\n\t\t\twhile(buffer[i] !== 0x00 && i < buffer.length) {\n\t\t\t\ti++\n\t\t\t}\n\t\t\t// If are at the end of the buffer there is a problem with the document\n\t\t\tif(i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\")\n\t\t\t// Return the C string\n\t\t\tvar source = buffer.toString('utf8', index, i);\n index = i + 1;\n\n\t\t\t// Get the start search index\n\t\t\tvar i = index;\n\t\t\t// Locate the end of the c string\n\t\t\twhile(buffer[i] !== 0x00 && i < buffer.length) {\n\t\t\t\ti++\n\t\t\t}\n\t\t\t// If are at the end of the buffer there is a problem with the document\n\t\t\tif(i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\")\n\t\t\t// Return the C string\n\t\t\tvar regExpOptions = buffer.toString('utf8', index, i);\n index = i + 1;\n\n // Set the object\n object[name] = new BSONRegExp(source, regExpOptions);\n\t\t} else if(elementType == BSON.BSON_DATA_SYMBOL) {\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\tif(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n object[name] = new Symbol(buffer.toString('utf8', index, index + stringSize - 1));\n index = index + stringSize;\n\t\t} else if(elementType == BSON.BSON_DATA_TIMESTAMP) {\n var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n object[name] = new Timestamp(lowBits, highBits);\n\t\t} else if(elementType == BSON.BSON_DATA_MIN_KEY) {\n object[name] = new MinKey();\n\t\t} else if(elementType == BSON.BSON_DATA_MAX_KEY) {\n object[name] = new MaxKey();\n\t\t} else if(elementType == BSON.BSON_DATA_CODE) {\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\tif(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n var functionString = buffer.toString('utf8', index, index + stringSize - 1);\n\n // If we are evaluating the functions\n if(evalFunctions) {\n var value = null;\n // If we have cache enabled let's look for the md5 of the function in the cache\n if(cacheFunctions) {\n var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString;\n // Got to do this to avoid V8 deoptimizing the call due to finding eval\n object[name] = isolateEvalWithHash(functionCache, hash, functionString, object);\n } else {\n object[name] = isolateEval(functionString);\n }\n } else {\n object[name] = new Code(functionString);\n }\n\n // Update parse index position\n index = index + stringSize;\n\t\t} else if(elementType == BSON.BSON_DATA_CODE_W_SCOPE) {\n var totalSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n\t\t\t// Element cannot be shorter than totalSize + stringSize + documentSize + terminator\n\t\t\tif(totalSize < (4 + 4 + 4 + 1)) {\n\t\t\t\tthrow new Error(\"code_w_scope total size shorter minimum expected length\");\n\t\t\t}\n\n\t\t\t// Get the code string size\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\t// Check if we have a valid string\n\t\t\tif(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n\n // Javascript function\n var functionString = buffer.toString('utf8', index, index + stringSize - 1);\n // Update parse index position\n index = index + stringSize;\n // Parse the element\n\t\t\tvar _index = index;\n // Decode the size of the object document\n var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;\n // Decode the scope object\n var scopeObject = deserializeObject(buffer, _index, options, false);\n // Adjust the index\n index = index + objectSize;\n\n\t\t\t// Check if field length is to short\n\t\t\tif(totalSize < (4 + 4 + objectSize + stringSize)) {\n\t\t\t\tthrow new Error('code_w_scope total size is to short, truncating scope');\n\t\t\t}\n\n\t\t\t// Check if totalSize field is to long\n\t\t\tif(totalSize > (4 + 4 + objectSize + stringSize)) {\n\t\t\t\tthrow new Error('code_w_scope total size is to long, clips outer document');\n\t\t\t}\n\n // If we are evaluating the functions\n if(evalFunctions) {\n // Contains the value we are going to set\n var value = null;\n // If we have cache enabled let's look for the md5 of the function in the cache\n if(cacheFunctions) {\n var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString;\n // Got to do this to avoid V8 deoptimizing the call due to finding eval\n object[name] = isolateEvalWithHash(functionCache, hash, functionString, object);\n } else {\n object[name] = isolateEval(functionString);\n }\n\n object[name].scope = scopeObject;\n } else {\n object[name] = new Code(functionString, scopeObject);\n }\n\t\t} else if(elementType == BSON.BSON_DATA_DBPOINTER) {\n\t\t\t// Get the code string size\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\t// Check if we have a valid string\n\t\t\tif(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n\t\t\t// Namespace\n var namespace = buffer.toString('utf8', index, index + stringSize - 1);\n\t\t\t// Update parse index position\n index = index + stringSize;\n\n\t\t\t// Read the oid\n\t\t\tvar oidBuffer = new Buffer(12);\n\t\t\tbuffer.copy(oidBuffer, 0, index, index + 12);\n var oid = new ObjectID(oidBuffer);\n\n\t\t\t// Update the index\n\t\t\tindex = index + 12;\n\n\t\t\t// Split the namespace\n\t\t\tvar parts = namespace.split('.');\n\t\t\tvar db = parts.shift();\n\t\t\tvar collection = parts.join('.');\n\t\t\t// Upgrade to DBRef type\n\t\t\tobject[name] = new DBRef(collection, oid, db);\n } else {\n\t\t\tthrow new Error(\"Detected unknown BSON type \" + elementType.toString(16) + \" for fieldname \\\"\" + name + \"\\\", are you using the latest BSON parser\");\n\t\t}\n }\n\n\t// Check if the deserialization was against a valid array/object\n\tif(size != (index - startIndex)) {\n\t\tif(isArray) throw new Error('corrupt array bson');\n\t\tthrow new Error('corrupt object bson');\n\t}\n\n // Check if we have a db ref object\n if(object['$id'] != null) object = new DBRef(object['$ref'], object['$id'], object['$db']);\n return object;\n}\n\n/**\n * Ensure eval is isolated.\n *\n * @ignore\n * @api private\n */\nvar isolateEvalWithHash = function(functionCache, hash, functionString, object) {\n // Contains the value we are going to set\n var value = null;\n\n // Check for cache hit, eval if missing and return cached function\n if(functionCache[hash] == null) {\n eval(\"value = \" + functionString);\n functionCache[hash] = value;\n }\n // Set the object\n return functionCache[hash].bind(object);\n}\n\n/**\n * Ensure eval is isolated.\n *\n * @ignore\n * @api private\n */\nvar isolateEval = function(functionString) {\n // Contains the value we are going to set\n var value = null;\n // Eval the function\n eval(\"value = \" + functionString);\n return value;\n}\n\nvar BSON = {};\n\n/**\n * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5\n *\n * @ignore\n * @api private\n */\nvar functionCache = BSON.functionCache = {};\n\n/**\n * Number BSON Type\n *\n * @classconstant BSON_DATA_NUMBER\n **/\nBSON.BSON_DATA_NUMBER = 1;\n/**\n * String BSON Type\n *\n * @classconstant BSON_DATA_STRING\n **/\nBSON.BSON_DATA_STRING = 2;\n/**\n * Object BSON Type\n *\n * @classconstant BSON_DATA_OBJECT\n **/\nBSON.BSON_DATA_OBJECT = 3;\n/**\n * Array BSON Type\n *\n * @classconstant BSON_DATA_ARRAY\n **/\nBSON.BSON_DATA_ARRAY = 4;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_BINARY\n **/\nBSON.BSON_DATA_BINARY = 5;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_UNDEFINED\n **/\nBSON.BSON_DATA_UNDEFINED = 6;\n/**\n * ObjectID BSON Type\n *\n * @classconstant BSON_DATA_OID\n **/\nBSON.BSON_DATA_OID = 7;\n/**\n * Boolean BSON Type\n *\n * @classconstant BSON_DATA_BOOLEAN\n **/\nBSON.BSON_DATA_BOOLEAN = 8;\n/**\n * Date BSON Type\n *\n * @classconstant BSON_DATA_DATE\n **/\nBSON.BSON_DATA_DATE = 9;\n/**\n * null BSON Type\n *\n * @classconstant BSON_DATA_NULL\n **/\nBSON.BSON_DATA_NULL = 10;\n/**\n * RegExp BSON Type\n *\n * @classconstant BSON_DATA_REGEXP\n **/\nBSON.BSON_DATA_REGEXP = 11;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_DBPOINTER\n **/\nBSON.BSON_DATA_DBPOINTER = 12;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_CODE\n **/\nBSON.BSON_DATA_CODE = 13;\n/**\n * Symbol BSON Type\n *\n * @classconstant BSON_DATA_SYMBOL\n **/\nBSON.BSON_DATA_SYMBOL = 14;\n/**\n * Code with Scope BSON Type\n *\n * @classconstant BSON_DATA_CODE_W_SCOPE\n **/\nBSON.BSON_DATA_CODE_W_SCOPE = 15;\n/**\n * 32 bit Integer BSON Type\n *\n * @classconstant BSON_DATA_INT\n **/\nBSON.BSON_DATA_INT = 16;\n/**\n * Timestamp BSON Type\n *\n * @classconstant BSON_DATA_TIMESTAMP\n **/\nBSON.BSON_DATA_TIMESTAMP = 17;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_LONG\n **/\nBSON.BSON_DATA_LONG = 18;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_DECIMAL128\n **/\nBSON.BSON_DATA_DECIMAL128 = 19;\n/**\n * MinKey BSON Type\n *\n * @classconstant BSON_DATA_MIN_KEY\n **/\nBSON.BSON_DATA_MIN_KEY = 0xff;\n/**\n * MaxKey BSON Type\n *\n * @classconstant BSON_DATA_MAX_KEY\n **/\nBSON.BSON_DATA_MAX_KEY = 0x7f;\n\n/**\n * Binary Default Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_DEFAULT\n **/\nBSON.BSON_BINARY_SUBTYPE_DEFAULT = 0;\n/**\n * Binary Function Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_FUNCTION\n **/\nBSON.BSON_BINARY_SUBTYPE_FUNCTION = 1;\n/**\n * Binary Byte Array Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY\n **/\nBSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;\n/**\n * Binary UUID Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_UUID\n **/\nBSON.BSON_BINARY_SUBTYPE_UUID = 3;\n/**\n * Binary MD5 Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_MD5\n **/\nBSON.BSON_BINARY_SUBTYPE_MD5 = 4;\n/**\n * Binary User Defined Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED\n **/\nBSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128;\n\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\nBSON.BSON_INT64_MAX = Math.pow(2, 63) - 1;\nBSON.BSON_INT64_MIN = -Math.pow(2, 63);\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\n// Internal long versions\nvar JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double.\nvar JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double.\n\nmodule.exports = deserialize\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/parser/deserializer.js","\"use strict\"\n\nvar writeIEEE754 = require('../float_parser').writeIEEE754,\n readIEEE754 = require('../float_parser').readIEEE754,\n Long = require('../long').Long,\n Map = require('../map'),\n Double = require('../double').Double,\n Timestamp = require('../timestamp').Timestamp,\n ObjectID = require('../objectid').ObjectID,\n Symbol = require('../symbol').Symbol,\n Code = require('../code').Code,\n BSONRegExp = require('../regexp').BSONRegExp,\n Int32 = require('../int_32').Int32,\n MinKey = require('../min_key').MinKey,\n MaxKey = require('../max_key').MaxKey,\n Decimal128 = require('../decimal128'),\n DBRef = require('../db_ref').DBRef,\n Binary = require('../binary').Binary;\n\ntry {\n var _Buffer = Uint8Array;\n} catch(e) {\n var _Buffer = Buffer;\n}\n\nvar regexp = /\\x00/\n\n// To ensure that 0.4 of node works correctly\nvar isDate = function isDate(d) {\n return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]';\n}\n\nvar isRegExp = function isRegExp(d) {\n return Object.prototype.toString.call(d) === '[object RegExp]';\n}\n\nvar serializeString = function(buffer, key, value, index, isArray) {\n // Encode String type\n buffer[index++] = BSON.BSON_DATA_STRING;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes + 1;\n buffer[index - 1] = 0;\n // Write the string\n var size = buffer.write(value, index + 4, 'utf8');\n // Write the size of the string to buffer\n buffer[index + 3] = (size + 1 >> 24) & 0xff;\n buffer[index + 2] = (size + 1 >> 16) & 0xff;\n buffer[index + 1] = (size + 1 >> 8) & 0xff;\n buffer[index] = size + 1 & 0xff;\n // Update index\n index = index + 4 + size;\n // Write zero\n buffer[index++] = 0;\n return index;\n}\n\nvar serializeNumber = function(buffer, key, value, index, isArray) {\n // We have an integer value\n if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) {\n // If the value fits in 32 bits encode as int, if it fits in a double\n // encode it as a double, otherwise long\n if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) {\n // Set int type 32 bits or less\n buffer[index++] = BSON.BSON_DATA_INT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the int value\n buffer[index++] = value & 0xff;\n buffer[index++] = (value >> 8) & 0xff;\n buffer[index++] = (value >> 16) & 0xff;\n buffer[index++] = (value >> 24) & 0xff;\n } else if(value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) {\n // Encode as double\n buffer[index++] = BSON.BSON_DATA_NUMBER;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write float\n writeIEEE754(buffer, value, index, 'little', 52, 8);\n // Ajust index\n index = index + 8;\n } else {\n // Set long type\n buffer[index++] = BSON.BSON_DATA_LONG;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n var longVal = Long.fromNumber(value);\n var lowBits = longVal.getLowBits();\n var highBits = longVal.getHighBits();\n // Encode low bits\n buffer[index++] = lowBits & 0xff;\n buffer[index++] = (lowBits >> 8) & 0xff;\n buffer[index++] = (lowBits >> 16) & 0xff;\n buffer[index++] = (lowBits >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = highBits & 0xff;\n buffer[index++] = (highBits >> 8) & 0xff;\n buffer[index++] = (highBits >> 16) & 0xff;\n buffer[index++] = (highBits >> 24) & 0xff;\n }\n } else {\n // Encode as double\n buffer[index++] = BSON.BSON_DATA_NUMBER;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write float\n writeIEEE754(buffer, value, index, 'little', 52, 8);\n // Ajust index\n index = index + 8;\n }\n\n return index;\n}\n\nvar serializeNull = function(buffer, key, value, index, isArray) {\n // Set long type\n buffer[index++] = BSON.BSON_DATA_NULL;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n return index;\n}\n\nvar serializeBoolean = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_BOOLEAN;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Encode the boolean value\n buffer[index++] = value ? 1 : 0;\n return index;\n}\n\nvar serializeDate = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_DATE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Write the date\n var dateInMilis = Long.fromNumber(value.getTime());\n var lowBits = dateInMilis.getLowBits();\n var highBits = dateInMilis.getHighBits();\n // Encode low bits\n buffer[index++] = lowBits & 0xff;\n buffer[index++] = (lowBits >> 8) & 0xff;\n buffer[index++] = (lowBits >> 16) & 0xff;\n buffer[index++] = (lowBits >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = highBits & 0xff;\n buffer[index++] = (highBits >> 8) & 0xff;\n buffer[index++] = (highBits >> 16) & 0xff;\n buffer[index++] = (highBits >> 24) & 0xff;\n return index;\n}\n\nvar serializeRegExp = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_REGEXP;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n if (value.source && value.source.match(regexp) != null) {\n throw Error(\"value \" + value.source + \" must not contain null bytes\");\n }\n // Adjust the index\n index = index + buffer.write(value.source, index, 'utf8');\n // Write zero\n buffer[index++] = 0x00;\n // Write the parameters\n if(value.global) buffer[index++] = 0x73; // s\n if(value.ignoreCase) buffer[index++] = 0x69; // i\n if(value.multiline) buffer[index++] = 0x6d; // m\n // Add ending zero\n buffer[index++] = 0x00;\n return index;\n}\n\nvar serializeBSONRegExp = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_REGEXP;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Check the pattern for 0 bytes\n if (value.pattern.match(regexp) != null) {\n // The BSON spec doesn't allow keys with null bytes because keys are\n // null-terminated.\n throw Error(\"pattern \" + value.pattern + \" must not contain null bytes\");\n }\n\n // Adjust the index\n index = index + buffer.write(value.pattern, index, 'utf8');\n // Write zero\n buffer[index++] = 0x00;\n // Write the options\n index = index + buffer.write(value.options.split('').sort().join(''), index, 'utf8');\n // Add ending zero\n buffer[index++] = 0x00;\n return index;\n}\n\nvar serializeMinMax = function(buffer, key, value, index, isArray) {\n // Write the type of either min or max key\n if(value === null) {\n buffer[index++] = BSON.BSON_DATA_NULL;\n } else if(value instanceof MinKey) {\n buffer[index++] = BSON.BSON_DATA_MIN_KEY;\n } else {\n buffer[index++] = BSON.BSON_DATA_MAX_KEY;\n }\n\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n return index;\n}\n\nvar serializeObjectId = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_OID;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Write the objectId into the shared buffer\n if(typeof value.id == 'string') {\n buffer.write(value.id, index, 'binary')\n } else if(value.id && value.id.copy){\n value.id.copy(buffer, index, 0, 12);\n } else {\n throw new Error('object [' + JSON.stringify(value) + \"] is not a valid ObjectId\");\n }\n\n // Ajust index\n return index + 12;\n}\n\nvar serializeBuffer = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_BINARY;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Get size of the buffer (current write point)\n var size = value.length;\n // Write the size of the string to buffer\n buffer[index++] = size & 0xff;\n buffer[index++] = (size >> 8) & 0xff;\n buffer[index++] = (size >> 16) & 0xff;\n buffer[index++] = (size >> 24) & 0xff;\n // Write the default subtype\n buffer[index++] = BSON.BSON_BINARY_SUBTYPE_DEFAULT;\n // Copy the content form the binary field to the buffer\n value.copy(buffer, index, 0, size);\n // Adjust the index\n index = index + size;\n return index;\n}\n\nvar serializeObject = function(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, isArray, path) {\n for(var i = 0; i < path.length; i++) {\n if(path[i] === value) throw new Error('cyclic dependency detected');\n }\n\n // Push value to stack\n path.push(value);\n // Write the type\n buffer[index++] = Array.isArray(value) ? BSON.BSON_DATA_ARRAY : BSON.BSON_DATA_OBJECT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n var endIndex = serializeInto(buffer, value, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined, path);\n // Pop stack\n path.pop();\n // Write size\n var size = endIndex - index;\n return endIndex;\n}\n\nvar serializeDecimal128 = function(buffer, key, value, index, isArray) {\n buffer[index++] = BSON.BSON_DATA_DECIMAL128;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the data from the value\n value.bytes.copy(buffer, index, 0, 16);\n return index + 16;\n}\n\nvar serializeLong = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = value._bsontype == 'Long' ? BSON.BSON_DATA_LONG : BSON.BSON_DATA_TIMESTAMP;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the date\n var lowBits = value.getLowBits();\n var highBits = value.getHighBits();\n // Encode low bits\n buffer[index++] = lowBits & 0xff;\n buffer[index++] = (lowBits >> 8) & 0xff;\n buffer[index++] = (lowBits >> 16) & 0xff;\n buffer[index++] = (lowBits >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = highBits & 0xff;\n buffer[index++] = (highBits >> 8) & 0xff;\n buffer[index++] = (highBits >> 16) & 0xff;\n buffer[index++] = (highBits >> 24) & 0xff;\n return index;\n}\n\nvar serializeInt32 = function(buffer, key, value, index, isArray) {\n // Set int type 32 bits or less\n buffer[index++] = BSON.BSON_DATA_INT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the int value\n buffer[index++] = value & 0xff;\n buffer[index++] = (value >> 8) & 0xff;\n buffer[index++] = (value >> 16) & 0xff;\n buffer[index++] = (value >> 24) & 0xff;\n return index;\n}\n\nvar serializeDouble = function(buffer, key, value, index, isArray) {\n // Encode as double\n buffer[index++] = BSON.BSON_DATA_NUMBER;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write float\n writeIEEE754(buffer, value, index, 'little', 52, 8);\n // Ajust index\n index = index + 8;\n return index;\n}\n\nvar serializeFunction = function(buffer, key, value, index, checkKeys, depth, isArray) {\n buffer[index++] = BSON.BSON_DATA_CODE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Function string\n var functionString = value.toString();\n // Write the string\n var size = buffer.write(functionString, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = size & 0xff;\n buffer[index + 1] = (size >> 8) & 0xff;\n buffer[index + 2] = (size >> 16) & 0xff;\n buffer[index + 3] = (size >> 24) & 0xff;\n // Update index\n index = index + 4 + size - 1;\n // Write zero\n buffer[index++] = 0;\n return index;\n}\n\nvar serializeCode = function(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, isArray) {\n if(value.scope && typeof value.scope == 'object') {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Starting index\n var startIndex = index;\n\n // Serialize the function\n // Get the function string\n var functionString = typeof value.code == 'string' ? value.code : value.code.toString();\n // Index adjustment\n index = index + 4;\n // Write string into buffer\n var codeSize = buffer.write(functionString, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = codeSize & 0xff;\n buffer[index + 1] = (codeSize >> 8) & 0xff;\n buffer[index + 2] = (codeSize >> 16) & 0xff;\n buffer[index + 3] = (codeSize >> 24) & 0xff;\n // Write end 0\n buffer[index + 4 + codeSize - 1] = 0;\n // Write the\n index = index + codeSize + 4;\n\n //\n // Serialize the scope value\n var endIndex = serializeInto(buffer, value.scope, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined)\n index = endIndex - 1;\n\n // Writ the total\n var totalSize = endIndex - startIndex;\n\n // Write the total size of the object\n buffer[startIndex++] = totalSize & 0xff;\n buffer[startIndex++] = (totalSize >> 8) & 0xff;\n buffer[startIndex++] = (totalSize >> 16) & 0xff;\n buffer[startIndex++] = (totalSize >> 24) & 0xff;\n // Write trailing zero\n buffer[index++] = 0;\n } else {\n buffer[index++] = BSON.BSON_DATA_CODE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Function string\n var functionString = value.code.toString();\n // Write the string\n var size = buffer.write(functionString, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = size & 0xff;\n buffer[index + 1] = (size >> 8) & 0xff;\n buffer[index + 2] = (size >> 16) & 0xff;\n buffer[index + 3] = (size >> 24) & 0xff;\n // Update index\n index = index + 4 + size - 1;\n // Write zero\n buffer[index++] = 0;\n }\n\n return index;\n}\n\nvar serializeBinary = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_BINARY;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Extract the buffer\n var data = value.value(true);\n // Calculate size\n var size = value.position;\n // Add the deprecated 02 type 4 bytes of size to total\n if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) size = size + 4;\n // Write the size of the string to buffer\n buffer[index++] = size & 0xff;\n buffer[index++] = (size >> 8) & 0xff;\n buffer[index++] = (size >> 16) & 0xff;\n buffer[index++] = (size >> 24) & 0xff;\n // Write the subtype to the buffer\n buffer[index++] = value.sub_type;\n\n // If we have binary type 2 the 4 first bytes are the size\n if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) {\n size = size - 4;\n buffer[index++] = size & 0xff;\n buffer[index++] = (size >> 8) & 0xff;\n buffer[index++] = (size >> 16) & 0xff;\n buffer[index++] = (size >> 24) & 0xff;\n }\n\n // Write the data to the object\n data.copy(buffer, index, 0, value.position);\n // Adjust the index\n index = index + value.position;\n return index;\n}\n\nvar serializeSymbol = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_SYMBOL;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the string\n var size = buffer.write(value.value, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = size & 0xff;\n buffer[index + 1] = (size >> 8) & 0xff;\n buffer[index + 2] = (size >> 16) & 0xff;\n buffer[index + 3] = (size >> 24) & 0xff;\n // Update index\n index = index + 4 + size - 1;\n // Write zero\n buffer[index++] = 0x00;\n return index;\n}\n\nvar serializeDBRef = function(buffer, key, value, index, depth, serializeFunctions, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_OBJECT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n var startIndex = index;\n var endIndex;\n\n // Serialize object\n if(null != value.db) {\n endIndex = serializeInto(buffer, {\n '$ref': value.namespace\n , '$id' : value.oid\n , '$db' : value.db\n }, false, index, depth + 1, serializeFunctions);\n } else {\n endIndex = serializeInto(buffer, {\n '$ref': value.namespace\n , '$id' : value.oid\n }, false, index, depth + 1, serializeFunctions);\n }\n\n // Calculate object size\n var size = endIndex - startIndex;\n // Write the size\n buffer[startIndex++] = size & 0xff;\n buffer[startIndex++] = (size >> 8) & 0xff;\n buffer[startIndex++] = (size >> 16) & 0xff;\n buffer[startIndex++] = (size >> 24) & 0xff;\n // Set index\n return endIndex;\n}\n\nvar serializeInto = function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializeFunctions, ignoreUndefined, path) {\n startingIndex = startingIndex || 0;\n path = path || [];\n\n // Push the object to the path\n path.push(object);\n\n // Start place to serialize into\n var index = startingIndex + 4;\n var self = this;\n\n // Special case isArray\n if(Array.isArray(object)) {\n // Get object keys\n for(var i = 0; i < object.length; i++) {\n var key = \"\" + i;\n var value = object[i];\n\n // Is there an override value\n if(value && value.toBSON) {\n if(typeof value.toBSON != 'function') throw new Error(\"toBSON is not a function\");\n value = value.toBSON();\n }\n\n var type = typeof value;\n if(type == 'string') {\n index = serializeString(buffer, key, value, index, true);\n } else if(type == 'number') {\n index = serializeNumber(buffer, key, value, index, true);\n } else if(type == 'boolean') {\n index = serializeBoolean(buffer, key, value, index, true);\n } else if(value instanceof Date || isDate(value)) {\n index = serializeDate(buffer, key, value, index, true);\n } else if(value === undefined) {\n index = serializeNull(buffer, key, value, index, true);\n } else if(value === null) {\n index = serializeNull(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'ObjectID') {\n index = serializeObjectId(buffer, key, value, index, true);\n } else if(Buffer.isBuffer(value)) {\n index = serializeBuffer(buffer, key, value, index, true);\n } else if(value instanceof RegExp || isRegExp(value)) {\n index = serializeRegExp(buffer, key, value, index, true);\n } else if(type == 'object' && value['_bsontype'] == null) {\n index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, true, path);\n } else if(type == 'object' && value['_bsontype'] == 'Decimal128') {\n index = serializeDecimal128(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {\n index = serializeLong(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'Double') {\n index = serializeDouble(buffer, key, value, index, true);\n } else if(typeof value == 'function' && serializeFunctions) {\n index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions, true);\n } else if(value['_bsontype'] == 'Code') {\n index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, true);\n } else if(value['_bsontype'] == 'Binary') {\n index = serializeBinary(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'Symbol') {\n index = serializeSymbol(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'DBRef') {\n index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, true);\n } else if(value['_bsontype'] == 'BSONRegExp') {\n index = serializeBSONRegExp(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'Int32') {\n index = serializeInt32(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n index = serializeMinMax(buffer, key, value, index, true);\n }\n }\n } else if(object instanceof Map) {\n var iterator = object.entries();\n var done = false;\n\n while(!done) {\n // Unpack the next entry\n var entry = iterator.next();\n done = entry.done;\n // Are we done, then skip and terminate\n if(done) continue;\n\n // Get the entry values\n var key = entry.value[0];\n var value = entry.value[1];\n\n // Check the type of the value\n var type = typeof value;\n\n // Check the key and throw error if it's illegal\n if(key != '$db' && key != '$ref' && key != '$id') {\n if (key.match(regexp) != null) {\n // The BSON spec doesn't allow keys with null bytes because keys are\n // null-terminated.\n throw Error(\"key \" + key + \" must not contain null bytes\");\n }\n\n if (checkKeys) {\n if('$' == key[0]) {\n throw Error(\"key \" + key + \" must not start with '$'\");\n } else if (!!~key.indexOf('.')) {\n throw Error(\"key \" + key + \" must not contain '.'\");\n }\n }\n }\n\n if(type == 'string') {\n index = serializeString(buffer, key, value, index);\n } else if(type == 'number') {\n index = serializeNumber(buffer, key, value, index);\n } else if(type == 'boolean') {\n index = serializeBoolean(buffer, key, value, index);\n } else if(value instanceof Date || isDate(value)) {\n index = serializeDate(buffer, key, value, index);\n } else if(value === undefined && ignoreUndefined == true) {\n } else if(value === null || value === undefined) {\n index = serializeNull(buffer, key, value, index);\n } else if(value['_bsontype'] == 'ObjectID') {\n index = serializeObjectId(buffer, key, value, index);\n } else if(Buffer.isBuffer(value)) {\n index = serializeBuffer(buffer, key, value, index);\n } else if(value instanceof RegExp || isRegExp(value)) {\n index = serializeRegExp(buffer, key, value, index);\n } else if(type == 'object' && value['_bsontype'] == null) {\n index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, false, path);\n } else if(type == 'object' && value['_bsontype'] == 'Decimal128') {\n index = serializeDecimal128(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {\n index = serializeLong(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Double') {\n index = serializeDouble(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Code') {\n index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined);\n } else if(typeof value == 'function' && serializeFunctions) {\n index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions);\n } else if(value['_bsontype'] == 'Binary') {\n index = serializeBinary(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Symbol') {\n index = serializeSymbol(buffer, key, value, index);\n } else if(value['_bsontype'] == 'DBRef') {\n index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions);\n } else if(value['_bsontype'] == 'BSONRegExp') {\n index = serializeBSONRegExp(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Int32') {\n index = serializeInt32(buffer, key, value, index);\n } else if(value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n index = serializeMinMax(buffer, key, value, index);\n }\n }\n } else {\n // Did we provide a custom serialization method\n if(object.toBSON) {\n if(typeof object.toBSON != 'function') throw new Error(\"toBSON is not a function\");\n object = object.toBSON();\n if(object != null && typeof object != 'object') throw new Error(\"toBSON function did not return an object\");\n }\n\n // Iterate over all the keys\n for(var key in object) {\n var value = object[key];\n // Is there an override value\n if(value && value.toBSON) {\n if(typeof value.toBSON != 'function') throw new Error(\"toBSON is not a function\");\n value = value.toBSON();\n }\n\n // Check the type of the value\n var type = typeof value;\n\n // Check the key and throw error if it's illegal\n if(key != '$db' && key != '$ref' && key != '$id') {\n if (key.match(regexp) != null) {\n // The BSON spec doesn't allow keys with null bytes because keys are\n // null-terminated.\n throw Error(\"key \" + key + \" must not contain null bytes\");\n }\n\n if (checkKeys) {\n if('$' == key[0]) {\n throw Error(\"key \" + key + \" must not start with '$'\");\n } else if (!!~key.indexOf('.')) {\n throw Error(\"key \" + key + \" must not contain '.'\");\n }\n }\n }\n\n if(type == 'string') {\n index = serializeString(buffer, key, value, index);\n } else if(type == 'number') {\n index = serializeNumber(buffer, key, value, index);\n } else if(type == 'boolean') {\n index = serializeBoolean(buffer, key, value, index);\n } else if(value instanceof Date || isDate(value)) {\n index = serializeDate(buffer, key, value, index);\n } else if(value === undefined && ignoreUndefined == true) {\n } else if(value === null || value === undefined) {\n index = serializeNull(buffer, key, value, index);\n } else if(value['_bsontype'] == 'ObjectID') {\n index = serializeObjectId(buffer, key, value, index);\n } else if(Buffer.isBuffer(value)) {\n index = serializeBuffer(buffer, key, value, index);\n } else if(value instanceof RegExp || isRegExp(value)) {\n index = serializeRegExp(buffer, key, value, index);\n } else if(type == 'object' && value['_bsontype'] == null) {\n index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, false, path);\n } else if(type == 'object' && value['_bsontype'] == 'Decimal128') {\n index = serializeDecimal128(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {\n index = serializeLong(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Double') {\n index = serializeDouble(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Code') {\n index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined);\n } else if(typeof value == 'function' && serializeFunctions) {\n index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions);\n } else if(value['_bsontype'] == 'Binary') {\n index = serializeBinary(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Symbol') {\n index = serializeSymbol(buffer, key, value, index);\n } else if(value['_bsontype'] == 'DBRef') {\n index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions);\n } else if(value['_bsontype'] == 'BSONRegExp') {\n index = serializeBSONRegExp(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Int32') {\n index = serializeInt32(buffer, key, value, index);\n } else if(value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n index = serializeMinMax(buffer, key, value, index);\n }\n }\n }\n\n // Remove the path\n path.pop();\n\n // Final padding byte for object\n buffer[index++] = 0x00;\n\n // Final size\n var size = index - startingIndex;\n // Write the size of the object\n buffer[startingIndex++] = size & 0xff;\n buffer[startingIndex++] = (size >> 8) & 0xff;\n buffer[startingIndex++] = (size >> 16) & 0xff;\n buffer[startingIndex++] = (size >> 24) & 0xff;\n return index;\n}\n\nvar BSON = {};\n\n/**\n * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5\n *\n * @ignore\n * @api private\n */\nvar functionCache = BSON.functionCache = {};\n\n/**\n * Number BSON Type\n *\n * @classconstant BSON_DATA_NUMBER\n **/\nBSON.BSON_DATA_NUMBER = 1;\n/**\n * String BSON Type\n *\n * @classconstant BSON_DATA_STRING\n **/\nBSON.BSON_DATA_STRING = 2;\n/**\n * Object BSON Type\n *\n * @classconstant BSON_DATA_OBJECT\n **/\nBSON.BSON_DATA_OBJECT = 3;\n/**\n * Array BSON Type\n *\n * @classconstant BSON_DATA_ARRAY\n **/\nBSON.BSON_DATA_ARRAY = 4;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_BINARY\n **/\nBSON.BSON_DATA_BINARY = 5;\n/**\n * ObjectID BSON Type, deprecated\n *\n * @classconstant BSON_DATA_UNDEFINED\n **/\nBSON.BSON_DATA_UNDEFINED = 6;\n/**\n * ObjectID BSON Type\n *\n * @classconstant BSON_DATA_OID\n **/\nBSON.BSON_DATA_OID = 7;\n/**\n * Boolean BSON Type\n *\n * @classconstant BSON_DATA_BOOLEAN\n **/\nBSON.BSON_DATA_BOOLEAN = 8;\n/**\n * Date BSON Type\n *\n * @classconstant BSON_DATA_DATE\n **/\nBSON.BSON_DATA_DATE = 9;\n/**\n * null BSON Type\n *\n * @classconstant BSON_DATA_NULL\n **/\nBSON.BSON_DATA_NULL = 10;\n/**\n * RegExp BSON Type\n *\n * @classconstant BSON_DATA_REGEXP\n **/\nBSON.BSON_DATA_REGEXP = 11;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_CODE\n **/\nBSON.BSON_DATA_CODE = 13;\n/**\n * Symbol BSON Type\n *\n * @classconstant BSON_DATA_SYMBOL\n **/\nBSON.BSON_DATA_SYMBOL = 14;\n/**\n * Code with Scope BSON Type\n *\n * @classconstant BSON_DATA_CODE_W_SCOPE\n **/\nBSON.BSON_DATA_CODE_W_SCOPE = 15;\n/**\n * 32 bit Integer BSON Type\n *\n * @classconstant BSON_DATA_INT\n **/\nBSON.BSON_DATA_INT = 16;\n/**\n * Timestamp BSON Type\n *\n * @classconstant BSON_DATA_TIMESTAMP\n **/\nBSON.BSON_DATA_TIMESTAMP = 17;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_LONG\n **/\nBSON.BSON_DATA_LONG = 18;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_DECIMAL128\n **/\nBSON.BSON_DATA_DECIMAL128 = 19;\n/**\n * MinKey BSON Type\n *\n * @classconstant BSON_DATA_MIN_KEY\n **/\nBSON.BSON_DATA_MIN_KEY = 0xff;\n/**\n * MaxKey BSON Type\n *\n * @classconstant BSON_DATA_MAX_KEY\n **/\nBSON.BSON_DATA_MAX_KEY = 0x7f;\n/**\n * Binary Default Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_DEFAULT\n **/\nBSON.BSON_BINARY_SUBTYPE_DEFAULT = 0;\n/**\n * Binary Function Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_FUNCTION\n **/\nBSON.BSON_BINARY_SUBTYPE_FUNCTION = 1;\n/**\n * Binary Byte Array Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY\n **/\nBSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;\n/**\n * Binary UUID Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_UUID\n **/\nBSON.BSON_BINARY_SUBTYPE_UUID = 3;\n/**\n * Binary MD5 Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_MD5\n **/\nBSON.BSON_BINARY_SUBTYPE_MD5 = 4;\n/**\n * Binary User Defined Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED\n **/\nBSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128;\n\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\nBSON.BSON_INT64_MAX = Math.pow(2, 63) - 1;\nBSON.BSON_INT64_MIN = -Math.pow(2, 63);\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\n// Internal long versions\nvar JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double.\nvar JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double.\n\nmodule.exports = serializeInto;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/parser/serializer.js","/* global window, document, fetch */\n\nimport { createStorage } from './storage';\nimport { createProviders } from './providers';\nimport { StitchError } from '../errors';\nimport * as authCommon from './common';\nimport * as common from '../common';\n\nconst jwtDecode = require('jwt-decode');\n\nconst EMBEDDED_USER_AUTH_DATA_PARTS = 4;\n\nexport default class Auth {\n constructor(client, rootUrl, options) {\n options = Object.assign({}, {\n storageType: 'localStorage',\n codec: authCommon.APP_CLIENT_CODEC\n }, options);\n\n this.client = client;\n this.rootUrl = rootUrl;\n this.codec = options.codec;\n this.storage = createStorage(options.storageType);\n this.providers = createProviders(this);\n }\n\n provider(name) {\n if (!this.providers.hasOwnProperty(name)) {\n throw new Error('Invalid auth provider specified: ' + name);\n }\n\n return this.providers[name];\n }\n\n refreshToken() {\n if (this.isImpersonatingUser()) {\n return this.refreshImpersonation(this.client);\n }\n\n return this.client.doSessionPost().then(json => this.set(json));\n }\n\n pageRootUrl() {\n return [window.location.protocol, '//', window.location.host, window.location.pathname].join('');\n }\n\n error() {\n return this._error;\n }\n\n isAppClient() {\n if (!this.client) {\n return true; // Handle the case where Auth is constructed with null\n }\n return this.client.type === common.APP_CLIENT_TYPE;\n }\n\n handleRedirect() {\n if (typeof (window) === 'undefined') {\n // This means we're running in some environment other\n // than a browser - so handling a redirect makes no sense here.\n return;\n }\n if (!window.location || !window.location.hash) {\n return;\n }\n\n let ourState = this.storage.get(authCommon.STATE_KEY);\n let redirectFragment = window.location.hash.substring(1);\n const redirectState = this.parseRedirectFragment(redirectFragment, ourState);\n if (redirectState.lastError) {\n console.error(`StitchClient: error from redirect: ${redirectState.lastError}`);\n this._error = redirectState.lastError;\n window.history.replaceState(null, '', this.pageRootUrl());\n return;\n }\n\n if (!redirectState.found) {\n return;\n }\n\n this.storage.remove(authCommon.STATE_KEY);\n if (!redirectState.stateValid) {\n console.error('StitchClient: state values did not match!');\n window.history.replaceState(null, '', this.pageRootUrl());\n return;\n }\n\n if (!redirectState.ua) {\n console.error('StitchClient: no UA value was returned from redirect!');\n return;\n }\n\n // If we get here, the state is valid - set auth appropriately.\n this.set(redirectState.ua);\n window.history.replaceState(null, '', this.pageRootUrl());\n }\n\n getCookie(name) {\n let splitCookies = document.cookie.split(' ');\n for (let i = 0; i < splitCookies.length; i++) {\n let cookie = splitCookies[i];\n let sepIdx = cookie.indexOf('=');\n let cookieName = cookie.substring(0, sepIdx);\n if (cookieName === name) {\n let cookieVal = cookie.substring(sepIdx + 1, cookie.length);\n if (cookieVal[cookieVal.length - 1] === ';') {\n return cookieVal.substring(0, cookie.length - 1);\n }\n return cookieVal;\n }\n }\n }\n\n handleCookie() {\n if (typeof (window) === 'undefined' || typeof (document) === 'undefined') {\n // This means we're running in some environment other\n // than a browser - so handling a cookie makes no sense here.\n return;\n }\n if (!document.cookie) {\n return;\n }\n\n let uaCookie = this.getCookie(authCommon.USER_AUTH_COOKIE_NAME);\n if (!uaCookie) {\n return;\n }\n\n document.cookie = `${authCommon.USER_AUTH_COOKIE_NAME}=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT;`;\n const userAuth = this.unmarshallUserAuth(uaCookie);\n this.set(userAuth);\n window.history.replaceState(null, '', this.pageRootUrl());\n }\n\n clear() {\n this.storage.remove(authCommon.USER_AUTH_KEY);\n this.storage.remove(authCommon.REFRESH_TOKEN_KEY);\n this.clearImpersonation();\n }\n\n getDeviceId() {\n return this.storage.get(authCommon.DEVICE_ID_KEY);\n }\n\n // Returns whether or not the access token is expired or is going to expire within 'withinSeconds'\n // seconds, according to current system time. Returns false if the token is malformed in any way.\n isAccessTokenExpired(withinSeconds = authCommon.DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS) {\n let token = this.getAccessToken();\n if (!token) {\n return false;\n }\n\n let decodedToken;\n try {\n decodedToken = jwtDecode(token);\n } catch (e) {\n return false;\n }\n\n if (!decodedToken) {\n return false;\n }\n\n return decodedToken.exp && Math.floor(Date.now() / 1000) >= decodedToken.exp - withinSeconds;\n }\n\n getAccessToken() {\n return this._get().accessToken;\n }\n\n getRefreshToken() {\n return this.storage.get(authCommon.REFRESH_TOKEN_KEY);\n }\n\n set(json) {\n if (!json) {\n return;\n }\n\n if (json[this.codec.refreshToken]) {\n let rt = json[this.codec.refreshToken];\n delete json[this.codec.refreshToken];\n this.storage.set(authCommon.REFRESH_TOKEN_KEY, rt);\n }\n\n if (json[this.codec.deviceId]) {\n const deviceId = json[this.codec.deviceId];\n delete json[this.codec.deviceId];\n this.storage.set(authCommon.DEVICE_ID_KEY, deviceId);\n }\n\n // Merge in new fields with old fields. Typically the first json value\n // is complete with every field inside a user auth, but subsequent requests\n // do not include everything. This merging behavior is safe so long as json\n // value responses with absent fields do not indicate that the field should\n // be unset.\n let newUserAuth = {};\n if (json[this.codec.accessToken]) {\n newUserAuth.accessToken = json[this.codec.accessToken];\n }\n if (json[this.codec.userId]) {\n newUserAuth.userId = json[this.codec.userId];\n }\n newUserAuth = Object.assign(this._get(), newUserAuth);\n this.storage.set(authCommon.USER_AUTH_KEY, JSON.stringify(newUserAuth));\n }\n\n _get() {\n const data = this.storage.get(authCommon.USER_AUTH_KEY);\n if (!data) {\n return {};\n }\n\n try {\n return JSON.parse(data);\n } catch (e) {\n // Need to back out and clear auth otherwise we will never\n // be able to do anything useful.\n this.clear();\n throw new StitchError('Failure retrieving stored auth');\n }\n }\n\n authedId() {\n return this._get().userId;\n }\n\n isImpersonatingUser() {\n return this.storage.get(authCommon.IMPERSONATION_ACTIVE_KEY) === 'true';\n }\n\n refreshImpersonation(client) {\n let userId = this.storage.get(authCommon.IMPERSONATION_USER_KEY);\n return client._do(`/admin/users/${userId}/impersonate`, 'POST', { refreshOnFailure: false, useRefreshToken: true })\n .then(response => response.json())\n .then(json => this.set(json))\n .catch(e => {\n this.stopImpersonation();\n throw e; // rethrow\n });\n }\n\n startImpersonation(client, userId) {\n if (!this.authedId()) {\n return Promise.reject(new StitchError('Must auth first'));\n }\n\n if (this.isImpersonatingUser()) {\n return Promise.reject(new StitchError('Already impersonating a user'));\n }\n\n this.storage.set(authCommon.IMPERSONATION_ACTIVE_KEY, 'true');\n this.storage.set(authCommon.IMPERSONATION_USER_KEY, userId);\n\n let realUserAuth = JSON.parse(this.storage.get(authCommon.USER_AUTH_KEY));\n this.storage.set(authCommon.IMPERSONATION_REAL_USER_AUTH_KEY, JSON.stringify(realUserAuth));\n return this.refreshImpersonation(client);\n }\n\n stopImpersonation() {\n if (!this.isImpersonatingUser()) {\n throw new StitchError('Not impersonating a user');\n }\n\n return new Promise((resolve, reject) => {\n let realUserAuth = JSON.parse(this.storage.get(authCommon.IMPERSONATION_REAL_USER_AUTH_KEY));\n this.set(realUserAuth);\n this.clearImpersonation();\n resolve();\n });\n }\n\n clearImpersonation() {\n this.storage.remove(authCommon.IMPERSONATION_ACTIVE_KEY);\n this.storage.remove(authCommon.IMPERSONATION_USER_KEY);\n this.storage.remove(authCommon.IMPERSONATION_REAL_USER_AUTH_KEY);\n }\n\n parseRedirectFragment(fragment, ourState) {\n // After being redirected from oauth, the URL will look like:\n // https://todo.examples.stitch.mongodb.com/#_stitch_state=...&_stitch_ua=...\n // This function parses out stitch-specific tokens from the fragment and\n // builds an object describing the result.\n const vars = fragment.split('&');\n const result = { ua: null, found: false, stateValid: false, lastError: null };\n let shouldBreak = false;\n for (let i = 0; i < vars.length && !shouldBreak; ++i) {\n const pairParts = vars[i].split('=');\n const pairKey = decodeURIComponent(pairParts[0]);\n switch (pairKey) {\n case authCommon.STITCH_ERROR_KEY:\n result.lastError = decodeURIComponent(pairParts[1]);\n result.found = true;\n shouldBreak = true;\n break;\n case authCommon.USER_AUTH_KEY:\n try {\n result.ua = this.unmarshallUserAuth(decodeURIComponent(pairParts[1]));\n result.found = true;\n } catch (e) {\n result.lastError = e;\n }\n continue;\n case authCommon.STITCH_LINK_KEY:\n result.found = true;\n continue;\n case authCommon.STATE_KEY:\n result.found = true;\n let theirState = decodeURIComponent(pairParts[1]);\n if (ourState && ourState === theirState) {\n result.stateValid = true;\n }\n continue;\n default: continue;\n }\n }\n\n return result;\n }\n\n unmarshallUserAuth(data) {\n let parts = data.split('$');\n if (parts.length !== EMBEDDED_USER_AUTH_DATA_PARTS) {\n throw new RangeError('invalid user auth data provided: ' + data);\n }\n\n return {\n [this.codec.accessToken]: parts[0],\n [this.codec.refreshToken]: parts[1],\n [this.codec.userId]: parts[2],\n [this.codec.deviceId]: parts[3]\n };\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/auth/index.js","/** @module auth */\nimport * as common from '../common';\nimport * as authCommon from './common';\nimport { getPlatform, uriEncodeObject } from '../util';\n\n/**\n * Create the device info for this client.\n *\n * @memberof module:auth\n * @method getDeviceInfo\n * @param {String} appId The app ID for this client\n * @param {String} appVersion The version of the app\n * @returns {Object} The device info object\n */\nfunction getDeviceInfo(deviceId, appId, appVersion = '') {\n const deviceInfo = { appId, appVersion, sdkVersion: common.SDK_VERSION };\n\n if (deviceId) {\n deviceInfo.deviceId = deviceId;\n }\n\n const platform = getPlatform();\n\n if (platform) {\n deviceInfo.platform = platform.name;\n deviceInfo.platformVersion = platform.version;\n }\n\n return deviceInfo;\n}\n\n/**\n * @namespace\n */\nfunction anonProvider(auth) {\n return {\n /**\n * Login to a stitch application using anonymous authentication\n *\n * @memberof anonProvider\n * @instance\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: () => {\n const device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID);\n const fetchArgs = common.makeFetchArgs('GET');\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/providers/anon-user/login?device=${uriEncodeObject(device)}`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json));\n }\n };\n}\n\n/**\n * @namespace\n */\nfunction customProvider(auth) {\n const providerRoute = 'providers/custom-token';\n const loginRoute = `${providerRoute}/login`;\n\n return {\n /**\n * Login to a stitch application using custom authentication\n *\n * @memberof customProvider\n * @instance\n * @param {String} JWT token to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: (token) => {\n const device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID);\n\n const fetchArgs = common.makeFetchArgs(\n 'POST',\n JSON.stringify({ token, options: { device } })\n );\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${loginRoute}`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json));\n }\n };\n}\n\n/** @namespace */\nfunction userPassProvider(auth) {\n // The ternary expression here is redundant but is just preserving previous behavior based on whether or not\n // the client is for the admin or client API.\n const providerRoute = auth.isAppClient() ? 'providers/local-userpass' : 'providers/local-userpass';\n const loginRoute = auth.isAppClient() ? `${providerRoute}/login` : `${providerRoute}/login`;\n\n return {\n /**\n * Login to a stitch application using username and password authentication\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} username the username to use for authentication\n * @param {String} password the password to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: ({ username, password }) => {\n const device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID);\n\n const fetchArgs = common.makeFetchArgs(\n 'POST',\n JSON.stringify({ username, password, options: { device } })\n );\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${loginRoute}`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json));\n },\n\n /**\n * Completes the confirmation workflow from the stitch server\n * @memberof userPassProvider\n * @instance\n * @param {String} tokenId the tokenId provided by the stitch server\n * @param {String} token the token provided by the stitch server\n * @returns {Promise}\n */\n emailConfirm: (tokenId, token) => {\n const fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ tokenId, token }));\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${providerRoute}/confirm`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json());\n },\n\n /**\n * Request that the stitch server send another email confirmation\n * for account creation.\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} email the email to send a confirmation email for\n * @returns {Promise}\n */\n sendEmailConfirm: (email) => {\n const fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email }));\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${providerRoute}/confirm/send`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json());\n },\n\n /**\n * Sends a password reset request to the stitch server\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} email the email of the account to reset the password for\n * @returns {Promise}\n */\n sendPasswordReset: (email) => {\n const fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email }));\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${providerRoute}/reset/send`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json());\n },\n\n /**\n * Use information returned from the stitch server to complete the password\n * reset flow for a given email account, providing a new password for the account.\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} tokenId the tokenId provided by the stitch server\n * @param {String} token the token provided by the stitch server\n * @param {String} password the new password requested for this account\n * @returns {Promise}\n */\n passwordReset: (tokenId, token, password) => {\n const fetchArgs =\n common.makeFetchArgs('POST', JSON.stringify({ tokenId, token, password }));\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${providerRoute}/reset`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json());\n },\n\n\n /**\n * Will trigger an email to the requested account containing a link with the\n * token and tokenId that must be returned to the server using emailConfirm()\n * to activate the account.\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} email the requested email for the account\n * @param {String} password the requested password for the account\n * @returns {Promise}\n */\n register: (email, password) => {\n const fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email, password }));\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${providerRoute}/register`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json());\n }\n };\n}\n\n/** @namespace */\nfunction apiKeyProvider(auth) {\n // The ternary expression here is redundant but is just preserving previous behavior based on whether or not\n // the client is for the admin or client API.\n const loginRoute = auth.isAppClient() ? 'providers/api-key/login' : 'providers/api-key/login';\n\n return {\n /**\n * Login to a stitch application using an api key\n *\n * @memberof apiKeyProvider\n * @instance\n * @param {String} key the key for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: key => {\n const device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID);\n const fetchArgs = common.makeFetchArgs(\n 'POST',\n JSON.stringify({ 'key': key, 'options': { device } })\n );\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${loginRoute}`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json));\n }\n };\n}\n\n// The state we generate is to be used for any kind of request where we will\n// complete an authentication flow via a redirect. We store the generate in\n// a local storage bound to the app's origin. This ensures that any time we\n// receive a redirect, there must be a state parameter and it must match\n// what we ourselves have generated. This state MUST only be sent to\n// a trusted Stitch endpoint in order to preserve its integrity. Stitch will\n// store it in some way on its origin (currently a cookie stored on this client)\n// and use that state at the end of an auth flow as a parameter in the redirect URI.\nconst alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\nfunction generateState() {\n let state = '';\n for (let i = 0; i < 64; ++i) {\n state += alpha.charAt(Math.floor(Math.random() * alpha.length));\n }\n\n return state;\n}\n\nfunction getOAuthLoginURL(auth, providerName, redirectUrl) {\n if (redirectUrl === undefined) {\n redirectUrl = auth.pageRootUrl();\n }\n\n const state = generateState();\n auth.storage.set(authCommon.STATE_KEY, state);\n\n const device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID);\n\n const result = `${auth.rootUrl}/providers/oauth2-${providerName}/login?redirect=${encodeURI(redirectUrl)}&state=${state}&device=${uriEncodeObject(device)}`;\n return result;\n}\n\n/** @namespace */\nfunction googleProvider(auth) {\n return {\n /**\n * Login to a stitch application using google authentication\n *\n * @memberof googleProvider\n * @instance\n * @param {Object} data the redirectUrl data to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: data => {\n const redirectUrl = (data && data.redirectUrl) ? data.redirectUrl : undefined;\n window.location.replace(getOAuthLoginURL(auth, 'google', redirectUrl));\n return Promise.resolve();\n }\n };\n}\n\n/** @namespace */\nfunction facebookProvider(auth) {\n return {\n /**\n * Login to a stitch application using facebook authentication\n *\n * @memberof facebookProvider\n * @instance\n * @param {Object} data the redirectUrl data to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: data => {\n const redirectUrl = (data && data.redirectUrl) ? data.redirectUrl : undefined;\n window.location.replace(getOAuthLoginURL(auth, 'facebook', redirectUrl));\n return Promise.resolve();\n }\n };\n}\n\n/** @namespace */\nfunction mongodbCloudProvider(auth) {\n // The ternary expression here is redundant but is just preserving previous behavior based on whether or not\n // the client is for the admin or client API.\n const loginRoute = auth.isAppClient() ? 'providers/mongodb-cloud/login' : 'providers/mongodb-cloud/login';\n\n return {\n /**\n * Login to a stitch application using mongodb cloud authentication\n *\n * @memberof mongodbCloudProvider\n * @instance\n * @param {Object} data the username, apiKey, cors, and cookie data to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: data => {\n const { username, apiKey, cors, cookie } = data;\n const options = Object.assign({}, { cors: true, cookie: false }, { cors: cors, cookie: cookie });\n const device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID);\n const fetchArgs = common.makeFetchArgs(\n 'POST',\n JSON.stringify({ username, apiKey, options: { device } })\n );\n fetchArgs.cors = true; // TODO: shouldn't this use the passed in `cors` value?\n fetchArgs.credentials = 'include';\n\n let url = `${auth.rootUrl}/${loginRoute}`;\n if (options.cookie) {\n return fetch(url + '?cookie=true', fetchArgs)\n .then(common.checkStatus);\n }\n\n return fetch(url, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json));\n }\n };\n}\n\n// TODO: support auth-specific options\nfunction createProviders(auth, options = {}) {\n return {\n anon: anonProvider(auth),\n apiKey: apiKeyProvider(auth),\n google: googleProvider(auth),\n facebook: facebookProvider(auth),\n mongodbCloud: mongodbCloudProvider(auth),\n userpass: userPassProvider(auth),\n custom: customProvider(auth)\n };\n}\n\nexport { createProviders };\n\n\n\n// WEBPACK FOOTER //\n// ./src/auth/providers.js","class MemoryStorage {\n constructor() {\n this._data = {};\n }\n\n getItem(key) {\n return (key in this._data) ? this._data[key] : null;\n }\n\n setItem(key, value) {\n this._data[key] = value;\n return this._data[key];\n }\n\n removeItem(key) {\n delete this._data[key];\n return undefined;\n }\n\n clear() {\n this._data = {};\n return this._data;\n }\n}\n\nclass Storage {\n constructor(store) {\n this.store = store;\n }\n\n get(key) { return this.store.getItem(key); }\n set(key, value) { return this.store.setItem(key, value); }\n remove(key) { return this.store.removeItem(key); }\n clear() { return this.store.clear(); }\n}\n\nexport function createStorage(type) {\n if (type === 'localStorage') {\n if ((typeof window !== 'undefined') && 'localStorage' in window && window.localStorage !== null) {\n return new Storage(window.localStorage);\n }\n } else if (type === 'sessionStorage') {\n if ((typeof window !== 'undefined') && 'sessionStorage' in window && window.sessionStorage !== null) {\n return new Storage(window.sessionStorage);\n }\n }\n\n // default to memory storage\n return new Storage(new MemoryStorage());\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/auth/storage.js","import StitchClient from './client';\nimport Admin from './admin';\n\nexport {\n StitchClient,\n Admin\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js","import { serviceResponse } from '../../util';\n\n/**\n * Convenience wrapper around AWS S3 service (not meant to be instantiated directly).\n *\n * @class\n * @return {S3Service} a S3Service instance.\n */\nclass S3Service {\n constructor(stitchClient, serviceName) {\n this.client = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Put an object to S3 via Stitch. For small uploads\n *\n * NOTE: body must be a pipeline stream\n *\n * @param {String} bucket which S3 bucket to use\n * @param {String} key which key (filename) to use\n * @param {String} acl which policy to apply\n * @param {String} contentType content type of uploaded data\n * @return {Promise}\n */\n put(bucket, key, acl, contentType) {\n return serviceResponse(this, {\n action: 'put',\n args: { bucket, key, acl, contentType }\n });\n }\n\n /**\n * Sign a policy for putting via Stitch. For large uploads\n *\n * @param {String} bucket which S3 bucket to use\n * @param {String} key which key (filename) to use\n * @param {String} acl which policy to apply\n * @param {String} contentType content type of uploaded data\n * @return {Promise}\n */\n signPolicy(bucket, key, acl, contentType) {\n return serviceResponse(this, {\n action: 'signPolicy',\n args: { bucket, key, acl, contentType }\n });\n }\n}\n\nexport default S3Service;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/aws/s3_service.js","import { serviceResponse } from '../../util';\n\n/**\n * Convenience wrapper around AWS SES service (not meant to be instantiated directly).\n *\n * @class\n * @return {SESService} a SESService instance.\n */\nclass SESService {\n constructor(stitchClient, serviceName) {\n this.client = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Send an email\n *\n * @method\n * @param {String} from the email to send from\n * @param {String} to the email to send to\n * @param {String} subject the subject of the email\n * @param {String} body the body of the email\n * @return {Promise}\n */\n send(from, to, subject, body) {\n return serviceResponse(this, {\n action: 'send',\n args: { from, to, subject, body }\n });\n }\n}\n\nexport default SESService;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/aws/ses_service.js","import { serviceResponse } from '../../util';\n\n/**\n * Convenience wrapper for HTTP service (not meant to be instantiated directly).\n *\n * @class\n * @return {HTTPService} a HTTPService instance.\n */\nclass HTTPService {\n constructor(client, serviceName) {\n this.client = client;\n this.serviceName = serviceName;\n }\n\n /**\n * Send a GET request to a resource (result must be application/json)\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of GET args\n * @param {Object} [options] optional settings for the GET operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n get(urlOrOptions, options = {}) {\n return buildResponse('get', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a POST request to a resource with payload\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of POST args\n * @param {Object} [options] optional settings for the POST operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n post(urlOrOptions, options = {}) {\n return buildResponse('post', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a PUT request to a resource with payload\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of PUT args\n * @param {Object} [options] optional settings for the PUT operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n put(urlOrOptions, options = {}) {\n return buildResponse('put', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a PATCH request to a resource with payload\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of PATCH args\n * @param {Object} [options] optional settings for the PATCH operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n patch(urlOrOptions, options = {}) {\n return buildResponse('patch', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a DELETE request to a resource\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of DELETE args\n * @param {Object} [options] optional settings for the DELETE operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n delete(urlOrOptions, options = {}) {\n return buildResponse('delete', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a HEAD request to a resource\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of HEAD args\n * @param {Object} [options] optional settings for the HEAD operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n head(urlOrOptions, options = {}) {\n return buildResponse('head', this, buildArgs(urlOrOptions, options));\n }\n}\n\nfunction buildArgs(urlOrOptions, options) {\n let args;\n if (typeof urlOrOptions !== 'string') {\n args = urlOrOptions;\n } else {\n args = { url: urlOrOptions };\n if (!!options.authUrl) args.authUrl = options.authUrl;\n }\n\n return args;\n}\n\nfunction buildResponse(action, service, args) {\n return serviceResponse(service, {\n action,\n args\n });\n}\n\nexport default HTTPService;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/http/http_service.js","import S3Service from './aws/s3_service';\nimport SESService from './aws/ses_service';\nimport HTTPService from './http/http_service';\nimport MongoDBService from './mongodb/mongodb_service';\nimport TwilioService from './twilio/twilio_service';\n\nexport default {\n 'aws/s3': S3Service,\n 'aws/ses': SESService,\n 'http': HTTPService,\n 'mongodb': MongoDBService,\n 'twilio': TwilioService\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/index.js","import { serviceResponse } from '../../util';\n\n/**\n * Create a new Collection instance (not meant to be instantiated directly).\n *\n * @class\n * @return {Collection} a Collection instance.\n */\nclass Collection {\n constructor(db, name) {\n this.db = db;\n this.name = name;\n }\n\n /**\n * Inserts a single document.\n *\n * @method\n * @param {Object} doc The document to insert.\n * @return {Promise} a Promise for the operation.\n */\n insertOne(doc) {\n const args = { document: doc };\n return buildResponse('insertOne', this, buildArgs(this, args));\n }\n\n /**\n * Inserts multiple documents.\n *\n * @method\n * @param {Array} docs The documents to insert.\n * @return {Promise} Returns a Promise for the operation.\n */\n insertMany(docs) {\n const args = { documents: Array.isArray(docs) ? docs : [ docs ] };\n return buildResponse('insertMany', this, buildArgs(this, args));\n }\n\n /**\n * Deletes a single document.\n *\n * @method\n * @param {Object} query The query used to match a single document.\n * @return {Promise} Returns a Promise for the operation.\n */\n deleteOne(query) {\n return buildResponse('deleteOne', this, buildArgs(this, { query }));\n }\n\n /**\n * Deletes all documents matching query.\n *\n * @method\n * @param {Object} query The query used to match the documents to delete.\n * @return {Promise} Returns a Promise for the operation.\n */\n deleteMany(query) {\n return buildResponse('deleteMany', this, buildArgs(this, { query }));\n }\n\n /**\n * Updates a single document.\n *\n * @method\n * @param {Object} query The query used to match a single document.\n * @param {Object} update The update operations to perform on the matching document.\n * @param {Object} [options] Additional options object.\n * @param {Boolean} [options.upsert=false] Perform an upsert operation.\n * @return {Promise} A Promise for the operation.\n */\n updateOne(query, update, options = {}) {\n return updateOp(this, false, query, update, options);\n }\n\n /**\n * Updates multiple documents.\n *\n * @method\n * @param {Object} query The query used to match the documents.\n * @param {Object} update The update operations to perform on the matching documents.\n * @param {Object} [options] Additional options object.\n * @param {Boolean} [options.upsert=false] Perform an upsert operation.\n * @return {Promise} Returns a Promise for the operation.\n */\n updateMany(query, update) {\n return updateOp(this, true, query, update);\n }\n\n /**\n * Finds documents.\n *\n * @method\n * @param {Object} query The query used to match documents.\n * @param {Object} [project] The query document projection.\n * @return {MongoQuery} An object which allows for `limit` and `sort` parameters to be set.\n * `execute` will return a {Promise} for the operation.\n */\n find(query, project) {\n return new MongoQuery(this, query, project);\n }\n\n /**\n * Executes an aggregation pipeline.\n *\n * @param {Array} pipeline The aggregation pipeline.\n * @returns {Array} The results of the aggregation.\n */\n aggregate(pipeline) {\n return aggregateOp(this, pipeline);\n }\n\n /**\n * Gets the number of documents matching the filter.\n *\n * @param {Object} query The query used to match documents.\n * @param {Object} options Additional count options.\n * @param {Number} [options.limit=null] The maximum number of documents to return.\n * @return {Number} The results of the count operation.\n */\n count(query, options = {}) {\n let outgoingOptions;\n if (options.limit) {\n outgoingOptions = { limit: options.limit };\n }\n\n return buildResponse('count', this, buildArgs(this, { count: true, query }, outgoingOptions));\n }\n}\n\n// private\n\nfunction updateOp(service, isMulti, query, update, options = {}) {\n const action = isMulti ? 'updateMany' : 'updateOne';\n\n let outgoingOptions;\n if (!isMulti && options.upsert) {\n outgoingOptions = { upsert: true };\n }\n\n return buildResponse(action, service, buildArgs(service, { query, update }, outgoingOptions));\n}\n\nfunction findOp({ service, query, project, limit, sort }) {\n return buildResponse('find', service, buildArgs(service, { query, project, limit, sort }));\n}\n\nfunction aggregateOp(service, pipeline) {\n return buildResponse('aggregate', service, buildArgs(service, { pipeline }));\n}\n\nfunction buildArgs({ db: { name: database }, name: collection }, args, options = {}) {\n return Object.assign(\n { database, collection },\n args,\n options\n );\n}\n\nfunction buildResponse(action, service, args) {\n return serviceResponse(service.db, {\n serviceName: service.db.service,\n action,\n args\n });\n}\n\n// mongo query (find) support\n\nfunction MongoQuery(service, query, project) {\n if (this instanceof MongoQuery) {\n this.service = service;\n this.query = query;\n this.project = project;\n return this;\n }\n return new MongoQuery(service, query, project);\n}\n\nMongoQuery.prototype.limit = function(limit) {\n this.limit = limit;\n return this;\n};\n\nMongoQuery.prototype.sort = function(sort) {\n this.sort = sort;\n return this;\n};\n\nMongoQuery.prototype.execute = function(resolve) {\n return findOp(this);\n};\n\nexport default Collection;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/mongodb/collection.js","import Collection from './collection';\n\n/**\n * Create a new DB instance (not meant to be instantiated directly).\n * @class\n * @return {DB} a DB instance.\n */\nclass DB {\n constructor(client, service, name) {\n this.client = client;\n this.service = service;\n this.name = name;\n }\n\n /**\n * Returns a Collection instance representing a MongoDB Collection object.\n *\n * @method\n * @param {String} name The collection name.\n * @param {Object} [options] Additional options.\n * @return {Collection} returns a Collection instance representing a MongoDb collection.\n */\n collection(name, options = {}) {\n return new Collection(this, name, options);\n }\n}\n\nexport default DB;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/mongodb/db.js","import DB from './db';\n\n/**\n * Create a new MongoDBService instance (not meant to be instantiated directly).\n *\n * @class\n * @return {MongoDBService} a MongoDBService instance.\n */\nclass MongoDBService {\n constructor(stitchClient, serviceName) {\n this.stitchClient = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Get a DB instance\n *\n * @method\n * @param {String} databaseName The MongoDB database name\n * @param {Object} [options] Additional options.\n * @return {DB} returns a DB instance representing a MongoDB database.\n */\n db(databaseName, options = {}) {\n return new DB(this.stitchClient, this.serviceName, databaseName);\n }\n}\n\n\nexport default MongoDBService;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/mongodb/mongodb_service.js","import { serviceResponse } from '../../util';\n\n/**\n * Create a new TwilioService instance (not meant to be instantiated directly).\n *\n * @class\n * @return {TwilioService} a TwilioService instance.\n */\nclass TwilioService {\n constructor(stitchClient, serviceName) {\n this.client = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Send a text message to a number\n *\n * @method\n * @param {String} from number to send from\n * @param {String} to number to send to\n * @param {String} body SMS body content\n * @return {Promise}\n */\n send(from, to, body) {\n return serviceResponse(this, {\n action: 'send',\n args: { from, to, body }\n });\n }\n}\n\nexport default TwilioService;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/twilio/twilio_service.js","var ExtJSON = require('./lib/ext_json');\n\nmodule.exports = ExtJSON;\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/index.js","'use strict';\n\n/**\n * Module dependencies.\n * @ignore\n */\nfunction convert(integer) {\n var str = Number(integer).toString(16);\n return str.length === 1 ? '0' + str : str;\n}\n\nfunction toExtendedJSON(obj) {\n var base64String = obj.buffer.toString('base64');\n\n return {\n $binary: {\n base64: base64String,\n subType: convert(obj.sub_type)\n }\n };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n var type = doc.$binary.subType ? parseInt(doc.$binary.subType, 16) : 0;\n\n var data = new Buffer(doc.$binary.base64, 'base64');\n\n return new BSON.Binary(data, type);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/binary.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n if (obj.scope) {\n return { $code: obj.code, $scope: obj.scope };\n }\n\n return { $code: obj.code };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Code(doc.$code, doc.$scope);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/code.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n var o = {\n $ref: obj.collection,\n $id: obj.oid\n };\n if (obj.db) o.$db = obj.db;\n o = Object.assign(o, obj.fields);\n return o;\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n var copy = Object.assign({}, doc);\n ['$ref', '$id', '$db'].forEach(k => delete copy[k]);\n return new BSON.DBRef(doc.$ref, doc.$id, doc.$db, copy);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/db_ref.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n return { $numberDecimal: obj.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Decimal128.fromString(doc.$numberDecimal);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/decimal128.js","'use strict';\n\nfunction toExtendedJSON(obj, options) {\n if (options.relaxed && isFinite(obj.value)) return obj.value;\n return { $numberDouble: obj.value.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Double(parseFloat(doc.$numberDouble));\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/double.js","'use strict';\n\nvar Binary = require('./binary');\nvar Code = require('./code');\nvar DBRef = require('./db_ref');\nvar Decimal128 = require('./decimal128');\nvar Double = require('./double');\nvar Int32 = require('./int_32');\nvar Long = require('./long');\nvar MaxKey = require('./max_key');\nvar MinKey = require('./min_key');\nvar ObjectID = require('./objectid');\nvar BSONRegExp = require('./regexp');\nvar Symbol = require('./symbol');\nvar Timestamp = require('./timestamp');\n\nmodule.exports = {\n Binary: Binary,\n Code: Code,\n DBRef: DBRef,\n Decimal128: Decimal128,\n Double: Double,\n Int32: Int32,\n Long: Long,\n MaxKey: MaxKey,\n MinKey: MinKey,\n ObjectID: ObjectID,\n BSONRegExp: BSONRegExp,\n Symbol: Symbol,\n Timestamp: Timestamp\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/index.js","'use strict';\n\nfunction toExtendedJSON(obj, options) {\n if (options && options.relaxed) return obj.value;\n return { $numberInt: obj.value.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Int32(doc.$numberInt);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/int_32.js","'use strict';\n\nfunction toExtendedJSON(obj, options) {\n if (options && options.relaxed) return obj.toNumber();\n return { $numberLong: obj.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return BSON.Long.fromString(doc.$numberLong);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/long.js","'use strict';\n\nfunction toExtendedJSON() {\n return { $maxKey: 1 };\n}\n\nfunction fromExtendedJSON(BSON) {\n return new BSON.MaxKey();\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/max_key.js","'use strict';\n\nfunction toExtendedJSON() {\n return { $minKey: 1 };\n}\n\nfunction fromExtendedJSON(BSON) {\n return new BSON.MinKey();\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/min_key.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n if (obj.toHexString) return { $oid: obj.toHexString() };\n return { $oid: obj.toString('hex') };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.ObjectID(doc.$oid);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/objectid.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n return { $regularExpression: { pattern: obj.pattern, options: obj.options } };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.BSONRegExp(\n doc.$regularExpression.pattern,\n doc.$regularExpression.options\n .split('')\n .sort()\n .join('')\n );\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/regexp.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n return { $symbol: obj.value };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Symbol(doc.$symbol);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/symbol.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n return {\n $timestamp: {\n t: obj.high_,\n i: obj.low_\n }\n };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Timestamp(doc.$timestamp.i, doc.$timestamp.t);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/timestamp.js","'use strict';\n\nlet codecs = require('./bson'),\n BSON = require('bson');\n\nvar BSONTypes = [\n 'Binary',\n 'Code',\n 'DBRef',\n 'Decimal128',\n 'Double',\n 'Int32',\n 'Long',\n 'MaxKey',\n 'MinKey',\n 'ObjectID',\n 'BSONRegExp',\n 'Symbol',\n 'Timestamp'\n];\n\nsetBSONModule(BSON);\n\n// all the types where we don't need to do any special processing and can just pass the EJSON\n//straight to type.fromExtendedJSON\nvar keysToCodecs = {\n $oid: codecs.ObjectID,\n $binary: codecs.Binary,\n $symbol: codecs.Symbol,\n $numberDecimal: codecs.Decimal128,\n $numberLong: codecs.Long,\n $minKey: codecs.MinKey,\n $maxKey: codecs.MaxKey,\n $regularExpression: codecs.BSONRegExp,\n $timestamp: codecs.Timestamp\n};\n\nfunction setBSONModule(module) {\n BSONTypes.forEach(t => {\n if (!module[t]) throw new Error('passed in module does not contain all BSON types required');\n });\n BSON = module;\n}\n\nfunction deserializeValue(self, key, value, options) {\n if (typeof value === 'number') {\n // if it's an integer, should interpret as smallest BSON integer\n // that can represent it exactly. (if out of range, interpret as double.)\n if (Math.floor(value) === value) {\n let int32Range = value >= BSON_INT32_MIN && value <= BSON_INT32_MAX,\n int64Range = value >= BSON_INT64_MIN && value <= BSON_INT64_MAX;\n\n if (int32Range) return options.strict ? new BSON.Int32(value) : value;\n if (int64Range) return options.strict ? new BSON.Long.fromNumber(value) : value;\n }\n // If the number is a non-integer or out of integer range, should interpret as BSON Double.\n return new BSON.Double(value);\n }\n\n // from here on out we're looking for bson types, so bail if its not an object\n if (value == null || typeof value !== 'object') return value;\n\n // upgrade deprecated undefined to null\n if (value.$undefined) return null;\n\n var keys = Object.keys(value).filter(k => k.startsWith('$') && value[k] != null);\n for (let i = 0; i < keys.length; i++) {\n let c = keysToCodecs[keys[i]];\n if (c) return c.fromExtendedJSON(BSON, value);\n }\n\n if (value.$date != null) {\n let d = value.$date,\n date = new Date();\n\n if (typeof d === 'string') date.setTime(Date.parse(d));\n else if (d instanceof BSON.Long) date.setTime(d.toNumber());\n return date;\n }\n\n if (value.$code != null) {\n if (value.$scope) var scope = deserializeValue(self, null, value.$scope);\n let copy = Object.assign({}, value);\n copy.$scope = scope;\n return codecs.Code.fromExtendedJSON(BSON, value);\n }\n\n if (value.$numberDouble != null) {\n return options.strict\n ? codecs.Double.fromExtendedJSON(BSON, value)\n : parseFloat(value.$numberDouble);\n }\n\n if (value.$numberInt != null) {\n return options.strict\n ? codecs.Int32.fromExtendedJSON(BSON, value)\n : parseInt(value.$numberInt, 10);\n }\n\n if (value.$ref != null || value.$dbPointer != null) {\n let v = value.$ref ? value : value.$dbPointer;\n\n // we run into this in a \"degenerate EJSON\" case (with $id and $ref order flipped)\n // because of the order JSON.parse goes through the document\n if (v instanceof BSON.DBRef) return v;\n\n let dollarKeys = Object.keys(v).filter(k => k.startsWith('$')),\n valid = true;\n dollarKeys.forEach(k => {\n if (['$ref', '$id', '$db'].indexOf(k) === -1) valid = false;\n });\n\n // only make DBRef if $ keys are all valid\n if (valid) return codecs.DBRef.fromExtendedJSON(BSON, v);\n }\n\n return value;\n}\n\nconst parse = function(text, options) {\n var self = this;\n options = options || { strict: true };\n\n return JSON.parse(text, function(key, value) {\n return deserializeValue(self, key, value, options);\n });\n};\n\n//\n// Serializer\n//\n\n// MAX INT32 boundaries\nconst BSON_INT32_MAX = 0x7fffffff,\n BSON_INT32_MIN = -0x80000000,\n BSON_INT64_MAX = 0x7fffffffffffffff,\n BSON_INT64_MIN = -0x8000000000000000;\n\nconst stringify = function(value, reducer, indents, options) {\n var opts = {};\n if (options != null && typeof options === 'object') opts = options;\n else if (indents != null && typeof indents === 'object') {\n opts = indents;\n indents = 0;\n } else if (reducer != null && typeof reducer === 'object') {\n opts = reducer;\n reducer = null;\n }\n\n var doc = Array.isArray(value) ? serializeArray(value, opts) : serializeDocument(value, opts);\n return JSON.stringify(doc, reducer, indents);\n};\n\nfunction serializeArray(array, options) {\n return array.map(v => serializeValue(v, options));\n}\n\nfunction getISOString(date) {\n var isoStr = date.toISOString();\n // we should only show milliseconds in timestamp if they're non-zero\n return date.getUTCMilliseconds() !== 0 ? isoStr : isoStr.slice(0, -5) + 'Z';\n}\n\nfunction serializeValue(value, options) {\n if (Array.isArray(value)) return serializeArray(value, options);\n\n if (value === undefined) return null;\n\n if (value instanceof Date) {\n let dateNum = value.getTime(),\n // is it in year range 1970-9999?\n inRange = dateNum > -1 && dateNum < 253402318800000;\n\n return options.relaxed && inRange\n ? { $date: getISOString(value) }\n : { $date: { $numberLong: value.getTime().toString() } };\n }\n\n if (typeof value === 'number' && !options.relaxed) {\n // it's an integer\n if (Math.floor(value) === value) {\n let int32Range = value >= BSON_INT32_MIN && value <= BSON_INT32_MAX,\n int64Range = value >= BSON_INT64_MIN && value <= BSON_INT64_MAX;\n\n // interpret as being of the smallest BSON integer type that can represent the number exactly\n if (int32Range) return { $numberInt: value.toString() };\n if (int64Range) return { $numberLong: value.toString() };\n }\n return { $numberDouble: value.toString() };\n }\n\n if (value != null && typeof value === 'object') return serializeDocument(value, options);\n return value;\n}\n\nfunction serializeDocument(doc, options) {\n if (doc == null || typeof doc !== 'object') throw new Error('not an object instance');\n\n // the document itself is a BSON type\n if (doc._bsontype && BSONTypes.indexOf(doc._bsontype) !== -1) {\n // we need to separately serialize the embedded scope document\n if (doc._bsontype === 'Code' && doc.scope) {\n let tempScope = serializeDocument(doc.scope, options),\n tempDoc = Object.assign({}, doc, { scope: tempScope });\n return codecs['Code'].toExtendedJSON(tempDoc, options);\n // we need to separately serialize the embedded OID document\n } else if (doc._bsontype === 'DBRef' && doc.oid) {\n let tempId = serializeDocument(doc.oid, options),\n tempDoc = Object.assign({}, doc, { oid: tempId });\n return codecs['DBRef'].toExtendedJSON(tempDoc, options);\n }\n return codecs[doc._bsontype].toExtendedJSON(doc, options);\n }\n\n // the document is an object with nested BSON types\n var _doc = {};\n for (var name in doc) {\n let val = doc[name];\n if (Array.isArray(val)) {\n _doc[name] = serializeArray(val, options);\n } else if (val != null && val._bsontype && BSONTypes.indexOf(val._bsontype) !== -1) {\n // we need to separately serialize the embedded scope document\n if (val._bsontype === 'Code' && val.scope) {\n let tempScope = serializeDocument(val.scope, options),\n tempVal = Object.assign({}, val, { scope: tempScope });\n _doc[name] = codecs['Code'].toExtendedJSON(tempVal, options);\n // we need to separately serialize the embedded OID document\n } else if (val._bsontype === 'DBRef' && val.oid) {\n let tempId = serializeDocument(val.oid, options),\n tempVal = Object.assign({}, val, { oid: tempId });\n _doc[name] = codecs['DBRef'].toExtendedJSON(tempVal, options);\n } else _doc[name] = codecs[val._bsontype].toExtendedJSON(val, options);\n } else if (val instanceof Date) {\n _doc[name] = serializeValue(val, options);\n } else if (val != null && typeof val === 'object') {\n _doc[name] = serializeDocument(val, options);\n }\n\n _doc[name] = serializeValue(val, options);\n }\n\n return _doc;\n}\n\nmodule.exports = {\n parse: parse,\n stringify: stringify,\n setBSONModule: setBSONModule,\n BSON: BSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/ext_json.js","'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, 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; i < l; i += 4) {\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 = 58\n// module chunks = 0","var detectBrowser = require('./lib/detectBrowser');\n\nvar agent;\n\nif (typeof navigator !== 'undefined' && navigator) {\n agent = navigator.userAgent;\n}\n\nmodule.exports = detectBrowser(agent);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/detect-browser/browser.js\n// module id = 59\n// module chunks = 0","var detectOS = require('./detectOS.js');\n\nmodule.exports = function detectBrowser(userAgentString) {\n if (!userAgentString) return null;\n\n var browsers = [\n [ 'edge', /Edge\\/([0-9\\._]+)/ ],\n [ 'yandexbrowser', /YaBrowser\\/([0-9\\._]+)/ ],\n [ 'vivaldi', /Vivaldi\\/([0-9\\.]+)/ ],\n [ 'kakaotalk', /KAKAOTALK\\s([0-9\\.]+)/ ],\n [ 'chrome', /(?!Chrom.*OPR)Chrom(?:e|ium)\\/([0-9\\.]+)(:?\\s|$)/ ],\n [ 'phantomjs', /PhantomJS\\/([0-9\\.]+)(:?\\s|$)/ ],\n [ 'crios', /CriOS\\/([0-9\\.]+)(:?\\s|$)/ ],\n [ 'firefox', /Firefox\\/([0-9\\.]+)(?:\\s|$)/ ],\n [ 'fxios', /FxiOS\\/([0-9\\.]+)/ ],\n [ 'opera', /Opera\\/([0-9\\.]+)(?:\\s|$)/ ],\n [ 'opera', /OPR\\/([0-9\\.]+)(:?\\s|$)$/ ],\n [ 'ie', /Trident\\/7\\.0.*rv\\:([0-9\\.]+).*\\).*Gecko$/ ],\n [ 'ie', /MSIE\\s([0-9\\.]+);.*Trident\\/[4-7].0/ ],\n [ 'ie', /MSIE\\s(7\\.0)/ ],\n [ 'bb10', /BB10;\\sTouch.*Version\\/([0-9\\.]+)/ ],\n [ 'android', /Android\\s([0-9\\.]+)/ ],\n [ 'ios', /Version\\/([0-9\\._]+).*Mobile.*Safari.*/ ],\n [ 'safari', /Version\\/([0-9\\._]+).*Safari/ ]\n ];\n\n return browsers.map(function (rule) {\n if (rule[1].test(userAgentString)) {\n var match = rule[1].exec(userAgentString);\n var version = match && match[1].split(/[._]/).slice(0,3);\n\n if (version && version.length < 3) {\n Array.prototype.push.apply(version, (version.length == 1) ? [0, 0] : [0]);\n }\n\n return {\n name: rule[0],\n version: version.join('.'),\n os: detectOS(userAgentString)\n };\n }\n }).filter(Boolean).shift();\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/detect-browser/lib/detectBrowser.js\n// module id = 60\n// module chunks = 0","module.exports = function detectOS(userAgentString) {\n var operatingSystems = [\n {\n name: 'iOS',\n rule: /iP(hone|od|ad)/\n },\n {\n name: 'Android OS',\n rule: /Android/\n },\n {\n name: 'BlackBerry OS',\n rule: /BlackBerry|BB10/\n },\n {\n name: 'Windows Mobile',\n rule: /IEMobile/\n },\n {\n name: 'Amazon OS',\n rule: /Kindle/\n },\n {\n name: 'Windows 3.11',\n rule: /Win16/\n },\n {\n name: 'Windows 95',\n rule: /(Windows 95)|(Win95)|(Windows_95)/\n },\n {\n name: 'Windows 98',\n rule: /(Windows 98)|(Win98)/\n },\n {\n name: 'Windows 2000',\n rule: /(Windows NT 5.0)|(Windows 2000)/\n },\n {\n name: 'Windows XP',\n rule: /(Windows NT 5.1)|(Windows XP)/\n },\n {\n name: 'Windows Server 2003',\n rule: /(Windows NT 5.2)/\n },\n {\n name: 'Windows Vista',\n rule: /(Windows NT 6.0)/\n },\n {\n name: 'Windows 7',\n rule: /(Windows NT 6.1)/\n },\n {\n name: 'Windows 8',\n rule: /(Windows NT 6.2)/\n },\n {\n name: 'Windows 8.1',\n rule: /(Windows NT 6.3)/\n },\n {\n name: 'Windows 10',\n rule: /(Windows NT 10.0)/\n },\n {\n name: 'Windows ME',\n rule: /Windows ME/\n },\n {\n name: 'Open BSD',\n rule: /OpenBSD/\n },\n {\n name: 'Sun OS',\n rule: /SunOS/\n },\n {\n name: 'Linux',\n rule: /(Linux)|(X11)/\n },\n {\n name: 'Mac OS',\n rule: /(Mac_PowerPC)|(Macintosh)/\n },\n {\n name: 'QNX',\n rule: /QNX/\n },\n {\n name: 'BeOS',\n rule: /BeOS/\n },\n {\n name: 'OS/2',\n rule: /OS\\/2/\n },\n {\n name: 'Search Bot',\n rule: /(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves\\/Teoma)|(ia_archiver)/\n }\n ];\n\n var detected = operatingSystems.filter(function (os) {\n if (userAgentString.match(os.rule)) {\n return true;\n }\n });\n\n return detected && detected[0] ? detected[0].name : null;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/detect-browser/lib/detectOS.js\n// module id = 61\n// module chunks = 0","exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/ieee754/index.js\n// module id = 62\n// module chunks = 0","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/inherits/inherits_browser.js\n// module id = 63\n// module chunks = 0","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/isarray/index.js\n// module id = 64\n// module chunks = 0","/**\n * The code was extracted from:\n * https://github.com/davidchambers/Base64.js\n */\n\nvar chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\nfunction InvalidCharacterError(message) {\n this.message = message;\n}\n\nInvalidCharacterError.prototype = new Error();\nInvalidCharacterError.prototype.name = 'InvalidCharacterError';\n\nfunction polyfill (input) {\n var str = String(input).replace(/=+$/, '');\n if (str.length % 4 == 1) {\n throw new InvalidCharacterError(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = '';\n // get next character\n buffer = str.charAt(idx++);\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n return output;\n}\n\n\nmodule.exports = typeof window !== 'undefined' && window.atob && window.atob.bind(window) || polyfill;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/jwt-decode/lib/atob.js\n// module id = 65\n// module chunks = 0","var atob = require('./atob');\n\nfunction b64DecodeUnicode(str) {\n return decodeURIComponent(atob(str).replace(/(.)/g, function (m, p) {\n var code = p.charCodeAt(0).toString(16).toUpperCase();\n if (code.length < 2) {\n code = '0' + code;\n }\n return '%' + code;\n }));\n}\n\nmodule.exports = function(str) {\n var output = str.replace(/-/g, \"+\").replace(/_/g, \"/\");\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += \"==\";\n break;\n case 3:\n output += \"=\";\n break;\n default:\n throw \"Illegal base64url string!\";\n }\n\n try{\n return b64DecodeUnicode(output);\n } catch (err) {\n return atob(output);\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/jwt-decode/lib/base64_url_decode.js\n// module id = 66\n// module chunks = 0","'use strict';\n\nvar base64_url_decode = require('./base64_url_decode');\n\nfunction InvalidTokenError(message) {\n this.message = message;\n}\n\nInvalidTokenError.prototype = new Error();\nInvalidTokenError.prototype.name = 'InvalidTokenError';\n\nmodule.exports = function (token,options) {\n if (typeof token !== 'string') {\n throw new InvalidTokenError('Invalid token specified');\n }\n\n options = options || {};\n var pos = options.header === true ? 0 : 1;\n try {\n return JSON.parse(base64_url_decode(token.split('.')[pos]));\n } catch (e) {\n throw new InvalidTokenError('Invalid token specified: ' + e.message);\n }\n};\n\nmodule.exports.InvalidTokenError = InvalidTokenError;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/jwt-decode/lib/index.js\n// module id = 67\n// module chunks = 0","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/object-assign/index.js\n// module id = 68\n// module chunks = 0","'use strict';\nvar strictUriEncode = require('strict-uri-encode');\nvar objectAssign = require('object-assign');\n\nfunction encoderForArrayFormat(opts) {\n\tswitch (opts.arrayFormat) {\n\t\tcase 'index':\n\t\t\treturn function (key, value, index) {\n\t\t\t\treturn value === null ? [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'[',\n\t\t\t\t\tindex,\n\t\t\t\t\t']'\n\t\t\t\t].join('') : [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'[',\n\t\t\t\t\tencode(index, opts),\n\t\t\t\t\t']=',\n\t\t\t\t\tencode(value, opts)\n\t\t\t\t].join('');\n\t\t\t};\n\n\t\tcase 'bracket':\n\t\t\treturn function (key, value) {\n\t\t\t\treturn value === null ? encode(key, opts) : [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'[]=',\n\t\t\t\t\tencode(value, opts)\n\t\t\t\t].join('');\n\t\t\t};\n\n\t\tdefault:\n\t\t\treturn function (key, value) {\n\t\t\t\treturn value === null ? encode(key, opts) : [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'=',\n\t\t\t\t\tencode(value, opts)\n\t\t\t\t].join('');\n\t\t\t};\n\t}\n}\n\nfunction parserForArrayFormat(opts) {\n\tvar result;\n\n\tswitch (opts.arrayFormat) {\n\t\tcase 'index':\n\t\t\treturn function (key, value, accumulator) {\n\t\t\t\tresult = /\\[(\\d*)\\]$/.exec(key);\n\n\t\t\t\tkey = key.replace(/\\[\\d*\\]$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = {};\n\t\t\t\t}\n\n\t\t\t\taccumulator[key][result[1]] = value;\n\t\t\t};\n\n\t\tcase 'bracket':\n\t\t\treturn function (key, value, accumulator) {\n\t\t\t\tresult = /(\\[\\])$/.exec(key);\n\t\t\t\tkey = key.replace(/\\[\\]$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t} else if (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = [value];\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [].concat(accumulator[key], value);\n\t\t\t};\n\n\t\tdefault:\n\t\t\treturn function (key, value, accumulator) {\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [].concat(accumulator[key], value);\n\t\t\t};\n\t}\n}\n\nfunction encode(value, opts) {\n\tif (opts.encode) {\n\t\treturn opts.strict ? strictUriEncode(value) : encodeURIComponent(value);\n\t}\n\n\treturn value;\n}\n\nfunction keysSorter(input) {\n\tif (Array.isArray(input)) {\n\t\treturn input.sort();\n\t} else if (typeof input === 'object') {\n\t\treturn keysSorter(Object.keys(input)).sort(function (a, b) {\n\t\t\treturn Number(a) - Number(b);\n\t\t}).map(function (key) {\n\t\t\treturn input[key];\n\t\t});\n\t}\n\n\treturn input;\n}\n\nexports.extract = function (str) {\n\treturn str.split('?')[1] || '';\n};\n\nexports.parse = function (str, opts) {\n\topts = objectAssign({arrayFormat: 'none'}, opts);\n\n\tvar formatter = parserForArrayFormat(opts);\n\n\t// Create an object with no prototype\n\t// https://github.com/sindresorhus/query-string/issues/47\n\tvar ret = Object.create(null);\n\n\tif (typeof str !== 'string') {\n\t\treturn ret;\n\t}\n\n\tstr = str.trim().replace(/^(\\?|#|&)/, '');\n\n\tif (!str) {\n\t\treturn ret;\n\t}\n\n\tstr.split('&').forEach(function (param) {\n\t\tvar parts = param.replace(/\\+/g, ' ').split('=');\n\t\t// Firefox (pre 40) decodes `%3D` to `=`\n\t\t// https://github.com/sindresorhus/query-string/pull/37\n\t\tvar key = parts.shift();\n\t\tvar val = parts.length > 0 ? parts.join('=') : undefined;\n\n\t\t// missing `=` should be `null`:\n\t\t// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters\n\t\tval = val === undefined ? null : decodeURIComponent(val);\n\n\t\tformatter(decodeURIComponent(key), val, ret);\n\t});\n\n\treturn Object.keys(ret).sort().reduce(function (result, key) {\n\t\tvar val = ret[key];\n\t\tif (Boolean(val) && typeof val === 'object' && !Array.isArray(val)) {\n\t\t\t// Sort object keys, not values\n\t\t\tresult[key] = keysSorter(val);\n\t\t} else {\n\t\t\tresult[key] = val;\n\t\t}\n\n\t\treturn result;\n\t}, Object.create(null));\n};\n\nexports.stringify = function (obj, opts) {\n\tvar defaults = {\n\t\tencode: true,\n\t\tstrict: true,\n\t\tarrayFormat: 'none'\n\t};\n\n\topts = objectAssign(defaults, opts);\n\n\tvar formatter = encoderForArrayFormat(opts);\n\n\treturn obj ? Object.keys(obj).sort().map(function (key) {\n\t\tvar val = obj[key];\n\n\t\tif (val === undefined) {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (val === null) {\n\t\t\treturn encode(key, opts);\n\t\t}\n\n\t\tif (Array.isArray(val)) {\n\t\t\tvar result = [];\n\n\t\t\tval.slice().forEach(function (val2) {\n\t\t\t\tif (val2 === undefined) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tresult.push(formatter(key, val2, result.length));\n\t\t\t});\n\n\t\t\treturn result.join('&');\n\t\t}\n\n\t\treturn encode(key, opts) + '=' + encode(val, opts);\n\t}).filter(function (x) {\n\t\treturn x.length > 0;\n\t}).join('&') : '';\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/query-string/index.js\n// module id = 69\n// module chunks = 0","'use strict';\nmodule.exports = function (str) {\n\treturn encodeURIComponent(str).replace(/[!'()*]/g, function (c) {\n\t\treturn '%' + c.charCodeAt(0).toString(16).toUpperCase();\n\t});\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/strict-uri-encode/index.js\n// module id = 70\n// module chunks = 0","module.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/util/support/isBufferBrowser.js\n// module id = 71\n// module chunks = 0","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexports.debuglog = function(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/util/util.js\n// module id = 72\n// module chunks = 0","(function(self) {\n 'use strict';\n\n if (self.fetch) {\n return\n }\n\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob: 'FileReader' in self && 'Blob' in self && (function() {\n try {\n new Blob()\n return true\n } catch(e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ]\n\n var isDataView = function(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n var isArrayBufferView = ArrayBuffer.isView || function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n }\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name)\n }\n if (/[^a-z0-9\\-#$%&'*+.\\^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value)\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift()\n return {done: value === undefined, value: value}\n }\n }\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n }\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {}\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value)\n }, this)\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1])\n }, this)\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name])\n }, this)\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name)\n value = normalizeValue(value)\n var oldValue = this.map[name]\n this.map[name] = oldValue ? oldValue+','+value : value\n }\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)]\n }\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name)\n return this.has(name) ? this.map[name] : null\n }\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n }\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value)\n }\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this)\n }\n }\n }\n\n Headers.prototype.keys = function() {\n var items = []\n this.forEach(function(value, name) { items.push(name) })\n return iteratorFor(items)\n }\n\n Headers.prototype.values = function() {\n var items = []\n this.forEach(function(value) { items.push(value) })\n return iteratorFor(items)\n }\n\n Headers.prototype.entries = function() {\n var items = []\n this.forEach(function(value, name) { items.push([name, value]) })\n return iteratorFor(items)\n }\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result)\n }\n reader.onerror = function() {\n reject(reader.error)\n }\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsArrayBuffer(blob)\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsText(blob)\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf)\n var chars = new Array(view.length)\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i])\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength)\n view.set(new Uint8Array(buf))\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false\n\n this._initBody = function(body) {\n this._bodyInit = body\n if (!body) {\n this._bodyText = ''\n } else if (typeof body === 'string') {\n this._bodyText = body\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString()\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer)\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer])\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body)\n } else {\n throw new Error('unsupported BodyInit type')\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8')\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type)\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')\n }\n }\n }\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n }\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n }\n }\n\n this.text = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n }\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n }\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n }\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase()\n return (methods.indexOf(upcased) > -1) ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {}\n var body = options.body\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url\n this.credentials = input.credentials\n if (!options.headers) {\n this.headers = new Headers(input.headers)\n }\n this.method = input.method\n this.mode = input.mode\n if (!body && input._bodyInit != null) {\n body = input._bodyInit\n input.bodyUsed = true\n }\n } else {\n this.url = String(input)\n }\n\n this.credentials = options.credentials || this.credentials || 'omit'\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers)\n }\n this.method = normalizeMethod(options.method || this.method || 'GET')\n this.mode = options.mode || this.mode || null\n this.referrer = null\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body)\n }\n\n Request.prototype.clone = function() {\n return new Request(this, { body: this._bodyInit })\n }\n\n function decode(body) {\n var form = new FormData()\n body.trim().split('&').forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=')\n var name = split.shift().replace(/\\+/g, ' ')\n var value = split.join('=').replace(/\\+/g, ' ')\n form.append(decodeURIComponent(name), decodeURIComponent(value))\n }\n })\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers()\n rawHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':')\n var key = parts.shift().trim()\n if (key) {\n var value = parts.join(':').trim()\n headers.append(key, value)\n }\n })\n return headers\n }\n\n Body.call(Request.prototype)\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {}\n }\n\n this.type = 'default'\n this.status = 'status' in options ? options.status : 200\n this.ok = this.status >= 200 && this.status < 300\n this.statusText = 'statusText' in options ? options.statusText : 'OK'\n this.headers = new Headers(options.headers)\n this.url = options.url || ''\n this._initBody(bodyInit)\n }\n\n Body.call(Response.prototype)\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n }\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''})\n response.type = 'error'\n return response\n }\n\n var redirectStatuses = [301, 302, 303, 307, 308]\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n }\n\n self.Headers = Headers\n self.Request = Request\n self.Response = Response\n\n self.fetch = function(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init)\n var xhr = new XMLHttpRequest()\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n }\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL')\n var body = 'response' in xhr ? xhr.response : xhr.responseText\n resolve(new Response(body, options))\n }\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'))\n }\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'))\n }\n\n xhr.open(request.method, request.url, true)\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob'\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value)\n })\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)\n })\n }\n self.fetch.polyfill = true\n})(typeof self !== 'undefined' ? self : this);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/whatwg-fetch/fetch.js\n// module id = 73\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 8e94527f40597b8e7578","webpack:///./~/buffer/index.js","webpack:///./~/bson/lib/bson/float_parser.js","webpack:///./src/util.js","webpack:///./~/bson/lib/bson/long.js","webpack:///./src/auth/common.js","webpack:///./~/bson/lib/bson/binary.js","webpack:///./~/bson/lib/bson/code.js","webpack:///./~/bson/lib/bson/db_ref.js","webpack:///./~/bson/lib/bson/decimal128.js","webpack:///./~/bson/lib/bson/double.js","webpack:///./~/bson/lib/bson/max_key.js","webpack:///./~/bson/lib/bson/min_key.js","webpack:///./~/bson/lib/bson/objectid.js","webpack:///./~/bson/lib/bson/regexp.js","webpack:///./~/bson/lib/bson/symbol.js","webpack:///./~/bson/lib/bson/timestamp.js","webpack:///./src/common.js","webpack:///(webpack)/buildin/global.js","webpack:///./~/bson/lib/bson/int_32.js","webpack:///./src/errors.js","webpack:///./src/client.js","webpack:///./~/mongodb-extjson/index.js","webpack:///./~/bson/lib/bson/map.js","webpack:///./src/auth/providers.js","webpack:///./~/fetch-everywhere/fetch-npm-browserify.js","webpack:///./~/process/browser.js","webpack:///./src/admin.js","webpack:///./~/Base64/base64.js","webpack:///./~/bson/lib/bson/bson.js","webpack:///./~/bson/lib/bson/parser/calculate_size.js","webpack:///./~/bson/lib/bson/parser/deserializer.js","webpack:///./~/bson/lib/bson/parser/serializer.js","webpack:///./src/auth/index.js","webpack:///./src/auth/storage.js","webpack:///./src/index.js","webpack:///./src/services/aws/s3_service.js","webpack:///./src/services/aws/ses_service.js","webpack:///./src/services/http/http_service.js","webpack:///./src/services/index.js","webpack:///./src/services/mongodb/collection.js","webpack:///./src/services/mongodb/db.js","webpack:///./src/services/mongodb/mongodb_service.js","webpack:///./src/services/twilio/twilio_service.js","webpack:///./~/mongodb-extjson/lib/bson/binary.js","webpack:///./~/mongodb-extjson/lib/bson/code.js","webpack:///./~/mongodb-extjson/lib/bson/db_ref.js","webpack:///./~/mongodb-extjson/lib/bson/decimal128.js","webpack:///./~/mongodb-extjson/lib/bson/double.js","webpack:///./~/mongodb-extjson/lib/bson/index.js","webpack:///./~/mongodb-extjson/lib/bson/int_32.js","webpack:///./~/mongodb-extjson/lib/bson/long.js","webpack:///./~/mongodb-extjson/lib/bson/max_key.js","webpack:///./~/mongodb-extjson/lib/bson/min_key.js","webpack:///./~/mongodb-extjson/lib/bson/objectid.js","webpack:///./~/mongodb-extjson/lib/bson/regexp.js","webpack:///./~/mongodb-extjson/lib/bson/symbol.js","webpack:///./~/mongodb-extjson/lib/bson/timestamp.js","webpack:///./~/mongodb-extjson/lib/ext_json.js","webpack:///./~/base64-js/index.js","webpack:///./~/detect-browser/browser.js","webpack:///./~/detect-browser/lib/detectBrowser.js","webpack:///./~/detect-browser/lib/detectOS.js","webpack:///./~/ieee754/index.js","webpack:///./~/inherits/inherits_browser.js","webpack:///./~/isarray/index.js","webpack:///./~/jwt-decode/lib/atob.js","webpack:///./~/jwt-decode/lib/base64_url_decode.js","webpack:///./~/jwt-decode/lib/index.js","webpack:///./~/object-assign/index.js","webpack:///./~/query-string/index.js","webpack:///./~/strict-uri-encode/index.js","webpack:///./~/util/support/isBufferBrowser.js","webpack:///./~/util/util.js","webpack:///./~/whatwg-fetch/fetch.js"],"names":["readIEEE754","buffer","offset","endian","mLen","nBytes","e","m","bBE","eLen","eMax","eBias","nBits","i","d","s","NaN","Infinity","Math","pow","writeIEEE754","value","c","rt","abs","isNaN","floor","log","LN2","exports","base64","RESULT_METADATA_KEY","collectMetadata","func","attachMetadata","res","Object","prototype","hasOwnProperty","call","defineProperty","enumerable","configurable","writable","metadata","Promise","resolve","captureMetadata","data","warnings","then","deprecate","fn","msg","alreadyWarned","deprecated","console","warn","apply","arguments","__proto__","serviceResponse","service","serviceName","action","args","client","Error","executeServiceFunction","uriEncodeObject","obj","encodeURIComponent","btoa","JSON","stringify","Long","low","high","_bsontype","low_","high_","toInt","toNumber","TWO_PWR_32_DBL_","getLowBitsUnsigned","toJSON","toString","opt_radix","radix","isZero","isNegative","equals","MIN_VALUE","radixLong","fromNumber","div","rem","multiply","subtract","negate","radixToPower","result","remDiv","intval","digits","length","getHighBits","getLowBits","getNumBitsAbs","val","bit","isOdd","other","notEquals","lessThan","compare","lessThanOrEqual","greaterThan","greaterThanOrEqual","thisNeg","otherNeg","not","add","ONE","a48","a32","a16","a00","b48","b32","b16","b00","c48","c32","c16","c00","fromBits","ZERO","TWO_PWR_24_","NEG_ONE","halfThis","shiftRight","approx","shiftLeft","max","log2","ceil","delta","approxRes","approxRem","modulo","and","or","xor","numBits","shiftRightUnsigned","fromInt","cachedObj","INT_CACHE_","isFinite","TWO_PWR_63_DBL_","MAX_VALUE","lowBits","highBits","fromString","str","charAt","substring","indexOf","size","min","parseInt","power","TWO_PWR_16_DBL_","TWO_PWR_24_DBL_","TWO_PWR_31_DBL_","TWO_PWR_48_DBL_","TWO_PWR_64_DBL_","module","USER_AUTH_KEY","REFRESH_TOKEN_KEY","DEVICE_ID_KEY","STATE_KEY","USER_AUTH_COOKIE_NAME","STITCH_ERROR_KEY","STITCH_LINK_KEY","USER_LOGGED_IN_PT_KEY","STITCH_REDIRECT_PROVIDER","DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS","APP_CLIENT_CODEC","ADMIN_CLIENT_CODEC","global","Buffer","require","Binary","subType","Number","sub_type","position","BSON_BINARY_SUBTYPE_DEFAULT","Uint8Array","writeStringToArray","BUFFER_SIZE","ArrayBuffer","Array","put","byte_value","decoded_byte","charCodeAt","isBuffer","copy","write","string","read","slice","asRaw","newBuffer","convertArraytoUtf8BinaryString","format","byteArray","startIndex","endIndex","String","fromCharCode","SUBTYPE_DEFAULT","SUBTYPE_FUNCTION","SUBTYPE_BYTE_ARRAY","SUBTYPE_UUID_OLD","SUBTYPE_UUID","SUBTYPE_MD5","SUBTYPE_USER_DEFINED","Code","code","scope","DBRef","namespace","oid","db","PARSE_STRING_REGEXP","PARSE_INF_REGEXP","PARSE_NAN_REGEXP","EXPONENT_MAX","EXPONENT_MIN","EXPONENT_BIAS","MAX_DIGITS","NAN_BUFFER","reverse","INF_NEGATIVE_BUFFER","INF_POSITIVE_BUFFER","EXPONENT_REGEX","isDigit","divideu128","DIVISOR","_rem","parts","quotient","multiply64x2","left","right","leftHigh","leftLow","rightHigh","rightLow","productHigh","productMid","productMid2","productLow","uhleft","uhright","ulleft","ulright","longtoHex","index","int32toHex","Decimal128","bytes","sawRadix","foundNonZero","significantDigits","nDigitsRead","nDigits","radixPosition","firstNonZero","nDigitsStored","digitsInsert","firstDigit","lastDigit","exponent","significandHigh","significandLow","biasedExponent","trim","stringMatch","match","infMatch","nanMatch","undefined","substr","digitsString","join","endOfString","roundDigit","roundBit","dIdx","significand","dec","COMBINATION_MASK","EXPONENT_MASK","COMBINATION_INFINITY","COMBINATION_NAN","COMBINATION_SNAN","midh","midl","combination","biased_exponent","significand_digits","scientific_exponent","is_zero","significand_msb","significand128","j","k","push","least_digits","radix_position","Double","valueOf","MaxKey","MinKey","MACHINE_ID","random","checkForHexRegExp","RegExp","hasBufferType","from","err","ObjectID","id","generate","cacheHexString","__id","valid","isValid","createFromHexString","toHexString","ObjectId","hexTable","hexString","_Buffer","convertToHex","get_inc","getInc","time","Date","now","pid","process","inc","inspect","otherId","toLowerCase","getTimestamp","timestamp","setTime","createPk","createFromTime","encodeLookup","split","decodeLookup","array","n","test","get","set","BSONRegExp","pattern","options","Symbol","Timestamp","radixTimestamp","JSONTYPE","APP_CLIENT_TYPE","ADMIN_CLIENT_TYPE","DEFAULT_STITCH_SERVER_URL","version","SDK_VERSION","checkStatus","response","status","headers","json","error","error_code","reject","statusText","makeFetchArgs","method","body","init","cors","Int32","StitchError","message","name","captureStackTrace","constructor","stack","ErrAuthProviderNotFound","ErrInvalidSession","ErrUnauthorized","newStitchClient","common","v1","v2","v3","API_TYPE_PUBLIC","API_TYPE_PRIVATE","API_TYPE_CLIENT","API_TYPE_APP","StitchClientFactory","clientAppID","StitchClient","stitchClient","create","baseUrl","authUrl","rootURLsByAPIVersion","authOptions","codec","storage","storageType","platform","authCodec","authPromise","auth","all","handleRedirect","handleCookie","email","password","authenticate","assign","username","provider","register","providerType","authenticateFn","authedId","isAuthenticated","getLoggedInProviderType","logout","_do","refreshOnFailure","useRefreshToken","rootURL","clear","type","ServiceType","_doFunctionCall","request","responseDecoder","parse","strict","responseEncoder","text","userApiKeyName","keyID","url","fetchArgs","resource","fetch","refreshToken","appURL","apiVersion","apiType","queryParams","_fetchArgs","noAuth","_fetch","token","getRefreshToken","getAccessToken","isAccessTokenExpired","Authorization","ExtJSON","Map","_keys","_values","entry","key","v","delete","splice","entries","self","next","done","forEach","callback","has","keys","values","authCommon","PROVIDER_TYPE_ANON","PROVIDER_TYPE_CUSTOM","PROVIDER_TYPE_USERPASS","PROVIDER_TYPE_APIKEY","PROVIDER_TYPE_GOOGLE","PROVIDER_TYPE_FACEBOOK","PROVIDER_TYPE_MONGODB_CLOUD","anonProvider","deviceId","getDeviceId","device","getDeviceInfo","rootUrl","customProvider","providerRoute","loginRoute","userPassProvider","isAppClient","emailConfirm","tokenId","sendEmailConfirm","sendPasswordReset","passwordReset","apiKeyProvider","alpha","generateState","state","getOAuthLoginURL","providerName","redirectUrl","pageRootUrl","encodeURI","googleProvider","authCode","window","location","replace","facebookProvider","accessToken","mongodbCloudProvider","apiKey","cookie","credentials","createProviders","StitchAdminClientFactory","StitchAdminClient","_v3","_get","groupId","api","groupUrl","list","query","defaults","_post","app","appId","appUrl","remove","_delete","valueId","valueUrl","update","_put","services","serviceId","runCommand","commandName","config","_patch","rules","rule","ruleId","ruleUrl","incomingWebhooks","incomingWebhook","incomingWebhookId","webhookUrl","pushNotifications","filter","pushNotification","messageId","send","users","user","uid","devices","enable","disable","debug","executeFunction","userId","user_id","executeFunctionSource","source","evalSource","authProviders","authProvider","providerId","security","allowedRequestOrigins","logs","apiKeys","apiKeyId","functions","function","functionId","_v2","apps","pipelines","pipeline","pipelineId","pipelineUrl","setType","dev","executePipeline","v3do","contentHeader","v2do","deserialize","serializer","calculateObjectSize","MAXSIZE","BSON","serialize","object","checkKeys","serializeFunctions","ignoreUndefined","serializationIndex","finishedBuffer","serializeWithBufferAndIndex","finalBuffer","deserializeStream","numberOfDocuments","documents","docStartIndex","BSON_INT32_MAX","BSON_INT32_MIN","BSON_INT64_MAX","BSON_INT64_MIN","JS_INT_MAX","JS_INT_MIN","JS_INT_MAX_LONG","JS_INT_MIN_LONG","BSON_DATA_NUMBER","BSON_DATA_STRING","BSON_DATA_OBJECT","BSON_DATA_ARRAY","BSON_DATA_BINARY","BSON_DATA_OID","BSON_DATA_BOOLEAN","BSON_DATA_DATE","BSON_DATA_NULL","BSON_DATA_REGEXP","BSON_DATA_CODE","BSON_DATA_SYMBOL","BSON_DATA_CODE_W_SCOPE","BSON_DATA_INT","BSON_DATA_TIMESTAMP","BSON_DATA_LONG","BSON_DATA_MIN_KEY","BSON_DATA_MAX_KEY","BSON_BINARY_SUBTYPE_FUNCTION","BSON_BINARY_SUBTYPE_BYTE_ARRAY","BSON_BINARY_SUBTYPE_UUID","BSON_BINARY_SUBTYPE_MD5","BSON_BINARY_SUBTYPE_USER_DEFINED","isDate","totalLength","isArray","calculateElement","toBSON","byteLength","ordered_values","ignoreCase","multiline","f","deserializeObject","evalFunctions","cacheFunctions","cacheFunctionsCrc32","fieldsAsRaw","raw","bsonRegExp","promoteBuffers","promoteLongs","promoteValues","arrayIndex","elementType","stringSize","readDoubleLE","_index","objectSize","arrayOptions","stopIndex","BSON_DATA_UNDEFINED","long","BSON_DATA_DECIMAL128","decimal128","toObject","binarySize","totalBinarySize","_buffer","regExpOptions","optionsArray","functionString","hash","crc32","isolateEvalWithHash","functionCache","isolateEval","totalSize","scopeObject","BSON_DATA_DBPOINTER","oidBuffer","shift","collection","eval","bind","regexp","isRegExp","serializeString","numberOfWrittenBytes","serializeNumber","longVal","serializeNull","serializeBoolean","serializeDate","dateInMilis","getTime","serializeRegExp","serializeBSONRegExp","sort","serializeMinMax","serializeObjectId","serializeBuffer","serializeObject","depth","path","serializeInto","pop","serializeDecimal128","serializeLong","serializeInt32","serializeDouble","serializeFunction","serializeCode","codeSize","serializeBinary","serializeSymbol","serializeDBRef","startingIndex","iterator","newAuth","_platform","jwtDecode","EMBEDDED_USER_AUTH_DATA_PARTS","AuthFactory","Auth","providers","authObj","loggedInProviderType","appVersion","deviceInfo","sdkVersion","platformVersion","doSessionPost","protocol","host","pathname","_error","redirectProvider","ourState","_redirectProvider","redirectFragment","redirectState","parseRedirectFragment","lastError","history","replaceState","found","stateValid","ua","splitCookies","document","sepIdx","cookieName","cookieVal","uaCookie","getCookie","userAuth","unmarshallUserAuth","withinSeconds","decodedToken","exp","authType","newUserAuth","setters","fragment","vars","shouldBreak","pairParts","pairKey","decodeURIComponent","theirState","RangeError","createStorage","MemoryStorage","_data","_orderedKeys","_VERSION","_VERSION_KEY","_runMigration","migrations","map","store","getItem","item","setItem","_generateKey","removeItem","Storage","_migration","localStorage","sessionStorage","S3Service","bucket","acl","contentType","SESService","to","subject","HTTPService","urlOrOptions","buildResponse","buildArgs","Collection","doc","docs","updateOp","project","MongoQuery","aggregateOp","outgoingOptions","limit","count","isMulti","upsert","findOp","database","execute","DB","MongoDBService","databaseName","TwilioService","convert","integer","toExtendedJSON","base64String","$binary","fromExtendedJSON","$code","$scope","o","$ref","$id","$db","fields","$numberDecimal","relaxed","$numberDouble","parseFloat","$numberInt","$numberLong","$maxKey","$minKey","$oid","$regularExpression","$symbol","$timestamp","t","codecs","BSONTypes","setBSONModule","keysToCodecs","deserializeValue","int32Range","int64Range","$undefined","startsWith","$date","date","$dbPointer","dollarKeys","reducer","indents","opts","serializeArray","serializeDocument","serializeValue","getISOString","isoStr","toISOString","getUTCMilliseconds","dateNum","inRange","tempScope","tempDoc","tempId","_doc","tempVal"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,mDAAmD;AACxE;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,UAAU;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,uCAAuC,SAAS;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;;AAEA;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gDAAgD,EAAE;AAClD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAwB,eAAe;AACvC;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,wBAAwB,QAAQ;AAChC;AACA,qBAAqB,eAAe;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,mBAAmB,cAAc;AACjC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uDAAuD,OAAO;AAC9D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA,uDAAuD,OAAO;AAC9D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,qBAAqB,QAAQ;AAC7B;AACA;AACA,GAAG;AACH;AACA,eAAe,SAAS;AACxB;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,YAAY;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,iBAAiB,gBAAgB;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,gBAAgB;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;;AC5vDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAIA,cAAc,SAAdA,WAAc,CAASC,MAAT,EAAiBC,MAAjB,EAAyBC,MAAzB,EAAiCC,IAAjC,EAAuCC,MAAvC,EAA+C;AAC/D,MAAIC,CAAJ;AAAA,MAAOC,CAAP;AAAA,MACIC,MAAOL,WAAW,KADtB;AAAA,MAEIM,OAAOJ,SAAS,CAAT,GAAaD,IAAb,GAAoB,CAF/B;AAAA,MAGIM,OAAO,CAAC,KAAKD,IAAN,IAAc,CAHzB;AAAA,MAIIE,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A,MAAd1D,OAAc,uEAAJ,EAAI;;AAC3C,4CACG+H,kBADH,EACwBO,aAAa5E,IAAb,CADxB,0BAEGwE,oBAFH,EAE0BoB,eAAe5F,IAAf,CAF1B,0BAGGyE,oBAHH,EAG0B4B,eAAerG,IAAf,CAH1B,0BAIG0E,sBAJH,EAI4BgC,iBAAiB1G,IAAjB,CAJ5B,0BAKG2E,2BALH,EAKiCiC,qBAAqB5G,IAArB,CALjC,0BAMGuE,sBANH,EAM4Bc,iBAAiBrF,IAAjB,CAN5B,0BAOGsE,oBAPH,EAO0BY,eAAelF,IAAf,CAP1B;AASD;;QAEQgH,e,GAAAA,e;;;;;;AChZT;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACNA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;A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;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;;;;;;ACjHA;;AAEA;;AAEA;AACA;AACA;;AAEA;;;;;;;ACRA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA,oBAAoB;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;;;;;;AC1CA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;;;;;;AC/GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,QAAQ,WAAW;;AAEnB;AACA;AACA;AACA,QAAQ,WAAW;;AAEnB;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA,QAAQ,WAAW;;AAEnB;AACA;AACA,QAAQ,UAAU;;AAElB;AACA;;;;;;;ACnFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACtBA,iBAAiB;;AAEjB;AACA;AACA;;;;;;;ACJA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;;;;;ACrCA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;;;;;;;;AChCA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;;;;;;;;ACzBA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH,kCAAkC;AAClC;AACA;AACA;;AAEA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,gBAAgB,sBAAsB;AACtC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;ACzFA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,sBAAsB,oBAAoB;;AAE1C;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,IAAI;;AAEJ;AACA;;AAEA;AACA,EAAE;AACF;AACA,EAAE;AACF;;;;;;;;AC5MA;AACA;AACA;AACA;AACA,EAAE;AACF;;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA,C;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,sBAAsB;AACzC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,uBAAuB,SAAS;AAChC;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,4CAA4C,KAAK;;AAEjD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA;AACA,mCAAmC,OAAO;AAC1C;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;;AAGA;AACA;AACA,yDAAyD;AACzD;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA,WAAW;AACX;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA,WAAW,SAAS;AACpB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;ACzkBA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wCAAwC,mBAAmB;AAC3D;AACA;;AAEA;AACA;AACA,kCAAkC,oBAAoB;AACtD;AACA;;AAEA;AACA;AACA,wCAAwC,4BAA4B;AACpE;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA,uDAAuD;AACvD,SAAS;AACT;AACA,SAAS;AACT,8EAA8E;AAC9E;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,8BAA8B,uBAAuB;AACrD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA,uCAAuC,0BAA0B;AACjE;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,+BAA+B,0BAA0B,eAAe;AACxE;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,OAAO;;AAEP;AACA,KAAK;AACL;AACA;AACA,CAAC","file":"stitch.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"stitch\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"stitch\"] = factory();\n\telse\n\t\troot[\"stitch\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \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 \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\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.l = 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// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 34);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 8e94527f40597b8e7578","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/buffer/index.js\n// module id = 0\n// module chunks = 0","// Copyright (c) 2008, Fair Oaks Labs, Inc.\n// All rights reserved.\n// \n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are met:\n// \n// * Redistributions of source code must retain the above copyright notice,\n// this list of conditions and the following disclaimer.\n// \n// * Redistributions in binary form must reproduce the above copyright notice,\n// this list of conditions and the following disclaimer in the documentation\n// and/or other materials provided with the distribution.\n// \n// * Neither the name of Fair Oaks Labs, Inc. nor the names of its contributors\n// may be used to endorse or promote products derived from this software\n// without specific prior written permission.\n// \n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n// POSSIBILITY OF SUCH DAMAGE.\n//\n//\n// Modifications to writeIEEE754 to support negative zeroes made by Brian White\n\nvar readIEEE754 = function(buffer, offset, endian, mLen, nBytes) {\n var e, m,\n bBE = (endian === 'big'),\n eLen = nBytes * 8 - mLen - 1,\n eMax = (1 << eLen) - 1,\n eBias = eMax >> 1,\n nBits = -7,\n i = bBE ? 0 : (nBytes - 1),\n d = bBE ? 1 : -1,\n s = buffer[offset + i];\n\n i += d;\n\n e = s & ((1 << (-nBits)) - 1);\n s >>= (-nBits);\n nBits += eLen;\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8);\n\n m = e & ((1 << (-nBits)) - 1);\n e >>= (-nBits);\n nBits += mLen;\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8);\n\n if (e === 0) {\n e = 1 - eBias;\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity);\n } else {\n m = m + Math.pow(2, mLen);\n e = e - eBias;\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen);\n};\n\nvar writeIEEE754 = function(buffer, value, offset, endian, mLen, nBytes) {\n var e, m, c,\n bBE = (endian === 'big'),\n eLen = nBytes * 8 - mLen - 1,\n eMax = (1 << eLen) - 1,\n eBias = eMax >> 1,\n rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),\n i = bBE ? (nBytes-1) : 0,\n d = bBE ? -1 : 1,\n s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;\n\n value = Math.abs(value);\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0;\n e = eMax;\n } else {\n e = Math.floor(Math.log(value) / Math.LN2);\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--;\n c *= 2;\n }\n if (e+eBias >= 1) {\n value += rt / c;\n } else {\n value += rt * Math.pow(2, 1 - eBias);\n }\n if (value * c >= 2) {\n e++;\n c /= 2;\n }\n\n if (e + eBias >= eMax) {\n m = 0;\n e = eMax;\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen);\n e = e + eBias;\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);\n e = 0;\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8);\n\n e = (e << mLen) | m;\n eLen += mLen;\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8);\n\n buffer[offset + i - d] |= s * 128;\n};\n\nexports.readIEEE754 = readIEEE754;\nexports.writeIEEE754 = writeIEEE754;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/float_parser.js","import * as base64 from 'Base64';\n\nconst RESULT_METADATA_KEY = '_stitch_metadata';\n\n/** @namespace util */\n\n/**\n * Utility which creates a function that extracts metadata\n * from the server in the response to a pipeline request,\n * and attaches it to the final result after the finalizer has been applied.\n *\n * @memberof util\n * @param {Function} [func] optional finalizer to transform the response data\n */\nexport const collectMetadata = (func) => {\n const attachMetadata = metadata => (res) => {\n if (typeof res === 'object' && !Object.prototype.hasOwnProperty.call(res, RESULT_METADATA_KEY)) {\n Object.defineProperty(\n res,\n RESULT_METADATA_KEY,\n {enumerable: false, configurable: false, writable: false, value: metadata}\n );\n }\n return Promise.resolve(res);\n };\n const captureMetadata = (data) => {\n let metadata = {};\n if (data.warnings) {\n // Metadata is not yet attached to result, grab any data that needs to be added.\n metadata.warnings = data.warnings;\n }\n if (!func) {\n return Promise.resolve(data).then(attachMetadata(metadata));\n }\n return Promise.resolve(data).then(func).then(attachMetadata(metadata));\n };\n return captureMetadata;\n};\n\n/**\n * Utility function for displaying deprecation notices\n *\n * @memberof util\n * @param {Function} fn the function to deprecate\n * @param {String} msg the message to display to the user regarding deprecation\n */\nfunction deprecate(fn, msg) {\n let alreadyWarned = false;\n function deprecated() {\n if (!alreadyWarned) {\n alreadyWarned = true;\n console.warn('DeprecationWarning: ' + msg);\n }\n\n return fn.apply(this, arguments);\n }\n\n deprecated.__proto__ = fn; // eslint-disable-line\n if (fn.prototype) {\n deprecated.prototype = fn.prototype;\n }\n\n return deprecated;\n}\n\n/**\n * Utility method for executing a service action as a function call.\n *\n * @memberof util\n * @param {Object} service the service to execute the action on\n * @param {String} action the service action to execute\n * @param {Array} args the arguments to supply to the service action invocation\n * @returns {Promise} the API response from the executed service action\n */\nfunction serviceResponse(service, { serviceName = service.serviceName, action, args }) {\n const { client } = service;\n\n if (!client) {\n throw new Error('Service has no client');\n }\n\n return client.executeServiceFunction(serviceName, action, args);\n}\n\n/**\n * Utility function to encode a JSON object into a valid string that can be\n * inserted in a URI. The object is first stringified, then encoded in base64,\n * and finally encoded via the builtin encodeURIComponent function.\n *\n * @memberof util\n * @param {Object} obj The object to encode\n * @returns {String} The encoded object\n */\nfunction uriEncodeObject(obj) {\n return encodeURIComponent(base64.btoa(JSON.stringify(obj)));\n}\n\nexport {\n deprecate,\n serviceResponse,\n uriEncodeObject\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/util.js","// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n// Copyright 2009 Google Inc. All Rights Reserved\n\n/**\n * Defines a Long class for representing a 64-bit two's-complement\n * integer value, which faithfully simulates the behavior of a Java \"Long\". This\n * implementation is derived from LongLib in GWT.\n *\n * Constructs a 64-bit two's-complement integer, given its low and high 32-bit\n * values as *signed* integers. See the from* functions below for more\n * convenient ways of constructing Longs.\n *\n * The internal representation of a Long is the two given signed, 32-bit values.\n * We use 32-bit pieces because these are the size of integers on which\n * Javascript performs bit-operations. For operations like addition and\n * multiplication, we split each number into 16-bit pieces, which can easily be\n * multiplied within Javascript's floating-point representation without overflow\n * or change in sign.\n *\n * In the algorithms below, we frequently reduce the negative case to the\n * positive case by negating the input(s) and then post-processing the result.\n * Note that we must ALWAYS check specially whether those values are MIN_VALUE\n * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\n * a positive number, it overflows back into a negative). Not handling this\n * case would often result in infinite recursion.\n *\n * @class\n * @param {number} low the low (signed) 32 bits of the Long.\n * @param {number} high the high (signed) 32 bits of the Long.\n * @return {Long}\n */\nfunction Long(low, high) {\n if(!(this instanceof Long)) return new Long(low, high);\n \n this._bsontype = 'Long';\n /**\n * @type {number}\n * @ignore\n */\n this.low_ = low | 0; // force into 32 signed bits.\n\n /**\n * @type {number}\n * @ignore\n */\n this.high_ = high | 0; // force into 32 signed bits.\n};\n\n/**\n * Return the int value.\n *\n * @method\n * @return {number} the value, assuming it is a 32-bit integer.\n */\nLong.prototype.toInt = function() {\n return this.low_;\n};\n\n/**\n * Return the Number value.\n *\n * @method\n * @return {number} the closest floating-point representation to this value.\n */\nLong.prototype.toNumber = function() {\n return this.high_ * Long.TWO_PWR_32_DBL_ +\n this.getLowBitsUnsigned();\n};\n\n/**\n * Return the JSON value.\n *\n * @method\n * @return {string} the JSON representation.\n */\nLong.prototype.toJSON = function() {\n return this.toString();\n}\n\n/**\n * Return the String value.\n *\n * @method\n * @param {number} [opt_radix] the radix in which the text should be written.\n * @return {string} the textual representation of this value.\n */\nLong.prototype.toString = function(opt_radix) {\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (this.isZero()) {\n return '0';\n }\n\n if (this.isNegative()) {\n if (this.equals(Long.MIN_VALUE)) {\n // We need to change the Long value before it can be negated, so we remove\n // the bottom-most digit in this base and then recurse to do the rest.\n var radixLong = Long.fromNumber(radix);\n var div = this.div(radixLong);\n var rem = div.multiply(radixLong).subtract(this);\n return div.toString(radix) + rem.toInt().toString(radix);\n } else {\n return '-' + this.negate().toString(radix);\n }\n }\n\n // Do several (6) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Long.fromNumber(Math.pow(radix, 6));\n\n var rem = this;\n var result = '';\n while (true) {\n var remDiv = rem.div(radixToPower);\n var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt();\n var digits = intval.toString(radix);\n\n rem = remDiv;\n if (rem.isZero()) {\n return digits + result;\n } else {\n while (digits.length < 6) {\n digits = '0' + digits;\n }\n result = '' + digits + result;\n }\n }\n};\n\n/**\n * Return the high 32-bits value.\n *\n * @method\n * @return {number} the high 32-bits as a signed value.\n */\nLong.prototype.getHighBits = function() {\n return this.high_;\n};\n\n/**\n * Return the low 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as a signed value.\n */\nLong.prototype.getLowBits = function() {\n return this.low_;\n};\n\n/**\n * Return the low unsigned 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as an unsigned value.\n */\nLong.prototype.getLowBitsUnsigned = function() {\n return (this.low_ >= 0) ?\n this.low_ : Long.TWO_PWR_32_DBL_ + this.low_;\n};\n\n/**\n * Returns the number of bits needed to represent the absolute value of this Long.\n *\n * @method\n * @return {number} Returns the number of bits needed to represent the absolute value of this Long.\n */\nLong.prototype.getNumBitsAbs = function() {\n if (this.isNegative()) {\n if (this.equals(Long.MIN_VALUE)) {\n return 64;\n } else {\n return this.negate().getNumBitsAbs();\n }\n } else {\n var val = this.high_ != 0 ? this.high_ : this.low_;\n for (var bit = 31; bit > 0; bit--) {\n if ((val & (1 << bit)) != 0) {\n break;\n }\n }\n return this.high_ != 0 ? bit + 33 : bit + 1;\n }\n};\n\n/**\n * Return whether this value is zero.\n *\n * @method\n * @return {boolean} whether this value is zero.\n */\nLong.prototype.isZero = function() {\n return this.high_ == 0 && this.low_ == 0;\n};\n\n/**\n * Return whether this value is negative.\n *\n * @method\n * @return {boolean} whether this value is negative.\n */\nLong.prototype.isNegative = function() {\n return this.high_ < 0;\n};\n\n/**\n * Return whether this value is odd.\n *\n * @method\n * @return {boolean} whether this value is odd.\n */\nLong.prototype.isOdd = function() {\n return (this.low_ & 1) == 1;\n};\n\n/**\n * Return whether this Long equals the other\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long equals the other\n */\nLong.prototype.equals = function(other) {\n return (this.high_ == other.high_) && (this.low_ == other.low_);\n};\n\n/**\n * Return whether this Long does not equal the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long does not equal the other.\n */\nLong.prototype.notEquals = function(other) {\n return (this.high_ != other.high_) || (this.low_ != other.low_);\n};\n\n/**\n * Return whether this Long is less than the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is less than the other.\n */\nLong.prototype.lessThan = function(other) {\n return this.compare(other) < 0;\n};\n\n/**\n * Return whether this Long is less than or equal to the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is less than or equal to the other.\n */\nLong.prototype.lessThanOrEqual = function(other) {\n return this.compare(other) <= 0;\n};\n\n/**\n * Return whether this Long is greater than the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is greater than the other.\n */\nLong.prototype.greaterThan = function(other) {\n return this.compare(other) > 0;\n};\n\n/**\n * Return whether this Long is greater than or equal to the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is greater than or equal to the other.\n */\nLong.prototype.greaterThanOrEqual = function(other) {\n return this.compare(other) >= 0;\n};\n\n/**\n * Compares this Long with the given one.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater.\n */\nLong.prototype.compare = function(other) {\n if (this.equals(other)) {\n return 0;\n }\n\n var thisNeg = this.isNegative();\n var otherNeg = other.isNegative();\n if (thisNeg && !otherNeg) {\n return -1;\n }\n if (!thisNeg && otherNeg) {\n return 1;\n }\n\n // at this point, the signs are the same, so subtraction will not overflow\n if (this.subtract(other).isNegative()) {\n return -1;\n } else {\n return 1;\n }\n};\n\n/**\n * The negation of this value.\n *\n * @method\n * @return {Long} the negation of this value.\n */\nLong.prototype.negate = function() {\n if (this.equals(Long.MIN_VALUE)) {\n return Long.MIN_VALUE;\n } else {\n return this.not().add(Long.ONE);\n }\n};\n\n/**\n * Returns the sum of this and the given Long.\n *\n * @method\n * @param {Long} other Long to add to this one.\n * @return {Long} the sum of this and the given Long.\n */\nLong.prototype.add = function(other) {\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 + b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 + b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 + b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 + b48;\n c48 &= 0xFFFF;\n return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32);\n};\n\n/**\n * Returns the difference of this and the given Long.\n *\n * @method\n * @param {Long} other Long to subtract from this.\n * @return {Long} the difference of this and the given Long.\n */\nLong.prototype.subtract = function(other) {\n return this.add(other.negate());\n};\n\n/**\n * Returns the product of this and the given Long.\n *\n * @method\n * @param {Long} other Long to multiply with this.\n * @return {Long} the product of this and the other.\n */\nLong.prototype.multiply = function(other) {\n if (this.isZero()) {\n return Long.ZERO;\n } else if (other.isZero()) {\n return Long.ZERO;\n }\n\n if (this.equals(Long.MIN_VALUE)) {\n return other.isOdd() ? Long.MIN_VALUE : Long.ZERO;\n } else if (other.equals(Long.MIN_VALUE)) {\n return this.isOdd() ? Long.MIN_VALUE : Long.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().multiply(other.negate());\n } else {\n return this.negate().multiply(other).negate();\n }\n } else if (other.isNegative()) {\n return this.multiply(other.negate()).negate();\n }\n\n // If both Longs are small, use float multiplication\n if (this.lessThan(Long.TWO_PWR_24_) &&\n other.lessThan(Long.TWO_PWR_24_)) {\n return Long.fromNumber(this.toNumber() * other.toNumber());\n }\n\n // Divide each Long into 4 chunks of 16 bits, and then add up 4x4 products.\n // We can skip products that would overflow.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 * b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 * b00;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c16 += a00 * b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 * b00;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a16 * b16;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a00 * b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\n c48 &= 0xFFFF;\n return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32);\n};\n\n/**\n * Returns this Long divided by the given one.\n *\n * @method\n * @param {Long} other Long by which to divide.\n * @return {Long} this Long divided by the given one.\n */\nLong.prototype.div = function(other) {\n if (other.isZero()) {\n throw Error('division by zero');\n } else if (this.isZero()) {\n return Long.ZERO;\n }\n\n if (this.equals(Long.MIN_VALUE)) {\n if (other.equals(Long.ONE) ||\n other.equals(Long.NEG_ONE)) {\n return Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\n } else if (other.equals(Long.MIN_VALUE)) {\n return Long.ONE;\n } else {\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\n var halfThis = this.shiftRight(1);\n var approx = halfThis.div(other).shiftLeft(1);\n if (approx.equals(Long.ZERO)) {\n return other.isNegative() ? Long.ONE : Long.NEG_ONE;\n } else {\n var rem = this.subtract(other.multiply(approx));\n var result = approx.add(rem.div(other));\n return result;\n }\n }\n } else if (other.equals(Long.MIN_VALUE)) {\n return Long.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().div(other.negate());\n } else {\n return this.negate().div(other).negate();\n }\n } else if (other.isNegative()) {\n return this.div(other.negate()).negate();\n }\n\n // Repeat the following until the remainder is less than other: find a\n // floating-point that approximates remainder / other *from below*, add this\n // into the result, and subtract it from the remainder. It is critical that\n // the approximate value is less than or equal to the real value so that the\n // remainder never becomes negative.\n var res = Long.ZERO;\n var rem = this;\n while (rem.greaterThanOrEqual(other)) {\n // Approximate the result of division. This may be a little greater or\n // smaller than the actual value.\n var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber()));\n\n // We will tweak the approximate result by changing it in the 48-th digit or\n // the smallest non-fractional digit, whichever is larger.\n var log2 = Math.ceil(Math.log(approx) / Math.LN2);\n var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48);\n\n // Decrease the approximation until it is smaller than the remainder. Note\n // that if it is too large, the product overflows and is negative.\n var approxRes = Long.fromNumber(approx);\n var approxRem = approxRes.multiply(other);\n while (approxRem.isNegative() || approxRem.greaterThan(rem)) {\n approx -= delta;\n approxRes = Long.fromNumber(approx);\n approxRem = approxRes.multiply(other);\n }\n\n // We know the answer can't be zero... and actually, zero would cause\n // infinite recursion since we would make no progress.\n if (approxRes.isZero()) {\n approxRes = Long.ONE;\n }\n\n res = res.add(approxRes);\n rem = rem.subtract(approxRem);\n }\n return res;\n};\n\n/**\n * Returns this Long modulo the given one.\n *\n * @method\n * @param {Long} other Long by which to mod.\n * @return {Long} this Long modulo the given one.\n */\nLong.prototype.modulo = function(other) {\n return this.subtract(this.div(other).multiply(other));\n};\n\n/**\n * The bitwise-NOT of this value.\n *\n * @method\n * @return {Long} the bitwise-NOT of this value.\n */\nLong.prototype.not = function() {\n return Long.fromBits(~this.low_, ~this.high_);\n};\n\n/**\n * Returns the bitwise-AND of this Long and the given one.\n *\n * @method\n * @param {Long} other the Long with which to AND.\n * @return {Long} the bitwise-AND of this and the other.\n */\nLong.prototype.and = function(other) {\n return Long.fromBits(this.low_ & other.low_, this.high_ & other.high_);\n};\n\n/**\n * Returns the bitwise-OR of this Long and the given one.\n *\n * @method\n * @param {Long} other the Long with which to OR.\n * @return {Long} the bitwise-OR of this and the other.\n */\nLong.prototype.or = function(other) {\n return Long.fromBits(this.low_ | other.low_, this.high_ | other.high_);\n};\n\n/**\n * Returns the bitwise-XOR of this Long and the given one.\n *\n * @method\n * @param {Long} other the Long with which to XOR.\n * @return {Long} the bitwise-XOR of this and the other.\n */\nLong.prototype.xor = function(other) {\n return Long.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_);\n};\n\n/**\n * Returns this Long with bits shifted to the left by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Long} this shifted to the left by the given amount.\n */\nLong.prototype.shiftLeft = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var low = this.low_;\n if (numBits < 32) {\n var high = this.high_;\n return Long.fromBits(\n low << numBits,\n (high << numBits) | (low >>> (32 - numBits)));\n } else {\n return Long.fromBits(0, low << (numBits - 32));\n }\n }\n};\n\n/**\n * Returns this Long with bits shifted to the right by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Long} this shifted to the right by the given amount.\n */\nLong.prototype.shiftRight = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Long.fromBits(\n (low >>> numBits) | (high << (32 - numBits)),\n high >> numBits);\n } else {\n return Long.fromBits(\n high >> (numBits - 32),\n high >= 0 ? 0 : -1);\n }\n }\n};\n\n/**\n * Returns this Long with bits shifted to the right by the given amount, with the new top bits matching the current sign bit.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Long} this shifted to the right by the given amount, with zeros placed into the new leading bits.\n */\nLong.prototype.shiftRightUnsigned = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Long.fromBits(\n (low >>> numBits) | (high << (32 - numBits)),\n high >>> numBits);\n } else if (numBits == 32) {\n return Long.fromBits(high, 0);\n } else {\n return Long.fromBits(high >>> (numBits - 32), 0);\n }\n }\n};\n\n/**\n * Returns a Long representing the given (32-bit) integer value.\n *\n * @method\n * @param {number} value the 32-bit integer in question.\n * @return {Long} the corresponding Long value.\n */\nLong.fromInt = function(value) {\n if (-128 <= value && value < 128) {\n var cachedObj = Long.INT_CACHE_[value];\n if (cachedObj) {\n return cachedObj;\n }\n }\n\n var obj = new Long(value | 0, value < 0 ? -1 : 0);\n if (-128 <= value && value < 128) {\n Long.INT_CACHE_[value] = obj;\n }\n return obj;\n};\n\n/**\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n *\n * @method\n * @param {number} value the number in question.\n * @return {Long} the corresponding Long value.\n */\nLong.fromNumber = function(value) {\n if (isNaN(value) || !isFinite(value)) {\n return Long.ZERO;\n } else if (value <= -Long.TWO_PWR_63_DBL_) {\n return Long.MIN_VALUE;\n } else if (value + 1 >= Long.TWO_PWR_63_DBL_) {\n return Long.MAX_VALUE;\n } else if (value < 0) {\n return Long.fromNumber(-value).negate();\n } else {\n return new Long(\n (value % Long.TWO_PWR_32_DBL_) | 0,\n (value / Long.TWO_PWR_32_DBL_) | 0);\n }\n};\n\n/**\n * Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits.\n *\n * @method\n * @param {number} lowBits the low 32-bits.\n * @param {number} highBits the high 32-bits.\n * @return {Long} the corresponding Long value.\n */\nLong.fromBits = function(lowBits, highBits) {\n return new Long(lowBits, highBits);\n};\n\n/**\n * Returns a Long representation of the given string, written using the given radix.\n *\n * @method\n * @param {string} str the textual representation of the Long.\n * @param {number} opt_radix the radix in which the text is written.\n * @return {Long} the corresponding Long value.\n */\nLong.fromString = function(str, opt_radix) {\n if (str.length == 0) {\n throw Error('number format error: empty string');\n }\n\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (str.charAt(0) == '-') {\n return Long.fromString(str.substring(1), radix).negate();\n } else if (str.indexOf('-') >= 0) {\n throw Error('number format error: interior \"-\" character: ' + str);\n }\n\n // Do several (8) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Long.fromNumber(Math.pow(radix, 8));\n\n var result = Long.ZERO;\n for (var i = 0; i < str.length; i += 8) {\n var size = Math.min(8, str.length - i);\n var value = parseInt(str.substring(i, i + size), radix);\n if (size < 8) {\n var power = Long.fromNumber(Math.pow(radix, size));\n result = result.multiply(power).add(Long.fromNumber(value));\n } else {\n result = result.multiply(radixToPower);\n result = result.add(Long.fromNumber(value));\n }\n }\n return result;\n};\n\n// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the\n// from* methods on which they depend.\n\n\n/**\n * A cache of the Long representations of small integer values.\n * @type {Object}\n * @ignore\n */\nLong.INT_CACHE_ = {};\n\n// NOTE: the compiler should inline these constant values below and then remove\n// these variables, so there should be no runtime penalty for these.\n\n/**\n * Number used repeated below in calculations. This must appear before the\n * first call to any from* function below.\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_16_DBL_ = 1 << 16;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_24_DBL_ = 1 << 24;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_32_DBL_ = Long.TWO_PWR_16_DBL_ * Long.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_31_DBL_ = Long.TWO_PWR_32_DBL_ / 2;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_48_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_64_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_32_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_63_DBL_ = Long.TWO_PWR_64_DBL_ / 2;\n\n/** @type {Long} */\nLong.ZERO = Long.fromInt(0);\n\n/** @type {Long} */\nLong.ONE = Long.fromInt(1);\n\n/** @type {Long} */\nLong.NEG_ONE = Long.fromInt(-1);\n\n/** @type {Long} */\nLong.MAX_VALUE =\n Long.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0);\n\n/** @type {Long} */\nLong.MIN_VALUE = Long.fromBits(0, 0x80000000 | 0);\n\n/**\n * @type {Long}\n * @ignore\n */\nLong.TWO_PWR_24_ = Long.fromInt(1 << 24);\n\n/**\n * Expose.\n */\nmodule.exports = Long;\nmodule.exports.Long = Long;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/long.js","export const USER_AUTH_KEY = '_stitch_ua';\nexport const REFRESH_TOKEN_KEY = '_stitch_rt';\nexport const DEVICE_ID_KEY = '_stitch_did';\nexport const STATE_KEY = '_stitch_state';\nexport const USER_AUTH_COOKIE_NAME = 'stitch_ua';\nexport const STITCH_ERROR_KEY = '_stitch_error';\nexport const STITCH_LINK_KEY = '_stitch_link';\nexport const USER_LOGGED_IN_PT_KEY = '_stitch_pt';\nexport const STITCH_REDIRECT_PROVIDER = '_stitch_rp';\n\nexport const DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS = 10;\n\nexport const APP_CLIENT_CODEC = {\n 'accessToken': 'access_token',\n 'refreshToken': 'refresh_token',\n 'deviceId': 'device_id',\n 'userId': 'user_id'\n};\n\nexport const ADMIN_CLIENT_CODEC = {\n 'accessToken': 'access_token',\n 'refreshToken': 'refresh_token',\n 'deviceId': 'device_id',\n 'userId': 'user_id'\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/auth/common.js","/**\n * Module dependencies.\n * @ignore\n */\n\n// Test if we're in Node via presence of \"global\" not absence of \"window\"\n// to support hybrid environments like Electron\nif(typeof global !== 'undefined') {\n var Buffer = require('buffer').Buffer; // TODO just use global Buffer\n}\n\n/**\n * A class representation of the BSON Binary type.\n *\n * Sub types\n * - **BSON.BSON_BINARY_SUBTYPE_DEFAULT**, default BSON type.\n * - **BSON.BSON_BINARY_SUBTYPE_FUNCTION**, BSON function type.\n * - **BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY**, BSON byte array type.\n * - **BSON.BSON_BINARY_SUBTYPE_UUID**, BSON uuid type.\n * - **BSON.BSON_BINARY_SUBTYPE_MD5**, BSON md5 type.\n * - **BSON.BSON_BINARY_SUBTYPE_USER_DEFINED**, BSON user defined type.\n *\n * @class\n * @param {Buffer} buffer a buffer object containing the binary data.\n * @param {Number} [subType] the option binary type.\n * @return {Binary}\n */\nfunction Binary(buffer, subType) {\n if(!(this instanceof Binary)) return new Binary(buffer, subType);\n\n this._bsontype = 'Binary';\n\n if(buffer instanceof Number) {\n this.sub_type = buffer;\n this.position = 0;\n } else {\n this.sub_type = subType == null ? BSON_BINARY_SUBTYPE_DEFAULT : subType;\n this.position = 0;\n }\n\n if(buffer != null && !(buffer instanceof Number)) {\n // Only accept Buffer, Uint8Array or Arrays\n if(typeof buffer == 'string') {\n // Different ways of writing the length of the string for the different types\n if(typeof Buffer != 'undefined') {\n this.buffer = new Buffer(buffer);\n } else if(typeof Uint8Array != 'undefined' || (Object.prototype.toString.call(buffer) == '[object Array]')) {\n this.buffer = writeStringToArray(buffer);\n } else {\n throw new Error(\"only String, Buffer, Uint8Array or Array accepted\");\n }\n } else {\n this.buffer = buffer;\n }\n this.position = buffer.length;\n } else {\n if(typeof Buffer != 'undefined') {\n this.buffer = new Buffer(Binary.BUFFER_SIZE);\n } else if(typeof Uint8Array != 'undefined'){\n this.buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE));\n } else {\n this.buffer = new Array(Binary.BUFFER_SIZE);\n }\n // Set position to start of buffer\n this.position = 0;\n }\n};\n\n/**\n * Updates this binary with byte_value.\n *\n * @method\n * @param {string} byte_value a single byte we wish to write.\n */\nBinary.prototype.put = function put(byte_value) {\n // If it's a string and a has more than one character throw an error\n if(byte_value['length'] != null && typeof byte_value != 'number' && byte_value.length != 1) throw new Error(\"only accepts single character String, Uint8Array or Array\");\n if(typeof byte_value != 'number' && byte_value < 0 || byte_value > 255) throw new Error(\"only accepts number in a valid unsigned byte range 0-255\");\n\n // Decode the byte value once\n var decoded_byte = null;\n if(typeof byte_value == 'string') {\n decoded_byte = byte_value.charCodeAt(0);\n } else if(byte_value['length'] != null) {\n decoded_byte = byte_value[0];\n } else {\n decoded_byte = byte_value;\n }\n\n if(this.buffer.length > this.position) {\n this.buffer[this.position++] = decoded_byte;\n } else {\n if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) {\n // Create additional overflow buffer\n var buffer = new Buffer(Binary.BUFFER_SIZE + this.buffer.length);\n // Combine the two buffers together\n this.buffer.copy(buffer, 0, 0, this.buffer.length);\n this.buffer = buffer;\n this.buffer[this.position++] = decoded_byte;\n } else {\n var buffer = null;\n // Create a new buffer (typed or normal array)\n if(Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') {\n buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE + this.buffer.length));\n } else {\n buffer = new Array(Binary.BUFFER_SIZE + this.buffer.length);\n }\n\n // We need to copy all the content to the new array\n for(var i = 0; i < this.buffer.length; i++) {\n buffer[i] = this.buffer[i];\n }\n\n // Reassign the buffer\n this.buffer = buffer;\n // Write the byte\n this.buffer[this.position++] = decoded_byte;\n }\n }\n};\n\n/**\n * Writes a buffer or string to the binary.\n *\n * @method\n * @param {(Buffer|string)} string a string or buffer to be written to the Binary BSON object.\n * @param {number} offset specify the binary of where to write the content.\n * @return {null}\n */\nBinary.prototype.write = function write(string, offset) {\n offset = typeof offset == 'number' ? offset : this.position;\n\n // If the buffer is to small let's extend the buffer\n if(this.buffer.length < offset + string.length) {\n var buffer = null;\n // If we are in node.js\n if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) {\n buffer = new Buffer(this.buffer.length + string.length);\n this.buffer.copy(buffer, 0, 0, this.buffer.length);\n } else if(Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') {\n // Create a new buffer\n buffer = new Uint8Array(new ArrayBuffer(this.buffer.length + string.length))\n // Copy the content\n for(var i = 0; i < this.position; i++) {\n buffer[i] = this.buffer[i];\n }\n }\n\n // Assign the new buffer\n this.buffer = buffer;\n }\n\n if(typeof Buffer != 'undefined' && Buffer.isBuffer(string) && Buffer.isBuffer(this.buffer)) {\n string.copy(this.buffer, offset, 0, string.length);\n this.position = (offset + string.length) > this.position ? (offset + string.length) : this.position;\n // offset = string.length\n } else if(typeof Buffer != 'undefined' && typeof string == 'string' && Buffer.isBuffer(this.buffer)) {\n this.buffer.write(string, offset, 'binary');\n this.position = (offset + string.length) > this.position ? (offset + string.length) : this.position;\n // offset = string.length;\n } else if(Object.prototype.toString.call(string) == '[object Uint8Array]'\n || Object.prototype.toString.call(string) == '[object Array]' && typeof string != 'string') {\n for(var i = 0; i < string.length; i++) {\n this.buffer[offset++] = string[i];\n }\n\n this.position = offset > this.position ? offset : this.position;\n } else if(typeof string == 'string') {\n for(var i = 0; i < string.length; i++) {\n this.buffer[offset++] = string.charCodeAt(i);\n }\n\n this.position = offset > this.position ? offset : this.position;\n }\n};\n\n/**\n * Reads **length** bytes starting at **position**.\n *\n * @method\n * @param {number} position read from the given position in the Binary.\n * @param {number} length the number of bytes to read.\n * @return {Buffer}\n */\nBinary.prototype.read = function read(position, length) {\n length = length && length > 0\n ? length\n : this.position;\n\n // Let's return the data based on the type we have\n if(this.buffer['slice']) {\n return this.buffer.slice(position, position + length);\n } else {\n // Create a buffer to keep the result\n var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(length)) : new Array(length);\n for(var i = 0; i < length; i++) {\n buffer[i] = this.buffer[position++];\n }\n }\n // Return the buffer\n return buffer;\n};\n\n/**\n * Returns the value of this binary as a string.\n *\n * @method\n * @return {string}\n */\nBinary.prototype.value = function value(asRaw) {\n asRaw = asRaw == null ? false : asRaw;\n\n // Optimize to serialize for the situation where the data == size of buffer\n if(asRaw && typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer) && this.buffer.length == this.position)\n return this.buffer;\n\n // If it's a node.js buffer object\n if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) {\n return asRaw ? this.buffer.slice(0, this.position) : this.buffer.toString('binary', 0, this.position);\n } else {\n if(asRaw) {\n // we support the slice command use it\n if(this.buffer['slice'] != null) {\n return this.buffer.slice(0, this.position);\n } else {\n // Create a new buffer to copy content to\n var newBuffer = Object.prototype.toString.call(this.buffer) == '[object Uint8Array]' ? new Uint8Array(new ArrayBuffer(this.position)) : new Array(this.position);\n // Copy content\n for(var i = 0; i < this.position; i++) {\n newBuffer[i] = this.buffer[i];\n }\n // Return the buffer\n return newBuffer;\n }\n } else {\n return convertArraytoUtf8BinaryString(this.buffer, 0, this.position);\n }\n }\n};\n\n/**\n * Length.\n *\n * @method\n * @return {number} the length of the binary.\n */\nBinary.prototype.length = function length() {\n return this.position;\n};\n\n/**\n * @ignore\n */\nBinary.prototype.toJSON = function() {\n return this.buffer != null ? this.buffer.toString('base64') : '';\n}\n\n/**\n * @ignore\n */\nBinary.prototype.toString = function(format) {\n return this.buffer != null ? this.buffer.slice(0, this.position).toString(format) : '';\n}\n\n/**\n * Binary default subtype\n * @ignore\n */\nvar BSON_BINARY_SUBTYPE_DEFAULT = 0;\n\n/**\n * @ignore\n */\nvar writeStringToArray = function(data) {\n // Create a buffer\n var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(data.length)) : new Array(data.length);\n // Write the content to the buffer\n for(var i = 0; i < data.length; i++) {\n buffer[i] = data.charCodeAt(i);\n }\n // Write the string to the buffer\n return buffer;\n}\n\n/**\n * Convert Array ot Uint8Array to Binary String\n *\n * @ignore\n */\nvar convertArraytoUtf8BinaryString = function(byteArray, startIndex, endIndex) {\n var result = \"\";\n for(var i = startIndex; i < endIndex; i++) {\n result = result + String.fromCharCode(byteArray[i]);\n }\n return result;\n};\n\nBinary.BUFFER_SIZE = 256;\n\n/**\n * Default BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_DEFAULT = 0;\n/**\n * Function BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_FUNCTION = 1;\n/**\n * Byte Array BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_BYTE_ARRAY = 2;\n/**\n * OLD UUID BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_UUID_OLD = 3;\n/**\n * UUID BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_UUID = 4;\n/**\n * MD5 BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_MD5 = 5;\n/**\n * User BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_USER_DEFINED = 128;\n\n/**\n * Expose.\n */\nmodule.exports = Binary;\nmodule.exports.Binary = Binary;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/binary.js","/**\n * A class representation of the BSON Code type.\n *\n * @class\n * @param {(string|function)} code a string or function.\n * @param {Object} [scope] an optional scope for the function.\n * @return {Code}\n */\nvar Code = function Code(code, scope) {\n if(!(this instanceof Code)) return new Code(code, scope);\n this._bsontype = 'Code';\n this.code = code;\n this.scope = scope;\n};\n\n/**\n * @ignore\n */\nCode.prototype.toJSON = function() {\n return {scope:this.scope, code:this.code};\n}\n\nmodule.exports = Code;\nmodule.exports.Code = Code;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/code.js","/**\n * A class representation of the BSON DBRef type.\n *\n * @class\n * @param {string} namespace the collection name.\n * @param {ObjectID} oid the reference ObjectID.\n * @param {string} [db] optional db name, if omitted the reference is local to the current db.\n * @return {DBRef}\n */\nfunction DBRef(namespace, oid, db) {\n if(!(this instanceof DBRef)) return new DBRef(namespace, oid, db);\n \n this._bsontype = 'DBRef';\n this.namespace = namespace;\n this.oid = oid;\n this.db = db;\n};\n\n/**\n * @ignore\n * @api private\n */\nDBRef.prototype.toJSON = function() {\n return {\n '$ref':this.namespace,\n '$id':this.oid,\n '$db':this.db == null ? '' : this.db\n };\n}\n\nmodule.exports = DBRef;\nmodule.exports.DBRef = DBRef;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/db_ref.js","\"use strict\"\n\nvar Long = require('./long');\n\nvar PARSE_STRING_REGEXP = /^(\\+|\\-)?(\\d+|(\\d*\\.\\d*))?(E|e)?([\\-\\+])?(\\d+)?$/;\nvar PARSE_INF_REGEXP = /^(\\+|\\-)?(Infinity|inf)$/i;\nvar PARSE_NAN_REGEXP = /^(\\+|\\-)?NaN$/i;\n\nvar EXPONENT_MAX = 6111;\nvar EXPONENT_MIN = -6176;\nvar EXPONENT_BIAS = 6176;\nvar MAX_DIGITS = 34;\n\n// Nan value bits as 32 bit values (due to lack of longs)\nvar NAN_BUFFER = [0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].reverse();\n// Infinity value bits 32 bit values (due to lack of longs)\nvar INF_NEGATIVE_BUFFER = [0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].reverse();\nvar INF_POSITIVE_BUFFER = [0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].reverse();\n\nvar EXPONENT_REGEX = /^([\\-\\+])?(\\d+)?$/;\n\n\n// Detect if the value is a digit\nvar isDigit = function(value) {\n return !isNaN(parseInt(value, 10));\n}\n\n// Divide two uint128 values\nvar divideu128 = function(value) {\n var DIVISOR = Long.fromNumber(1000 * 1000 * 1000);\n var _rem = Long.fromNumber(0);\n var i = 0;\n\n if(!value.parts[0] && !value.parts[1] &&\n !value.parts[2] && !value.parts[3]) {\n return { quotient: value, rem: _rem };\n }\n\n for(var i = 0; i <= 3; i++) {\n // Adjust remainder to match value of next dividend\n _rem = _rem.shiftLeft(32);\n // Add the divided to _rem\n _rem = _rem.add(new Long(value.parts[i], 0));\n value.parts[i] = _rem.div(DIVISOR).low_;\n _rem = _rem.modulo(DIVISOR);\n }\n\n return { quotient: value, rem: _rem };\n}\n\n// Multiply two Long values and return the 128 bit value\nvar multiply64x2 = function(left, right) {\n if(!left && !right) {\n return {high: Long.fromNumber(0), low: Long.fromNumber(0)};\n }\n\n var leftHigh = left.shiftRightUnsigned(32);\n var leftLow = new Long(left.getLowBits(), 0);\n var rightHigh = right.shiftRightUnsigned(32);\n var rightLow = new Long(right.getLowBits(), 0);\n\n var productHigh = leftHigh.multiply(rightHigh);\n var productMid = leftHigh.multiply(rightLow);\n var productMid2 = leftLow.multiply(rightHigh);\n var productLow = leftLow.multiply(rightLow);\n\n productHigh = productHigh.add(productMid.shiftRightUnsigned(32));\n productMid = new Long(productMid.getLowBits(), 0)\n .add(productMid2)\n .add(productLow.shiftRightUnsigned(32));\n\n productHigh = productHigh.add(productMid.shiftRightUnsigned(32));\n productLow = productMid.shiftLeft(32).add(new Long(productLow.getLowBits(), 0));\n\n // Return the 128 bit result\n return {high: productHigh, low: productLow};\n}\n\nvar lessThan = function(left, right) {\n // Make values unsigned\n var uhleft = left.high_ >>> 0;\n var uhright = right.high_ >>> 0;\n\n // Compare high bits first\n if(uhleft < uhright) {\n return true\n } else if(uhleft == uhright) {\n var ulleft = left.low_ >>> 0;\n var ulright = right.low_ >>> 0;\n if(ulleft < ulright) return true;\n }\n\n return false;\n}\n\nvar longtoHex = function(value) {\n var buffer = new Buffer(8);\n var index = 0;\n // Encode the low 64 bits of the decimal\n // Encode low bits\n buffer[index++] = value.low_ & 0xff;\n buffer[index++] = (value.low_ >> 8) & 0xff;\n buffer[index++] = (value.low_ >> 16) & 0xff;\n buffer[index++] = (value.low_ >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = value.high_ & 0xff;\n buffer[index++] = (value.high_ >> 8) & 0xff;\n buffer[index++] = (value.high_ >> 16) & 0xff;\n buffer[index++] = (value.high_ >> 24) & 0xff;\n return buffer.reverse().toString('hex');\n}\n\nvar int32toHex = function(value) {\n var buffer = new Buffer(4);\n var index = 0;\n // Encode the low 64 bits of the decimal\n // Encode low bits\n buffer[index++] = value & 0xff;\n buffer[index++] = (value >> 8) & 0xff;\n buffer[index++] = (value >> 16) & 0xff;\n buffer[index++] = (value >> 24) & 0xff;\n return buffer.reverse().toString('hex');\n}\n\nvar Decimal128 = function(bytes) {\n this._bsontype = 'Decimal128';\n this.bytes = bytes;\n}\n\nDecimal128.fromString = function(string) {\n // Parse state tracking\n var isNegative = false;\n var sawRadix = false;\n var foundNonZero = false;\n\n // Total number of significant digits (no leading or trailing zero)\n var significantDigits = 0;\n // Total number of significand digits read\n var nDigitsRead = 0;\n // Total number of digits (no leading zeros)\n var nDigits = 0;\n // The number of the digits after radix\n var radixPosition = 0;\n // The index of the first non-zero in *str*\n var firstNonZero = 0;\n\n // Digits Array\n var digits = [0];\n // The number of digits in digits\n var nDigitsStored = 0;\n // Insertion pointer for digits\n var digitsInsert = 0;\n // The index of the first non-zero digit\n var firstDigit = 0;\n // The index of the last digit\n var lastDigit = 0;\n\n // Exponent\n var exponent = 0;\n // loop index over array\n var i = 0;\n // The high 17 digits of the significand\n var significandHigh = [0, 0];\n // The low 17 digits of the significand\n var significandLow = [0, 0];\n // The biased exponent\n var biasedExponent = 0;\n\n // Read index\n var index = 0;\n\n // Trim the string\n string = string.trim();\n\n // Results\n var stringMatch = string.match(PARSE_STRING_REGEXP);\n var infMatch = string.match(PARSE_INF_REGEXP);\n var nanMatch = string.match(PARSE_NAN_REGEXP);\n\n // Validate the string\n if(!stringMatch\n && ! infMatch\n && ! nanMatch || string.length == 0) {\n throw new Error(\"\" + string + \" not a valid Decimal128 string\");\n }\n\n // Check if we have an illegal exponent format\n if(stringMatch && stringMatch[4] && stringMatch[2] === undefined) {\n throw new Error(\"\" + string + \" not a valid Decimal128 string\");\n }\n\n // Get the negative or positive sign\n if(string[index] == '+' || string[index] == '-') {\n isNegative = string[index++] == '-';\n }\n\n // Check if user passed Infinity or NaN\n if(!isDigit(string[index]) && string[index] != '.') {\n if(string[index] == 'i' || string[index] == 'I') {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER));\n } else if(string[index] == 'N') {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n }\n\n // Read all the digits\n while(isDigit(string[index]) || string[index] == '.') {\n if(string[index] == '.') {\n if(sawRadix) {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n\n sawRadix = true;\n index = index + 1;\n continue;\n }\n\n if(nDigitsStored < 34) {\n if(string[index] != '0' || foundNonZero) {\n if(!foundNonZero) {\n firstNonZero = nDigitsRead;\n }\n\n foundNonZero = true;\n\n // Only store 34 digits\n digits[digitsInsert++] = parseInt(string[index], 10);\n nDigitsStored = nDigitsStored + 1;\n }\n }\n\n if(foundNonZero) {\n nDigits = nDigits + 1;\n }\n\n if(sawRadix) {\n radixPosition = radixPosition + 1;\n }\n\n nDigitsRead = nDigitsRead + 1;\n index = index + 1;\n }\n\n if(sawRadix && !nDigitsRead) {\n throw new Error(\"\" + string + \" not a valid Decimal128 string\");\n }\n\n // Read exponent if exists\n if(string[index] == 'e' || string[index] == 'E') {\n // Read exponent digits\n var match = string.substr(++index).match(EXPONENT_REGEX);\n\n // No digits read\n if(!match || !match[2]) {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n\n // Get exponent\n exponent = parseInt(match[0], 10);\n\n // Adjust the index\n index = index + match[0].length;\n }\n\n // Return not a number\n if(string[index]) {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n\n // Done reading input\n // Find first non-zero digit in digits\n firstDigit = 0;\n\n if(!nDigitsStored) {\n firstDigit = 0;\n lastDigit = 0;\n digits[0] = 0;\n nDigits = 1;\n nDigitsStored = 1;\n significantDigits = 0;\n } else {\n lastDigit = nDigitsStored - 1;\n significantDigits = nDigits;\n\n if(exponent != 0 && significantDigits != 1) {\n while(string[firstNonZero + significantDigits - 1] == '0') {\n significantDigits = significantDigits - 1;\n }\n }\n }\n\n // Normalization of exponent\n // Correct exponent based on radix position, and shift significand as needed\n // to represent user input\n\n // Overflow prevention\n if(exponent <= radixPosition && radixPosition - exponent > (1 << 14)) {\n exponent = EXPONENT_MIN;\n } else {\n exponent = exponent - radixPosition;\n }\n\n // Attempt to normalize the exponent\n while(exponent > EXPONENT_MAX) {\n // Shift exponent to significand and decrease\n lastDigit = lastDigit + 1;\n\n if(lastDigit - firstDigit > MAX_DIGITS) {\n // Check if we have a zero then just hard clamp, otherwise fail\n var digitsString = digits.join('');\n if(digitsString.match(/^0+$/)) {\n exponent = EXPONENT_MAX;\n break;\n } else {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER));\n }\n }\n\n exponent = exponent - 1;\n }\n\n while(exponent < EXPONENT_MIN || nDigitsStored < nDigits) {\n // Shift last digit\n if(lastDigit == 0) {\n exponent = EXPONENT_MIN;\n significantDigits = 0;\n break;\n }\n\n if(nDigitsStored < nDigits) {\n // adjust to match digits not stored\n nDigits = nDigits - 1;\n } else {\n // adjust to round\n lastDigit = lastDigit - 1;\n }\n\n if(exponent < EXPONENT_MAX) {\n exponent = exponent + 1;\n } else {\n // Check if we have a zero then just hard clamp, otherwise fail\n var digitsString = digits.join('');\n if(digitsString.match(/^0+$/)) {\n exponent = EXPONENT_MAX;\n break;\n } else {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER))\n }\n }\n }\n\n\n // Round\n // We've normalized the exponent, but might still need to round.\n if((lastDigit - firstDigit + 1 < significantDigits) && string[significantDigits] != '0') {\n var endOfString = nDigitsRead;\n\n // If we have seen a radix point, 'string' is 1 longer than we have\n // documented with ndigits_read, so inc the position of the first nonzero\n // digit and the position that digits are read to.\n if(sawRadix && exponent == EXPONENT_MIN) {\n firstNonZero = firstNonZero + 1;\n endOfString = endOfString + 1;\n }\n\n var roundDigit = parseInt(string[firstNonZero + lastDigit + 1], 10);\n var roundBit = 0;\n\n if(roundDigit >= 5) {\n roundBit = 1;\n\n if(roundDigit == 5) {\n roundBit = digits[lastDigit] % 2 == 1;\n\n for(var i = firstNonZero + lastDigit + 2; i < endOfString; i++) {\n if(parseInt(string[i], 10)) {\n roundBit = 1;\n break;\n }\n }\n }\n }\n\n if(roundBit) {\n var dIdx = lastDigit;\n\n for(; dIdx >= 0; dIdx--) {\n if(++digits[dIdx] > 9) {\n digits[dIdx] = 0;\n\n // overflowed most significant digit\n if(dIdx == 0) {\n if(exponent < EXPONENT_MAX) {\n exponent = exponent + 1;\n digits[dIdx] = 1;\n } else {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER))\n }\n }\n } else {\n break;\n }\n }\n }\n }\n\n // Encode significand\n // The high 17 digits of the significand\n significandHigh = Long.fromNumber(0);\n // The low 17 digits of the significand\n significandLow = Long.fromNumber(0);\n\n // read a zero\n if(significantDigits == 0) {\n significandHigh = Long.fromNumber(0);\n significandLow = Long.fromNumber(0);\n } else if(lastDigit - firstDigit < 17) {\n var dIdx = firstDigit;\n significandLow = Long.fromNumber(digits[dIdx++]);\n significandHigh = new Long(0, 0);\n\n for(; dIdx <= lastDigit; dIdx++) {\n significandLow = significandLow.multiply(Long.fromNumber(10));\n significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));\n }\n } else {\n var dIdx = firstDigit;\n significandHigh = Long.fromNumber(digits[dIdx++]);\n\n for(; dIdx <= lastDigit - 17; dIdx++) {\n significandHigh = significandHigh.multiply(Long.fromNumber(10));\n significandHigh = significandHigh.add(Long.fromNumber(digits[dIdx]));\n }\n\n significandLow = Long.fromNumber(digits[dIdx++]);\n\n for(; dIdx <= lastDigit; dIdx++) {\n significandLow = significandLow.multiply(Long.fromNumber(10));\n significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));\n }\n }\n\n var significand = multiply64x2(significandHigh, Long.fromString(\"100000000000000000\"));\n\n significand.low = significand.low.add(significandLow);\n\n if(lessThan(significand.low, significandLow)) {\n significand.high = significand.high.add(Long.fromNumber(1));\n }\n\n // Biased exponent\n var biasedExponent = (exponent + EXPONENT_BIAS);\n var dec = { low: Long.fromNumber(0), high: Long.fromNumber(0) };\n\n // Encode combination, exponent, and significand.\n if(significand.high.shiftRightUnsigned(49).and(Long.fromNumber(1)).equals(Long.fromNumber)) {\n // Encode '11' into bits 1 to 3\n dec.high = dec.high.or(Long.fromNumber(0x3).shiftLeft(61));\n dec.high = dec.high.or(Long.fromNumber(biasedExponent).and(Long.fromNumber(0x3fff).shiftLeft(47)));\n dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x7fffffffffff)));\n } else {\n dec.high = dec.high.or(Long.fromNumber(biasedExponent & 0x3fff).shiftLeft(49));\n dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x1ffffffffffff)));\n }\n\n dec.low = significand.low;\n\n // Encode sign\n if(isNegative) {\n dec.high = dec.high.or(Long.fromString('9223372036854775808'));\n }\n\n // Encode into a buffer\n var buffer = new Buffer(16);\n var index = 0;\n\n // Encode the low 64 bits of the decimal\n // Encode low bits\n buffer[index++] = dec.low.low_ & 0xff;\n buffer[index++] = (dec.low.low_ >> 8) & 0xff;\n buffer[index++] = (dec.low.low_ >> 16) & 0xff;\n buffer[index++] = (dec.low.low_ >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = dec.low.high_ & 0xff;\n buffer[index++] = (dec.low.high_ >> 8) & 0xff;\n buffer[index++] = (dec.low.high_ >> 16) & 0xff;\n buffer[index++] = (dec.low.high_ >> 24) & 0xff;\n\n // Encode the high 64 bits of the decimal\n // Encode low bits\n buffer[index++] = dec.high.low_ & 0xff;\n buffer[index++] = (dec.high.low_ >> 8) & 0xff;\n buffer[index++] = (dec.high.low_ >> 16) & 0xff;\n buffer[index++] = (dec.high.low_ >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = dec.high.high_ & 0xff;\n buffer[index++] = (dec.high.high_ >> 8) & 0xff;\n buffer[index++] = (dec.high.high_ >> 16) & 0xff;\n buffer[index++] = (dec.high.high_ >> 24) & 0xff;\n\n // Return the new Decimal128\n return new Decimal128(buffer);\n}\n\n// Extract least significant 5 bits\nvar COMBINATION_MASK = 0x1f;\n// Extract least significant 14 bits\nvar EXPONENT_MASK = 0x3fff;\n// Value of combination field for Inf\nvar COMBINATION_INFINITY = 30;\n// Value of combination field for NaN\nvar COMBINATION_NAN = 31;\n// Value of combination field for NaN\nvar COMBINATION_SNAN = 32;\n// decimal128 exponent bias\nvar EXPONENT_BIAS = 6176;\n\nDecimal128.prototype.toString = function() {\n // Note: bits in this routine are referred to starting at 0,\n // from the sign bit, towards the coefficient.\n\n // bits 0 - 31\n var high;\n // bits 32 - 63\n var midh;\n // bits 64 - 95\n var midl;\n // bits 96 - 127\n var low;\n // bits 1 - 5\n var combination;\n // decoded biased exponent (14 bits)\n var biased_exponent;\n // the number of significand digits\n var significand_digits = 0;\n // the base-10 digits in the significand\n var significand = new Array(36);\n for(var i = 0; i < significand.length; i++) significand[i] = 0;\n // read pointer into significand\n var index = 0;\n\n // unbiased exponent\n var exponent;\n // the exponent if scientific notation is used\n var scientific_exponent;\n\n // true if the number is zero\n var is_zero = false;\n\n // the most signifcant significand bits (50-46)\n var significand_msb;\n // temporary storage for significand decoding\n var significand128 = {parts: new Array(4)};\n // indexing variables\n var i;\n var j, k;\n\n // Output string\n var string = [];\n\n // Unpack index\n var index = 0;\n\n // Buffer reference\n var buffer = this.bytes;\n\n // Unpack the low 64bits into a long\n low = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n midl = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n // Unpack the high 64bits into a long\n midh = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n high = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n // Unpack index\n var index = 0;\n\n // Create the state of the decimal\n var dec = {\n low: new Long(low, midl),\n high: new Long(midh, high) };\n\n if(dec.high.lessThan(Long.ZERO)) {\n string.push('-');\n }\n\n // Decode combination field and exponent\n combination = (high >> 26) & COMBINATION_MASK;\n\n if((combination >> 3) == 3) {\n // Check for 'special' values\n if(combination == COMBINATION_INFINITY) {\n return string.join('') + \"Infinity\";\n } else if(combination == COMBINATION_NAN) {\n return \"NaN\";\n } else {\n biased_exponent = (high >> 15) & EXPONENT_MASK;\n significand_msb = 0x08 + ((high >> 14) & 0x01);\n }\n } else {\n significand_msb = (high >> 14) & 0x07;\n biased_exponent = (high >> 17) & EXPONENT_MASK;\n }\n\n exponent = biased_exponent - EXPONENT_BIAS;\n\n // Create string of significand digits\n\n // Convert the 114-bit binary number represented by\n // (significand_high, significand_low) to at most 34 decimal\n // digits through modulo and division.\n significand128.parts[0] = (high & 0x3fff) + ((significand_msb & 0xf) << 14);\n significand128.parts[1] = midh;\n significand128.parts[2] = midl;\n significand128.parts[3] = low;\n\n if(significand128.parts[0] == 0 && significand128.parts[1] == 0\n && significand128.parts[2] == 0 && significand128.parts[3] == 0) {\n is_zero = true;\n } else {\n for(var k = 3; k >= 0; k--) {\n var least_digits = 0;\n // Peform the divide\n var result = divideu128(significand128);\n significand128 = result.quotient;\n least_digits = result.rem.low_;\n\n // We now have the 9 least significant digits (in base 2).\n // Convert and output to string.\n if(!least_digits) continue;\n\n for(var j = 8; j >= 0; j--) {\n // significand[k * 9 + j] = Math.round(least_digits % 10);\n significand[k * 9 + j] = least_digits % 10;\n // least_digits = Math.round(least_digits / 10);\n least_digits = Math.floor(least_digits / 10);\n }\n }\n }\n\n // Output format options:\n // Scientific - [-]d.dddE(+/-)dd or [-]dE(+/-)dd\n // Regular - ddd.ddd\n\n if(is_zero) {\n significand_digits = 1;\n significand[index] = 0;\n } else {\n significand_digits = 36;\n var i = 0;\n\n while(!significand[index]) {\n i++;\n significand_digits = significand_digits - 1;\n index = index + 1;\n }\n }\n\n scientific_exponent = significand_digits - 1 + exponent;\n\n // The scientific exponent checks are dictated by the string conversion\n // specification and are somewhat arbitrary cutoffs.\n //\n // We must check exponent > 0, because if this is the case, the number\n // has trailing zeros. However, we *cannot* output these trailing zeros,\n // because doing so would change the precision of the value, and would\n // change stored data if the string converted number is round tripped.\n\n if(scientific_exponent >= 34 || scientific_exponent <= -7 ||\n exponent > 0) {\n // Scientific format\n string.push(significand[index++]);\n significand_digits = significand_digits - 1;\n\n if(significand_digits) {\n string.push('.');\n }\n\n for(var i = 0; i < significand_digits; i++) {\n string.push(significand[index++]);\n }\n\n // Exponent\n string.push('E');\n if(scientific_exponent > 0) {\n string.push('+' + scientific_exponent);\n } else {\n string.push(scientific_exponent);\n }\n } else {\n // Regular format with no decimal place\n if(exponent >= 0) {\n for(var i = 0; i < significand_digits; i++) {\n string.push(significand[index++]);\n }\n } else {\n var radix_position = significand_digits + exponent;\n\n // non-zero digits before radix\n if(radix_position > 0) {\n for(var i = 0; i < radix_position; i++) {\n string.push(significand[index++]);\n }\n } else {\n string.push('0');\n }\n\n string.push('.');\n // add leading zeros after radix\n while(radix_position++ < 0) {\n string.push('0');\n }\n\n for(var i = 0; i < significand_digits - Math.max(radix_position - 1, 0); i++) {\n string.push(significand[index++]);\n }\n }\n }\n\n return string.join('');\n}\n\nDecimal128.prototype.toJSON = function() {\n return { \"$numberDecimal\": this.toString() };\n}\n\nmodule.exports = Decimal128;\nmodule.exports.Decimal128 = Decimal128;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/decimal128.js","/**\n * A class representation of the BSON Double type.\n *\n * @class\n * @param {number} value the number we want to represent as a double.\n * @return {Double}\n */\nfunction Double(value) {\n if(!(this instanceof Double)) return new Double(value);\n\n this._bsontype = 'Double';\n this.value = value;\n}\n\n/**\n * Access the number value.\n *\n * @method\n * @return {number} returns the wrapped double number.\n */\nDouble.prototype.valueOf = function() {\n return this.value;\n};\n\n/**\n * @ignore\n */\nDouble.prototype.toJSON = function() {\n return this.value;\n}\n\nmodule.exports = Double;\nmodule.exports.Double = Double;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/double.js","/**\n * A class representation of the BSON MaxKey type.\n *\n * @class\n * @return {MaxKey} A MaxKey instance\n */\nfunction MaxKey() {\n if(!(this instanceof MaxKey)) return new MaxKey();\n \n this._bsontype = 'MaxKey'; \n}\n\nmodule.exports = MaxKey;\nmodule.exports.MaxKey = MaxKey;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/max_key.js","/**\n * A class representation of the BSON MinKey type.\n *\n * @class\n * @return {MinKey} A MinKey instance\n */\nfunction MinKey() {\n if(!(this instanceof MinKey)) return new MinKey();\n \n this._bsontype = 'MinKey';\n}\n\nmodule.exports = MinKey;\nmodule.exports.MinKey = MinKey;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/min_key.js","/**\n * Machine id.\n *\n * Create a random 3-byte value (i.e. unique for this\n * process). Other drivers use a md5 of the machine id here, but\n * that would mean an asyc call to gethostname, so we don't bother.\n * @ignore\n */\nvar MACHINE_ID = parseInt(Math.random() * 0xFFFFFF, 10);\n\n// Regular expression that checks for hex value\nvar checkForHexRegExp = new RegExp(\"^[0-9a-fA-F]{24}$\");\nvar hasBufferType = false;\n\n// Check if buffer exists\ntry {\n if(Buffer && Buffer.from) hasBufferType = true;\n} catch(err) {};\n\n/**\n* Create a new ObjectID instance\n*\n* @class\n* @param {(string|number)} id Can be a 24 byte hex string, 12 byte binary string or a Number.\n* @property {number} generationTime The generation time of this ObjectId instance\n* @return {ObjectID} instance of ObjectID.\n*/\nvar ObjectID = function ObjectID(id) {\n // Duck-typing to support ObjectId from different npm packages\n if(id instanceof ObjectID) return id;\n if(!(this instanceof ObjectID)) return new ObjectID(id);\n\n this._bsontype = 'ObjectID';\n\n // The most common usecase (blank id, new objectId instance)\n if(id == null || typeof id == 'number') {\n // Generate a new id\n this.id = this.generate(id);\n // If we are caching the hex string\n if(ObjectID.cacheHexString) this.__id = this.toString('hex');\n // Return the object\n return;\n }\n\n // Check if the passed in id is valid\n var valid = ObjectID.isValid(id);\n\n // Throw an error if it's not a valid setup\n if(!valid && id != null){\n throw new Error(\"Argument passed in must be a single String of 12 bytes or a string of 24 hex characters\");\n } else if(valid && typeof id == 'string' && id.length == 24 && hasBufferType) {\n return new ObjectID(new Buffer(id, 'hex'));\n } else if(valid && typeof id == 'string' && id.length == 24) {\n return ObjectID.createFromHexString(id);\n } else if(id != null && id.length === 12) {\n // assume 12 byte string\n this.id = id;\n } else if(id != null && id.toHexString) {\n // Duck-typing to support ObjectId from different npm packages\n return id;\n } else {\n throw new Error(\"Argument passed in must be a single String of 12 bytes or a string of 24 hex characters\");\n }\n\n if(ObjectID.cacheHexString) this.__id = this.toString('hex');\n};\n\n// Allow usage of ObjectId as well as ObjectID\nvar ObjectId = ObjectID;\n\n// Precomputed hex table enables speedy hex string conversion\nvar hexTable = [];\nfor (var i = 0; i < 256; i++) {\n hexTable[i] = (i <= 15 ? '0' : '') + i.toString(16);\n}\n\n/**\n* Return the ObjectID id as a 24 byte hex string representation\n*\n* @method\n* @return {string} return the 24 byte hex string representation.\n*/\nObjectID.prototype.toHexString = function() {\n if(ObjectID.cacheHexString && this.__id) return this.__id;\n\n var hexString = '';\n if(!this.id || !this.id.length) {\n throw new Error('invalid ObjectId, ObjectId.id must be either a string or a Buffer, but is [' + JSON.stringify(this.id) + ']');\n }\n\n if(this.id instanceof _Buffer) {\n hexString = convertToHex(this.id);\n if(ObjectID.cacheHexString) this.__id = hexString;\n return hexString;\n }\n\n for (var i = 0; i < this.id.length; i++) {\n hexString += hexTable[this.id.charCodeAt(i)];\n }\n\n if(ObjectID.cacheHexString) this.__id = hexString;\n return hexString;\n};\n\n/**\n* Update the ObjectID index used in generating new ObjectID's on the driver\n*\n* @method\n* @return {number} returns next index value.\n* @ignore\n*/\nObjectID.prototype.get_inc = function() {\n return ObjectID.index = (ObjectID.index + 1) % 0xFFFFFF;\n};\n\n/**\n* Update the ObjectID index used in generating new ObjectID's on the driver\n*\n* @method\n* @return {number} returns next index value.\n* @ignore\n*/\nObjectID.prototype.getInc = function() {\n return this.get_inc();\n};\n\n/**\n* Generate a 12 byte id buffer used in ObjectID's\n*\n* @method\n* @param {number} [time] optional parameter allowing to pass in a second based timestamp.\n* @return {Buffer} return the 12 byte id buffer string.\n*/\nObjectID.prototype.generate = function(time) {\n if ('number' != typeof time) {\n time = ~~(Date.now()/1000);\n }\n\n // Use pid\n var pid = (typeof process === 'undefined' ? Math.floor(Math.random() * 100000) : process.pid) % 0xFFFF;\n var inc = this.get_inc();\n // Buffer used\n var buffer = new Buffer(12);\n // Encode time\n buffer[3] = time & 0xff;\n buffer[2] = (time >> 8) & 0xff;\n buffer[1] = (time >> 16) & 0xff;\n buffer[0] = (time >> 24) & 0xff;\n // Encode machine\n buffer[6] = MACHINE_ID & 0xff;\n buffer[5] = (MACHINE_ID >> 8) & 0xff;\n buffer[4] = (MACHINE_ID >> 16) & 0xff;\n // Encode pid\n buffer[8] = pid & 0xff;\n buffer[7] = (pid >> 8) & 0xff;\n // Encode index\n buffer[11] = inc & 0xff;\n buffer[10] = (inc >> 8) & 0xff;\n buffer[9] = (inc >> 16) & 0xff;\n // Return the buffer\n return buffer;\n};\n\n/**\n* Converts the id into a 24 byte hex string for printing\n*\n* @param {String} format The Buffer toString format parameter.\n* @return {String} return the 24 byte hex string representation.\n* @ignore\n*/\nObjectID.prototype.toString = function(format) {\n // Is the id a buffer then use the buffer toString method to return the format\n if(this.id && this.id.copy) {\n return this.id.toString(typeof format === 'string' ? format : 'hex');\n }\n\n // if(this.buffer )\n return this.toHexString();\n};\n\n/**\n* Converts to a string representation of this Id.\n*\n* @return {String} return the 24 byte hex string representation.\n* @ignore\n*/\nObjectID.prototype.inspect = ObjectID.prototype.toString;\n\n/**\n* Converts to its JSON representation.\n*\n* @return {String} return the 24 byte hex string representation.\n* @ignore\n*/\nObjectID.prototype.toJSON = function() {\n return this.toHexString();\n};\n\n/**\n* Compares the equality of this ObjectID with `otherID`.\n*\n* @method\n* @param {object} otherID ObjectID instance to compare against.\n* @return {boolean} the result of comparing two ObjectID's\n*/\nObjectID.prototype.equals = function equals (otherId) {\n var id;\n\n if(otherId instanceof ObjectID) {\n return this.toString() == otherId.toString();\n } else if(typeof otherId == 'string' && ObjectID.isValid(otherId) && otherId.length == 12 && this.id instanceof _Buffer) {\n return otherId === this.id.toString('binary');\n } else if(typeof otherId == 'string' && ObjectID.isValid(otherId) && otherId.length == 24) {\n return otherId.toLowerCase() === this.toHexString();\n } else if(typeof otherId == 'string' && ObjectID.isValid(otherId) && otherId.length == 12) {\n return otherId === this.id;\n } else if(otherId != null && (otherId instanceof ObjectID || otherId.toHexString)) {\n return otherId.toHexString() === this.toHexString();\n } else {\n return false;\n }\n}\n\n/**\n* Returns the generation date (accurate up to the second) that this ID was generated.\n*\n* @method\n* @return {date} the generation date\n*/\nObjectID.prototype.getTimestamp = function() {\n var timestamp = new Date();\n var time = this.id[3] | this.id[2] << 8 | this.id[1] << 16 | this.id[0] << 24;\n timestamp.setTime(Math.floor(time) * 1000);\n return timestamp;\n}\n\n/**\n* @ignore\n*/\nObjectID.index = ~~(Math.random() * 0xFFFFFF);\n\n/**\n* @ignore\n*/\nObjectID.createPk = function createPk () {\n return new ObjectID();\n};\n\n/**\n* Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID.\n*\n* @method\n* @param {number} time an integer number representing a number of seconds.\n* @return {ObjectID} return the created ObjectID\n*/\nObjectID.createFromTime = function createFromTime (time) {\n var buffer = new Buffer([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);\n // Encode time into first 4 bytes\n buffer[3] = time & 0xff;\n buffer[2] = (time >> 8) & 0xff;\n buffer[1] = (time >> 16) & 0xff;\n buffer[0] = (time >> 24) & 0xff;\n // Return the new objectId\n return new ObjectID(buffer);\n};\n\n// Lookup tables\nvar encodeLookup = '0123456789abcdef'.split('')\nvar decodeLookup = []\nvar i = 0\nwhile (i < 10) decodeLookup[0x30 + i] = i++\nwhile (i < 16) decodeLookup[0x41 - 10 + i] = decodeLookup[0x61 - 10 + i] = i++\n\nvar _Buffer = Buffer;\nvar convertToHex = function(bytes) {\n return bytes.toString('hex');\n}\n\n/**\n* Creates an ObjectID from a hex string representation of an ObjectID.\n*\n* @method\n* @param {string} hexString create a ObjectID from a passed in 24 byte hexstring.\n* @return {ObjectID} return the created ObjectID\n*/\nObjectID.createFromHexString = function createFromHexString (string) {\n // Throw an error if it's not a valid setup\n if(typeof string === 'undefined' || string != null && string.length != 24) {\n throw new Error(\"Argument passed in must be a single String of 12 bytes or a string of 24 hex characters\");\n }\n\n // Use Buffer.from method if available\n if(hasBufferType) return new ObjectID(new Buffer(string, 'hex'));\n\n // Calculate lengths\n var array = new _Buffer(12);\n var n = 0;\n var i = 0;\n\n while (i < 24) {\n array[n++] = decodeLookup[string.charCodeAt(i++)] << 4 | decodeLookup[string.charCodeAt(i++)]\n }\n\n return new ObjectID(array);\n};\n\n/**\n* Checks if a value is a valid bson ObjectId\n*\n* @method\n* @return {boolean} return true if the value is a valid bson ObjectId, return false otherwise.\n*/\nObjectID.isValid = function isValid(id) {\n if(id == null) return false;\n\n if(typeof id == 'number') {\n return true;\n }\n\n if(typeof id == 'string') {\n return id.length == 12 || (id.length == 24 && checkForHexRegExp.test(id));\n }\n\n if(id instanceof ObjectID) {\n return true;\n }\n\n if(id instanceof _Buffer) {\n return true;\n }\n\n // Duck-Typing detection of ObjectId like objects\n if(id.toHexString) {\n return id.id.length == 12 || (id.id.length == 24 && checkForHexRegExp.test(id.id));\n }\n\n return false;\n};\n\n/**\n* @ignore\n*/\nObject.defineProperty(ObjectID.prototype, \"generationTime\", {\n enumerable: true\n , get: function () {\n return this.id[3] | this.id[2] << 8 | this.id[1] << 16 | this.id[0] << 24;\n }\n , set: function (value) {\n // Encode time into first 4 bytes\n this.id[3] = value & 0xff;\n this.id[2] = (value >> 8) & 0xff;\n this.id[1] = (value >> 16) & 0xff;\n this.id[0] = (value >> 24) & 0xff;\n }\n});\n\n/**\n * Expose.\n */\nmodule.exports = ObjectID;\nmodule.exports.ObjectID = ObjectID;\nmodule.exports.ObjectId = ObjectID;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/objectid.js","/**\n * A class representation of the BSON RegExp type.\n *\n * @class\n * @return {BSONRegExp} A MinKey instance\n */\nfunction BSONRegExp(pattern, options) {\n if(!(this instanceof BSONRegExp)) return new BSONRegExp();\n\n // Execute\n this._bsontype = 'BSONRegExp';\n this.pattern = pattern || '';\n this.options = options || '';\n\n // Validate options\n for(var i = 0; i < this.options.length; i++) {\n if(!(this.options[i] == 'i'\n || this.options[i] == 'm'\n || this.options[i] == 'x'\n || this.options[i] == 'l'\n || this.options[i] == 's'\n || this.options[i] == 'u'\n )) {\n throw new Error('the regular expression options [' + this.options[i] + \"] is not supported\");\n }\n }\n}\n\nmodule.exports = BSONRegExp;\nmodule.exports.BSONRegExp = BSONRegExp;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/regexp.js","/**\n * A class representation of the BSON Symbol type.\n *\n * @class\n * @deprecated\n * @param {string} value the string representing the symbol.\n * @return {Symbol}\n */\nfunction Symbol(value) {\n if(!(this instanceof Symbol)) return new Symbol(value);\n this._bsontype = 'Symbol';\n this.value = value;\n}\n\n/**\n * Access the wrapped string value.\n *\n * @method\n * @return {String} returns the wrapped string.\n */\nSymbol.prototype.valueOf = function() {\n return this.value;\n};\n\n/**\n * @ignore\n */\nSymbol.prototype.toString = function() {\n return this.value;\n}\n\n/**\n * @ignore\n */\nSymbol.prototype.inspect = function() {\n return this.value;\n}\n\n/**\n * @ignore\n */\nSymbol.prototype.toJSON = function() {\n return this.value;\n}\n\nmodule.exports = Symbol;\nmodule.exports.Symbol = Symbol;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/symbol.js","// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n// Copyright 2009 Google Inc. All Rights Reserved\n\n/**\n * This type is for INTERNAL use in MongoDB only and should not be used in applications.\n * The appropriate corresponding type is the JavaScript Date type.\n * \n * Defines a Timestamp class for representing a 64-bit two's-complement\n * integer value, which faithfully simulates the behavior of a Java \"Timestamp\". This\n * implementation is derived from TimestampLib in GWT.\n *\n * Constructs a 64-bit two's-complement integer, given its low and high 32-bit\n * values as *signed* integers. See the from* functions below for more\n * convenient ways of constructing Timestamps.\n *\n * The internal representation of a Timestamp is the two given signed, 32-bit values.\n * We use 32-bit pieces because these are the size of integers on which\n * Javascript performs bit-operations. For operations like addition and\n * multiplication, we split each number into 16-bit pieces, which can easily be\n * multiplied within Javascript's floating-point representation without overflow\n * or change in sign.\n *\n * In the algorithms below, we frequently reduce the negative case to the\n * positive case by negating the input(s) and then post-processing the result.\n * Note that we must ALWAYS check specially whether those values are MIN_VALUE\n * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\n * a positive number, it overflows back into a negative). Not handling this\n * case would often result in infinite recursion.\n *\n * @class\n * @param {number} low the low (signed) 32 bits of the Timestamp.\n * @param {number} high the high (signed) 32 bits of the Timestamp.\n */\nfunction Timestamp(low, high) {\n if(!(this instanceof Timestamp)) return new Timestamp(low, high);\n this._bsontype = 'Timestamp';\n /**\n * @type {number}\n * @ignore\n */\n this.low_ = low | 0; // force into 32 signed bits.\n\n /**\n * @type {number}\n * @ignore\n */\n this.high_ = high | 0; // force into 32 signed bits.\n};\n\n/**\n * Return the int value.\n *\n * @return {number} the value, assuming it is a 32-bit integer.\n */\nTimestamp.prototype.toInt = function() {\n return this.low_;\n};\n\n/**\n * Return the Number value.\n *\n * @method\n * @return {number} the closest floating-point representation to this value.\n */\nTimestamp.prototype.toNumber = function() {\n return this.high_ * Timestamp.TWO_PWR_32_DBL_ +\n this.getLowBitsUnsigned();\n};\n\n/**\n * Return the JSON value.\n *\n * @method\n * @return {string} the JSON representation.\n */\nTimestamp.prototype.toJSON = function() {\n return this.toString();\n}\n\n/**\n * Return the String value.\n *\n * @method\n * @param {number} [opt_radix] the radix in which the text should be written.\n * @return {string} the textual representation of this value.\n */\nTimestamp.prototype.toString = function(opt_radix) {\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (this.isZero()) {\n return '0';\n }\n\n if (this.isNegative()) {\n if (this.equals(Timestamp.MIN_VALUE)) {\n // We need to change the Timestamp value before it can be negated, so we remove\n // the bottom-most digit in this base and then recurse to do the rest.\n var radixTimestamp = Timestamp.fromNumber(radix);\n var div = this.div(radixTimestamp);\n var rem = div.multiply(radixTimestamp).subtract(this);\n return div.toString(radix) + rem.toInt().toString(radix);\n } else {\n return '-' + this.negate().toString(radix);\n }\n }\n\n // Do several (6) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Timestamp.fromNumber(Math.pow(radix, 6));\n\n var rem = this;\n var result = '';\n while (true) {\n var remDiv = rem.div(radixToPower);\n var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt();\n var digits = intval.toString(radix);\n\n rem = remDiv;\n if (rem.isZero()) {\n return digits + result;\n } else {\n while (digits.length < 6) {\n digits = '0' + digits;\n }\n result = '' + digits + result;\n }\n }\n};\n\n/**\n * Return the high 32-bits value.\n *\n * @method\n * @return {number} the high 32-bits as a signed value.\n */\nTimestamp.prototype.getHighBits = function() {\n return this.high_;\n};\n\n/**\n * Return the low 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as a signed value.\n */\nTimestamp.prototype.getLowBits = function() {\n return this.low_;\n};\n\n/**\n * Return the low unsigned 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as an unsigned value.\n */\nTimestamp.prototype.getLowBitsUnsigned = function() {\n return (this.low_ >= 0) ?\n this.low_ : Timestamp.TWO_PWR_32_DBL_ + this.low_;\n};\n\n/**\n * Returns the number of bits needed to represent the absolute value of this Timestamp.\n *\n * @method\n * @return {number} Returns the number of bits needed to represent the absolute value of this Timestamp.\n */\nTimestamp.prototype.getNumBitsAbs = function() {\n if (this.isNegative()) {\n if (this.equals(Timestamp.MIN_VALUE)) {\n return 64;\n } else {\n return this.negate().getNumBitsAbs();\n }\n } else {\n var val = this.high_ != 0 ? this.high_ : this.low_;\n for (var bit = 31; bit > 0; bit--) {\n if ((val & (1 << bit)) != 0) {\n break;\n }\n }\n return this.high_ != 0 ? bit + 33 : bit + 1;\n }\n};\n\n/**\n * Return whether this value is zero.\n *\n * @method\n * @return {boolean} whether this value is zero.\n */\nTimestamp.prototype.isZero = function() {\n return this.high_ == 0 && this.low_ == 0;\n};\n\n/**\n * Return whether this value is negative.\n *\n * @method\n * @return {boolean} whether this value is negative.\n */\nTimestamp.prototype.isNegative = function() {\n return this.high_ < 0;\n};\n\n/**\n * Return whether this value is odd.\n *\n * @method\n * @return {boolean} whether this value is odd.\n */\nTimestamp.prototype.isOdd = function() {\n return (this.low_ & 1) == 1;\n};\n\n/**\n * Return whether this Timestamp equals the other\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp equals the other\n */\nTimestamp.prototype.equals = function(other) {\n return (this.high_ == other.high_) && (this.low_ == other.low_);\n};\n\n/**\n * Return whether this Timestamp does not equal the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp does not equal the other.\n */\nTimestamp.prototype.notEquals = function(other) {\n return (this.high_ != other.high_) || (this.low_ != other.low_);\n};\n\n/**\n * Return whether this Timestamp is less than the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is less than the other.\n */\nTimestamp.prototype.lessThan = function(other) {\n return this.compare(other) < 0;\n};\n\n/**\n * Return whether this Timestamp is less than or equal to the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is less than or equal to the other.\n */\nTimestamp.prototype.lessThanOrEqual = function(other) {\n return this.compare(other) <= 0;\n};\n\n/**\n * Return whether this Timestamp is greater than the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is greater than the other.\n */\nTimestamp.prototype.greaterThan = function(other) {\n return this.compare(other) > 0;\n};\n\n/**\n * Return whether this Timestamp is greater than or equal to the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is greater than or equal to the other.\n */\nTimestamp.prototype.greaterThanOrEqual = function(other) {\n return this.compare(other) >= 0;\n};\n\n/**\n * Compares this Timestamp with the given one.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater.\n */\nTimestamp.prototype.compare = function(other) {\n if (this.equals(other)) {\n return 0;\n }\n\n var thisNeg = this.isNegative();\n var otherNeg = other.isNegative();\n if (thisNeg && !otherNeg) {\n return -1;\n }\n if (!thisNeg && otherNeg) {\n return 1;\n }\n\n // at this point, the signs are the same, so subtraction will not overflow\n if (this.subtract(other).isNegative()) {\n return -1;\n } else {\n return 1;\n }\n};\n\n/**\n * The negation of this value.\n *\n * @method\n * @return {Timestamp} the negation of this value.\n */\nTimestamp.prototype.negate = function() {\n if (this.equals(Timestamp.MIN_VALUE)) {\n return Timestamp.MIN_VALUE;\n } else {\n return this.not().add(Timestamp.ONE);\n }\n};\n\n/**\n * Returns the sum of this and the given Timestamp.\n *\n * @method\n * @param {Timestamp} other Timestamp to add to this one.\n * @return {Timestamp} the sum of this and the given Timestamp.\n */\nTimestamp.prototype.add = function(other) {\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 + b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 + b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 + b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 + b48;\n c48 &= 0xFFFF;\n return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32);\n};\n\n/**\n * Returns the difference of this and the given Timestamp.\n *\n * @method\n * @param {Timestamp} other Timestamp to subtract from this.\n * @return {Timestamp} the difference of this and the given Timestamp.\n */\nTimestamp.prototype.subtract = function(other) {\n return this.add(other.negate());\n};\n\n/**\n * Returns the product of this and the given Timestamp.\n *\n * @method\n * @param {Timestamp} other Timestamp to multiply with this.\n * @return {Timestamp} the product of this and the other.\n */\nTimestamp.prototype.multiply = function(other) {\n if (this.isZero()) {\n return Timestamp.ZERO;\n } else if (other.isZero()) {\n return Timestamp.ZERO;\n }\n\n if (this.equals(Timestamp.MIN_VALUE)) {\n return other.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO;\n } else if (other.equals(Timestamp.MIN_VALUE)) {\n return this.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().multiply(other.negate());\n } else {\n return this.negate().multiply(other).negate();\n }\n } else if (other.isNegative()) {\n return this.multiply(other.negate()).negate();\n }\n\n // If both Timestamps are small, use float multiplication\n if (this.lessThan(Timestamp.TWO_PWR_24_) &&\n other.lessThan(Timestamp.TWO_PWR_24_)) {\n return Timestamp.fromNumber(this.toNumber() * other.toNumber());\n }\n\n // Divide each Timestamp into 4 chunks of 16 bits, and then add up 4x4 products.\n // We can skip products that would overflow.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 * b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 * b00;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c16 += a00 * b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 * b00;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a16 * b16;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a00 * b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\n c48 &= 0xFFFF;\n return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32);\n};\n\n/**\n * Returns this Timestamp divided by the given one.\n *\n * @method\n * @param {Timestamp} other Timestamp by which to divide.\n * @return {Timestamp} this Timestamp divided by the given one.\n */\nTimestamp.prototype.div = function(other) {\n if (other.isZero()) {\n throw Error('division by zero');\n } else if (this.isZero()) {\n return Timestamp.ZERO;\n }\n\n if (this.equals(Timestamp.MIN_VALUE)) {\n if (other.equals(Timestamp.ONE) ||\n other.equals(Timestamp.NEG_ONE)) {\n return Timestamp.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\n } else if (other.equals(Timestamp.MIN_VALUE)) {\n return Timestamp.ONE;\n } else {\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\n var halfThis = this.shiftRight(1);\n var approx = halfThis.div(other).shiftLeft(1);\n if (approx.equals(Timestamp.ZERO)) {\n return other.isNegative() ? Timestamp.ONE : Timestamp.NEG_ONE;\n } else {\n var rem = this.subtract(other.multiply(approx));\n var result = approx.add(rem.div(other));\n return result;\n }\n }\n } else if (other.equals(Timestamp.MIN_VALUE)) {\n return Timestamp.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().div(other.negate());\n } else {\n return this.negate().div(other).negate();\n }\n } else if (other.isNegative()) {\n return this.div(other.negate()).negate();\n }\n\n // Repeat the following until the remainder is less than other: find a\n // floating-point that approximates remainder / other *from below*, add this\n // into the result, and subtract it from the remainder. It is critical that\n // the approximate value is less than or equal to the real value so that the\n // remainder never becomes negative.\n var res = Timestamp.ZERO;\n var rem = this;\n while (rem.greaterThanOrEqual(other)) {\n // Approximate the result of division. This may be a little greater or\n // smaller than the actual value.\n var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber()));\n\n // We will tweak the approximate result by changing it in the 48-th digit or\n // the smallest non-fractional digit, whichever is larger.\n var log2 = Math.ceil(Math.log(approx) / Math.LN2);\n var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48);\n\n // Decrease the approximation until it is smaller than the remainder. Note\n // that if it is too large, the product overflows and is negative.\n var approxRes = Timestamp.fromNumber(approx);\n var approxRem = approxRes.multiply(other);\n while (approxRem.isNegative() || approxRem.greaterThan(rem)) {\n approx -= delta;\n approxRes = Timestamp.fromNumber(approx);\n approxRem = approxRes.multiply(other);\n }\n\n // We know the answer can't be zero... and actually, zero would cause\n // infinite recursion since we would make no progress.\n if (approxRes.isZero()) {\n approxRes = Timestamp.ONE;\n }\n\n res = res.add(approxRes);\n rem = rem.subtract(approxRem);\n }\n return res;\n};\n\n/**\n * Returns this Timestamp modulo the given one.\n *\n * @method\n * @param {Timestamp} other Timestamp by which to mod.\n * @return {Timestamp} this Timestamp modulo the given one.\n */\nTimestamp.prototype.modulo = function(other) {\n return this.subtract(this.div(other).multiply(other));\n};\n\n/**\n * The bitwise-NOT of this value.\n *\n * @method\n * @return {Timestamp} the bitwise-NOT of this value.\n */\nTimestamp.prototype.not = function() {\n return Timestamp.fromBits(~this.low_, ~this.high_);\n};\n\n/**\n * Returns the bitwise-AND of this Timestamp and the given one.\n *\n * @method\n * @param {Timestamp} other the Timestamp with which to AND.\n * @return {Timestamp} the bitwise-AND of this and the other.\n */\nTimestamp.prototype.and = function(other) {\n return Timestamp.fromBits(this.low_ & other.low_, this.high_ & other.high_);\n};\n\n/**\n * Returns the bitwise-OR of this Timestamp and the given one.\n *\n * @method\n * @param {Timestamp} other the Timestamp with which to OR.\n * @return {Timestamp} the bitwise-OR of this and the other.\n */\nTimestamp.prototype.or = function(other) {\n return Timestamp.fromBits(this.low_ | other.low_, this.high_ | other.high_);\n};\n\n/**\n * Returns the bitwise-XOR of this Timestamp and the given one.\n *\n * @method\n * @param {Timestamp} other the Timestamp with which to XOR.\n * @return {Timestamp} the bitwise-XOR of this and the other.\n */\nTimestamp.prototype.xor = function(other) {\n return Timestamp.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_);\n};\n\n/**\n * Returns this Timestamp with bits shifted to the left by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Timestamp} this shifted to the left by the given amount.\n */\nTimestamp.prototype.shiftLeft = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var low = this.low_;\n if (numBits < 32) {\n var high = this.high_;\n return Timestamp.fromBits(\n low << numBits,\n (high << numBits) | (low >>> (32 - numBits)));\n } else {\n return Timestamp.fromBits(0, low << (numBits - 32));\n }\n }\n};\n\n/**\n * Returns this Timestamp with bits shifted to the right by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Timestamp} this shifted to the right by the given amount.\n */\nTimestamp.prototype.shiftRight = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Timestamp.fromBits(\n (low >>> numBits) | (high << (32 - numBits)),\n high >> numBits);\n } else {\n return Timestamp.fromBits(\n high >> (numBits - 32),\n high >= 0 ? 0 : -1);\n }\n }\n};\n\n/**\n * Returns this Timestamp with bits shifted to the right by the given amount, with the new top bits matching the current sign bit.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Timestamp} this shifted to the right by the given amount, with zeros placed into the new leading bits.\n */\nTimestamp.prototype.shiftRightUnsigned = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Timestamp.fromBits(\n (low >>> numBits) | (high << (32 - numBits)),\n high >>> numBits);\n } else if (numBits == 32) {\n return Timestamp.fromBits(high, 0);\n } else {\n return Timestamp.fromBits(high >>> (numBits - 32), 0);\n }\n }\n};\n\n/**\n * Returns a Timestamp representing the given (32-bit) integer value.\n *\n * @method\n * @param {number} value the 32-bit integer in question.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromInt = function(value) {\n if (-128 <= value && value < 128) {\n var cachedObj = Timestamp.INT_CACHE_[value];\n if (cachedObj) {\n return cachedObj;\n }\n }\n\n var obj = new Timestamp(value | 0, value < 0 ? -1 : 0);\n if (-128 <= value && value < 128) {\n Timestamp.INT_CACHE_[value] = obj;\n }\n return obj;\n};\n\n/**\n * Returns a Timestamp representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n *\n * @method\n * @param {number} value the number in question.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromNumber = function(value) {\n if (isNaN(value) || !isFinite(value)) {\n return Timestamp.ZERO;\n } else if (value <= -Timestamp.TWO_PWR_63_DBL_) {\n return Timestamp.MIN_VALUE;\n } else if (value + 1 >= Timestamp.TWO_PWR_63_DBL_) {\n return Timestamp.MAX_VALUE;\n } else if (value < 0) {\n return Timestamp.fromNumber(-value).negate();\n } else {\n return new Timestamp(\n (value % Timestamp.TWO_PWR_32_DBL_) | 0,\n (value / Timestamp.TWO_PWR_32_DBL_) | 0);\n }\n};\n\n/**\n * Returns a Timestamp representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits.\n *\n * @method\n * @param {number} lowBits the low 32-bits.\n * @param {number} highBits the high 32-bits.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromBits = function(lowBits, highBits) {\n return new Timestamp(lowBits, highBits);\n};\n\n/**\n * Returns a Timestamp representation of the given string, written using the given radix.\n *\n * @method\n * @param {string} str the textual representation of the Timestamp.\n * @param {number} opt_radix the radix in which the text is written.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromString = function(str, opt_radix) {\n if (str.length == 0) {\n throw Error('number format error: empty string');\n }\n\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (str.charAt(0) == '-') {\n return Timestamp.fromString(str.substring(1), radix).negate();\n } else if (str.indexOf('-') >= 0) {\n throw Error('number format error: interior \"-\" character: ' + str);\n }\n\n // Do several (8) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Timestamp.fromNumber(Math.pow(radix, 8));\n\n var result = Timestamp.ZERO;\n for (var i = 0; i < str.length; i += 8) {\n var size = Math.min(8, str.length - i);\n var value = parseInt(str.substring(i, i + size), radix);\n if (size < 8) {\n var power = Timestamp.fromNumber(Math.pow(radix, size));\n result = result.multiply(power).add(Timestamp.fromNumber(value));\n } else {\n result = result.multiply(radixToPower);\n result = result.add(Timestamp.fromNumber(value));\n }\n }\n return result;\n};\n\n// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the\n// from* methods on which they depend.\n\n\n/**\n * A cache of the Timestamp representations of small integer values.\n * @type {Object}\n * @ignore\n */\nTimestamp.INT_CACHE_ = {};\n\n// NOTE: the compiler should inline these constant values below and then remove\n// these variables, so there should be no runtime penalty for these.\n\n/**\n * Number used repeated below in calculations. This must appear before the\n * first call to any from* function below.\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_16_DBL_ = 1 << 16;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_24_DBL_ = 1 << 24;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_32_DBL_ = Timestamp.TWO_PWR_16_DBL_ * Timestamp.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_31_DBL_ = Timestamp.TWO_PWR_32_DBL_ / 2;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_48_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_64_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_32_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_63_DBL_ = Timestamp.TWO_PWR_64_DBL_ / 2;\n\n/** @type {Timestamp} */\nTimestamp.ZERO = Timestamp.fromInt(0);\n\n/** @type {Timestamp} */\nTimestamp.ONE = Timestamp.fromInt(1);\n\n/** @type {Timestamp} */\nTimestamp.NEG_ONE = Timestamp.fromInt(-1);\n\n/** @type {Timestamp} */\nTimestamp.MAX_VALUE =\n Timestamp.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0);\n\n/** @type {Timestamp} */\nTimestamp.MIN_VALUE = Timestamp.fromBits(0, 0x80000000 | 0);\n\n/**\n * @type {Timestamp}\n * @ignore\n */\nTimestamp.TWO_PWR_24_ = Timestamp.fromInt(1 << 24);\n\n/**\n * Expose.\n */\nmodule.exports = Timestamp;\nmodule.exports.Timestamp = Timestamp;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/timestamp.js","import { StitchError } from './errors';\n\nexport const JSONTYPE = 'application/json';\nexport const APP_CLIENT_TYPE = 'app';\nexport const ADMIN_CLIENT_TYPE = 'admin';\nexport const DEFAULT_STITCH_SERVER_URL = 'https://stitch.mongodb.com';\n\n// VERSION is substituted with the package.json version number at build time\nlet version = 'unknown';\nif (typeof VERSION !== 'undefined') {\n version = VERSION;\n}\nexport const SDK_VERSION = version;\n\nexport const checkStatus = (response) => {\n if (response.status >= 200 && response.status < 300) {\n return response;\n }\n\n if (response.headers.get('Content-Type') === JSONTYPE) {\n return response.json()\n .then(json => {\n const error = new StitchError(json.error, json.error_code);\n error.response = response;\n error.json = json;\n return Promise.reject(error);\n });\n }\n\n const error = new Error(response.statusText);\n error.response = response;\n return Promise.reject(error);\n};\n\nexport const makeFetchArgs = (method, body) => {\n const init = {\n method: method,\n headers: { 'Accept': JSONTYPE, 'Content-Type': JSONTYPE }\n };\n\n if (body) {\n init.body = body;\n }\n\n init.cors = true;\n return init;\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/common.js","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 17\n// module chunks = 0","var Int32 = function(value) {\n if(!(this instanceof Int32)) return new Int32(value);\n\n this._bsontype = 'Int32';\n this.value = value;\n}\n\n/**\n * Access the number value.\n *\n * @method\n * @return {number} returns the wrapped int32 number.\n */\nInt32.prototype.valueOf = function() {\n return this.value;\n};\n\n/**\n * @ignore\n */\nInt32.prototype.toJSON = function() {\n return this.value;\n}\n\nmodule.exports = Int32;\nmodule.exports.Int32 = Int32;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/int_32.js","/**\n * Creates a new StitchError\n *\n * @class\n * @augments Error\n * @param {String} message The error message.\n * @param {Object} code The error code.\n * @return {StitchError} A StitchError instance.\n */\nclass StitchError extends Error {\n constructor(message, code) {\n super(message);\n this.name = 'StitchError';\n this.message = message;\n if (code !== undefined) {\n this.code = code;\n }\n\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(this, this.constructor);\n } else {\n this.stack = (new Error(message)).stack;\n }\n }\n}\n\nconst ErrAuthProviderNotFound = 'AuthProviderNotFound';\nconst ErrInvalidSession = 'InvalidSession';\nconst ErrUnauthorized = 'Unauthorized';\n\n\nexport {\n StitchError,\n ErrAuthProviderNotFound,\n ErrInvalidSession,\n ErrUnauthorized\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/errors.js","/* global window, fetch */\n/* eslint no-labels: ['error', { 'allowLoop': true }] */\nimport 'fetch-everywhere';\nimport { AuthFactory } from './auth';\nimport { PROVIDER_TYPE_ANON } from './auth/providers';\nimport { APP_CLIENT_CODEC } from './auth/common';\nimport ServiceRegistry from './services';\nimport * as common from './common';\nimport ExtJSON from 'mongodb-extjson';\nimport queryString from 'query-string';\nimport {\n StitchError,\n ErrInvalidSession,\n ErrUnauthorized\n} from './errors';\n\nconst v1 = 1;\nconst v2 = 2;\nconst v3 = 3;\nconst API_TYPE_PUBLIC = 'public';\nconst API_TYPE_PRIVATE = 'private';\nconst API_TYPE_CLIENT = 'client';\nconst API_TYPE_APP = 'app';\n\n/**\n * Factory class to create a new StitchClient asynchronously.\n */\nexport class StitchClientFactory {\n constructor() {\n throw new StitchError('StitchClient can only be made from the StitchClientFactory.create function');\n }\n\n static create(clientAppID, options = {}) {\n return newStitchClient(StitchClient.prototype, clientAppID, options);\n }\n}\n\nexport function newStitchClient(prototype, clientAppID, options = {}) {\n let stitchClient = Object.create(prototype);\n let baseUrl = common.DEFAULT_STITCH_SERVER_URL;\n if (options.baseUrl) {\n baseUrl = options.baseUrl;\n }\n\n stitchClient.clientAppID = clientAppID;\n\n stitchClient.authUrl = (\n clientAppID ?\n `${baseUrl}/api/client/v2.0/app/${clientAppID}/auth` :\n `${baseUrl}/api/admin/v3.0/auth`\n );\n\n stitchClient.rootURLsByAPIVersion = {\n [v1]: {\n [API_TYPE_PUBLIC]: `${baseUrl}/api/public/v1.0`,\n [API_TYPE_CLIENT]: `${baseUrl}/api/client/v1.0`,\n [API_TYPE_PRIVATE]: `${baseUrl}/api/private/v1.0`,\n [API_TYPE_APP]: (clientAppID ?\n `${baseUrl}/api/client/v1.0/app/${clientAppID}` :\n `${baseUrl}/api/public/v1.0`)\n },\n [v2]: {\n [API_TYPE_PUBLIC]: `${baseUrl}/api/public/v2.0`,\n [API_TYPE_CLIENT]: `${baseUrl}/api/client/v2.0`,\n [API_TYPE_PRIVATE]: `${baseUrl}/api/private/v2.0`,\n [API_TYPE_APP]: (clientAppID ?\n `${baseUrl}/api/client/v2.0/app/${clientAppID}` :\n `${baseUrl}/api/public/v2.0`)\n },\n [v3]: {\n [API_TYPE_PUBLIC]: `${baseUrl}/api/public/v3.0`,\n [API_TYPE_CLIENT]: `${baseUrl}/api/client/v3.0`,\n [API_TYPE_APP]: (clientAppID ?\n `${baseUrl}/api/client/v3.0/app/${clientAppID}` :\n `${baseUrl}/api/admin/v3.0`)\n }\n };\n\n const authOptions = {\n codec: APP_CLIENT_CODEC,\n storage: options.storage\n };\n\n if (options.storageType) {\n authOptions.storageType = options.storageType;\n }\n if (options.platform) {\n authOptions.platform = options.platform;\n }\n if (options.authCodec) {\n authOptions.codec = options.authCodec;\n }\n\n const authPromise = AuthFactory.create(stitchClient, stitchClient.authUrl, authOptions);\n return authPromise.then(auth => {\n stitchClient.auth = auth;\n return Promise.all([\n stitchClient.auth.handleRedirect(),\n stitchClient.auth.handleCookie()\n ]);\n }).then(() => stitchClient);\n}\n/**\n * Prototype for StitchClient class.\n * This is the internal implementation for StitchClient and should not\n * be exposed.\n *\n * @class\n */\nexport class StitchClient {\n constructor() {\n throw new StitchError('StitchClient can only be made from the StitchClientFactory.create function');\n }\n\n get type() {\n return common.APP_CLIENT_TYPE;\n }\n\n /**\n * Login to stitch instance, optionally providing a username and password. In\n * the event that these are omitted, anonymous authentication is used.\n *\n * @param {String} [email] the email address used for login\n * @param {String} [password] the password for the provided email address\n * @param {Object} [options] additional authentication options\n * @returns {Promise}\n */\n login(email, password, options = {}) {\n if (email === undefined || password === undefined) {\n return this.authenticate(PROVIDER_TYPE_ANON, options);\n }\n\n return this.authenticate('userpass', Object.assign({ username: email, password }, options));\n }\n\n /**\n * Send a request to the server indicating the provided email would like\n * to sign up for an account. This will trigger a confirmation email containing\n * a token which must be used with the `emailConfirm` method of the `userpass`\n * auth provider in order to complete registration. The user will not be able\n * to log in until that flow has been completed.\n *\n * @param {String} email the email used to sign up for the app\n * @param {String} password the password used to sign up for the app\n * @param {Object} [options] additional authentication options\n * @returns {Promise}\n */\n register(email, password, options = {}) {\n return this.auth.provider('userpass').register(email, password, options);\n }\n\n /**\n * Submits an authentication request to the specified provider providing any\n * included options (read: user data). If auth data already exists and the\n * existing auth data has an access token, then these credentials are returned.\n *\n * @param {String} providerType the provider used for authentication (e.g. 'userpass', 'facebook', 'google')\n * @param {Object} [options] additional authentication options\n * @returns {Promise} which resolves to a String value: the authed userId\n */\n authenticate(providerType, options = {}) {\n // reuse existing auth if present\n const authenticateFn = () =>\n this.auth.provider(providerType).authenticate(options).then(() => this.authedId());\n\n if (this.isAuthenticated()) {\n if (providerType === PROVIDER_TYPE_ANON && this.auth.getLoggedInProviderType() === PROVIDER_TYPE_ANON) {\n return Promise.resolve(this.auth.authedId); // is authenticated, skip log in\n }\n\n return this.logout().then(() => authenticateFn()); // will not be authenticated, continue log in\n }\n\n // is not authenticated, continue log in\n return authenticateFn();\n }\n\n /**\n * Ends the session for the current user.\n *\n * @returns {Promise}\n */\n logout() {\n return this._do(\n '/auth/session',\n 'DELETE',\n {\n refreshOnFailure: false,\n useRefreshToken: true,\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT]\n }\n ).then(() => this.auth.clear(), () => this.auth.clear());\n }\n\n /**\n * @return {*} Returns any error from the Stitch authentication system.\n */\n authError() {\n return this.auth.error();\n }\n\n /**\n * Returns profile information for the currently logged in user\n *\n * @returns {Promise}\n */\n userProfile() {\n return this._do(\n '/auth/profile',\n 'GET',\n {rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT]},\n ).then(response => response.json());\n }\n\n /**\n * @return {Boolean} whether or not the current client is authenticated\n */\n isAuthenticated() {\n return !!this.authedId();\n }\n\n /**\n * @return {String} Returns a string of the currently authed user's ID.\n */\n authedId() {\n return this.auth.authedId;\n }\n\n /**\n * Factory method for accessing Stitch services.\n *\n * @method\n * @param {String} type The service type [mongodb, {String}]\n * @param {String} name The service name.\n * @return {Object} returns a named service.\n */\n service(type, name) {\n if (this.constructor !== StitchClient) {\n throw new StitchError('`service` is a factory method, do not use `new`');\n }\n\n if (!ServiceRegistry.hasOwnProperty(type)) {\n throw new StitchError('Invalid service type specified: ' + type);\n }\n\n const ServiceType = ServiceRegistry[type];\n return new ServiceType(this, name);\n }\n\n /**\n * Executes a function.\n *\n * @param {String} name The name of the function.\n * @param {...*} args Arguments to pass to the function.\n */\n executeFunction(name, ...args) {\n return this._doFunctionCall({\n name,\n arguments: args\n });\n }\n\n /**\n * Executes a service function.\n *\n * @param {String} service The name of the service.\n * @param {String} action The name of the service action.\n * @param {...*} args Arguments to pass to the service action.\n */\n executeServiceFunction(service, action, ...args) {\n return this._doFunctionCall({\n service,\n name: action,\n arguments: args\n });\n }\n\n _doFunctionCall(request) {\n let responseDecoder = (d) => ExtJSON.parse(d, { strict: false });\n let responseEncoder = (d) => ExtJSON.stringify(d);\n\n return this._do('/functions/call', 'POST', { body: responseEncoder(request) })\n .then(response => response.text())\n .then(body => responseDecoder(body));\n }\n\n /**\n * Returns an access token for the user\n *\n * @returns {Promise}\n */\n doSessionPost() {\n return this._do(\n '/auth/session',\n 'POST',\n {\n refreshOnFailure: false,\n useRefreshToken: true,\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT]\n }\n )\n .then(response => response.json());\n }\n\n /**\n * Returns an array of api keys\n *\n * @returns {Promise}\n */\n getApiKeys() {\n return this._do(\n '/auth/api_keys',\n 'GET',\n {\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT],\n useRefreshToken: true\n },\n )\n .then((response) => response.json());\n }\n\n /**\n * Creates a user api key\n *\n * @param {String} userApiKeyName the user defined name of the userApiKey\n * @returns {Promise}\n */\n createApiKey(userApiKeyName) {\n return this._do(\n '/auth/api_keys',\n 'POST',\n { rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT],\n useRefreshToken: true,\n body: JSON.stringify({'name': userApiKeyName})\n },\n )\n .then((response) => response.json());\n }\n\n /**\n * Returns a user api key\n *\n * @param {String} keyID the ID of the key\n * @returns {Promise}\n */\n getApiKeyByID(keyID) {\n return this._do(\n `/auth/api_keys/${keyID}`,\n 'GET',\n {\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT],\n useRefreshToken: true\n },\n )\n .then((response) => response.json());\n }\n\n /**\n * Deletes a user api key\n *\n * @param {String} keyID the ID of the key\n * @returns {Promise}\n */\n deleteApiKeyByID(keyID) {\n return this._do(\n `/auth/api_keys/${keyID}`,\n 'DELETE',\n {\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT],\n useRefreshToken: true\n },\n );\n }\n\n /**\n * Enable a user api key\n *\n * @param {String} keyID the ID of the key\n * @returns {Promise}\n */\n enableApiKeyByID(keyID) {\n return this._do(\n `/auth/api_keys/${keyID}/enable`,\n 'PUT',\n {\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT],\n useRefreshToken: true\n },\n );\n }\n\n /**\n * Disable a user api key\n *\n * @param {String} keyID the ID of the key\n * @returns {Promise}\n */\n disableApiKeyByID(keyID) {\n return this._do(\n `/auth/api_keys/${keyID}/disable`,\n 'PUT',\n {\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT],\n useRefreshToken: true\n },\n );\n }\n\n _fetch(url, fetchArgs, resource, method, options) {\n return fetch(url, fetchArgs)\n .then(response => {\n // Okay: passthrough\n if (response.status >= 200 && response.status < 300) {\n return Promise.resolve(response);\n }\n\n if (response.headers.get('Content-Type') === common.JSONTYPE) {\n return response.json()\n .then(json => {\n // Only want to try refreshing token when there's an invalid session\n if ('error_code' in json && json.error_code === ErrInvalidSession) {\n if (!options.refreshOnFailure) {\n return this.auth.clear().then(() => {\n const error = new StitchError(json.error, json.error_code);\n error.response = response;\n error.json = json;\n throw error;\n });\n }\n\n return this.auth.refreshToken()\n .then(() => {\n options.refreshOnFailure = false;\n return this._do(resource, method, options);\n });\n }\n\n const error = new StitchError(json.error, json.error_code);\n error.response = response;\n error.json = json;\n return Promise.reject(error);\n });\n }\n\n const error = new Error(response.statusText);\n error.response = response;\n return Promise.reject(error);\n });\n }\n\n _fetchArgs(resource, method, options) {\n const appURL = this.rootURLsByAPIVersion[options.apiVersion][options.apiType];\n let url = `${appURL}${resource}`;\n if (options.rootURL) {\n url = `${options.rootURL}${resource}`;\n }\n let fetchArgs = common.makeFetchArgs(method, options.body);\n\n if (!!options.headers) {\n Object.assign(fetchArgs.headers, options.headers);\n }\n\n if (options.queryParams) {\n url = `${url}?${queryString.stringify(options.queryParams)}`;\n }\n\n return { url, fetchArgs };\n }\n\n _do(resource, method, options) {\n options = Object.assign({}, {\n refreshOnFailure: true,\n useRefreshToken: false,\n apiVersion: v2,\n apiType: API_TYPE_APP,\n rootURL: undefined\n }, options);\n\n let { url, fetchArgs } = this._fetchArgs(resource, method, options);\n if (options.noAuth) {\n return this._fetch(url, fetchArgs, resource, method, options);\n }\n\n if (!this.isAuthenticated()) {\n return Promise.reject(new StitchError('Must auth first', ErrUnauthorized));\n }\n const token =\n options.useRefreshToken ? this.auth.getRefreshToken() : this.auth.getAccessToken();\n\n // If access token is expired, proactively get a new one\n if (!options.useRefreshToken) {\n if (this.auth.isAccessTokenExpired()) {\n return this.auth.refreshToken().then(() => {\n options.refreshOnFailure = false;\n return this._do(resource, method, options);\n });\n }\n\n fetchArgs.headers.Authorization = `Bearer ${token}`;\n return this._fetch(url, fetchArgs, resource, method, options);\n }\n\n fetchArgs.headers.Authorization = `Bearer ${token}`;\n return this._fetch(url, fetchArgs, resource, method, options);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/client.js","var ExtJSON = require('./lib/ext_json');\n\nmodule.exports = ExtJSON;\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/index.js","\"use strict\"\n\n// We have an ES6 Map available, return the native instance\nif(typeof global.Map !== 'undefined') {\n module.exports = global.Map;\n module.exports.Map = global.Map;\n} else {\n // We will return a polyfill\n var Map = function(array) {\n this._keys = [];\n this._values = {};\n\n for(var i = 0; i < array.length; i++) {\n if(array[i] == null) continue; // skip null and undefined\n var entry = array[i];\n var key = entry[0];\n var value = entry[1];\n // Add the key to the list of keys in order\n this._keys.push(key);\n // Add the key and value to the values dictionary with a point\n // to the location in the ordered keys list\n this._values[key] = {v: value, i: this._keys.length - 1};\n }\n }\n\n Map.prototype.clear = function() {\n this._keys = [];\n this._values = {};\n }\n\n Map.prototype.delete = function(key) {\n var value = this._values[key];\n if(value == null) return false;\n // Delete entry\n delete this._values[key];\n // Remove the key from the ordered keys list\n this._keys.splice(value.i, 1);\n return true;\n }\n\n Map.prototype.entries = function() {\n var self = this;\n var index = 0;\n\n return {\n next: function() {\n var key = self._keys[index++];\n return {\n value: key !== undefined ? [key, self._values[key].v] : undefined,\n done: key !== undefined ? false : true\n }\n }\n };\n }\n\n Map.prototype.forEach = function(callback, self) {\n self = self || this;\n\n for(var i = 0; i < this._keys.length; i++) {\n var key = this._keys[i];\n // Call the forEach callback\n callback.call(self, this._values[key].v, key, self);\n }\n }\n\n Map.prototype.get = function(key) {\n return this._values[key] ? this._values[key].v : undefined;\n }\n\n Map.prototype.has = function(key) {\n return this._values[key] != null;\n }\n\n Map.prototype.keys = function(key) {\n var self = this;\n var index = 0;\n\n return {\n next: function() {\n var key = self._keys[index++];\n return {\n value: key !== undefined ? key : undefined,\n done: key !== undefined ? false : true\n }\n }\n };\n }\n\n Map.prototype.set = function(key, value) {\n if(this._values[key]) {\n this._values[key].v = value;\n return this;\n }\n\n // Add the key to the list of keys in order\n this._keys.push(key);\n // Add the key and value to the values dictionary with a point\n // to the location in the ordered keys list\n this._values[key] = {v: value, i: this._keys.length - 1};\n return this;\n }\n\n Map.prototype.values = function(key, value) {\n var self = this;\n var index = 0;\n\n return {\n next: function() {\n var key = self._keys[index++];\n return {\n value: key !== undefined ? self._values[key].v : undefined,\n done: key !== undefined ? false : true\n }\n }\n };\n }\n\n // Last ismaster\n Object.defineProperty(Map.prototype, 'size', {\n enumerable:true,\n get: function() { return this._keys.length; }\n });\n\n module.exports = Map;\n module.exports.Map = Map;\n}\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/map.js","/** @module auth */\nimport * as common from '../common';\nimport * as authCommon from './common';\nimport { uriEncodeObject } from '../util';\n\nexport const PROVIDER_TYPE_ANON = 'anon';\nexport const PROVIDER_TYPE_CUSTOM = 'custom';\nexport const PROVIDER_TYPE_USERPASS = 'userpass';\nexport const PROVIDER_TYPE_APIKEY = 'apiKey';\nexport const PROVIDER_TYPE_GOOGLE = 'google';\nexport const PROVIDER_TYPE_FACEBOOK = 'facebook';\nexport const PROVIDER_TYPE_MONGODB_CLOUD = 'mongodbCloud';\n\n/**\n * @namespace\n */\nfunction anonProvider(auth) {\n return {\n /**\n * Login to a stitch application using anonymous authentication\n *\n * @memberof anonProvider\n * @instance\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: () => {\n const deviceId = auth.getDeviceId();\n const device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n const fetchArgs = common.makeFetchArgs('GET');\n fetchArgs.cors = true;\n\n return fetch(\n `${auth.rootUrl}/providers/anon-user/login?device=${uriEncodeObject(device)}`,\n fetchArgs\n ).then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json, PROVIDER_TYPE_ANON));\n }\n };\n}\n\n/**\n * @namespace\n */\nfunction customProvider(auth) {\n const providerRoute = 'providers/custom-token';\n const loginRoute = `${providerRoute}/login`;\n\n return {\n /**\n * Login to a stitch application using custom authentication\n *\n * @memberof customProvider\n * @instance\n * @param {String} JWT token to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: (token) => {\n const deviceId = auth.getDeviceId();\n const device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n\n const fetchArgs = common.makeFetchArgs(\n 'POST',\n JSON.stringify({ token, options: { device } })\n );\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${loginRoute}`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json, PROVIDER_TYPE_CUSTOM));\n }\n };\n}\n\n/** @namespace */\nfunction userPassProvider(auth) {\n // The ternary expression here is redundant but is just preserving previous behavior based on whether or not\n // the client is for the admin or client API.\n const providerRoute = auth.isAppClient() ? 'providers/local-userpass' : 'providers/local-userpass';\n const loginRoute = auth.isAppClient() ? `${providerRoute}/login` : `${providerRoute}/login`;\n\n return {\n /**\n * Login to a stitch application using username and password authentication\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} username the username to use for authentication\n * @param {String} password the password to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: ({ username, password }) => {\n const deviceId = auth.getDeviceId();\n const device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n\n const fetchArgs = common.makeFetchArgs(\n 'POST',\n JSON.stringify({ username, password, options: { device } })\n );\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${loginRoute}`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json, PROVIDER_TYPE_USERPASS));\n },\n\n /**\n * Completes the confirmation workflow from the stitch server\n * @memberof userPassProvider\n * @instance\n * @param {String} tokenId the tokenId provided by the stitch server\n * @param {String} token the token provided by the stitch server\n * @returns {Promise}\n */\n emailConfirm: (tokenId, token) => {\n const fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ tokenId, token }));\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${providerRoute}/confirm`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json());\n },\n\n /**\n * Request that the stitch server send another email confirmation\n * for account creation.\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} email the email to send a confirmation email for\n * @returns {Promise}\n */\n sendEmailConfirm: (email) => {\n const fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email }));\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${providerRoute}/confirm/send`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json());\n },\n\n /**\n * Sends a password reset request to the stitch server\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} email the email of the account to reset the password for\n * @returns {Promise}\n */\n sendPasswordReset: (email) => {\n const fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email }));\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${providerRoute}/reset/send`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json());\n },\n\n /**\n * Use information returned from the stitch server to complete the password\n * reset flow for a given email account, providing a new password for the account.\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} tokenId the tokenId provided by the stitch server\n * @param {String} token the token provided by the stitch server\n * @param {String} password the new password requested for this account\n * @returns {Promise}\n */\n passwordReset: (tokenId, token, password) => {\n const fetchArgs =\n common.makeFetchArgs('POST', JSON.stringify({ tokenId, token, password }));\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${providerRoute}/reset`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json());\n },\n\n\n /**\n * Will trigger an email to the requested account containing a link with the\n * token and tokenId that must be returned to the server using emailConfirm()\n * to activate the account.\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} email the requested email for the account\n * @param {String} password the requested password for the account\n * @returns {Promise}\n */\n register: (email, password) => {\n const fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email, password }));\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${providerRoute}/register`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json());\n }\n };\n}\n\n/** @namespace */\nfunction apiKeyProvider(auth) {\n // The ternary expression here is redundant but is just preserving previous behavior based on whether or not\n // the client is for the admin or client API.\n const loginRoute = auth.isAppClient() ? 'providers/api-key/login' : 'providers/api-key/login';\n\n return {\n /**\n * Login to a stitch application using an api key\n *\n * @memberof apiKeyProvider\n * @instance\n * @param {String} key the key for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: key => {\n const deviceId = auth.getDeviceId();\n const device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n const fetchArgs = common.makeFetchArgs(\n 'POST',\n JSON.stringify({ 'key': key, 'options': { device } })\n );\n fetchArgs.cors = true;\n return fetch(`${auth.rootUrl}/${loginRoute}`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json, PROVIDER_TYPE_APIKEY));\n }\n };\n}\n\n// The state we generate is to be used for any kind of request where we will\n// complete an authentication flow via a redirect. We store the generate in\n// a local storage bound to the app's origin. This ensures that any time we\n// receive a redirect, there must be a state parameter and it must match\n// what we ourselves have generated. This state MUST only be sent to\n// a trusted Stitch endpoint in order to preserve its integrity. Stitch will\n// store it in some way on its origin (currently a cookie stored on this client)\n// and use that state at the end of an auth flow as a parameter in the redirect URI.\nconst alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\nfunction generateState() {\n let state = '';\n for (let i = 0; i < 64; ++i) {\n state += alpha.charAt(Math.floor(Math.random() * alpha.length));\n }\n\n return state;\n}\n\nfunction getOAuthLoginURL(auth, providerName, redirectUrl) {\n if (redirectUrl === undefined) {\n redirectUrl = auth.pageRootUrl();\n }\n\n const state = generateState();\n return auth.storage.set(authCommon.STATE_KEY, state)\n .then(() => auth.getDeviceId())\n .then(deviceId => {\n const device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n\n const result = `${auth.rootUrl}/providers/oauth2-${providerName}/login?redirect=${encodeURI(redirectUrl)}&state=${state}&device=${uriEncodeObject(device)}`;\n return result;\n });\n}\n\n/** @namespace */\nfunction googleProvider(auth) {\n const loginRoute = auth.isAppClient() ? 'providers/oauth2-google/login' : 'providers/oauth2-google/login';\n\n return {\n /**\n * Login to a stitch application using google authentication\n *\n * @memberof googleProvider\n * @instance\n * @param {Object} data the redirectUrl data to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: data => {\n let { authCode } = data;\n if (authCode) {\n const deviceId = auth.getDeviceId();\n const device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n\n const fetchArgs = common.makeFetchArgs(\n 'POST',\n JSON.stringify({ authCode, options: { device } })\n );\n\n return fetch(`${auth.rootUrl}/${loginRoute}`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json, PROVIDER_TYPE_GOOGLE));\n }\n\n const redirectUrl = (data && data.redirectUrl) ? data.redirectUrl : undefined;\n return auth.storage.set(authCommon.STITCH_REDIRECT_PROVIDER, PROVIDER_TYPE_GOOGLE)\n .then(() => getOAuthLoginURL(auth, PROVIDER_TYPE_GOOGLE, redirectUrl))\n .then((res) => window.location.replace(res));\n }\n };\n}\n\n/** @namespace */\nfunction facebookProvider(auth) {\n const loginRoute = auth.isAppClient() ? 'providers/oauth2-facebook/login' : 'providers/oauth2-facebook/login';\n\n return {\n /**\n * Login to a stitch application using facebook authentication\n *\n * @memberof facebookProvider\n * @instance\n * @param {Object} data the redirectUrl data to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: data => {\n let { accessToken } = data;\n\n if (accessToken) {\n const deviceId = auth.getDeviceId();\n const device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n\n const fetchArgs = common.makeFetchArgs(\n 'POST',\n JSON.stringify({ accessToken, options: { device } })\n );\n\n return fetch(`${auth.rootUrl}/${loginRoute}`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json, PROVIDER_TYPE_FACEBOOK));\n }\n\n const redirectUrl = (data && data.redirectUrl) ? data.redirectUrl : undefined;\n return auth.storage.set(authCommon.STITCH_REDIRECT_PROVIDER, PROVIDER_TYPE_FACEBOOK)\n .then(() => getOAuthLoginURL(auth, PROVIDER_TYPE_FACEBOOK, redirectUrl))\n .then((res) => window.location.replace(res));\n }\n };\n}\n\n/** @namespace */\nfunction mongodbCloudProvider(auth) {\n // The ternary expression here is redundant but is just preserving previous behavior based on whether or not\n // the client is for the admin or client API.\n const loginRoute = auth.isAppClient() ? 'providers/mongodb-cloud/login' : 'providers/mongodb-cloud/login';\n\n return {\n /**\n * Login to a stitch application using mongodb cloud authentication\n *\n * @memberof mongodbCloudProvider\n * @instance\n * @param {Object} data the username, apiKey, cors, and cookie data to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: data => {\n const { username, apiKey, cors, cookie } = data;\n const options = Object.assign({}, { cors: true, cookie: false }, { cors: cors, cookie: cookie });\n const deviceId = auth.getDeviceId();\n const device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n const fetchArgs = common.makeFetchArgs(\n 'POST',\n JSON.stringify({ username, apiKey, options: { device } })\n );\n fetchArgs.cors = true; // TODO: shouldn't this use the passed in `cors` value?\n fetchArgs.credentials = 'include';\n\n let url = `${auth.rootUrl}/${loginRoute}`;\n if (options.cookie) {\n return fetch(url + '?cookie=true', fetchArgs)\n .then(common.checkStatus);\n }\n\n return fetch(url, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json, PROVIDER_TYPE_MONGODB_CLOUD));\n }\n };\n}\n\n// TODO: support auth-specific options\nfunction createProviders(auth, options = {}) {\n return {\n [PROVIDER_TYPE_ANON]: anonProvider(auth),\n [PROVIDER_TYPE_APIKEY]: apiKeyProvider(auth),\n [PROVIDER_TYPE_GOOGLE]: googleProvider(auth),\n [PROVIDER_TYPE_FACEBOOK]: facebookProvider(auth),\n [PROVIDER_TYPE_MONGODB_CLOUD]: mongodbCloudProvider(auth),\n [PROVIDER_TYPE_USERPASS]: userPassProvider(auth),\n [PROVIDER_TYPE_CUSTOM]: customProvider(auth)\n };\n}\n\nexport { createProviders };\n\n\n\n// WEBPACK FOOTER //\n// ./src/auth/providers.js","// the whatwg-fetch polyfill installs the fetch() function\n// on the global object (window or self)\n//\n// Return that as the export for use in Webpack, Browserify etc.\nrequire('whatwg-fetch');\nvar globalObj = typeof self !== 'undefined' && self || this;\nmodule.exports = globalObj.fetch.bind(globalObj);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/fetch-everywhere/fetch-npm-browserify.js\n// module id = 24\n// module chunks = 0","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/process/browser.js\n// module id = 25\n// module chunks = 0","/* global window, fetch */\n/* eslint no-labels: ['error', { 'allowLoop': true }] */\nimport 'fetch-everywhere';\nimport { newStitchClient, StitchClient } from './client';\nimport ADMIN_CLIENT_TYPE from './common';\nimport { ADMIN_CLIENT_CODEC } from './auth/common';\n\nconst v2 = 2;\nconst v3 = 3;\n\nexport class StitchAdminClientFactory {\n constructor() {\n throw new StitchError('StitchAdminClient can only be made from the StitchAdminClientFactory.create function');\n }\n\n static create(baseUrl) {\n return newStitchClient(StitchAdminClient.prototype, '', {baseUrl, authCodec: ADMIN_CLIENT_CODEC});\n }\n}\n\nexport class StitchAdminClient extends StitchClient {\n constructor() {\n super();\n throw new StitchError('StitchAdminClient can only be made from the StitchAdminClientFactory.create function');\n }\n\n get type() {\n return ADMIN_CLIENT_TYPE;\n }\n\n get _v3() {\n const v3do = (url, method, options) =>\n super._do(\n url,\n method,\n Object.assign({}, { apiVersion: v3 }, options)\n ).then(response => {\n const contentHeader = response.headers.get('content-type') || '';\n if (contentHeader.split(',').indexOf('application/json') >= 0) {\n return response.json();\n }\n return response;\n });\n\n return {\n _get: (url, queryParams) => v3do(url, 'GET', {queryParams}),\n _put: (url, data) =>\n (data ?\n v3do(url, 'PUT', {body: JSON.stringify(data)}) :\n v3do(url, 'PUT')),\n _patch: (url, data) =>\n (data ?\n v3do(url, 'PATCH', {body: JSON.stringify(data)}) :\n v3do(url, 'PATCH')),\n _delete: (url) => v3do(url, 'DELETE'),\n _post: (url, body, queryParams) =>\n (queryParams ?\n v3do(url, 'POST', { body: JSON.stringify(body), queryParams }) :\n v3do(url, 'POST', { body: JSON.stringify(body) }))\n };\n }\n\n get _v2() {\n const v2do = (url, method, options) =>\n super._do(\n url,\n method,\n Object.assign({}, { apiVersion: v2 }, options)\n ).then(response => {\n const contentHeader = response.headers.get('content-type') || '';\n if (contentHeader.split(',').indexOf('application/json') >= 0) {\n return response.json();\n }\n return response;\n });\n\n return {\n _get: (url, queryParams) => v2do(url, 'GET', {queryParams}),\n _put: (url, data) =>\n (data ?\n v2do(url, 'PUT', {body: JSON.stringify(data)}) :\n v2do(url, 'PUT')),\n _patch: (url, data) =>\n (data ?\n v2do(url, 'PATCH', {body: JSON.stringify(data)}) :\n v2do(url, 'PATCH')),\n _delete: (url) => v2do(url, 'DELETE'),\n _post: (url, body, queryParams) =>\n (queryParams ?\n v2do(url, 'POST', { body: JSON.stringify(body), queryParams }) :\n v2do(url, 'POST', { body: JSON.stringify(body) }))\n };\n }\n\n /**\n * Ends the session for the current user.\n *\n * @returns {Promise}\n */\n logout() {\n return super._do('/auth/session', 'DELETE', { refreshOnFailure: false, useRefreshToken: true, apiVersion: v3 })\n .then(() => this.auth.clear());\n }\n\n /**\n * Returns profile information for the currently logged in user\n *\n * @returns {Promise}\n */\n userProfile() {\n return this._v3._get('/auth/profile');\n }\n\n /**\n * Returns available providers for the currently logged in admin\n *\n * @returns {Promise}\n */\n getAuthProviders() {\n return super._do('/auth/providers', 'GET', { noAuth: true, apiVersion: v3 })\n .then(response => response.json());\n }\n\n /**\n * Returns an access token for the user\n *\n * @returns {Promise}\n */\n doSessionPost() {\n return super._do('/auth/session', 'POST', { refreshOnFailure: false, useRefreshToken: true, apiVersion: v3 })\n .then(response => response.json());\n }\n\n /* Examples of how to access admin API with this client:\n *\n * List all apps\n * a.apps('580e6d055b199c221fcb821c').list()\n *\n * Fetch app under name 'planner'\n * a.apps('580e6d055b199c221fcb821c').app('planner').get()\n *\n * List services under the app 'planner'\n * a.apps('580e6d055b199c221fcb821c').app('planner').services().list()\n *\n * Delete a rule by ID\n * a.apps('580e6d055b199c221fcb821c').app('planner').services().service('mdb1').rules().rule('580e6d055b199c221fcb821d').remove()\n *\n */\n apps(groupId) {\n const api = this._v3;\n const groupUrl = `/groups/${groupId}/apps`;\n return {\n list: () => api._get(groupUrl),\n create: (data, options) => {\n let query = (options && options.defaults) ? '?defaults=true' : '';\n return api._post(groupUrl + query, data);\n },\n\n app: (appId) => {\n const appUrl = `${groupUrl}/${appId}`;\n return {\n get: () => api._get(appUrl),\n remove: () => api._delete(appUrl),\n\n values: () => ({\n list: () => api._get(`${appUrl}/values`),\n create: (data) => api._post( `${appUrl}/values`, data),\n value: (valueId) => {\n const valueUrl = `${appUrl}/values/${valueId}`;\n return {\n get: ()=> api._get(valueUrl),\n remove: ()=> api._delete(valueUrl),\n update: (data) => api._put(valueUrl, data)\n };\n }\n }),\n\n services: () => ({\n list: () => api._get(`${appUrl}/services`),\n create: (data) => api._post(`${appUrl}/services`, data),\n service: (serviceId) => ({\n get: () => api._get(`${appUrl}/services/${serviceId}`),\n remove: () => api._delete(`${appUrl}/services/${serviceId}`),\n runCommand: (commandName, data) => api._post(`${appUrl}/services/${serviceId}/commands/${commandName}`, data),\n config: ()=> ({\n get: () => api._get(`${appUrl}/services/${serviceId}/config`),\n update: (data) => api._patch(`${appUrl}/services/${serviceId}/config`, data)\n }),\n\n rules: () => ({\n list: () => api._get(`${appUrl}/services/${serviceId}/rules`),\n create: (data) => api._post(`${appUrl}/services/${serviceId}/rules`, data),\n rule: (ruleId) => {\n const ruleUrl = `${appUrl}/services/${serviceId}/rules/${ruleId}`;\n return {\n get: () => api._get(ruleUrl),\n update: (data) => api._put(ruleUrl, data),\n remove: () => api._delete(ruleUrl)\n };\n }\n }),\n\n incomingWebhooks: () => ({\n list: () => api._get(`${appUrl}/services/${serviceId}/incoming_webhooks`),\n create: (data) => api._post(`${appUrl}/services/${serviceId}/incoming_webhooks`, data),\n incomingWebhook: (incomingWebhookId) => {\n const webhookUrl = `${appUrl}/services/${serviceId}/incoming_webhooks/${incomingWebhookId}`;\n return {\n get: () => api._get(webhookUrl),\n update: (data) => api._put(webhookUrl, data),\n remove: () => api._delete(webhookUrl)\n };\n }\n })\n })\n }),\n\n pushNotifications: () => ({\n list: (filter) => api._get(`${appUrl}/push/notifications`, filter),\n create: (data) => api._post(`${appUrl}/push/notifications`, data),\n pushNotification: (messageId) => ({\n get: () => api._get(`${appUrl}/push/notifications/${messageId}`),\n update: (data) => api._put(`${appUrl}/push/notifications/${messageId}`, data),\n remove: () => api._delete(`${appUrl}/push/notifications/${messageId}`),\n send: () => api._post(`${appUrl}/push/notifications/${messageId}/send`)\n })\n }),\n\n users: () => ({\n list: (filter) => api._get(`${appUrl}/users`, filter),\n create: (user) => api._post(`${appUrl}/users`, user),\n user: (uid) => ({\n get: () => api._get(`${appUrl}/users/${uid}`),\n devices: () => ({\n get: () => api._get(`${appUrl}/users/${uid}/devices`)\n }),\n logout: () => api._put(`${appUrl}/users/${uid}/logout`),\n enable: () => api._put(`${appUrl}/users/${uid}/enable`),\n disable: () => api._put(`${appUrl}/users/${uid}/disable`),\n remove: () => api._delete(`${appUrl}/users/${uid}`)\n })\n }),\n\n debug: () => ({\n executeFunction: (userId, name = '', ...args) => {\n return api._post(\n `${appUrl}/debug/execute_function`,\n {name, 'arguments': args},\n { user_id: userId });\n },\n executeFunctionSource: (userId, source = '', evalSource = '') => {\n return api._post(\n `${appUrl}/debug/execute_function_source`,\n {source, 'eval_source': evalSource},\n { user_id: userId });\n }\n }),\n\n authProviders: () => ({\n list: () => api._get(`${appUrl}/auth_providers`),\n create: (data) => api._post(`${appUrl}/auth_providers`, data),\n authProvider: (providerId) => ({\n get: () => api._get(`${appUrl}/auth_providers/${providerId}`),\n update: (data) => api._patch(`${appUrl}/auth_providers/${providerId}`, data),\n enable: () => api._put(`${appUrl}/auth_providers/${providerId}/enable`),\n disable: () => api._put(`${appUrl}/auth_providers/${providerId}/disable`),\n remove: () => api._delete(`${appUrl}/auth_providers/${providerId}`)\n })\n }),\n\n security: () => ({\n allowedRequestOrigins: () => ({\n get: () => api._get(`${appUrl}/security/allowed_request_origins`),\n update: (data) => api._post(`${appUrl}/security/allowed_request_origins`, data)\n })\n }),\n\n logs: () => ({\n list: (filter) => api._get(`${appUrl}/logs`, filter)\n }),\n\n apiKeys: () => ({\n list: () => api._get(`${appUrl}/api_keys`),\n create: (data) => api._post(`${appUrl}/api_keys`, data),\n apiKey: (apiKeyId) => ({\n get: () => api._get(`${appUrl}/api_keys/${apiKeyId}`),\n remove: () => api._delete(`${appUrl}/api_keys/${apiKeyId}`),\n enable: () => api._put(`${appUrl}/api_keys/${apiKeyId}/enable`),\n disable: () => api._put(`${appUrl}/api_keys/${apiKeyId}/disable`)\n })\n }),\n\n functions: () => ({\n list: () => api._get(`${appUrl}/functions`),\n create: (data) => api._post(`${appUrl}/functions`, data),\n function: (functionId) => ({\n get: () => api._get(`${appUrl}/functions/${functionId}`),\n update: (data) => api._put(`${appUrl}/functions/${functionId}`, data),\n remove: () => api._delete(`${appUrl}/functions/${functionId}`)\n })\n })\n };\n }\n };\n }\n\n v2() {\n const api = this._v2;\n return {\n\n apps: (groupId) => {\n const groupUrl = `/groups/${groupId}/apps`;\n return {\n list: () => api._get(groupUrl),\n create: (data, options) => {\n let query = (options && options.defaults) ? '?defaults=true' : '';\n return api._post(groupUrl + query, data);\n },\n\n app: (appId) => {\n const appUrl = `${groupUrl}/${appId}`;\n return {\n get: () => api._get(appUrl),\n remove: () => api._delete(appUrl),\n\n pipelines: () => ({\n list: () => api._get(`${appUrl}/pipelines`),\n create: (data) => api._post( `${appUrl}/pipelines`, data),\n pipeline: (pipelineId) => {\n const pipelineUrl = `${appUrl}/pipelines/${pipelineId}`;\n return {\n get: ()=> api._get(pipelineUrl),\n remove: ()=> api._delete(pipelineUrl),\n update: (data) => api._put(pipelineUrl, data)\n };\n }\n }),\n\n values: () => ({\n list: () => api._get(`${appUrl}/values`),\n create: (data) => api._post( `${appUrl}/values`, data),\n value: (valueId) => {\n const valueUrl = `${appUrl}/values/${valueId}`;\n return {\n get: ()=> api._get(valueUrl),\n remove: ()=> api._delete(valueUrl),\n update: (data) => api._put(valueUrl, data)\n };\n }\n }),\n\n services: () => ({\n list: () => api._get(`${appUrl}/services`),\n create: (data) => api._post(`${appUrl}/services`, data),\n service: (serviceId) => ({\n get: () => api._get(`${appUrl}/services/${serviceId}`),\n remove: () => api._delete(`${appUrl}/services/${serviceId}`),\n runCommand: (commandName, data) => api._post(`${appUrl}/services/${serviceId}/commands/${commandName}`, data),\n config: ()=> ({\n get: () => api._get(`${appUrl}/services/${serviceId}/config`),\n update: (data) => api._patch(`${appUrl}/services/${serviceId}/config`, data)\n }),\n\n rules: () => ({\n list: () => api._get(`${appUrl}/services/${serviceId}/rules`),\n create: (data) => api._post(`${appUrl}/services/${serviceId}/rules`, data),\n rule: (ruleId) => {\n const ruleUrl = `${appUrl}/services/${serviceId}/rules/${ruleId}`;\n return {\n get: () => api._get(ruleUrl),\n update: (data) => api._put(ruleUrl, data),\n remove: () => api._delete(ruleUrl)\n };\n }\n }),\n\n incomingWebhooks: () => ({\n list: () => api._get(`${appUrl}/services/${serviceId}/incoming_webhooks`),\n create: (data) => api._post(`${appUrl}/services/${serviceId}/incoming_webhooks`, data),\n incomingWebhook: (incomingWebhookId) => {\n const webhookUrl = `${appUrl}/services/${serviceId}/incoming_webhooks/${incomingWebhookId}`;\n return {\n get: () => api._get(webhookUrl),\n update: (data) => api._put(webhookUrl, data),\n remove: () => api._delete(webhookUrl)\n };\n }\n })\n\n })\n }),\n\n pushNotifications: () => ({\n list: (filter) => api._get(`${appUrl}/push/notifications`, filter),\n create: (data) => api._post(`${appUrl}/push/notifications`, data),\n pushNotification: (messageId) => ({\n get: () => api._get(`${appUrl}/push/notifications/${messageId}`),\n update: (data) => api._put(`${appUrl}/push/notifications/${messageId}`, data),\n setType: (type) => api._put(`${appUrl}/push/notifications/${messageId}/type`, { type }),\n remove: () => api._delete(`${appUrl}/push/notifications/${messageId}`)\n })\n }),\n\n users: () => ({\n list: (filter) => api._get(`${appUrl}/users`, filter),\n create: (user) => api._post(`${appUrl}/users`, user),\n user: (uid) => ({\n get: () => api._get(`${appUrl}/users/${uid}`),\n logout: () => api._put(`${appUrl}/users/${uid}/logout`),\n remove: () => api._delete(`${appUrl}/users/${uid}`)\n })\n }),\n\n dev: () => ({\n executePipeline: (body, userId, options) => {\n return api._post(\n `${appUrl}/dev/pipeline`,\n body,\n Object.assign({}, options, { user_id: userId }));\n }\n }),\n\n authProviders: () => ({\n list: () => api._get(`${appUrl}/auth_providers`),\n create: (data) => api._post(`${appUrl}/auth_providers`, data),\n authProvider: (providerId) => ({\n get: () => api._get(`${appUrl}/auth_providers/${providerId}`),\n update: (data) => api._patch(`${appUrl}/auth_providers/${providerId}`, data),\n enable: () => api._put(`${appUrl}/auth_providers/${providerId}/enable`),\n disable: () => api._put(`${appUrl}/auth_providers/${providerId}/disable`),\n remove: () => api._delete(`${appUrl}/auth_providers/${providerId}`)\n })\n }),\n\n security: () => ({\n allowedRequestOrigins: () => ({\n get: () => api._get(`${appUrl}/security/allowed_request_origins`),\n update: (data) => api._post(`${appUrl}/security/allowed_request_origins`, data)\n })\n }),\n\n logs: () => ({\n list: (filter) => api._get(`${appUrl}/logs`, filter)\n }),\n\n apiKeys: () => ({\n list: () => api._get(`${appUrl}/api_keys`),\n create: (data) => api._post(`${appUrl}/api_keys`, data),\n apiKey: (apiKeyId) => ({\n get: () => api._get(`${appUrl}/api_keys/${apiKeyId}`),\n remove: () => api._delete(`${appUrl}/api_keys/${apiKeyId}`),\n enable: () => api._put(`${appUrl}/api_keys/${apiKeyId}/enable`),\n disable: () => api._put(`${appUrl}/api_keys/${apiKeyId}/disable`)\n })\n })\n };\n }\n };\n }\n };\n }\n\n _admin() {\n return {\n logs: () => ({\n get: (filter) => super._do('/admin/logs', 'GET', { useRefreshToken: true, queryParams: filter })\n }),\n users: () => ({\n list: (filter) => super._do('/admin/users', 'GET', { useRefreshToken: true, queryParams: filter }),\n user: (uid) => ({\n logout: () => super._do(`/admin/users/${uid}/logout`, 'PUT', { useRefreshToken: true })\n })\n })\n };\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/admin.js",";(function () {\n\n var object =\n typeof exports != 'undefined' ? exports :\n typeof self != 'undefined' ? self : // #8: web workers\n $.global; // #31: ExtendScript\n\n var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n function InvalidCharacterError(message) {\n this.message = message;\n }\n InvalidCharacterError.prototype = new Error;\n InvalidCharacterError.prototype.name = 'InvalidCharacterError';\n\n // encoder\n // [https://gist.github.com/999166] by [https://github.com/nignag]\n object.btoa || (\n object.btoa = function (input) {\n var str = String(input);\n for (\n // initialize result and counter\n var block, charCode, idx = 0, map = chars, output = '';\n // if the next str index does not exist:\n // change the mapping table to \"=\"\n // check if d has no fractional digits\n str.charAt(idx | 0) || (map = '=', idx % 1);\n // \"8 - idx % 1 * 8\" generates the sequence 2, 4, 6, 8\n output += map.charAt(63 & block >> 8 - idx % 1 * 8)\n ) {\n charCode = str.charCodeAt(idx += 3/4);\n if (charCode > 0xFF) {\n throw new InvalidCharacterError(\"'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.\");\n }\n block = block << 8 | charCode;\n }\n return output;\n });\n\n // decoder\n // [https://gist.github.com/1020396] by [https://github.com/atk]\n object.atob || (\n object.atob = function (input) {\n var str = String(input).replace(/[=]+$/, ''); // #31: ExtendScript bad parse of /=\n if (str.length % 4 == 1) {\n throw new InvalidCharacterError(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = '';\n // get next character\n buffer = str.charAt(idx++);\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n return output;\n });\n\n}());\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/Base64/base64.js\n// module id = 27\n// module chunks = 0","\"use strict\"\n\nvar writeIEEE754 = require('./float_parser').writeIEEE754,\n\treadIEEE754 = require('./float_parser').readIEEE754,\n Map = require('./map'),\n\tLong = require('./long'),\n Double = require('./double'),\n Timestamp = require('./timestamp'),\n ObjectID = require('./objectid'),\n BSONRegExp = require('./regexp'),\n Symbol = require('./symbol'),\n\tInt32 = require('./int_32'),\n Code = require('./code'),\n\tDecimal128 = require('./decimal128'),\n MinKey = require('./min_key'),\n MaxKey = require('./max_key'),\n DBRef = require('./db_ref'),\n Binary = require('./binary');\n\n// Parts of the parser\nvar deserialize = require('./parser/deserializer'),\n\tserializer = require('./parser/serializer'),\n\tcalculateObjectSize = require('./parser/calculate_size');\n\n/**\n * @ignore\n * @api private\n */\n// Max Size\nvar MAXSIZE = (1024*1024*17);\n// Max Document Buffer size\nvar buffer = new Buffer(MAXSIZE);\n\nvar BSON = function() {\n}\n\n/**\n * Serialize a Javascript object.\n *\n * @param {Object} object the Javascript object to serialize.\n * @param {Boolean} [options.checkKeys] the serializer will check if keys are valid.\n * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**.\n * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**.\n * @return {Buffer} returns the Buffer object containing the serialized object.\n * @api public\n */\nBSON.prototype.serialize = function serialize(object, options) {\n\toptions = options || {};\n\t// Unpack the options\n\tvar checkKeys = typeof options.checkKeys == 'boolean'\n\t\t? options.checkKeys : false;\n\tvar serializeFunctions = typeof options.serializeFunctions == 'boolean'\n\t\t? options.serializeFunctions : false;\n\tvar ignoreUndefined = typeof options.ignoreUndefined == 'boolean'\n\t\t? options.ignoreUndefined : true;\n\n\t// Attempt to serialize\n\tvar serializationIndex = serializer(buffer, object, checkKeys, 0, 0, serializeFunctions, ignoreUndefined, []);\n\t// Create the final buffer\n\tvar finishedBuffer = new Buffer(serializationIndex);\n\t// Copy into the finished buffer\n\tbuffer.copy(finishedBuffer, 0, 0, finishedBuffer.length);\n\t// Return the buffer\n\treturn finishedBuffer;\n}\n\n/**\n * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization.\n *\n * @param {Object} object the Javascript object to serialize.\n * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object.\n * @param {Boolean} [options.checkKeys] the serializer will check if keys are valid.\n * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**.\n * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**.\n * @param {Number} [options.index] the index in the buffer where we wish to start serializing into.\n * @return {Number} returns the index pointing to the last written byte in the buffer.\n * @api public\n */\nBSON.prototype.serializeWithBufferAndIndex = function(object, finalBuffer, options) {\n\toptions = options || {};\n\t// Unpack the options\n\tvar checkKeys = typeof options.checkKeys == 'boolean'\n\t\t? options.checkKeys : false;\n\tvar serializeFunctions = typeof options.serializeFunctions == 'boolean'\n\t\t? options.serializeFunctions : false;\n\tvar ignoreUndefined = typeof options.ignoreUndefined == 'boolean'\n\t\t? options.ignoreUndefined : true;\n\tvar startIndex = typeof options.index == 'number'\n\t\t? options.index : 0;\n\n\t// Attempt to serialize\n\tvar serializationIndex = serializer(buffer, object, checkKeys, startIndex || 0, 0, serializeFunctions, ignoreUndefined);\n\tbuffer.copy(finalBuffer, startIndex, 0, serializationIndex);\n\n\t// Return the index\n\treturn serializationIndex - 1;\n}\n\n/**\n * Deserialize data as BSON.\n *\n * @param {Buffer} buffer the buffer containing the serialized set of BSON documents.\n * @param {Object} [options.evalFunctions=false] evaluate functions in the BSON document scoped to the object deserialized.\n * @param {Object} [options.cacheFunctions=false] cache evaluated functions for reuse.\n * @param {Object} [options.cacheFunctionsCrc32=false] use a crc32 code for caching, otherwise use the string of the function.\n * @param {Object} [options.promoteLongs=true] when deserializing a Long will fit it into a Number if it's smaller than 53 bits\n * @param {Object} [options.promoteBuffers=false] when deserializing a Binary will return it as a node.js Buffer instance.\n * @param {Object} [options.promoteValues=false] when deserializing will promote BSON values to their Node.js closest equivalent types.\n * @param {Object} [options.fieldsAsRaw=null] allow to specify if there what fields we wish to return as unserialized raw buffer.\n * @param {Object} [options.bsonRegExp=false] return BSON regular expressions as BSONRegExp instances.\n * @return {Object} returns the deserialized Javascript Object.\n * @api public\n */\nBSON.prototype.deserialize = function(buffer, options) {\n return deserialize(buffer, options);\n}\n\n/**\n * Calculate the bson size for a passed in Javascript object.\n *\n * @param {Object} object the Javascript object to calculate the BSON byte size for.\n * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**.\n * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**.\n * @return {Number} returns the number of bytes the BSON object will take up.\n * @api public\n */\nBSON.prototype.calculateObjectSize = function(object, options) {\n\toptions = options || {};\n\n\tvar serializeFunctions = typeof options.serializeFunctions == 'boolean'\n\t\t? options.serializeFunctions : false;\n\tvar ignoreUndefined = typeof options.ignoreUndefined == 'boolean'\n\t\t? options.ignoreUndefined : true;\n\n return calculateObjectSize(object, serializeFunctions, ignoreUndefined);\n}\n\n/**\n * Deserialize stream data as BSON documents.\n *\n * @param {Buffer} data the buffer containing the serialized set of BSON documents.\n * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start.\n * @param {Number} numberOfDocuments number of documents to deserialize.\n * @param {Array} documents an array where to store the deserialized documents.\n * @param {Number} docStartIndex the index in the documents array from where to start inserting documents.\n * @param {Object} [options] additional options used for the deserialization.\n * @param {Object} [options.evalFunctions=false] evaluate functions in the BSON document scoped to the object deserialized.\n * @param {Object} [options.cacheFunctions=false] cache evaluated functions for reuse.\n * @param {Object} [options.cacheFunctionsCrc32=false] use a crc32 code for caching, otherwise use the string of the function.\n * @param {Object} [options.promoteLongs=true] when deserializing a Long will fit it into a Number if it's smaller than 53 bits\n * @param {Object} [options.promoteBuffers=false] when deserializing a Binary will return it as a node.js Buffer instance.\n * @param {Object} [options.promoteValues=false] when deserializing will promote BSON values to their Node.js closest equivalent types.\n * @param {Object} [options.fieldsAsRaw=null] allow to specify if there what fields we wish to return as unserialized raw buffer.\n * @param {Object} [options.bsonRegExp=false] return BSON regular expressions as BSONRegExp instances.\n * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents.\n * @api public\n */\nBSON.prototype.deserializeStream = function(data, startIndex, numberOfDocuments, documents, docStartIndex, options) {\n options = options != null ? options : {};\n var index = startIndex;\n // Loop over all documents\n for(var i = 0; i < numberOfDocuments; i++) {\n // Find size of the document\n var size = data[index] | data[index + 1] << 8 | data[index + 2] << 16 | data[index + 3] << 24;\n // Update options with index\n options['index'] = index;\n // Parse the document at this point\n documents[docStartIndex + i] = this.deserialize(data, options);\n // Adjust index by the document size\n index = index + size;\n }\n\n // Return object containing end index of parsing and list of documents\n return index;\n}\n\n/**\n * @ignore\n * @api private\n */\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\nBSON.BSON_INT64_MAX = Math.pow(2, 63) - 1;\nBSON.BSON_INT64_MIN = -Math.pow(2, 63);\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\n// Internal long versions\nvar JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double.\nvar JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double.\n\n/**\n * Number BSON Type\n *\n * @classconstant BSON_DATA_NUMBER\n **/\nBSON.BSON_DATA_NUMBER = 1;\n/**\n * String BSON Type\n *\n * @classconstant BSON_DATA_STRING\n **/\nBSON.BSON_DATA_STRING = 2;\n/**\n * Object BSON Type\n *\n * @classconstant BSON_DATA_OBJECT\n **/\nBSON.BSON_DATA_OBJECT = 3;\n/**\n * Array BSON Type\n *\n * @classconstant BSON_DATA_ARRAY\n **/\nBSON.BSON_DATA_ARRAY = 4;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_BINARY\n **/\nBSON.BSON_DATA_BINARY = 5;\n/**\n * ObjectID BSON Type\n *\n * @classconstant BSON_DATA_OID\n **/\nBSON.BSON_DATA_OID = 7;\n/**\n * Boolean BSON Type\n *\n * @classconstant BSON_DATA_BOOLEAN\n **/\nBSON.BSON_DATA_BOOLEAN = 8;\n/**\n * Date BSON Type\n *\n * @classconstant BSON_DATA_DATE\n **/\nBSON.BSON_DATA_DATE = 9;\n/**\n * null BSON Type\n *\n * @classconstant BSON_DATA_NULL\n **/\nBSON.BSON_DATA_NULL = 10;\n/**\n * RegExp BSON Type\n *\n * @classconstant BSON_DATA_REGEXP\n **/\nBSON.BSON_DATA_REGEXP = 11;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_CODE\n **/\nBSON.BSON_DATA_CODE = 13;\n/**\n * Symbol BSON Type\n *\n * @classconstant BSON_DATA_SYMBOL\n **/\nBSON.BSON_DATA_SYMBOL = 14;\n/**\n * Code with Scope BSON Type\n *\n * @classconstant BSON_DATA_CODE_W_SCOPE\n **/\nBSON.BSON_DATA_CODE_W_SCOPE = 15;\n/**\n * 32 bit Integer BSON Type\n *\n * @classconstant BSON_DATA_INT\n **/\nBSON.BSON_DATA_INT = 16;\n/**\n * Timestamp BSON Type\n *\n * @classconstant BSON_DATA_TIMESTAMP\n **/\nBSON.BSON_DATA_TIMESTAMP = 17;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_LONG\n **/\nBSON.BSON_DATA_LONG = 18;\n/**\n * MinKey BSON Type\n *\n * @classconstant BSON_DATA_MIN_KEY\n **/\nBSON.BSON_DATA_MIN_KEY = 0xff;\n/**\n * MaxKey BSON Type\n *\n * @classconstant BSON_DATA_MAX_KEY\n **/\nBSON.BSON_DATA_MAX_KEY = 0x7f;\n\n/**\n * Binary Default Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_DEFAULT\n **/\nBSON.BSON_BINARY_SUBTYPE_DEFAULT = 0;\n/**\n * Binary Function Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_FUNCTION\n **/\nBSON.BSON_BINARY_SUBTYPE_FUNCTION = 1;\n/**\n * Binary Byte Array Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY\n **/\nBSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;\n/**\n * Binary UUID Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_UUID\n **/\nBSON.BSON_BINARY_SUBTYPE_UUID = 3;\n/**\n * Binary MD5 Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_MD5\n **/\nBSON.BSON_BINARY_SUBTYPE_MD5 = 4;\n/**\n * Binary User Defined Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED\n **/\nBSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128;\n\n// Return BSON\nmodule.exports = BSON;\nmodule.exports.Code = Code;\nmodule.exports.Map = Map;\nmodule.exports.Symbol = Symbol;\nmodule.exports.BSON = BSON;\nmodule.exports.DBRef = DBRef;\nmodule.exports.Binary = Binary;\nmodule.exports.ObjectID = ObjectID;\nmodule.exports.Long = Long;\nmodule.exports.Timestamp = Timestamp;\nmodule.exports.Double = Double;\nmodule.exports.Int32 = Int32;\nmodule.exports.MinKey = MinKey;\nmodule.exports.MaxKey = MaxKey;\nmodule.exports.BSONRegExp = BSONRegExp;\nmodule.exports.Decimal128 = Decimal128;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/bson.js","\"use strict\"\n\nvar writeIEEE754 = require('../float_parser').writeIEEE754\n\t, readIEEE754 = require('../float_parser').readIEEE754\n\t, Long = require('../long').Long\n , Double = require('../double').Double\n , Timestamp = require('../timestamp').Timestamp\n , ObjectID = require('../objectid').ObjectID\n , Symbol = require('../symbol').Symbol\n , BSONRegExp = require('../regexp').BSONRegExp\n , Code = require('../code').Code\n\t, Decimal128 = require('../decimal128')\n , MinKey = require('../min_key').MinKey\n , MaxKey = require('../max_key').MaxKey\n , DBRef = require('../db_ref').DBRef\n , Binary = require('../binary').Binary;\n\n// To ensure that 0.4 of node works correctly\nvar isDate = function isDate(d) {\n return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]';\n}\n\nvar calculateObjectSize = function calculateObjectSize(object, serializeFunctions, ignoreUndefined) {\n var totalLength = (4 + 1);\n\n if(Array.isArray(object)) {\n for(var i = 0; i < object.length; i++) {\n totalLength += calculateElement(i.toString(), object[i], serializeFunctions, true, ignoreUndefined)\n }\n } else {\n\t\t// If we have toBSON defined, override the current object\n\t\tif(object.toBSON) {\n\t\t\tobject = object.toBSON();\n\t\t}\n\n\t\t// Calculate size\n for(var key in object) {\n totalLength += calculateElement(key, object[key], serializeFunctions, false, ignoreUndefined)\n }\n }\n\n return totalLength;\n}\n\n/**\n * @ignore\n * @api private\n */\nfunction calculateElement(name, value, serializeFunctions, isArray, ignoreUndefined) {\n\t// If we have toBSON defined, override the current object\n if(value && value.toBSON){\n value = value.toBSON();\n }\n\n switch(typeof value) {\n case 'string':\n return 1 + Buffer.byteLength(name, 'utf8') + 1 + 4 + Buffer.byteLength(value, 'utf8') + 1;\n case 'number':\n if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) {\n if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { // 32 bit\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (4 + 1);\n } else {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1);\n }\n } else { // 64 bit\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1);\n }\n case 'undefined':\n if(isArray || !ignoreUndefined) return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1);\n return 0;\n case 'boolean':\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1 + 1);\n case 'object':\n if(value == null || value instanceof MinKey || value instanceof MaxKey || value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1);\n } else if(value instanceof ObjectID || value['_bsontype'] == 'ObjectID') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (12 + 1);\n } else if(value instanceof Date || isDate(value)) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1);\n } else if(typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1 + 4 + 1) + value.length;\n } else if(value instanceof Long || value instanceof Double || value instanceof Timestamp\n || value['_bsontype'] == 'Long' || value['_bsontype'] == 'Double' || value['_bsontype'] == 'Timestamp') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1);\n\t\t\t} else if(value instanceof Decimal128 || value['_bsontype'] == 'Decimal128') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (16 + 1);\n } else if(value instanceof Code || value['_bsontype'] == 'Code') {\n // Calculate size depending on the availability of a scope\n if(value.scope != null && Object.keys(value.scope).length > 0) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + 4 + Buffer.byteLength(value.code.toString(), 'utf8') + 1 + calculateObjectSize(value.scope, serializeFunctions, ignoreUndefined);\n } else {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + Buffer.byteLength(value.code.toString(), 'utf8') + 1;\n }\n } else if(value instanceof Binary || value['_bsontype'] == 'Binary') {\n // Check what kind of subtype we have\n if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (value.position + 1 + 4 + 1 + 4);\n } else {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (value.position + 1 + 4 + 1);\n }\n } else if(value instanceof Symbol || value['_bsontype'] == 'Symbol') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + Buffer.byteLength(value.value, 'utf8') + 4 + 1 + 1;\n } else if(value instanceof DBRef || value['_bsontype'] == 'DBRef') {\n // Set up correct object for serialization\n var ordered_values = {\n '$ref': value.namespace\n , '$id' : value.oid\n };\n\n // Add db reference if it exists\n if(null != value.db) {\n ordered_values['$db'] = value.db;\n }\n\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + calculateObjectSize(ordered_values, serializeFunctions, ignoreUndefined);\n } else if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + Buffer.byteLength(value.source, 'utf8') + 1\n + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1\n } else if(value instanceof BSONRegExp || value['_bsontype'] == 'BSONRegExp') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + Buffer.byteLength(value.pattern, 'utf8') + 1\n + Buffer.byteLength(value.options, 'utf8') + 1\n } else {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + calculateObjectSize(value, serializeFunctions, ignoreUndefined) + 1;\n }\n case 'function':\n // WTF for 0.4.X where typeof /someregexp/ === 'function'\n if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]' || String.call(value) == '[object RegExp]') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + Buffer.byteLength(value.source, 'utf8') + 1\n + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1\n } else {\n if(serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + 4 + Buffer.byteLength(value.toString(), 'utf8') + 1 + calculateObjectSize(value.scope, serializeFunctions, ignoreUndefined);\n } else if(serializeFunctions) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + Buffer.byteLength(value.toString(), 'utf8') + 1;\n }\n }\n }\n\n return 0;\n}\n\nvar BSON = {};\n\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\nmodule.exports = calculateObjectSize;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/parser/calculate_size.js","\"use strict\"\n\nvar readIEEE754 = require('../float_parser').readIEEE754,\n\tf = require('util').format,\n\tLong = require('../long').Long,\n Double = require('../double').Double,\n Timestamp = require('../timestamp').Timestamp,\n ObjectID = require('../objectid').ObjectID,\n Symbol = require('../symbol').Symbol,\n Code = require('../code').Code,\n MinKey = require('../min_key').MinKey,\n MaxKey = require('../max_key').MaxKey,\n\tDecimal128 = require('../decimal128'),\n\tInt32 = require('../int_32'),\n DBRef = require('../db_ref').DBRef,\n BSONRegExp = require('../regexp').BSONRegExp,\n Binary = require('../binary').Binary;\n\nvar deserialize = function(buffer, options, isArray) {\n\toptions = options == null ? {} : options;\n\tvar index = options && options.index ? options.index : 0;\n\t// Read the document size\n var size = buffer[index] | buffer[index+1] << 8 | buffer[index+2] << 16 | buffer[index+3] << 24;\n\n\t// Ensure buffer is valid size\n if(size < 5 || buffer.length < size || (size + index) > buffer.length) {\n\t\tthrow new Error(\"corrupt bson message\");\n\t}\n\n\t// Illegal end value\n\tif(buffer[index + size - 1] != 0) {\n\t\tthrow new Error(\"One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00\");\n\t}\n\n\t// Start deserializtion\n\treturn deserializeObject(buffer, index, options, isArray);\n}\n\nvar deserializeObject = function(buffer, index, options, isArray) {\n\tvar evalFunctions = options['evalFunctions'] == null ? false : options['evalFunctions'];\n var cacheFunctions = options['cacheFunctions'] == null ? false : options['cacheFunctions'];\n var cacheFunctionsCrc32 = options['cacheFunctionsCrc32'] == null ? false : options['cacheFunctionsCrc32'];\n\tvar fieldsAsRaw = options['fieldsAsRaw'] == null ? null : options['fieldsAsRaw'];\n\n\t// Return raw bson buffer instead of parsing it\n\tvar raw = options['raw'] == null ? false : options['raw'];\n\n\t// Return BSONRegExp objects instead of native regular expressions\n var bsonRegExp = typeof options['bsonRegExp'] == 'boolean' ? options['bsonRegExp'] : false;\n\n\t// Controls the promotion of values vs wrapper classes\n\tvar promoteBuffers = options['promoteBuffers'] == null ? false : options['promoteBuffers'];\n\tvar promoteLongs = options['promoteLongs'] == null ? true : options['promoteLongs'];\n\tvar promoteValues = options['promoteValues'] == null ? true : options['promoteValues'];\n\n\t// Set the start index\n\tvar startIndex = index;\n\n // Validate that we have at least 4 bytes of buffer\n if(buffer.length < 5) throw new Error(\"corrupt bson message < 5 bytes long\");\n\n\t// Read the document size\n var size = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n\t// Ensure buffer is valid size\n if(size < 5 || size > buffer.length) throw new Error(\"corrupt bson message\");\n\n // Create holding object\n var object = isArray ? [] : {};\n\t// Used for arrays to skip having to perform utf8 decoding\n\tvar arrayIndex = 0;\n\n // While we have more left data left keep parsing\n while(true) {\n // Read the type\n var elementType = buffer[index++];\n // If we get a zero it's the last byte, exit\n if(elementType == 0) {\n\t\t\tbreak;\n\t\t}\n\n\t\t// Get the start search index\n\t\tvar i = index;\n\t\t// Locate the end of the c string\n\t\twhile(buffer[i] !== 0x00 && i < buffer.length) {\n\t\t\ti++\n\t\t}\n\n\t\t// If are at the end of the buffer there is a problem with the document\n\t\tif(i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\")\n\t\tvar name = isArray ? arrayIndex++ : buffer.toString('utf8', index, i);\n\n\t\tindex = i + 1;\n\n\t\tif(elementType == BSON.BSON_DATA_STRING) {\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\tif(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n object[name] = buffer.toString('utf8', index, index + stringSize - 1);\n index = index + stringSize;\n\t\t} else if(elementType == BSON.BSON_DATA_OID) {\n\t\t\tvar oid = new Buffer(12);\n\t\t\tbuffer.copy(oid, 0, index, index + 12);\n object[name] = new ObjectID(oid);\n index = index + 12;\n\t\t} else if(elementType == BSON.BSON_DATA_INT && promoteValues == false) {\n\t\t\tobject[name] = new Int32(buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24);\n\t\t} else if(elementType == BSON.BSON_DATA_INT) {\n object[name] = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t} else if(elementType == BSON.BSON_DATA_NUMBER && promoteValues == false) {\n\t\t\tobject[name] = new Double(buffer.readDoubleLE(index));\n\t\t\tindex = index + 8;\n\t\t} else if(elementType == BSON.BSON_DATA_NUMBER) {\n\t\t\tobject[name] = buffer.readDoubleLE(index);\n index = index + 8;\n\t\t} else if(elementType == BSON.BSON_DATA_DATE) {\n var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n object[name] = new Date(new Long(lowBits, highBits).toNumber());\n\t\t} else if(elementType == BSON.BSON_DATA_BOOLEAN) {\n\t\t\tif(buffer[index] != 0 && buffer[index] != 1) throw new Error('illegal boolean type value');\n object[name] = buffer[index++] == 1;\n\t\t} else if(elementType == BSON.BSON_DATA_OBJECT) {\n\t\t\tvar _index = index;\n var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;\n\t\t\tif(objectSize <= 0 || objectSize > (buffer.length - index)) throw new Error(\"bad embedded document length in bson\");\n\n\t\t\t// We have a raw value\n\t\t\tif(raw) {\n\t object[name] = buffer.slice(index, index + objectSize);\n\t\t\t} else {\n\t object[name] = deserializeObject(buffer, _index, options, false);\n\t\t\t}\n\n index = index + objectSize;\n\t\t} else if(elementType == BSON.BSON_DATA_ARRAY) {\n\t\t\tvar _index = index;\n var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;\n\t\t\tvar arrayOptions = options;\n\n\t\t\t// Stop index\n\t\t\tvar stopIndex = index + objectSize;\n\n\t\t\t// All elements of array to be returned as raw bson\n\t\t\tif(fieldsAsRaw && fieldsAsRaw[name]) {\n\t\t\t\tarrayOptions = {};\n\t\t\t\tfor(var n in options) arrayOptions[n] = options[n];\n\t\t\t\tarrayOptions['raw'] = true;\n\t\t\t}\n\n object[name] = deserializeObject(buffer, _index, arrayOptions, true);\n index = index + objectSize;\n\n\t\t\tif(buffer[index - 1] != 0) throw new Error('invalid array terminator byte');\n\t\t\tif(index != stopIndex) throw new Error('corrupted array bson');\n\t\t} else if(elementType == BSON.BSON_DATA_UNDEFINED) {\n object[name] = undefined;\n\t\t} else if(elementType == BSON.BSON_DATA_NULL) {\n\t\t\tobject[name] = null;\n\t\t} else if(elementType == BSON.BSON_DATA_LONG) {\n // Unpack the low and high bits\n var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var long = new Long(lowBits, highBits);\n // Promote the long if possible\n if(promoteLongs && promoteValues == true) {\n object[name] = long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG) ? long.toNumber() : long;\n } else {\n object[name] = long;\n }\n\t\t} else if(elementType == BSON.BSON_DATA_DECIMAL128) {\n\t\t\t// Buffer to contain the decimal bytes\n\t\t\tvar bytes = new Buffer(16);\n\t\t\t// Copy the next 16 bytes into the bytes buffer\n\t\t\tbuffer.copy(bytes, 0, index, index + 16);\n\t\t\t// Update index\n\t\t\tindex = index + 16;\n\t\t\t// Assign the new Decimal128 value\n\t\t\tvar decimal128 = new Decimal128(bytes);\n\t\t\t// If we have an alternative mapper use that\n\t\t\tobject[name] = decimal128.toObject ? decimal128.toObject() : decimal128;\n\t\t} else if(elementType == BSON.BSON_DATA_BINARY) {\n var binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\tvar totalBinarySize = binarySize;\n var subType = buffer[index++];\n\n\t\t\t// Did we have a negative binary size, throw\n\t\t\tif(binarySize < 0) throw new Error('Negative binary type element size found');\n\n\t\t\t// Is the length longer than the document\n\t\t\tif(binarySize > buffer.length) throw new Error('Binary type size larger than document size');\n\n\t\t\t// Decode as raw Buffer object if options specifies it\n if(buffer['slice'] != null) {\n // If we have subtype 2 skip the 4 bytes for the size\n if(subType == Binary.SUBTYPE_BYTE_ARRAY) {\n binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\t\t\tif(binarySize < 0) throw new Error('Negative binary type element size found for subtype 0x02');\n\t\t\t\t\tif(binarySize > (totalBinarySize - 4)) throw new Error('Binary type with subtype 0x02 contains to long binary size');\n\t\t\t\t\tif(binarySize < (totalBinarySize - 4)) throw new Error('Binary type with subtype 0x02 contains to short binary size');\n }\n\n if(promoteBuffers && promoteValues) {\n object[name] = buffer.slice(index, index + binarySize);\n } else {\n object[name] = new Binary(buffer.slice(index, index + binarySize), subType);\n }\n } else {\n var _buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(binarySize)) : new Array(binarySize);\n // If we have subtype 2 skip the 4 bytes for the size\n if(subType == Binary.SUBTYPE_BYTE_ARRAY) {\n binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\t\t\tif(binarySize < 0) throw new Error('Negative binary type element size found for subtype 0x02');\n\t\t\t\t\tif(binarySize > (totalBinarySize - 4)) throw new Error('Binary type with subtype 0x02 contains to long binary size');\n\t\t\t\t\tif(binarySize < (totalBinarySize - 4)) throw new Error('Binary type with subtype 0x02 contains to short binary size');\n }\n\n // Copy the data\n for(var i = 0; i < binarySize; i++) {\n _buffer[i] = buffer[index + i];\n }\n\n if(promoteBuffers && promoteValues) {\n object[name] = _buffer;\n } else {\n object[name] = new Binary(_buffer, subType);\n }\n }\n\n // Update the index\n index = index + binarySize;\n\t\t} else if(elementType == BSON.BSON_DATA_REGEXP && bsonRegExp == false) {\n\t\t\t// Get the start search index\n\t\t\tvar i = index;\n\t\t\t// Locate the end of the c string\n\t\t\twhile(buffer[i] !== 0x00 && i < buffer.length) {\n\t\t\t\ti++\n\t\t\t}\n\t\t\t// If are at the end of the buffer there is a problem with the document\n\t\t\tif(i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\")\n\t\t\t// Return the C string\n\t\t\tvar source = buffer.toString('utf8', index, i);\n // Create the regexp\n\t\t\tindex = i + 1;\n\n\t\t\t// Get the start search index\n\t\t\tvar i = index;\n\t\t\t// Locate the end of the c string\n\t\t\twhile(buffer[i] !== 0x00 && i < buffer.length) {\n\t\t\t\ti++\n\t\t\t}\n\t\t\t// If are at the end of the buffer there is a problem with the document\n\t\t\tif(i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\")\n\t\t\t// Return the C string\n\t\t\tvar regExpOptions = buffer.toString('utf8', index, i);\n\t\t\tindex = i + 1;\n\n // For each option add the corresponding one for javascript\n var optionsArray = new Array(regExpOptions.length);\n\n // Parse options\n for(var i = 0; i < regExpOptions.length; i++) {\n switch(regExpOptions[i]) {\n case 'm':\n optionsArray[i] = 'm';\n break;\n case 's':\n optionsArray[i] = 'g';\n break;\n case 'i':\n optionsArray[i] = 'i';\n break;\n }\n }\n\n object[name] = new RegExp(source, optionsArray.join(''));\n } else if(elementType == BSON.BSON_DATA_REGEXP && bsonRegExp == true) {\n\t\t\t// Get the start search index\n\t\t\tvar i = index;\n\t\t\t// Locate the end of the c string\n\t\t\twhile(buffer[i] !== 0x00 && i < buffer.length) {\n\t\t\t\ti++\n\t\t\t}\n\t\t\t// If are at the end of the buffer there is a problem with the document\n\t\t\tif(i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\")\n\t\t\t// Return the C string\n\t\t\tvar source = buffer.toString('utf8', index, i);\n index = i + 1;\n\n\t\t\t// Get the start search index\n\t\t\tvar i = index;\n\t\t\t// Locate the end of the c string\n\t\t\twhile(buffer[i] !== 0x00 && i < buffer.length) {\n\t\t\t\ti++\n\t\t\t}\n\t\t\t// If are at the end of the buffer there is a problem with the document\n\t\t\tif(i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\")\n\t\t\t// Return the C string\n\t\t\tvar regExpOptions = buffer.toString('utf8', index, i);\n index = i + 1;\n\n // Set the object\n object[name] = new BSONRegExp(source, regExpOptions);\n\t\t} else if(elementType == BSON.BSON_DATA_SYMBOL) {\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\tif(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n object[name] = new Symbol(buffer.toString('utf8', index, index + stringSize - 1));\n index = index + stringSize;\n\t\t} else if(elementType == BSON.BSON_DATA_TIMESTAMP) {\n var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n object[name] = new Timestamp(lowBits, highBits);\n\t\t} else if(elementType == BSON.BSON_DATA_MIN_KEY) {\n object[name] = new MinKey();\n\t\t} else if(elementType == BSON.BSON_DATA_MAX_KEY) {\n object[name] = new MaxKey();\n\t\t} else if(elementType == BSON.BSON_DATA_CODE) {\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\tif(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n var functionString = buffer.toString('utf8', index, index + stringSize - 1);\n\n // If we are evaluating the functions\n if(evalFunctions) {\n var value = null;\n // If we have cache enabled let's look for the md5 of the function in the cache\n if(cacheFunctions) {\n var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString;\n // Got to do this to avoid V8 deoptimizing the call due to finding eval\n object[name] = isolateEvalWithHash(functionCache, hash, functionString, object);\n } else {\n object[name] = isolateEval(functionString);\n }\n } else {\n object[name] = new Code(functionString);\n }\n\n // Update parse index position\n index = index + stringSize;\n\t\t} else if(elementType == BSON.BSON_DATA_CODE_W_SCOPE) {\n var totalSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n\t\t\t// Element cannot be shorter than totalSize + stringSize + documentSize + terminator\n\t\t\tif(totalSize < (4 + 4 + 4 + 1)) {\n\t\t\t\tthrow new Error(\"code_w_scope total size shorter minimum expected length\");\n\t\t\t}\n\n\t\t\t// Get the code string size\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\t// Check if we have a valid string\n\t\t\tif(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n\n // Javascript function\n var functionString = buffer.toString('utf8', index, index + stringSize - 1);\n // Update parse index position\n index = index + stringSize;\n // Parse the element\n\t\t\tvar _index = index;\n // Decode the size of the object document\n var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;\n // Decode the scope object\n var scopeObject = deserializeObject(buffer, _index, options, false);\n // Adjust the index\n index = index + objectSize;\n\n\t\t\t// Check if field length is to short\n\t\t\tif(totalSize < (4 + 4 + objectSize + stringSize)) {\n\t\t\t\tthrow new Error('code_w_scope total size is to short, truncating scope');\n\t\t\t}\n\n\t\t\t// Check if totalSize field is to long\n\t\t\tif(totalSize > (4 + 4 + objectSize + stringSize)) {\n\t\t\t\tthrow new Error('code_w_scope total size is to long, clips outer document');\n\t\t\t}\n\n // If we are evaluating the functions\n if(evalFunctions) {\n // Contains the value we are going to set\n var value = null;\n // If we have cache enabled let's look for the md5 of the function in the cache\n if(cacheFunctions) {\n var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString;\n // Got to do this to avoid V8 deoptimizing the call due to finding eval\n object[name] = isolateEvalWithHash(functionCache, hash, functionString, object);\n } else {\n object[name] = isolateEval(functionString);\n }\n\n object[name].scope = scopeObject;\n } else {\n object[name] = new Code(functionString, scopeObject);\n }\n\t\t} else if(elementType == BSON.BSON_DATA_DBPOINTER) {\n\t\t\t// Get the code string size\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\t// Check if we have a valid string\n\t\t\tif(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n\t\t\t// Namespace\n var namespace = buffer.toString('utf8', index, index + stringSize - 1);\n\t\t\t// Update parse index position\n index = index + stringSize;\n\n\t\t\t// Read the oid\n\t\t\tvar oidBuffer = new Buffer(12);\n\t\t\tbuffer.copy(oidBuffer, 0, index, index + 12);\n var oid = new ObjectID(oidBuffer);\n\n\t\t\t// Update the index\n\t\t\tindex = index + 12;\n\n\t\t\t// Split the namespace\n\t\t\tvar parts = namespace.split('.');\n\t\t\tvar db = parts.shift();\n\t\t\tvar collection = parts.join('.');\n\t\t\t// Upgrade to DBRef type\n\t\t\tobject[name] = new DBRef(collection, oid, db);\n } else {\n\t\t\tthrow new Error(\"Detected unknown BSON type \" + elementType.toString(16) + \" for fieldname \\\"\" + name + \"\\\", are you using the latest BSON parser\");\n\t\t}\n }\n\n\t// Check if the deserialization was against a valid array/object\n\tif(size != (index - startIndex)) {\n\t\tif(isArray) throw new Error('corrupt array bson');\n\t\tthrow new Error('corrupt object bson');\n\t}\n\n // Check if we have a db ref object\n if(object['$id'] != null) object = new DBRef(object['$ref'], object['$id'], object['$db']);\n return object;\n}\n\n/**\n * Ensure eval is isolated.\n *\n * @ignore\n * @api private\n */\nvar isolateEvalWithHash = function(functionCache, hash, functionString, object) {\n // Contains the value we are going to set\n var value = null;\n\n // Check for cache hit, eval if missing and return cached function\n if(functionCache[hash] == null) {\n eval(\"value = \" + functionString);\n functionCache[hash] = value;\n }\n // Set the object\n return functionCache[hash].bind(object);\n}\n\n/**\n * Ensure eval is isolated.\n *\n * @ignore\n * @api private\n */\nvar isolateEval = function(functionString) {\n // Contains the value we are going to set\n var value = null;\n // Eval the function\n eval(\"value = \" + functionString);\n return value;\n}\n\nvar BSON = {};\n\n/**\n * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5\n *\n * @ignore\n * @api private\n */\nvar functionCache = BSON.functionCache = {};\n\n/**\n * Number BSON Type\n *\n * @classconstant BSON_DATA_NUMBER\n **/\nBSON.BSON_DATA_NUMBER = 1;\n/**\n * String BSON Type\n *\n * @classconstant BSON_DATA_STRING\n **/\nBSON.BSON_DATA_STRING = 2;\n/**\n * Object BSON Type\n *\n * @classconstant BSON_DATA_OBJECT\n **/\nBSON.BSON_DATA_OBJECT = 3;\n/**\n * Array BSON Type\n *\n * @classconstant BSON_DATA_ARRAY\n **/\nBSON.BSON_DATA_ARRAY = 4;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_BINARY\n **/\nBSON.BSON_DATA_BINARY = 5;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_UNDEFINED\n **/\nBSON.BSON_DATA_UNDEFINED = 6;\n/**\n * ObjectID BSON Type\n *\n * @classconstant BSON_DATA_OID\n **/\nBSON.BSON_DATA_OID = 7;\n/**\n * Boolean BSON Type\n *\n * @classconstant BSON_DATA_BOOLEAN\n **/\nBSON.BSON_DATA_BOOLEAN = 8;\n/**\n * Date BSON Type\n *\n * @classconstant BSON_DATA_DATE\n **/\nBSON.BSON_DATA_DATE = 9;\n/**\n * null BSON Type\n *\n * @classconstant BSON_DATA_NULL\n **/\nBSON.BSON_DATA_NULL = 10;\n/**\n * RegExp BSON Type\n *\n * @classconstant BSON_DATA_REGEXP\n **/\nBSON.BSON_DATA_REGEXP = 11;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_DBPOINTER\n **/\nBSON.BSON_DATA_DBPOINTER = 12;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_CODE\n **/\nBSON.BSON_DATA_CODE = 13;\n/**\n * Symbol BSON Type\n *\n * @classconstant BSON_DATA_SYMBOL\n **/\nBSON.BSON_DATA_SYMBOL = 14;\n/**\n * Code with Scope BSON Type\n *\n * @classconstant BSON_DATA_CODE_W_SCOPE\n **/\nBSON.BSON_DATA_CODE_W_SCOPE = 15;\n/**\n * 32 bit Integer BSON Type\n *\n * @classconstant BSON_DATA_INT\n **/\nBSON.BSON_DATA_INT = 16;\n/**\n * Timestamp BSON Type\n *\n * @classconstant BSON_DATA_TIMESTAMP\n **/\nBSON.BSON_DATA_TIMESTAMP = 17;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_LONG\n **/\nBSON.BSON_DATA_LONG = 18;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_DECIMAL128\n **/\nBSON.BSON_DATA_DECIMAL128 = 19;\n/**\n * MinKey BSON Type\n *\n * @classconstant BSON_DATA_MIN_KEY\n **/\nBSON.BSON_DATA_MIN_KEY = 0xff;\n/**\n * MaxKey BSON Type\n *\n * @classconstant BSON_DATA_MAX_KEY\n **/\nBSON.BSON_DATA_MAX_KEY = 0x7f;\n\n/**\n * Binary Default Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_DEFAULT\n **/\nBSON.BSON_BINARY_SUBTYPE_DEFAULT = 0;\n/**\n * Binary Function Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_FUNCTION\n **/\nBSON.BSON_BINARY_SUBTYPE_FUNCTION = 1;\n/**\n * Binary Byte Array Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY\n **/\nBSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;\n/**\n * Binary UUID Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_UUID\n **/\nBSON.BSON_BINARY_SUBTYPE_UUID = 3;\n/**\n * Binary MD5 Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_MD5\n **/\nBSON.BSON_BINARY_SUBTYPE_MD5 = 4;\n/**\n * Binary User Defined Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED\n **/\nBSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128;\n\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\nBSON.BSON_INT64_MAX = Math.pow(2, 63) - 1;\nBSON.BSON_INT64_MIN = -Math.pow(2, 63);\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\n// Internal long versions\nvar JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double.\nvar JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double.\n\nmodule.exports = deserialize\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/parser/deserializer.js","\"use strict\"\n\nvar writeIEEE754 = require('../float_parser').writeIEEE754,\n readIEEE754 = require('../float_parser').readIEEE754,\n Long = require('../long').Long,\n Map = require('../map'),\n Double = require('../double').Double,\n Timestamp = require('../timestamp').Timestamp,\n ObjectID = require('../objectid').ObjectID,\n Symbol = require('../symbol').Symbol,\n Code = require('../code').Code,\n BSONRegExp = require('../regexp').BSONRegExp,\n Int32 = require('../int_32').Int32,\n MinKey = require('../min_key').MinKey,\n MaxKey = require('../max_key').MaxKey,\n Decimal128 = require('../decimal128'),\n DBRef = require('../db_ref').DBRef,\n Binary = require('../binary').Binary;\n\ntry {\n var _Buffer = Uint8Array;\n} catch(e) {\n var _Buffer = Buffer;\n}\n\nvar regexp = /\\x00/\n\n// To ensure that 0.4 of node works correctly\nvar isDate = function isDate(d) {\n return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]';\n}\n\nvar isRegExp = function isRegExp(d) {\n return Object.prototype.toString.call(d) === '[object RegExp]';\n}\n\nvar serializeString = function(buffer, key, value, index, isArray) {\n // Encode String type\n buffer[index++] = BSON.BSON_DATA_STRING;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes + 1;\n buffer[index - 1] = 0;\n // Write the string\n var size = buffer.write(value, index + 4, 'utf8');\n // Write the size of the string to buffer\n buffer[index + 3] = (size + 1 >> 24) & 0xff;\n buffer[index + 2] = (size + 1 >> 16) & 0xff;\n buffer[index + 1] = (size + 1 >> 8) & 0xff;\n buffer[index] = size + 1 & 0xff;\n // Update index\n index = index + 4 + size;\n // Write zero\n buffer[index++] = 0;\n return index;\n}\n\nvar serializeNumber = function(buffer, key, value, index, isArray) {\n // We have an integer value\n if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) {\n // If the value fits in 32 bits encode as int, if it fits in a double\n // encode it as a double, otherwise long\n if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) {\n // Set int type 32 bits or less\n buffer[index++] = BSON.BSON_DATA_INT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the int value\n buffer[index++] = value & 0xff;\n buffer[index++] = (value >> 8) & 0xff;\n buffer[index++] = (value >> 16) & 0xff;\n buffer[index++] = (value >> 24) & 0xff;\n } else if(value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) {\n // Encode as double\n buffer[index++] = BSON.BSON_DATA_NUMBER;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write float\n writeIEEE754(buffer, value, index, 'little', 52, 8);\n // Ajust index\n index = index + 8;\n } else {\n // Set long type\n buffer[index++] = BSON.BSON_DATA_LONG;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n var longVal = Long.fromNumber(value);\n var lowBits = longVal.getLowBits();\n var highBits = longVal.getHighBits();\n // Encode low bits\n buffer[index++] = lowBits & 0xff;\n buffer[index++] = (lowBits >> 8) & 0xff;\n buffer[index++] = (lowBits >> 16) & 0xff;\n buffer[index++] = (lowBits >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = highBits & 0xff;\n buffer[index++] = (highBits >> 8) & 0xff;\n buffer[index++] = (highBits >> 16) & 0xff;\n buffer[index++] = (highBits >> 24) & 0xff;\n }\n } else {\n // Encode as double\n buffer[index++] = BSON.BSON_DATA_NUMBER;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write float\n writeIEEE754(buffer, value, index, 'little', 52, 8);\n // Ajust index\n index = index + 8;\n }\n\n return index;\n}\n\nvar serializeNull = function(buffer, key, value, index, isArray) {\n // Set long type\n buffer[index++] = BSON.BSON_DATA_NULL;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n return index;\n}\n\nvar serializeBoolean = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_BOOLEAN;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Encode the boolean value\n buffer[index++] = value ? 1 : 0;\n return index;\n}\n\nvar serializeDate = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_DATE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Write the date\n var dateInMilis = Long.fromNumber(value.getTime());\n var lowBits = dateInMilis.getLowBits();\n var highBits = dateInMilis.getHighBits();\n // Encode low bits\n buffer[index++] = lowBits & 0xff;\n buffer[index++] = (lowBits >> 8) & 0xff;\n buffer[index++] = (lowBits >> 16) & 0xff;\n buffer[index++] = (lowBits >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = highBits & 0xff;\n buffer[index++] = (highBits >> 8) & 0xff;\n buffer[index++] = (highBits >> 16) & 0xff;\n buffer[index++] = (highBits >> 24) & 0xff;\n return index;\n}\n\nvar serializeRegExp = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_REGEXP;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n if (value.source && value.source.match(regexp) != null) {\n throw Error(\"value \" + value.source + \" must not contain null bytes\");\n }\n // Adjust the index\n index = index + buffer.write(value.source, index, 'utf8');\n // Write zero\n buffer[index++] = 0x00;\n // Write the parameters\n if(value.global) buffer[index++] = 0x73; // s\n if(value.ignoreCase) buffer[index++] = 0x69; // i\n if(value.multiline) buffer[index++] = 0x6d; // m\n // Add ending zero\n buffer[index++] = 0x00;\n return index;\n}\n\nvar serializeBSONRegExp = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_REGEXP;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Check the pattern for 0 bytes\n if (value.pattern.match(regexp) != null) {\n // The BSON spec doesn't allow keys with null bytes because keys are\n // null-terminated.\n throw Error(\"pattern \" + value.pattern + \" must not contain null bytes\");\n }\n\n // Adjust the index\n index = index + buffer.write(value.pattern, index, 'utf8');\n // Write zero\n buffer[index++] = 0x00;\n // Write the options\n index = index + buffer.write(value.options.split('').sort().join(''), index, 'utf8');\n // Add ending zero\n buffer[index++] = 0x00;\n return index;\n}\n\nvar serializeMinMax = function(buffer, key, value, index, isArray) {\n // Write the type of either min or max key\n if(value === null) {\n buffer[index++] = BSON.BSON_DATA_NULL;\n } else if(value instanceof MinKey) {\n buffer[index++] = BSON.BSON_DATA_MIN_KEY;\n } else {\n buffer[index++] = BSON.BSON_DATA_MAX_KEY;\n }\n\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n return index;\n}\n\nvar serializeObjectId = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_OID;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Write the objectId into the shared buffer\n if(typeof value.id == 'string') {\n buffer.write(value.id, index, 'binary')\n } else if(value.id && value.id.copy){\n value.id.copy(buffer, index, 0, 12);\n } else {\n throw new Error('object [' + JSON.stringify(value) + \"] is not a valid ObjectId\");\n }\n\n // Ajust index\n return index + 12;\n}\n\nvar serializeBuffer = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_BINARY;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Get size of the buffer (current write point)\n var size = value.length;\n // Write the size of the string to buffer\n buffer[index++] = size & 0xff;\n buffer[index++] = (size >> 8) & 0xff;\n buffer[index++] = (size >> 16) & 0xff;\n buffer[index++] = (size >> 24) & 0xff;\n // Write the default subtype\n buffer[index++] = BSON.BSON_BINARY_SUBTYPE_DEFAULT;\n // Copy the content form the binary field to the buffer\n value.copy(buffer, index, 0, size);\n // Adjust the index\n index = index + size;\n return index;\n}\n\nvar serializeObject = function(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, isArray, path) {\n for(var i = 0; i < path.length; i++) {\n if(path[i] === value) throw new Error('cyclic dependency detected');\n }\n\n // Push value to stack\n path.push(value);\n // Write the type\n buffer[index++] = Array.isArray(value) ? BSON.BSON_DATA_ARRAY : BSON.BSON_DATA_OBJECT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n var endIndex = serializeInto(buffer, value, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined, path);\n // Pop stack\n path.pop();\n // Write size\n var size = endIndex - index;\n return endIndex;\n}\n\nvar serializeDecimal128 = function(buffer, key, value, index, isArray) {\n buffer[index++] = BSON.BSON_DATA_DECIMAL128;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the data from the value\n value.bytes.copy(buffer, index, 0, 16);\n return index + 16;\n}\n\nvar serializeLong = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = value._bsontype == 'Long' ? BSON.BSON_DATA_LONG : BSON.BSON_DATA_TIMESTAMP;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the date\n var lowBits = value.getLowBits();\n var highBits = value.getHighBits();\n // Encode low bits\n buffer[index++] = lowBits & 0xff;\n buffer[index++] = (lowBits >> 8) & 0xff;\n buffer[index++] = (lowBits >> 16) & 0xff;\n buffer[index++] = (lowBits >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = highBits & 0xff;\n buffer[index++] = (highBits >> 8) & 0xff;\n buffer[index++] = (highBits >> 16) & 0xff;\n buffer[index++] = (highBits >> 24) & 0xff;\n return index;\n}\n\nvar serializeInt32 = function(buffer, key, value, index, isArray) {\n // Set int type 32 bits or less\n buffer[index++] = BSON.BSON_DATA_INT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the int value\n buffer[index++] = value & 0xff;\n buffer[index++] = (value >> 8) & 0xff;\n buffer[index++] = (value >> 16) & 0xff;\n buffer[index++] = (value >> 24) & 0xff;\n return index;\n}\n\nvar serializeDouble = function(buffer, key, value, index, isArray) {\n // Encode as double\n buffer[index++] = BSON.BSON_DATA_NUMBER;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write float\n writeIEEE754(buffer, value, index, 'little', 52, 8);\n // Ajust index\n index = index + 8;\n return index;\n}\n\nvar serializeFunction = function(buffer, key, value, index, checkKeys, depth, isArray) {\n buffer[index++] = BSON.BSON_DATA_CODE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Function string\n var functionString = value.toString();\n // Write the string\n var size = buffer.write(functionString, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = size & 0xff;\n buffer[index + 1] = (size >> 8) & 0xff;\n buffer[index + 2] = (size >> 16) & 0xff;\n buffer[index + 3] = (size >> 24) & 0xff;\n // Update index\n index = index + 4 + size - 1;\n // Write zero\n buffer[index++] = 0;\n return index;\n}\n\nvar serializeCode = function(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, isArray) {\n if(value.scope && typeof value.scope == 'object') {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Starting index\n var startIndex = index;\n\n // Serialize the function\n // Get the function string\n var functionString = typeof value.code == 'string' ? value.code : value.code.toString();\n // Index adjustment\n index = index + 4;\n // Write string into buffer\n var codeSize = buffer.write(functionString, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = codeSize & 0xff;\n buffer[index + 1] = (codeSize >> 8) & 0xff;\n buffer[index + 2] = (codeSize >> 16) & 0xff;\n buffer[index + 3] = (codeSize >> 24) & 0xff;\n // Write end 0\n buffer[index + 4 + codeSize - 1] = 0;\n // Write the\n index = index + codeSize + 4;\n\n //\n // Serialize the scope value\n var endIndex = serializeInto(buffer, value.scope, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined)\n index = endIndex - 1;\n\n // Writ the total\n var totalSize = endIndex - startIndex;\n\n // Write the total size of the object\n buffer[startIndex++] = totalSize & 0xff;\n buffer[startIndex++] = (totalSize >> 8) & 0xff;\n buffer[startIndex++] = (totalSize >> 16) & 0xff;\n buffer[startIndex++] = (totalSize >> 24) & 0xff;\n // Write trailing zero\n buffer[index++] = 0;\n } else {\n buffer[index++] = BSON.BSON_DATA_CODE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Function string\n var functionString = value.code.toString();\n // Write the string\n var size = buffer.write(functionString, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = size & 0xff;\n buffer[index + 1] = (size >> 8) & 0xff;\n buffer[index + 2] = (size >> 16) & 0xff;\n buffer[index + 3] = (size >> 24) & 0xff;\n // Update index\n index = index + 4 + size - 1;\n // Write zero\n buffer[index++] = 0;\n }\n\n return index;\n}\n\nvar serializeBinary = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_BINARY;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Extract the buffer\n var data = value.value(true);\n // Calculate size\n var size = value.position;\n // Add the deprecated 02 type 4 bytes of size to total\n if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) size = size + 4;\n // Write the size of the string to buffer\n buffer[index++] = size & 0xff;\n buffer[index++] = (size >> 8) & 0xff;\n buffer[index++] = (size >> 16) & 0xff;\n buffer[index++] = (size >> 24) & 0xff;\n // Write the subtype to the buffer\n buffer[index++] = value.sub_type;\n\n // If we have binary type 2 the 4 first bytes are the size\n if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) {\n size = size - 4;\n buffer[index++] = size & 0xff;\n buffer[index++] = (size >> 8) & 0xff;\n buffer[index++] = (size >> 16) & 0xff;\n buffer[index++] = (size >> 24) & 0xff;\n }\n\n // Write the data to the object\n data.copy(buffer, index, 0, value.position);\n // Adjust the index\n index = index + value.position;\n return index;\n}\n\nvar serializeSymbol = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_SYMBOL;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the string\n var size = buffer.write(value.value, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = size & 0xff;\n buffer[index + 1] = (size >> 8) & 0xff;\n buffer[index + 2] = (size >> 16) & 0xff;\n buffer[index + 3] = (size >> 24) & 0xff;\n // Update index\n index = index + 4 + size - 1;\n // Write zero\n buffer[index++] = 0x00;\n return index;\n}\n\nvar serializeDBRef = function(buffer, key, value, index, depth, serializeFunctions, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_OBJECT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n var startIndex = index;\n var endIndex;\n\n // Serialize object\n if(null != value.db) {\n endIndex = serializeInto(buffer, {\n '$ref': value.namespace\n , '$id' : value.oid\n , '$db' : value.db\n }, false, index, depth + 1, serializeFunctions);\n } else {\n endIndex = serializeInto(buffer, {\n '$ref': value.namespace\n , '$id' : value.oid\n }, false, index, depth + 1, serializeFunctions);\n }\n\n // Calculate object size\n var size = endIndex - startIndex;\n // Write the size\n buffer[startIndex++] = size & 0xff;\n buffer[startIndex++] = (size >> 8) & 0xff;\n buffer[startIndex++] = (size >> 16) & 0xff;\n buffer[startIndex++] = (size >> 24) & 0xff;\n // Set index\n return endIndex;\n}\n\nvar serializeInto = function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializeFunctions, ignoreUndefined, path) {\n startingIndex = startingIndex || 0;\n path = path || [];\n\n // Push the object to the path\n path.push(object);\n\n // Start place to serialize into\n var index = startingIndex + 4;\n var self = this;\n\n // Special case isArray\n if(Array.isArray(object)) {\n // Get object keys\n for(var i = 0; i < object.length; i++) {\n var key = \"\" + i;\n var value = object[i];\n\n // Is there an override value\n if(value && value.toBSON) {\n if(typeof value.toBSON != 'function') throw new Error(\"toBSON is not a function\");\n value = value.toBSON();\n }\n\n var type = typeof value;\n if(type == 'string') {\n index = serializeString(buffer, key, value, index, true);\n } else if(type == 'number') {\n index = serializeNumber(buffer, key, value, index, true);\n } else if(type == 'boolean') {\n index = serializeBoolean(buffer, key, value, index, true);\n } else if(value instanceof Date || isDate(value)) {\n index = serializeDate(buffer, key, value, index, true);\n } else if(value === undefined) {\n index = serializeNull(buffer, key, value, index, true);\n } else if(value === null) {\n index = serializeNull(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'ObjectID') {\n index = serializeObjectId(buffer, key, value, index, true);\n } else if(Buffer.isBuffer(value)) {\n index = serializeBuffer(buffer, key, value, index, true);\n } else if(value instanceof RegExp || isRegExp(value)) {\n index = serializeRegExp(buffer, key, value, index, true);\n } else if(type == 'object' && value['_bsontype'] == null) {\n index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, true, path);\n } else if(type == 'object' && value['_bsontype'] == 'Decimal128') {\n index = serializeDecimal128(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {\n index = serializeLong(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'Double') {\n index = serializeDouble(buffer, key, value, index, true);\n } else if(typeof value == 'function' && serializeFunctions) {\n index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions, true);\n } else if(value['_bsontype'] == 'Code') {\n index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, true);\n } else if(value['_bsontype'] == 'Binary') {\n index = serializeBinary(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'Symbol') {\n index = serializeSymbol(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'DBRef') {\n index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, true);\n } else if(value['_bsontype'] == 'BSONRegExp') {\n index = serializeBSONRegExp(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'Int32') {\n index = serializeInt32(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n index = serializeMinMax(buffer, key, value, index, true);\n }\n }\n } else if(object instanceof Map) {\n var iterator = object.entries();\n var done = false;\n\n while(!done) {\n // Unpack the next entry\n var entry = iterator.next();\n done = entry.done;\n // Are we done, then skip and terminate\n if(done) continue;\n\n // Get the entry values\n var key = entry.value[0];\n var value = entry.value[1];\n\n // Check the type of the value\n var type = typeof value;\n\n // Check the key and throw error if it's illegal\n if(key != '$db' && key != '$ref' && key != '$id') {\n if (key.match(regexp) != null) {\n // The BSON spec doesn't allow keys with null bytes because keys are\n // null-terminated.\n throw Error(\"key \" + key + \" must not contain null bytes\");\n }\n\n if (checkKeys) {\n if('$' == key[0]) {\n throw Error(\"key \" + key + \" must not start with '$'\");\n } else if (!!~key.indexOf('.')) {\n throw Error(\"key \" + key + \" must not contain '.'\");\n }\n }\n }\n\n if(type == 'string') {\n index = serializeString(buffer, key, value, index);\n } else if(type == 'number') {\n index = serializeNumber(buffer, key, value, index);\n } else if(type == 'boolean') {\n index = serializeBoolean(buffer, key, value, index);\n } else if(value instanceof Date || isDate(value)) {\n index = serializeDate(buffer, key, value, index);\n } else if(value === undefined && ignoreUndefined == true) {\n } else if(value === null || value === undefined) {\n index = serializeNull(buffer, key, value, index);\n } else if(value['_bsontype'] == 'ObjectID') {\n index = serializeObjectId(buffer, key, value, index);\n } else if(Buffer.isBuffer(value)) {\n index = serializeBuffer(buffer, key, value, index);\n } else if(value instanceof RegExp || isRegExp(value)) {\n index = serializeRegExp(buffer, key, value, index);\n } else if(type == 'object' && value['_bsontype'] == null) {\n index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, false, path);\n } else if(type == 'object' && value['_bsontype'] == 'Decimal128') {\n index = serializeDecimal128(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {\n index = serializeLong(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Double') {\n index = serializeDouble(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Code') {\n index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined);\n } else if(typeof value == 'function' && serializeFunctions) {\n index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions);\n } else if(value['_bsontype'] == 'Binary') {\n index = serializeBinary(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Symbol') {\n index = serializeSymbol(buffer, key, value, index);\n } else if(value['_bsontype'] == 'DBRef') {\n index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions);\n } else if(value['_bsontype'] == 'BSONRegExp') {\n index = serializeBSONRegExp(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Int32') {\n index = serializeInt32(buffer, key, value, index);\n } else if(value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n index = serializeMinMax(buffer, key, value, index);\n }\n }\n } else {\n // Did we provide a custom serialization method\n if(object.toBSON) {\n if(typeof object.toBSON != 'function') throw new Error(\"toBSON is not a function\");\n object = object.toBSON();\n if(object != null && typeof object != 'object') throw new Error(\"toBSON function did not return an object\");\n }\n\n // Iterate over all the keys\n for(var key in object) {\n var value = object[key];\n // Is there an override value\n if(value && value.toBSON) {\n if(typeof value.toBSON != 'function') throw new Error(\"toBSON is not a function\");\n value = value.toBSON();\n }\n\n // Check the type of the value\n var type = typeof value;\n\n // Check the key and throw error if it's illegal\n if(key != '$db' && key != '$ref' && key != '$id') {\n if (key.match(regexp) != null) {\n // The BSON spec doesn't allow keys with null bytes because keys are\n // null-terminated.\n throw Error(\"key \" + key + \" must not contain null bytes\");\n }\n\n if (checkKeys) {\n if('$' == key[0]) {\n throw Error(\"key \" + key + \" must not start with '$'\");\n } else if (!!~key.indexOf('.')) {\n throw Error(\"key \" + key + \" must not contain '.'\");\n }\n }\n }\n\n if(type == 'string') {\n index = serializeString(buffer, key, value, index);\n } else if(type == 'number') {\n index = serializeNumber(buffer, key, value, index);\n } else if(type == 'boolean') {\n index = serializeBoolean(buffer, key, value, index);\n } else if(value instanceof Date || isDate(value)) {\n index = serializeDate(buffer, key, value, index);\n } else if(value === undefined && ignoreUndefined == true) {\n } else if(value === null || value === undefined) {\n index = serializeNull(buffer, key, value, index);\n } else if(value['_bsontype'] == 'ObjectID') {\n index = serializeObjectId(buffer, key, value, index);\n } else if(Buffer.isBuffer(value)) {\n index = serializeBuffer(buffer, key, value, index);\n } else if(value instanceof RegExp || isRegExp(value)) {\n index = serializeRegExp(buffer, key, value, index);\n } else if(type == 'object' && value['_bsontype'] == null) {\n index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, false, path);\n } else if(type == 'object' && value['_bsontype'] == 'Decimal128') {\n index = serializeDecimal128(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {\n index = serializeLong(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Double') {\n index = serializeDouble(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Code') {\n index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined);\n } else if(typeof value == 'function' && serializeFunctions) {\n index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions);\n } else if(value['_bsontype'] == 'Binary') {\n index = serializeBinary(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Symbol') {\n index = serializeSymbol(buffer, key, value, index);\n } else if(value['_bsontype'] == 'DBRef') {\n index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions);\n } else if(value['_bsontype'] == 'BSONRegExp') {\n index = serializeBSONRegExp(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Int32') {\n index = serializeInt32(buffer, key, value, index);\n } else if(value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n index = serializeMinMax(buffer, key, value, index);\n }\n }\n }\n\n // Remove the path\n path.pop();\n\n // Final padding byte for object\n buffer[index++] = 0x00;\n\n // Final size\n var size = index - startingIndex;\n // Write the size of the object\n buffer[startingIndex++] = size & 0xff;\n buffer[startingIndex++] = (size >> 8) & 0xff;\n buffer[startingIndex++] = (size >> 16) & 0xff;\n buffer[startingIndex++] = (size >> 24) & 0xff;\n return index;\n}\n\nvar BSON = {};\n\n/**\n * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5\n *\n * @ignore\n * @api private\n */\nvar functionCache = BSON.functionCache = {};\n\n/**\n * Number BSON Type\n *\n * @classconstant BSON_DATA_NUMBER\n **/\nBSON.BSON_DATA_NUMBER = 1;\n/**\n * String BSON Type\n *\n * @classconstant BSON_DATA_STRING\n **/\nBSON.BSON_DATA_STRING = 2;\n/**\n * Object BSON Type\n *\n * @classconstant BSON_DATA_OBJECT\n **/\nBSON.BSON_DATA_OBJECT = 3;\n/**\n * Array BSON Type\n *\n * @classconstant BSON_DATA_ARRAY\n **/\nBSON.BSON_DATA_ARRAY = 4;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_BINARY\n **/\nBSON.BSON_DATA_BINARY = 5;\n/**\n * ObjectID BSON Type, deprecated\n *\n * @classconstant BSON_DATA_UNDEFINED\n **/\nBSON.BSON_DATA_UNDEFINED = 6;\n/**\n * ObjectID BSON Type\n *\n * @classconstant BSON_DATA_OID\n **/\nBSON.BSON_DATA_OID = 7;\n/**\n * Boolean BSON Type\n *\n * @classconstant BSON_DATA_BOOLEAN\n **/\nBSON.BSON_DATA_BOOLEAN = 8;\n/**\n * Date BSON Type\n *\n * @classconstant BSON_DATA_DATE\n **/\nBSON.BSON_DATA_DATE = 9;\n/**\n * null BSON Type\n *\n * @classconstant BSON_DATA_NULL\n **/\nBSON.BSON_DATA_NULL = 10;\n/**\n * RegExp BSON Type\n *\n * @classconstant BSON_DATA_REGEXP\n **/\nBSON.BSON_DATA_REGEXP = 11;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_CODE\n **/\nBSON.BSON_DATA_CODE = 13;\n/**\n * Symbol BSON Type\n *\n * @classconstant BSON_DATA_SYMBOL\n **/\nBSON.BSON_DATA_SYMBOL = 14;\n/**\n * Code with Scope BSON Type\n *\n * @classconstant BSON_DATA_CODE_W_SCOPE\n **/\nBSON.BSON_DATA_CODE_W_SCOPE = 15;\n/**\n * 32 bit Integer BSON Type\n *\n * @classconstant BSON_DATA_INT\n **/\nBSON.BSON_DATA_INT = 16;\n/**\n * Timestamp BSON Type\n *\n * @classconstant BSON_DATA_TIMESTAMP\n **/\nBSON.BSON_DATA_TIMESTAMP = 17;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_LONG\n **/\nBSON.BSON_DATA_LONG = 18;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_DECIMAL128\n **/\nBSON.BSON_DATA_DECIMAL128 = 19;\n/**\n * MinKey BSON Type\n *\n * @classconstant BSON_DATA_MIN_KEY\n **/\nBSON.BSON_DATA_MIN_KEY = 0xff;\n/**\n * MaxKey BSON Type\n *\n * @classconstant BSON_DATA_MAX_KEY\n **/\nBSON.BSON_DATA_MAX_KEY = 0x7f;\n/**\n * Binary Default Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_DEFAULT\n **/\nBSON.BSON_BINARY_SUBTYPE_DEFAULT = 0;\n/**\n * Binary Function Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_FUNCTION\n **/\nBSON.BSON_BINARY_SUBTYPE_FUNCTION = 1;\n/**\n * Binary Byte Array Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY\n **/\nBSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;\n/**\n * Binary UUID Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_UUID\n **/\nBSON.BSON_BINARY_SUBTYPE_UUID = 3;\n/**\n * Binary MD5 Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_MD5\n **/\nBSON.BSON_BINARY_SUBTYPE_MD5 = 4;\n/**\n * Binary User Defined Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED\n **/\nBSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128;\n\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\nBSON.BSON_INT64_MAX = Math.pow(2, 63) - 1;\nBSON.BSON_INT64_MIN = -Math.pow(2, 63);\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\n// Internal long versions\nvar JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double.\nvar JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double.\n\nmodule.exports = serializeInto;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/parser/serializer.js","/* global window, document, fetch */\n\nimport { createStorage } from './storage';\nimport { createProviders, PROVIDER_TYPE_MONGODB_CLOUD } from './providers';\nimport { StitchError } from '../errors';\nimport * as authCommon from './common';\nimport * as common from '../common';\nimport * as _platform from 'detect-browser';\n\nconst jwtDecode = require('jwt-decode');\n\nconst EMBEDDED_USER_AUTH_DATA_PARTS = 4;\n\nexport class AuthFactory {\n constructor() {\n throw new StitchError('Auth can only be made from the AuthFactory.create function');\n }\n\n static create(client, rootUrl, options) {\n return newAuth(client, rootUrl, options);\n }\n}\n\nexport function newAuth(client, rootUrl, options) {\n let auth = Object.create(Auth.prototype);\n let namespace;\n if (!client || client.clientAppID === '') {\n namespace = 'admin';\n } else {\n namespace = `client.${client.clientAppID}`;\n }\n\n options = Object.assign({\n codec: authCommon.APP_CLIENT_CODEC,\n namespace: namespace,\n storageType: 'localStorage'\n }, options);\n\n auth.client = client;\n auth.rootUrl = rootUrl;\n auth.codec = options.codec;\n auth.platform = options.platform || _platform;\n auth.storage = createStorage(options);\n auth.providers = createProviders(auth, options);\n\n return Promise.all([\n auth._get(),\n auth.storage.get(authCommon.REFRESH_TOKEN_KEY),\n auth.storage.get(authCommon.USER_LOGGED_IN_PT_KEY),\n auth.storage.get(authCommon.DEVICE_ID_KEY)\n ]).then(([authObj, rt, loggedInProviderType, deviceId]) => {\n auth.auth = authObj;\n auth.authedId = authObj.userId;\n auth.rt = rt;\n auth.loggedInProviderType = loggedInProviderType;\n auth.deviceId = deviceId;\n\n return auth;\n });\n}\n\nexport class Auth {\n constructor(client, rootUrl, options) {\n throw new StitchError('Auth can only be made from the AuthFactory.create function');\n }\n\n /**\n * Create the device info for this client.\n *\n * @memberof module:auth\n * @method getDeviceInfo\n * @param {String} appId The app ID for this client\n * @param {String} appVersion The version of the app\n * @returns {Object} The device info object\n */\n getDeviceInfo(deviceId, appId, appVersion = '') {\n const deviceInfo = { appId, appVersion, sdkVersion: common.SDK_VERSION };\n\n if (deviceId) {\n deviceInfo.deviceId = deviceId;\n }\n\n if (this.platform) {\n deviceInfo.platform = this.platform.name;\n deviceInfo.platformVersion = this.platform.version;\n }\n\n return deviceInfo;\n }\n\n provider(name) {\n if (!this.providers.hasOwnProperty(name)) {\n throw new Error('Invalid auth provider specified: ' + name);\n }\n\n return this.providers[name];\n }\n\n refreshToken() {\n return this.client.doSessionPost()\n .then((json) => this.set(json));\n }\n\n pageRootUrl() {\n return [window.location.protocol, '//', window.location.host, window.location.pathname].join('');\n }\n\n error() {\n return this._error;\n }\n\n isAppClient() {\n if (!this.client) {\n return true; // Handle the case where Auth is constructed with null\n }\n return this.client.type === common.APP_CLIENT_TYPE;\n }\n\n handleRedirect() {\n if (typeof (window) === 'undefined') {\n // This means we're running in some environment other\n // than a browser - so handling a redirect makes no sense here.\n return;\n }\n if (!window.location || !window.location.hash) {\n return;\n }\n\n let redirectProvider;\n return Promise.all([\n this.storage.get(authCommon.STATE_KEY),\n this.storage.get(authCommon.STITCH_REDIRECT_PROVIDER)\n ]).then(([ourState, _redirectProvider]) => {\n let redirectFragment = window.location.hash.substring(1);\n redirectProvider = _redirectProvider;\n const redirectState = this.parseRedirectFragment(redirectFragment, ourState);\n if (redirectState.lastError || !redirectProvider) {\n console.error(`StitchClient: error from redirect: ${redirectState.lastError ?\n redirectState.lastError : 'provider type not set'}`);\n this._error = redirectState.lastError;\n window.history.replaceState(null, '', this.pageRootUrl());\n return;\n }\n\n if (!redirectState.found) {\n return;\n }\n\n return Promise.all(\n [\n this.storage.remove(authCommon.STATE_KEY),\n this.storage.remove(authCommon.STITCH_REDIRECT_PROVIDER)\n ]\n ).then(() => redirectState);\n }).then((redirectState) => {\n if (!redirectState.stateValid) {\n console.error('StitchClient: state values did not match!');\n window.history.replaceState(null, '', this.pageRootUrl());\n return;\n }\n\n if (!redirectState.ua) {\n console.error('StitchClient: no UA value was returned from redirect!');\n return;\n }\n\n // If we get here, the state is valid - set auth appropriately.\n return this.set(redirectState.ua, redirectProvider);\n }).then(() => window.history.replaceState(null, '', this.pageRootUrl()));\n }\n\n getCookie(name) {\n let splitCookies = document.cookie.split(' ');\n for (let i = 0; i < splitCookies.length; i++) {\n let cookie = splitCookies[i];\n let sepIdx = cookie.indexOf('=');\n let cookieName = cookie.substring(0, sepIdx);\n if (cookieName === name) {\n let cookieVal = cookie.substring(sepIdx + 1, cookie.length);\n if (cookieVal[cookieVal.length - 1] === ';') {\n return cookieVal.substring(0, cookie.length - 1);\n }\n return cookieVal;\n }\n }\n }\n\n handleCookie() {\n if (typeof (window) === 'undefined' || typeof (document) === 'undefined') {\n // This means we're running in some environment other\n // than a browser - so handling a cookie makes no sense here.\n return;\n }\n if (!document.cookie) {\n return;\n }\n\n let uaCookie = this.getCookie(authCommon.USER_AUTH_COOKIE_NAME);\n if (!uaCookie) {\n return;\n }\n\n document.cookie = `${authCommon.USER_AUTH_COOKIE_NAME}=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT;`;\n const userAuth = this.unmarshallUserAuth(uaCookie);\n return this.set(userAuth, PROVIDER_TYPE_MONGODB_CLOUD).then(() =>\n window.history.replaceState(null, '', this.pageRootUrl())\n );\n }\n\n clear() {\n this.auth = null;\n this.authedId = null;\n this.rt = null;\n this.loggedInProviderType = null;\n\n return Promise.all(\n [\n this.storage.remove(authCommon.USER_AUTH_KEY),\n this.storage.remove(authCommon.REFRESH_TOKEN_KEY),\n this.storage.remove(authCommon.USER_LOGGED_IN_PT_KEY),\n this.storage.remove(authCommon.STITCH_REDIRECT_PROVIDER)\n ]\n );\n }\n\n getDeviceId() {\n return this.deviceId;\n }\n\n // Returns whether or not the access token is expired or is going to expire within 'withinSeconds'\n // seconds, according to current system time. Returns false if the token is malformed in any way.\n isAccessTokenExpired(withinSeconds = authCommon.DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS) {\n const token = this.getAccessToken();\n if (!token) {\n return false;\n }\n\n let decodedToken;\n try {\n decodedToken = jwtDecode(token);\n } catch (e) {\n return false;\n }\n\n if (!decodedToken) {\n return false;\n }\n\n return decodedToken.exp && Math.floor(Date.now() / 1000) >= decodedToken.exp - withinSeconds;\n }\n\n getAccessToken() {\n return this.auth.accessToken;\n }\n\n getRefreshToken() {\n return this.rt;\n }\n\n set(json, authType = '') {\n if (!json) {\n return;\n }\n\n let newUserAuth = {};\n let setters = [];\n\n if (authType) {\n this.loggedInProviderType = authType;\n setters.push(this.storage.set(authCommon.USER_LOGGED_IN_PT_KEY, authType));\n }\n\n if (json[this.codec.refreshToken]) {\n this.rt = json[this.codec.refreshToken];\n delete json[this.codec.refreshToken];\n setters.push(this.storage.set(authCommon.REFRESH_TOKEN_KEY, this.rt));\n }\n\n if (json[this.codec.deviceId]) {\n this.deviceId = json[this.codec.deviceId];\n delete json[this.codec.deviceId];\n setters.push(this.storage.set(authCommon.DEVICE_ID_KEY, this.deviceId));\n }\n\n // Merge in new fields with old fields. Typically the first json value\n // is complete with every field inside a user auth, but subsequent requests\n // do not include everything. This merging behavior is safe so long as json\n // value responses with absent fields do not indicate that the field should\n // be unset.\n if (json[this.codec.accessToken]) {\n newUserAuth.accessToken = json[this.codec.accessToken];\n }\n if (json[this.codec.userId]) {\n newUserAuth.userId = json[this.codec.userId];\n }\n\n this.auth = Object.assign(this.auth ? this.auth : {}, newUserAuth);\n this.authedId = this.auth.userId;\n setters.push(this.storage.set(authCommon.USER_AUTH_KEY, JSON.stringify(this.auth)));\n return Promise.all(setters).then(() => this.auth);\n }\n\n _get() {\n return this.storage.get(authCommon.USER_AUTH_KEY).then((data) => {\n if (!data) {\n return {};\n }\n\n try {\n return JSON.parse(data);\n } catch (e) {\n // Need to back out and clear auth otherwise we will never\n // be able to do anything useful.\n return this.clear().then(() => {\n throw new StitchError('Failure retrieving stored auth');\n });\n }\n });\n }\n\n getLoggedInProviderType() {\n return this.loggedInProviderType;\n }\n\n parseRedirectFragment(fragment, ourState) {\n // After being redirected from oauth, the URL will look like:\n // https://todo.examples.stitch.mongodb.com/#_stitch_state=...&_stitch_ua=...\n // This function parses out stitch-specific tokens from the fragment and\n // builds an object describing the result.\n const vars = fragment.split('&');\n const result = { ua: null, found: false, stateValid: false, lastError: null };\n let shouldBreak = false;\n for (let i = 0; i < vars.length && !shouldBreak; ++i) {\n const pairParts = vars[i].split('=');\n const pairKey = decodeURIComponent(pairParts[0]);\n switch (pairKey) {\n case authCommon.STITCH_ERROR_KEY:\n result.lastError = decodeURIComponent(pairParts[1]);\n result.found = true;\n shouldBreak = true;\n break;\n case authCommon.USER_AUTH_KEY:\n try {\n result.ua = this.unmarshallUserAuth(decodeURIComponent(pairParts[1]));\n result.found = true;\n } catch (e) {\n result.lastError = e;\n }\n continue;\n case authCommon.STITCH_LINK_KEY:\n result.found = true;\n continue;\n case authCommon.STATE_KEY:\n result.found = true;\n let theirState = decodeURIComponent(pairParts[1]);\n if (ourState && ourState === theirState) {\n result.stateValid = true;\n }\n continue;\n default: continue;\n }\n }\n\n return result;\n }\n\n unmarshallUserAuth(data) {\n let parts = data.split('$');\n if (parts.length !== EMBEDDED_USER_AUTH_DATA_PARTS) {\n throw new RangeError('invalid user auth data provided: ' + data);\n }\n\n return {\n [this.codec.accessToken]: parts[0],\n [this.codec.refreshToken]: parts[1],\n [this.codec.userId]: parts[2],\n [this.codec.deviceId]: parts[3]\n };\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/auth/index.js","import { USER_AUTH_KEY, REFRESH_TOKEN_KEY, DEVICE_ID_KEY, STATE_KEY } from './common';\n\nexport class MemoryStorage {\n constructor() {\n this._data = {};\n this._orderedKeys = [];\n this.length = 0;\n }\n\n getItem(key) {\n return (key in this._data) ? this._data[key] : null;\n }\n\n setItem(key, value) {\n this._orderedKeys.push(key);\n this._data[key] = value;\n this.length++;\n return this._data[key];\n }\n\n removeItem(key) {\n this._orderedKeys.pop(key);\n delete this._data[key];\n this.length--;\n return undefined;\n }\n\n key(index) {\n return this._orderedKeys[index];\n }\n}\n\nconst _VERSION = 1;\nconst _VERSION_KEY = '__stitch_storage_version__';\n\n/**\n * Run a migration on the currently used storage\n * that checks to see if the current version is up to date.\n * If the version has not been set, this method will migrate\n * to the latest version.\n * @param {Integer} version version number of storage\n * @param {Object} storage storage class being checked\n * @returns {Promise} nullable promise containing migration logic\n */\nfunction _runMigration(version, storage) {\n switch (version) {\n case null:\n case undefined:\n // return a promise,\n // mapping each of the store's keys to a Promise\n // that fetches the each value for each key,\n // sets the old value to the new \"namespaced\" key\n // remove the old key value pair,\n // and set the version number\n let migrations = [\n USER_AUTH_KEY,\n REFRESH_TOKEN_KEY,\n DEVICE_ID_KEY,\n STATE_KEY\n ].map(key =>\n Promise.resolve(storage.store.getItem(key))\n .then(item => !!item && storage.store.setItem(storage._generateKey(key), item))\n .then(() => storage.store.removeItem(key))\n );\n return Promise.all(migrations)\n .then(() => storage.store.setItem(_VERSION_KEY, _VERSION));\n // in future versions, `case 1:`, `case 2:` and so on\n // could be added to perform similar migrations\n default: break;\n }\n}\n\nclass Storage {\n /**\n * @param {Storage} store implementer of Storage interface\n * @param {String} namespace clientAppID to be used for namespacing\n * @param\n */\n constructor(store, namespace) {\n this.store = store;\n this.namespace = `_stitch.${namespace}`;\n\n this._migration = Promise.resolve(this.store.getItem(_VERSION_KEY))\n .then(version => _runMigration(version, this));\n }\n\n _generateKey(key) {\n return `${this.namespace}.${key}`;\n }\n\n get(key) {\n return Promise.resolve(this._migration)\n .then(() => this.store.getItem(this._generateKey(key)));\n }\n\n set(key, value) {\n return Promise.resolve(this._migration)\n .then(() => this.store.setItem(this._generateKey(key), value))\n .then(() => value);\n }\n\n remove(key) {\n return Promise.resolve(this._migration)\n .then(() => this.store.removeItem(this._generateKey(key)));\n }\n}\n\nexport function createStorage(options) {\n let { storageType, storage, namespace } = options;\n\n if (storageType === 'localStorage') {\n if ((typeof window !== 'undefined') && 'localStorage' in window && window.localStorage !== null) {\n return new Storage(window.localStorage, namespace);\n }\n } else if (storageType === 'sessionStorage') {\n if ((typeof window !== 'undefined') && 'sessionStorage' in window && window.sessionStorage !== null) {\n return new Storage(window.sessionStorage, namespace);\n }\n } else if (storageType == 'customStorage') { //eslint-disable-line eqeqeq\n return new Storage(storage, namespace);\n }\n\n // default to memory storage\n return new Storage(new MemoryStorage(), namespace);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/auth/storage.js","import { StitchClientFactory } from './client';\nimport { StitchAdminClientFactory } from './admin';\nimport { BSON } from 'mongodb-extjson';\n\nexport {\n StitchClientFactory,\n StitchAdminClientFactory,\n BSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js","import { serviceResponse } from '../../util';\n\n/**\n * Convenience wrapper around AWS S3 service (not meant to be instantiated directly).\n *\n * @class\n * @return {S3Service} a S3Service instance.\n */\nclass S3Service {\n constructor(stitchClient, serviceName) {\n this.client = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Put an object to S3 via Stitch. For small uploads\n *\n * NOTE: body must be a pipeline stream\n *\n * @param {String} bucket which S3 bucket to use\n * @param {String} key which key (filename) to use\n * @param {String} acl which policy to apply\n * @param {String} contentType content type of uploaded data\n * @return {Promise}\n */\n put(bucket, key, acl, contentType) {\n return serviceResponse(this, {\n action: 'put',\n args: { bucket, key, acl, contentType }\n });\n }\n\n /**\n * Sign a policy for putting via Stitch. For large uploads\n *\n * @param {String} bucket which S3 bucket to use\n * @param {String} key which key (filename) to use\n * @param {String} acl which policy to apply\n * @param {String} contentType content type of uploaded data\n * @return {Promise}\n */\n signPolicy(bucket, key, acl, contentType) {\n return serviceResponse(this, {\n action: 'signPolicy',\n args: { bucket, key, acl, contentType }\n });\n }\n}\n\nexport default S3Service;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/aws/s3_service.js","import { serviceResponse } from '../../util';\n\n/**\n * Convenience wrapper around AWS SES service (not meant to be instantiated directly).\n *\n * @class\n * @return {SESService} a SESService instance.\n */\nclass SESService {\n constructor(stitchClient, serviceName) {\n this.client = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Send an email\n *\n * @method\n * @param {String} from the email to send from\n * @param {String} to the email to send to\n * @param {String} subject the subject of the email\n * @param {String} body the body of the email\n * @return {Promise}\n */\n send(from, to, subject, body) {\n return serviceResponse(this, {\n action: 'send',\n args: { from, to, subject, body }\n });\n }\n}\n\nexport default SESService;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/aws/ses_service.js","import { serviceResponse } from '../../util';\n\n/**\n * Convenience wrapper for HTTP service (not meant to be instantiated directly).\n *\n * @class\n * @return {HTTPService} a HTTPService instance.\n */\nclass HTTPService {\n constructor(client, serviceName) {\n this.client = client;\n this.serviceName = serviceName;\n }\n\n /**\n * Send a GET request to a resource (result must be application/json)\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of GET args\n * @param {Object} [options] optional settings for the GET operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n get(urlOrOptions, options = {}) {\n return buildResponse('get', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a POST request to a resource with payload\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of POST args\n * @param {Object} [options] optional settings for the POST operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n post(urlOrOptions, options = {}) {\n return buildResponse('post', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a PUT request to a resource with payload\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of PUT args\n * @param {Object} [options] optional settings for the PUT operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n put(urlOrOptions, options = {}) {\n return buildResponse('put', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a PATCH request to a resource with payload\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of PATCH args\n * @param {Object} [options] optional settings for the PATCH operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n patch(urlOrOptions, options = {}) {\n return buildResponse('patch', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a DELETE request to a resource\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of DELETE args\n * @param {Object} [options] optional settings for the DELETE operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n delete(urlOrOptions, options = {}) {\n return buildResponse('delete', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a HEAD request to a resource\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of HEAD args\n * @param {Object} [options] optional settings for the HEAD operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n head(urlOrOptions, options = {}) {\n return buildResponse('head', this, buildArgs(urlOrOptions, options));\n }\n}\n\nfunction buildArgs(urlOrOptions, options) {\n let args;\n if (typeof urlOrOptions !== 'string') {\n args = urlOrOptions;\n } else {\n args = { url: urlOrOptions };\n if (!!options.authUrl) args.authUrl = options.authUrl;\n }\n\n return args;\n}\n\nfunction buildResponse(action, service, args) {\n return serviceResponse(service, {\n action,\n args\n });\n}\n\nexport default HTTPService;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/http/http_service.js","import S3Service from './aws/s3_service';\nimport SESService from './aws/ses_service';\nimport HTTPService from './http/http_service';\nimport MongoDBService from './mongodb/mongodb_service';\nimport TwilioService from './twilio/twilio_service';\n\nexport default {\n 'aws/s3': S3Service,\n 'aws/ses': SESService,\n 'http': HTTPService,\n 'mongodb': MongoDBService,\n 'twilio': TwilioService\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/index.js","import { serviceResponse } from '../../util';\n\n/**\n * Create a new Collection instance (not meant to be instantiated directly).\n *\n * @class\n * @return {Collection} a Collection instance.\n */\nclass Collection {\n constructor(db, name) {\n this.db = db;\n this.name = name;\n }\n\n /**\n * Inserts a single document.\n *\n * @method\n * @param {Object} doc The document to insert.\n * @return {Promise} a Promise for the operation.\n */\n insertOne(doc) {\n const args = { document: doc };\n return buildResponse('insertOne', this, buildArgs(this, args));\n }\n\n /**\n * Inserts multiple documents.\n *\n * @method\n * @param {Array} docs The documents to insert.\n * @return {Promise} Returns a Promise for the operation.\n */\n insertMany(docs) {\n const args = { documents: Array.isArray(docs) ? docs : [ docs ] };\n return buildResponse('insertMany', this, buildArgs(this, args));\n }\n\n /**\n * Deletes a single document.\n *\n * @method\n * @param {Object} query The query used to match a single document.\n * @return {Promise} Returns a Promise for the operation.\n */\n deleteOne(query) {\n return buildResponse('deleteOne', this, buildArgs(this, { query }));\n }\n\n /**\n * Deletes all documents matching query.\n *\n * @method\n * @param {Object} query The query used to match the documents to delete.\n * @return {Promise} Returns a Promise for the operation.\n */\n deleteMany(query) {\n return buildResponse('deleteMany', this, buildArgs(this, { query }));\n }\n\n /**\n * Updates a single document.\n *\n * @method\n * @param {Object} query The query used to match a single document.\n * @param {Object} update The update operations to perform on the matching document.\n * @param {Object} [options] Additional options object.\n * @param {Boolean} [options.upsert=false] Perform an upsert operation.\n * @return {Promise} A Promise for the operation.\n */\n updateOne(query, update, options = {}) {\n return updateOp(this, false, query, update, options);\n }\n\n /**\n * Updates multiple documents.\n *\n * @method\n * @param {Object} query The query used to match the documents.\n * @param {Object} update The update operations to perform on the matching documents.\n * @param {Object} [options] Additional options object.\n * @param {Boolean} [options.upsert=false] Perform an upsert operation.\n * @return {Promise} Returns a Promise for the operation.\n */\n updateMany(query, update) {\n return updateOp(this, true, query, update);\n }\n\n /**\n * Finds documents.\n *\n * @method\n * @param {Object} query The query used to match documents.\n * @param {Object} [project] The query document projection.\n * @return {MongoQuery} An object which allows for `limit` and `sort` parameters to be set.\n * `execute` will return a {Promise} for the operation.\n */\n find(query, project) {\n return new MongoQuery(this, query, project);\n }\n\n /**\n * Finds one document.\n *\n * @method\n * @param {Object} query The query used to match documents.\n * @param {Object} [project] The query document projection.\n * @return {Promise} Returns a Promise for the operation\n */\n findOne(query, project) {\n return buildResponse('findOne', this, buildArgs(this, { query, project }));\n }\n\n /**\n * Executes an aggregation pipeline.\n *\n * @param {Array} pipeline The aggregation pipeline.\n * @returns {Array} The results of the aggregation.\n */\n aggregate(pipeline) {\n return aggregateOp(this, pipeline);\n }\n\n /**\n * Gets the number of documents matching the filter.\n *\n * @param {Object} query The query used to match documents.\n * @param {Object} options Additional count options.\n * @param {Number} [options.limit=null] The maximum number of documents to return.\n * @return {Number} The results of the count operation.\n */\n count(query, options = {}) {\n let outgoingOptions;\n if (options.limit) {\n outgoingOptions = { limit: options.limit };\n }\n\n return buildResponse('count', this, buildArgs(this, { count: true, query }, outgoingOptions));\n }\n}\n\n// private\n\nfunction updateOp(service, isMulti, query, update, options = {}) {\n const action = isMulti ? 'updateMany' : 'updateOne';\n\n let outgoingOptions;\n if (!isMulti && options.upsert) {\n outgoingOptions = { upsert: true };\n }\n\n return buildResponse(action, service, buildArgs(service, { query, update }, outgoingOptions));\n}\n\nfunction findOp({ service, query, project, limit, sort }) {\n return buildResponse('find', service, buildArgs(service, { query, project, limit, sort }));\n}\n\nfunction aggregateOp(service, pipeline) {\n return buildResponse('aggregate', service, buildArgs(service, { pipeline }));\n}\n\nfunction buildArgs({ db: { name: database }, name: collection }, args, options = {}) {\n return Object.assign(\n { database, collection },\n args,\n options\n );\n}\n\nfunction buildResponse(action, service, args) {\n return serviceResponse(service.db, {\n serviceName: service.db.service,\n action,\n args\n });\n}\n\n// mongo query (find) support\n\nfunction MongoQuery(service, query, project) {\n if (this instanceof MongoQuery) {\n this.service = service;\n this.query = query;\n this.project = project;\n return this;\n }\n return new MongoQuery(service, query, project);\n}\n\nMongoQuery.prototype.limit = function(limit) {\n this.limit = limit;\n return this;\n};\n\nMongoQuery.prototype.sort = function(sort) {\n this.sort = sort;\n return this;\n};\n\nMongoQuery.prototype.execute = function(resolve) {\n return findOp(this);\n};\n\nexport default Collection;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/mongodb/collection.js","import Collection from './collection';\n\n/**\n * Create a new DB instance (not meant to be instantiated directly).\n * @class\n * @return {DB} a DB instance.\n */\nclass DB {\n constructor(client, service, name) {\n this.client = client;\n this.service = service;\n this.name = name;\n }\n\n /**\n * Returns a Collection instance representing a MongoDB Collection object.\n *\n * @method\n * @param {String} name The collection name.\n * @param {Object} [options] Additional options.\n * @return {Collection} returns a Collection instance representing a MongoDb collection.\n */\n collection(name, options = {}) {\n return new Collection(this, name, options);\n }\n}\n\nexport default DB;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/mongodb/db.js","import DB from './db';\n\n/**\n * Create a new MongoDBService instance (not meant to be instantiated directly).\n *\n * @class\n * @return {MongoDBService} a MongoDBService instance.\n */\nclass MongoDBService {\n constructor(stitchClient, serviceName) {\n this.stitchClient = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Get a DB instance\n *\n * @method\n * @param {String} databaseName The MongoDB database name\n * @param {Object} [options] Additional options.\n * @return {DB} returns a DB instance representing a MongoDB database.\n */\n db(databaseName, options = {}) {\n return new DB(this.stitchClient, this.serviceName, databaseName);\n }\n}\n\n\nexport default MongoDBService;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/mongodb/mongodb_service.js","import { serviceResponse } from '../../util';\n\n/**\n * Create a new TwilioService instance (not meant to be instantiated directly).\n *\n * @class\n * @return {TwilioService} a TwilioService instance.\n */\nclass TwilioService {\n constructor(stitchClient, serviceName) {\n this.client = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Send a text message to a number\n *\n * @method\n * @param {String} from number to send from\n * @param {String} to number to send to\n * @param {String} body SMS body content\n * @return {Promise}\n */\n send(from, to, body) {\n return serviceResponse(this, {\n action: 'send',\n args: { from, to, body }\n });\n }\n}\n\nexport default TwilioService;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/twilio/twilio_service.js","'use strict';\n\n/**\n * Module dependencies.\n * @ignore\n */\nfunction convert(integer) {\n var str = Number(integer).toString(16);\n return str.length === 1 ? '0' + str : str;\n}\n\nfunction toExtendedJSON(obj) {\n var base64String = obj.buffer.toString('base64');\n\n return {\n $binary: {\n base64: base64String,\n subType: convert(obj.sub_type)\n }\n };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n var type = doc.$binary.subType ? parseInt(doc.$binary.subType, 16) : 0;\n\n var data = new Buffer(doc.$binary.base64, 'base64');\n\n return new BSON.Binary(data, type);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/binary.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n if (obj.scope) {\n return { $code: obj.code, $scope: obj.scope };\n }\n\n return { $code: obj.code };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Code(doc.$code, doc.$scope);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/code.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n var o = {\n $ref: obj.collection,\n $id: obj.oid\n };\n if (obj.db) o.$db = obj.db;\n o = Object.assign(o, obj.fields);\n return o;\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n var copy = Object.assign({}, doc);\n ['$ref', '$id', '$db'].forEach(k => delete copy[k]);\n return new BSON.DBRef(doc.$ref, doc.$id, doc.$db, copy);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/db_ref.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n return { $numberDecimal: obj.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Decimal128.fromString(doc.$numberDecimal);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/decimal128.js","'use strict';\n\nfunction toExtendedJSON(obj, options) {\n if (options.relaxed && isFinite(obj.value)) return obj.value;\n return { $numberDouble: obj.value.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Double(parseFloat(doc.$numberDouble));\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/double.js","'use strict';\n\nvar Binary = require('./binary');\nvar Code = require('./code');\nvar DBRef = require('./db_ref');\nvar Decimal128 = require('./decimal128');\nvar Double = require('./double');\nvar Int32 = require('./int_32');\nvar Long = require('./long');\nvar MaxKey = require('./max_key');\nvar MinKey = require('./min_key');\nvar ObjectID = require('./objectid');\nvar BSONRegExp = require('./regexp');\nvar Symbol = require('./symbol');\nvar Timestamp = require('./timestamp');\n\nmodule.exports = {\n Binary: Binary,\n Code: Code,\n DBRef: DBRef,\n Decimal128: Decimal128,\n Double: Double,\n Int32: Int32,\n Long: Long,\n MaxKey: MaxKey,\n MinKey: MinKey,\n ObjectID: ObjectID,\n BSONRegExp: BSONRegExp,\n Symbol: Symbol,\n Timestamp: Timestamp\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/index.js","'use strict';\n\nfunction toExtendedJSON(obj, options) {\n if (options && options.relaxed) return obj.value;\n return { $numberInt: obj.value.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Int32(doc.$numberInt);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/int_32.js","'use strict';\n\nfunction toExtendedJSON(obj, options) {\n if (options && options.relaxed) return obj.toNumber();\n return { $numberLong: obj.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return BSON.Long.fromString(doc.$numberLong);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/long.js","'use strict';\n\nfunction toExtendedJSON() {\n return { $maxKey: 1 };\n}\n\nfunction fromExtendedJSON(BSON) {\n return new BSON.MaxKey();\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/max_key.js","'use strict';\n\nfunction toExtendedJSON() {\n return { $minKey: 1 };\n}\n\nfunction fromExtendedJSON(BSON) {\n return new BSON.MinKey();\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/min_key.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n if (obj.toHexString) return { $oid: obj.toHexString() };\n return { $oid: obj.toString('hex') };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.ObjectID(doc.$oid);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/objectid.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n return { $regularExpression: { pattern: obj.pattern, options: obj.options } };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.BSONRegExp(\n doc.$regularExpression.pattern,\n doc.$regularExpression.options\n .split('')\n .sort()\n .join('')\n );\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/regexp.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n return { $symbol: obj.value };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Symbol(doc.$symbol);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/symbol.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n return {\n $timestamp: {\n t: obj.high_,\n i: obj.low_\n }\n };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Timestamp(doc.$timestamp.i, doc.$timestamp.t);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/timestamp.js","'use strict';\n\nlet codecs = require('./bson'),\n BSON = require('bson');\n\nvar BSONTypes = [\n 'Binary',\n 'Code',\n 'DBRef',\n 'Decimal128',\n 'Double',\n 'Int32',\n 'Long',\n 'MaxKey',\n 'MinKey',\n 'ObjectID',\n 'BSONRegExp',\n 'Symbol',\n 'Timestamp'\n];\n\nsetBSONModule(BSON);\n\n// all the types where we don't need to do any special processing and can just pass the EJSON\n//straight to type.fromExtendedJSON\nvar keysToCodecs = {\n $oid: codecs.ObjectID,\n $binary: codecs.Binary,\n $symbol: codecs.Symbol,\n $numberDecimal: codecs.Decimal128,\n $numberLong: codecs.Long,\n $minKey: codecs.MinKey,\n $maxKey: codecs.MaxKey,\n $regularExpression: codecs.BSONRegExp,\n $timestamp: codecs.Timestamp\n};\n\nfunction setBSONModule(module) {\n BSONTypes.forEach(t => {\n if (!module[t]) throw new Error('passed in module does not contain all BSON types required');\n });\n BSON = module;\n}\n\nfunction deserializeValue(self, key, value, options) {\n if (typeof value === 'number') {\n // if it's an integer, should interpret as smallest BSON integer\n // that can represent it exactly. (if out of range, interpret as double.)\n if (Math.floor(value) === value) {\n let int32Range = value >= BSON_INT32_MIN && value <= BSON_INT32_MAX,\n int64Range = value >= BSON_INT64_MIN && value <= BSON_INT64_MAX;\n\n if (int32Range) return options.strict ? new BSON.Int32(value) : value;\n if (int64Range) return options.strict ? new BSON.Long.fromNumber(value) : value;\n }\n // If the number is a non-integer or out of integer range, should interpret as BSON Double.\n return new BSON.Double(value);\n }\n\n // from here on out we're looking for bson types, so bail if its not an object\n if (value == null || typeof value !== 'object') return value;\n\n // upgrade deprecated undefined to null\n if (value.$undefined) return null;\n\n var keys = Object.keys(value).filter(k => k.startsWith('$') && value[k] != null);\n for (let i = 0; i < keys.length; i++) {\n let c = keysToCodecs[keys[i]];\n if (c) return c.fromExtendedJSON(BSON, value);\n }\n\n if (value.$date != null) {\n let d = value.$date,\n date = new Date();\n\n if (typeof d === 'string') date.setTime(Date.parse(d));\n else if (d instanceof BSON.Long) date.setTime(d.toNumber());\n return date;\n }\n\n if (value.$code != null) {\n if (value.$scope) var scope = deserializeValue(self, null, value.$scope);\n let copy = Object.assign({}, value);\n copy.$scope = scope;\n return codecs.Code.fromExtendedJSON(BSON, value);\n }\n\n if (value.$numberDouble != null) {\n return options.strict\n ? codecs.Double.fromExtendedJSON(BSON, value)\n : parseFloat(value.$numberDouble);\n }\n\n if (value.$numberInt != null) {\n return options.strict\n ? codecs.Int32.fromExtendedJSON(BSON, value)\n : parseInt(value.$numberInt, 10);\n }\n\n if (value.$ref != null || value.$dbPointer != null) {\n let v = value.$ref ? value : value.$dbPointer;\n\n // we run into this in a \"degenerate EJSON\" case (with $id and $ref order flipped)\n // because of the order JSON.parse goes through the document\n if (v instanceof BSON.DBRef) return v;\n\n let dollarKeys = Object.keys(v).filter(k => k.startsWith('$')),\n valid = true;\n dollarKeys.forEach(k => {\n if (['$ref', '$id', '$db'].indexOf(k) === -1) valid = false;\n });\n\n // only make DBRef if $ keys are all valid\n if (valid) return codecs.DBRef.fromExtendedJSON(BSON, v);\n }\n\n return value;\n}\n\nconst parse = function(text, options) {\n var self = this;\n options = options || { strict: true };\n\n return JSON.parse(text, function(key, value) {\n return deserializeValue(self, key, value, options);\n });\n};\n\n//\n// Serializer\n//\n\n// MAX INT32 boundaries\nconst BSON_INT32_MAX = 0x7fffffff,\n BSON_INT32_MIN = -0x80000000,\n BSON_INT64_MAX = 0x7fffffffffffffff,\n BSON_INT64_MIN = -0x8000000000000000;\n\nconst stringify = function(value, reducer, indents, options) {\n var opts = {};\n if (options != null && typeof options === 'object') opts = options;\n else if (indents != null && typeof indents === 'object') {\n opts = indents;\n indents = 0;\n } else if (reducer != null && typeof reducer === 'object') {\n opts = reducer;\n reducer = null;\n }\n\n var doc = Array.isArray(value) ? serializeArray(value, opts) : serializeDocument(value, opts);\n return JSON.stringify(doc, reducer, indents);\n};\n\nfunction serializeArray(array, options) {\n return array.map(v => serializeValue(v, options));\n}\n\nfunction getISOString(date) {\n var isoStr = date.toISOString();\n // we should only show milliseconds in timestamp if they're non-zero\n return date.getUTCMilliseconds() !== 0 ? isoStr : isoStr.slice(0, -5) + 'Z';\n}\n\nfunction serializeValue(value, options) {\n if (Array.isArray(value)) return serializeArray(value, options);\n\n if (value === undefined) return null;\n\n if (value instanceof Date) {\n let dateNum = value.getTime(),\n // is it in year range 1970-9999?\n inRange = dateNum > -1 && dateNum < 253402318800000;\n\n return options.relaxed && inRange\n ? { $date: getISOString(value) }\n : { $date: { $numberLong: value.getTime().toString() } };\n }\n\n if (typeof value === 'number' && !options.relaxed) {\n // it's an integer\n if (Math.floor(value) === value) {\n let int32Range = value >= BSON_INT32_MIN && value <= BSON_INT32_MAX,\n int64Range = value >= BSON_INT64_MIN && value <= BSON_INT64_MAX;\n\n // interpret as being of the smallest BSON integer type that can represent the number exactly\n if (int32Range) return { $numberInt: value.toString() };\n if (int64Range) return { $numberLong: value.toString() };\n }\n return { $numberDouble: value.toString() };\n }\n\n if (value != null && typeof value === 'object') return serializeDocument(value, options);\n return value;\n}\n\nfunction serializeDocument(doc, options) {\n if (doc == null || typeof doc !== 'object') throw new Error('not an object instance');\n\n // the document itself is a BSON type\n if (doc._bsontype && BSONTypes.indexOf(doc._bsontype) !== -1) {\n // we need to separately serialize the embedded scope document\n if (doc._bsontype === 'Code' && doc.scope) {\n let tempScope = serializeDocument(doc.scope, options),\n tempDoc = Object.assign({}, doc, { scope: tempScope });\n return codecs['Code'].toExtendedJSON(tempDoc, options);\n // we need to separately serialize the embedded OID document\n } else if (doc._bsontype === 'DBRef' && doc.oid) {\n let tempId = serializeDocument(doc.oid, options),\n tempDoc = Object.assign({}, doc, { oid: tempId });\n return codecs['DBRef'].toExtendedJSON(tempDoc, options);\n }\n return codecs[doc._bsontype].toExtendedJSON(doc, options);\n }\n\n // the document is an object with nested BSON types\n var _doc = {};\n for (var name in doc) {\n let val = doc[name];\n if (Array.isArray(val)) {\n _doc[name] = serializeArray(val, options);\n } else if (val != null && val._bsontype && BSONTypes.indexOf(val._bsontype) !== -1) {\n // we need to separately serialize the embedded scope document\n if (val._bsontype === 'Code' && val.scope) {\n let tempScope = serializeDocument(val.scope, options),\n tempVal = Object.assign({}, val, { scope: tempScope });\n _doc[name] = codecs['Code'].toExtendedJSON(tempVal, options);\n // we need to separately serialize the embedded OID document\n } else if (val._bsontype === 'DBRef' && val.oid) {\n let tempId = serializeDocument(val.oid, options),\n tempVal = Object.assign({}, val, { oid: tempId });\n _doc[name] = codecs['DBRef'].toExtendedJSON(tempVal, options);\n } else _doc[name] = codecs[val._bsontype].toExtendedJSON(val, options);\n } else if (val instanceof Date) {\n _doc[name] = serializeValue(val, options);\n } else if (val != null && typeof val === 'object') {\n _doc[name] = serializeDocument(val, options);\n }\n\n _doc[name] = serializeValue(val, options);\n }\n\n return _doc;\n}\n\nmodule.exports = {\n parse: parse,\n stringify: stringify,\n setBSONModule: setBSONModule,\n BSON: BSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/ext_json.js","'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, 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; i < l; i += 4) {\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 = 58\n// module chunks = 0","var detectBrowser = require('./lib/detectBrowser');\n\nvar agent;\n\nif (typeof navigator !== 'undefined' && navigator) {\n agent = navigator.userAgent;\n}\n\nmodule.exports = detectBrowser(agent);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/detect-browser/browser.js\n// module id = 59\n// module chunks = 0","var detectOS = require('./detectOS.js');\n\nmodule.exports = function detectBrowser(userAgentString) {\n if (!userAgentString) return null;\n\n var browsers = [\n [ 'edge', /Edge\\/([0-9\\._]+)/ ],\n [ 'yandexbrowser', /YaBrowser\\/([0-9\\._]+)/ ],\n [ 'vivaldi', /Vivaldi\\/([0-9\\.]+)/ ],\n [ 'kakaotalk', /KAKAOTALK\\s([0-9\\.]+)/ ],\n [ 'chrome', /(?!Chrom.*OPR)Chrom(?:e|ium)\\/([0-9\\.]+)(:?\\s|$)/ ],\n [ 'phantomjs', /PhantomJS\\/([0-9\\.]+)(:?\\s|$)/ ],\n [ 'crios', /CriOS\\/([0-9\\.]+)(:?\\s|$)/ ],\n [ 'firefox', /Firefox\\/([0-9\\.]+)(?:\\s|$)/ ],\n [ 'fxios', /FxiOS\\/([0-9\\.]+)/ ],\n [ 'opera', /Opera\\/([0-9\\.]+)(?:\\s|$)/ ],\n [ 'opera', /OPR\\/([0-9\\.]+)(:?\\s|$)$/ ],\n [ 'ie', /Trident\\/7\\.0.*rv\\:([0-9\\.]+).*\\).*Gecko$/ ],\n [ 'ie', /MSIE\\s([0-9\\.]+);.*Trident\\/[4-7].0/ ],\n [ 'ie', /MSIE\\s(7\\.0)/ ],\n [ 'bb10', /BB10;\\sTouch.*Version\\/([0-9\\.]+)/ ],\n [ 'android', /Android\\s([0-9\\.]+)/ ],\n [ 'ios', /Version\\/([0-9\\._]+).*Mobile.*Safari.*/ ],\n [ 'safari', /Version\\/([0-9\\._]+).*Safari/ ]\n ];\n\n return browsers.map(function (rule) {\n if (rule[1].test(userAgentString)) {\n var match = rule[1].exec(userAgentString);\n var version = match && match[1].split(/[._]/).slice(0,3);\n\n if (version && version.length < 3) {\n Array.prototype.push.apply(version, (version.length == 1) ? [0, 0] : [0]);\n }\n\n return {\n name: rule[0],\n version: version.join('.'),\n os: detectOS(userAgentString)\n };\n }\n }).filter(Boolean).shift();\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/detect-browser/lib/detectBrowser.js\n// module id = 60\n// module chunks = 0","module.exports = function detectOS(userAgentString) {\n var operatingSystems = [\n {\n name: 'iOS',\n rule: /iP(hone|od|ad)/\n },\n {\n name: 'Android OS',\n rule: /Android/\n },\n {\n name: 'BlackBerry OS',\n rule: /BlackBerry|BB10/\n },\n {\n name: 'Windows Mobile',\n rule: /IEMobile/\n },\n {\n name: 'Amazon OS',\n rule: /Kindle/\n },\n {\n name: 'Windows 3.11',\n rule: /Win16/\n },\n {\n name: 'Windows 95',\n rule: /(Windows 95)|(Win95)|(Windows_95)/\n },\n {\n name: 'Windows 98',\n rule: /(Windows 98)|(Win98)/\n },\n {\n name: 'Windows 2000',\n rule: /(Windows NT 5.0)|(Windows 2000)/\n },\n {\n name: 'Windows XP',\n rule: /(Windows NT 5.1)|(Windows XP)/\n },\n {\n name: 'Windows Server 2003',\n rule: /(Windows NT 5.2)/\n },\n {\n name: 'Windows Vista',\n rule: /(Windows NT 6.0)/\n },\n {\n name: 'Windows 7',\n rule: /(Windows NT 6.1)/\n },\n {\n name: 'Windows 8',\n rule: /(Windows NT 6.2)/\n },\n {\n name: 'Windows 8.1',\n rule: /(Windows NT 6.3)/\n },\n {\n name: 'Windows 10',\n rule: /(Windows NT 10.0)/\n },\n {\n name: 'Windows ME',\n rule: /Windows ME/\n },\n {\n name: 'Open BSD',\n rule: /OpenBSD/\n },\n {\n name: 'Sun OS',\n rule: /SunOS/\n },\n {\n name: 'Linux',\n rule: /(Linux)|(X11)/\n },\n {\n name: 'Mac OS',\n rule: /(Mac_PowerPC)|(Macintosh)/\n },\n {\n name: 'QNX',\n rule: /QNX/\n },\n {\n name: 'BeOS',\n rule: /BeOS/\n },\n {\n name: 'OS/2',\n rule: /OS\\/2/\n },\n {\n name: 'Search Bot',\n rule: /(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves\\/Teoma)|(ia_archiver)/\n }\n ];\n\n var detected = operatingSystems.filter(function (os) {\n if (userAgentString.match(os.rule)) {\n return true;\n }\n });\n\n return detected && detected[0] ? detected[0].name : null;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/detect-browser/lib/detectOS.js\n// module id = 61\n// module chunks = 0","exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/ieee754/index.js\n// module id = 62\n// module chunks = 0","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/inherits/inherits_browser.js\n// module id = 63\n// module chunks = 0","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/isarray/index.js\n// module id = 64\n// module chunks = 0","/**\n * The code was extracted from:\n * https://github.com/davidchambers/Base64.js\n */\n\nvar chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\nfunction InvalidCharacterError(message) {\n this.message = message;\n}\n\nInvalidCharacterError.prototype = new Error();\nInvalidCharacterError.prototype.name = 'InvalidCharacterError';\n\nfunction polyfill (input) {\n var str = String(input).replace(/=+$/, '');\n if (str.length % 4 == 1) {\n throw new InvalidCharacterError(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = '';\n // get next character\n buffer = str.charAt(idx++);\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n return output;\n}\n\n\nmodule.exports = typeof window !== 'undefined' && window.atob && window.atob.bind(window) || polyfill;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/jwt-decode/lib/atob.js\n// module id = 65\n// module chunks = 0","var atob = require('./atob');\n\nfunction b64DecodeUnicode(str) {\n return decodeURIComponent(atob(str).replace(/(.)/g, function (m, p) {\n var code = p.charCodeAt(0).toString(16).toUpperCase();\n if (code.length < 2) {\n code = '0' + code;\n }\n return '%' + code;\n }));\n}\n\nmodule.exports = function(str) {\n var output = str.replace(/-/g, \"+\").replace(/_/g, \"/\");\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += \"==\";\n break;\n case 3:\n output += \"=\";\n break;\n default:\n throw \"Illegal base64url string!\";\n }\n\n try{\n return b64DecodeUnicode(output);\n } catch (err) {\n return atob(output);\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/jwt-decode/lib/base64_url_decode.js\n// module id = 66\n// module chunks = 0","'use strict';\n\nvar base64_url_decode = require('./base64_url_decode');\n\nfunction InvalidTokenError(message) {\n this.message = message;\n}\n\nInvalidTokenError.prototype = new Error();\nInvalidTokenError.prototype.name = 'InvalidTokenError';\n\nmodule.exports = function (token,options) {\n if (typeof token !== 'string') {\n throw new InvalidTokenError('Invalid token specified');\n }\n\n options = options || {};\n var pos = options.header === true ? 0 : 1;\n try {\n return JSON.parse(base64_url_decode(token.split('.')[pos]));\n } catch (e) {\n throw new InvalidTokenError('Invalid token specified: ' + e.message);\n }\n};\n\nmodule.exports.InvalidTokenError = InvalidTokenError;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/jwt-decode/lib/index.js\n// module id = 67\n// module chunks = 0","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/object-assign/index.js\n// module id = 68\n// module chunks = 0","'use strict';\nvar strictUriEncode = require('strict-uri-encode');\nvar objectAssign = require('object-assign');\n\nfunction encoderForArrayFormat(opts) {\n\tswitch (opts.arrayFormat) {\n\t\tcase 'index':\n\t\t\treturn function (key, value, index) {\n\t\t\t\treturn value === null ? [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'[',\n\t\t\t\t\tindex,\n\t\t\t\t\t']'\n\t\t\t\t].join('') : [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'[',\n\t\t\t\t\tencode(index, opts),\n\t\t\t\t\t']=',\n\t\t\t\t\tencode(value, opts)\n\t\t\t\t].join('');\n\t\t\t};\n\n\t\tcase 'bracket':\n\t\t\treturn function (key, value) {\n\t\t\t\treturn value === null ? encode(key, opts) : [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'[]=',\n\t\t\t\t\tencode(value, opts)\n\t\t\t\t].join('');\n\t\t\t};\n\n\t\tdefault:\n\t\t\treturn function (key, value) {\n\t\t\t\treturn value === null ? encode(key, opts) : [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'=',\n\t\t\t\t\tencode(value, opts)\n\t\t\t\t].join('');\n\t\t\t};\n\t}\n}\n\nfunction parserForArrayFormat(opts) {\n\tvar result;\n\n\tswitch (opts.arrayFormat) {\n\t\tcase 'index':\n\t\t\treturn function (key, value, accumulator) {\n\t\t\t\tresult = /\\[(\\d*)\\]$/.exec(key);\n\n\t\t\t\tkey = key.replace(/\\[\\d*\\]$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = {};\n\t\t\t\t}\n\n\t\t\t\taccumulator[key][result[1]] = value;\n\t\t\t};\n\n\t\tcase 'bracket':\n\t\t\treturn function (key, value, accumulator) {\n\t\t\t\tresult = /(\\[\\])$/.exec(key);\n\t\t\t\tkey = key.replace(/\\[\\]$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t} else if (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = [value];\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [].concat(accumulator[key], value);\n\t\t\t};\n\n\t\tdefault:\n\t\t\treturn function (key, value, accumulator) {\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [].concat(accumulator[key], value);\n\t\t\t};\n\t}\n}\n\nfunction encode(value, opts) {\n\tif (opts.encode) {\n\t\treturn opts.strict ? strictUriEncode(value) : encodeURIComponent(value);\n\t}\n\n\treturn value;\n}\n\nfunction keysSorter(input) {\n\tif (Array.isArray(input)) {\n\t\treturn input.sort();\n\t} else if (typeof input === 'object') {\n\t\treturn keysSorter(Object.keys(input)).sort(function (a, b) {\n\t\t\treturn Number(a) - Number(b);\n\t\t}).map(function (key) {\n\t\t\treturn input[key];\n\t\t});\n\t}\n\n\treturn input;\n}\n\nexports.extract = function (str) {\n\treturn str.split('?')[1] || '';\n};\n\nexports.parse = function (str, opts) {\n\topts = objectAssign({arrayFormat: 'none'}, opts);\n\n\tvar formatter = parserForArrayFormat(opts);\n\n\t// Create an object with no prototype\n\t// https://github.com/sindresorhus/query-string/issues/47\n\tvar ret = Object.create(null);\n\n\tif (typeof str !== 'string') {\n\t\treturn ret;\n\t}\n\n\tstr = str.trim().replace(/^(\\?|#|&)/, '');\n\n\tif (!str) {\n\t\treturn ret;\n\t}\n\n\tstr.split('&').forEach(function (param) {\n\t\tvar parts = param.replace(/\\+/g, ' ').split('=');\n\t\t// Firefox (pre 40) decodes `%3D` to `=`\n\t\t// https://github.com/sindresorhus/query-string/pull/37\n\t\tvar key = parts.shift();\n\t\tvar val = parts.length > 0 ? parts.join('=') : undefined;\n\n\t\t// missing `=` should be `null`:\n\t\t// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters\n\t\tval = val === undefined ? null : decodeURIComponent(val);\n\n\t\tformatter(decodeURIComponent(key), val, ret);\n\t});\n\n\treturn Object.keys(ret).sort().reduce(function (result, key) {\n\t\tvar val = ret[key];\n\t\tif (Boolean(val) && typeof val === 'object' && !Array.isArray(val)) {\n\t\t\t// Sort object keys, not values\n\t\t\tresult[key] = keysSorter(val);\n\t\t} else {\n\t\t\tresult[key] = val;\n\t\t}\n\n\t\treturn result;\n\t}, Object.create(null));\n};\n\nexports.stringify = function (obj, opts) {\n\tvar defaults = {\n\t\tencode: true,\n\t\tstrict: true,\n\t\tarrayFormat: 'none'\n\t};\n\n\topts = objectAssign(defaults, opts);\n\n\tvar formatter = encoderForArrayFormat(opts);\n\n\treturn obj ? Object.keys(obj).sort().map(function (key) {\n\t\tvar val = obj[key];\n\n\t\tif (val === undefined) {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (val === null) {\n\t\t\treturn encode(key, opts);\n\t\t}\n\n\t\tif (Array.isArray(val)) {\n\t\t\tvar result = [];\n\n\t\t\tval.slice().forEach(function (val2) {\n\t\t\t\tif (val2 === undefined) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tresult.push(formatter(key, val2, result.length));\n\t\t\t});\n\n\t\t\treturn result.join('&');\n\t\t}\n\n\t\treturn encode(key, opts) + '=' + encode(val, opts);\n\t}).filter(function (x) {\n\t\treturn x.length > 0;\n\t}).join('&') : '';\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/query-string/index.js\n// module id = 69\n// module chunks = 0","'use strict';\nmodule.exports = function (str) {\n\treturn encodeURIComponent(str).replace(/[!'()*]/g, function (c) {\n\t\treturn '%' + c.charCodeAt(0).toString(16).toUpperCase();\n\t});\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/strict-uri-encode/index.js\n// module id = 70\n// module chunks = 0","module.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/util/support/isBufferBrowser.js\n// module id = 71\n// module chunks = 0","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexports.debuglog = function(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/util/util.js\n// module id = 72\n// module chunks = 0","(function(self) {\n 'use strict';\n\n if (self.fetch) {\n return\n }\n\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob: 'FileReader' in self && 'Blob' in self && (function() {\n try {\n new Blob()\n return true\n } catch(e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ]\n\n var isDataView = function(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n var isArrayBufferView = ArrayBuffer.isView || function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n }\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name)\n }\n if (/[^a-z0-9\\-#$%&'*+.\\^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value)\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift()\n return {done: value === undefined, value: value}\n }\n }\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n }\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {}\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value)\n }, this)\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1])\n }, this)\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name])\n }, this)\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name)\n value = normalizeValue(value)\n var oldValue = this.map[name]\n this.map[name] = oldValue ? oldValue+','+value : value\n }\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)]\n }\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name)\n return this.has(name) ? this.map[name] : null\n }\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n }\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value)\n }\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this)\n }\n }\n }\n\n Headers.prototype.keys = function() {\n var items = []\n this.forEach(function(value, name) { items.push(name) })\n return iteratorFor(items)\n }\n\n Headers.prototype.values = function() {\n var items = []\n this.forEach(function(value) { items.push(value) })\n return iteratorFor(items)\n }\n\n Headers.prototype.entries = function() {\n var items = []\n this.forEach(function(value, name) { items.push([name, value]) })\n return iteratorFor(items)\n }\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result)\n }\n reader.onerror = function() {\n reject(reader.error)\n }\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsArrayBuffer(blob)\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsText(blob)\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf)\n var chars = new Array(view.length)\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i])\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength)\n view.set(new Uint8Array(buf))\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false\n\n this._initBody = function(body) {\n this._bodyInit = body\n if (!body) {\n this._bodyText = ''\n } else if (typeof body === 'string') {\n this._bodyText = body\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString()\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer)\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer])\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body)\n } else {\n throw new Error('unsupported BodyInit type')\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8')\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type)\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')\n }\n }\n }\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n }\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n }\n }\n\n this.text = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n }\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n }\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n }\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase()\n return (methods.indexOf(upcased) > -1) ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {}\n var body = options.body\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url\n this.credentials = input.credentials\n if (!options.headers) {\n this.headers = new Headers(input.headers)\n }\n this.method = input.method\n this.mode = input.mode\n if (!body && input._bodyInit != null) {\n body = input._bodyInit\n input.bodyUsed = true\n }\n } else {\n this.url = String(input)\n }\n\n this.credentials = options.credentials || this.credentials || 'omit'\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers)\n }\n this.method = normalizeMethod(options.method || this.method || 'GET')\n this.mode = options.mode || this.mode || null\n this.referrer = null\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body)\n }\n\n Request.prototype.clone = function() {\n return new Request(this, { body: this._bodyInit })\n }\n\n function decode(body) {\n var form = new FormData()\n body.trim().split('&').forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=')\n var name = split.shift().replace(/\\+/g, ' ')\n var value = split.join('=').replace(/\\+/g, ' ')\n form.append(decodeURIComponent(name), decodeURIComponent(value))\n }\n })\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers()\n rawHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':')\n var key = parts.shift().trim()\n if (key) {\n var value = parts.join(':').trim()\n headers.append(key, value)\n }\n })\n return headers\n }\n\n Body.call(Request.prototype)\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {}\n }\n\n this.type = 'default'\n this.status = 'status' in options ? options.status : 200\n this.ok = this.status >= 200 && this.status < 300\n this.statusText = 'statusText' in options ? options.statusText : 'OK'\n this.headers = new Headers(options.headers)\n this.url = options.url || ''\n this._initBody(bodyInit)\n }\n\n Body.call(Response.prototype)\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n }\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''})\n response.type = 'error'\n return response\n }\n\n var redirectStatuses = [301, 302, 303, 307, 308]\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n }\n\n self.Headers = Headers\n self.Request = Request\n self.Response = Response\n\n self.fetch = function(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init)\n var xhr = new XMLHttpRequest()\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n }\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL')\n var body = 'response' in xhr ? xhr.response : xhr.responseText\n resolve(new Response(body, options))\n }\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'))\n }\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'))\n }\n\n xhr.open(request.method, request.url, true)\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob'\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value)\n })\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)\n })\n }\n self.fetch.polyfill = true\n})(typeof self !== 'undefined' ? self : this);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/whatwg-fetch/fetch.js\n// module id = 73\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/web/stitch.min.js b/dist/web/stitch.min.js index 20c5bc9d7..fb3c1f11c 100644 --- a/dist/web/stitch.min.js +++ b/dist/web/stitch.min.js @@ -1,13 +1,13 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("stitch",[],e):"object"==typeof exports?exports.stitch=e():t.stitch=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=33)}([function(t,e,r){"use strict";(function(t){function n(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(t,e){if(n()=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|t}function d(t){return+t!=t&&(t=0),o.alloc(+t)}function y(t,e){if(o.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return K(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return V(t).length;default:if(n)return K(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,r);case"utf8":case"utf-8":return T(this,e,r);case"ascii":return R(this,e,r);case"latin1":case"binary":return D(this,e,r);case"base64":return B(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function v(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=o.from(e,n)),o.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,i);if("number"==typeof e)return e&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,i){function o(t,e){return 1===u?t[e]:t.readUInt16BE(e*u)}var u=1,s=t.length,a=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;u=2,s/=2,a/=2,r/=2}var f;if(i){var c=-1;for(f=r;fs&&(r=s-a),f=r;f>=0;f--){for(var h=!0,l=0;li&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var u=0;u239?4:o>223?3:o>191?2:1;if(i+s<=r){var a,f,c,h;switch(s){case 1:o<128&&(u=o);break;case 2:a=t[i+1],128==(192&a)&&(h=(31&o)<<6|63&a)>127&&(u=h);break;case 3:a=t[i+1],f=t[i+2],128==(192&a)&&128==(192&f)&&(h=(15&o)<<12|(63&a)<<6|63&f)>2047&&(h<55296||h>57343)&&(u=h);break;case 4:a=t[i+1],f=t[i+2],c=t[i+3],128==(192&a)&&128==(192&f)&&128==(192&c)&&(h=(15&o)<<18|(63&a)<<12|(63&f)<<6|63&c)>65535&&h<1114112&&(u=h)}}null===u?(u=65533,s=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),i+=s}return I(n)}function I(t){var e=t.length;if(e<=Q)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function M(t,e,r,n,i,u){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function k(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function j(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function L(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function C(t,e,r,n,i){return i||L(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),G.write(t,e,r,n,23,4),r+4}function Y(t,e,r,n,i){return i||L(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),G.write(t,e,r,n,52,8),r+8}function W(t){if(t=F(t).replace(tt,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function F(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function $(t){return t<16?"0"+t.toString(16):t.toString(16)}function K(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],u=0;u55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(u+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function J(t){for(var e=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function V(t){return Z.toByteArray(W(t))}function H(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function z(t){return t!==t}/*! +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("stitch",[],e):"object"==typeof exports?exports.stitch=e():t.stitch=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=34)}([function(t,e,r){"use strict";(function(t){function n(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(t,e){if(n()=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|t}function d(t){return+t!=t&&(t=0),o.alloc(+t)}function y(t,e){if(o.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(t).length;default:if(n)return $(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return R(this,e,r);case"latin1":case"binary":return D(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function v(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=o.from(e,n)),o.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,i);if("number"==typeof e)return e&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,i){function o(t,e){return 1===u?t[e]:t.readUInt16BE(e*u)}var u=1,s=t.length,a=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;u=2,s/=2,a/=2,r/=2}var f;if(i){var c=-1;for(f=r;fs&&(r=s-a),f=r;f>=0;f--){for(var h=!0,l=0;li&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var u=0;u239?4:o>223?3:o>191?2:1;if(i+s<=r){var a,f,c,h;switch(s){case 1:o<128&&(u=o);break;case 2:a=t[i+1],128==(192&a)&&(h=(31&o)<<6|63&a)>127&&(u=h);break;case 3:a=t[i+1],f=t[i+2],128==(192&a)&&128==(192&f)&&(h=(15&o)<<12|(63&a)<<6|63&f)>2047&&(h<55296||h>57343)&&(u=h);break;case 4:a=t[i+1],f=t[i+2],c=t[i+3],128==(192&a)&&128==(192&f)&&128==(192&c)&&(h=(15&o)<<18|(63&a)<<12|(63&f)<<6|63&c)>65535&&h<1114112&&(u=h)}}null===u?(u=65533,s=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),i+=s}return I(n)}function I(t){var e=t.length;if(e<=Q)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function k(t,e,r,n,i,u){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function L(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function M(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function j(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function C(t,e,r,n,i){return i||j(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(t,e,r,n,23,4),r+4}function Y(t,e,r,n,i){return i||j(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(t,e,r,n,52,8),r+8}function F(t){if(t=W(t).replace(tt,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function W(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function K(t){return t<16?"0"+t.toString(16):t.toString(16)}function $(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],u=0;u55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(u+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function J(t){for(var e=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function q(t){return G.toByteArray(F(t))}function H(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function z(t){return t!==t}/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -var Z=r(58),G=r(62),X=r(64);e.Buffer=o,e.SlowBuffer=d,e.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=n(),o.poolSize=8192,o._augment=function(t){return t.__proto__=o.prototype,t},o.from=function(t,e,r){return u(null,t,e,r)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(t,e,r){return a(null,t,e,r)},o.allocUnsafe=function(t){return f(null,t)},o.allocUnsafeSlow=function(t){return f(null,t)},o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,u=Math.min(r,n);i0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},o.prototype.compare=function(t,e,r,n,i){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var u=i-n,s=r-e,a=Math.min(u,s),f=this.slice(n,i),c=t.slice(e,r),h=0;hi)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return O(this,t,e,r);case"ascii":return E(this,t,e,r);case"latin1":case"binary":return S(this,t,e,r);case"base64":return N(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;o.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e0&&(i*=256);)n+=this[t+--e]*i;return n},o.prototype.readUInt8=function(t,e){return e||U(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||U(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||U(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||U(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||U(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||U(t,e,this.length);for(var n=this[t],i=1,o=0;++o=i&&(n-=Math.pow(2,8*e)),n},o.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||U(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){e||U(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(t,e){e||U(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(t,e){return e||U(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||U(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||U(t,4,this.length),G.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||U(t,4,this.length),G.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||U(t,8,this.length),G.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return e||U(t,8,this.length),G.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){M(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+r},o.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):k(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):k(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):j(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);M(this,t,e,r,i-1,-i)}var o=0,u=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+r},o.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);M(this,t,e,r,i-1,-i)}var o=r-1,u=1,s=0;for(this[e+o]=255&t;--o>=0&&(u*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/u>>0)-s&255;return e+r},o.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):k(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):k(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):j(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,r){return C(this,t,e,!0,r)},o.prototype.writeFloatBE=function(t,e,r){return C(this,t,e,!1,r)},o.prototype.writeDoubleLE=function(t,e,r){return Y(this,t,e,!0,r)},o.prototype.writeDoubleBE=function(t,e,r){return Y(this,t,e,!1,r)},o.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(u<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var u;if("number"==typeof t)for(u=e;u>1,h=-7,l=s?0:i-1,p=s?1:-1,_=t[e+l];for(l+=p,o=_&(1<<-h)-1,_>>=-h,h+=a;h>0;o=256*o+t[e+l],l+=p,h-=8);for(u=o&(1<<-h)-1,o>>=-h,h+=n;h>0;u=256*u+t[e+l],l+=p,h-=8);if(0===o)o=1-c;else{if(o===f)return u?NaN:1/0*(_?-1:1);u+=Math.pow(2,n),o-=c}return(_?-1:1)*u*Math.pow(2,o-n)},i=function(t,e,r,n,i,o){var u,s,a,f="big"===n,c=8*o-i-1,h=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,_=f?o-1:0,d=f?-1:1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,u=h):(u=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-u))<1&&(u--,a*=2),e+=u+l>=1?p/a:p*Math.pow(2,1-l),e*a>=2&&(u++,a/=2),u+l>=h?(s=0,u=h):u+l>=1?(s=(e*a-1)*Math.pow(2,i),u+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,i),u=0));i>=8;t[r+_]=255&s,_+=d,s/=256,i-=8);for(u=u<0;t[r+_]=255&u,_+=d,u/=256,c-=8);t[r+_-d]|=128*y};e.readIEEE754=n,e.writeIEEE754=i},function(t,e,r){"use strict";function n(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function i(t,e){function r(){return n||(n=!0,console.warn("DeprecationWarning: "+e)),t.apply(this,arguments)}var n=!1;return r.__proto__=t,t.prototype&&(r.prototype=t.prototype),r}function o(t,e){var r=e.serviceName,n=void 0===r?t.serviceName:r,i=e.action,o=e.args,u=t.client;if(!u)throw new Error("Service has no client");return u.executeServiceFunction(n,i,o)}function u(){return c||null}function s(t){return encodeURIComponent(l.btoa(JSON.stringify(t)))}Object.defineProperty(e,"__esModule",{value:!0}),e.uriEncodeObject=e.getPlatform=e.serviceResponse=e.deprecate=e.collectMetadata=void 0;var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f=r(59),c=n(f),h=r(25),l=n(h);e.collectMetadata=function(t){var e=function(t){return function(e){return"object"!==(void 0===e?"undefined":a(e))||Object.prototype.hasOwnProperty.call(e,"_stitch_metadata")||Object.defineProperty(e,"_stitch_metadata",{enumerable:!1,configurable:!1,writable:!1,value:t}),Promise.resolve(e)}};return function(r){var n={};return r.warnings&&(n.warnings=r.warnings),t?Promise.resolve(r).then(t).then(e(n)):Promise.resolve(r).then(e(n))}};e.deprecate=i,e.serviceResponse=o,e.getPlatform=u,e.uriEncodeObject=s},function(t,e,r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);this._bsontype="Long",this.low_=0|t,this.high_=0|e}n.prototype.toInt=function(){return this.low_},n.prototype.toNumber=function(){return this.high_*n.TWO_PWR_32_DBL_+this.getLowBitsUnsigned()},n.prototype.toJSON=function(){return this.toString()},n.prototype.toString=function(t){var e=t||10;if(e<2||36=0?this.low_:n.TWO_PWR_32_DBL_+this.low_},n.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(n.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var t=0!=this.high_?this.high_:this.low_,e=31;e>0&&0==(t&1<0},n.prototype.greaterThanOrEqual=function(t){return this.compare(t)>=0},n.prototype.compare=function(t){if(this.equals(t))return 0;var e=this.isNegative(),r=t.isNegative();return e&&!r?-1:!e&&r?1:this.subtract(t).isNegative()?-1:1},n.prototype.negate=function(){return this.equals(n.MIN_VALUE)?n.MIN_VALUE:this.not().add(n.ONE)},n.prototype.add=function(t){var e=this.high_>>>16,r=65535&this.high_,i=this.low_>>>16,o=65535&this.low_,u=t.high_>>>16,s=65535&t.high_,a=t.low_>>>16,f=65535&t.low_,c=0,h=0,l=0,p=0;return p+=o+f,l+=p>>>16,p&=65535,l+=i+a,h+=l>>>16,l&=65535,h+=r+s,c+=h>>>16,h&=65535,c+=e+u,c&=65535,n.fromBits(l<<16|p,c<<16|h)},n.prototype.subtract=function(t){return this.add(t.negate())},n.prototype.multiply=function(t){if(this.isZero())return n.ZERO;if(t.isZero())return n.ZERO;if(this.equals(n.MIN_VALUE))return t.isOdd()?n.MIN_VALUE:n.ZERO;if(t.equals(n.MIN_VALUE))return this.isOdd()?n.MIN_VALUE:n.ZERO;if(this.isNegative())return t.isNegative()?this.negate().multiply(t.negate()):this.negate().multiply(t).negate();if(t.isNegative())return this.multiply(t.negate()).negate();if(this.lessThan(n.TWO_PWR_24_)&&t.lessThan(n.TWO_PWR_24_))return n.fromNumber(this.toNumber()*t.toNumber());var e=this.high_>>>16,r=65535&this.high_,i=this.low_>>>16,o=65535&this.low_,u=t.high_>>>16,s=65535&t.high_,a=t.low_>>>16,f=65535&t.low_,c=0,h=0,l=0,p=0;return p+=o*f,l+=p>>>16,p&=65535,l+=i*f,h+=l>>>16,l&=65535,l+=o*a,h+=l>>>16,l&=65535,h+=r*f,c+=h>>>16,h&=65535,h+=i*a,c+=h>>>16,h&=65535,h+=o*s,c+=h>>>16,h&=65535,c+=e*f+r*a+i*s+o*u,c&=65535,n.fromBits(l<<16|p,c<<16|h)},n.prototype.div=function(t){if(t.isZero())throw Error("division by zero");if(this.isZero())return n.ZERO;if(this.equals(n.MIN_VALUE)){if(t.equals(n.ONE)||t.equals(n.NEG_ONE))return n.MIN_VALUE;if(t.equals(n.MIN_VALUE))return n.ONE;var e=this.shiftRight(1),r=e.div(t).shiftLeft(1);if(r.equals(n.ZERO))return t.isNegative()?n.ONE:n.NEG_ONE;var i=this.subtract(t.multiply(r));return r.add(i.div(t))}if(t.equals(n.MIN_VALUE))return n.ZERO;if(this.isNegative())return t.isNegative()?this.negate().div(t.negate()):this.negate().div(t).negate();if(t.isNegative())return this.div(t.negate()).negate();for(var o=n.ZERO,i=this;i.greaterThanOrEqual(t);){for(var r=Math.max(1,Math.floor(i.toNumber()/t.toNumber())),u=Math.ceil(Math.log(r)/Math.LN2),s=u<=48?1:Math.pow(2,u-48),a=n.fromNumber(r),f=a.multiply(t);f.isNegative()||f.greaterThan(i);)r-=s,a=n.fromNumber(r),f=a.multiply(t);a.isZero()&&(a=n.ONE),o=o.add(a),i=i.subtract(f)}return o},n.prototype.modulo=function(t){return this.subtract(this.div(t).multiply(t))},n.prototype.not=function(){return n.fromBits(~this.low_,~this.high_)},n.prototype.and=function(t){return n.fromBits(this.low_&t.low_,this.high_&t.high_)},n.prototype.or=function(t){return n.fromBits(this.low_|t.low_,this.high_|t.high_)},n.prototype.xor=function(t){return n.fromBits(this.low_^t.low_,this.high_^t.high_)},n.prototype.shiftLeft=function(t){if(0==(t&=63))return this;var e=this.low_;if(t<32){var r=this.high_;return n.fromBits(e<>>32-t)}return n.fromBits(0,e<>>t|e<<32-t,e>>t)}return n.fromBits(e>>t-32,e>=0?0:-1)},n.prototype.shiftRightUnsigned=function(t){if(0==(t&=63))return this;var e=this.high_;if(t<32){var r=this.low_;return n.fromBits(r>>>t|e<<32-t,e>>>t)}return 32==t?n.fromBits(e,0):n.fromBits(e>>>t-32,0)},n.fromInt=function(t){if(-128<=t&&t<128){var e=n.INT_CACHE_[t];if(e)return e}var r=new n(0|t,t<0?-1:0);return-128<=t&&t<128&&(n.INT_CACHE_[t]=r),r},n.fromNumber=function(t){return isNaN(t)||!isFinite(t)?n.ZERO:t<=-n.TWO_PWR_63_DBL_?n.MIN_VALUE:t+1>=n.TWO_PWR_63_DBL_?n.MAX_VALUE:t<0?n.fromNumber(-t).negate():new n(t%n.TWO_PWR_32_DBL_|0,t/n.TWO_PWR_32_DBL_|0)},n.fromBits=function(t,e){return new n(t,e)},n.fromString=function(t,e){if(0==t.length)throw Error("number format error: empty string");var r=e||10;if(r<2||36=0)throw Error('number format error: interior "-" character: '+t);for(var i=n.fromNumber(Math.pow(r,8)),o=n.ZERO,u=0;u255)throw new Error("only accepts number in a valid unsigned byte range 0-255");var e=null;if(e="string"==typeof t?t.charCodeAt(0):null!=t.length?t[0]:t,this.buffer.length>this.position)this.buffer[this.position++]=e;else if(void 0!==i&&i.isBuffer(this.buffer)){var r=new i(n.BUFFER_SIZE+this.buffer.length);this.buffer.copy(r,0,0,this.buffer.length),this.buffer=r,this.buffer[this.position++]=e}else{var r=null;r="[object Uint8Array]"==Object.prototype.toString.call(this.buffer)?new Uint8Array(new ArrayBuffer(n.BUFFER_SIZE+this.buffer.length)):new Array(n.BUFFER_SIZE+this.buffer.length);for(var o=0;othis.position?e+t.length:this.position;else if(void 0!==i&&"string"==typeof t&&i.isBuffer(this.buffer))this.buffer.write(t,e,"binary"),this.position=e+t.length>this.position?e+t.length:this.position;else if("[object Uint8Array]"==Object.prototype.toString.call(t)||"[object Array]"==Object.prototype.toString.call(t)&&"string"!=typeof t){for(var n=0;nthis.position?e:this.position}else if("string"==typeof t){for(var n=0;nthis.position?e:this.position}},n.prototype.read=function(t,e){if(e=e&&e>0?e:this.position,this.buffer.slice)return this.buffer.slice(t,t+e);for(var r="undefined"!=typeof Uint8Array?new Uint8Array(new ArrayBuffer(e)):new Array(e),n=0;n>>0,n=e.high_>>>0;if(r>>0>>0)return!0}return!1},y=function(t){this._bsontype="Decimal128",this.bytes=t};y.fromString=function(t){var r=!1,p=!1,g=!1,v=0,b=0,m=0,w=0,O=0,E=[0],S=0,N=0,A=0,B=0,T=0,I=0,R=[0,0],D=[0,0],P=0,x=0;t=t.trim();var U=t.match(i),M=t.match(o),k=t.match(u);if(!U&&!M&&!k||0==t.length)throw new Error(t+" not a valid Decimal128 string");if(U&&U[4]&&void 0===U[2])throw new Error(t+" not a valid Decimal128 string");if("+"!=t[x]&&"-"!=t[x]||(r="-"==t[x++]),!l(t[x])&&"."!=t[x]){if("i"==t[x]||"I"==t[x])return new y(new e(r?f:c));if("N"==t[x])return new y(new e(a))}for(;l(t[x])||"."==t[x];)if("."!=t[x])S<34&&("0"!=t[x]||g)&&(g||(O=b),g=!0,E[N++]=parseInt(t[x],10),S+=1),g&&(m+=1),p&&(w+=1),b+=1,x+=1;else{if(p)return new y(new e(a));p=!0,x+=1}if(p&&!b)throw new Error(t+" not a valid Decimal128 string");if("e"==t[x]||"E"==t[x]){var j=t.substr(++x).match(h);if(!j||!j[2])return new y(new e(a));T=parseInt(j[0],10),x+=j[0].length}if(t[x])return new y(new e(a));if(A=0,S){if(B=S-1,v=m,0!=T&&1!=v)for(;"0"==t[O+v-1];)v-=1}else A=0,B=0,E[0]=0,m=1,S=1,v=0;for(T<=w&&w-T>16384?T=-6176:T-=w;T>6111;){if((B+=1)-A>34){var L=E.join("");if(L.match(/^0+$/)){T=6111;break}return new y(new e(r?f:c))}T-=1}for(;T<-6176||S=5&&(W=1,5==Y)){W=E[B]%2==1;for(var I=O+B+2;I=0&&++E[F]>9;F--)if(E[F]=0,0==F){if(!(T<6111))return new y(new e(r?f:c));T+=1,E[F]=1}}if(R=n.fromNumber(0),D=n.fromNumber(0),0==v)R=n.fromNumber(0),D=n.fromNumber(0);else if(B-A<17){var F=A;for(D=n.fromNumber(E[F++]),R=new n(0,0);F<=B;F++)D=D.multiply(n.fromNumber(10)),D=D.add(n.fromNumber(E[F]))}else{var F=A;for(R=n.fromNumber(E[F++]);F<=B-17;F++)R=R.multiply(n.fromNumber(10)),R=R.add(n.fromNumber(E[F]));for(D=n.fromNumber(E[F++]);F<=B;F++)D=D.multiply(n.fromNumber(10)),D=D.add(n.fromNumber(E[F]))}var $=_(R,n.fromString("100000000000000000"));$.low=$.low.add(D),d($.low,D)&&($.high=$.high.add(n.fromNumber(1)));var P=T+s,K={low:n.fromNumber(0),high:n.fromNumber(0)};$.high.shiftRightUnsigned(49).and(n.fromNumber(1)).equals(n.fromNumber)?(K.high=K.high.or(n.fromNumber(3).shiftLeft(61)),K.high=K.high.or(n.fromNumber(P).and(n.fromNumber(16383).shiftLeft(47))),K.high=K.high.or($.high.and(n.fromNumber(0x7fffffffffff)))):(K.high=K.high.or(n.fromNumber(16383&P).shiftLeft(49)),K.high=K.high.or($.high.and(n.fromNumber(562949953421311)))),K.low=$.low,r&&(K.high=K.high.or(n.fromString("9223372036854775808")));var J=new e(16),x=0;return J[x++]=255&K.low.low_,J[x++]=K.low.low_>>8&255,J[x++]=K.low.low_>>16&255,J[x++]=K.low.low_>>24&255,J[x++]=255&K.low.high_,J[x++]=K.low.high_>>8&255,J[x++]=K.low.high_>>16&255,J[x++]=K.low.high_>>24&255,J[x++]=255&K.high.low_,J[x++]=K.high.low_>>8&255,J[x++]=K.high.low_>>16&255,J[x++]=K.high.low_>>24&255,J[x++]=255&K.high.high_,J[x++]=K.high.high_>>8&255,J[x++]=K.high.high_>>16&255,J[x++]=K.high.high_>>24&255,new y(J)};var s=6176;y.prototype.toString=function(){for(var t,e,r,i,o,u,a=0,f=new Array(36),c=0;c>26&31)>>3==3){if(30==o)return m.join("")+"Infinity";if(31==o)return"NaN";u=t>>15&16383,_=8+(t>>14&1)}else _=t>>14&7,u=t>>17&16383;if(h=u-s,b.parts[0]=(16383&t)+((15&_)<<14),b.parts[1]=e,b.parts[2]=r,b.parts[3]=i,0==b.parts[0]&&0==b.parts[1]&&0==b.parts[2]&&0==b.parts[3])v=!0;else for(var y=3;y>=0;y--){var O=0,E=p(b);if(b=E.quotient,O=E.rem.low_)for(var d=8;d>=0;d--)f[9*y+d]=O%10,O=Math.floor(O/10)}if(v)a=1,f[g]=0;else{a=36;for(var c=0;!f[g];)c++,a-=1,g+=1}if((l=a-1+h)>=34||l<=-7||h>0){m.push(f[g++]),a-=1,a&&m.push(".");for(var c=0;c0?m.push("+"+l):m.push(l)}else if(h>=0)for(var c=0;c0)for(var c=0;c>8&255,u[1]=t>>16&255,u[0]=t>>24&255,u[6]=255&n,u[5]=n>>8&255,u[4]=n>>16&255,u[8]=255&i,u[7]=i>>8&255,u[11]=255&o,u[10]=o>>8&255,u[9]=o>>16&255,u},u.prototype.toString=function(t){return this.id&&this.id.copy?this.id.toString("string"==typeof t?t:"hex"):this.toHexString()},u.prototype.inspect=u.prototype.toString,u.prototype.toJSON=function(){return this.toHexString()},u.prototype.equals=function(t){return t instanceof u?this.toString()==t.toString():"string"==typeof t&&u.isValid(t)&&12==t.length&&this.id instanceof c?t===this.id.toString("binary"):"string"==typeof t&&u.isValid(t)&&24==t.length?t.toLowerCase()===this.toHexString():"string"==typeof t&&u.isValid(t)&&12==t.length?t===this.id:!(null==t||!(t instanceof u||t.toHexString))&&t.toHexString()===this.toHexString()},u.prototype.getTimestamp=function(){var t=new Date,e=this.id[3]|this.id[2]<<8|this.id[1]<<16|this.id[0]<<24;return t.setTime(1e3*Math.floor(e)),t},u.index=~~(16777215*Math.random()),u.createPk=function(){return new u},u.createFromTime=function(t){var r=new e([0,0,0,0,0,0,0,0,0,0,0,0]);return r[3]=255&t,r[2]=t>>8&255,r[1]=t>>16&255,r[0]=t>>24&255,new u(r)};for(var f=("0123456789abcdef".split(""),[]),a=0;a<10;)f[48+a]=a++;for(;a<16;)f[55+a]=f[87+a]=a++;var c=e,h=function(t){return t.toString("hex")};u.createFromHexString=function(t){if(void 0===t||null!=t&&24!=t.length)throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");if(o)return new u(new e(t,"hex"));for(var r=new c(12),n=0,i=0;i<24;)r[n++]=f[t.charCodeAt(i++)]<<4|f[t.charCodeAt(i++)];return new u(r)},u.isValid=function(t){return null!=t&&("number"==typeof t||("string"==typeof t?12==t.length||24==t.length&&i.test(t):t instanceof u||(t instanceof c||!!t.toHexString&&(12==t.id.length||24==t.id.length&&i.test(t.id)))))},Object.defineProperty(u.prototype,"generationTime",{enumerable:!0,get:function(){return this.id[3]|this.id[2]<<8|this.id[1]<<16|this.id[0]<<24},set:function(t){this.id[3]=255&t,this.id[2]=t>>8&255,this.id[1]=t>>16&255,this.id[0]=t>>24&255}}),t.exports=u,t.exports.ObjectID=u,t.exports.ObjectId=u}).call(e,r(0).Buffer,r(23))},function(t,e,r){"use strict";function n(t,e){if(!(this instanceof n))return new n;this._bsontype="BSONRegExp",this.pattern=t||"",this.options=e||"";for(var r=0;r=0?this.low_:n.TWO_PWR_32_DBL_+this.low_},n.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(n.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var t=0!=this.high_?this.high_:this.low_,e=31;e>0&&0==(t&1<0},n.prototype.greaterThanOrEqual=function(t){return this.compare(t)>=0},n.prototype.compare=function(t){if(this.equals(t))return 0;var e=this.isNegative(),r=t.isNegative();return e&&!r?-1:!e&&r?1:this.subtract(t).isNegative()?-1:1},n.prototype.negate=function(){return this.equals(n.MIN_VALUE)?n.MIN_VALUE:this.not().add(n.ONE)},n.prototype.add=function(t){var e=this.high_>>>16,r=65535&this.high_,i=this.low_>>>16,o=65535&this.low_,u=t.high_>>>16,s=65535&t.high_,a=t.low_>>>16,f=65535&t.low_,c=0,h=0,l=0,p=0;return p+=o+f,l+=p>>>16,p&=65535,l+=i+a,h+=l>>>16,l&=65535,h+=r+s,c+=h>>>16,h&=65535,c+=e+u,c&=65535,n.fromBits(l<<16|p,c<<16|h)},n.prototype.subtract=function(t){return this.add(t.negate())},n.prototype.multiply=function(t){if(this.isZero())return n.ZERO;if(t.isZero())return n.ZERO;if(this.equals(n.MIN_VALUE))return t.isOdd()?n.MIN_VALUE:n.ZERO;if(t.equals(n.MIN_VALUE))return this.isOdd()?n.MIN_VALUE:n.ZERO;if(this.isNegative())return t.isNegative()?this.negate().multiply(t.negate()):this.negate().multiply(t).negate();if(t.isNegative())return this.multiply(t.negate()).negate();if(this.lessThan(n.TWO_PWR_24_)&&t.lessThan(n.TWO_PWR_24_))return n.fromNumber(this.toNumber()*t.toNumber());var e=this.high_>>>16,r=65535&this.high_,i=this.low_>>>16,o=65535&this.low_,u=t.high_>>>16,s=65535&t.high_,a=t.low_>>>16,f=65535&t.low_,c=0,h=0,l=0,p=0;return p+=o*f,l+=p>>>16,p&=65535,l+=i*f,h+=l>>>16,l&=65535,l+=o*a,h+=l>>>16,l&=65535,h+=r*f,c+=h>>>16,h&=65535,h+=i*a,c+=h>>>16,h&=65535,h+=o*s,c+=h>>>16,h&=65535,c+=e*f+r*a+i*s+o*u,c&=65535,n.fromBits(l<<16|p,c<<16|h)},n.prototype.div=function(t){if(t.isZero())throw Error("division by zero");if(this.isZero())return n.ZERO;if(this.equals(n.MIN_VALUE)){if(t.equals(n.ONE)||t.equals(n.NEG_ONE))return n.MIN_VALUE;if(t.equals(n.MIN_VALUE))return n.ONE;var e=this.shiftRight(1),r=e.div(t).shiftLeft(1);if(r.equals(n.ZERO))return t.isNegative()?n.ONE:n.NEG_ONE;var i=this.subtract(t.multiply(r));return r.add(i.div(t))}if(t.equals(n.MIN_VALUE))return n.ZERO;if(this.isNegative())return t.isNegative()?this.negate().div(t.negate()):this.negate().div(t).negate();if(t.isNegative())return this.div(t.negate()).negate();for(var o=n.ZERO,i=this;i.greaterThanOrEqual(t);){for(var r=Math.max(1,Math.floor(i.toNumber()/t.toNumber())),u=Math.ceil(Math.log(r)/Math.LN2),s=u<=48?1:Math.pow(2,u-48),a=n.fromNumber(r),f=a.multiply(t);f.isNegative()||f.greaterThan(i);)r-=s,a=n.fromNumber(r),f=a.multiply(t);a.isZero()&&(a=n.ONE),o=o.add(a),i=i.subtract(f)}return o},n.prototype.modulo=function(t){return this.subtract(this.div(t).multiply(t))},n.prototype.not=function(){return n.fromBits(~this.low_,~this.high_)},n.prototype.and=function(t){return n.fromBits(this.low_&t.low_,this.high_&t.high_)},n.prototype.or=function(t){return n.fromBits(this.low_|t.low_,this.high_|t.high_)},n.prototype.xor=function(t){return n.fromBits(this.low_^t.low_,this.high_^t.high_)},n.prototype.shiftLeft=function(t){if(0==(t&=63))return this;var e=this.low_;if(t<32){var r=this.high_;return n.fromBits(e<>>32-t)}return n.fromBits(0,e<>>t|e<<32-t,e>>t)}return n.fromBits(e>>t-32,e>=0?0:-1)},n.prototype.shiftRightUnsigned=function(t){if(0==(t&=63))return this;var e=this.high_;if(t<32){var r=this.low_;return n.fromBits(r>>>t|e<<32-t,e>>>t)}return 32==t?n.fromBits(e,0):n.fromBits(e>>>t-32,0)},n.fromInt=function(t){if(-128<=t&&t<128){var e=n.INT_CACHE_[t];if(e)return e}var r=new n(0|t,t<0?-1:0);return-128<=t&&t<128&&(n.INT_CACHE_[t]=r),r},n.fromNumber=function(t){return isNaN(t)||!isFinite(t)?n.ZERO:t<=-n.TWO_PWR_63_DBL_?n.MIN_VALUE:t+1>=n.TWO_PWR_63_DBL_?n.MAX_VALUE:t<0?n.fromNumber(-t).negate():new n(t%n.TWO_PWR_32_DBL_|0,t/n.TWO_PWR_32_DBL_|0)},n.fromBits=function(t,e){return new n(t,e)},n.fromString=function(t,e){if(0==t.length)throw Error("number format error: empty string");var r=e||10;if(r<2||36=0)throw Error('number format error: interior "-" character: '+t);for(var i=n.fromNumber(Math.pow(r,8)),o=n.ZERO,u=0;u=200&&t.status<300)return t;var e=new Error(t.statusText);return e.response=t,e.error=t.statusText,t.json().catch(function(){return Promise.reject(e)}).then(function(t){return Promise.reject(Object.assign(e,t))})},e.makeFetchArgs=function(t,e){var r={method:t,headers:{Accept:n,"Content-Type":n}};return e&&(r.body=e),r.cors=!0,r}},function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";var n=function t(e){if(!(this instanceof t))return new t(e);this._bsontype="Int32",this.value=e};n.prototype.valueOf=function(){return this.value},n.prototype.toJSON=function(){return this.value},t.exports=n,t.exports.Int32=n},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:{};return void 0===t||void 0===e?this.authenticate("anon",r):this.authenticate("userpass",Object.assign({username:t,password:e},r))}},{key:"register",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.auth.provider("userpass").register(t,e,r)}},{key:"authenticate",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.auth.getAccessToken()?Promise.resolve(this.auth.authedId()):this.auth.provider(t).authenticate(r).then(function(){return e.auth.authedId()})}},{key:"logout",value:function(){var t=this;return this._do("/auth/session","DELETE",{refreshOnFailure:!1,useRefreshToken:!0,rootURL:this.rootURLsByAPIVersion[w][N]}).then(function(){return t.auth.clear()})}},{key:"authError",value:function(){return this.auth.error()}},{key:"userProfile",value:function(){return this._do("/auth/profile","GET",{rootURL:this.rootURLsByAPIVersion[w][N]}).then(function(t){return t.json()})}},{key:"authedId",value:function(){return this.auth.authedId()}},{key:"service",value:function(e,r){if(this.constructor!==t)throw new b.StitchError("`service` is a factory method, do not use `new`");if(!h.default.hasOwnProperty(e))throw new b.StitchError("Invalid service type specified: "+e);return new(0,h.default[e])(this,r)}},{key:"executeFunction",value:function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n2?r-2:0),i=2;i=200&&i.status<300)return Promise.resolve(i);if(i.headers.get("Content-Type")===p.JSONTYPE)return i.json().then(function(o){if("error_code"in o&&o.error_code===b.ErrInvalidSession){if(!r.refreshOnFailure){n.auth.clear();var u=new b.StitchError(o.error,o.error_code);throw u.response=i,u.json=o,u}return n.auth.refreshToken().then(function(){return r.refreshOnFailure=!1,n._do(t,e,r)})}var s=new b.StitchError(o.error,o.error_code);return s.response=i,s.json=o,Promise.reject(s)});var o=new Error(i.statusText);return o.response=i,Promise.reject(o)})}},{key:"authWithOAuth",value:function(t,e){return this.auth.provider(t).authenticate({redirectUrl:e})}},{key:"anonymousAuth",value:function(){return this.authenticate("anon")}},{key:"type",get:function(){return p.APP_CLIENT_TYPE}}]),t}();e.default=B,B.prototype.authWithOAuth=(0,v.deprecate)(B.prototype.authWithOAuth,"use `authenticate` instead of `authWithOAuth`"),B.prototype.anonymousAuth=(0,v.deprecate)(B.prototype.anonymousAuth,"use `login()` instead of `anonymousAuth`"),t.exports=e.default},function(t,e,r){"use strict";(function(e){if(void 0!==e.Map)t.exports=e.Map,t.exports.Map=e.Map;else{var r=function(t){this._keys=[],this._values={};for(var e=0;e1)for(var r=1;r2?r-2:0),o=2;o1&&void 0!==arguments[1]?arguments[1]:"";return e._post(n+"/debug/execute_function",{name:u,arguments:i},{user_id:t})},executeFunctionSource:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return e._post(n+"/debug/execute_function_source",{source:r,eval_source:i},{user_id:t})}}},authProviders:function(){return{list:function(){return e._get(n+"/auth_providers")},create:function(t){return e._post(n+"/auth_providers",t)},authProvider:function(t){return{get:function(){return e._get(n+"/auth_providers/"+t)},update:function(r){return e._patch(n+"/auth_providers/"+t,r)},enable:function(){return e._put(n+"/auth_providers/"+t+"/enable")},disable:function(){return e._put(n+"/auth_providers/"+t+"/disable")},remove:function(){return e._delete(n+"/auth_providers/"+t)}}}}},security:function(){return{allowedRequestOrigins:function(){return{get:function(){return e._get(n+"/security/allowed_request_origins")},update:function(t){return e._post(n+"/security/allowed_request_origins",t)}}}}},logs:function(){return{list:function(t){return e._get(n+"/logs",t)}}},apiKeys:function(){return{list:function(){return e._get(n+"/api_keys")},create:function(t){return e._post(n+"/api_keys",t)},apiKey:function(t){return{get:function(){return e._get(n+"/api_keys/"+t)},remove:function(){return e._delete(n+"/api_keys/"+t)},enable:function(){return e._put(n+"/api_keys/"+t+"/enable")},disable:function(){return e._put(n+"/api_keys/"+t+"/disable")}}}}},functions:function(){return{list:function(){return e._get(n+"/functions")},create:function(t){return e._post(n+"/functions",t)},function:function(t){return{get:function(){return e._get(n+"/functions/"+t)},update:function(r){return e._put(n+"/functions/"+t,r)},remove:function(){return e._delete(n+"/functions/"+t)}}}}}}}}}},{key:"v2",value:function(){var t=this._v2;return{apps:function(e){var r="/groups/"+e+"/apps";return{list:function(){return t._get(r)},create:function(e,n){var i=n&&n.defaults?"?defaults=true":"";return t._post(r+i,e)},app:function(e){var n=r+"/"+e;return{get:function(){return t._get(n)},remove:function(){return t._delete(n)},pipelines:function(){return{list:function(){return t._get(n+"/pipelines")},create:function(e){return t._post(n+"/pipelines",e)},pipeline:function(e){var r=n+"/pipelines/"+e;return{get:function(){return t._get(r)},remove:function(){return t._delete(r)},update:function(e){return t._put(r,e)}}}}},values:function(){return{list:function(){return t._get(n+"/values")},create:function(e){return t._post(n+"/values",e)},value:function(e){var r=n+"/values/"+e;return{get:function(){return t._get(r)},remove:function(){return t._delete(r)},update:function(e){return t._put(r,e)}}}}},services:function(){return{list:function(){return t._get(n+"/services")},create:function(e){return t._post(n+"/services",e)},service:function(e){return{get:function(){return t._get(n+"/services/"+e)},remove:function(){return t._delete(n+"/services/"+e)},runCommand:function(r,i){return t._post(n+"/services/"+e+"/commands/"+r,i)},config:function(){return{get:function(){return t._get(n+"/services/"+e+"/config")},update:function(r){return t._patch(n+"/services/"+e+"/config",r)}}},rules:function(){return{list:function(){return t._get(n+"/services/"+e+"/rules")},create:function(r){return t._post(n+"/services/"+e+"/rules",r)},rule:function(r){var i=n+"/services/"+e+"/rules/"+r;return{get:function(){return t._get(i)},update:function(e){return t._put(i,e)},remove:function(){return t._delete(i)}}}}},incomingWebhooks:function(){return{list:function(){return t._get(n+"/services/"+e+"/incoming_webhooks")},create:function(r){return t._post(n+"/services/"+e+"/incoming_webhooks",r)},incomingWebhook:function(r){var i=n+"/services/"+e+"/incoming_webhooks/"+r;return{get:function(){return t._get(i)},update:function(e){return t._put(i,e)},remove:function(){return t._delete(i)}}}}}}}}},pushNotifications:function(){return{list:function(e){return t._get(n+"/push/notifications",e)},create:function(e){return t._post(n+"/push/notifications",e)},pushNotification:function(e){return{get:function(){return t._get(n+"/push/notifications/"+e)},update:function(r){return t._put(n+"/push/notifications/"+e,r)},setType:function(r){return t._put(n+"/push/notifications/"+e+"/type",{type:r})},remove:function(){return t._delete(n+"/push/notifications/"+e)}}}}},users:function(){return{list:function(e){return t._get(n+"/users",e)},create:function(e){return t._post(n+"/users",e)},user:function(e){return{get:function(){return t._get(n+"/users/"+e)},logout:function(){return t._put(n+"/users/"+e+"/logout")},remove:function(){return t._delete(n+"/users/"+e)}}}}},dev:function(){return{executePipeline:function(e,r,i){return t._post(n+"/dev/pipeline",e,Object.assign({},i,{user_id:r}))}}},authProviders:function(){return{list:function(){return t._get(n+"/auth_providers")},create:function(e){return t._post(n+"/auth_providers",e)},authProvider:function(e){return{get:function(){return t._get(n+"/auth_providers/"+e)},update:function(r){return t._patch(n+"/auth_providers/"+e,r)},enable:function(){return t._put(n+"/auth_providers/"+e+"/enable")},disable:function(){return t._put(n+"/auth_providers/"+e+"/disable")},remove:function(){return t._delete(n+"/auth_providers/"+e)}}}}},security:function(){return{allowedRequestOrigins:function(){return{get:function(){return t._get(n+"/security/allowed_request_origins")},update:function(e){return t._post(n+"/security/allowed_request_origins",e)}}}}},logs:function(){return{list:function(e){return t._get(n+"/logs",e)}}},apiKeys:function(){return{list:function(){return t._get(n+"/api_keys")},create:function(e){return t._post(n+"/api_keys",e)},apiKey:function(e){return{get:function(){return t._get(n+"/api_keys/"+e)},remove:function(){return t._delete(n+"/api_keys/"+e)},enable:function(){return t._put(n+"/api_keys/"+e+"/enable")},disable:function(){return t._put(n+"/api_keys/"+e+"/disable")}}}}}}}}}}}},{key:"_admin",value:function(){var t=this;return{logs:function(){return{get:function(r){return a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_do",t).call(t,"/admin/logs","GET",{useRefreshToken:!0,queryParams:r})}}},users:function(){return{list:function(r){return a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_do",t).call(t,"/admin/users","GET",{useRefreshToken:!0,queryParams:r})},user:function(r){return{logout:function(){return a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_do",t).call(t,"/admin/users/"+r+"/logout","PUT",{useRefreshToken:!0})}}}}}}}},{key:"_isImpersonatingUser",value:function(){return this.auth.isImpersonatingUser()}},{key:"_startImpersonation",value:function(t){return this.auth.startImpersonation(this,t)}},{key:"_stopImpersonation",value:function(){return this.auth.stopImpersonation()}},{key:"type",get:function(){return l.default}},{key:"_v3",get:function(){var t=this,r=function(r,n,i){return a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_do",t).call(t,r,n,Object.assign({},{apiVersion:3},i)).then(function(t){return(t.headers.get("content-type")||"").split(",").indexOf("application/json")>=0?t.json():t})};return{_get:function(t,e){return r(t,"GET",{queryParams:e})},_put:function(t,e){return e?r(t,"PUT",{body:JSON.stringify(e)}):r(t,"PUT")},_patch:function(t,e){return e?r(t,"PATCH",{body:JSON.stringify(e)}):r(t,"PATCH")},_delete:function(t){return r(t,"DELETE")},_post:function(t,e,n){return n?r(t,"POST",{body:JSON.stringify(e),queryParams:n}):r(t,"POST",{body:JSON.stringify(e)})}}}},{key:"_v2",get:function(){var t=this,r=function(r,n,i){return a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_do",t).call(t,r,n,Object.assign({},{apiVersion:2},i)).then(function(t){return(t.headers.get("content-type")||"").split(",").indexOf("application/json")>=0?t.json():t})};return{_get:function(t,e){return r(t,"GET",{queryParams:e})},_put:function(t,e){return e?r(t,"PUT",{body:JSON.stringify(e)}):r(t,"PUT")},_patch:function(t,e){return e?r(t,"PATCH",{body:JSON.stringify(e)}):r(t,"PATCH")},_delete:function(t){return r(t,"DELETE")},_post:function(t,e,n){return n?r(t,"POST",{body:JSON.stringify(e),queryParams:n}):r(t,"POST",{body:JSON.stringify(e)})}}}}]),e}(c.default);e.default=_,t.exports=e.default},function(t,e,r){!function(){function t(t){this.message=t}var r=e,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.prototype=new Error,t.prototype.name="InvalidCharacterError",r.btoa||(r.btoa=function(e){for(var r,i,o=String(e),u=0,s=n,a="";o.charAt(0|u)||(s="=",u%1);a+=s.charAt(63&r>>8-u%1*8)){if((i=o.charCodeAt(u+=.75))>255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");r=r<<8|i}return a}),r.atob||(r.atob=function(e){var r=String(e).replace(/[=]+$/,"");if(r.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var i,o,u=0,s=0,a="";o=r.charAt(s++);~o&&(i=u%4?64*i+o:o,u++%4)?a+=String.fromCharCode(255&i>>(-2*u&6)):0)o=n.indexOf(o);return a})}()},function(t,e,r){"use strict";(function(e){var n=(r(1).writeIEEE754,r(1).readIEEE754,r(20)),i=r(3),o=r(8),u=r(14),s=r(11),a=r(12),f=r(13),c=r(18),h=r(5),l=r(7),p=r(10),_=r(9),d=r(6),y=r(4),g=r(28),v=r(29),b=r(27),m=new e(17825792),w=function(){};w.prototype.serialize=function(t,r){r=r||{};var n="boolean"==typeof r.checkKeys&&r.checkKeys,i="boolean"==typeof r.serializeFunctions&&r.serializeFunctions,o="boolean"!=typeof r.ignoreUndefined||r.ignoreUndefined,u=v(m,t,n,0,0,i,o,[]),s=new e(u);return m.copy(s,0,0,s.length),s},w.prototype.serializeWithBufferAndIndex=function(t,e,r){r=r||{};var n="boolean"==typeof r.checkKeys&&r.checkKeys,i="boolean"==typeof r.serializeFunctions&&r.serializeFunctions,o="boolean"!=typeof r.ignoreUndefined||r.ignoreUndefined,u="number"==typeof r.index?r.index:0,s=v(m,t,n,u||0,0,i,o);return m.copy(e,u,0,s),s-1},w.prototype.deserialize=function(t,e){return g(t,e)},w.prototype.calculateObjectSize=function(t,e){e=e||{};var r="boolean"==typeof e.serializeFunctions&&e.serializeFunctions,n="boolean"!=typeof e.ignoreUndefined||e.ignoreUndefined;return b(t,r,n)},w.prototype.deserializeStream=function(t,e,r,n,i,o){o=null!=o?o:{};for(var u=e,s=0;s=b.JS_INT_MIN&&r<=b.JS_INT_MAX&&r>=b.BSON_INT32_MIN&&r<=b.BSON_INT32_MAX?(null!=t?e.byteLength(t,"utf8")+1:0)+5:(null!=t?e.byteLength(t,"utf8")+1:0)+9;case"undefined":return m||!w?(null!=t?e.byteLength(t,"utf8")+1:0)+1:0;case"boolean":return(null!=t?e.byteLength(t,"utf8")+1:0)+2;case"object":if(null==r||r instanceof p||r instanceof _||"MinKey"==r._bsontype||"MaxKey"==r._bsontype)return(null!=t?e.byteLength(t,"utf8")+1:0)+1;if(r instanceof a||"ObjectID"==r._bsontype)return(null!=t?e.byteLength(t,"utf8")+1:0)+13;if(r instanceof Date||g(r))return(null!=t?e.byteLength(t,"utf8")+1:0)+9;if(void 0!==e&&e.isBuffer(r))return(null!=t?e.byteLength(t,"utf8")+1:0)+6+r.length;if(r instanceof o||r instanceof u||r instanceof s||"Long"==r._bsontype||"Double"==r._bsontype||"Timestamp"==r._bsontype)return(null!=t?e.byteLength(t,"utf8")+1:0)+9;if(r instanceof l||"Decimal128"==r._bsontype)return(null!=t?e.byteLength(t,"utf8")+1:0)+17;if(r instanceof h||"Code"==r._bsontype)return null!=r.scope&&Object.keys(r.scope).length>0?(null!=t?e.byteLength(t,"utf8")+1:0)+1+4+4+e.byteLength(r.code.toString(),"utf8")+1+v(r.scope,n,w):(null!=t?e.byteLength(t,"utf8")+1:0)+1+4+e.byteLength(r.code.toString(),"utf8")+1;if(r instanceof y||"Binary"==r._bsontype)return r.sub_type==y.SUBTYPE_BYTE_ARRAY?(null!=t?e.byteLength(t,"utf8")+1:0)+(r.position+1+4+1+4):(null!=t?e.byteLength(t,"utf8")+1:0)+(r.position+1+4+1);if(r instanceof f||"Symbol"==r._bsontype)return(null!=t?e.byteLength(t,"utf8")+1:0)+e.byteLength(r.value,"utf8")+4+1+1;if(r instanceof d||"DBRef"==r._bsontype){var O={$ref:r.namespace,$id:r.oid};return null!=r.db&&(O.$db=r.db),(null!=t?e.byteLength(t,"utf8")+1:0)+1+v(O,n,w)}return r instanceof RegExp||"[object RegExp]"===Object.prototype.toString.call(r)?(null!=t?e.byteLength(t,"utf8")+1:0)+1+e.byteLength(r.source,"utf8")+1+(r.global?1:0)+(r.ignoreCase?1:0)+(r.multiline?1:0)+1:r instanceof c||"BSONRegExp"==r._bsontype?(null!=t?e.byteLength(t,"utf8")+1:0)+1+e.byteLength(r.pattern,"utf8")+1+e.byteLength(r.options,"utf8")+1:(null!=t?e.byteLength(t,"utf8")+1:0)+v(r,n,w)+1;case"function":if(r instanceof RegExp||"[object RegExp]"===Object.prototype.toString.call(r)||"[object RegExp]"==String.call(r))return(null!=t?e.byteLength(t,"utf8")+1:0)+1+e.byteLength(r.source,"utf8")+1+(r.global?1:0)+(r.ignoreCase?1:0)+(r.multiline?1:0)+1;if(n&&null!=r.scope&&Object.keys(r.scope).length>0)return(null!=t?e.byteLength(t,"utf8")+1:0)+1+4+4+e.byteLength(r.toString(),"utf8")+1+v(r.scope,n,w);if(n)return(null!=t?e.byteLength(t,"utf8")+1:0)+1+4+e.byteLength(r.toString(),"utf8")+1}return 0}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=(r(1).writeIEEE754,r(1).readIEEE754,r(3).Long),u=r(8).Double,s=r(14).Timestamp,a=r(11).ObjectID,f=r(13).Symbol,c=r(12).BSONRegExp,h=r(5).Code,l=r(7),p=r(10).MinKey,_=r(9).MaxKey,d=r(6).DBRef,y=r(4).Binary,g=function(t){return"object"===(void 0===t?"undefined":i(t))&&"[object Date]"===Object.prototype.toString.call(t)},v=function(t,e,r){var i=5;if(Array.isArray(t))for(var o=0;ot.length)throw new Error("corrupt bson message");if(0!=t[n+i-1])throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return deserializeObject(t,n,e,r)},deserializeObject=function t(e,r,n,i){var o=null!=n.evalFunctions&&n.evalFunctions,u=null!=n.cacheFunctions&&n.cacheFunctions,s=null!=n.cacheFunctionsCrc32&&n.cacheFunctionsCrc32,a=null==n.fieldsAsRaw?null:n.fieldsAsRaw,f=null!=n.raw&&n.raw,c="boolean"==typeof n.bsonRegExp&&n.bsonRegExp,h=null!=n.promoteBuffers&&n.promoteBuffers,l=null==n.promoteLongs||n.promoteLongs,p=null==n.promoteValues||n.promoteValues,_=r;if(e.length<5)throw new Error("corrupt bson message < 5 bytes long");var d=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;if(d<5||d>e.length)throw new Error("corrupt bson message");for(var y=i?[]:{},g=0;;){var v=e[r++];if(0==v)break;for(var b=r;0!==e[b]&&b=e.length)throw new Error("Bad BSON Document: illegal CString");var m=i?g++:e.toString("utf8",r,b);if(r=b+1,v==BSON.BSON_DATA_STRING){var w=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;if(w<=0||w>e.length-r||0!=e[r+w-1])throw new Error("bad string length in bson");y[m]=e.toString("utf8",r,r+w-1),r+=w}else if(v==BSON.BSON_DATA_OID){var O=new Buffer(12);e.copy(O,0,r,r+12),y[m]=new ObjectID(O),r+=12}else if(v==BSON.BSON_DATA_INT&&0==p)y[m]=new Int32(e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24);else if(v==BSON.BSON_DATA_INT)y[m]=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;else if(v==BSON.BSON_DATA_NUMBER&&0==p)y[m]=new Double(e.readDoubleLE(r)),r+=8;else if(v==BSON.BSON_DATA_NUMBER)y[m]=e.readDoubleLE(r),r+=8;else if(v==BSON.BSON_DATA_DATE){var E=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24,S=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;y[m]=new Date(new Long(E,S).toNumber())}else if(v==BSON.BSON_DATA_BOOLEAN){if(0!=e[r]&&1!=e[r])throw new Error("illegal boolean type value");y[m]=1==e[r++]}else if(v==BSON.BSON_DATA_OBJECT){var N=r,A=e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24;if(A<=0||A>e.length-r)throw new Error("bad embedded document length in bson");y[m]=f?e.slice(r,r+A):t(e,N,n,!1),r+=A}else if(v==BSON.BSON_DATA_ARRAY){var N=r,A=e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24,B=n,T=r+A;if(a&&a[m]){B={};for(var I in n)B[I]=n[I];B.raw=!0}if(y[m]=t(e,N,B,!0),r+=A,0!=e[r-1])throw new Error("invalid array terminator byte");if(r!=T)throw new Error("corrupted array bson")}else if(v==BSON.BSON_DATA_UNDEFINED)y[m]=void 0;else if(v==BSON.BSON_DATA_NULL)y[m]=null;else if(v==BSON.BSON_DATA_LONG){var E=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24,S=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24,R=new Long(E,S);y[m]=l&&1==p&&R.lessThanOrEqual(JS_INT_MAX_LONG)&&R.greaterThanOrEqual(JS_INT_MIN_LONG)?R.toNumber():R}else if(v==BSON.BSON_DATA_DECIMAL128){var D=new Buffer(16);e.copy(D,0,r,r+16),r+=16;var P=new Decimal128(D);y[m]=P.toObject?P.toObject():P}else if(v==BSON.BSON_DATA_BINARY){var x=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24,U=x,M=e[r++];if(x<0)throw new Error("Negative binary type element size found");if(x>e.length)throw new Error("Binary type size larger than document size");if(null!=e.slice){if(M==Binary.SUBTYPE_BYTE_ARRAY){if((x=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24)<0)throw new Error("Negative binary type element size found for subtype 0x02");if(x>U-4)throw new Error("Binary type with subtype 0x02 contains to long binary size");if(xU-4)throw new Error("Binary type with subtype 0x02 contains to long binary size");if(x=e.length)throw new Error("Bad BSON Document: illegal CString");var j=e.toString("utf8",r,b);r=b+1;for(var b=r;0!==e[b]&&b=e.length)throw new Error("Bad BSON Document: illegal CString");var L=e.toString("utf8",r,b);r=b+1;for(var C=new Array(L.length),b=0;b=e.length)throw new Error("Bad BSON Document: illegal CString");var j=e.toString("utf8",r,b);r=b+1;for(var b=r;0!==e[b]&&b=e.length)throw new Error("Bad BSON Document: illegal CString");var L=e.toString("utf8",r,b);r=b+1,y[m]=new BSONRegExp(j,L)}else if(v==BSON.BSON_DATA_SYMBOL){var w=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;if(w<=0||w>e.length-r||0!=e[r+w-1])throw new Error("bad string length in bson");y[m]=new _Symbol(e.toString("utf8",r,r+w-1)),r+=w}else if(v==BSON.BSON_DATA_TIMESTAMP){var E=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24,S=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;y[m]=new Timestamp(E,S)}else if(v==BSON.BSON_DATA_MIN_KEY)y[m]=new MinKey;else if(v==BSON.BSON_DATA_MAX_KEY)y[m]=new MaxKey;else if(v==BSON.BSON_DATA_CODE){var w=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;if(w<=0||w>e.length-r||0!=e[r+w-1])throw new Error("bad string length in bson");var Y=e.toString("utf8",r,r+w-1);if(o){if(u){var W=s?crc32(Y):Y;y[m]=isolateEvalWithHash(functionCache,W,Y,y)}else y[m]=isolateEval(Y)}else y[m]=new Code(Y);r+=w}else if(v==BSON.BSON_DATA_CODE_W_SCOPE){var F=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;if(F<13)throw new Error("code_w_scope total size shorter minimum expected length");var w=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;if(w<=0||w>e.length-r||0!=e[r+w-1])throw new Error("bad string length in bson");var Y=e.toString("utf8",r,r+w-1);r+=w;var N=r,A=e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24,$=t(e,N,n,!1);if(r+=A,F<8+A+w)throw new Error("code_w_scope total size is to short, truncating scope");if(F>8+A+w)throw new Error("code_w_scope total size is to long, clips outer document");if(o){if(u){var W=s?crc32(Y):Y;y[m]=isolateEvalWithHash(functionCache,W,Y,y)}else y[m]=isolateEval(Y);y[m].scope=$}else y[m]=new Code(Y,$)}else{if(v!=BSON.BSON_DATA_DBPOINTER)throw new Error("Detected unknown BSON type "+v.toString(16)+' for fieldname "'+m+'", are you using the latest BSON parser');var w=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;if(w<=0||w>e.length-r||0!=e[r+w-1])throw new Error("bad string length in bson");var K=e.toString("utf8",r,r+w-1);r+=w;var J=new Buffer(12);e.copy(J,0,r,r+12);var O=new ObjectID(J);r+=12;var q=K.split("."),V=q.shift(),H=q.join(".");y[m]=new DBRef(H,O,V)}}if(d!=r-_){if(i)throw new Error("corrupt array bson");throw new Error("corrupt object bson")}return null!=y.$id&&(y=new DBRef(y.$ref,y.$id,y.$db)),y},isolateEvalWithHash=function isolateEvalWithHash(functionCache,hash,functionString,object){var value=null;return null==functionCache[hash]&&(eval("value = "+functionString),functionCache[hash]=value),functionCache[hash].bind(object)},isolateEval=function isolateEval(functionString){var value=null;return eval("value = "+functionString),value},BSON={},functionCache=BSON.functionCache={};BSON.BSON_DATA_NUMBER=1,BSON.BSON_DATA_STRING=2,BSON.BSON_DATA_OBJECT=3,BSON.BSON_DATA_ARRAY=4,BSON.BSON_DATA_BINARY=5,BSON.BSON_DATA_UNDEFINED=6,BSON.BSON_DATA_OID=7,BSON.BSON_DATA_BOOLEAN=8,BSON.BSON_DATA_DATE=9,BSON.BSON_DATA_NULL=10,BSON.BSON_DATA_REGEXP=11,BSON.BSON_DATA_DBPOINTER=12,BSON.BSON_DATA_CODE=13,BSON.BSON_DATA_SYMBOL=14,BSON.BSON_DATA_CODE_W_SCOPE=15,BSON.BSON_DATA_INT=16,BSON.BSON_DATA_TIMESTAMP=17,BSON.BSON_DATA_LONG=18,BSON.BSON_DATA_DECIMAL128=19,BSON.BSON_DATA_MIN_KEY=255,BSON.BSON_DATA_MAX_KEY=127,BSON.BSON_BINARY_SUBTYPE_DEFAULT=0,BSON.BSON_BINARY_SUBTYPE_FUNCTION=1,BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY=2,BSON.BSON_BINARY_SUBTYPE_UUID=3,BSON.BSON_BINARY_SUBTYPE_MD5=4,BSON.BSON_BINARY_SUBTYPE_USER_DEFINED=128,BSON.BSON_INT32_MAX=2147483647,BSON.BSON_INT32_MIN=-2147483648,BSON.BSON_INT64_MAX=Math.pow(2,63)-1,BSON.BSON_INT64_MIN=-Math.pow(2,63),BSON.JS_INT_MAX=9007199254740992,BSON.JS_INT_MIN=-9007199254740992;var JS_INT_MAX_LONG=Long.fromNumber(9007199254740992),JS_INT_MIN_LONG=Long.fromNumber(-9007199254740992);module.exports=deserialize}).call(exports,__webpack_require__(0).Buffer)},function(t,e,r){"use strict";(function(e){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=r(1).writeIEEE754,o=(r(1).readIEEE754,r(3).Long),u=r(20),s=(r(8).Double,r(14).Timestamp,r(11).ObjectID,r(13).Symbol,r(5).Code,r(12).BSONRegExp,r(18).Int32,r(10).MinKey),a=(r(9).MaxKey,r(7),r(6).DBRef,r(4).Binary);try{Uint8Array}catch(t){}var f=/\x00/,c=function(t){return"object"===(void 0===t?"undefined":n(t))&&"[object Date]"===Object.prototype.toString.call(t)},h=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},l=function(t,e,r,n,i){t[n++]=x.BSON_DATA_STRING,n=n+(i?t.write(e,n,"ascii"):t.write(e,n,"utf8"))+1,t[n-1]=0;var o=t.write(r,n+4,"utf8");return t[n+3]=o+1>>24&255,t[n+2]=o+1>>16&255,t[n+1]=o+1>>8&255,t[n]=o+1&255,n=n+4+o,t[n++]=0,n},p=function(t,e,r,n,u){if(Math.floor(r)===r&&r>=x.JS_INT_MIN&&r<=x.JS_INT_MAX)if(r>=x.BSON_INT32_MIN&&r<=x.BSON_INT32_MAX){t[n++]=x.BSON_DATA_INT;var s=u?t.write(e,n,"ascii"):t.write(e,n,"utf8");n+=s,t[n++]=0,t[n++]=255&r,t[n++]=r>>8&255,t[n++]=r>>16&255,t[n++]=r>>24&255}else if(r>=x.JS_INT_MIN&&r<=x.JS_INT_MAX){t[n++]=x.BSON_DATA_NUMBER;var s=u?t.write(e,n,"ascii"):t.write(e,n,"utf8");n+=s,t[n++]=0,i(t,r,n,"little",52,8),n+=8}else{t[n++]=x.BSON_DATA_LONG;var s=u?t.write(e,n,"ascii"):t.write(e,n,"utf8");n+=s,t[n++]=0;var a=o.fromNumber(r),f=a.getLowBits(),c=a.getHighBits();t[n++]=255&f,t[n++]=f>>8&255,t[n++]=f>>16&255,t[n++]=f>>24&255,t[n++]=255&c,t[n++]=c>>8&255,t[n++]=c>>16&255,t[n++]=c>>24&255}else{t[n++]=x.BSON_DATA_NUMBER;var s=u?t.write(e,n,"ascii"):t.write(e,n,"utf8");n+=s,t[n++]=0,i(t,r,n,"little",52,8),n+=8}return n},_=function(t,e,r,n,i){return t[n++]=x.BSON_DATA_NULL,n+=i?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0,n},d=function(t,e,r,n,i){return t[n++]=x.BSON_DATA_BOOLEAN,n+=i?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0,t[n++]=r?1:0,n},y=function(t,e,r,n,i){t[n++]=x.BSON_DATA_DATE,n+=i?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0;var u=o.fromNumber(r.getTime()),s=u.getLowBits(),a=u.getHighBits();return t[n++]=255&s,t[n++]=s>>8&255,t[n++]=s>>16&255,t[n++]=s>>24&255,t[n++]=255&a,t[n++]=a>>8&255,t[n++]=a>>16&255,t[n++]=a>>24&255,n},g=function(t,e,r,n,i){if(t[n++]=x.BSON_DATA_REGEXP,n+=i?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0,r.source&&null!=r.source.match(f))throw Error("value "+r.source+" must not contain null bytes");return n+=t.write(r.source,n,"utf8"),t[n++]=0,r.global&&(t[n++]=115),r.ignoreCase&&(t[n++]=105),r.multiline&&(t[n++]=109),t[n++]=0,n},v=function(t,e,r,n,i){if(t[n++]=x.BSON_DATA_REGEXP,n+=i?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0,null!=r.pattern.match(f))throw Error("pattern "+r.pattern+" must not contain null bytes");return n+=t.write(r.pattern,n,"utf8"),t[n++]=0,n+=t.write(r.options.split("").sort().join(""),n,"utf8"),t[n++]=0,n},b=function(t,e,r,n,i){return t[n++]=null===r?x.BSON_DATA_NULL:r instanceof s?x.BSON_DATA_MIN_KEY:x.BSON_DATA_MAX_KEY,n+=i?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0,n},m=function(t,e,r,n,i){if(t[n++]=x.BSON_DATA_OID,n+=i?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0,"string"==typeof r.id)t.write(r.id,n,"binary");else{if(!r.id||!r.id.copy)throw new Error("object ["+JSON.stringify(r)+"] is not a valid ObjectId");r.id.copy(t,n,0,12)}return n+12},w=function(t,e,r,n,i){t[n++]=x.BSON_DATA_BINARY,n+=i?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0;var o=r.length;return t[n++]=255&o,t[n++]=o>>8&255,t[n++]=o>>16&255,t[n++]=o>>24&255,t[n++]=x.BSON_BINARY_SUBTYPE_DEFAULT,r.copy(t,n,0,o),n+=o},O=function(t,e,r,n,i,o,u,s,a,f){for(var c=0;c>8&255,t[n++]=o>>16&255,t[n++]=o>>24&255,t[n++]=255&u,t[n++]=u>>8&255,t[n++]=u>>16&255,t[n++]=u>>24&255,n},N=function(t,e,r,n,i){return t[n++]=x.BSON_DATA_INT,n+=i?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0,t[n++]=255&r,t[n++]=r>>8&255,t[n++]=r>>16&255,t[n++]=r>>24&255,n},A=function(t,e,r,n,o){return t[n++]=x.BSON_DATA_NUMBER,n+=o?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0,i(t,r,n,"little",52,8),n+=8},B=function(t,e,r,n,i,o,u){t[n++]=x.BSON_DATA_CODE,n+=u?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0;var s=r.toString(),a=t.write(s,n+4,"utf8")+1;return t[n]=255&a,t[n+1]=a>>8&255,t[n+2]=a>>16&255,t[n+3]=a>>24&255,n=n+4+a-1,t[n++]=0,n},T=function(t,e,r,i,o,u,s,a,f){if(r.scope&&"object"==n(r.scope)){t[i++]=x.BSON_DATA_CODE_W_SCOPE;var c=f?t.write(e,i,"ascii"):t.write(e,i,"utf8");i+=c,t[i++]=0;var h=i,l="string"==typeof r.code?r.code:r.code.toString();i+=4;var p=t.write(l,i+4,"utf8")+1;t[i]=255&p,t[i+1]=p>>8&255,t[i+2]=p>>16&255,t[i+3]=p>>24&255,t[i+4+p-1]=0,i=i+p+4;var _=P(t,r.scope,o,i,u+1,s,a);i=_-1;var d=_-h;t[h++]=255&d,t[h++]=d>>8&255,t[h++]=d>>16&255,t[h++]=d>>24&255,t[i++]=0}else{t[i++]=x.BSON_DATA_CODE;var c=f?t.write(e,i,"ascii"):t.write(e,i,"utf8");i+=c,t[i++]=0;var l=r.code.toString(),y=t.write(l,i+4,"utf8")+1;t[i]=255&y,t[i+1]=y>>8&255,t[i+2]=y>>16&255,t[i+3]=y>>24&255,i=i+4+y-1,t[i++]=0}return i},I=function(t,e,r,n,i){t[n++]=x.BSON_DATA_BINARY,n+=i?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0;var o=r.value(!0),u=r.position;return r.sub_type==a.SUBTYPE_BYTE_ARRAY&&(u+=4),t[n++]=255&u,t[n++]=u>>8&255,t[n++]=u>>16&255,t[n++]=u>>24&255,t[n++]=r.sub_type,r.sub_type==a.SUBTYPE_BYTE_ARRAY&&(u-=4,t[n++]=255&u,t[n++]=u>>8&255,t[n++]=u>>16&255,t[n++]=u>>24&255),o.copy(t,n,0,r.position),n+=r.position},R=function(t,e,r,n,i){t[n++]=x.BSON_DATA_SYMBOL,n+=i?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0;var o=t.write(r.value,n+4,"utf8")+1;return t[n]=255&o,t[n+1]=o>>8&255,t[n+2]=o>>16&255,t[n+3]=o>>24&255,n=n+4+o-1,t[n++]=0,n},D=function(t,e,r,n,i,o,u){t[n++]=x.BSON_DATA_OBJECT,n+=u?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0;var s,a=n;s=null!=r.db?P(t,{$ref:r.namespace,$id:r.oid,$db:r.db},!1,n,i+1,o):P(t,{$ref:r.namespace,$id:r.oid},!1,n,i+1,o);var f=s-a;return t[a++]=255&f,t[a++]=f>>8&255,t[a++]=f>>16&255,t[a++]=f>>24&255,s},P=function(t,r,i,o,s,a,P,x){o=o||0,x=x||[],x.push(r);var U=o+4;if(Array.isArray(r))for(var M=0;M>8&255,t[o++]=F>>16&255,t[o++]=F>>24&255,U},x={};x.functionCache={};x.BSON_DATA_NUMBER=1,x.BSON_DATA_STRING=2,x.BSON_DATA_OBJECT=3,x.BSON_DATA_ARRAY=4,x.BSON_DATA_BINARY=5,x.BSON_DATA_UNDEFINED=6,x.BSON_DATA_OID=7,x.BSON_DATA_BOOLEAN=8,x.BSON_DATA_DATE=9,x.BSON_DATA_NULL=10,x.BSON_DATA_REGEXP=11,x.BSON_DATA_CODE=13,x.BSON_DATA_SYMBOL=14,x.BSON_DATA_CODE_W_SCOPE=15,x.BSON_DATA_INT=16,x.BSON_DATA_TIMESTAMP=17,x.BSON_DATA_LONG=18,x.BSON_DATA_DECIMAL128=19,x.BSON_DATA_MIN_KEY=255,x.BSON_DATA_MAX_KEY=127,x.BSON_BINARY_SUBTYPE_DEFAULT=0,x.BSON_BINARY_SUBTYPE_FUNCTION=1,x.BSON_BINARY_SUBTYPE_BYTE_ARRAY=2,x.BSON_BINARY_SUBTYPE_UUID=3,x.BSON_BINARY_SUBTYPE_MD5=4,x.BSON_BINARY_SUBTYPE_USER_DEFINED=128,x.BSON_INT32_MAX=2147483647,x.BSON_INT32_MIN=-2147483648,x.BSON_INT64_MAX=Math.pow(2,63)-1,x.BSON_INT64_MIN=-Math.pow(2,63),x.JS_INT_MAX=9007199254740992,x.JS_INT_MIN=-9007199254740992;o.fromNumber(9007199254740992),o.fromNumber(-9007199254740992);t.exports=P}).call(e,r(0).Buffer)},function(t,e,r){"use strict";function n(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:h.DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS,e=this.getAccessToken();if(!e)return!1;var r=void 0;try{r=_(e)}catch(t){return!1}return!!r&&(r.exp&&Math.floor(Date.now()/1e3)>=r.exp-t)}},{key:"getAccessToken",value:function(){return this._get().accessToken}},{key:"getRefreshToken",value:function(){return this.storage.get(h.REFRESH_TOKEN_KEY)}},{key:"set",value:function(t){if(t){if(t[this.codec.refreshToken]){var e=t[this.codec.refreshToken];delete t[this.codec.refreshToken],this.storage.set(h.REFRESH_TOKEN_KEY,e)}if(t[this.codec.deviceId]){var r=t[this.codec.deviceId];delete t[this.codec.deviceId],this.storage.set(h.DEVICE_ID_KEY,r)}var n={};t[this.codec.accessToken]&&(n.accessToken=t[this.codec.accessToken]),t[this.codec.userId]&&(n.userId=t[this.codec.userId]),n=Object.assign(this._get(),n),this.storage.set(h.USER_AUTH_KEY,JSON.stringify(n))}}},{key:"_get",value:function(){var t=this.storage.get(h.USER_AUTH_KEY);if(!t)return{};try{return JSON.parse(t)}catch(t){throw this.clear(),new f.StitchError("Failure retrieving stored auth")}}},{key:"authedId",value:function(){return this._get().userId}},{key:"isImpersonatingUser",value:function(){return"true"===this.storage.get(h.IMPERSONATION_ACTIVE_KEY)}},{key:"refreshImpersonation",value:function(t){var e=this,r=this.storage.get(h.IMPERSONATION_USER_KEY);return t._do("/admin/users/"+r+"/impersonate","POST",{refreshOnFailure:!1,useRefreshToken:!0}).then(function(t){return t.json()}).then(function(t){return e.set(t)}).catch(function(t){throw e.stopImpersonation(),t})}},{key:"startImpersonation",value:function(t,e){if(!this.authedId())return Promise.reject(new f.StitchError("Must auth first"));if(this.isImpersonatingUser())return Promise.reject(new f.StitchError("Already impersonating a user"));this.storage.set(h.IMPERSONATION_ACTIVE_KEY,"true"),this.storage.set(h.IMPERSONATION_USER_KEY,e);var r=JSON.parse(this.storage.get(h.USER_AUTH_KEY));return this.storage.set(h.IMPERSONATION_REAL_USER_AUTH_KEY,JSON.stringify(r)),this.refreshImpersonation(t)}},{key:"stopImpersonation",value:function(){var t=this;if(!this.isImpersonatingUser())throw new f.StitchError("Not impersonating a user");return new Promise(function(e,r){var n=JSON.parse(t.storage.get(h.IMPERSONATION_REAL_USER_AUTH_KEY));t.set(n),t.clearImpersonation(),e()})}},{key:"clearImpersonation",value:function(){this.storage.remove(h.IMPERSONATION_ACTIVE_KEY),this.storage.remove(h.IMPERSONATION_USER_KEY),this.storage.remove(h.IMPERSONATION_REAL_USER_AUTH_KEY)}},{key:"parseRedirectFragment",value:function(t,e){for(var r=t.split("&"),n={ua:null,found:!1,stateValid:!1,lastError:null},i=!1,o=0;o2&&void 0!==arguments[2]?arguments[2]:"",n={appId:e,appVersion:r,sdkVersion:y.SDK_VERSION};t&&(n.deviceId=t);var i=(0,b.getPlatform)();return i&&(n.platform=i.name,n.platformVersion=i.version),n}function o(t){return{authenticate:function(){var e=i(t.getDeviceId(),!!t.client&&t.client.clientAppID),r=y.makeFetchArgs("GET");return r.cors=!0,fetch(t.rootUrl+"/providers/anon-user/login?device="+(0,b.uriEncodeObject)(e),r).then(y.checkStatus).then(function(t){return t.json()}).then(function(e){return t.set(e)})}}}function u(t){return{authenticate:function(e){var r=i(t.getDeviceId(),!!t.client&&t.client.clientAppID),n=y.makeFetchArgs("POST",JSON.stringify({token:e,options:{device:r}}));return n.cors=!0,fetch(t.rootUrl+"/providers/custom-token/login",n).then(y.checkStatus).then(function(t){return t.json()}).then(function(e){return t.set(e)})}}}function s(t){var e=(t.isAppClient(),"providers/local-userpass"),r=(t.isAppClient(),e+"/login");return{authenticate:function(e){var n=e.username,o=e.password,u=i(t.getDeviceId(),!!t.client&&t.client.clientAppID),s=y.makeFetchArgs("POST",JSON.stringify({username:n,password:o,options:{device:u}}));return s.cors=!0,fetch(t.rootUrl+"/"+r,s).then(y.checkStatus).then(function(t){return t.json()}).then(function(e){return t.set(e)})},emailConfirm:function(r,n){var i=y.makeFetchArgs("POST",JSON.stringify({tokenId:r,token:n}));return i.cors=!0,fetch(t.rootUrl+"/"+e+"/confirm",i).then(y.checkStatus).then(function(t){return t.json()})},sendEmailConfirm:function(r){var n=y.makeFetchArgs("POST",JSON.stringify({email:r}));return n.cors=!0,fetch(t.rootUrl+"/"+e+"/confirm/send",n).then(y.checkStatus).then(function(t){return t.json()})},sendPasswordReset:function(r){var n=y.makeFetchArgs("POST",JSON.stringify({email:r}));return n.cors=!0,fetch(t.rootUrl+"/"+e+"/reset/send",n).then(y.checkStatus).then(function(t){return t.json()})},passwordReset:function(r,n,i){var o=y.makeFetchArgs("POST",JSON.stringify({tokenId:r,token:n,password:i}));return o.cors=!0,fetch(t.rootUrl+"/"+e+"/reset",o).then(y.checkStatus).then(function(t){return t.json()})},register:function(r,n){var i=y.makeFetchArgs("POST",JSON.stringify({email:r,password:n}));return i.cors=!0,fetch(t.rootUrl+"/"+e+"/register",i).then(y.checkStatus).then(function(t){return t.json()})}}}function a(t){var e=(t.isAppClient(),"providers/api-key/login");return{authenticate:function(r){var n=i(t.getDeviceId(),!!t.client&&t.client.clientAppID),o=y.makeFetchArgs("POST",JSON.stringify({key:r,options:{device:n}}));return o.cors=!0,fetch(t.rootUrl+"/"+e,o).then(y.checkStatus).then(function(t){return t.json()}).then(function(e){return t.set(e)})}}}function f(){for(var t="",e=0;e<64;++e)t+=m.charAt(Math.floor(Math.random()*m.length));return t}function c(t,e,r){void 0===r&&(r=t.pageRootUrl());var n=f();t.storage.set(v.STATE_KEY,n);var o=i(t.getDeviceId(),!!t.client&&t.client.clientAppID);return t.rootUrl+"/providers/oauth2-"+e+"/login?redirect="+encodeURI(r)+"&state="+n+"&device="+(0,b.uriEncodeObject)(o)}function h(t){return{authenticate:function(e){var r=e&&e.redirectUrl?e.redirectUrl:void 0;return window.location.replace(c(t,"google",r)),Promise.resolve()}}}function l(t){return{authenticate:function(e){var r=e&&e.redirectUrl?e.redirectUrl:void 0;return window.location.replace(c(t,"facebook",r)),Promise.resolve()}}}function p(t){var e=(t.isAppClient(),"providers/mongodb-cloud/login");return{authenticate:function(r){var n=r.username,o=r.apiKey,u=r.cors,s=r.cookie,a=Object.assign({},{cors:!0,cookie:!1},{cors:u,cookie:s}),f=i(t.getDeviceId(),!!t.client&&t.client.clientAppID),c=y.makeFetchArgs("POST",JSON.stringify({username:n,apiKey:o,options:{device:f}}));c.cors=!0,c.credentials="include";var h=t.rootUrl+"/"+e;return a.cookie?fetch(h+"?cookie=true",c).then(y.checkStatus):fetch(h,c).then(y.checkStatus).then(function(t){return t.json()}).then(function(e){return t.set(e)})}}}function _(t){arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{anon:o(t),apiKey:a(t),google:h(t),facebook:l(t),mongodbCloud:p(t),userpass:s(t),custom:u(t)}}Object.defineProperty(e,"__esModule",{value:!0}),e.createProviders=void 0;var d=r(16),y=n(d),g=r(15),v=n(g),b=r(2),m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";e.createProviders=_},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t){if("localStorage"===t){if("undefined"!=typeof window&&"localStorage"in window&&null!==window.localStorage)return new s(window.localStorage)}else if("sessionStorage"===t&&"undefined"!=typeof window&&"sessionStorage"in window&&null!==window.sessionStorage)return new s(window.sessionStorage);return new s(new u)}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:{}))}},{key:"post",value:function(t){return o("post",this,i(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}))}},{key:"put",value:function(t){return o("put",this,i(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}))}},{key:"patch",value:function(t){return o("patch",this,i(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}))}},{key:"delete",value:function(t){return o("delete",this,i(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}))}},{key:"head",value:function(t){return o("head",this,i(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}))}}]),t}();e.default=a,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i=r(34),o=n(i),u=r(35),s=n(u),a=r(36),f=n(a),c=r(40),h=n(c),l=r(41),p=n(l);e.default={"aws/s3":o.default,"aws/ses":s.default,http:f.default,mongodb:h.default,twilio:p.default},t.exports=e.default},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=e?"updateMany":"updateOne",u=void 0;return!e&&i.upsert&&(u={upsert:!0}),a(o,t,s(t,{query:r,update:n},u))}function o(t){var e=t.service;return a("find",e,s(e,{query:t.query,project:t.project,limit:t.limit,sort:t.sort}))}function u(t,e){return a("aggregate",t,s(t,{pipeline:e}))}function s(t,e){var r=t.db.name,n=t.name,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object.assign({database:r,collection:n},e,i)}function a(t,e,r){return(0,h.serviceResponse)(e.db,{serviceName:e.db.service,action:t,args:r})}function f(t,e,r){return this instanceof f?(this.service=t,this.query=e,this.project=r,this):new f(t,e,r)}Object.defineProperty(e,"__esModule",{value:!0});var c=function(){function t(t,e){for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:{})}},{key:"updateMany",value:function(t,e){return i(this,!0,t,e)}},{key:"find",value:function(t,e){return new f(this,t,e)}},{key:"aggregate",value:function(t){return u(this,t)}},{key:"count",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=void 0;return e.limit&&(r={limit:e.limit}),a("count",this,s(this,{count:!0,query:t},r))}}]),t}();f.prototype.limit=function(t){return this.limit=t,this},f.prototype.sort=function(t){return this.sort=t,this},f.prototype.execute=function(t){return o(this)},e.default=l,t.exports=e.default},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:{};return new u.default(this,t,e)}}]),t}();e.default=s,t.exports=e.default},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]&&arguments[1];return new u.default(this.stitchClient,this.serviceName,t)}}]),t}();e.default=s,t.exports=e.default},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var r=0;r=y&&r<=d,u=r>=v&&r<=g;if(o)return n.strict?new h.Int32(r):r;if(u)return n.strict?new h.Long.fromNumber(r):r}return new h.Double(r)}if(null==r||"object"!==(void 0===r?"undefined":f(r)))return r;if(r.$undefined)return null;for(var s=Object.keys(r).filter(function(t){return t.startsWith("$")&&null!=r[t]}),a=0;a-1&&r<2534023188e5;return e.relaxed&&n?{$date:u(t)}:{$date:{$numberLong:t.getTime().toString()}}}if("number"==typeof t&&!e.relaxed){if(Math.floor(t)===t){var i=t>=y&&t<=d,s=t>=v&&t<=g;if(i)return{$numberInt:t.toString()};if(s)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}return null!=t&&"object"===(void 0===t?"undefined":f(t))?a(t,e):t}function a(t,e){if(null==t||"object"!==(void 0===t?"undefined":f(t)))throw new Error("not an object instance");if(t._bsontype&&-1!==l.indexOf(t._bsontype)){if("Code"===t._bsontype&&t.scope){var r=a(t.scope,e),n=Object.assign({},t,{scope:r});return c.Code.toExtendedJSON(n,e)}if("DBRef"===t._bsontype&&t.oid){var i=a(t.oid,e),u=Object.assign({},t,{oid:i});return c.DBRef.toExtendedJSON(u,e)}return c[t._bsontype].toExtendedJSON(t,e)}var h={};for(var p in t){var _=t[p];if(Array.isArray(_))h[p]=o(_,e);else if(null!=_&&_._bsontype&&-1!==l.indexOf(_._bsontype))if("Code"===_._bsontype&&_.scope){var d=a(_.scope,e),y=Object.assign({},_,{scope:d});h[p]=c.Code.toExtendedJSON(y,e)}else if("DBRef"===_._bsontype&&_.oid){var g=a(_.oid,e),v=Object.assign({},_,{oid:g});h[p]=c.DBRef.toExtendedJSON(v,e)}else h[p]=c[_._bsontype].toExtendedJSON(_,e);else _ instanceof Date?h[p]=s(_,e):null!=_&&"object"===(void 0===_?"undefined":f(_))&&(h[p]=a(_,e));h[p]=s(_,e)}return h}var f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c=r(48),h=r(26),l=["Binary","Code","DBRef","Decimal128","Double","Int32","Long","MaxKey","MinKey","ObjectID","BSONRegExp","Symbol","Timestamp"];n(h);var p={$oid:c.ObjectID,$binary:c.Binary,$symbol:c.Symbol,$numberDecimal:c.Decimal128,$numberLong:c.Long,$minKey:c.MinKey,$maxKey:c.MaxKey,$regularExpression:c.BSONRegExp,$timestamp:c.Timestamp},_=function(t,e){var r=this;return e=e||{strict:!0},JSON.parse(t,function(t,n){return i(r,t,n,e)})},d=2147483647,y=-2147483648,g=0x8000000000000000,v=-0x8000000000000000,b=function(t,e,r,n){var i={};null!=n&&"object"===(void 0===n?"undefined":f(n))?i=n:null!=r&&"object"===(void 0===r?"undefined":f(r))?(i=r,r=0):null!=e&&"object"===(void 0===e?"undefined":f(e))&&(i=e,e=null);var u=Array.isArray(t)?o(t,i):a(t,i);return JSON.stringify(u,e,r)};t.exports={parse:_,stringify:b,setBSONModule:n,BSON:h}},function(t,e,r){"use strict";function n(t){var e=t.length;if(e%4>0)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 o(t){var e,r,i,o,u,s=t.length;o=n(t),u=new h(3*s/4-o),r=o>0?s-4:s;var a=0;for(e=0;e>16&255,u[a++]=i>>8&255,u[a++]=255&i;return 2===o?(i=c[t.charCodeAt(e)]<<2|c[t.charCodeAt(e+1)]>>4,u[a++]=255&i):1===o&&(i=c[t.charCodeAt(e)]<<10|c[t.charCodeAt(e+1)]<<4|c[t.charCodeAt(e+2)]>>2,u[a++]=i>>8&255,u[a++]=255&i),u}function u(t){return f[t>>18&63]+f[t>>12&63]+f[t>>6&63]+f[63&t]}function s(t,e,r){for(var n,i=[],o=e;oa?a:u+16383));return 1===n?(e=t[r-1],i+=f[e>>2],i+=f[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=f[e>>10],i+=f[e>>4&63],i+=f[e<<2&63],i+="="),o.push(i),o.join("")}e.byteLength=i,e.toByteArray=o,e.fromByteArray=a;for(var f=[],c=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,_=l.length;p<_;++p)f[p]=l[p],c[l.charCodeAt(p)]=p;c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63},function(t,e,r){var n,i=r(60);"undefined"!=typeof navigator&&navigator&&(n=navigator.userAgent),t.exports=i(n)},function(t,e,r){var n=r(61);t.exports=function(t){return t?[["edge",/Edge\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["vivaldi",/Vivaldi\/([0-9\.]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)$/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/]].map(function(e){if(e[1].test(t)){var r=e[1].exec(t),i=r&&r[1].split(/[._]/).slice(0,3);return i&&i.length<3&&Array.prototype.push.apply(i,1==i.length?[0,0]:[0]),{name:e[0],version:i.join("."),os:n(t)}}}).filter(Boolean).shift():null}},function(t,e){t.exports=function(t){var e=[{name:"iOS",rule:/iP(hone|od|ad)/},{name:"Android OS",rule:/Android/},{name:"BlackBerry OS",rule:/BlackBerry|BB10/},{name:"Windows Mobile",rule:/IEMobile/},{name:"Amazon OS",rule:/Kindle/},{name:"Windows 3.11",rule:/Win16/},{name:"Windows 95",rule:/(Windows 95)|(Win95)|(Windows_95)/},{name:"Windows 98",rule:/(Windows 98)|(Win98)/},{name:"Windows 2000",rule:/(Windows NT 5.0)|(Windows 2000)/},{name:"Windows XP",rule:/(Windows NT 5.1)|(Windows XP)/},{name:"Windows Server 2003",rule:/(Windows NT 5.2)/},{name:"Windows Vista",rule:/(Windows NT 6.0)/},{name:"Windows 7",rule:/(Windows NT 6.1)/},{name:"Windows 8",rule:/(Windows NT 6.2)/},{name:"Windows 8.1",rule:/(Windows NT 6.3)/},{name:"Windows 10",rule:/(Windows NT 10.0)/},{name:"Windows ME",rule:/Windows ME/},{name:"Open BSD",rule:/OpenBSD/},{name:"Sun OS",rule:/SunOS/},{name:"Linux",rule:/(Linux)|(X11)/},{name:"Mac OS",rule:/(Mac_PowerPC)|(Macintosh)/},{name:"QNX",rule:/QNX/},{name:"BeOS",rule:/BeOS/},{name:"OS/2",rule:/OS\/2/},{name:"Search Bot",rule:/(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves\/Teoma)|(ia_archiver)/}],r=e.filter(function(e){if(t.match(e.rule))return!0});return r&&r[0]?r[0].name:null}},function(t,e){e.read=function(t,e,r,n,i){var o,u,s=8*i-n-1,a=(1<>1,c=-7,h=r?i-1:0,l=r?-1:1,p=t[e+h];for(h+=l,o=p&(1<<-c)-1,p>>=-c,c+=s;c>0;o=256*o+t[e+h],h+=l,c-=8);for(u=o&(1<<-c)-1,o>>=-c,c+=n;c>0;u=256*u+t[e+h],h+=l,c-=8);if(0===o)o=1-f;else{if(o===a)return u?NaN:1/0*(p?-1:1);u+=Math.pow(2,n),o-=f}return(p?-1:1)*u*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var u,s,a,f=8*o-i-1,c=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,_=n?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,u=c):(u=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-u))<1&&(u--,a*=2),e+=u+h>=1?l/a:l*Math.pow(2,1-h),e*a>=2&&(u++,a/=2),u+h>=c?(s=0,u=c):u+h>=1?(s=(e*a-1)*Math.pow(2,i),u+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),u=0));i>=8;t[r+p]=255&s,p+=_,s/=256,i-=8);for(u=u<0;t[r+p]=255&u,p+=_,u/=256,f-=8);t[r+p-_]|=128*d}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){function r(t){this.message=t}function n(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new r("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,u=0,s=0,a="";o=e.charAt(s++);~o&&(n=u%4?64*n+o:o,u++%4)?a+=String.fromCharCode(255&n>>(-2*u&6)):0)o=i.indexOf(o);return a}var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.prototype=new Error,r.prototype.name="InvalidCharacterError",t.exports="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||n},function(t,e,r){function n(t){return decodeURIComponent(i(t).replace(/(.)/g,function(t,e){var r=e.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}var i=r(65);t.exports=function(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return n(e)}catch(t){return i(e)}}},function(t,e,r){"use strict";function n(t){this.message=t}var i=r(66);n.prototype=new Error,n.prototype.name="InvalidTokenError",t.exports=function(t,e){if("string"!=typeof t)throw new n("Invalid token specified");e=e||{};var r=!0===e.header?0:1;try{return JSON.parse(i(t.split(".")[r]))}catch(t){throw new n("Invalid token specified: "+t.message)}},t.exports.InvalidTokenError=n},function(t,e,r){"use strict";function n(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}/* +var G=r(58),Z=r(62),X=r(64);e.Buffer=o,e.SlowBuffer=d,e.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=n(),o.poolSize=8192,o._augment=function(t){return t.__proto__=o.prototype,t},o.from=function(t,e,r){return u(null,t,e,r)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(t,e,r){return a(null,t,e,r)},o.allocUnsafe=function(t){return f(null,t)},o.allocUnsafeSlow=function(t){return f(null,t)},o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,u=Math.min(r,n);i0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},o.prototype.compare=function(t,e,r,n,i){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var u=i-n,s=r-e,a=Math.min(u,s),f=this.slice(n,i),c=t.slice(e,r),h=0;hi)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return O(this,t,e,r);case"ascii":return E(this,t,e,r);case"latin1":case"binary":return S(this,t,e,r);case"base64":return N(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;o.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e0&&(i*=256);)n+=this[t+--e]*i;return n},o.prototype.readUInt8=function(t,e){return e||U(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||U(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||U(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||U(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||U(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||U(t,e,this.length);for(var n=this[t],i=1,o=0;++o=i&&(n-=Math.pow(2,8*e)),n},o.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||U(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){e||U(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(t,e){e||U(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(t,e){return e||U(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||U(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||U(t,4,this.length),Z.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||U(t,4,this.length),Z.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||U(t,8,this.length),Z.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return e||U(t,8,this.length),Z.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){k(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+r},o.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):L(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):L(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):M(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):M(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);k(this,t,e,r,i-1,-i)}var o=0,u=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+r},o.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);k(this,t,e,r,i-1,-i)}var o=r-1,u=1,s=0;for(this[e+o]=255&t;--o>=0&&(u*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/u>>0)-s&255;return e+r},o.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):L(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):L(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):M(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):M(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,r){return C(this,t,e,!0,r)},o.prototype.writeFloatBE=function(t,e,r){return C(this,t,e,!1,r)},o.prototype.writeDoubleLE=function(t,e,r){return Y(this,t,e,!0,r)},o.prototype.writeDoubleBE=function(t,e,r){return Y(this,t,e,!1,r)},o.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(u<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var u;if("number"==typeof t)for(u=e;u>1,h=-7,l=s?0:i-1,p=s?1:-1,_=t[e+l];for(l+=p,o=_&(1<<-h)-1,_>>=-h,h+=a;h>0;o=256*o+t[e+l],l+=p,h-=8);for(u=o&(1<<-h)-1,o>>=-h,h+=n;h>0;u=256*u+t[e+l],l+=p,h-=8);if(0===o)o=1-c;else{if(o===f)return u?NaN:1/0*(_?-1:1);u+=Math.pow(2,n),o-=c}return(_?-1:1)*u*Math.pow(2,o-n)},i=function(t,e,r,n,i,o){var u,s,a,f="big"===n,c=8*o-i-1,h=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,_=f?o-1:0,d=f?-1:1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,u=h):(u=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-u))<1&&(u--,a*=2),e+=u+l>=1?p/a:p*Math.pow(2,1-l),e*a>=2&&(u++,a/=2),u+l>=h?(s=0,u=h):u+l>=1?(s=(e*a-1)*Math.pow(2,i),u+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,i),u=0));i>=8;t[r+_]=255&s,_+=d,s/=256,i-=8);for(u=u<0;t[r+_]=255&u,_+=d,u/=256,c-=8);t[r+_-d]|=128*y};e.readIEEE754=n,e.writeIEEE754=i},function(t,e,r){"use strict";function n(t,e){function r(){return n||(n=!0,console.warn("DeprecationWarning: "+e)),t.apply(this,arguments)}var n=!1;return r.__proto__=t,t.prototype&&(r.prototype=t.prototype),r}function i(t,e){var r=e.serviceName,n=void 0===r?t.serviceName:r,i=e.action,o=e.args,u=t.client;if(!u)throw new Error("Service has no client");return u.executeServiceFunction(n,i,o)}function o(t){return encodeURIComponent(a.btoa(JSON.stringify(t)))}Object.defineProperty(e,"__esModule",{value:!0}),e.uriEncodeObject=e.serviceResponse=e.deprecate=e.collectMetadata=void 0;var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s=r(27),a=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}(s);e.collectMetadata=function(t){var e=function(t){return function(e){return"object"!==(void 0===e?"undefined":u(e))||Object.prototype.hasOwnProperty.call(e,"_stitch_metadata")||Object.defineProperty(e,"_stitch_metadata",{enumerable:!1,configurable:!1,writable:!1,value:t}),Promise.resolve(e)}};return function(r){var n={};return r.warnings&&(n.warnings=r.warnings),t?Promise.resolve(r).then(t).then(e(n)):Promise.resolve(r).then(e(n))}};e.deprecate=n,e.serviceResponse=i,e.uriEncodeObject=o},function(t,e,r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);this._bsontype="Long",this.low_=0|t,this.high_=0|e}n.prototype.toInt=function(){return this.low_},n.prototype.toNumber=function(){return this.high_*n.TWO_PWR_32_DBL_+this.getLowBitsUnsigned()},n.prototype.toJSON=function(){return this.toString()},n.prototype.toString=function(t){var e=t||10;if(e<2||36=0?this.low_:n.TWO_PWR_32_DBL_+this.low_},n.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(n.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var t=0!=this.high_?this.high_:this.low_,e=31;e>0&&0==(t&1<0},n.prototype.greaterThanOrEqual=function(t){return this.compare(t)>=0},n.prototype.compare=function(t){if(this.equals(t))return 0;var e=this.isNegative(),r=t.isNegative();return e&&!r?-1:!e&&r?1:this.subtract(t).isNegative()?-1:1},n.prototype.negate=function(){return this.equals(n.MIN_VALUE)?n.MIN_VALUE:this.not().add(n.ONE)},n.prototype.add=function(t){var e=this.high_>>>16,r=65535&this.high_,i=this.low_>>>16,o=65535&this.low_,u=t.high_>>>16,s=65535&t.high_,a=t.low_>>>16,f=65535&t.low_,c=0,h=0,l=0,p=0;return p+=o+f,l+=p>>>16,p&=65535,l+=i+a,h+=l>>>16,l&=65535,h+=r+s,c+=h>>>16,h&=65535,c+=e+u,c&=65535,n.fromBits(l<<16|p,c<<16|h)},n.prototype.subtract=function(t){return this.add(t.negate())},n.prototype.multiply=function(t){if(this.isZero())return n.ZERO;if(t.isZero())return n.ZERO;if(this.equals(n.MIN_VALUE))return t.isOdd()?n.MIN_VALUE:n.ZERO;if(t.equals(n.MIN_VALUE))return this.isOdd()?n.MIN_VALUE:n.ZERO;if(this.isNegative())return t.isNegative()?this.negate().multiply(t.negate()):this.negate().multiply(t).negate();if(t.isNegative())return this.multiply(t.negate()).negate();if(this.lessThan(n.TWO_PWR_24_)&&t.lessThan(n.TWO_PWR_24_))return n.fromNumber(this.toNumber()*t.toNumber());var e=this.high_>>>16,r=65535&this.high_,i=this.low_>>>16,o=65535&this.low_,u=t.high_>>>16,s=65535&t.high_,a=t.low_>>>16,f=65535&t.low_,c=0,h=0,l=0,p=0;return p+=o*f,l+=p>>>16,p&=65535,l+=i*f,h+=l>>>16,l&=65535,l+=o*a,h+=l>>>16,l&=65535,h+=r*f,c+=h>>>16,h&=65535,h+=i*a,c+=h>>>16,h&=65535,h+=o*s,c+=h>>>16,h&=65535,c+=e*f+r*a+i*s+o*u,c&=65535,n.fromBits(l<<16|p,c<<16|h)},n.prototype.div=function(t){if(t.isZero())throw Error("division by zero");if(this.isZero())return n.ZERO;if(this.equals(n.MIN_VALUE)){if(t.equals(n.ONE)||t.equals(n.NEG_ONE))return n.MIN_VALUE;if(t.equals(n.MIN_VALUE))return n.ONE;var e=this.shiftRight(1),r=e.div(t).shiftLeft(1);if(r.equals(n.ZERO))return t.isNegative()?n.ONE:n.NEG_ONE;var i=this.subtract(t.multiply(r));return r.add(i.div(t))}if(t.equals(n.MIN_VALUE))return n.ZERO;if(this.isNegative())return t.isNegative()?this.negate().div(t.negate()):this.negate().div(t).negate();if(t.isNegative())return this.div(t.negate()).negate();for(var o=n.ZERO,i=this;i.greaterThanOrEqual(t);){for(var r=Math.max(1,Math.floor(i.toNumber()/t.toNumber())),u=Math.ceil(Math.log(r)/Math.LN2),s=u<=48?1:Math.pow(2,u-48),a=n.fromNumber(r),f=a.multiply(t);f.isNegative()||f.greaterThan(i);)r-=s,a=n.fromNumber(r),f=a.multiply(t);a.isZero()&&(a=n.ONE),o=o.add(a),i=i.subtract(f)}return o},n.prototype.modulo=function(t){return this.subtract(this.div(t).multiply(t))},n.prototype.not=function(){return n.fromBits(~this.low_,~this.high_)},n.prototype.and=function(t){return n.fromBits(this.low_&t.low_,this.high_&t.high_)},n.prototype.or=function(t){return n.fromBits(this.low_|t.low_,this.high_|t.high_)},n.prototype.xor=function(t){return n.fromBits(this.low_^t.low_,this.high_^t.high_)},n.prototype.shiftLeft=function(t){if(0==(t&=63))return this;var e=this.low_;if(t<32){var r=this.high_;return n.fromBits(e<>>32-t)}return n.fromBits(0,e<>>t|e<<32-t,e>>t)}return n.fromBits(e>>t-32,e>=0?0:-1)},n.prototype.shiftRightUnsigned=function(t){if(0==(t&=63))return this;var e=this.high_;if(t<32){var r=this.low_;return n.fromBits(r>>>t|e<<32-t,e>>>t)}return 32==t?n.fromBits(e,0):n.fromBits(e>>>t-32,0)},n.fromInt=function(t){if(-128<=t&&t<128){var e=n.INT_CACHE_[t];if(e)return e}var r=new n(0|t,t<0?-1:0);return-128<=t&&t<128&&(n.INT_CACHE_[t]=r),r},n.fromNumber=function(t){return isNaN(t)||!isFinite(t)?n.ZERO:t<=-n.TWO_PWR_63_DBL_?n.MIN_VALUE:t+1>=n.TWO_PWR_63_DBL_?n.MAX_VALUE:t<0?n.fromNumber(-t).negate():new n(t%n.TWO_PWR_32_DBL_|0,t/n.TWO_PWR_32_DBL_|0)},n.fromBits=function(t,e){return new n(t,e)},n.fromString=function(t,e){if(0==t.length)throw Error("number format error: empty string");var r=e||10;if(r<2||36=0)throw Error('number format error: interior "-" character: '+t);for(var i=n.fromNumber(Math.pow(r,8)),o=n.ZERO,u=0;u255)throw new Error("only accepts number in a valid unsigned byte range 0-255");var e=null;if(e="string"==typeof t?t.charCodeAt(0):null!=t.length?t[0]:t,this.buffer.length>this.position)this.buffer[this.position++]=e;else if(void 0!==i&&i.isBuffer(this.buffer)){var r=new i(n.BUFFER_SIZE+this.buffer.length);this.buffer.copy(r,0,0,this.buffer.length),this.buffer=r,this.buffer[this.position++]=e}else{var r=null;r="[object Uint8Array]"==Object.prototype.toString.call(this.buffer)?new Uint8Array(new ArrayBuffer(n.BUFFER_SIZE+this.buffer.length)):new Array(n.BUFFER_SIZE+this.buffer.length);for(var o=0;othis.position?e+t.length:this.position;else if(void 0!==i&&"string"==typeof t&&i.isBuffer(this.buffer))this.buffer.write(t,e,"binary"),this.position=e+t.length>this.position?e+t.length:this.position;else if("[object Uint8Array]"==Object.prototype.toString.call(t)||"[object Array]"==Object.prototype.toString.call(t)&&"string"!=typeof t){for(var n=0;nthis.position?e:this.position}else if("string"==typeof t){for(var n=0;nthis.position?e:this.position}},n.prototype.read=function(t,e){if(e=e&&e>0?e:this.position,this.buffer.slice)return this.buffer.slice(t,t+e);for(var r="undefined"!=typeof Uint8Array?new Uint8Array(new ArrayBuffer(e)):new Array(e),n=0;n>>0,n=e.high_>>>0;if(r>>0>>0)return!0}return!1},y=function(t){this._bsontype="Decimal128",this.bytes=t};y.fromString=function(t){var r=!1,p=!1,g=!1,v=0,b=0,m=0,w=0,O=0,E=[0],S=0,N=0,A=0,T=0,B=0,I=0,R=[0,0],D=[0,0],P=0,x=0;t=t.trim();var U=t.match(i),k=t.match(o),L=t.match(u);if(!U&&!k&&!L||0==t.length)throw new Error(t+" not a valid Decimal128 string");if(U&&U[4]&&void 0===U[2])throw new Error(t+" not a valid Decimal128 string");if("+"!=t[x]&&"-"!=t[x]||(r="-"==t[x++]),!l(t[x])&&"."!=t[x]){if("i"==t[x]||"I"==t[x])return new y(new e(r?f:c));if("N"==t[x])return new y(new e(a))}for(;l(t[x])||"."==t[x];)if("."!=t[x])S<34&&("0"!=t[x]||g)&&(g||(O=b),g=!0,E[N++]=parseInt(t[x],10),S+=1),g&&(m+=1),p&&(w+=1),b+=1,x+=1;else{if(p)return new y(new e(a));p=!0,x+=1}if(p&&!b)throw new Error(t+" not a valid Decimal128 string");if("e"==t[x]||"E"==t[x]){var M=t.substr(++x).match(h);if(!M||!M[2])return new y(new e(a));B=parseInt(M[0],10),x+=M[0].length}if(t[x])return new y(new e(a));if(A=0,S){if(T=S-1,v=m,0!=B&&1!=v)for(;"0"==t[O+v-1];)v-=1}else A=0,T=0,E[0]=0,m=1,S=1,v=0;for(B<=w&&w-B>16384?B=-6176:B-=w;B>6111;){if((T+=1)-A>34){var j=E.join("");if(j.match(/^0+$/)){B=6111;break}return new y(new e(r?f:c))}B-=1}for(;B<-6176||S=5&&(F=1,5==Y)){F=E[T]%2==1;for(var I=O+T+2;I=0&&++E[W]>9;W--)if(E[W]=0,0==W){if(!(B<6111))return new y(new e(r?f:c));B+=1,E[W]=1}}if(R=n.fromNumber(0),D=n.fromNumber(0),0==v)R=n.fromNumber(0),D=n.fromNumber(0);else if(T-A<17){var W=A;for(D=n.fromNumber(E[W++]),R=new n(0,0);W<=T;W++)D=D.multiply(n.fromNumber(10)),D=D.add(n.fromNumber(E[W]))}else{var W=A;for(R=n.fromNumber(E[W++]);W<=T-17;W++)R=R.multiply(n.fromNumber(10)),R=R.add(n.fromNumber(E[W]));for(D=n.fromNumber(E[W++]);W<=T;W++)D=D.multiply(n.fromNumber(10)),D=D.add(n.fromNumber(E[W]))}var K=_(R,n.fromString("100000000000000000"));K.low=K.low.add(D),d(K.low,D)&&(K.high=K.high.add(n.fromNumber(1)));var P=B+s,$={low:n.fromNumber(0),high:n.fromNumber(0)};K.high.shiftRightUnsigned(49).and(n.fromNumber(1)).equals(n.fromNumber)?($.high=$.high.or(n.fromNumber(3).shiftLeft(61)),$.high=$.high.or(n.fromNumber(P).and(n.fromNumber(16383).shiftLeft(47))),$.high=$.high.or(K.high.and(n.fromNumber(0x7fffffffffff)))):($.high=$.high.or(n.fromNumber(16383&P).shiftLeft(49)),$.high=$.high.or(K.high.and(n.fromNumber(562949953421311)))),$.low=K.low,r&&($.high=$.high.or(n.fromString("9223372036854775808")));var J=new e(16),x=0;return J[x++]=255&$.low.low_,J[x++]=$.low.low_>>8&255,J[x++]=$.low.low_>>16&255,J[x++]=$.low.low_>>24&255,J[x++]=255&$.low.high_,J[x++]=$.low.high_>>8&255,J[x++]=$.low.high_>>16&255,J[x++]=$.low.high_>>24&255,J[x++]=255&$.high.low_,J[x++]=$.high.low_>>8&255,J[x++]=$.high.low_>>16&255,J[x++]=$.high.low_>>24&255,J[x++]=255&$.high.high_,J[x++]=$.high.high_>>8&255,J[x++]=$.high.high_>>16&255,J[x++]=$.high.high_>>24&255,new y(J)};var s=6176;y.prototype.toString=function(){for(var t,e,r,i,o,u,a=0,f=new Array(36),c=0;c>26&31)>>3==3){if(30==o)return m.join("")+"Infinity";if(31==o)return"NaN";u=t>>15&16383,_=8+(t>>14&1)}else _=t>>14&7,u=t>>17&16383;if(h=u-s,b.parts[0]=(16383&t)+((15&_)<<14),b.parts[1]=e,b.parts[2]=r,b.parts[3]=i,0==b.parts[0]&&0==b.parts[1]&&0==b.parts[2]&&0==b.parts[3])v=!0;else for(var y=3;y>=0;y--){var O=0,E=p(b);if(b=E.quotient,O=E.rem.low_)for(var d=8;d>=0;d--)f[9*y+d]=O%10,O=Math.floor(O/10)}if(v)a=1,f[g]=0;else{a=36;for(var c=0;!f[g];)c++,a-=1,g+=1}if((l=a-1+h)>=34||l<=-7||h>0){m.push(f[g++]),a-=1,a&&m.push(".");for(var c=0;c0?m.push("+"+l):m.push(l)}else if(h>=0)for(var c=0;c0)for(var c=0;c>8&255,u[1]=t>>16&255,u[0]=t>>24&255,u[6]=255&n,u[5]=n>>8&255,u[4]=n>>16&255,u[8]=255&i,u[7]=i>>8&255,u[11]=255&o,u[10]=o>>8&255,u[9]=o>>16&255,u},u.prototype.toString=function(t){return this.id&&this.id.copy?this.id.toString("string"==typeof t?t:"hex"):this.toHexString()},u.prototype.inspect=u.prototype.toString,u.prototype.toJSON=function(){return this.toHexString()},u.prototype.equals=function(t){return t instanceof u?this.toString()==t.toString():"string"==typeof t&&u.isValid(t)&&12==t.length&&this.id instanceof c?t===this.id.toString("binary"):"string"==typeof t&&u.isValid(t)&&24==t.length?t.toLowerCase()===this.toHexString():"string"==typeof t&&u.isValid(t)&&12==t.length?t===this.id:!(null==t||!(t instanceof u||t.toHexString))&&t.toHexString()===this.toHexString()},u.prototype.getTimestamp=function(){var t=new Date,e=this.id[3]|this.id[2]<<8|this.id[1]<<16|this.id[0]<<24;return t.setTime(1e3*Math.floor(e)),t},u.index=~~(16777215*Math.random()),u.createPk=function(){return new u},u.createFromTime=function(t){var r=new e([0,0,0,0,0,0,0,0,0,0,0,0]);return r[3]=255&t,r[2]=t>>8&255,r[1]=t>>16&255,r[0]=t>>24&255,new u(r)};for(var f=("0123456789abcdef".split(""),[]),a=0;a<10;)f[48+a]=a++;for(;a<16;)f[55+a]=f[87+a]=a++;var c=e,h=function(t){return t.toString("hex")};u.createFromHexString=function(t){if(void 0===t||null!=t&&24!=t.length)throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");if(o)return new u(new e(t,"hex"));for(var r=new c(12),n=0,i=0;i<24;)r[n++]=f[t.charCodeAt(i++)]<<4|f[t.charCodeAt(i++)];return new u(r)},u.isValid=function(t){return null!=t&&("number"==typeof t||("string"==typeof t?12==t.length||24==t.length&&i.test(t):t instanceof u||(t instanceof c||!!t.toHexString&&(12==t.id.length||24==t.id.length&&i.test(t.id)))))},Object.defineProperty(u.prototype,"generationTime",{enumerable:!0,get:function(){return this.id[3]|this.id[2]<<8|this.id[1]<<16|this.id[0]<<24},set:function(t){this.id[3]=255&t,this.id[2]=t>>8&255,this.id[1]=t>>16&255,this.id[0]=t>>24&255}}),t.exports=u,t.exports.ObjectID=u,t.exports.ObjectId=u}).call(e,r(0).Buffer,r(25))},function(t,e,r){"use strict";function n(t,e){if(!(this instanceof n))return new n;this._bsontype="BSONRegExp",this.pattern=t||"",this.options=e||"";for(var r=0;r=0?this.low_:n.TWO_PWR_32_DBL_+this.low_},n.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(n.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var t=0!=this.high_?this.high_:this.low_,e=31;e>0&&0==(t&1<0},n.prototype.greaterThanOrEqual=function(t){return this.compare(t)>=0},n.prototype.compare=function(t){if(this.equals(t))return 0;var e=this.isNegative(),r=t.isNegative();return e&&!r?-1:!e&&r?1:this.subtract(t).isNegative()?-1:1},n.prototype.negate=function(){return this.equals(n.MIN_VALUE)?n.MIN_VALUE:this.not().add(n.ONE)},n.prototype.add=function(t){var e=this.high_>>>16,r=65535&this.high_,i=this.low_>>>16,o=65535&this.low_,u=t.high_>>>16,s=65535&t.high_,a=t.low_>>>16,f=65535&t.low_,c=0,h=0,l=0,p=0;return p+=o+f,l+=p>>>16,p&=65535,l+=i+a,h+=l>>>16,l&=65535,h+=r+s,c+=h>>>16,h&=65535,c+=e+u,c&=65535,n.fromBits(l<<16|p,c<<16|h)},n.prototype.subtract=function(t){return this.add(t.negate())},n.prototype.multiply=function(t){if(this.isZero())return n.ZERO;if(t.isZero())return n.ZERO;if(this.equals(n.MIN_VALUE))return t.isOdd()?n.MIN_VALUE:n.ZERO;if(t.equals(n.MIN_VALUE))return this.isOdd()?n.MIN_VALUE:n.ZERO;if(this.isNegative())return t.isNegative()?this.negate().multiply(t.negate()):this.negate().multiply(t).negate();if(t.isNegative())return this.multiply(t.negate()).negate();if(this.lessThan(n.TWO_PWR_24_)&&t.lessThan(n.TWO_PWR_24_))return n.fromNumber(this.toNumber()*t.toNumber());var e=this.high_>>>16,r=65535&this.high_,i=this.low_>>>16,o=65535&this.low_,u=t.high_>>>16,s=65535&t.high_,a=t.low_>>>16,f=65535&t.low_,c=0,h=0,l=0,p=0;return p+=o*f,l+=p>>>16,p&=65535,l+=i*f,h+=l>>>16,l&=65535,l+=o*a,h+=l>>>16,l&=65535,h+=r*f,c+=h>>>16,h&=65535,h+=i*a,c+=h>>>16,h&=65535,h+=o*s,c+=h>>>16,h&=65535,c+=e*f+r*a+i*s+o*u,c&=65535,n.fromBits(l<<16|p,c<<16|h)},n.prototype.div=function(t){if(t.isZero())throw Error("division by zero");if(this.isZero())return n.ZERO;if(this.equals(n.MIN_VALUE)){if(t.equals(n.ONE)||t.equals(n.NEG_ONE))return n.MIN_VALUE;if(t.equals(n.MIN_VALUE))return n.ONE;var e=this.shiftRight(1),r=e.div(t).shiftLeft(1);if(r.equals(n.ZERO))return t.isNegative()?n.ONE:n.NEG_ONE;var i=this.subtract(t.multiply(r));return r.add(i.div(t))}if(t.equals(n.MIN_VALUE))return n.ZERO;if(this.isNegative())return t.isNegative()?this.negate().div(t.negate()):this.negate().div(t).negate();if(t.isNegative())return this.div(t.negate()).negate();for(var o=n.ZERO,i=this;i.greaterThanOrEqual(t);){for(var r=Math.max(1,Math.floor(i.toNumber()/t.toNumber())),u=Math.ceil(Math.log(r)/Math.LN2),s=u<=48?1:Math.pow(2,u-48),a=n.fromNumber(r),f=a.multiply(t);f.isNegative()||f.greaterThan(i);)r-=s,a=n.fromNumber(r),f=a.multiply(t);a.isZero()&&(a=n.ONE),o=o.add(a),i=i.subtract(f)}return o},n.prototype.modulo=function(t){return this.subtract(this.div(t).multiply(t))},n.prototype.not=function(){return n.fromBits(~this.low_,~this.high_)},n.prototype.and=function(t){return n.fromBits(this.low_&t.low_,this.high_&t.high_)},n.prototype.or=function(t){return n.fromBits(this.low_|t.low_,this.high_|t.high_)},n.prototype.xor=function(t){return n.fromBits(this.low_^t.low_,this.high_^t.high_)},n.prototype.shiftLeft=function(t){if(0==(t&=63))return this;var e=this.low_;if(t<32){var r=this.high_;return n.fromBits(e<>>32-t)}return n.fromBits(0,e<>>t|e<<32-t,e>>t)}return n.fromBits(e>>t-32,e>=0?0:-1)},n.prototype.shiftRightUnsigned=function(t){if(0==(t&=63))return this;var e=this.high_;if(t<32){var r=this.low_;return n.fromBits(r>>>t|e<<32-t,e>>>t)}return 32==t?n.fromBits(e,0):n.fromBits(e>>>t-32,0)},n.fromInt=function(t){if(-128<=t&&t<128){var e=n.INT_CACHE_[t];if(e)return e}var r=new n(0|t,t<0?-1:0);return-128<=t&&t<128&&(n.INT_CACHE_[t]=r),r},n.fromNumber=function(t){return isNaN(t)||!isFinite(t)?n.ZERO:t<=-n.TWO_PWR_63_DBL_?n.MIN_VALUE:t+1>=n.TWO_PWR_63_DBL_?n.MAX_VALUE:t<0?n.fromNumber(-t).negate():new n(t%n.TWO_PWR_32_DBL_|0,t/n.TWO_PWR_32_DBL_|0)},n.fromBits=function(t,e){return new n(t,e)},n.fromString=function(t,e){if(0==t.length)throw Error("number format error: empty string");var r=e||10;if(r<2||36=0)throw Error('number format error: interior "-" character: '+t);for(var i=n.fromNumber(Math.pow(r,8)),o=n.ZERO,u=0;u=200&&t.status<300)return t;if(t.headers.get("Content-Type")===i)return t.json().then(function(e){var r=new n.StitchError(e.error,e.error_code);return r.response=t,r.json=e,Promise.reject(r)});var e=new Error(t.statusText);return e.response=t,Promise.reject(e)},e.makeFetchArgs=function(t,e){var r={method:t,headers:{Accept:i,"Content-Type":i}};return e&&(r.body=e),r.cors=!0,r}},function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";var n=function t(e){if(!(this instanceof t))return new t(e);this._bsontype="Int32",this.value=e};n.prototype.valueOf=function(){return this.value},n.prototype.toJSON=function(){return this.value},t.exports=n,t.exports.Int32=n},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(t){function e(t,r){n(this,e);var o=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return o.name="StitchError",o.message=t,void 0!==r&&(o.code=r),"function"==typeof Error.captureStackTrace?Error.captureStackTrace(o,o.constructor):o.stack=new Error(t).stack,o}return o(e,t),e}(function(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}(Error));e.StitchError=u,e.ErrAuthProviderNotFound="AuthProviderNotFound",e.ErrInvalidSession="InvalidSession",e.ErrUnauthorized="Unauthorized"},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){var r,n,o,u,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},f=Object.create(t),h=_.DEFAULT_STITCH_SERVER_URL;s.baseUrl&&(h=s.baseUrl),f.clientAppID=e,f.authUrl=e?h+"/api/client/v2.0/app/"+e+"/auth":h+"/api/admin/v3.0/auth",f.rootURLsByAPIVersion=(u={},i(u,m,(r={},i(r,E,h+"/api/public/v1.0"),i(r,N,h+"/api/client/v1.0"),i(r,S,h+"/api/private/v1.0"),i(r,A,e?h+"/api/client/v1.0/app/"+e:h+"/api/public/v1.0"),r)),i(u,w,(n={},i(n,E,h+"/api/public/v2.0"),i(n,N,h+"/api/client/v2.0"),i(n,S,h+"/api/private/v2.0"),i(n,A,e?h+"/api/client/v2.0/app/"+e:h+"/api/public/v2.0"),n)),i(u,O,(o={},i(o,E,h+"/api/public/v3.0"),i(o,N,h+"/api/client/v3.0"),i(o,A,e?h+"/api/client/v3.0/app/"+e:h+"/api/admin/v3.0"),o)),u);var l={codec:c.APP_CLIENT_CODEC,storage:s.storage};return s.storageType&&(l.storageType=s.storageType),s.platform&&(l.platform=s.platform),s.authCodec&&(l.codec=s.authCodec),a.AuthFactory.create(f,f.authUrl,l).then(function(t){return f.auth=t,Promise.all([f.auth.handleRedirect(),f.auth.handleCookie()])}).then(function(){return f})}Object.defineProperty(e,"__esModule",{value:!0}),e.StitchClient=e.StitchClientFactory=void 0;var s=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:{};return u(T.prototype,t,e)}}]),t}(),e.StitchClient=function(){function t(){throw o(this,t),new b.StitchError("StitchClient can only be made from the StitchClientFactory.create function")}return s(t,[{key:"login",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return void 0===t||void 0===e?this.authenticate(f.PROVIDER_TYPE_ANON,r):this.authenticate("userpass",Object.assign({username:t,password:e},r))}},{key:"register",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.auth.provider("userpass").register(t,e,r)}},{key:"authenticate",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=function(){return e.auth.provider(t).authenticate(r).then(function(){return e.authedId()})};return this.isAuthenticated()?t===f.PROVIDER_TYPE_ANON&&this.auth.getLoggedInProviderType()===f.PROVIDER_TYPE_ANON?Promise.resolve(this.auth.authedId):this.logout().then(function(){return n()}):n()}},{key:"logout",value:function(){var t=this;return this._do("/auth/session","DELETE",{refreshOnFailure:!1,useRefreshToken:!0,rootURL:this.rootURLsByAPIVersion[w][N]}).then(function(){return t.auth.clear()},function(){return t.auth.clear()})}},{key:"authError",value:function(){return this.auth.error()}},{key:"userProfile",value:function(){return this._do("/auth/profile","GET",{rootURL:this.rootURLsByAPIVersion[w][N]}).then(function(t){return t.json()})}},{key:"isAuthenticated",value:function(){return!!this.authedId()}},{key:"authedId",value:function(){return this.auth.authedId}},{key:"service",value:function(e,r){if(this.constructor!==t)throw new b.StitchError("`service` is a factory method, do not use `new`");if(!l.default.hasOwnProperty(e))throw new b.StitchError("Invalid service type specified: "+e);return new(0,l.default[e])(this,r)}},{key:"executeFunction",value:function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n2?r-2:0),i=2;i=200&&t.status<300)return Promise.resolve(t);if(t.headers.get("Content-Type")===_.JSONTYPE)return t.json().then(function(e){if("error_code"in e&&e.error_code===b.ErrInvalidSession)return i.refreshOnFailure?o.auth.refreshToken().then(function(){return i.refreshOnFailure=!1,o._do(r,n,i)}):o.auth.clear().then(function(){var r=new b.StitchError(e.error,e.error_code);throw r.response=t,r.json=e,r});var u=new b.StitchError(e.error,e.error_code);return u.response=t,u.json=e,Promise.reject(u)});var e=new Error(t.statusText);return e.response=t,Promise.reject(e)})}},{key:"_fetchArgs",value:function(t,e,r){var n=this.rootURLsByAPIVersion[r.apiVersion][r.apiType],i=""+n+t;r.rootURL&&(i=""+r.rootURL+t);var o=_.makeFetchArgs(e,r.body);return r.headers&&Object.assign(o.headers,r.headers),r.queryParams&&(i=i+"?"+v.default.stringify(r.queryParams)),{url:i,fetchArgs:o}}},{key:"_do",value:function(t,e,r){var n=this;r=Object.assign({},{refreshOnFailure:!0,useRefreshToken:!1,apiVersion:w,apiType:A,rootURL:void 0},r);var i=this._fetchArgs(t,e,r),o=i.url,u=i.fetchArgs;if(r.noAuth)return this._fetch(o,u,t,e,r);if(!this.isAuthenticated())return Promise.reject(new b.StitchError("Must auth first",b.ErrUnauthorized));var s=r.useRefreshToken?this.auth.getRefreshToken():this.auth.getAccessToken();return r.useRefreshToken?(u.headers.Authorization="Bearer "+s,this._fetch(o,u,t,e,r)):this.auth.isAccessTokenExpired()?this.auth.refreshToken().then(function(){return r.refreshOnFailure=!1,n._do(t,e,r)}):(u.headers.Authorization="Bearer "+s,this._fetch(o,u,t,e,r))}},{key:"type",get:function(){return _.APP_CLIENT_TYPE}}]),t}())},function(t,e,r){"use strict";var n=r(57);t.exports=n},function(t,e,r){"use strict";(function(e){if(void 0!==e.Map)t.exports=e.Map,t.exports.Map=e.Map;else{var r=function(t){this._keys=[],this._values={};for(var e=0;e1&&void 0!==arguments[1]&&arguments[1];return e={},i(e,m,o(t)),i(e,E,a(t)),i(e,S,h(t)),i(e,N,l(t)),i(e,A,p(t)),i(e,O,s(t)),i(e,w,u(t)),e}Object.defineProperty(e,"__esModule",{value:!0}),e.createProviders=e.PROVIDER_TYPE_MONGODB_CLOUD=e.PROVIDER_TYPE_FACEBOOK=e.PROVIDER_TYPE_GOOGLE=e.PROVIDER_TYPE_APIKEY=e.PROVIDER_TYPE_USERPASS=e.PROVIDER_TYPE_CUSTOM=e.PROVIDER_TYPE_ANON=void 0;var d=r(16),y=n(d),g=r(4),v=n(g),b=r(2),m=e.PROVIDER_TYPE_ANON="anon",w=e.PROVIDER_TYPE_CUSTOM="custom",O=e.PROVIDER_TYPE_USERPASS="userpass",E=e.PROVIDER_TYPE_APIKEY="apiKey",S=e.PROVIDER_TYPE_GOOGLE="google",N=e.PROVIDER_TYPE_FACEBOOK="facebook",A=e.PROVIDER_TYPE_MONGODB_CLOUD="mongodbCloud",T="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";e.createProviders=_},function(t,e,r){r(73);var n="undefined"!=typeof self&&self||this;t.exports=n.fetch.bind(n)},function(t,e){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function i(t){if(c===setTimeout)return setTimeout(t,0);if((c===r||!c)&&setTimeout)return c=setTimeout,setTimeout(t,0);try{return c(t,0)}catch(e){try{return c.call(null,t,0)}catch(e){return c.call(this,t,0)}}}function o(t){if(h===clearTimeout)return clearTimeout(t);if((h===n||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(t);try{return h(t)}catch(e){try{return h.call(null,t)}catch(e){return h.call(this,t)}}}function u(){d&&p&&(d=!1,p.length?_=p.concat(_):y=-1,_.length&&s())}function s(){if(!d){var t=i(u);d=!0;for(var e=_.length;e;){for(p=_,_=[];++y1)for(var r=1;r2?r-2:0),o=2;o1&&void 0!==arguments[1]?arguments[1]:"";return e._post(n+"/debug/execute_function",{name:u,arguments:i},{user_id:t})},executeFunctionSource:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return e._post(n+"/debug/execute_function_source",{source:r,eval_source:i},{user_id:t})}}},authProviders:function(){return{list:function(){return e._get(n+"/auth_providers")},create:function(t){return e._post(n+"/auth_providers",t)},authProvider:function(t){return{get:function(){return e._get(n+"/auth_providers/"+t)},update:function(r){return e._patch(n+"/auth_providers/"+t,r)},enable:function(){return e._put(n+"/auth_providers/"+t+"/enable")},disable:function(){return e._put(n+"/auth_providers/"+t+"/disable")},remove:function(){return e._delete(n+"/auth_providers/"+t)}}}}},security:function(){return{allowedRequestOrigins:function(){return{get:function(){return e._get(n+"/security/allowed_request_origins")},update:function(t){return e._post(n+"/security/allowed_request_origins",t)}}}}},logs:function(){return{list:function(t){return e._get(n+"/logs",t)}}},apiKeys:function(){return{list:function(){return e._get(n+"/api_keys")},create:function(t){return e._post(n+"/api_keys",t)},apiKey:function(t){return{get:function(){return e._get(n+"/api_keys/"+t)},remove:function(){return e._delete(n+"/api_keys/"+t)},enable:function(){return e._put(n+"/api_keys/"+t+"/enable")},disable:function(){return e._put(n+"/api_keys/"+t+"/disable")}}}}},functions:function(){return{list:function(){return e._get(n+"/functions")},create:function(t){return e._post(n+"/functions",t)},function:function(t){return{get:function(){return e._get(n+"/functions/"+t)},update:function(r){return e._put(n+"/functions/"+t,r)},remove:function(){return e._delete(n+"/functions/"+t)}}}}}}}}}},{key:"v2",value:function(){var t=this._v2;return{apps:function(e){var r="/groups/"+e+"/apps";return{list:function(){return t._get(r)},create:function(e,n){var i=n&&n.defaults?"?defaults=true":"";return t._post(r+i,e)},app:function(e){var n=r+"/"+e;return{get:function(){return t._get(n)},remove:function(){return t._delete(n)},pipelines:function(){return{list:function(){return t._get(n+"/pipelines")},create:function(e){return t._post(n+"/pipelines",e)},pipeline:function(e){var r=n+"/pipelines/"+e;return{get:function(){return t._get(r)},remove:function(){return t._delete(r)},update:function(e){return t._put(r,e)}}}}},values:function(){return{list:function(){return t._get(n+"/values")},create:function(e){return t._post(n+"/values",e)},value:function(e){var r=n+"/values/"+e;return{get:function(){return t._get(r)},remove:function(){return t._delete(r)},update:function(e){return t._put(r,e)}}}}},services:function(){return{list:function(){return t._get(n+"/services")},create:function(e){return t._post(n+"/services",e)},service:function(e){return{get:function(){return t._get(n+"/services/"+e)},remove:function(){return t._delete(n+"/services/"+e)},runCommand:function(r,i){return t._post(n+"/services/"+e+"/commands/"+r,i)},config:function(){return{get:function(){return t._get(n+"/services/"+e+"/config")},update:function(r){return t._patch(n+"/services/"+e+"/config",r)}}},rules:function(){return{list:function(){return t._get(n+"/services/"+e+"/rules")},create:function(r){return t._post(n+"/services/"+e+"/rules",r)},rule:function(r){var i=n+"/services/"+e+"/rules/"+r;return{get:function(){return t._get(i)},update:function(e){return t._put(i,e)},remove:function(){return t._delete(i)}}}}},incomingWebhooks:function(){return{list:function(){return t._get(n+"/services/"+e+"/incoming_webhooks")},create:function(r){return t._post(n+"/services/"+e+"/incoming_webhooks",r)},incomingWebhook:function(r){var i=n+"/services/"+e+"/incoming_webhooks/"+r;return{get:function(){return t._get(i)},update:function(e){return t._put(i,e)},remove:function(){return t._delete(i)}}}}}}}}},pushNotifications:function(){return{list:function(e){return t._get(n+"/push/notifications",e)},create:function(e){return t._post(n+"/push/notifications",e)},pushNotification:function(e){return{get:function(){return t._get(n+"/push/notifications/"+e)},update:function(r){return t._put(n+"/push/notifications/"+e,r)},setType:function(r){return t._put(n+"/push/notifications/"+e+"/type",{type:r})},remove:function(){return t._delete(n+"/push/notifications/"+e)}}}}},users:function(){return{list:function(e){return t._get(n+"/users",e)},create:function(e){return t._post(n+"/users",e)},user:function(e){return{get:function(){return t._get(n+"/users/"+e)},logout:function(){return t._put(n+"/users/"+e+"/logout")},remove:function(){return t._delete(n+"/users/"+e)}}}}},dev:function(){return{executePipeline:function(e,r,i){return t._post(n+"/dev/pipeline",e,Object.assign({},i,{user_id:r}))}}},authProviders:function(){return{list:function(){return t._get(n+"/auth_providers")},create:function(e){return t._post(n+"/auth_providers",e)},authProvider:function(e){return{get:function(){return t._get(n+"/auth_providers/"+e)},update:function(r){return t._patch(n+"/auth_providers/"+e,r)},enable:function(){return t._put(n+"/auth_providers/"+e+"/enable")},disable:function(){return t._put(n+"/auth_providers/"+e+"/disable")},remove:function(){return t._delete(n+"/auth_providers/"+e)}}}}},security:function(){return{allowedRequestOrigins:function(){return{get:function(){return t._get(n+"/security/allowed_request_origins")},update:function(e){return t._post(n+"/security/allowed_request_origins",e)}}}}},logs:function(){return{list:function(e){return t._get(n+"/logs",e)}}},apiKeys:function(){return{list:function(){return t._get(n+"/api_keys")},create:function(e){return t._post(n+"/api_keys",e)},apiKey:function(e){return{get:function(){return t._get(n+"/api_keys/"+e)},remove:function(){return t._delete(n+"/api_keys/"+e)},enable:function(){return t._put(n+"/api_keys/"+e+"/enable")},disable:function(){return t._put(n+"/api_keys/"+e+"/disable")}}}}}}}}}}}},{key:"_admin",value:function(){var t=this;return{logs:function(){return{get:function(r){return u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_do",t).call(t,"/admin/logs","GET",{useRefreshToken:!0,queryParams:r})}}},users:function(){return{list:function(r){return u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_do",t).call(t,"/admin/users","GET",{useRefreshToken:!0,queryParams:r})},user:function(r){return{logout:function(){return u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_do",t).call(t,"/admin/users/"+r+"/logout","PUT",{useRefreshToken:!0})}}}}}}}},{key:"type",get:function(){return c.default}},{key:"_v3",get:function(){var t=this,r=function(r,n,i){return u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_do",t).call(t,r,n,Object.assign({},{apiVersion:3},i)).then(function(t){return(t.headers.get("content-type")||"").split(",").indexOf("application/json")>=0?t.json():t})};return{_get:function(t,e){return r(t,"GET",{queryParams:e})},_put:function(t,e){return e?r(t,"PUT",{body:JSON.stringify(e)}):r(t,"PUT")},_patch:function(t,e){return e?r(t,"PATCH",{body:JSON.stringify(e)}):r(t,"PATCH")},_delete:function(t){return r(t,"DELETE")},_post:function(t,e,n){return n?r(t,"POST",{body:JSON.stringify(e),queryParams:n}):r(t,"POST",{body:JSON.stringify(e)})}}}},{key:"_v2",get:function(){var t=this,r=function(r,n,i){return u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_do",t).call(t,r,n,Object.assign({},{apiVersion:2},i)).then(function(t){return(t.headers.get("content-type")||"").split(",").indexOf("application/json")>=0?t.json():t})};return{_get:function(t,e){return r(t,"GET",{queryParams:e})},_put:function(t,e){return e?r(t,"PUT",{body:JSON.stringify(e)}):r(t,"PUT")},_patch:function(t,e){return e?r(t,"PATCH",{body:JSON.stringify(e)}):r(t,"PATCH")},_delete:function(t){return r(t,"DELETE")},_post:function(t,e,n){return n?r(t,"POST",{body:JSON.stringify(e),queryParams:n}):r(t,"POST",{body:JSON.stringify(e)})}}}}]),e}(a.StitchClient))},function(t,e,r){!function(){function t(t){this.message=t}var r=e,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.prototype=new Error,t.prototype.name="InvalidCharacterError",r.btoa||(r.btoa=function(e){for(var r,i,o=String(e),u=0,s=n,a="";o.charAt(0|u)||(s="=",u%1);a+=s.charAt(63&r>>8-u%1*8)){if((i=o.charCodeAt(u+=.75))>255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");r=r<<8|i}return a}),r.atob||(r.atob=function(e){var r=String(e).replace(/[=]+$/,"");if(r.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var i,o,u=0,s=0,a="";o=r.charAt(s++);~o&&(i=u%4?64*i+o:o,u++%4)?a+=String.fromCharCode(255&i>>(-2*u&6)):0)o=n.indexOf(o);return a})}()},function(t,e,r){"use strict";(function(e){var n=(r(1).writeIEEE754,r(1).readIEEE754,r(22)),i=r(3),o=r(9),u=r(15),s=r(12),a=r(13),f=r(14),c=r(18),h=r(6),l=r(8),p=r(11),_=r(10),d=r(7),y=r(5),g=r(30),v=r(31),b=r(29),m=new e(17825792),w=function(){};w.prototype.serialize=function(t,r){r=r||{};var n="boolean"==typeof r.checkKeys&&r.checkKeys,i="boolean"==typeof r.serializeFunctions&&r.serializeFunctions,o="boolean"!=typeof r.ignoreUndefined||r.ignoreUndefined,u=v(m,t,n,0,0,i,o,[]),s=new e(u);return m.copy(s,0,0,s.length),s},w.prototype.serializeWithBufferAndIndex=function(t,e,r){r=r||{};var n="boolean"==typeof r.checkKeys&&r.checkKeys,i="boolean"==typeof r.serializeFunctions&&r.serializeFunctions,o="boolean"!=typeof r.ignoreUndefined||r.ignoreUndefined,u="number"==typeof r.index?r.index:0,s=v(m,t,n,u||0,0,i,o);return m.copy(e,u,0,s),s-1},w.prototype.deserialize=function(t,e){return g(t,e)},w.prototype.calculateObjectSize=function(t,e){e=e||{};var r="boolean"==typeof e.serializeFunctions&&e.serializeFunctions,n="boolean"!=typeof e.ignoreUndefined||e.ignoreUndefined;return b(t,r,n)},w.prototype.deserializeStream=function(t,e,r,n,i,o){o=null!=o?o:{};for(var u=e,s=0;s=b.JS_INT_MIN&&r<=b.JS_INT_MAX&&r>=b.BSON_INT32_MIN&&r<=b.BSON_INT32_MAX?(null!=t?e.byteLength(t,"utf8")+1:0)+5:(null!=t?e.byteLength(t,"utf8")+1:0)+9;case"undefined":return m||!w?(null!=t?e.byteLength(t,"utf8")+1:0)+1:0;case"boolean":return(null!=t?e.byteLength(t,"utf8")+1:0)+2;case"object":if(null==r||r instanceof p||r instanceof _||"MinKey"==r._bsontype||"MaxKey"==r._bsontype)return(null!=t?e.byteLength(t,"utf8")+1:0)+1;if(r instanceof a||"ObjectID"==r._bsontype)return(null!=t?e.byteLength(t,"utf8")+1:0)+13;if(r instanceof Date||g(r))return(null!=t?e.byteLength(t,"utf8")+1:0)+9;if(void 0!==e&&e.isBuffer(r))return(null!=t?e.byteLength(t,"utf8")+1:0)+6+r.length;if(r instanceof o||r instanceof u||r instanceof s||"Long"==r._bsontype||"Double"==r._bsontype||"Timestamp"==r._bsontype)return(null!=t?e.byteLength(t,"utf8")+1:0)+9;if(r instanceof l||"Decimal128"==r._bsontype)return(null!=t?e.byteLength(t,"utf8")+1:0)+17;if(r instanceof h||"Code"==r._bsontype)return null!=r.scope&&Object.keys(r.scope).length>0?(null!=t?e.byteLength(t,"utf8")+1:0)+1+4+4+e.byteLength(r.code.toString(),"utf8")+1+v(r.scope,n,w):(null!=t?e.byteLength(t,"utf8")+1:0)+1+4+e.byteLength(r.code.toString(),"utf8")+1;if(r instanceof y||"Binary"==r._bsontype)return r.sub_type==y.SUBTYPE_BYTE_ARRAY?(null!=t?e.byteLength(t,"utf8")+1:0)+(r.position+1+4+1+4):(null!=t?e.byteLength(t,"utf8")+1:0)+(r.position+1+4+1);if(r instanceof f||"Symbol"==r._bsontype)return(null!=t?e.byteLength(t,"utf8")+1:0)+e.byteLength(r.value,"utf8")+4+1+1;if(r instanceof d||"DBRef"==r._bsontype){var O={$ref:r.namespace,$id:r.oid};return null!=r.db&&(O.$db=r.db),(null!=t?e.byteLength(t,"utf8")+1:0)+1+v(O,n,w)}return r instanceof RegExp||"[object RegExp]"===Object.prototype.toString.call(r)?(null!=t?e.byteLength(t,"utf8")+1:0)+1+e.byteLength(r.source,"utf8")+1+(r.global?1:0)+(r.ignoreCase?1:0)+(r.multiline?1:0)+1:r instanceof c||"BSONRegExp"==r._bsontype?(null!=t?e.byteLength(t,"utf8")+1:0)+1+e.byteLength(r.pattern,"utf8")+1+e.byteLength(r.options,"utf8")+1:(null!=t?e.byteLength(t,"utf8")+1:0)+v(r,n,w)+1;case"function":if(r instanceof RegExp||"[object RegExp]"===Object.prototype.toString.call(r)||"[object RegExp]"==String.call(r))return(null!=t?e.byteLength(t,"utf8")+1:0)+1+e.byteLength(r.source,"utf8")+1+(r.global?1:0)+(r.ignoreCase?1:0)+(r.multiline?1:0)+1;if(n&&null!=r.scope&&Object.keys(r.scope).length>0)return(null!=t?e.byteLength(t,"utf8")+1:0)+1+4+4+e.byteLength(r.toString(),"utf8")+1+v(r.scope,n,w);if(n)return(null!=t?e.byteLength(t,"utf8")+1:0)+1+4+e.byteLength(r.toString(),"utf8")+1}return 0}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=(r(1).writeIEEE754,r(1).readIEEE754,r(3).Long),u=r(9).Double,s=r(15).Timestamp,a=r(12).ObjectID,f=r(14).Symbol,c=r(13).BSONRegExp,h=r(6).Code,l=r(8),p=r(11).MinKey,_=r(10).MaxKey,d=r(7).DBRef,y=r(5).Binary,g=function(t){return"object"===(void 0===t?"undefined":i(t))&&"[object Date]"===Object.prototype.toString.call(t)},v=function(t,e,r){var i=5;if(Array.isArray(t))for(var o=0;ot.length)throw new Error("corrupt bson message");if(0!=t[n+i-1])throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return deserializeObject(t,n,e,r)},deserializeObject=function t(e,r,n,i){var o=null!=n.evalFunctions&&n.evalFunctions,u=null!=n.cacheFunctions&&n.cacheFunctions,s=null!=n.cacheFunctionsCrc32&&n.cacheFunctionsCrc32,a=null==n.fieldsAsRaw?null:n.fieldsAsRaw,f=null!=n.raw&&n.raw,c="boolean"==typeof n.bsonRegExp&&n.bsonRegExp,h=null!=n.promoteBuffers&&n.promoteBuffers,l=null==n.promoteLongs||n.promoteLongs,p=null==n.promoteValues||n.promoteValues,_=r;if(e.length<5)throw new Error("corrupt bson message < 5 bytes long");var d=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;if(d<5||d>e.length)throw new Error("corrupt bson message");for(var y=i?[]:{},g=0;;){var v=e[r++];if(0==v)break;for(var b=r;0!==e[b]&&b=e.length)throw new Error("Bad BSON Document: illegal CString");var m=i?g++:e.toString("utf8",r,b);if(r=b+1,v==BSON.BSON_DATA_STRING){var w=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;if(w<=0||w>e.length-r||0!=e[r+w-1])throw new Error("bad string length in bson");y[m]=e.toString("utf8",r,r+w-1),r+=w}else if(v==BSON.BSON_DATA_OID){var O=new Buffer(12);e.copy(O,0,r,r+12),y[m]=new ObjectID(O),r+=12}else if(v==BSON.BSON_DATA_INT&&0==p)y[m]=new Int32(e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24);else if(v==BSON.BSON_DATA_INT)y[m]=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;else if(v==BSON.BSON_DATA_NUMBER&&0==p)y[m]=new Double(e.readDoubleLE(r)),r+=8;else if(v==BSON.BSON_DATA_NUMBER)y[m]=e.readDoubleLE(r),r+=8;else if(v==BSON.BSON_DATA_DATE){var E=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24,S=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;y[m]=new Date(new Long(E,S).toNumber())}else if(v==BSON.BSON_DATA_BOOLEAN){if(0!=e[r]&&1!=e[r])throw new Error("illegal boolean type value");y[m]=1==e[r++]}else if(v==BSON.BSON_DATA_OBJECT){var N=r,A=e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24;if(A<=0||A>e.length-r)throw new Error("bad embedded document length in bson");y[m]=f?e.slice(r,r+A):t(e,N,n,!1),r+=A}else if(v==BSON.BSON_DATA_ARRAY){var N=r,A=e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24,T=n,B=r+A;if(a&&a[m]){T={};for(var I in n)T[I]=n[I];T.raw=!0}if(y[m]=t(e,N,T,!0),r+=A,0!=e[r-1])throw new Error("invalid array terminator byte");if(r!=B)throw new Error("corrupted array bson")}else if(v==BSON.BSON_DATA_UNDEFINED)y[m]=void 0;else if(v==BSON.BSON_DATA_NULL)y[m]=null;else if(v==BSON.BSON_DATA_LONG){var E=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24,S=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24,R=new Long(E,S);y[m]=l&&1==p&&R.lessThanOrEqual(JS_INT_MAX_LONG)&&R.greaterThanOrEqual(JS_INT_MIN_LONG)?R.toNumber():R}else if(v==BSON.BSON_DATA_DECIMAL128){var D=new Buffer(16);e.copy(D,0,r,r+16),r+=16;var P=new Decimal128(D);y[m]=P.toObject?P.toObject():P}else if(v==BSON.BSON_DATA_BINARY){var x=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24,U=x,k=e[r++];if(x<0)throw new Error("Negative binary type element size found");if(x>e.length)throw new Error("Binary type size larger than document size");if(null!=e.slice){if(k==Binary.SUBTYPE_BYTE_ARRAY){if((x=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24)<0)throw new Error("Negative binary type element size found for subtype 0x02");if(x>U-4)throw new Error("Binary type with subtype 0x02 contains to long binary size");if(xU-4)throw new Error("Binary type with subtype 0x02 contains to long binary size");if(x=e.length)throw new Error("Bad BSON Document: illegal CString");var M=e.toString("utf8",r,b);r=b+1;for(var b=r;0!==e[b]&&b=e.length)throw new Error("Bad BSON Document: illegal CString");var j=e.toString("utf8",r,b);r=b+1;for(var C=new Array(j.length),b=0;b=e.length)throw new Error("Bad BSON Document: illegal CString");var M=e.toString("utf8",r,b);r=b+1;for(var b=r;0!==e[b]&&b=e.length)throw new Error("Bad BSON Document: illegal CString");var j=e.toString("utf8",r,b);r=b+1,y[m]=new BSONRegExp(M,j)}else if(v==BSON.BSON_DATA_SYMBOL){var w=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;if(w<=0||w>e.length-r||0!=e[r+w-1])throw new Error("bad string length in bson");y[m]=new _Symbol(e.toString("utf8",r,r+w-1)),r+=w}else if(v==BSON.BSON_DATA_TIMESTAMP){var E=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24,S=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;y[m]=new Timestamp(E,S)}else if(v==BSON.BSON_DATA_MIN_KEY)y[m]=new MinKey;else if(v==BSON.BSON_DATA_MAX_KEY)y[m]=new MaxKey;else if(v==BSON.BSON_DATA_CODE){var w=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;if(w<=0||w>e.length-r||0!=e[r+w-1])throw new Error("bad string length in bson");var Y=e.toString("utf8",r,r+w-1);if(o){if(u){var F=s?crc32(Y):Y;y[m]=isolateEvalWithHash(functionCache,F,Y,y)}else y[m]=isolateEval(Y)}else y[m]=new Code(Y);r+=w}else if(v==BSON.BSON_DATA_CODE_W_SCOPE){var W=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;if(W<13)throw new Error("code_w_scope total size shorter minimum expected length");var w=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;if(w<=0||w>e.length-r||0!=e[r+w-1])throw new Error("bad string length in bson");var Y=e.toString("utf8",r,r+w-1);r+=w;var N=r,A=e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24,K=t(e,N,n,!1);if(r+=A,W<8+A+w)throw new Error("code_w_scope total size is to short, truncating scope");if(W>8+A+w)throw new Error("code_w_scope total size is to long, clips outer document");if(o){if(u){var F=s?crc32(Y):Y;y[m]=isolateEvalWithHash(functionCache,F,Y,y)}else y[m]=isolateEval(Y);y[m].scope=K}else y[m]=new Code(Y,K)}else{if(v!=BSON.BSON_DATA_DBPOINTER)throw new Error("Detected unknown BSON type "+v.toString(16)+' for fieldname "'+m+'", are you using the latest BSON parser');var w=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;if(w<=0||w>e.length-r||0!=e[r+w-1])throw new Error("bad string length in bson");var $=e.toString("utf8",r,r+w-1);r+=w;var J=new Buffer(12);e.copy(J,0,r,r+12);var O=new ObjectID(J);r+=12;var V=$.split("."),q=V.shift(),H=V.join(".");y[m]=new DBRef(H,O,q)}}if(d!=r-_){if(i)throw new Error("corrupt array bson");throw new Error("corrupt object bson")}return null!=y.$id&&(y=new DBRef(y.$ref,y.$id,y.$db)),y},isolateEvalWithHash=function isolateEvalWithHash(functionCache,hash,functionString,object){var value=null;return null==functionCache[hash]&&(eval("value = "+functionString),functionCache[hash]=value),functionCache[hash].bind(object)},isolateEval=function isolateEval(functionString){var value=null;return eval("value = "+functionString),value},BSON={},functionCache=BSON.functionCache={};BSON.BSON_DATA_NUMBER=1,BSON.BSON_DATA_STRING=2,BSON.BSON_DATA_OBJECT=3,BSON.BSON_DATA_ARRAY=4,BSON.BSON_DATA_BINARY=5,BSON.BSON_DATA_UNDEFINED=6,BSON.BSON_DATA_OID=7,BSON.BSON_DATA_BOOLEAN=8,BSON.BSON_DATA_DATE=9,BSON.BSON_DATA_NULL=10,BSON.BSON_DATA_REGEXP=11,BSON.BSON_DATA_DBPOINTER=12,BSON.BSON_DATA_CODE=13,BSON.BSON_DATA_SYMBOL=14,BSON.BSON_DATA_CODE_W_SCOPE=15,BSON.BSON_DATA_INT=16,BSON.BSON_DATA_TIMESTAMP=17,BSON.BSON_DATA_LONG=18,BSON.BSON_DATA_DECIMAL128=19,BSON.BSON_DATA_MIN_KEY=255,BSON.BSON_DATA_MAX_KEY=127,BSON.BSON_BINARY_SUBTYPE_DEFAULT=0,BSON.BSON_BINARY_SUBTYPE_FUNCTION=1,BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY=2,BSON.BSON_BINARY_SUBTYPE_UUID=3,BSON.BSON_BINARY_SUBTYPE_MD5=4,BSON.BSON_BINARY_SUBTYPE_USER_DEFINED=128,BSON.BSON_INT32_MAX=2147483647,BSON.BSON_INT32_MIN=-2147483648,BSON.BSON_INT64_MAX=Math.pow(2,63)-1,BSON.BSON_INT64_MIN=-Math.pow(2,63),BSON.JS_INT_MAX=9007199254740992,BSON.JS_INT_MIN=-9007199254740992;var JS_INT_MAX_LONG=Long.fromNumber(9007199254740992),JS_INT_MIN_LONG=Long.fromNumber(-9007199254740992);module.exports=deserialize}).call(exports,__webpack_require__(0).Buffer)},function(t,e,r){"use strict";(function(e){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=r(1).writeIEEE754,o=(r(1).readIEEE754,r(3).Long),u=r(22),s=(r(9).Double,r(15).Timestamp,r(12).ObjectID,r(14).Symbol,r(6).Code,r(13).BSONRegExp,r(18).Int32,r(11).MinKey),a=(r(10).MaxKey,r(8),r(7).DBRef,r(5).Binary);try{Uint8Array}catch(t){}var f=/\x00/,c=function(t){return"object"===(void 0===t?"undefined":n(t))&&"[object Date]"===Object.prototype.toString.call(t)},h=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},l=function(t,e,r,n,i){t[n++]=x.BSON_DATA_STRING,n=n+(i?t.write(e,n,"ascii"):t.write(e,n,"utf8"))+1,t[n-1]=0;var o=t.write(r,n+4,"utf8");return t[n+3]=o+1>>24&255,t[n+2]=o+1>>16&255,t[n+1]=o+1>>8&255,t[n]=o+1&255,n=n+4+o,t[n++]=0,n},p=function(t,e,r,n,u){if(Math.floor(r)===r&&r>=x.JS_INT_MIN&&r<=x.JS_INT_MAX)if(r>=x.BSON_INT32_MIN&&r<=x.BSON_INT32_MAX){t[n++]=x.BSON_DATA_INT;var s=u?t.write(e,n,"ascii"):t.write(e,n,"utf8");n+=s,t[n++]=0,t[n++]=255&r,t[n++]=r>>8&255,t[n++]=r>>16&255,t[n++]=r>>24&255}else if(r>=x.JS_INT_MIN&&r<=x.JS_INT_MAX){t[n++]=x.BSON_DATA_NUMBER;var s=u?t.write(e,n,"ascii"):t.write(e,n,"utf8");n+=s,t[n++]=0,i(t,r,n,"little",52,8),n+=8}else{t[n++]=x.BSON_DATA_LONG;var s=u?t.write(e,n,"ascii"):t.write(e,n,"utf8");n+=s,t[n++]=0;var a=o.fromNumber(r),f=a.getLowBits(),c=a.getHighBits();t[n++]=255&f,t[n++]=f>>8&255,t[n++]=f>>16&255,t[n++]=f>>24&255,t[n++]=255&c,t[n++]=c>>8&255,t[n++]=c>>16&255,t[n++]=c>>24&255}else{t[n++]=x.BSON_DATA_NUMBER;var s=u?t.write(e,n,"ascii"):t.write(e,n,"utf8");n+=s,t[n++]=0,i(t,r,n,"little",52,8),n+=8}return n},_=function(t,e,r,n,i){return t[n++]=x.BSON_DATA_NULL,n+=i?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0,n},d=function(t,e,r,n,i){return t[n++]=x.BSON_DATA_BOOLEAN,n+=i?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0,t[n++]=r?1:0,n},y=function(t,e,r,n,i){t[n++]=x.BSON_DATA_DATE,n+=i?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0;var u=o.fromNumber(r.getTime()),s=u.getLowBits(),a=u.getHighBits();return t[n++]=255&s,t[n++]=s>>8&255,t[n++]=s>>16&255,t[n++]=s>>24&255,t[n++]=255&a,t[n++]=a>>8&255,t[n++]=a>>16&255,t[n++]=a>>24&255,n},g=function(t,e,r,n,i){if(t[n++]=x.BSON_DATA_REGEXP,n+=i?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0,r.source&&null!=r.source.match(f))throw Error("value "+r.source+" must not contain null bytes");return n+=t.write(r.source,n,"utf8"),t[n++]=0,r.global&&(t[n++]=115),r.ignoreCase&&(t[n++]=105),r.multiline&&(t[n++]=109),t[n++]=0,n},v=function(t,e,r,n,i){if(t[n++]=x.BSON_DATA_REGEXP,n+=i?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0,null!=r.pattern.match(f))throw Error("pattern "+r.pattern+" must not contain null bytes");return n+=t.write(r.pattern,n,"utf8"),t[n++]=0,n+=t.write(r.options.split("").sort().join(""),n,"utf8"),t[n++]=0,n},b=function(t,e,r,n,i){return t[n++]=null===r?x.BSON_DATA_NULL:r instanceof s?x.BSON_DATA_MIN_KEY:x.BSON_DATA_MAX_KEY,n+=i?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0,n},m=function(t,e,r,n,i){if(t[n++]=x.BSON_DATA_OID,n+=i?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0,"string"==typeof r.id)t.write(r.id,n,"binary");else{if(!r.id||!r.id.copy)throw new Error("object ["+JSON.stringify(r)+"] is not a valid ObjectId");r.id.copy(t,n,0,12)}return n+12},w=function(t,e,r,n,i){t[n++]=x.BSON_DATA_BINARY,n+=i?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0;var o=r.length;return t[n++]=255&o,t[n++]=o>>8&255,t[n++]=o>>16&255,t[n++]=o>>24&255,t[n++]=x.BSON_BINARY_SUBTYPE_DEFAULT,r.copy(t,n,0,o),n+=o},O=function(t,e,r,n,i,o,u,s,a,f){for(var c=0;c>8&255,t[n++]=o>>16&255,t[n++]=o>>24&255,t[n++]=255&u,t[n++]=u>>8&255,t[n++]=u>>16&255,t[n++]=u>>24&255,n},N=function(t,e,r,n,i){return t[n++]=x.BSON_DATA_INT,n+=i?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0,t[n++]=255&r,t[n++]=r>>8&255,t[n++]=r>>16&255,t[n++]=r>>24&255,n},A=function(t,e,r,n,o){return t[n++]=x.BSON_DATA_NUMBER,n+=o?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0,i(t,r,n,"little",52,8),n+=8},T=function(t,e,r,n,i,o,u){t[n++]=x.BSON_DATA_CODE,n+=u?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0;var s=r.toString(),a=t.write(s,n+4,"utf8")+1;return t[n]=255&a,t[n+1]=a>>8&255,t[n+2]=a>>16&255,t[n+3]=a>>24&255,n=n+4+a-1,t[n++]=0,n},B=function(t,e,r,i,o,u,s,a,f){if(r.scope&&"object"==n(r.scope)){t[i++]=x.BSON_DATA_CODE_W_SCOPE;var c=f?t.write(e,i,"ascii"):t.write(e,i,"utf8");i+=c,t[i++]=0;var h=i,l="string"==typeof r.code?r.code:r.code.toString();i+=4;var p=t.write(l,i+4,"utf8")+1;t[i]=255&p,t[i+1]=p>>8&255,t[i+2]=p>>16&255,t[i+3]=p>>24&255,t[i+4+p-1]=0,i=i+p+4;var _=P(t,r.scope,o,i,u+1,s,a);i=_-1;var d=_-h;t[h++]=255&d,t[h++]=d>>8&255,t[h++]=d>>16&255,t[h++]=d>>24&255,t[i++]=0}else{t[i++]=x.BSON_DATA_CODE;var c=f?t.write(e,i,"ascii"):t.write(e,i,"utf8");i+=c,t[i++]=0;var l=r.code.toString(),y=t.write(l,i+4,"utf8")+1;t[i]=255&y,t[i+1]=y>>8&255,t[i+2]=y>>16&255,t[i+3]=y>>24&255,i=i+4+y-1,t[i++]=0}return i},I=function(t,e,r,n,i){t[n++]=x.BSON_DATA_BINARY,n+=i?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0;var o=r.value(!0),u=r.position;return r.sub_type==a.SUBTYPE_BYTE_ARRAY&&(u+=4),t[n++]=255&u,t[n++]=u>>8&255,t[n++]=u>>16&255,t[n++]=u>>24&255,t[n++]=r.sub_type,r.sub_type==a.SUBTYPE_BYTE_ARRAY&&(u-=4,t[n++]=255&u,t[n++]=u>>8&255,t[n++]=u>>16&255,t[n++]=u>>24&255),o.copy(t,n,0,r.position),n+=r.position},R=function(t,e,r,n,i){t[n++]=x.BSON_DATA_SYMBOL,n+=i?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0;var o=t.write(r.value,n+4,"utf8")+1;return t[n]=255&o,t[n+1]=o>>8&255,t[n+2]=o>>16&255,t[n+3]=o>>24&255,n=n+4+o-1,t[n++]=0,n},D=function(t,e,r,n,i,o,u){t[n++]=x.BSON_DATA_OBJECT,n+=u?t.write(e,n,"ascii"):t.write(e,n,"utf8"),t[n++]=0;var s,a=n;s=null!=r.db?P(t,{$ref:r.namespace,$id:r.oid,$db:r.db},!1,n,i+1,o):P(t,{$ref:r.namespace,$id:r.oid},!1,n,i+1,o);var f=s-a;return t[a++]=255&f,t[a++]=f>>8&255,t[a++]=f>>16&255,t[a++]=f>>24&255,s},P=function(t,r,i,o,s,a,P,x){o=o||0,x=x||[],x.push(r);var U=o+4;if(Array.isArray(r))for(var k=0;k>8&255,t[o++]=W>>16&255,t[o++]=W>>24&255,U},x={};x.functionCache={};x.BSON_DATA_NUMBER=1,x.BSON_DATA_STRING=2,x.BSON_DATA_OBJECT=3,x.BSON_DATA_ARRAY=4,x.BSON_DATA_BINARY=5,x.BSON_DATA_UNDEFINED=6,x.BSON_DATA_OID=7,x.BSON_DATA_BOOLEAN=8,x.BSON_DATA_DATE=9,x.BSON_DATA_NULL=10,x.BSON_DATA_REGEXP=11,x.BSON_DATA_CODE=13,x.BSON_DATA_SYMBOL=14,x.BSON_DATA_CODE_W_SCOPE=15,x.BSON_DATA_INT=16,x.BSON_DATA_TIMESTAMP=17,x.BSON_DATA_LONG=18,x.BSON_DATA_DECIMAL128=19,x.BSON_DATA_MIN_KEY=255,x.BSON_DATA_MAX_KEY=127,x.BSON_BINARY_SUBTYPE_DEFAULT=0,x.BSON_BINARY_SUBTYPE_FUNCTION=1,x.BSON_BINARY_SUBTYPE_BYTE_ARRAY=2,x.BSON_BINARY_SUBTYPE_UUID=3,x.BSON_BINARY_SUBTYPE_MD5=4,x.BSON_BINARY_SUBTYPE_USER_DEFINED=128,x.BSON_INT32_MAX=2147483647,x.BSON_INT32_MIN=-2147483648,x.BSON_INT64_MAX=Math.pow(2,63)-1,x.BSON_INT64_MIN=-Math.pow(2,63),x.JS_INT_MAX=9007199254740992,x.JS_INT_MIN=-9007199254740992;o.fromNumber(9007199254740992),o.fromNumber(-9007199254740992);t.exports=P}).call(e,r(0).Buffer)},function(t,e,r){"use strict";function n(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e,r){var n=Object.create(b.prototype),i=void 0;return i=t&&""!==t.clientAppID?"client."+t.clientAppID:"admin",r=Object.assign({codec:p.APP_CLIENT_CODEC,namespace:i,storageType:"localStorage"},r),n.client=t,n.rootUrl=e,n.codec=r.codec,n.platform=r.platform||g,n.storage=(0,f.createStorage)(r),n.providers=(0,c.createProviders)(n,r),Promise.all([n._get(),n.storage.get(p.REFRESH_TOKEN_KEY),n.storage.get(p.USER_LOGGED_IN_PT_KEY),n.storage.get(p.DEVICE_ID_KEY)]).then(function(t){var e=s(t,4),r=e[0],i=e[1],o=e[2],u=e[3];return n.auth=r,n.authedId=r.userId,n.rt=i,n.loggedInProviderType=o,n.deviceId=u,n})}Object.defineProperty(e,"__esModule",{value:!0}),e.Auth=e.AuthFactory=void 0;var s=function(){function t(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var u,s=t[Symbol.iterator]();!(n=(u=s.next()).done)&&(r.push(u.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function t(t,e){for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:"",n={appId:e,appVersion:r,sdkVersion:d.SDK_VERSION};return t&&(n.deviceId=t),this.platform&&(n.platform=this.platform.name,n.platformVersion=this.platform.version),n}},{key:"provider",value:function(t){if(!this.providers.hasOwnProperty(t))throw new Error("Invalid auth provider specified: "+t);return this.providers[t]}},{key:"refreshToken",value:function(){var t=this;return this.client.doSessionPost().then(function(e){return t.set(e)})}},{key:"pageRootUrl",value:function(){return[window.location.protocol,"//",window.location.host,window.location.pathname].join("")}},{key:"error",value:function(){return this._error}},{key:"isAppClient",value:function(){return!this.client||this.client.type===d.APP_CLIENT_TYPE}},{key:"handleRedirect",value:function(){var t=this;if("undefined"!=typeof window&&window.location&&window.location.hash){var e=void 0;return Promise.all([this.storage.get(p.STATE_KEY),this.storage.get(p.STITCH_REDIRECT_PROVIDER)]).then(function(r){var n=s(r,2),i=n[0],o=n[1],u=window.location.hash.substring(1);e=o;var a=t.parseRedirectFragment(u,i);return a.lastError||!e?(console.error("StitchClient: error from redirect: "+(a.lastError?a.lastError:"provider type not set")),t._error=a.lastError,void window.history.replaceState(null,"",t.pageRootUrl())):a.found?Promise.all([t.storage.remove(p.STATE_KEY),t.storage.remove(p.STITCH_REDIRECT_PROVIDER)]).then(function(){return a}):void 0}).then(function(r){return r.stateValid?r.ua?t.set(r.ua,e):void console.error("StitchClient: no UA value was returned from redirect!"):(console.error("StitchClient: state values did not match!"),void window.history.replaceState(null,"",t.pageRootUrl()))}).then(function(){return window.history.replaceState(null,"",t.pageRootUrl())})}}},{key:"getCookie",value:function(t){for(var e=document.cookie.split(" "),r=0;r0&&void 0!==arguments[0]?arguments[0]:p.DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS,e=this.getAccessToken();if(!e)return!1;var r=void 0;try{r=v(e)}catch(t){return!1}return!!r&&(r.exp&&Math.floor(Date.now()/1e3)>=r.exp-t)}},{key:"getAccessToken",value:function(){return this.auth.accessToken}},{key:"getRefreshToken",value:function(){return this.rt}},{key:"set",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(t){var n={},i=[];return r&&(this.loggedInProviderType=r,i.push(this.storage.set(p.USER_LOGGED_IN_PT_KEY,r))),t[this.codec.refreshToken]&&(this.rt=t[this.codec.refreshToken],delete t[this.codec.refreshToken],i.push(this.storage.set(p.REFRESH_TOKEN_KEY,this.rt))),t[this.codec.deviceId]&&(this.deviceId=t[this.codec.deviceId],delete t[this.codec.deviceId],i.push(this.storage.set(p.DEVICE_ID_KEY,this.deviceId))),t[this.codec.accessToken]&&(n.accessToken=t[this.codec.accessToken]),t[this.codec.userId]&&(n.userId=t[this.codec.userId]),this.auth=Object.assign(this.auth?this.auth:{},n),this.authedId=this.auth.userId,i.push(this.storage.set(p.USER_AUTH_KEY,JSON.stringify(this.auth))),Promise.all(i).then(function(){return e.auth})}}},{key:"_get",value:function(){var t=this;return this.storage.get(p.USER_AUTH_KEY).then(function(e){if(!e)return{};try{return JSON.parse(e)}catch(e){return t.clear().then(function(){throw new h.StitchError("Failure retrieving stored auth")})}})}},{key:"getLoggedInProviderType",value:function(){return this.loggedInProviderType}},{key:"parseRedirectFragment",value:function(t,e){for(var r=t.split("&"),n={ua:null,found:!1,stateValid:!1,lastError:null},i=!1,o=0;o1&&void 0!==arguments[1]?arguments[1]:{}))}},{key:"post",value:function(t){return o("post",this,i(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}))}},{key:"put",value:function(t){return o("put",this,i(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}))}},{key:"patch",value:function(t){return o("patch",this,i(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}))}},{key:"delete",value:function(t){return o("delete",this,i(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}))}},{key:"head",value:function(t){return o("head",this,i(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}))}}]),t}();e.default=a,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i=r(35),o=n(i),u=r(36),s=n(u),a=r(37),f=n(a),c=r(41),h=n(c),l=r(42),p=n(l);e.default={"aws/s3":o.default,"aws/ses":s.default,http:f.default,mongodb:h.default,twilio:p.default},t.exports=e.default},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=e?"updateMany":"updateOne",u=void 0;return!e&&i.upsert&&(u={upsert:!0}),a(o,t,s(t,{query:r,update:n},u))}function o(t){var e=t.service;return a("find",e,s(e,{query:t.query,project:t.project,limit:t.limit,sort:t.sort}))}function u(t,e){return a("aggregate",t,s(t,{pipeline:e}))}function s(t,e){var r=t.db.name,n=t.name,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object.assign({database:r,collection:n},e,i)}function a(t,e,r){return(0,h.serviceResponse)(e.db,{serviceName:e.db.service,action:t,args:r})}function f(t,e,r){return this instanceof f?(this.service=t,this.query=e,this.project=r,this):new f(t,e,r)}Object.defineProperty(e,"__esModule",{value:!0});var c=function(){function t(t,e){for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:{})}},{key:"updateMany",value:function(t,e){return i(this,!0,t,e)}},{key:"find",value:function(t,e){return new f(this,t,e)}},{key:"findOne",value:function(t,e){return a("findOne",this,s(this,{query:t,project:e}))}},{key:"aggregate",value:function(t){return u(this,t)}},{key:"count",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=void 0;return e.limit&&(r={limit:e.limit}),a("count",this,s(this,{count:!0,query:t},r))}}]),t}();f.prototype.limit=function(t){return this.limit=t,this},f.prototype.sort=function(t){return this.sort=t,this},f.prototype.execute=function(t){return o(this)},e.default=l,t.exports=e.default},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:{};return new u.default(this,t,e)}}]),t}();e.default=s,t.exports=e.default},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]&&arguments[1];return new u.default(this.stitchClient,this.serviceName,t)}}]),t}();e.default=s,t.exports=e.default},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var r=0;r=y&&r<=d,u=r>=v&&r<=g;if(o)return n.strict?new h.Int32(r):r;if(u)return n.strict?new h.Long.fromNumber(r):r}return new h.Double(r)}if(null==r||"object"!==(void 0===r?"undefined":f(r)))return r;if(r.$undefined)return null;for(var s=Object.keys(r).filter(function(t){return t.startsWith("$")&&null!=r[t]}),a=0;a-1&&r<2534023188e5;return e.relaxed&&n?{$date:u(t)}:{$date:{$numberLong:t.getTime().toString()}}}if("number"==typeof t&&!e.relaxed){if(Math.floor(t)===t){var i=t>=y&&t<=d,s=t>=v&&t<=g;if(i)return{$numberInt:t.toString()};if(s)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}return null!=t&&"object"===(void 0===t?"undefined":f(t))?a(t,e):t}function a(t,e){if(null==t||"object"!==(void 0===t?"undefined":f(t)))throw new Error("not an object instance");if(t._bsontype&&-1!==l.indexOf(t._bsontype)){if("Code"===t._bsontype&&t.scope){var r=a(t.scope,e),n=Object.assign({},t,{scope:r});return c.Code.toExtendedJSON(n,e)}if("DBRef"===t._bsontype&&t.oid){var i=a(t.oid,e),u=Object.assign({},t,{oid:i});return c.DBRef.toExtendedJSON(u,e)}return c[t._bsontype].toExtendedJSON(t,e)}var h={};for(var p in t){var _=t[p];if(Array.isArray(_))h[p]=o(_,e);else if(null!=_&&_._bsontype&&-1!==l.indexOf(_._bsontype))if("Code"===_._bsontype&&_.scope){var d=a(_.scope,e),y=Object.assign({},_,{scope:d});h[p]=c.Code.toExtendedJSON(y,e)}else if("DBRef"===_._bsontype&&_.oid){var g=a(_.oid,e),v=Object.assign({},_,{oid:g});h[p]=c.DBRef.toExtendedJSON(v,e)}else h[p]=c[_._bsontype].toExtendedJSON(_,e);else _ instanceof Date?h[p]=s(_,e):null!=_&&"object"===(void 0===_?"undefined":f(_))&&(h[p]=a(_,e));h[p]=s(_,e)}return h}var f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c=r(48),h=r(28),l=["Binary","Code","DBRef","Decimal128","Double","Int32","Long","MaxKey","MinKey","ObjectID","BSONRegExp","Symbol","Timestamp"];n(h);var p={$oid:c.ObjectID,$binary:c.Binary,$symbol:c.Symbol,$numberDecimal:c.Decimal128,$numberLong:c.Long,$minKey:c.MinKey,$maxKey:c.MaxKey,$regularExpression:c.BSONRegExp,$timestamp:c.Timestamp},_=function(t,e){var r=this;return e=e||{strict:!0},JSON.parse(t,function(t,n){return i(r,t,n,e)})},d=2147483647,y=-2147483648,g=0x8000000000000000,v=-0x8000000000000000,b=function(t,e,r,n){var i={};null!=n&&"object"===(void 0===n?"undefined":f(n))?i=n:null!=r&&"object"===(void 0===r?"undefined":f(r))?(i=r,r=0):null!=e&&"object"===(void 0===e?"undefined":f(e))&&(i=e,e=null);var u=Array.isArray(t)?o(t,i):a(t,i);return JSON.stringify(u,e,r)};t.exports={parse:_,stringify:b,setBSONModule:n,BSON:h}},function(t,e,r){"use strict";function n(t){var e=t.length;if(e%4>0)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 o(t){var e,r,i,o,u,s=t.length;o=n(t),u=new h(3*s/4-o),r=o>0?s-4:s;var a=0;for(e=0;e>16&255,u[a++]=i>>8&255,u[a++]=255&i;return 2===o?(i=c[t.charCodeAt(e)]<<2|c[t.charCodeAt(e+1)]>>4,u[a++]=255&i):1===o&&(i=c[t.charCodeAt(e)]<<10|c[t.charCodeAt(e+1)]<<4|c[t.charCodeAt(e+2)]>>2,u[a++]=i>>8&255,u[a++]=255&i),u}function u(t){return f[t>>18&63]+f[t>>12&63]+f[t>>6&63]+f[63&t]}function s(t,e,r){for(var n,i=[],o=e;oa?a:u+16383));return 1===n?(e=t[r-1],i+=f[e>>2],i+=f[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=f[e>>10],i+=f[e>>4&63],i+=f[e<<2&63],i+="="),o.push(i),o.join("")}e.byteLength=i,e.toByteArray=o,e.fromByteArray=a;for(var f=[],c=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,_=l.length;p<_;++p)f[p]=l[p],c[l.charCodeAt(p)]=p;c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63},function(t,e,r){var n,i=r(60);"undefined"!=typeof navigator&&navigator&&(n=navigator.userAgent),t.exports=i(n)},function(t,e,r){var n=r(61);t.exports=function(t){return t?[["edge",/Edge\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["vivaldi",/Vivaldi\/([0-9\.]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)$/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/]].map(function(e){if(e[1].test(t)){var r=e[1].exec(t),i=r&&r[1].split(/[._]/).slice(0,3);return i&&i.length<3&&Array.prototype.push.apply(i,1==i.length?[0,0]:[0]),{name:e[0],version:i.join("."),os:n(t)}}}).filter(Boolean).shift():null}},function(t,e){t.exports=function(t){var e=[{name:"iOS",rule:/iP(hone|od|ad)/},{name:"Android OS",rule:/Android/},{name:"BlackBerry OS",rule:/BlackBerry|BB10/},{name:"Windows Mobile",rule:/IEMobile/},{name:"Amazon OS",rule:/Kindle/},{name:"Windows 3.11",rule:/Win16/},{name:"Windows 95",rule:/(Windows 95)|(Win95)|(Windows_95)/},{name:"Windows 98",rule:/(Windows 98)|(Win98)/},{name:"Windows 2000",rule:/(Windows NT 5.0)|(Windows 2000)/},{name:"Windows XP",rule:/(Windows NT 5.1)|(Windows XP)/},{name:"Windows Server 2003",rule:/(Windows NT 5.2)/},{name:"Windows Vista",rule:/(Windows NT 6.0)/},{name:"Windows 7",rule:/(Windows NT 6.1)/},{name:"Windows 8",rule:/(Windows NT 6.2)/},{name:"Windows 8.1",rule:/(Windows NT 6.3)/},{name:"Windows 10",rule:/(Windows NT 10.0)/},{name:"Windows ME",rule:/Windows ME/},{name:"Open BSD",rule:/OpenBSD/},{name:"Sun OS",rule:/SunOS/},{name:"Linux",rule:/(Linux)|(X11)/},{name:"Mac OS",rule:/(Mac_PowerPC)|(Macintosh)/},{name:"QNX",rule:/QNX/},{name:"BeOS",rule:/BeOS/},{name:"OS/2",rule:/OS\/2/},{name:"Search Bot",rule:/(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves\/Teoma)|(ia_archiver)/}],r=e.filter(function(e){if(t.match(e.rule))return!0});return r&&r[0]?r[0].name:null}},function(t,e){e.read=function(t,e,r,n,i){var o,u,s=8*i-n-1,a=(1<>1,c=-7,h=r?i-1:0,l=r?-1:1,p=t[e+h];for(h+=l,o=p&(1<<-c)-1,p>>=-c,c+=s;c>0;o=256*o+t[e+h],h+=l,c-=8);for(u=o&(1<<-c)-1,o>>=-c,c+=n;c>0;u=256*u+t[e+h],h+=l,c-=8);if(0===o)o=1-f;else{if(o===a)return u?NaN:1/0*(p?-1:1);u+=Math.pow(2,n),o-=f}return(p?-1:1)*u*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var u,s,a,f=8*o-i-1,c=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,_=n?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,u=c):(u=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-u))<1&&(u--,a*=2),e+=u+h>=1?l/a:l*Math.pow(2,1-h),e*a>=2&&(u++,a/=2),u+h>=c?(s=0,u=c):u+h>=1?(s=(e*a-1)*Math.pow(2,i),u+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),u=0));i>=8;t[r+p]=255&s,p+=_,s/=256,i-=8);for(u=u<0;t[r+p]=255&u,p+=_,u/=256,f-=8);t[r+p-_]|=128*d}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){function r(t){this.message=t}function n(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new r("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,u=0,s=0,a="";o=e.charAt(s++);~o&&(n=u%4?64*n+o:o,u++%4)?a+=String.fromCharCode(255&n>>(-2*u&6)):0)o=i.indexOf(o);return a}var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.prototype=new Error,r.prototype.name="InvalidCharacterError",t.exports="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||n},function(t,e,r){function n(t){return decodeURIComponent(i(t).replace(/(.)/g,function(t,e){var r=e.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}var i=r(65);t.exports=function(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return n(e)}catch(t){return i(e)}}},function(t,e,r){"use strict";function n(t){this.message=t}var i=r(66);n.prototype=new Error,n.prototype.name="InvalidTokenError",t.exports=function(t,e){if("string"!=typeof t)throw new n("Invalid token specified");e=e||{};var r=!0===e.header?0:1;try{return JSON.parse(i(t.split(".")[r]))}catch(t){throw new n("Invalid token specified: "+t.message)}},t.exports.InvalidTokenError=n},function(t,e,r){"use strict";function n(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}/* object-assign (c) Sindre Sorhus @license MIT */ -var i=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(t){n[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,s,a=n(t),f=1;f=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),d(r)?n.showHidden=r:r&&e._extend(n,r),w(n.showHidden)&&(n.showHidden=!1),w(n.depth)&&(n.depth=2),w(n.colors)&&(n.colors=!1),w(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=o),a(n,t,n.depth)}function o(t,e){var r=i.styles[e];return r?"["+i.colors[r][0]+"m"+t+"["+i.colors[r][1]+"m":t}function u(t,e){return t}function s(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}function a(t,r,n){if(t.customInspect&&r&&A(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,t);return b(i)||(i=a(t,i,n)),i}var o=f(t,r);if(o)return o;var u=Object.keys(r),d=s(u);if(t.showHidden&&(u=Object.getOwnPropertyNames(r)),N(r)&&(u.indexOf("message")>=0||u.indexOf("description")>=0))return c(r);if(0===u.length){if(A(r)){var y=r.name?": "+r.name:"";return t.stylize("[Function"+y+"]","special")}if(O(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(S(r))return t.stylize(Date.prototype.toString.call(r),"date");if(N(r))return c(r)}var g="",v=!1,m=["{","}"];if(_(r)&&(v=!0,m=["[","]"]),A(r)){g=" [Function"+(r.name?": "+r.name:"")+"]"}if(O(r)&&(g=" "+RegExp.prototype.toString.call(r)),S(r)&&(g=" "+Date.prototype.toUTCString.call(r)),N(r)&&(g=" "+c(r)),0===u.length&&(!v||0==r.length))return m[0]+g+m[1];if(n<0)return O(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special");t.seen.push(r);var w;return w=v?h(t,r,n,d,u):u.map(function(e){return l(t,r,n,d,e,v)}),t.seen.pop(),p(w,g,m)}function f(t,e){if(w(e))return t.stylize("undefined","undefined");if(b(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return v(e)?t.stylize(""+e,"number"):d(e)?t.stylize(""+e,"boolean"):y(e)?t.stylize("null","null"):void 0}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,i){for(var o=[],u=0,s=e.length;u-1&&(s=o?s.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+s.split("\n").map(function(t){return" "+t}).join("\n"))):s=t.stylize("[Circular]","special")),w(u)){if(o&&i.match(/^\d+$/))return s;u=JSON.stringify(""+i),u.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(u=u.substr(1,u.length-2),u=t.stylize(u,"name")):(u=u.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),u=t.stylize(u,"string"))}return u+": "+s}function p(t,e,r){var n=0;return t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function _(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function y(t){return null===t}function g(t){return null==t}function v(t){return"number"==typeof t}function b(t){return"string"==typeof t}function m(t){return"symbol"==typeof t}function w(t){return void 0===t}function O(t){return E(t)&&"[object RegExp]"===T(t)}function E(t){return"object"==typeof t&&null!==t}function S(t){return E(t)&&"[object Date]"===T(t)}function N(t){return E(t)&&("[object Error]"===T(t)||t instanceof Error)}function A(t){return"function"==typeof t}function B(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function T(t){return Object.prototype.toString.call(t)}function I(t){return t<10?"0"+t.toString(10):t.toString(10)}function R(){var t=new Date,e=[I(t.getHours()),I(t.getMinutes()),I(t.getSeconds())].join(":");return[t.getDate(),M[t.getMonth()],e].join(" ")}function D(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var P=/%[sdj%]/g;e.format=function(t){if(!b(t)){for(var e=[],r=0;r=o)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}}),s=n[r];r-1?e:t}function p(t,e){e=e||{};var r=e.body;if(t instanceof p){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new i(t.headers)),this.method=t.method,this.mode=t.mode,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new i(e.headers)),this.method=l(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function _(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}}),e}function d(t){var e=new i;return t.split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}}),e}function y(t,e){e||(e={}),this.type="default",this.status="status"in e?e.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new i(e.headers),this.url=e.url||"",this._initBody(t)}if(!t.fetch){var g={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(g.arrayBuffer)var v=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],b=function(t){return t&&DataView.prototype.isPrototypeOf(t)},m=ArrayBuffer.isView||function(t){return t&&v.indexOf(Object.prototype.toString.call(t))>-1};i.prototype.append=function(t,n){t=e(t),n=r(n);var i=this.map[t];this.map[t]=i?i+","+n:n},i.prototype.delete=function(t){delete this.map[e(t)]},i.prototype.get=function(t){return t=e(t),this.has(t)?this.map[t]:null},i.prototype.has=function(t){return this.map.hasOwnProperty(e(t))},i.prototype.set=function(t,n){this.map[e(t)]=r(n)},i.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},i.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),n(t)},i.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),n(t)},i.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),n(t)},g.iterable&&(i.prototype[Symbol.iterator]=i.prototype.entries);var w=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];p.prototype.clone=function(){return new p(this,{body:this._bodyInit})},h.call(p.prototype),h.call(y.prototype),y.prototype.clone=function(){return new y(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new i(this.headers),url:this.url})},y.error=function(){var t=new y(null,{status:0,statusText:""});return t.type="error",t};var O=[301,302,303,307,308];y.redirect=function(t,e){if(-1===O.indexOf(e))throw new RangeError("Invalid status code");return new y(null,{status:e,headers:{location:t}})},t.Headers=i,t.Request=p,t.Response=y,t.fetch=function(t,e){return new Promise(function(r,n){var i=new p(t,e),o=new XMLHttpRequest;o.onload=function(){var t={status:o.status,statusText:o.statusText,headers:d(o.getAllResponseHeaders()||"")};t.url="responseURL"in o?o.responseURL:t.headers.get("X-Request-URL");var e="response"in o?o.response:o.responseText;r(new y(e,t))},o.onerror=function(){n(new TypeError("Network request failed"))},o.ontimeout=function(){n(new TypeError("Network request failed"))},o.open(i.method,i.url,!0),"include"===i.credentials&&(o.withCredentials=!0),"responseType"in o&&g.blob&&(o.responseType="blob"),i.headers.forEach(function(t,e){o.setRequestHeader(e,t)}),o.send(void 0===i._bodyInit?null:i._bodyInit)})},t.fetch.polyfill=!0}}("undefined"!=typeof self?self:this)}])}); +var i=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(t){n[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,s,a=n(t),f=1;f=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),d(r)?n.showHidden=r:r&&e._extend(n,r),w(n.showHidden)&&(n.showHidden=!1),w(n.depth)&&(n.depth=2),w(n.colors)&&(n.colors=!1),w(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=o),a(n,t,n.depth)}function o(t,e){var r=i.styles[e];return r?"["+i.colors[r][0]+"m"+t+"["+i.colors[r][1]+"m":t}function u(t,e){return t}function s(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}function a(t,r,n){if(t.customInspect&&r&&A(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,t);return b(i)||(i=a(t,i,n)),i}var o=f(t,r);if(o)return o;var u=Object.keys(r),d=s(u);if(t.showHidden&&(u=Object.getOwnPropertyNames(r)),N(r)&&(u.indexOf("message")>=0||u.indexOf("description")>=0))return c(r);if(0===u.length){if(A(r)){var y=r.name?": "+r.name:"";return t.stylize("[Function"+y+"]","special")}if(O(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(S(r))return t.stylize(Date.prototype.toString.call(r),"date");if(N(r))return c(r)}var g="",v=!1,m=["{","}"];if(_(r)&&(v=!0,m=["[","]"]),A(r)){g=" [Function"+(r.name?": "+r.name:"")+"]"}if(O(r)&&(g=" "+RegExp.prototype.toString.call(r)),S(r)&&(g=" "+Date.prototype.toUTCString.call(r)),N(r)&&(g=" "+c(r)),0===u.length&&(!v||0==r.length))return m[0]+g+m[1];if(n<0)return O(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special");t.seen.push(r);var w;return w=v?h(t,r,n,d,u):u.map(function(e){return l(t,r,n,d,e,v)}),t.seen.pop(),p(w,g,m)}function f(t,e){if(w(e))return t.stylize("undefined","undefined");if(b(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return v(e)?t.stylize(""+e,"number"):d(e)?t.stylize(""+e,"boolean"):y(e)?t.stylize("null","null"):void 0}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,i){for(var o=[],u=0,s=e.length;u-1&&(s=o?s.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+s.split("\n").map(function(t){return" "+t}).join("\n"))):s=t.stylize("[Circular]","special")),w(u)){if(o&&i.match(/^\d+$/))return s;u=JSON.stringify(""+i),u.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(u=u.substr(1,u.length-2),u=t.stylize(u,"name")):(u=u.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),u=t.stylize(u,"string"))}return u+": "+s}function p(t,e,r){var n=0;return t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function _(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function y(t){return null===t}function g(t){return null==t}function v(t){return"number"==typeof t}function b(t){return"string"==typeof t}function m(t){return"symbol"==typeof t}function w(t){return void 0===t}function O(t){return E(t)&&"[object RegExp]"===B(t)}function E(t){return"object"==typeof t&&null!==t}function S(t){return E(t)&&"[object Date]"===B(t)}function N(t){return E(t)&&("[object Error]"===B(t)||t instanceof Error)}function A(t){return"function"==typeof t}function T(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function B(t){return Object.prototype.toString.call(t)}function I(t){return t<10?"0"+t.toString(10):t.toString(10)}function R(){var t=new Date,e=[I(t.getHours()),I(t.getMinutes()),I(t.getSeconds())].join(":");return[t.getDate(),k[t.getMonth()],e].join(" ")}function D(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var P=/%[sdj%]/g;e.format=function(t){if(!b(t)){for(var e=[],r=0;r=o)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}}),s=n[r];r-1?e:t}function p(t,e){e=e||{};var r=e.body;if(t instanceof p){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new i(t.headers)),this.method=t.method,this.mode=t.mode,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new i(e.headers)),this.method=l(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function _(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}}),e}function d(t){var e=new i;return t.split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}}),e}function y(t,e){e||(e={}),this.type="default",this.status="status"in e?e.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new i(e.headers),this.url=e.url||"",this._initBody(t)}if(!t.fetch){var g={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(g.arrayBuffer)var v=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],b=function(t){return t&&DataView.prototype.isPrototypeOf(t)},m=ArrayBuffer.isView||function(t){return t&&v.indexOf(Object.prototype.toString.call(t))>-1};i.prototype.append=function(t,n){t=e(t),n=r(n);var i=this.map[t];this.map[t]=i?i+","+n:n},i.prototype.delete=function(t){delete this.map[e(t)]},i.prototype.get=function(t){return t=e(t),this.has(t)?this.map[t]:null},i.prototype.has=function(t){return this.map.hasOwnProperty(e(t))},i.prototype.set=function(t,n){this.map[e(t)]=r(n)},i.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},i.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),n(t)},i.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),n(t)},i.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),n(t)},g.iterable&&(i.prototype[Symbol.iterator]=i.prototype.entries);var w=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];p.prototype.clone=function(){return new p(this,{body:this._bodyInit})},h.call(p.prototype),h.call(y.prototype),y.prototype.clone=function(){return new y(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new i(this.headers),url:this.url})},y.error=function(){var t=new y(null,{status:0,statusText:""});return t.type="error",t};var O=[301,302,303,307,308];y.redirect=function(t,e){if(-1===O.indexOf(e))throw new RangeError("Invalid status code");return new y(null,{status:e,headers:{location:t}})},t.Headers=i,t.Request=p,t.Response=y,t.fetch=function(t,e){return new Promise(function(r,n){var i=new p(t,e),o=new XMLHttpRequest;o.onload=function(){var t={status:o.status,statusText:o.statusText,headers:d(o.getAllResponseHeaders()||"")};t.url="responseURL"in o?o.responseURL:t.headers.get("X-Request-URL");var e="response"in o?o.response:o.responseText;r(new y(e,t))},o.onerror=function(){n(new TypeError("Network request failed"))},o.ontimeout=function(){n(new TypeError("Network request failed"))},o.open(i.method,i.url,!0),"include"===i.credentials&&(o.withCredentials=!0),"responseType"in o&&g.blob&&(o.responseType="blob"),i.headers.forEach(function(t,e){o.setRequestHeader(e,t)}),o.send(void 0===i._bodyInit?null:i._bodyInit)})},t.fetch.polyfill=!0}}("undefined"!=typeof self?self:this)}])}); //# sourceMappingURL=stitch.min.js.map \ No newline at end of file diff --git a/dist/web/stitch.min.js.map b/dist/web/stitch.min.js.map index 9945d370e..6054e3ad8 100644 --- a/dist/web/stitch.min.js.map +++ b/dist/web/stitch.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///stitch.min.js","webpack:///webpack/bootstrap 5f2c9227c84dbba4c004","webpack:///./~/buffer/index.js","webpack:///./~/bson/lib/bson/float_parser.js","webpack:///./src/util.js","webpack:///./~/bson/lib/bson/long.js","webpack:///./~/bson/lib/bson/binary.js","webpack:///./~/bson/lib/bson/code.js","webpack:///./~/bson/lib/bson/db_ref.js","webpack:///./~/bson/lib/bson/decimal128.js","webpack:///./~/bson/lib/bson/double.js","webpack:///./~/bson/lib/bson/max_key.js","webpack:///./~/bson/lib/bson/min_key.js","webpack:///./~/bson/lib/bson/objectid.js","webpack:///./~/bson/lib/bson/regexp.js","webpack:///./~/bson/lib/bson/symbol.js","webpack:///./~/bson/lib/bson/timestamp.js","webpack:///./src/auth/common.js","webpack:///./src/common.js","webpack:///(webpack)/buildin/global.js","webpack:///./~/bson/lib/bson/int_32.js","webpack:///./src/client.js","webpack:///./~/bson/lib/bson/map.js","webpack:///./src/errors.js","webpack:///./~/fetch-everywhere/fetch-npm-browserify.js","webpack:///./~/process/browser.js","webpack:///./src/admin.js","webpack:///./~/Base64/base64.js","webpack:///./~/bson/lib/bson/bson.js","webpack:///./~/bson/lib/bson/parser/calculate_size.js","webpack:///./~/bson/lib/bson/parser/deserializer.js","webpack:///./~/bson/lib/bson/parser/serializer.js","webpack:///./src/auth/index.js","webpack:///./src/auth/providers.js","webpack:///./src/auth/storage.js","webpack:///./src/index.js","webpack:///./src/services/aws/s3_service.js","webpack:///./src/services/aws/ses_service.js","webpack:///./src/services/http/http_service.js","webpack:///./src/services/index.js","webpack:///./src/services/mongodb/collection.js","webpack:///./src/services/mongodb/db.js","webpack:///./src/services/mongodb/mongodb_service.js","webpack:///./src/services/twilio/twilio_service.js","webpack:///./~/mongodb-extjson/index.js","webpack:///./~/mongodb-extjson/lib/bson/binary.js","webpack:///./~/mongodb-extjson/lib/bson/code.js","webpack:///./~/mongodb-extjson/lib/bson/db_ref.js","webpack:///./~/mongodb-extjson/lib/bson/decimal128.js","webpack:///./~/mongodb-extjson/lib/bson/double.js","webpack:///./~/mongodb-extjson/lib/bson/index.js","webpack:///./~/mongodb-extjson/lib/bson/int_32.js","webpack:///./~/mongodb-extjson/lib/bson/long.js","webpack:///./~/mongodb-extjson/lib/bson/max_key.js","webpack:///./~/mongodb-extjson/lib/bson/min_key.js","webpack:///./~/mongodb-extjson/lib/bson/objectid.js","webpack:///./~/mongodb-extjson/lib/bson/regexp.js","webpack:///./~/mongodb-extjson/lib/bson/symbol.js","webpack:///./~/mongodb-extjson/lib/bson/timestamp.js","webpack:///./~/mongodb-extjson/lib/ext_json.js","webpack:///./~/base64-js/index.js","webpack:///./~/detect-browser/browser.js","webpack:///./~/detect-browser/lib/detectBrowser.js","webpack:///./~/detect-browser/lib/detectOS.js","webpack:///./~/ieee754/index.js","webpack:///./~/inherits/inherits_browser.js","webpack:///./~/isarray/index.js","webpack:///./~/jwt-decode/lib/atob.js","webpack:///./~/jwt-decode/lib/base64_url_decode.js","webpack:///./~/jwt-decode/lib/index.js","webpack:///./~/object-assign/index.js","webpack:///./~/query-string/index.js","webpack:///./~/strict-uri-encode/index.js","webpack:///./~/util/support/isBufferBrowser.js","webpack:///./~/util/util.js","webpack:///./~/whatwg-fetch/fetch.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","value","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","global","kMaxLength","Buffer","TYPED_ARRAY_SUPPORT","createBuffer","that","length","RangeError","Uint8Array","__proto__","arg","encodingOrOffset","Error","allocUnsafe","from","TypeError","ArrayBuffer","fromArrayBuffer","fromString","fromObject","assertSize","size","alloc","fill","encoding","undefined","checked","string","isEncoding","byteLength","actual","write","slice","fromArrayLike","array","byteOffset","obj","isBuffer","len","copy","buffer","isnan","type","isArray","data","toString","SlowBuffer","isView","loweredCase","utf8ToBytes","base64ToBytes","toLowerCase","slowToString","start","end","hexSlice","utf8Slice","asciiSlice","latin1Slice","base64Slice","utf16leSlice","swap","b","bidirectionalIndexOf","val","dir","isNaN","arrayIndexOf","indexOf","lastIndexOf","arr","read","buf","indexSize","readUInt16BE","arrLength","valLength","String","foundIndex","found","j","hexWrite","offset","Number","remaining","strLen","parsed","parseInt","substr","utf8Write","blitBuffer","asciiWrite","asciiToBytes","latin1Write","base64Write","ucs2Write","utf16leToBytes","base64","fromByteArray","Math","min","res","firstByte","codePoint","bytesPerSequence","secondByte","thirdByte","fourthByte","tempCodePoint","push","decodeCodePointsArray","codePoints","MAX_ARGUMENTS_LENGTH","fromCharCode","apply","ret","out","toHex","bytes","checkOffset","ext","checkInt","max","objectWriteUInt16","littleEndian","objectWriteUInt32","checkIEEE754","writeFloat","noAssert","ieee754","writeDouble","base64clean","str","stringtrim","replace","INVALID_BASE64_RE","trim","units","Infinity","leadSurrogate","charCodeAt","byteArray","hi","lo","toByteArray","src","dst","INSPECT_MAX_BYTES","foo","subarray","e","poolSize","_augment","Symbol","species","allocUnsafeSlow","_isBuffer","compare","a","x","y","concat","list","pos","swap16","swap32","swap64","arguments","equals","inspect","match","join","target","thisStart","thisEnd","thisCopy","targetCopy","includes","isFinite","toJSON","Array","_arr","newBuf","sliceLen","readUIntLE","mul","readUIntBE","readUInt8","readUInt16LE","readUInt32LE","readUInt32BE","readIntLE","pow","readIntBE","readInt8","readInt16LE","readInt16BE","readInt32LE","readInt32BE","readFloatLE","readFloatBE","readDoubleLE","readDoubleBE","writeUIntLE","writeUIntBE","writeUInt8","floor","writeUInt16LE","writeUInt16BE","writeUInt32LE","writeUInt32BE","writeIntLE","limit","sub","writeIntBE","writeInt8","writeInt16LE","writeInt16BE","writeInt32LE","writeInt32BE","writeFloatLE","writeFloatBE","writeDoubleLE","writeDoubleBE","targetStart","set","code","readIEEE754","endian","mLen","nBytes","bBE","eLen","eMax","eBias","nBits","NaN","writeIEEE754","rt","abs","log","LN2","_interopRequireWildcard","newObj","key","default","deprecate","fn","msg","deprecated","alreadyWarned","console","warn","serviceResponse","service","_ref","_ref$serviceName","serviceName","action","args","client","executeServiceFunction","getPlatform","platform","uriEncodeObject","encodeURIComponent","btoa","JSON","stringify","collectMetadata","_typeof","iterator","constructor","_detectBrowser","_Base","func","attachMetadata","metadata","writable","Promise","resolve","warnings","then","Long","low","high","_bsontype","low_","high_","toInt","toNumber","TWO_PWR_32_DBL_","getLowBitsUnsigned","opt_radix","radix","isZero","isNegative","MIN_VALUE","radixLong","fromNumber","div","rem","multiply","subtract","negate","radixToPower","result","remDiv","intval","digits","getHighBits","getLowBits","getNumBitsAbs","bit","isOdd","other","notEquals","lessThan","lessThanOrEqual","greaterThan","greaterThanOrEqual","thisNeg","otherNeg","not","add","ONE","a48","a32","a16","a00","b48","b32","b16","b00","c48","c32","c16","c00","fromBits","ZERO","TWO_PWR_24_","NEG_ONE","halfThis","shiftRight","approx","shiftLeft","log2","ceil","delta","approxRes","approxRem","modulo","and","or","xor","numBits","shiftRightUnsigned","fromInt","cachedObj","INT_CACHE_","TWO_PWR_63_DBL_","MAX_VALUE","lowBits","highBits","charAt","substring","power","TWO_PWR_16_DBL_","TWO_PWR_24_DBL_","TWO_PWR_31_DBL_","TWO_PWR_48_DBL_","TWO_PWR_64_DBL_","Binary","subType","sub_type","position","BSON_BINARY_SUBTYPE_DEFAULT","BUFFER_SIZE","writeStringToArray","put","byte_value","decoded_byte","asRaw","newBuffer","convertArraytoUtf8BinaryString","format","startIndex","endIndex","SUBTYPE_DEFAULT","SUBTYPE_FUNCTION","SUBTYPE_BYTE_ARRAY","SUBTYPE_UUID_OLD","SUBTYPE_UUID","SUBTYPE_MD5","SUBTYPE_USER_DEFINED","Code","scope","DBRef","namespace","oid","db","$ref","$id","$db","PARSE_STRING_REGEXP","PARSE_INF_REGEXP","PARSE_NAN_REGEXP","EXPONENT_BIAS","NAN_BUFFER","reverse","INF_NEGATIVE_BUFFER","INF_POSITIVE_BUFFER","EXPONENT_REGEX","isDigit","divideu128","DIVISOR","_rem","parts","quotient","multiply64x2","left","right","leftHigh","leftLow","rightHigh","rightLow","productHigh","productMid","productMid2","productLow","uhleft","uhright","Decimal128","sawRadix","foundNonZero","significantDigits","nDigitsRead","nDigits","radixPosition","firstNonZero","nDigitsStored","digitsInsert","firstDigit","lastDigit","exponent","significandHigh","significandLow","biasedExponent","index","stringMatch","infMatch","nanMatch","digitsString","endOfString","roundDigit","roundBit","dIdx","significand","dec","midh","midl","combination","biased_exponent","significand_digits","scientific_exponent","significand_msb","k","is_zero","significand128","least_digits","radix_position","$numberDecimal","Double","valueOf","MaxKey","MinKey","process","MACHINE_ID","random","checkForHexRegExp","RegExp","hasBufferType","err","ObjectID","id","generate","cacheHexString","__id","valid","isValid","createFromHexString","toHexString","hexTable","hexString","_Buffer","convertToHex","get_inc","getInc","time","Date","now","pid","inc","otherId","getTimestamp","timestamp","setTime","createPk","createFromTime","decodeLookup","split","test","ObjectId","BSONRegExp","pattern","options","Timestamp","radixTimestamp","USER_AUTH_KEY","REFRESH_TOKEN_KEY","DEVICE_ID_KEY","STATE_KEY","IMPERSONATION_ACTIVE_KEY","IMPERSONATION_USER_KEY","IMPERSONATION_REAL_USER_AUTH_KEY","USER_AUTH_COOKIE_NAME","STITCH_ERROR_KEY","STITCH_LINK_KEY","DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS","APP_CLIENT_CODEC","accessToken","refreshToken","deviceId","userId","ADMIN_CLIENT_CODEC","JSONTYPE","version","APP_CLIENT_TYPE","ADMIN_CLIENT_TYPE","DEFAULT_STITCH_SERVER_URL","SDK_VERSION","checkStatus","response","status","error","statusText","json","catch","reject","assign","makeFetchArgs","method","body","init","headers","Accept","Content-Type","cors","g","Function","eval","window","Int32","_interopRequireDefault","_defineProperty","_classCallCheck","instance","Constructor","_createClass","defineProperties","props","descriptor","protoProps","staticProps","_auth","_auth2","_common","_services","_services2","_common2","common","_mongodbExtjson","_mongodbExtjson2","_queryString","_queryString2","_util","_errors","v1","v2","v3","API_TYPE_PUBLIC","API_TYPE_PRIVATE","API_TYPE_CLIENT","API_TYPE_APP","StitchClient","clientAppID","_v","_v2","_v3","_rootURLsByAPIVersion","_this","baseUrl","authUrl","rootURLsByAPIVersion","authOptions","codec","authCodec","auth","handleRedirect","handleCookie","authManager","apiKeyAuth","authenticate","localAuth","email","password","login","mongodbCloudAuth","username","apiKey","opts","provider","register","providerType","_this2","getAccessToken","authedId","_this3","_do","refreshOnFailure","useRefreshToken","rootURL","clear","StitchError","ServiceType","_len","_key","_doFunctionCall","_len2","_key2","request","responseDecoder","parse","strict","text","resource","_this4","apiVersion","apiType","noAuth","ErrUnauthorized","isAccessTokenExpired","appURL","url","fetchArgs","token","getRefreshToken","Authorization","queryParams","fetch","error_code","ErrInvalidSession","redirectUrl","authWithOAuth","anonymousAuth","Map","_keys","_values","entry","v","delete","splice","entries","self","next","done","forEach","callback","has","keys","values","_possibleConstructorReturn","ReferenceError","_inherits","subClass","superClass","create","setPrototypeOf","_extendableBuiltin2","message","getPrototypeOf","captureStackTrace","stack","cls","ExtendableBuiltin","Reflect","construct","ErrAuthProviderNotFound","globalObj","bind","defaultSetTimout","defaultClearTimeout","runTimeout","fun","cachedSetTimeout","setTimeout","runClearTimeout","marker","cachedClearTimeout","clearTimeout","cleanUpNextTick","draining","currentQueue","queue","queueIndex","drainQueue","timeout","run","Item","noop","nextTick","title","browser","env","argv","versions","on","addListener","once","off","removeListener","removeAllListeners","emit","prependListener","prependOnceListener","listeners","binding","cwd","chdir","umask","_get","receiver","desc","getOwnPropertyDescriptor","parent","_client","_client2","_common3","Admin","_StitchClient","groupId","api","groupUrl","query","defaults","_post","app","appId","appUrl","remove","_delete","valueId","valueUrl","update","_put","services","serviceId","runCommand","commandName","config","_patch","rules","rule","ruleId","ruleUrl","incomingWebhooks","incomingWebhook","incomingWebhookId","webhookUrl","pushNotifications","filter","pushNotification","messageId","send","users","user","uid","logout","debug","executeFunction","user_id","executeFunctionSource","source","evalSource","eval_source","authProviders","authProvider","providerId","enable","disable","security","allowedRequestOrigins","logs","apiKeys","apiKeyId","functions","function","functionId","apps","pipelines","pipeline","pipelineId","pipelineUrl","setType","dev","executePipeline","isImpersonatingUser","startImpersonation","stopImpersonation","v3do","_this5","v2do","InvalidCharacterError","chars","input","block","charCode","idx","map","output","atob","bs","bc","deserialize","serializer","calculateObjectSize","BSON","serialize","checkKeys","serializeFunctions","ignoreUndefined","serializationIndex","finishedBuffer","serializeWithBufferAndIndex","finalBuffer","deserializeStream","numberOfDocuments","documents","docStartIndex","BSON_INT32_MAX","BSON_INT32_MIN","BSON_INT64_MAX","BSON_INT64_MIN","JS_INT_MAX","JS_INT_MIN","BSON_DATA_NUMBER","BSON_DATA_STRING","BSON_DATA_OBJECT","BSON_DATA_ARRAY","BSON_DATA_BINARY","BSON_DATA_OID","BSON_DATA_BOOLEAN","BSON_DATA_DATE","BSON_DATA_NULL","BSON_DATA_REGEXP","BSON_DATA_CODE","BSON_DATA_SYMBOL","BSON_DATA_CODE_W_SCOPE","BSON_DATA_INT","BSON_DATA_TIMESTAMP","BSON_DATA_LONG","BSON_DATA_MIN_KEY","BSON_DATA_MAX_KEY","BSON_BINARY_SUBTYPE_FUNCTION","BSON_BINARY_SUBTYPE_BYTE_ARRAY","BSON_BINARY_SUBTYPE_UUID","BSON_BINARY_SUBTYPE_MD5","BSON_BINARY_SUBTYPE_USER_DEFINED","calculateElement","toBSON","isDate","ordered_values","ignoreCase","multiline","totalLength","f","deserializeObject","evalFunctions","cacheFunctions","cacheFunctionsCrc32","fieldsAsRaw","raw","bsonRegExp","promoteBuffers","promoteLongs","promoteValues","arrayIndex","elementType","stringSize","_index","objectSize","arrayOptions","stopIndex","BSON_DATA_UNDEFINED","long","JS_INT_MAX_LONG","JS_INT_MIN_LONG","BSON_DATA_DECIMAL128","decimal128","toObject","binarySize","totalBinarySize","_buffer","regExpOptions","optionsArray","functionString","hash","crc32","isolateEvalWithHash","functionCache","isolateEval","totalSize","scopeObject","BSON_DATA_DBPOINTER","oidBuffer","shift","collection","regexp","isRegExp","serializeString","serializeNumber","numberOfWrittenBytes","longVal","serializeNull","serializeBoolean","serializeDate","dateInMilis","getTime","serializeRegExp","serializeBSONRegExp","sort","serializeMinMax","serializeObjectId","serializeBuffer","serializeObject","depth","path","serializeInto","pop","serializeDecimal128","serializeLong","serializeInt32","serializeDouble","serializeFunction","serializeCode","codeSize","serializeBinary","serializeSymbol","serializeDBRef","startingIndex","_storage","_providers","authCommon","jwtDecode","Auth","rootUrl","storageType","storage","createStorage","providers","createProviders","refreshImpersonation","doSessionPost","location","protocol","host","pathname","_error","ourState","redirectFragment","redirectState","parseRedirectFragment","lastError","history","replaceState","pageRootUrl","stateValid","ua","splitCookies","document","cookie","sepIdx","cookieVal","uaCookie","getCookie","userAuth","unmarshallUserAuth","clearImpersonation","withinSeconds","decodedToken","exp","newUserAuth","realUserAuth","fragment","vars","shouldBreak","pairParts","decodeURIComponent","theirState","getDeviceInfo","appVersion","deviceInfo","sdkVersion","platformVersion","anonProvider","device","getDeviceId","customProvider","userPassProvider","providerRoute","isAppClient","loginRoute","emailConfirm","tokenId","sendEmailConfirm","sendPasswordReset","passwordReset","apiKeyProvider","generateState","state","alpha","getOAuthLoginURL","providerName","encodeURI","googleProvider","facebookProvider","mongodbCloudProvider","credentials","anon","google","facebook","mongodbCloud","userpass","custom","localStorage","Storage","sessionStorage","MemoryStorage","_data","store","getItem","setItem","removeItem","_admin","_admin2","S3Service","stitchClient","bucket","acl","contentType","SESService","to","subject","buildArgs","urlOrOptions","buildResponse","HTTPService","_s3_service","_s3_service2","_ses_service","_ses_service2","_http_service","_http_service2","_mongodb_service","_mongodb_service2","_twilio_service","_twilio_service2","aws/s3","aws/ses","http","mongodb","twilio","updateOp","isMulti","outgoingOptions","upsert","findOp","project","aggregateOp","_ref2","database","MongoQuery","Collection","doc","docs","count","execute","_collection","_collection2","DB","_db","_db2","MongoDBService","databaseName","TwilioService","ExtJSON","convert","integer","toExtendedJSON","$binary","fromExtendedJSON","$code","$scope","fields","relaxed","$numberDouble","parseFloat","$numberInt","$numberLong","$maxKey","$minKey","$oid","$regularExpression","$symbol","$timestamp","t","setBSONModule","BSONTypes","deserializeValue","int32Range","int64Range","$undefined","startsWith","keysToCodecs","$date","date","codecs","$dbPointer","dollarKeys","serializeArray","serializeValue","getISOString","isoStr","toISOString","getUTCMilliseconds","dateNum","inRange","serializeDocument","tempScope","tempDoc","tempId","_doc","tempVal","reducer","indents","placeHoldersCount","b64","tmp","placeHolders","Arr","L","revLookup","tripletToBase64","num","lookup","encodeChunk","uint8","extraBytes","len2","agent","detectBrowser","navigator","userAgent","detectOS","userAgentString","exec","os","Boolean","operatingSystems","detected","isLE","ctor","superCtor","super_","TempCtor","polyfill","b64DecodeUnicode","toUpperCase","InvalidTokenError","base64_url_decode","header","getOwnPropertySymbols","propIsEnumerable","propertyIsEnumerable","test1","getOwnPropertyNames","test2","test3","letter","symbols","encoderForArrayFormat","arrayFormat","encode","parserForArrayFormat","accumulator","strictUriEncode","keysSorter","objectAssign","extract","formatter","param","reduce","val2","ctx","seen","stylize","stylizeNoColor","colors","isBoolean","showHidden","_extend","isUndefined","customInspect","stylizeWithColor","formatValue","styleType","style","styles","arrayToHash","recurseTimes","isFunction","isString","primitive","formatPrimitive","visibleKeys","isError","formatError","base","braces","toUTCString","formatArray","formatProperty","reduceToSingleString","simple","isNumber","isNull","line","numLinesEst","prev","cur","ar","isNullOrUndefined","isSymbol","re","isObject","objectToString","isPrimitive","pad","getHours","getMinutes","getSeconds","getDate","months","getMonth","prop","formatRegExp","objects","_","warned","throwDeprecation","traceDeprecation","trace","noDeprecation","debugEnviron","debugs","debuglog","NODE_DEBUG","bold","italic","underline","inverse","white","grey","black","blue","cyan","green","magenta","red","yellow","special","number","boolean","null","inherits","origin","normalizeName","normalizeValue","iteratorFor","items","support","iterable","Headers","append","consumed","bodyUsed","fileReaderReady","reader","onload","onerror","readBlobAsArrayBuffer","blob","FileReader","promise","readAsArrayBuffer","readBlobAsText","readAsText","readArrayBufferAsText","view","bufferClone","Body","_initBody","_bodyInit","_bodyText","Blob","isPrototypeOf","_bodyBlob","formData","FormData","_bodyFormData","searchParams","URLSearchParams","arrayBuffer","isDataView","_bodyArrayBuffer","isArrayBufferView","rejected","decode","normalizeMethod","upcased","methods","Request","mode","referrer","form","parseHeaders","rawHeaders","Response","bodyInit","ok","viewClasses","DataView","oldValue","thisArg","clone","redirectStatuses","redirect","xhr","XMLHttpRequest","getAllResponseHeaders","responseURL","responseText","ontimeout","open","withCredentials","responseType","setRequestHeader"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,OAAA,YAAAH,GACA,gBAAAC,SACAA,QAAA,OAAAD,IAEAD,EAAA,OAAAC,KACCK,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAP,OAGA,IAAAC,GAAAO,EAAAD,IACAE,EAAAF,EACAG,GAAA,EACAV,WAUA,OANAK,GAAAE,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAS,GAAA,EAGAT,EAAAD,QAvBA,GAAAQ,KA+DA,OAnCAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAG,EAAA,SAAAK,GAA2C,MAAAA,IAG3CR,EAAAS,EAAA,SAAAf,EAAAgB,EAAAC,GACAX,EAAAY,EAAAlB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AAA,SAAAC,EAAA4Q,GACA,GAAA4F,GAAA,GAAA6rB,GAAArgB,EAAA/Q,GACAoyB,EAAA,GAAAC,eAEAD,GAAAjD,OAAA,WACA,GAAAzxB,IACA4B,OAAA8yB,EAAA9yB,OACAE,WAAA4yB,EAAA5yB,WACAS,QAAAuxB,EAAAY,EAAAE,yBAAA,IAEA50B,GAAA0I,IAAA,eAAAgsB,KAAAG,YAAA70B,EAAAuC,QAAAnjB,IAAA,gBACA,IAAAijB,GAAA,YAAAqyB,KAAA/yB,SAAA+yB,EAAAI,YACAzjC,GAAA,GAAA2iC,GAAA3xB,EAAArC,KAGA00B,EAAAhD,QAAA,WACAzvB,EAAA,GAAArhB,WAAA,4BAGA8zC,EAAAK,UAAA,WACA9yB,EAAA,GAAArhB,WAAA,4BAGA8zC,EAAAM,KAAAntB,EAAAzF,OAAAyF,EAAAa,KAAA,GAEA,YAAAb,EAAA6Y,cACAgU,EAAAO,iBAAA,GAGA,gBAAAP,IAAAzD,EAAAW,OACA8C,EAAAQ,aAAA,QAGArtB,EAAAtF,QAAA0H,QAAA,SAAAtrB,EAAAE,GACA61C,EAAAS,iBAAAt2C,EAAAF,KAGA+1C,EAAA9jB,SAAA,KAAA/I,EAAA0qB,UAAA,KAAA1qB,EAAA0qB,cAGAzoB,EAAAd,MAAA8gB,UAAA,IACC,mBAAAhgB,WAAA7rB","file":"stitch.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"stitch\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"stitch\"] = factory();\n\telse\n\t\troot[\"stitch\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"stitch\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"stitch\"] = factory();\n\telse\n\t\troot[\"stitch\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\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.l = 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// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 33);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(global) {/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n\n\nvar base64 = __webpack_require__(58)\nvar ieee754 = __webpack_require__(62)\nvar isArray = __webpack_require__(64)\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(17)))\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n// Copyright (c) 2008, Fair Oaks Labs, Inc.\n// All rights reserved.\n// \n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are met:\n// \n// * Redistributions of source code must retain the above copyright notice,\n// this list of conditions and the following disclaimer.\n// \n// * Redistributions in binary form must reproduce the above copyright notice,\n// this list of conditions and the following disclaimer in the documentation\n// and/or other materials provided with the distribution.\n// \n// * Neither the name of Fair Oaks Labs, Inc. nor the names of its contributors\n// may be used to endorse or promote products derived from this software\n// without specific prior written permission.\n// \n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n// POSSIBILITY OF SUCH DAMAGE.\n//\n//\n// Modifications to writeIEEE754 to support negative zeroes made by Brian White\n\nvar readIEEE754 = function readIEEE754(buffer, offset, endian, mLen, nBytes) {\n var e,\n m,\n bBE = endian === 'big',\n eLen = nBytes * 8 - mLen - 1,\n eMax = (1 << eLen) - 1,\n eBias = eMax >> 1,\n nBits = -7,\n i = bBE ? 0 : nBytes - 1,\n d = bBE ? 1 : -1,\n s = buffer[offset + i];\n\n i += d;\n\n e = s & (1 << -nBits) - 1;\n s >>= -nBits;\n nBits += eLen;\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & (1 << -nBits) - 1;\n e >>= -nBits;\n nBits += mLen;\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias;\n } else if (e === eMax) {\n return m ? NaN : (s ? -1 : 1) * Infinity;\n } else {\n m = m + Math.pow(2, mLen);\n e = e - eBias;\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen);\n};\n\nvar writeIEEE754 = function writeIEEE754(buffer, value, offset, endian, mLen, nBytes) {\n var e,\n m,\n c,\n bBE = endian === 'big',\n eLen = nBytes * 8 - mLen - 1,\n eMax = (1 << eLen) - 1,\n eBias = eMax >> 1,\n rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0,\n i = bBE ? nBytes - 1 : 0,\n d = bBE ? -1 : 1,\n s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;\n\n value = Math.abs(value);\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0;\n e = eMax;\n } else {\n e = Math.floor(Math.log(value) / Math.LN2);\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--;\n c *= 2;\n }\n if (e + eBias >= 1) {\n value += rt / c;\n } else {\n value += rt * Math.pow(2, 1 - eBias);\n }\n if (value * c >= 2) {\n e++;\n c /= 2;\n }\n\n if (e + eBias >= eMax) {\n m = 0;\n e = eMax;\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen);\n e = e + eBias;\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);\n e = 0;\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = e << mLen | m;\n eLen += mLen;\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128;\n};\n\nexports.readIEEE754 = readIEEE754;\nexports.writeIEEE754 = writeIEEE754;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.uriEncodeObject = exports.getPlatform = exports.serviceResponse = exports.deprecate = exports.collectMetadata = undefined;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _detectBrowser = __webpack_require__(59);\n\nvar platform = _interopRequireWildcard(_detectBrowser);\n\nvar _Base = __webpack_require__(25);\n\nvar base64 = _interopRequireWildcard(_Base);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nvar RESULT_METADATA_KEY = '_stitch_metadata';\n\n/** @namespace util */\n\n/**\n * Utility which creates a function that extracts metadata\n * from the server in the response to a pipeline request,\n * and attaches it to the final result after the finalizer has been applied.\n *\n * @memberof util\n * @param {Function} [func] optional finalizer to transform the response data\n */\nvar collectMetadata = exports.collectMetadata = function collectMetadata(func) {\n var attachMetadata = function attachMetadata(metadata) {\n return function (res) {\n if ((typeof res === 'undefined' ? 'undefined' : _typeof(res)) === 'object' && !Object.prototype.hasOwnProperty.call(res, RESULT_METADATA_KEY)) {\n Object.defineProperty(res, RESULT_METADATA_KEY, { enumerable: false, configurable: false, writable: false, value: metadata });\n }\n return Promise.resolve(res);\n };\n };\n var captureMetadata = function captureMetadata(data) {\n var metadata = {};\n if (data.warnings) {\n // Metadata is not yet attached to result, grab any data that needs to be added.\n metadata.warnings = data.warnings;\n }\n if (!func) {\n return Promise.resolve(data).then(attachMetadata(metadata));\n }\n return Promise.resolve(data).then(func).then(attachMetadata(metadata));\n };\n return captureMetadata;\n};\n\n/**\n * Utility function for displaying deprecation notices\n *\n * @memberof util\n * @param {Function} fn the function to deprecate\n * @param {String} msg the message to display to the user regarding deprecation\n */\nfunction deprecate(fn, msg) {\n var alreadyWarned = false;\n function deprecated() {\n if (!alreadyWarned) {\n alreadyWarned = true;\n console.warn('DeprecationWarning: ' + msg);\n }\n\n return fn.apply(this, arguments);\n }\n\n deprecated.__proto__ = fn; // eslint-disable-line\n if (fn.prototype) {\n deprecated.prototype = fn.prototype;\n }\n\n return deprecated;\n}\n\n/**\n * Utility method for executing a service action as a function call.\n *\n * @memberof util\n * @param {Object} service the service to execute the action on\n * @param {String} action the service action to execute\n * @param {Array} args the arguments to supply to the service action invocation\n * @returns {Promise} the API response from the executed service action\n */\nfunction serviceResponse(service, _ref) {\n var _ref$serviceName = _ref.serviceName,\n serviceName = _ref$serviceName === undefined ? service.serviceName : _ref$serviceName,\n action = _ref.action,\n args = _ref.args;\n var client = service.client;\n\n\n if (!client) {\n throw new Error('Service has no client');\n }\n\n return client.executeServiceFunction(serviceName, action, args);\n}\n\n/**\n * Utility function to get the platform.\n *\n * @memberof util\n * @returns {Object} An object of the form {name: ..., version: ...}, or null\n */\nfunction getPlatform() {\n return platform ? platform : null;\n}\n\n/**\n * Utility function to encode a JSON object into a valid string that can be\n * inserted in a URI. The object is first stringified, then encoded in base64,\n * and finally encoded via the builtin encodeURIComponent function.\n *\n * @memberof util\n * @param {Object} obj The object to encode\n * @returns {String} The encoded object\n */\nfunction uriEncodeObject(obj) {\n return encodeURIComponent(base64.btoa(JSON.stringify(obj)));\n}\n\nexports.deprecate = deprecate;\nexports.serviceResponse = serviceResponse;\nexports.getPlatform = getPlatform;\nexports.uriEncodeObject = uriEncodeObject;\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n// Copyright 2009 Google Inc. All Rights Reserved\n\n/**\n * Defines a Long class for representing a 64-bit two's-complement\n * integer value, which faithfully simulates the behavior of a Java \"Long\". This\n * implementation is derived from LongLib in GWT.\n *\n * Constructs a 64-bit two's-complement integer, given its low and high 32-bit\n * values as *signed* integers. See the from* functions below for more\n * convenient ways of constructing Longs.\n *\n * The internal representation of a Long is the two given signed, 32-bit values.\n * We use 32-bit pieces because these are the size of integers on which\n * Javascript performs bit-operations. For operations like addition and\n * multiplication, we split each number into 16-bit pieces, which can easily be\n * multiplied within Javascript's floating-point representation without overflow\n * or change in sign.\n *\n * In the algorithms below, we frequently reduce the negative case to the\n * positive case by negating the input(s) and then post-processing the result.\n * Note that we must ALWAYS check specially whether those values are MIN_VALUE\n * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\n * a positive number, it overflows back into a negative). Not handling this\n * case would often result in infinite recursion.\n *\n * @class\n * @param {number} low the low (signed) 32 bits of the Long.\n * @param {number} high the high (signed) 32 bits of the Long.\n * @return {Long}\n */\nfunction Long(low, high) {\n if (!(this instanceof Long)) return new Long(low, high);\n\n this._bsontype = 'Long';\n /**\n * @type {number}\n * @ignore\n */\n this.low_ = low | 0; // force into 32 signed bits.\n\n /**\n * @type {number}\n * @ignore\n */\n this.high_ = high | 0; // force into 32 signed bits.\n};\n\n/**\n * Return the int value.\n *\n * @method\n * @return {number} the value, assuming it is a 32-bit integer.\n */\nLong.prototype.toInt = function () {\n return this.low_;\n};\n\n/**\n * Return the Number value.\n *\n * @method\n * @return {number} the closest floating-point representation to this value.\n */\nLong.prototype.toNumber = function () {\n return this.high_ * Long.TWO_PWR_32_DBL_ + this.getLowBitsUnsigned();\n};\n\n/**\n * Return the JSON value.\n *\n * @method\n * @return {string} the JSON representation.\n */\nLong.prototype.toJSON = function () {\n return this.toString();\n};\n\n/**\n * Return the String value.\n *\n * @method\n * @param {number} [opt_radix] the radix in which the text should be written.\n * @return {string} the textual representation of this value.\n */\nLong.prototype.toString = function (opt_radix) {\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (this.isZero()) {\n return '0';\n }\n\n if (this.isNegative()) {\n if (this.equals(Long.MIN_VALUE)) {\n // We need to change the Long value before it can be negated, so we remove\n // the bottom-most digit in this base and then recurse to do the rest.\n var radixLong = Long.fromNumber(radix);\n var div = this.div(radixLong);\n var rem = div.multiply(radixLong).subtract(this);\n return div.toString(radix) + rem.toInt().toString(radix);\n } else {\n return '-' + this.negate().toString(radix);\n }\n }\n\n // Do several (6) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Long.fromNumber(Math.pow(radix, 6));\n\n var rem = this;\n var result = '';\n while (true) {\n var remDiv = rem.div(radixToPower);\n var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt();\n var digits = intval.toString(radix);\n\n rem = remDiv;\n if (rem.isZero()) {\n return digits + result;\n } else {\n while (digits.length < 6) {\n digits = '0' + digits;\n }\n result = '' + digits + result;\n }\n }\n};\n\n/**\n * Return the high 32-bits value.\n *\n * @method\n * @return {number} the high 32-bits as a signed value.\n */\nLong.prototype.getHighBits = function () {\n return this.high_;\n};\n\n/**\n * Return the low 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as a signed value.\n */\nLong.prototype.getLowBits = function () {\n return this.low_;\n};\n\n/**\n * Return the low unsigned 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as an unsigned value.\n */\nLong.prototype.getLowBitsUnsigned = function () {\n return this.low_ >= 0 ? this.low_ : Long.TWO_PWR_32_DBL_ + this.low_;\n};\n\n/**\n * Returns the number of bits needed to represent the absolute value of this Long.\n *\n * @method\n * @return {number} Returns the number of bits needed to represent the absolute value of this Long.\n */\nLong.prototype.getNumBitsAbs = function () {\n if (this.isNegative()) {\n if (this.equals(Long.MIN_VALUE)) {\n return 64;\n } else {\n return this.negate().getNumBitsAbs();\n }\n } else {\n var val = this.high_ != 0 ? this.high_ : this.low_;\n for (var bit = 31; bit > 0; bit--) {\n if ((val & 1 << bit) != 0) {\n break;\n }\n }\n return this.high_ != 0 ? bit + 33 : bit + 1;\n }\n};\n\n/**\n * Return whether this value is zero.\n *\n * @method\n * @return {boolean} whether this value is zero.\n */\nLong.prototype.isZero = function () {\n return this.high_ == 0 && this.low_ == 0;\n};\n\n/**\n * Return whether this value is negative.\n *\n * @method\n * @return {boolean} whether this value is negative.\n */\nLong.prototype.isNegative = function () {\n return this.high_ < 0;\n};\n\n/**\n * Return whether this value is odd.\n *\n * @method\n * @return {boolean} whether this value is odd.\n */\nLong.prototype.isOdd = function () {\n return (this.low_ & 1) == 1;\n};\n\n/**\n * Return whether this Long equals the other\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long equals the other\n */\nLong.prototype.equals = function (other) {\n return this.high_ == other.high_ && this.low_ == other.low_;\n};\n\n/**\n * Return whether this Long does not equal the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long does not equal the other.\n */\nLong.prototype.notEquals = function (other) {\n return this.high_ != other.high_ || this.low_ != other.low_;\n};\n\n/**\n * Return whether this Long is less than the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is less than the other.\n */\nLong.prototype.lessThan = function (other) {\n return this.compare(other) < 0;\n};\n\n/**\n * Return whether this Long is less than or equal to the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is less than or equal to the other.\n */\nLong.prototype.lessThanOrEqual = function (other) {\n return this.compare(other) <= 0;\n};\n\n/**\n * Return whether this Long is greater than the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is greater than the other.\n */\nLong.prototype.greaterThan = function (other) {\n return this.compare(other) > 0;\n};\n\n/**\n * Return whether this Long is greater than or equal to the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is greater than or equal to the other.\n */\nLong.prototype.greaterThanOrEqual = function (other) {\n return this.compare(other) >= 0;\n};\n\n/**\n * Compares this Long with the given one.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater.\n */\nLong.prototype.compare = function (other) {\n if (this.equals(other)) {\n return 0;\n }\n\n var thisNeg = this.isNegative();\n var otherNeg = other.isNegative();\n if (thisNeg && !otherNeg) {\n return -1;\n }\n if (!thisNeg && otherNeg) {\n return 1;\n }\n\n // at this point, the signs are the same, so subtraction will not overflow\n if (this.subtract(other).isNegative()) {\n return -1;\n } else {\n return 1;\n }\n};\n\n/**\n * The negation of this value.\n *\n * @method\n * @return {Long} the negation of this value.\n */\nLong.prototype.negate = function () {\n if (this.equals(Long.MIN_VALUE)) {\n return Long.MIN_VALUE;\n } else {\n return this.not().add(Long.ONE);\n }\n};\n\n/**\n * Returns the sum of this and the given Long.\n *\n * @method\n * @param {Long} other Long to add to this one.\n * @return {Long} the sum of this and the given Long.\n */\nLong.prototype.add = function (other) {\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0,\n c32 = 0,\n c16 = 0,\n c00 = 0;\n c00 += a00 + b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 + b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 + b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 + b48;\n c48 &= 0xFFFF;\n return Long.fromBits(c16 << 16 | c00, c48 << 16 | c32);\n};\n\n/**\n * Returns the difference of this and the given Long.\n *\n * @method\n * @param {Long} other Long to subtract from this.\n * @return {Long} the difference of this and the given Long.\n */\nLong.prototype.subtract = function (other) {\n return this.add(other.negate());\n};\n\n/**\n * Returns the product of this and the given Long.\n *\n * @method\n * @param {Long} other Long to multiply with this.\n * @return {Long} the product of this and the other.\n */\nLong.prototype.multiply = function (other) {\n if (this.isZero()) {\n return Long.ZERO;\n } else if (other.isZero()) {\n return Long.ZERO;\n }\n\n if (this.equals(Long.MIN_VALUE)) {\n return other.isOdd() ? Long.MIN_VALUE : Long.ZERO;\n } else if (other.equals(Long.MIN_VALUE)) {\n return this.isOdd() ? Long.MIN_VALUE : Long.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().multiply(other.negate());\n } else {\n return this.negate().multiply(other).negate();\n }\n } else if (other.isNegative()) {\n return this.multiply(other.negate()).negate();\n }\n\n // If both Longs are small, use float multiplication\n if (this.lessThan(Long.TWO_PWR_24_) && other.lessThan(Long.TWO_PWR_24_)) {\n return Long.fromNumber(this.toNumber() * other.toNumber());\n }\n\n // Divide each Long into 4 chunks of 16 bits, and then add up 4x4 products.\n // We can skip products that would overflow.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0,\n c32 = 0,\n c16 = 0,\n c00 = 0;\n c00 += a00 * b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 * b00;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c16 += a00 * b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 * b00;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a16 * b16;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a00 * b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\n c48 &= 0xFFFF;\n return Long.fromBits(c16 << 16 | c00, c48 << 16 | c32);\n};\n\n/**\n * Returns this Long divided by the given one.\n *\n * @method\n * @param {Long} other Long by which to divide.\n * @return {Long} this Long divided by the given one.\n */\nLong.prototype.div = function (other) {\n if (other.isZero()) {\n throw Error('division by zero');\n } else if (this.isZero()) {\n return Long.ZERO;\n }\n\n if (this.equals(Long.MIN_VALUE)) {\n if (other.equals(Long.ONE) || other.equals(Long.NEG_ONE)) {\n return Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\n } else if (other.equals(Long.MIN_VALUE)) {\n return Long.ONE;\n } else {\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\n var halfThis = this.shiftRight(1);\n var approx = halfThis.div(other).shiftLeft(1);\n if (approx.equals(Long.ZERO)) {\n return other.isNegative() ? Long.ONE : Long.NEG_ONE;\n } else {\n var rem = this.subtract(other.multiply(approx));\n var result = approx.add(rem.div(other));\n return result;\n }\n }\n } else if (other.equals(Long.MIN_VALUE)) {\n return Long.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().div(other.negate());\n } else {\n return this.negate().div(other).negate();\n }\n } else if (other.isNegative()) {\n return this.div(other.negate()).negate();\n }\n\n // Repeat the following until the remainder is less than other: find a\n // floating-point that approximates remainder / other *from below*, add this\n // into the result, and subtract it from the remainder. It is critical that\n // the approximate value is less than or equal to the real value so that the\n // remainder never becomes negative.\n var res = Long.ZERO;\n var rem = this;\n while (rem.greaterThanOrEqual(other)) {\n // Approximate the result of division. This may be a little greater or\n // smaller than the actual value.\n var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber()));\n\n // We will tweak the approximate result by changing it in the 48-th digit or\n // the smallest non-fractional digit, whichever is larger.\n var log2 = Math.ceil(Math.log(approx) / Math.LN2);\n var delta = log2 <= 48 ? 1 : Math.pow(2, log2 - 48);\n\n // Decrease the approximation until it is smaller than the remainder. Note\n // that if it is too large, the product overflows and is negative.\n var approxRes = Long.fromNumber(approx);\n var approxRem = approxRes.multiply(other);\n while (approxRem.isNegative() || approxRem.greaterThan(rem)) {\n approx -= delta;\n approxRes = Long.fromNumber(approx);\n approxRem = approxRes.multiply(other);\n }\n\n // We know the answer can't be zero... and actually, zero would cause\n // infinite recursion since we would make no progress.\n if (approxRes.isZero()) {\n approxRes = Long.ONE;\n }\n\n res = res.add(approxRes);\n rem = rem.subtract(approxRem);\n }\n return res;\n};\n\n/**\n * Returns this Long modulo the given one.\n *\n * @method\n * @param {Long} other Long by which to mod.\n * @return {Long} this Long modulo the given one.\n */\nLong.prototype.modulo = function (other) {\n return this.subtract(this.div(other).multiply(other));\n};\n\n/**\n * The bitwise-NOT of this value.\n *\n * @method\n * @return {Long} the bitwise-NOT of this value.\n */\nLong.prototype.not = function () {\n return Long.fromBits(~this.low_, ~this.high_);\n};\n\n/**\n * Returns the bitwise-AND of this Long and the given one.\n *\n * @method\n * @param {Long} other the Long with which to AND.\n * @return {Long} the bitwise-AND of this and the other.\n */\nLong.prototype.and = function (other) {\n return Long.fromBits(this.low_ & other.low_, this.high_ & other.high_);\n};\n\n/**\n * Returns the bitwise-OR of this Long and the given one.\n *\n * @method\n * @param {Long} other the Long with which to OR.\n * @return {Long} the bitwise-OR of this and the other.\n */\nLong.prototype.or = function (other) {\n return Long.fromBits(this.low_ | other.low_, this.high_ | other.high_);\n};\n\n/**\n * Returns the bitwise-XOR of this Long and the given one.\n *\n * @method\n * @param {Long} other the Long with which to XOR.\n * @return {Long} the bitwise-XOR of this and the other.\n */\nLong.prototype.xor = function (other) {\n return Long.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_);\n};\n\n/**\n * Returns this Long with bits shifted to the left by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Long} this shifted to the left by the given amount.\n */\nLong.prototype.shiftLeft = function (numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var low = this.low_;\n if (numBits < 32) {\n var high = this.high_;\n return Long.fromBits(low << numBits, high << numBits | low >>> 32 - numBits);\n } else {\n return Long.fromBits(0, low << numBits - 32);\n }\n }\n};\n\n/**\n * Returns this Long with bits shifted to the right by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Long} this shifted to the right by the given amount.\n */\nLong.prototype.shiftRight = function (numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Long.fromBits(low >>> numBits | high << 32 - numBits, high >> numBits);\n } else {\n return Long.fromBits(high >> numBits - 32, high >= 0 ? 0 : -1);\n }\n }\n};\n\n/**\n * Returns this Long with bits shifted to the right by the given amount, with the new top bits matching the current sign bit.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Long} this shifted to the right by the given amount, with zeros placed into the new leading bits.\n */\nLong.prototype.shiftRightUnsigned = function (numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Long.fromBits(low >>> numBits | high << 32 - numBits, high >>> numBits);\n } else if (numBits == 32) {\n return Long.fromBits(high, 0);\n } else {\n return Long.fromBits(high >>> numBits - 32, 0);\n }\n }\n};\n\n/**\n * Returns a Long representing the given (32-bit) integer value.\n *\n * @method\n * @param {number} value the 32-bit integer in question.\n * @return {Long} the corresponding Long value.\n */\nLong.fromInt = function (value) {\n if (-128 <= value && value < 128) {\n var cachedObj = Long.INT_CACHE_[value];\n if (cachedObj) {\n return cachedObj;\n }\n }\n\n var obj = new Long(value | 0, value < 0 ? -1 : 0);\n if (-128 <= value && value < 128) {\n Long.INT_CACHE_[value] = obj;\n }\n return obj;\n};\n\n/**\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n *\n * @method\n * @param {number} value the number in question.\n * @return {Long} the corresponding Long value.\n */\nLong.fromNumber = function (value) {\n if (isNaN(value) || !isFinite(value)) {\n return Long.ZERO;\n } else if (value <= -Long.TWO_PWR_63_DBL_) {\n return Long.MIN_VALUE;\n } else if (value + 1 >= Long.TWO_PWR_63_DBL_) {\n return Long.MAX_VALUE;\n } else if (value < 0) {\n return Long.fromNumber(-value).negate();\n } else {\n return new Long(value % Long.TWO_PWR_32_DBL_ | 0, value / Long.TWO_PWR_32_DBL_ | 0);\n }\n};\n\n/**\n * Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits.\n *\n * @method\n * @param {number} lowBits the low 32-bits.\n * @param {number} highBits the high 32-bits.\n * @return {Long} the corresponding Long value.\n */\nLong.fromBits = function (lowBits, highBits) {\n return new Long(lowBits, highBits);\n};\n\n/**\n * Returns a Long representation of the given string, written using the given radix.\n *\n * @method\n * @param {string} str the textual representation of the Long.\n * @param {number} opt_radix the radix in which the text is written.\n * @return {Long} the corresponding Long value.\n */\nLong.fromString = function (str, opt_radix) {\n if (str.length == 0) {\n throw Error('number format error: empty string');\n }\n\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (str.charAt(0) == '-') {\n return Long.fromString(str.substring(1), radix).negate();\n } else if (str.indexOf('-') >= 0) {\n throw Error('number format error: interior \"-\" character: ' + str);\n }\n\n // Do several (8) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Long.fromNumber(Math.pow(radix, 8));\n\n var result = Long.ZERO;\n for (var i = 0; i < str.length; i += 8) {\n var size = Math.min(8, str.length - i);\n var value = parseInt(str.substring(i, i + size), radix);\n if (size < 8) {\n var power = Long.fromNumber(Math.pow(radix, size));\n result = result.multiply(power).add(Long.fromNumber(value));\n } else {\n result = result.multiply(radixToPower);\n result = result.add(Long.fromNumber(value));\n }\n }\n return result;\n};\n\n// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the\n// from* methods on which they depend.\n\n\n/**\n * A cache of the Long representations of small integer values.\n * @type {Object}\n * @ignore\n */\nLong.INT_CACHE_ = {};\n\n// NOTE: the compiler should inline these constant values below and then remove\n// these variables, so there should be no runtime penalty for these.\n\n/**\n * Number used repeated below in calculations. This must appear before the\n * first call to any from* function below.\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_16_DBL_ = 1 << 16;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_24_DBL_ = 1 << 24;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_32_DBL_ = Long.TWO_PWR_16_DBL_ * Long.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_31_DBL_ = Long.TWO_PWR_32_DBL_ / 2;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_48_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_64_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_32_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_63_DBL_ = Long.TWO_PWR_64_DBL_ / 2;\n\n/** @type {Long} */\nLong.ZERO = Long.fromInt(0);\n\n/** @type {Long} */\nLong.ONE = Long.fromInt(1);\n\n/** @type {Long} */\nLong.NEG_ONE = Long.fromInt(-1);\n\n/** @type {Long} */\nLong.MAX_VALUE = Long.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0);\n\n/** @type {Long} */\nLong.MIN_VALUE = Long.fromBits(0, 0x80000000 | 0);\n\n/**\n * @type {Long}\n * @ignore\n */\nLong.TWO_PWR_24_ = Long.fromInt(1 << 24);\n\n/**\n * Expose.\n */\nmodule.exports = Long;\nmodule.exports.Long = Long;\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(global) {\n\n/**\n * Module dependencies.\n * @ignore\n */\n\n// Test if we're in Node via presence of \"global\" not absence of \"window\"\n// to support hybrid environments like Electron\nif (typeof global !== 'undefined') {\n var Buffer = __webpack_require__(0).Buffer; // TODO just use global Buffer\n}\n\n/**\n * A class representation of the BSON Binary type.\n *\n * Sub types\n * - **BSON.BSON_BINARY_SUBTYPE_DEFAULT**, default BSON type.\n * - **BSON.BSON_BINARY_SUBTYPE_FUNCTION**, BSON function type.\n * - **BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY**, BSON byte array type.\n * - **BSON.BSON_BINARY_SUBTYPE_UUID**, BSON uuid type.\n * - **BSON.BSON_BINARY_SUBTYPE_MD5**, BSON md5 type.\n * - **BSON.BSON_BINARY_SUBTYPE_USER_DEFINED**, BSON user defined type.\n *\n * @class\n * @param {Buffer} buffer a buffer object containing the binary data.\n * @param {Number} [subType] the option binary type.\n * @return {Binary}\n */\nfunction Binary(buffer, subType) {\n if (!(this instanceof Binary)) return new Binary(buffer, subType);\n\n this._bsontype = 'Binary';\n\n if (buffer instanceof Number) {\n this.sub_type = buffer;\n this.position = 0;\n } else {\n this.sub_type = subType == null ? BSON_BINARY_SUBTYPE_DEFAULT : subType;\n this.position = 0;\n }\n\n if (buffer != null && !(buffer instanceof Number)) {\n // Only accept Buffer, Uint8Array or Arrays\n if (typeof buffer == 'string') {\n // Different ways of writing the length of the string for the different types\n if (typeof Buffer != 'undefined') {\n this.buffer = new Buffer(buffer);\n } else if (typeof Uint8Array != 'undefined' || Object.prototype.toString.call(buffer) == '[object Array]') {\n this.buffer = writeStringToArray(buffer);\n } else {\n throw new Error(\"only String, Buffer, Uint8Array or Array accepted\");\n }\n } else {\n this.buffer = buffer;\n }\n this.position = buffer.length;\n } else {\n if (typeof Buffer != 'undefined') {\n this.buffer = new Buffer(Binary.BUFFER_SIZE);\n } else if (typeof Uint8Array != 'undefined') {\n this.buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE));\n } else {\n this.buffer = new Array(Binary.BUFFER_SIZE);\n }\n // Set position to start of buffer\n this.position = 0;\n }\n};\n\n/**\n * Updates this binary with byte_value.\n *\n * @method\n * @param {string} byte_value a single byte we wish to write.\n */\nBinary.prototype.put = function put(byte_value) {\n // If it's a string and a has more than one character throw an error\n if (byte_value['length'] != null && typeof byte_value != 'number' && byte_value.length != 1) throw new Error(\"only accepts single character String, Uint8Array or Array\");\n if (typeof byte_value != 'number' && byte_value < 0 || byte_value > 255) throw new Error(\"only accepts number in a valid unsigned byte range 0-255\");\n\n // Decode the byte value once\n var decoded_byte = null;\n if (typeof byte_value == 'string') {\n decoded_byte = byte_value.charCodeAt(0);\n } else if (byte_value['length'] != null) {\n decoded_byte = byte_value[0];\n } else {\n decoded_byte = byte_value;\n }\n\n if (this.buffer.length > this.position) {\n this.buffer[this.position++] = decoded_byte;\n } else {\n if (typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) {\n // Create additional overflow buffer\n var buffer = new Buffer(Binary.BUFFER_SIZE + this.buffer.length);\n // Combine the two buffers together\n this.buffer.copy(buffer, 0, 0, this.buffer.length);\n this.buffer = buffer;\n this.buffer[this.position++] = decoded_byte;\n } else {\n var buffer = null;\n // Create a new buffer (typed or normal array)\n if (Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') {\n buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE + this.buffer.length));\n } else {\n buffer = new Array(Binary.BUFFER_SIZE + this.buffer.length);\n }\n\n // We need to copy all the content to the new array\n for (var i = 0; i < this.buffer.length; i++) {\n buffer[i] = this.buffer[i];\n }\n\n // Reassign the buffer\n this.buffer = buffer;\n // Write the byte\n this.buffer[this.position++] = decoded_byte;\n }\n }\n};\n\n/**\n * Writes a buffer or string to the binary.\n *\n * @method\n * @param {(Buffer|string)} string a string or buffer to be written to the Binary BSON object.\n * @param {number} offset specify the binary of where to write the content.\n * @return {null}\n */\nBinary.prototype.write = function write(string, offset) {\n offset = typeof offset == 'number' ? offset : this.position;\n\n // If the buffer is to small let's extend the buffer\n if (this.buffer.length < offset + string.length) {\n var buffer = null;\n // If we are in node.js\n if (typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) {\n buffer = new Buffer(this.buffer.length + string.length);\n this.buffer.copy(buffer, 0, 0, this.buffer.length);\n } else if (Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') {\n // Create a new buffer\n buffer = new Uint8Array(new ArrayBuffer(this.buffer.length + string.length));\n // Copy the content\n for (var i = 0; i < this.position; i++) {\n buffer[i] = this.buffer[i];\n }\n }\n\n // Assign the new buffer\n this.buffer = buffer;\n }\n\n if (typeof Buffer != 'undefined' && Buffer.isBuffer(string) && Buffer.isBuffer(this.buffer)) {\n string.copy(this.buffer, offset, 0, string.length);\n this.position = offset + string.length > this.position ? offset + string.length : this.position;\n // offset = string.length\n } else if (typeof Buffer != 'undefined' && typeof string == 'string' && Buffer.isBuffer(this.buffer)) {\n this.buffer.write(string, offset, 'binary');\n this.position = offset + string.length > this.position ? offset + string.length : this.position;\n // offset = string.length;\n } else if (Object.prototype.toString.call(string) == '[object Uint8Array]' || Object.prototype.toString.call(string) == '[object Array]' && typeof string != 'string') {\n for (var i = 0; i < string.length; i++) {\n this.buffer[offset++] = string[i];\n }\n\n this.position = offset > this.position ? offset : this.position;\n } else if (typeof string == 'string') {\n for (var i = 0; i < string.length; i++) {\n this.buffer[offset++] = string.charCodeAt(i);\n }\n\n this.position = offset > this.position ? offset : this.position;\n }\n};\n\n/**\n * Reads **length** bytes starting at **position**.\n *\n * @method\n * @param {number} position read from the given position in the Binary.\n * @param {number} length the number of bytes to read.\n * @return {Buffer}\n */\nBinary.prototype.read = function read(position, length) {\n length = length && length > 0 ? length : this.position;\n\n // Let's return the data based on the type we have\n if (this.buffer['slice']) {\n return this.buffer.slice(position, position + length);\n } else {\n // Create a buffer to keep the result\n var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(length)) : new Array(length);\n for (var i = 0; i < length; i++) {\n buffer[i] = this.buffer[position++];\n }\n }\n // Return the buffer\n return buffer;\n};\n\n/**\n * Returns the value of this binary as a string.\n *\n * @method\n * @return {string}\n */\nBinary.prototype.value = function value(asRaw) {\n asRaw = asRaw == null ? false : asRaw;\n\n // Optimize to serialize for the situation where the data == size of buffer\n if (asRaw && typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer) && this.buffer.length == this.position) return this.buffer;\n\n // If it's a node.js buffer object\n if (typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) {\n return asRaw ? this.buffer.slice(0, this.position) : this.buffer.toString('binary', 0, this.position);\n } else {\n if (asRaw) {\n // we support the slice command use it\n if (this.buffer['slice'] != null) {\n return this.buffer.slice(0, this.position);\n } else {\n // Create a new buffer to copy content to\n var newBuffer = Object.prototype.toString.call(this.buffer) == '[object Uint8Array]' ? new Uint8Array(new ArrayBuffer(this.position)) : new Array(this.position);\n // Copy content\n for (var i = 0; i < this.position; i++) {\n newBuffer[i] = this.buffer[i];\n }\n // Return the buffer\n return newBuffer;\n }\n } else {\n return convertArraytoUtf8BinaryString(this.buffer, 0, this.position);\n }\n }\n};\n\n/**\n * Length.\n *\n * @method\n * @return {number} the length of the binary.\n */\nBinary.prototype.length = function length() {\n return this.position;\n};\n\n/**\n * @ignore\n */\nBinary.prototype.toJSON = function () {\n return this.buffer != null ? this.buffer.toString('base64') : '';\n};\n\n/**\n * @ignore\n */\nBinary.prototype.toString = function (format) {\n return this.buffer != null ? this.buffer.slice(0, this.position).toString(format) : '';\n};\n\n/**\n * Binary default subtype\n * @ignore\n */\nvar BSON_BINARY_SUBTYPE_DEFAULT = 0;\n\n/**\n * @ignore\n */\nvar writeStringToArray = function writeStringToArray(data) {\n // Create a buffer\n var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(data.length)) : new Array(data.length);\n // Write the content to the buffer\n for (var i = 0; i < data.length; i++) {\n buffer[i] = data.charCodeAt(i);\n }\n // Write the string to the buffer\n return buffer;\n};\n\n/**\n * Convert Array ot Uint8Array to Binary String\n *\n * @ignore\n */\nvar convertArraytoUtf8BinaryString = function convertArraytoUtf8BinaryString(byteArray, startIndex, endIndex) {\n var result = \"\";\n for (var i = startIndex; i < endIndex; i++) {\n result = result + String.fromCharCode(byteArray[i]);\n }\n return result;\n};\n\nBinary.BUFFER_SIZE = 256;\n\n/**\n * Default BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_DEFAULT = 0;\n/**\n * Function BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_FUNCTION = 1;\n/**\n * Byte Array BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_BYTE_ARRAY = 2;\n/**\n * OLD UUID BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_UUID_OLD = 3;\n/**\n * UUID BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_UUID = 4;\n/**\n * MD5 BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_MD5 = 5;\n/**\n * User BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_USER_DEFINED = 128;\n\n/**\n * Expose.\n */\nmodule.exports = Binary;\nmodule.exports.Binary = Binary;\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(17)))\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * A class representation of the BSON Code type.\n *\n * @class\n * @param {(string|function)} code a string or function.\n * @param {Object} [scope] an optional scope for the function.\n * @return {Code}\n */\nvar Code = function Code(code, scope) {\n if (!(this instanceof Code)) return new Code(code, scope);\n this._bsontype = 'Code';\n this.code = code;\n this.scope = scope;\n};\n\n/**\n * @ignore\n */\nCode.prototype.toJSON = function () {\n return { scope: this.scope, code: this.code };\n};\n\nmodule.exports = Code;\nmodule.exports.Code = Code;\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * A class representation of the BSON DBRef type.\n *\n * @class\n * @param {string} namespace the collection name.\n * @param {ObjectID} oid the reference ObjectID.\n * @param {string} [db] optional db name, if omitted the reference is local to the current db.\n * @return {DBRef}\n */\nfunction DBRef(namespace, oid, db) {\n if (!(this instanceof DBRef)) return new DBRef(namespace, oid, db);\n\n this._bsontype = 'DBRef';\n this.namespace = namespace;\n this.oid = oid;\n this.db = db;\n};\n\n/**\n * @ignore\n * @api private\n */\nDBRef.prototype.toJSON = function () {\n return {\n '$ref': this.namespace,\n '$id': this.oid,\n '$db': this.db == null ? '' : this.db\n };\n};\n\nmodule.exports = DBRef;\nmodule.exports.DBRef = DBRef;\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Buffer) {\n\nvar Long = __webpack_require__(3);\n\nvar PARSE_STRING_REGEXP = /^(\\+|\\-)?(\\d+|(\\d*\\.\\d*))?(E|e)?([\\-\\+])?(\\d+)?$/;\nvar PARSE_INF_REGEXP = /^(\\+|\\-)?(Infinity|inf)$/i;\nvar PARSE_NAN_REGEXP = /^(\\+|\\-)?NaN$/i;\n\nvar EXPONENT_MAX = 6111;\nvar EXPONENT_MIN = -6176;\nvar EXPONENT_BIAS = 6176;\nvar MAX_DIGITS = 34;\n\n// Nan value bits as 32 bit values (due to lack of longs)\nvar NAN_BUFFER = [0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].reverse();\n// Infinity value bits 32 bit values (due to lack of longs)\nvar INF_NEGATIVE_BUFFER = [0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].reverse();\nvar INF_POSITIVE_BUFFER = [0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].reverse();\n\nvar EXPONENT_REGEX = /^([\\-\\+])?(\\d+)?$/;\n\n// Detect if the value is a digit\nvar isDigit = function isDigit(value) {\n return !isNaN(parseInt(value, 10));\n};\n\n// Divide two uint128 values\nvar divideu128 = function divideu128(value) {\n var DIVISOR = Long.fromNumber(1000 * 1000 * 1000);\n var _rem = Long.fromNumber(0);\n var i = 0;\n\n if (!value.parts[0] && !value.parts[1] && !value.parts[2] && !value.parts[3]) {\n return { quotient: value, rem: _rem };\n }\n\n for (var i = 0; i <= 3; i++) {\n // Adjust remainder to match value of next dividend\n _rem = _rem.shiftLeft(32);\n // Add the divided to _rem\n _rem = _rem.add(new Long(value.parts[i], 0));\n value.parts[i] = _rem.div(DIVISOR).low_;\n _rem = _rem.modulo(DIVISOR);\n }\n\n return { quotient: value, rem: _rem };\n};\n\n// Multiply two Long values and return the 128 bit value\nvar multiply64x2 = function multiply64x2(left, right) {\n if (!left && !right) {\n return { high: Long.fromNumber(0), low: Long.fromNumber(0) };\n }\n\n var leftHigh = left.shiftRightUnsigned(32);\n var leftLow = new Long(left.getLowBits(), 0);\n var rightHigh = right.shiftRightUnsigned(32);\n var rightLow = new Long(right.getLowBits(), 0);\n\n var productHigh = leftHigh.multiply(rightHigh);\n var productMid = leftHigh.multiply(rightLow);\n var productMid2 = leftLow.multiply(rightHigh);\n var productLow = leftLow.multiply(rightLow);\n\n productHigh = productHigh.add(productMid.shiftRightUnsigned(32));\n productMid = new Long(productMid.getLowBits(), 0).add(productMid2).add(productLow.shiftRightUnsigned(32));\n\n productHigh = productHigh.add(productMid.shiftRightUnsigned(32));\n productLow = productMid.shiftLeft(32).add(new Long(productLow.getLowBits(), 0));\n\n // Return the 128 bit result\n return { high: productHigh, low: productLow };\n};\n\nvar lessThan = function lessThan(left, right) {\n // Make values unsigned\n var uhleft = left.high_ >>> 0;\n var uhright = right.high_ >>> 0;\n\n // Compare high bits first\n if (uhleft < uhright) {\n return true;\n } else if (uhleft == uhright) {\n var ulleft = left.low_ >>> 0;\n var ulright = right.low_ >>> 0;\n if (ulleft < ulright) return true;\n }\n\n return false;\n};\n\nvar longtoHex = function longtoHex(value) {\n var buffer = new Buffer(8);\n var index = 0;\n // Encode the low 64 bits of the decimal\n // Encode low bits\n buffer[index++] = value.low_ & 0xff;\n buffer[index++] = value.low_ >> 8 & 0xff;\n buffer[index++] = value.low_ >> 16 & 0xff;\n buffer[index++] = value.low_ >> 24 & 0xff;\n // Encode high bits\n buffer[index++] = value.high_ & 0xff;\n buffer[index++] = value.high_ >> 8 & 0xff;\n buffer[index++] = value.high_ >> 16 & 0xff;\n buffer[index++] = value.high_ >> 24 & 0xff;\n return buffer.reverse().toString('hex');\n};\n\nvar int32toHex = function int32toHex(value) {\n var buffer = new Buffer(4);\n var index = 0;\n // Encode the low 64 bits of the decimal\n // Encode low bits\n buffer[index++] = value & 0xff;\n buffer[index++] = value >> 8 & 0xff;\n buffer[index++] = value >> 16 & 0xff;\n buffer[index++] = value >> 24 & 0xff;\n return buffer.reverse().toString('hex');\n};\n\nvar Decimal128 = function Decimal128(bytes) {\n this._bsontype = 'Decimal128';\n this.bytes = bytes;\n};\n\nDecimal128.fromString = function (string) {\n // Parse state tracking\n var isNegative = false;\n var sawRadix = false;\n var foundNonZero = false;\n\n // Total number of significant digits (no leading or trailing zero)\n var significantDigits = 0;\n // Total number of significand digits read\n var nDigitsRead = 0;\n // Total number of digits (no leading zeros)\n var nDigits = 0;\n // The number of the digits after radix\n var radixPosition = 0;\n // The index of the first non-zero in *str*\n var firstNonZero = 0;\n\n // Digits Array\n var digits = [0];\n // The number of digits in digits\n var nDigitsStored = 0;\n // Insertion pointer for digits\n var digitsInsert = 0;\n // The index of the first non-zero digit\n var firstDigit = 0;\n // The index of the last digit\n var lastDigit = 0;\n\n // Exponent\n var exponent = 0;\n // loop index over array\n var i = 0;\n // The high 17 digits of the significand\n var significandHigh = [0, 0];\n // The low 17 digits of the significand\n var significandLow = [0, 0];\n // The biased exponent\n var biasedExponent = 0;\n\n // Read index\n var index = 0;\n\n // Trim the string\n string = string.trim();\n\n // Results\n var stringMatch = string.match(PARSE_STRING_REGEXP);\n var infMatch = string.match(PARSE_INF_REGEXP);\n var nanMatch = string.match(PARSE_NAN_REGEXP);\n\n // Validate the string\n if (!stringMatch && !infMatch && !nanMatch || string.length == 0) {\n throw new Error(\"\" + string + \" not a valid Decimal128 string\");\n }\n\n // Check if we have an illegal exponent format\n if (stringMatch && stringMatch[4] && stringMatch[2] === undefined) {\n throw new Error(\"\" + string + \" not a valid Decimal128 string\");\n }\n\n // Get the negative or positive sign\n if (string[index] == '+' || string[index] == '-') {\n isNegative = string[index++] == '-';\n }\n\n // Check if user passed Infinity or NaN\n if (!isDigit(string[index]) && string[index] != '.') {\n if (string[index] == 'i' || string[index] == 'I') {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER));\n } else if (string[index] == 'N') {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n }\n\n // Read all the digits\n while (isDigit(string[index]) || string[index] == '.') {\n if (string[index] == '.') {\n if (sawRadix) {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n\n sawRadix = true;\n index = index + 1;\n continue;\n }\n\n if (nDigitsStored < 34) {\n if (string[index] != '0' || foundNonZero) {\n if (!foundNonZero) {\n firstNonZero = nDigitsRead;\n }\n\n foundNonZero = true;\n\n // Only store 34 digits\n digits[digitsInsert++] = parseInt(string[index], 10);\n nDigitsStored = nDigitsStored + 1;\n }\n }\n\n if (foundNonZero) {\n nDigits = nDigits + 1;\n }\n\n if (sawRadix) {\n radixPosition = radixPosition + 1;\n }\n\n nDigitsRead = nDigitsRead + 1;\n index = index + 1;\n }\n\n if (sawRadix && !nDigitsRead) {\n throw new Error(\"\" + string + \" not a valid Decimal128 string\");\n }\n\n // Read exponent if exists\n if (string[index] == 'e' || string[index] == 'E') {\n // Read exponent digits\n var match = string.substr(++index).match(EXPONENT_REGEX);\n\n // No digits read\n if (!match || !match[2]) {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n\n // Get exponent\n exponent = parseInt(match[0], 10);\n\n // Adjust the index\n index = index + match[0].length;\n }\n\n // Return not a number\n if (string[index]) {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n\n // Done reading input\n // Find first non-zero digit in digits\n firstDigit = 0;\n\n if (!nDigitsStored) {\n firstDigit = 0;\n lastDigit = 0;\n digits[0] = 0;\n nDigits = 1;\n nDigitsStored = 1;\n significantDigits = 0;\n } else {\n lastDigit = nDigitsStored - 1;\n significantDigits = nDigits;\n\n if (exponent != 0 && significantDigits != 1) {\n while (string[firstNonZero + significantDigits - 1] == '0') {\n significantDigits = significantDigits - 1;\n }\n }\n }\n\n // Normalization of exponent\n // Correct exponent based on radix position, and shift significand as needed\n // to represent user input\n\n // Overflow prevention\n if (exponent <= radixPosition && radixPosition - exponent > 1 << 14) {\n exponent = EXPONENT_MIN;\n } else {\n exponent = exponent - radixPosition;\n }\n\n // Attempt to normalize the exponent\n while (exponent > EXPONENT_MAX) {\n // Shift exponent to significand and decrease\n lastDigit = lastDigit + 1;\n\n if (lastDigit - firstDigit > MAX_DIGITS) {\n // Check if we have a zero then just hard clamp, otherwise fail\n var digitsString = digits.join('');\n if (digitsString.match(/^0+$/)) {\n exponent = EXPONENT_MAX;\n break;\n } else {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER));\n }\n }\n\n exponent = exponent - 1;\n }\n\n while (exponent < EXPONENT_MIN || nDigitsStored < nDigits) {\n // Shift last digit\n if (lastDigit == 0) {\n exponent = EXPONENT_MIN;\n significantDigits = 0;\n break;\n }\n\n if (nDigitsStored < nDigits) {\n // adjust to match digits not stored\n nDigits = nDigits - 1;\n } else {\n // adjust to round\n lastDigit = lastDigit - 1;\n }\n\n if (exponent < EXPONENT_MAX) {\n exponent = exponent + 1;\n } else {\n // Check if we have a zero then just hard clamp, otherwise fail\n var digitsString = digits.join('');\n if (digitsString.match(/^0+$/)) {\n exponent = EXPONENT_MAX;\n break;\n } else {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER));\n }\n }\n }\n\n // Round\n // We've normalized the exponent, but might still need to round.\n if (lastDigit - firstDigit + 1 < significantDigits && string[significantDigits] != '0') {\n var endOfString = nDigitsRead;\n\n // If we have seen a radix point, 'string' is 1 longer than we have\n // documented with ndigits_read, so inc the position of the first nonzero\n // digit and the position that digits are read to.\n if (sawRadix && exponent == EXPONENT_MIN) {\n firstNonZero = firstNonZero + 1;\n endOfString = endOfString + 1;\n }\n\n var roundDigit = parseInt(string[firstNonZero + lastDigit + 1], 10);\n var roundBit = 0;\n\n if (roundDigit >= 5) {\n roundBit = 1;\n\n if (roundDigit == 5) {\n roundBit = digits[lastDigit] % 2 == 1;\n\n for (var i = firstNonZero + lastDigit + 2; i < endOfString; i++) {\n if (parseInt(string[i], 10)) {\n roundBit = 1;\n break;\n }\n }\n }\n }\n\n if (roundBit) {\n var dIdx = lastDigit;\n\n for (; dIdx >= 0; dIdx--) {\n if (++digits[dIdx] > 9) {\n digits[dIdx] = 0;\n\n // overflowed most significant digit\n if (dIdx == 0) {\n if (exponent < EXPONENT_MAX) {\n exponent = exponent + 1;\n digits[dIdx] = 1;\n } else {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER));\n }\n }\n } else {\n break;\n }\n }\n }\n }\n\n // Encode significand\n // The high 17 digits of the significand\n significandHigh = Long.fromNumber(0);\n // The low 17 digits of the significand\n significandLow = Long.fromNumber(0);\n\n // read a zero\n if (significantDigits == 0) {\n significandHigh = Long.fromNumber(0);\n significandLow = Long.fromNumber(0);\n } else if (lastDigit - firstDigit < 17) {\n var dIdx = firstDigit;\n significandLow = Long.fromNumber(digits[dIdx++]);\n significandHigh = new Long(0, 0);\n\n for (; dIdx <= lastDigit; dIdx++) {\n significandLow = significandLow.multiply(Long.fromNumber(10));\n significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));\n }\n } else {\n var dIdx = firstDigit;\n significandHigh = Long.fromNumber(digits[dIdx++]);\n\n for (; dIdx <= lastDigit - 17; dIdx++) {\n significandHigh = significandHigh.multiply(Long.fromNumber(10));\n significandHigh = significandHigh.add(Long.fromNumber(digits[dIdx]));\n }\n\n significandLow = Long.fromNumber(digits[dIdx++]);\n\n for (; dIdx <= lastDigit; dIdx++) {\n significandLow = significandLow.multiply(Long.fromNumber(10));\n significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));\n }\n }\n\n var significand = multiply64x2(significandHigh, Long.fromString(\"100000000000000000\"));\n\n significand.low = significand.low.add(significandLow);\n\n if (lessThan(significand.low, significandLow)) {\n significand.high = significand.high.add(Long.fromNumber(1));\n }\n\n // Biased exponent\n var biasedExponent = exponent + EXPONENT_BIAS;\n var dec = { low: Long.fromNumber(0), high: Long.fromNumber(0) };\n\n // Encode combination, exponent, and significand.\n if (significand.high.shiftRightUnsigned(49).and(Long.fromNumber(1)).equals(Long.fromNumber)) {\n // Encode '11' into bits 1 to 3\n dec.high = dec.high.or(Long.fromNumber(0x3).shiftLeft(61));\n dec.high = dec.high.or(Long.fromNumber(biasedExponent).and(Long.fromNumber(0x3fff).shiftLeft(47)));\n dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x7fffffffffff)));\n } else {\n dec.high = dec.high.or(Long.fromNumber(biasedExponent & 0x3fff).shiftLeft(49));\n dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x1ffffffffffff)));\n }\n\n dec.low = significand.low;\n\n // Encode sign\n if (isNegative) {\n dec.high = dec.high.or(Long.fromString('9223372036854775808'));\n }\n\n // Encode into a buffer\n var buffer = new Buffer(16);\n var index = 0;\n\n // Encode the low 64 bits of the decimal\n // Encode low bits\n buffer[index++] = dec.low.low_ & 0xff;\n buffer[index++] = dec.low.low_ >> 8 & 0xff;\n buffer[index++] = dec.low.low_ >> 16 & 0xff;\n buffer[index++] = dec.low.low_ >> 24 & 0xff;\n // Encode high bits\n buffer[index++] = dec.low.high_ & 0xff;\n buffer[index++] = dec.low.high_ >> 8 & 0xff;\n buffer[index++] = dec.low.high_ >> 16 & 0xff;\n buffer[index++] = dec.low.high_ >> 24 & 0xff;\n\n // Encode the high 64 bits of the decimal\n // Encode low bits\n buffer[index++] = dec.high.low_ & 0xff;\n buffer[index++] = dec.high.low_ >> 8 & 0xff;\n buffer[index++] = dec.high.low_ >> 16 & 0xff;\n buffer[index++] = dec.high.low_ >> 24 & 0xff;\n // Encode high bits\n buffer[index++] = dec.high.high_ & 0xff;\n buffer[index++] = dec.high.high_ >> 8 & 0xff;\n buffer[index++] = dec.high.high_ >> 16 & 0xff;\n buffer[index++] = dec.high.high_ >> 24 & 0xff;\n\n // Return the new Decimal128\n return new Decimal128(buffer);\n};\n\n// Extract least significant 5 bits\nvar COMBINATION_MASK = 0x1f;\n// Extract least significant 14 bits\nvar EXPONENT_MASK = 0x3fff;\n// Value of combination field for Inf\nvar COMBINATION_INFINITY = 30;\n// Value of combination field for NaN\nvar COMBINATION_NAN = 31;\n// Value of combination field for NaN\nvar COMBINATION_SNAN = 32;\n// decimal128 exponent bias\nvar EXPONENT_BIAS = 6176;\n\nDecimal128.prototype.toString = function () {\n // Note: bits in this routine are referred to starting at 0,\n // from the sign bit, towards the coefficient.\n\n // bits 0 - 31\n var high;\n // bits 32 - 63\n var midh;\n // bits 64 - 95\n var midl;\n // bits 96 - 127\n var low;\n // bits 1 - 5\n var combination;\n // decoded biased exponent (14 bits)\n var biased_exponent;\n // the number of significand digits\n var significand_digits = 0;\n // the base-10 digits in the significand\n var significand = new Array(36);\n for (var i = 0; i < significand.length; i++) {\n significand[i] = 0;\n } // read pointer into significand\n var index = 0;\n\n // unbiased exponent\n var exponent;\n // the exponent if scientific notation is used\n var scientific_exponent;\n\n // true if the number is zero\n var is_zero = false;\n\n // the most signifcant significand bits (50-46)\n var significand_msb;\n // temporary storage for significand decoding\n var significand128 = { parts: new Array(4) };\n // indexing variables\n var i;\n var j, k;\n\n // Output string\n var string = [];\n\n // Unpack index\n var index = 0;\n\n // Buffer reference\n var buffer = this.bytes;\n\n // Unpack the low 64bits into a long\n low = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n midl = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n // Unpack the high 64bits into a long\n midh = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n high = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n // Unpack index\n var index = 0;\n\n // Create the state of the decimal\n var dec = {\n low: new Long(low, midl),\n high: new Long(midh, high) };\n\n if (dec.high.lessThan(Long.ZERO)) {\n string.push('-');\n }\n\n // Decode combination field and exponent\n combination = high >> 26 & COMBINATION_MASK;\n\n if (combination >> 3 == 3) {\n // Check for 'special' values\n if (combination == COMBINATION_INFINITY) {\n return string.join('') + \"Infinity\";\n } else if (combination == COMBINATION_NAN) {\n return \"NaN\";\n } else {\n biased_exponent = high >> 15 & EXPONENT_MASK;\n significand_msb = 0x08 + (high >> 14 & 0x01);\n }\n } else {\n significand_msb = high >> 14 & 0x07;\n biased_exponent = high >> 17 & EXPONENT_MASK;\n }\n\n exponent = biased_exponent - EXPONENT_BIAS;\n\n // Create string of significand digits\n\n // Convert the 114-bit binary number represented by\n // (significand_high, significand_low) to at most 34 decimal\n // digits through modulo and division.\n significand128.parts[0] = (high & 0x3fff) + ((significand_msb & 0xf) << 14);\n significand128.parts[1] = midh;\n significand128.parts[2] = midl;\n significand128.parts[3] = low;\n\n if (significand128.parts[0] == 0 && significand128.parts[1] == 0 && significand128.parts[2] == 0 && significand128.parts[3] == 0) {\n is_zero = true;\n } else {\n for (var k = 3; k >= 0; k--) {\n var least_digits = 0;\n // Peform the divide\n var result = divideu128(significand128);\n significand128 = result.quotient;\n least_digits = result.rem.low_;\n\n // We now have the 9 least significant digits (in base 2).\n // Convert and output to string.\n if (!least_digits) continue;\n\n for (var j = 8; j >= 0; j--) {\n // significand[k * 9 + j] = Math.round(least_digits % 10);\n significand[k * 9 + j] = least_digits % 10;\n // least_digits = Math.round(least_digits / 10);\n least_digits = Math.floor(least_digits / 10);\n }\n }\n }\n\n // Output format options:\n // Scientific - [-]d.dddE(+/-)dd or [-]dE(+/-)dd\n // Regular - ddd.ddd\n\n if (is_zero) {\n significand_digits = 1;\n significand[index] = 0;\n } else {\n significand_digits = 36;\n var i = 0;\n\n while (!significand[index]) {\n i++;\n significand_digits = significand_digits - 1;\n index = index + 1;\n }\n }\n\n scientific_exponent = significand_digits - 1 + exponent;\n\n // The scientific exponent checks are dictated by the string conversion\n // specification and are somewhat arbitrary cutoffs.\n //\n // We must check exponent > 0, because if this is the case, the number\n // has trailing zeros. However, we *cannot* output these trailing zeros,\n // because doing so would change the precision of the value, and would\n // change stored data if the string converted number is round tripped.\n\n if (scientific_exponent >= 34 || scientific_exponent <= -7 || exponent > 0) {\n // Scientific format\n string.push(significand[index++]);\n significand_digits = significand_digits - 1;\n\n if (significand_digits) {\n string.push('.');\n }\n\n for (var i = 0; i < significand_digits; i++) {\n string.push(significand[index++]);\n }\n\n // Exponent\n string.push('E');\n if (scientific_exponent > 0) {\n string.push('+' + scientific_exponent);\n } else {\n string.push(scientific_exponent);\n }\n } else {\n // Regular format with no decimal place\n if (exponent >= 0) {\n for (var i = 0; i < significand_digits; i++) {\n string.push(significand[index++]);\n }\n } else {\n var radix_position = significand_digits + exponent;\n\n // non-zero digits before radix\n if (radix_position > 0) {\n for (var i = 0; i < radix_position; i++) {\n string.push(significand[index++]);\n }\n } else {\n string.push('0');\n }\n\n string.push('.');\n // add leading zeros after radix\n while (radix_position++ < 0) {\n string.push('0');\n }\n\n for (var i = 0; i < significand_digits - Math.max(radix_position - 1, 0); i++) {\n string.push(significand[index++]);\n }\n }\n }\n\n return string.join('');\n};\n\nDecimal128.prototype.toJSON = function () {\n return { \"$numberDecimal\": this.toString() };\n};\n\nmodule.exports = Decimal128;\nmodule.exports.Decimal128 = Decimal128;\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * A class representation of the BSON Double type.\n *\n * @class\n * @param {number} value the number we want to represent as a double.\n * @return {Double}\n */\nfunction Double(value) {\n if (!(this instanceof Double)) return new Double(value);\n\n this._bsontype = 'Double';\n this.value = value;\n}\n\n/**\n * Access the number value.\n *\n * @method\n * @return {number} returns the wrapped double number.\n */\nDouble.prototype.valueOf = function () {\n return this.value;\n};\n\n/**\n * @ignore\n */\nDouble.prototype.toJSON = function () {\n return this.value;\n};\n\nmodule.exports = Double;\nmodule.exports.Double = Double;\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * A class representation of the BSON MaxKey type.\n *\n * @class\n * @return {MaxKey} A MaxKey instance\n */\nfunction MaxKey() {\n if (!(this instanceof MaxKey)) return new MaxKey();\n\n this._bsontype = 'MaxKey';\n}\n\nmodule.exports = MaxKey;\nmodule.exports.MaxKey = MaxKey;\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * A class representation of the BSON MinKey type.\n *\n * @class\n * @return {MinKey} A MinKey instance\n */\nfunction MinKey() {\n if (!(this instanceof MinKey)) return new MinKey();\n\n this._bsontype = 'MinKey';\n}\n\nmodule.exports = MinKey;\nmodule.exports.MinKey = MinKey;\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Buffer, process) {\n\n/**\n * Machine id.\n *\n * Create a random 3-byte value (i.e. unique for this\n * process). Other drivers use a md5 of the machine id here, but\n * that would mean an asyc call to gethostname, so we don't bother.\n * @ignore\n */\nvar MACHINE_ID = parseInt(Math.random() * 0xFFFFFF, 10);\n\n// Regular expression that checks for hex value\nvar checkForHexRegExp = new RegExp(\"^[0-9a-fA-F]{24}$\");\nvar hasBufferType = false;\n\n// Check if buffer exists\ntry {\n if (Buffer && Buffer.from) hasBufferType = true;\n} catch (err) {};\n\n/**\n* Create a new ObjectID instance\n*\n* @class\n* @param {(string|number)} id Can be a 24 byte hex string, 12 byte binary string or a Number.\n* @property {number} generationTime The generation time of this ObjectId instance\n* @return {ObjectID} instance of ObjectID.\n*/\nvar ObjectID = function ObjectID(id) {\n // Duck-typing to support ObjectId from different npm packages\n if (id instanceof ObjectID) return id;\n if (!(this instanceof ObjectID)) return new ObjectID(id);\n\n this._bsontype = 'ObjectID';\n\n // The most common usecase (blank id, new objectId instance)\n if (id == null || typeof id == 'number') {\n // Generate a new id\n this.id = this.generate(id);\n // If we are caching the hex string\n if (ObjectID.cacheHexString) this.__id = this.toString('hex');\n // Return the object\n return;\n }\n\n // Check if the passed in id is valid\n var valid = ObjectID.isValid(id);\n\n // Throw an error if it's not a valid setup\n if (!valid && id != null) {\n throw new Error(\"Argument passed in must be a single String of 12 bytes or a string of 24 hex characters\");\n } else if (valid && typeof id == 'string' && id.length == 24 && hasBufferType) {\n return new ObjectID(new Buffer(id, 'hex'));\n } else if (valid && typeof id == 'string' && id.length == 24) {\n return ObjectID.createFromHexString(id);\n } else if (id != null && id.length === 12) {\n // assume 12 byte string\n this.id = id;\n } else if (id != null && id.toHexString) {\n // Duck-typing to support ObjectId from different npm packages\n return id;\n } else {\n throw new Error(\"Argument passed in must be a single String of 12 bytes or a string of 24 hex characters\");\n }\n\n if (ObjectID.cacheHexString) this.__id = this.toString('hex');\n};\n\n// Allow usage of ObjectId as well as ObjectID\nvar ObjectId = ObjectID;\n\n// Precomputed hex table enables speedy hex string conversion\nvar hexTable = [];\nfor (var i = 0; i < 256; i++) {\n hexTable[i] = (i <= 15 ? '0' : '') + i.toString(16);\n}\n\n/**\n* Return the ObjectID id as a 24 byte hex string representation\n*\n* @method\n* @return {string} return the 24 byte hex string representation.\n*/\nObjectID.prototype.toHexString = function () {\n if (ObjectID.cacheHexString && this.__id) return this.__id;\n\n var hexString = '';\n if (!this.id || !this.id.length) {\n throw new Error('invalid ObjectId, ObjectId.id must be either a string or a Buffer, but is [' + JSON.stringify(this.id) + ']');\n }\n\n if (this.id instanceof _Buffer) {\n hexString = convertToHex(this.id);\n if (ObjectID.cacheHexString) this.__id = hexString;\n return hexString;\n }\n\n for (var i = 0; i < this.id.length; i++) {\n hexString += hexTable[this.id.charCodeAt(i)];\n }\n\n if (ObjectID.cacheHexString) this.__id = hexString;\n return hexString;\n};\n\n/**\n* Update the ObjectID index used in generating new ObjectID's on the driver\n*\n* @method\n* @return {number} returns next index value.\n* @ignore\n*/\nObjectID.prototype.get_inc = function () {\n return ObjectID.index = (ObjectID.index + 1) % 0xFFFFFF;\n};\n\n/**\n* Update the ObjectID index used in generating new ObjectID's on the driver\n*\n* @method\n* @return {number} returns next index value.\n* @ignore\n*/\nObjectID.prototype.getInc = function () {\n return this.get_inc();\n};\n\n/**\n* Generate a 12 byte id buffer used in ObjectID's\n*\n* @method\n* @param {number} [time] optional parameter allowing to pass in a second based timestamp.\n* @return {Buffer} return the 12 byte id buffer string.\n*/\nObjectID.prototype.generate = function (time) {\n if ('number' != typeof time) {\n time = ~~(Date.now() / 1000);\n }\n\n // Use pid\n var pid = (typeof process === 'undefined' ? Math.floor(Math.random() * 100000) : process.pid) % 0xFFFF;\n var inc = this.get_inc();\n // Buffer used\n var buffer = new Buffer(12);\n // Encode time\n buffer[3] = time & 0xff;\n buffer[2] = time >> 8 & 0xff;\n buffer[1] = time >> 16 & 0xff;\n buffer[0] = time >> 24 & 0xff;\n // Encode machine\n buffer[6] = MACHINE_ID & 0xff;\n buffer[5] = MACHINE_ID >> 8 & 0xff;\n buffer[4] = MACHINE_ID >> 16 & 0xff;\n // Encode pid\n buffer[8] = pid & 0xff;\n buffer[7] = pid >> 8 & 0xff;\n // Encode index\n buffer[11] = inc & 0xff;\n buffer[10] = inc >> 8 & 0xff;\n buffer[9] = inc >> 16 & 0xff;\n // Return the buffer\n return buffer;\n};\n\n/**\n* Converts the id into a 24 byte hex string for printing\n*\n* @param {String} format The Buffer toString format parameter.\n* @return {String} return the 24 byte hex string representation.\n* @ignore\n*/\nObjectID.prototype.toString = function (format) {\n // Is the id a buffer then use the buffer toString method to return the format\n if (this.id && this.id.copy) {\n return this.id.toString(typeof format === 'string' ? format : 'hex');\n }\n\n // if(this.buffer )\n return this.toHexString();\n};\n\n/**\n* Converts to a string representation of this Id.\n*\n* @return {String} return the 24 byte hex string representation.\n* @ignore\n*/\nObjectID.prototype.inspect = ObjectID.prototype.toString;\n\n/**\n* Converts to its JSON representation.\n*\n* @return {String} return the 24 byte hex string representation.\n* @ignore\n*/\nObjectID.prototype.toJSON = function () {\n return this.toHexString();\n};\n\n/**\n* Compares the equality of this ObjectID with `otherID`.\n*\n* @method\n* @param {object} otherID ObjectID instance to compare against.\n* @return {boolean} the result of comparing two ObjectID's\n*/\nObjectID.prototype.equals = function equals(otherId) {\n var id;\n\n if (otherId instanceof ObjectID) {\n return this.toString() == otherId.toString();\n } else if (typeof otherId == 'string' && ObjectID.isValid(otherId) && otherId.length == 12 && this.id instanceof _Buffer) {\n return otherId === this.id.toString('binary');\n } else if (typeof otherId == 'string' && ObjectID.isValid(otherId) && otherId.length == 24) {\n return otherId.toLowerCase() === this.toHexString();\n } else if (typeof otherId == 'string' && ObjectID.isValid(otherId) && otherId.length == 12) {\n return otherId === this.id;\n } else if (otherId != null && (otherId instanceof ObjectID || otherId.toHexString)) {\n return otherId.toHexString() === this.toHexString();\n } else {\n return false;\n }\n};\n\n/**\n* Returns the generation date (accurate up to the second) that this ID was generated.\n*\n* @method\n* @return {date} the generation date\n*/\nObjectID.prototype.getTimestamp = function () {\n var timestamp = new Date();\n var time = this.id[3] | this.id[2] << 8 | this.id[1] << 16 | this.id[0] << 24;\n timestamp.setTime(Math.floor(time) * 1000);\n return timestamp;\n};\n\n/**\n* @ignore\n*/\nObjectID.index = ~~(Math.random() * 0xFFFFFF);\n\n/**\n* @ignore\n*/\nObjectID.createPk = function createPk() {\n return new ObjectID();\n};\n\n/**\n* Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID.\n*\n* @method\n* @param {number} time an integer number representing a number of seconds.\n* @return {ObjectID} return the created ObjectID\n*/\nObjectID.createFromTime = function createFromTime(time) {\n var buffer = new Buffer([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);\n // Encode time into first 4 bytes\n buffer[3] = time & 0xff;\n buffer[2] = time >> 8 & 0xff;\n buffer[1] = time >> 16 & 0xff;\n buffer[0] = time >> 24 & 0xff;\n // Return the new objectId\n return new ObjectID(buffer);\n};\n\n// Lookup tables\nvar encodeLookup = '0123456789abcdef'.split('');\nvar decodeLookup = [];\nvar i = 0;\nwhile (i < 10) {\n decodeLookup[0x30 + i] = i++;\n}while (i < 16) {\n decodeLookup[0x41 - 10 + i] = decodeLookup[0x61 - 10 + i] = i++;\n}var _Buffer = Buffer;\nvar convertToHex = function convertToHex(bytes) {\n return bytes.toString('hex');\n};\n\n/**\n* Creates an ObjectID from a hex string representation of an ObjectID.\n*\n* @method\n* @param {string} hexString create a ObjectID from a passed in 24 byte hexstring.\n* @return {ObjectID} return the created ObjectID\n*/\nObjectID.createFromHexString = function createFromHexString(string) {\n // Throw an error if it's not a valid setup\n if (typeof string === 'undefined' || string != null && string.length != 24) {\n throw new Error(\"Argument passed in must be a single String of 12 bytes or a string of 24 hex characters\");\n }\n\n // Use Buffer.from method if available\n if (hasBufferType) return new ObjectID(new Buffer(string, 'hex'));\n\n // Calculate lengths\n var array = new _Buffer(12);\n var n = 0;\n var i = 0;\n\n while (i < 24) {\n array[n++] = decodeLookup[string.charCodeAt(i++)] << 4 | decodeLookup[string.charCodeAt(i++)];\n }\n\n return new ObjectID(array);\n};\n\n/**\n* Checks if a value is a valid bson ObjectId\n*\n* @method\n* @return {boolean} return true if the value is a valid bson ObjectId, return false otherwise.\n*/\nObjectID.isValid = function isValid(id) {\n if (id == null) return false;\n\n if (typeof id == 'number') {\n return true;\n }\n\n if (typeof id == 'string') {\n return id.length == 12 || id.length == 24 && checkForHexRegExp.test(id);\n }\n\n if (id instanceof ObjectID) {\n return true;\n }\n\n if (id instanceof _Buffer) {\n return true;\n }\n\n // Duck-Typing detection of ObjectId like objects\n if (id.toHexString) {\n return id.id.length == 12 || id.id.length == 24 && checkForHexRegExp.test(id.id);\n }\n\n return false;\n};\n\n/**\n* @ignore\n*/\nObject.defineProperty(ObjectID.prototype, \"generationTime\", {\n enumerable: true,\n get: function get() {\n return this.id[3] | this.id[2] << 8 | this.id[1] << 16 | this.id[0] << 24;\n },\n set: function set(value) {\n // Encode time into first 4 bytes\n this.id[3] = value & 0xff;\n this.id[2] = value >> 8 & 0xff;\n this.id[1] = value >> 16 & 0xff;\n this.id[0] = value >> 24 & 0xff;\n }\n});\n\n/**\n * Expose.\n */\nmodule.exports = ObjectID;\nmodule.exports.ObjectID = ObjectID;\nmodule.exports.ObjectId = ObjectID;\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer, __webpack_require__(23)))\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * A class representation of the BSON RegExp type.\n *\n * @class\n * @return {BSONRegExp} A MinKey instance\n */\nfunction BSONRegExp(pattern, options) {\n if (!(this instanceof BSONRegExp)) return new BSONRegExp();\n\n // Execute\n this._bsontype = 'BSONRegExp';\n this.pattern = pattern || '';\n this.options = options || '';\n\n // Validate options\n for (var i = 0; i < this.options.length; i++) {\n if (!(this.options[i] == 'i' || this.options[i] == 'm' || this.options[i] == 'x' || this.options[i] == 'l' || this.options[i] == 's' || this.options[i] == 'u')) {\n throw new Error('the regular expression options [' + this.options[i] + \"] is not supported\");\n }\n }\n}\n\nmodule.exports = BSONRegExp;\nmodule.exports.BSONRegExp = BSONRegExp;\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * A class representation of the BSON Symbol type.\n *\n * @class\n * @deprecated\n * @param {string} value the string representing the symbol.\n * @return {Symbol}\n */\nfunction _Symbol(value) {\n if (!(this instanceof _Symbol)) return new _Symbol(value);\n this._bsontype = 'Symbol';\n this.value = value;\n}\n\n/**\n * Access the wrapped string value.\n *\n * @method\n * @return {String} returns the wrapped string.\n */\n_Symbol.prototype.valueOf = function () {\n return this.value;\n};\n\n/**\n * @ignore\n */\n_Symbol.prototype.toString = function () {\n return this.value;\n};\n\n/**\n * @ignore\n */\n_Symbol.prototype.inspect = function () {\n return this.value;\n};\n\n/**\n * @ignore\n */\n_Symbol.prototype.toJSON = function () {\n return this.value;\n};\n\nmodule.exports = _Symbol;\nmodule.exports.Symbol = _Symbol;\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n// Copyright 2009 Google Inc. All Rights Reserved\n\n/**\n * This type is for INTERNAL use in MongoDB only and should not be used in applications.\n * The appropriate corresponding type is the JavaScript Date type.\n * \n * Defines a Timestamp class for representing a 64-bit two's-complement\n * integer value, which faithfully simulates the behavior of a Java \"Timestamp\". This\n * implementation is derived from TimestampLib in GWT.\n *\n * Constructs a 64-bit two's-complement integer, given its low and high 32-bit\n * values as *signed* integers. See the from* functions below for more\n * convenient ways of constructing Timestamps.\n *\n * The internal representation of a Timestamp is the two given signed, 32-bit values.\n * We use 32-bit pieces because these are the size of integers on which\n * Javascript performs bit-operations. For operations like addition and\n * multiplication, we split each number into 16-bit pieces, which can easily be\n * multiplied within Javascript's floating-point representation without overflow\n * or change in sign.\n *\n * In the algorithms below, we frequently reduce the negative case to the\n * positive case by negating the input(s) and then post-processing the result.\n * Note that we must ALWAYS check specially whether those values are MIN_VALUE\n * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\n * a positive number, it overflows back into a negative). Not handling this\n * case would often result in infinite recursion.\n *\n * @class\n * @param {number} low the low (signed) 32 bits of the Timestamp.\n * @param {number} high the high (signed) 32 bits of the Timestamp.\n */\nfunction Timestamp(low, high) {\n if (!(this instanceof Timestamp)) return new Timestamp(low, high);\n this._bsontype = 'Timestamp';\n /**\n * @type {number}\n * @ignore\n */\n this.low_ = low | 0; // force into 32 signed bits.\n\n /**\n * @type {number}\n * @ignore\n */\n this.high_ = high | 0; // force into 32 signed bits.\n};\n\n/**\n * Return the int value.\n *\n * @return {number} the value, assuming it is a 32-bit integer.\n */\nTimestamp.prototype.toInt = function () {\n return this.low_;\n};\n\n/**\n * Return the Number value.\n *\n * @method\n * @return {number} the closest floating-point representation to this value.\n */\nTimestamp.prototype.toNumber = function () {\n return this.high_ * Timestamp.TWO_PWR_32_DBL_ + this.getLowBitsUnsigned();\n};\n\n/**\n * Return the JSON value.\n *\n * @method\n * @return {string} the JSON representation.\n */\nTimestamp.prototype.toJSON = function () {\n return this.toString();\n};\n\n/**\n * Return the String value.\n *\n * @method\n * @param {number} [opt_radix] the radix in which the text should be written.\n * @return {string} the textual representation of this value.\n */\nTimestamp.prototype.toString = function (opt_radix) {\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (this.isZero()) {\n return '0';\n }\n\n if (this.isNegative()) {\n if (this.equals(Timestamp.MIN_VALUE)) {\n // We need to change the Timestamp value before it can be negated, so we remove\n // the bottom-most digit in this base and then recurse to do the rest.\n var radixTimestamp = Timestamp.fromNumber(radix);\n var div = this.div(radixTimestamp);\n var rem = div.multiply(radixTimestamp).subtract(this);\n return div.toString(radix) + rem.toInt().toString(radix);\n } else {\n return '-' + this.negate().toString(radix);\n }\n }\n\n // Do several (6) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Timestamp.fromNumber(Math.pow(radix, 6));\n\n var rem = this;\n var result = '';\n while (true) {\n var remDiv = rem.div(radixToPower);\n var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt();\n var digits = intval.toString(radix);\n\n rem = remDiv;\n if (rem.isZero()) {\n return digits + result;\n } else {\n while (digits.length < 6) {\n digits = '0' + digits;\n }\n result = '' + digits + result;\n }\n }\n};\n\n/**\n * Return the high 32-bits value.\n *\n * @method\n * @return {number} the high 32-bits as a signed value.\n */\nTimestamp.prototype.getHighBits = function () {\n return this.high_;\n};\n\n/**\n * Return the low 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as a signed value.\n */\nTimestamp.prototype.getLowBits = function () {\n return this.low_;\n};\n\n/**\n * Return the low unsigned 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as an unsigned value.\n */\nTimestamp.prototype.getLowBitsUnsigned = function () {\n return this.low_ >= 0 ? this.low_ : Timestamp.TWO_PWR_32_DBL_ + this.low_;\n};\n\n/**\n * Returns the number of bits needed to represent the absolute value of this Timestamp.\n *\n * @method\n * @return {number} Returns the number of bits needed to represent the absolute value of this Timestamp.\n */\nTimestamp.prototype.getNumBitsAbs = function () {\n if (this.isNegative()) {\n if (this.equals(Timestamp.MIN_VALUE)) {\n return 64;\n } else {\n return this.negate().getNumBitsAbs();\n }\n } else {\n var val = this.high_ != 0 ? this.high_ : this.low_;\n for (var bit = 31; bit > 0; bit--) {\n if ((val & 1 << bit) != 0) {\n break;\n }\n }\n return this.high_ != 0 ? bit + 33 : bit + 1;\n }\n};\n\n/**\n * Return whether this value is zero.\n *\n * @method\n * @return {boolean} whether this value is zero.\n */\nTimestamp.prototype.isZero = function () {\n return this.high_ == 0 && this.low_ == 0;\n};\n\n/**\n * Return whether this value is negative.\n *\n * @method\n * @return {boolean} whether this value is negative.\n */\nTimestamp.prototype.isNegative = function () {\n return this.high_ < 0;\n};\n\n/**\n * Return whether this value is odd.\n *\n * @method\n * @return {boolean} whether this value is odd.\n */\nTimestamp.prototype.isOdd = function () {\n return (this.low_ & 1) == 1;\n};\n\n/**\n * Return whether this Timestamp equals the other\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp equals the other\n */\nTimestamp.prototype.equals = function (other) {\n return this.high_ == other.high_ && this.low_ == other.low_;\n};\n\n/**\n * Return whether this Timestamp does not equal the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp does not equal the other.\n */\nTimestamp.prototype.notEquals = function (other) {\n return this.high_ != other.high_ || this.low_ != other.low_;\n};\n\n/**\n * Return whether this Timestamp is less than the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is less than the other.\n */\nTimestamp.prototype.lessThan = function (other) {\n return this.compare(other) < 0;\n};\n\n/**\n * Return whether this Timestamp is less than or equal to the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is less than or equal to the other.\n */\nTimestamp.prototype.lessThanOrEqual = function (other) {\n return this.compare(other) <= 0;\n};\n\n/**\n * Return whether this Timestamp is greater than the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is greater than the other.\n */\nTimestamp.prototype.greaterThan = function (other) {\n return this.compare(other) > 0;\n};\n\n/**\n * Return whether this Timestamp is greater than or equal to the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is greater than or equal to the other.\n */\nTimestamp.prototype.greaterThanOrEqual = function (other) {\n return this.compare(other) >= 0;\n};\n\n/**\n * Compares this Timestamp with the given one.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater.\n */\nTimestamp.prototype.compare = function (other) {\n if (this.equals(other)) {\n return 0;\n }\n\n var thisNeg = this.isNegative();\n var otherNeg = other.isNegative();\n if (thisNeg && !otherNeg) {\n return -1;\n }\n if (!thisNeg && otherNeg) {\n return 1;\n }\n\n // at this point, the signs are the same, so subtraction will not overflow\n if (this.subtract(other).isNegative()) {\n return -1;\n } else {\n return 1;\n }\n};\n\n/**\n * The negation of this value.\n *\n * @method\n * @return {Timestamp} the negation of this value.\n */\nTimestamp.prototype.negate = function () {\n if (this.equals(Timestamp.MIN_VALUE)) {\n return Timestamp.MIN_VALUE;\n } else {\n return this.not().add(Timestamp.ONE);\n }\n};\n\n/**\n * Returns the sum of this and the given Timestamp.\n *\n * @method\n * @param {Timestamp} other Timestamp to add to this one.\n * @return {Timestamp} the sum of this and the given Timestamp.\n */\nTimestamp.prototype.add = function (other) {\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0,\n c32 = 0,\n c16 = 0,\n c00 = 0;\n c00 += a00 + b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 + b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 + b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 + b48;\n c48 &= 0xFFFF;\n return Timestamp.fromBits(c16 << 16 | c00, c48 << 16 | c32);\n};\n\n/**\n * Returns the difference of this and the given Timestamp.\n *\n * @method\n * @param {Timestamp} other Timestamp to subtract from this.\n * @return {Timestamp} the difference of this and the given Timestamp.\n */\nTimestamp.prototype.subtract = function (other) {\n return this.add(other.negate());\n};\n\n/**\n * Returns the product of this and the given Timestamp.\n *\n * @method\n * @param {Timestamp} other Timestamp to multiply with this.\n * @return {Timestamp} the product of this and the other.\n */\nTimestamp.prototype.multiply = function (other) {\n if (this.isZero()) {\n return Timestamp.ZERO;\n } else if (other.isZero()) {\n return Timestamp.ZERO;\n }\n\n if (this.equals(Timestamp.MIN_VALUE)) {\n return other.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO;\n } else if (other.equals(Timestamp.MIN_VALUE)) {\n return this.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().multiply(other.negate());\n } else {\n return this.negate().multiply(other).negate();\n }\n } else if (other.isNegative()) {\n return this.multiply(other.negate()).negate();\n }\n\n // If both Timestamps are small, use float multiplication\n if (this.lessThan(Timestamp.TWO_PWR_24_) && other.lessThan(Timestamp.TWO_PWR_24_)) {\n return Timestamp.fromNumber(this.toNumber() * other.toNumber());\n }\n\n // Divide each Timestamp into 4 chunks of 16 bits, and then add up 4x4 products.\n // We can skip products that would overflow.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0,\n c32 = 0,\n c16 = 0,\n c00 = 0;\n c00 += a00 * b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 * b00;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c16 += a00 * b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 * b00;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a16 * b16;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a00 * b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\n c48 &= 0xFFFF;\n return Timestamp.fromBits(c16 << 16 | c00, c48 << 16 | c32);\n};\n\n/**\n * Returns this Timestamp divided by the given one.\n *\n * @method\n * @param {Timestamp} other Timestamp by which to divide.\n * @return {Timestamp} this Timestamp divided by the given one.\n */\nTimestamp.prototype.div = function (other) {\n if (other.isZero()) {\n throw Error('division by zero');\n } else if (this.isZero()) {\n return Timestamp.ZERO;\n }\n\n if (this.equals(Timestamp.MIN_VALUE)) {\n if (other.equals(Timestamp.ONE) || other.equals(Timestamp.NEG_ONE)) {\n return Timestamp.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\n } else if (other.equals(Timestamp.MIN_VALUE)) {\n return Timestamp.ONE;\n } else {\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\n var halfThis = this.shiftRight(1);\n var approx = halfThis.div(other).shiftLeft(1);\n if (approx.equals(Timestamp.ZERO)) {\n return other.isNegative() ? Timestamp.ONE : Timestamp.NEG_ONE;\n } else {\n var rem = this.subtract(other.multiply(approx));\n var result = approx.add(rem.div(other));\n return result;\n }\n }\n } else if (other.equals(Timestamp.MIN_VALUE)) {\n return Timestamp.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().div(other.negate());\n } else {\n return this.negate().div(other).negate();\n }\n } else if (other.isNegative()) {\n return this.div(other.negate()).negate();\n }\n\n // Repeat the following until the remainder is less than other: find a\n // floating-point that approximates remainder / other *from below*, add this\n // into the result, and subtract it from the remainder. It is critical that\n // the approximate value is less than or equal to the real value so that the\n // remainder never becomes negative.\n var res = Timestamp.ZERO;\n var rem = this;\n while (rem.greaterThanOrEqual(other)) {\n // Approximate the result of division. This may be a little greater or\n // smaller than the actual value.\n var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber()));\n\n // We will tweak the approximate result by changing it in the 48-th digit or\n // the smallest non-fractional digit, whichever is larger.\n var log2 = Math.ceil(Math.log(approx) / Math.LN2);\n var delta = log2 <= 48 ? 1 : Math.pow(2, log2 - 48);\n\n // Decrease the approximation until it is smaller than the remainder. Note\n // that if it is too large, the product overflows and is negative.\n var approxRes = Timestamp.fromNumber(approx);\n var approxRem = approxRes.multiply(other);\n while (approxRem.isNegative() || approxRem.greaterThan(rem)) {\n approx -= delta;\n approxRes = Timestamp.fromNumber(approx);\n approxRem = approxRes.multiply(other);\n }\n\n // We know the answer can't be zero... and actually, zero would cause\n // infinite recursion since we would make no progress.\n if (approxRes.isZero()) {\n approxRes = Timestamp.ONE;\n }\n\n res = res.add(approxRes);\n rem = rem.subtract(approxRem);\n }\n return res;\n};\n\n/**\n * Returns this Timestamp modulo the given one.\n *\n * @method\n * @param {Timestamp} other Timestamp by which to mod.\n * @return {Timestamp} this Timestamp modulo the given one.\n */\nTimestamp.prototype.modulo = function (other) {\n return this.subtract(this.div(other).multiply(other));\n};\n\n/**\n * The bitwise-NOT of this value.\n *\n * @method\n * @return {Timestamp} the bitwise-NOT of this value.\n */\nTimestamp.prototype.not = function () {\n return Timestamp.fromBits(~this.low_, ~this.high_);\n};\n\n/**\n * Returns the bitwise-AND of this Timestamp and the given one.\n *\n * @method\n * @param {Timestamp} other the Timestamp with which to AND.\n * @return {Timestamp} the bitwise-AND of this and the other.\n */\nTimestamp.prototype.and = function (other) {\n return Timestamp.fromBits(this.low_ & other.low_, this.high_ & other.high_);\n};\n\n/**\n * Returns the bitwise-OR of this Timestamp and the given one.\n *\n * @method\n * @param {Timestamp} other the Timestamp with which to OR.\n * @return {Timestamp} the bitwise-OR of this and the other.\n */\nTimestamp.prototype.or = function (other) {\n return Timestamp.fromBits(this.low_ | other.low_, this.high_ | other.high_);\n};\n\n/**\n * Returns the bitwise-XOR of this Timestamp and the given one.\n *\n * @method\n * @param {Timestamp} other the Timestamp with which to XOR.\n * @return {Timestamp} the bitwise-XOR of this and the other.\n */\nTimestamp.prototype.xor = function (other) {\n return Timestamp.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_);\n};\n\n/**\n * Returns this Timestamp with bits shifted to the left by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Timestamp} this shifted to the left by the given amount.\n */\nTimestamp.prototype.shiftLeft = function (numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var low = this.low_;\n if (numBits < 32) {\n var high = this.high_;\n return Timestamp.fromBits(low << numBits, high << numBits | low >>> 32 - numBits);\n } else {\n return Timestamp.fromBits(0, low << numBits - 32);\n }\n }\n};\n\n/**\n * Returns this Timestamp with bits shifted to the right by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Timestamp} this shifted to the right by the given amount.\n */\nTimestamp.prototype.shiftRight = function (numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Timestamp.fromBits(low >>> numBits | high << 32 - numBits, high >> numBits);\n } else {\n return Timestamp.fromBits(high >> numBits - 32, high >= 0 ? 0 : -1);\n }\n }\n};\n\n/**\n * Returns this Timestamp with bits shifted to the right by the given amount, with the new top bits matching the current sign bit.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Timestamp} this shifted to the right by the given amount, with zeros placed into the new leading bits.\n */\nTimestamp.prototype.shiftRightUnsigned = function (numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Timestamp.fromBits(low >>> numBits | high << 32 - numBits, high >>> numBits);\n } else if (numBits == 32) {\n return Timestamp.fromBits(high, 0);\n } else {\n return Timestamp.fromBits(high >>> numBits - 32, 0);\n }\n }\n};\n\n/**\n * Returns a Timestamp representing the given (32-bit) integer value.\n *\n * @method\n * @param {number} value the 32-bit integer in question.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromInt = function (value) {\n if (-128 <= value && value < 128) {\n var cachedObj = Timestamp.INT_CACHE_[value];\n if (cachedObj) {\n return cachedObj;\n }\n }\n\n var obj = new Timestamp(value | 0, value < 0 ? -1 : 0);\n if (-128 <= value && value < 128) {\n Timestamp.INT_CACHE_[value] = obj;\n }\n return obj;\n};\n\n/**\n * Returns a Timestamp representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n *\n * @method\n * @param {number} value the number in question.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromNumber = function (value) {\n if (isNaN(value) || !isFinite(value)) {\n return Timestamp.ZERO;\n } else if (value <= -Timestamp.TWO_PWR_63_DBL_) {\n return Timestamp.MIN_VALUE;\n } else if (value + 1 >= Timestamp.TWO_PWR_63_DBL_) {\n return Timestamp.MAX_VALUE;\n } else if (value < 0) {\n return Timestamp.fromNumber(-value).negate();\n } else {\n return new Timestamp(value % Timestamp.TWO_PWR_32_DBL_ | 0, value / Timestamp.TWO_PWR_32_DBL_ | 0);\n }\n};\n\n/**\n * Returns a Timestamp representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits.\n *\n * @method\n * @param {number} lowBits the low 32-bits.\n * @param {number} highBits the high 32-bits.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromBits = function (lowBits, highBits) {\n return new Timestamp(lowBits, highBits);\n};\n\n/**\n * Returns a Timestamp representation of the given string, written using the given radix.\n *\n * @method\n * @param {string} str the textual representation of the Timestamp.\n * @param {number} opt_radix the radix in which the text is written.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromString = function (str, opt_radix) {\n if (str.length == 0) {\n throw Error('number format error: empty string');\n }\n\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (str.charAt(0) == '-') {\n return Timestamp.fromString(str.substring(1), radix).negate();\n } else if (str.indexOf('-') >= 0) {\n throw Error('number format error: interior \"-\" character: ' + str);\n }\n\n // Do several (8) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Timestamp.fromNumber(Math.pow(radix, 8));\n\n var result = Timestamp.ZERO;\n for (var i = 0; i < str.length; i += 8) {\n var size = Math.min(8, str.length - i);\n var value = parseInt(str.substring(i, i + size), radix);\n if (size < 8) {\n var power = Timestamp.fromNumber(Math.pow(radix, size));\n result = result.multiply(power).add(Timestamp.fromNumber(value));\n } else {\n result = result.multiply(radixToPower);\n result = result.add(Timestamp.fromNumber(value));\n }\n }\n return result;\n};\n\n// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the\n// from* methods on which they depend.\n\n\n/**\n * A cache of the Timestamp representations of small integer values.\n * @type {Object}\n * @ignore\n */\nTimestamp.INT_CACHE_ = {};\n\n// NOTE: the compiler should inline these constant values below and then remove\n// these variables, so there should be no runtime penalty for these.\n\n/**\n * Number used repeated below in calculations. This must appear before the\n * first call to any from* function below.\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_16_DBL_ = 1 << 16;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_24_DBL_ = 1 << 24;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_32_DBL_ = Timestamp.TWO_PWR_16_DBL_ * Timestamp.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_31_DBL_ = Timestamp.TWO_PWR_32_DBL_ / 2;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_48_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_64_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_32_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_63_DBL_ = Timestamp.TWO_PWR_64_DBL_ / 2;\n\n/** @type {Timestamp} */\nTimestamp.ZERO = Timestamp.fromInt(0);\n\n/** @type {Timestamp} */\nTimestamp.ONE = Timestamp.fromInt(1);\n\n/** @type {Timestamp} */\nTimestamp.NEG_ONE = Timestamp.fromInt(-1);\n\n/** @type {Timestamp} */\nTimestamp.MAX_VALUE = Timestamp.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0);\n\n/** @type {Timestamp} */\nTimestamp.MIN_VALUE = Timestamp.fromBits(0, 0x80000000 | 0);\n\n/**\n * @type {Timestamp}\n * @ignore\n */\nTimestamp.TWO_PWR_24_ = Timestamp.fromInt(1 << 24);\n\n/**\n * Expose.\n */\nmodule.exports = Timestamp;\nmodule.exports.Timestamp = Timestamp;\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar USER_AUTH_KEY = exports.USER_AUTH_KEY = '_stitch_ua';\nvar REFRESH_TOKEN_KEY = exports.REFRESH_TOKEN_KEY = '_stitch_rt';\nvar DEVICE_ID_KEY = exports.DEVICE_ID_KEY = '_stitch_did';\nvar STATE_KEY = exports.STATE_KEY = '_stitch_state';\nvar IMPERSONATION_ACTIVE_KEY = exports.IMPERSONATION_ACTIVE_KEY = '_stitch_impers_active';\nvar IMPERSONATION_USER_KEY = exports.IMPERSONATION_USER_KEY = '_stitch_impers_user';\nvar IMPERSONATION_REAL_USER_AUTH_KEY = exports.IMPERSONATION_REAL_USER_AUTH_KEY = '_stitch_impers_real_ua';\nvar USER_AUTH_COOKIE_NAME = exports.USER_AUTH_COOKIE_NAME = 'stitch_ua';\nvar STITCH_ERROR_KEY = exports.STITCH_ERROR_KEY = '_stitch_error';\nvar STITCH_LINK_KEY = exports.STITCH_LINK_KEY = '_stitch_link';\nvar DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS = exports.DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS = 10;\n\nvar APP_CLIENT_CODEC = exports.APP_CLIENT_CODEC = {\n 'accessToken': 'access_token',\n 'refreshToken': 'refresh_token',\n 'deviceId': 'device_id',\n 'userId': 'user_id'\n};\n\nvar ADMIN_CLIENT_CODEC = exports.ADMIN_CLIENT_CODEC = {\n 'accessToken': 'access_token',\n 'refreshToken': 'refresh_token',\n 'deviceId': 'device_id',\n 'userId': 'user_id'\n};\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar JSONTYPE = exports.JSONTYPE = 'application/json';\nvar APP_CLIENT_TYPE = exports.APP_CLIENT_TYPE = 'app';\nvar ADMIN_CLIENT_TYPE = exports.ADMIN_CLIENT_TYPE = 'admin';\nvar DEFAULT_STITCH_SERVER_URL = exports.DEFAULT_STITCH_SERVER_URL = 'https://stitch.mongodb.com';\n\n// VERSION is substituted with the package.json version number at build time\nvar version = 'unknown';\nif (true) {\n version = \"2.3.1\";\n}\nvar SDK_VERSION = exports.SDK_VERSION = version;\n\nvar checkStatus = exports.checkStatus = function checkStatus(response) {\n if (response.status >= 200 && response.status < 300) {\n return response;\n }\n\n var error = new Error(response.statusText);\n error.response = response;\n\n // set error to statusText by default; this will be overwritten when (and if)\n // the response is successfully parsed into json below\n error.error = response.statusText;\n\n return response.json().catch(function () {\n return Promise.reject(error);\n }).then(function (json) {\n return Promise.reject(Object.assign(error, json));\n });\n};\n\nvar makeFetchArgs = exports.makeFetchArgs = function makeFetchArgs(method, body) {\n var init = {\n method: method,\n headers: { 'Accept': JSONTYPE, 'Content-Type': JSONTYPE }\n };\n\n if (body) {\n init.body = body;\n }\n\n init.cors = true;\n return init;\n};\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports) {\n\nvar g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Int32 = function Int32(value) {\n if (!(this instanceof Int32)) return new Int32(value);\n\n this._bsontype = 'Int32';\n this.value = value;\n};\n\n/**\n * Access the number value.\n *\n * @method\n * @return {number} returns the wrapped int32 number.\n */\nInt32.prototype.valueOf = function () {\n return this.value;\n};\n\n/**\n * @ignore\n */\nInt32.prototype.toJSON = function () {\n return this.value;\n};\n\nmodule.exports = Int32;\nmodule.exports.Int32 = Int32;\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* global window, fetch */\n/* eslint no-labels: ['error', { 'allowLoop': true }] */\n\n\n__webpack_require__(22);\n\nvar _auth = __webpack_require__(30);\n\nvar _auth2 = _interopRequireDefault(_auth);\n\nvar _common = __webpack_require__(15);\n\nvar _services = __webpack_require__(37);\n\nvar _services2 = _interopRequireDefault(_services);\n\nvar _common2 = __webpack_require__(16);\n\nvar common = _interopRequireWildcard(_common2);\n\nvar _mongodbExtjson = __webpack_require__(42);\n\nvar _mongodbExtjson2 = _interopRequireDefault(_mongodbExtjson);\n\nvar _queryString = __webpack_require__(69);\n\nvar _queryString2 = _interopRequireDefault(_queryString);\n\nvar _util = __webpack_require__(2);\n\nvar _errors = __webpack_require__(21);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar v1 = 1;\nvar v2 = 2;\nvar v3 = 3;\nvar API_TYPE_PUBLIC = 'public';\nvar API_TYPE_PRIVATE = 'private';\nvar API_TYPE_CLIENT = 'client';\nvar API_TYPE_APP = 'app';\n\n/**\n * Create a new StitchClient instance.\n *\n * @class\n * @return {StitchClient} a StitchClient instance.\n */\n\nvar StitchClient = function () {\n function StitchClient(clientAppID, options) {\n var _v,\n _v2,\n _v3,\n _rootURLsByAPIVersion,\n _this = this;\n\n _classCallCheck(this, StitchClient);\n\n var baseUrl = common.DEFAULT_STITCH_SERVER_URL;\n if (options && options.baseUrl) {\n baseUrl = options.baseUrl;\n }\n\n this.clientAppID = clientAppID;\n\n this.authUrl = clientAppID ? baseUrl + '/api/client/v2.0/app/' + clientAppID + '/auth' : baseUrl + '/api/admin/v3.0/auth';\n\n this.rootURLsByAPIVersion = (_rootURLsByAPIVersion = {}, _defineProperty(_rootURLsByAPIVersion, v1, (_v = {}, _defineProperty(_v, API_TYPE_PUBLIC, baseUrl + '/api/public/v1.0'), _defineProperty(_v, API_TYPE_CLIENT, baseUrl + '/api/client/v1.0'), _defineProperty(_v, API_TYPE_PRIVATE, baseUrl + '/api/private/v1.0'), _defineProperty(_v, API_TYPE_APP, clientAppID ? baseUrl + '/api/client/v1.0/app/' + clientAppID : baseUrl + '/api/public/v1.0'), _v)), _defineProperty(_rootURLsByAPIVersion, v2, (_v2 = {}, _defineProperty(_v2, API_TYPE_PUBLIC, baseUrl + '/api/public/v2.0'), _defineProperty(_v2, API_TYPE_CLIENT, baseUrl + '/api/client/v2.0'), _defineProperty(_v2, API_TYPE_PRIVATE, baseUrl + '/api/private/v2.0'), _defineProperty(_v2, API_TYPE_APP, clientAppID ? baseUrl + '/api/client/v2.0/app/' + clientAppID : baseUrl + '/api/public/v2.0'), _v2)), _defineProperty(_rootURLsByAPIVersion, v3, (_v3 = {}, _defineProperty(_v3, API_TYPE_PUBLIC, baseUrl + '/api/public/v3.0'), _defineProperty(_v3, API_TYPE_CLIENT, baseUrl + '/api/client/v3.0'), _defineProperty(_v3, API_TYPE_APP, clientAppID ? baseUrl + '/api/client/v3.0/app/' + clientAppID : baseUrl + '/api/admin/v3.0'), _v3)), _rootURLsByAPIVersion);\n\n var authOptions = { codec: _common.APP_CLIENT_CODEC };\n if (options && options.authCodec) {\n authOptions.codec = options.authCodec;\n }\n this.auth = new _auth2.default(this, this.authUrl, authOptions);\n this.auth.handleRedirect();\n this.auth.handleCookie();\n\n // deprecated API\n this.authManager = {\n apiKeyAuth: function apiKeyAuth(key) {\n return _this.authenticate('apiKey', key);\n },\n localAuth: function localAuth(email, password) {\n return _this.login(email, password);\n },\n mongodbCloudAuth: function mongodbCloudAuth(username, apiKey, opts) {\n return _this.authenticate('mongodbCloud', Object.assign({ username: username, apiKey: apiKey }, opts));\n }\n };\n\n this.authManager.apiKeyAuth = (0, _util.deprecate)(this.authManager.apiKeyAuth, 'use `client.authenticate(\"apiKey\", \"key\")` instead of `client.authManager.apiKey`');\n this.authManager.localAuth = (0, _util.deprecate)(this.authManager.localAuth, 'use `client.login` instead of `client.authManager.localAuth`');\n this.authManager.mongodbCloudAuth = (0, _util.deprecate)(this.authManager.mongodbCloudAuth, 'use `client.authenticate(\"mongodbCloud\", opts)` instead of `client.authManager.mongodbCloudAuth`');\n }\n\n _createClass(StitchClient, [{\n key: 'login',\n\n\n /**\n * Login to stitch instance, optionally providing a username and password. In\n * the event that these are omitted, anonymous authentication is used.\n *\n * @param {String} [email] the email address used for login\n * @param {String} [password] the password for the provided email address\n * @param {Object} [options] additional authentication options\n * @returns {Promise}\n */\n value: function login(email, password) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n if (email === undefined || password === undefined) {\n return this.authenticate('anon', options);\n }\n\n return this.authenticate('userpass', Object.assign({ username: email, password: password }, options));\n }\n\n /**\n * Send a request to the server indicating the provided email would like\n * to sign up for an account. This will trigger a confirmation email containing\n * a token which must be used with the `emailConfirm` method of the `userpass`\n * auth provider in order to complete registration. The user will not be able\n * to log in until that flow has been completed.\n *\n * @param {String} email the email used to sign up for the app\n * @param {String} password the password used to sign up for the app\n * @param {Object} [options] additional authentication options\n * @returns {Promise}\n */\n\n }, {\n key: 'register',\n value: function register(email, password) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n return this.auth.provider('userpass').register(email, password, options);\n }\n\n /**\n * Submits an authentication request to the specified provider providing any\n * included options (read: user data). If auth data already exists and the\n * existing auth data has an access token, then these credentials are returned.\n *\n * @param {String} providerType the provider used for authentication (e.g. 'userpass', 'facebook', 'google')\n * @param {Object} [options] additional authentication options\n * @returns {Promise} which resolves to a String value: the authed userId\n */\n\n }, {\n key: 'authenticate',\n value: function authenticate(providerType) {\n var _this2 = this;\n\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n // reuse existing auth if present\n if (this.auth.getAccessToken()) {\n return Promise.resolve(this.auth.authedId());\n }\n\n return this.auth.provider(providerType).authenticate(options).then(function () {\n return _this2.auth.authedId();\n });\n }\n\n /**\n * Ends the session for the current user.\n *\n * @returns {Promise}\n */\n\n }, {\n key: 'logout',\n value: function logout() {\n var _this3 = this;\n\n return this._do('/auth/session', 'DELETE', {\n refreshOnFailure: false,\n useRefreshToken: true,\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT]\n }).then(function () {\n return _this3.auth.clear();\n });\n }\n\n /**\n * @return {*} Returns any error from the Stitch authentication system.\n */\n\n }, {\n key: 'authError',\n value: function authError() {\n return this.auth.error();\n }\n\n /**\n * Returns profile information for the currently logged in user\n *\n * @returns {Promise}\n */\n\n }, {\n key: 'userProfile',\n value: function userProfile() {\n return this._do('/auth/profile', 'GET', { rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT] }).then(function (response) {\n return response.json();\n });\n }\n /**\n * @return {String} Returns the currently authed user's ID.\n */\n\n }, {\n key: 'authedId',\n value: function authedId() {\n return this.auth.authedId();\n }\n\n /**\n * Factory method for accessing Stitch services.\n *\n * @method\n * @param {String} type The service type [mongodb, {String}]\n * @param {String} name The service name.\n * @return {Object} returns a named service.\n */\n\n }, {\n key: 'service',\n value: function service(type, name) {\n if (this.constructor !== StitchClient) {\n throw new _errors.StitchError('`service` is a factory method, do not use `new`');\n }\n\n if (!_services2.default.hasOwnProperty(type)) {\n throw new _errors.StitchError('Invalid service type specified: ' + type);\n }\n\n var ServiceType = _services2.default[type];\n return new ServiceType(this, name);\n }\n\n /**\n * Executes a function.\n *\n * @param {String} name The name of the function.\n * @param {...*} args Arguments to pass to the function.\n */\n\n }, {\n key: 'executeFunction',\n value: function executeFunction(name) {\n for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n return this._doFunctionCall({\n name: name,\n arguments: args\n });\n }\n\n /**\n * Executes a service function.\n *\n * @param {String} service The name of the service.\n * @param {String} action The name of the service action.\n * @param {...*} args Arguments to pass to the service action.\n */\n\n }, {\n key: 'executeServiceFunction',\n value: function executeServiceFunction(service, action) {\n for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {\n args[_key2 - 2] = arguments[_key2];\n }\n\n return this._doFunctionCall({\n service: service,\n name: action,\n arguments: args\n });\n }\n }, {\n key: '_doFunctionCall',\n value: function _doFunctionCall(request) {\n var responseDecoder = function responseDecoder(d) {\n return _mongodbExtjson2.default.parse(d, { strict: false });\n };\n var responseEncoder = function responseEncoder(d) {\n return _mongodbExtjson2.default.stringify(d);\n };\n\n return this._do('/functions/call', 'POST', { body: responseEncoder(request) }).then(function (response) {\n return response.text();\n }).then(function (body) {\n return responseDecoder(body);\n });\n }\n\n /**\n * Returns an access token for the user\n *\n * @returns {Promise}\n */\n\n }, {\n key: 'doSessionPost',\n value: function doSessionPost() {\n return this._do('/auth/session', 'POST', {\n refreshOnFailure: false,\n useRefreshToken: true,\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT]\n }).then(function (response) {\n return response.json();\n });\n }\n }, {\n key: '_do',\n value: function _do(resource, method, options) {\n var _this4 = this;\n\n options = Object.assign({}, {\n refreshOnFailure: true,\n useRefreshToken: false,\n apiVersion: v2,\n apiType: API_TYPE_APP,\n rootURL: undefined\n }, options);\n\n if (!options.noAuth) {\n if (!this.authedId()) {\n return Promise.reject(new _errors.StitchError('Must auth first', _errors.ErrUnauthorized));\n }\n\n // If access token is expired, proactively get a new one\n if (!options.useRefreshToken && this.auth.isAccessTokenExpired()) {\n return this.auth.refreshToken().then(function () {\n options.refreshOnFailure = false;\n return _this4._do(resource, method, options);\n });\n }\n }\n\n var appURL = this.rootURLsByAPIVersion[options.apiVersion][options.apiType];\n var url = '' + appURL + resource;\n if (options.rootURL) {\n url = '' + options.rootURL + resource;\n }\n var fetchArgs = common.makeFetchArgs(method, options.body);\n\n if (!!options.headers) {\n Object.assign(fetchArgs.headers, options.headers);\n }\n\n if (!options.noAuth) {\n var token = options.useRefreshToken ? this.auth.getRefreshToken() : this.auth.getAccessToken();\n fetchArgs.headers.Authorization = 'Bearer ' + token;\n }\n\n if (options.queryParams) {\n url = url + '?' + _queryString2.default.stringify(options.queryParams);\n }\n\n return fetch(url, fetchArgs).then(function (response) {\n // Okay: passthrough\n if (response.status >= 200 && response.status < 300) {\n return Promise.resolve(response);\n }\n\n if (response.headers.get('Content-Type') === common.JSONTYPE) {\n return response.json().then(function (json) {\n // Only want to try refreshing token when there's an invalid session\n if ('error_code' in json && json.error_code === _errors.ErrInvalidSession) {\n if (!options.refreshOnFailure) {\n _this4.auth.clear();\n var _error = new _errors.StitchError(json.error, json.error_code);\n _error.response = response;\n _error.json = json;\n throw _error;\n }\n\n return _this4.auth.refreshToken().then(function () {\n options.refreshOnFailure = false;\n return _this4._do(resource, method, options);\n });\n }\n\n var error = new _errors.StitchError(json.error, json.error_code);\n error.response = response;\n error.json = json;\n return Promise.reject(error);\n });\n }\n\n var error = new Error(response.statusText);\n error.response = response;\n return Promise.reject(error);\n });\n }\n\n // Deprecated API\n\n }, {\n key: 'authWithOAuth',\n value: function authWithOAuth(providerType, redirectUrl) {\n return this.auth.provider(providerType).authenticate({ redirectUrl: redirectUrl });\n }\n }, {\n key: 'anonymousAuth',\n value: function anonymousAuth() {\n return this.authenticate('anon');\n }\n }, {\n key: 'type',\n get: function get() {\n return common.APP_CLIENT_TYPE;\n }\n }]);\n\n return StitchClient;\n}();\n\nexports.default = StitchClient;\n\n\nStitchClient.prototype.authWithOAuth = (0, _util.deprecate)(StitchClient.prototype.authWithOAuth, 'use `authenticate` instead of `authWithOAuth`');\nStitchClient.prototype.anonymousAuth = (0, _util.deprecate)(StitchClient.prototype.anonymousAuth, 'use `login()` instead of `anonymousAuth`');\nmodule.exports = exports['default'];\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(global) {\n\n// We have an ES6 Map available, return the native instance\n\nif (typeof global.Map !== 'undefined') {\n module.exports = global.Map;\n module.exports.Map = global.Map;\n} else {\n // We will return a polyfill\n var Map = function Map(array) {\n this._keys = [];\n this._values = {};\n\n for (var i = 0; i < array.length; i++) {\n if (array[i] == null) continue; // skip null and undefined\n var entry = array[i];\n var key = entry[0];\n var value = entry[1];\n // Add the key to the list of keys in order\n this._keys.push(key);\n // Add the key and value to the values dictionary with a point\n // to the location in the ordered keys list\n this._values[key] = { v: value, i: this._keys.length - 1 };\n }\n };\n\n Map.prototype.clear = function () {\n this._keys = [];\n this._values = {};\n };\n\n Map.prototype.delete = function (key) {\n var value = this._values[key];\n if (value == null) return false;\n // Delete entry\n delete this._values[key];\n // Remove the key from the ordered keys list\n this._keys.splice(value.i, 1);\n return true;\n };\n\n Map.prototype.entries = function () {\n var self = this;\n var index = 0;\n\n return {\n next: function next() {\n var key = self._keys[index++];\n return {\n value: key !== undefined ? [key, self._values[key].v] : undefined,\n done: key !== undefined ? false : true\n };\n }\n };\n };\n\n Map.prototype.forEach = function (callback, self) {\n self = self || this;\n\n for (var i = 0; i < this._keys.length; i++) {\n var key = this._keys[i];\n // Call the forEach callback\n callback.call(self, this._values[key].v, key, self);\n }\n };\n\n Map.prototype.get = function (key) {\n return this._values[key] ? this._values[key].v : undefined;\n };\n\n Map.prototype.has = function (key) {\n return this._values[key] != null;\n };\n\n Map.prototype.keys = function (key) {\n var self = this;\n var index = 0;\n\n return {\n next: function next() {\n var key = self._keys[index++];\n return {\n value: key !== undefined ? key : undefined,\n done: key !== undefined ? false : true\n };\n }\n };\n };\n\n Map.prototype.set = function (key, value) {\n if (this._values[key]) {\n this._values[key].v = value;\n return this;\n }\n\n // Add the key to the list of keys in order\n this._keys.push(key);\n // Add the key and value to the values dictionary with a point\n // to the location in the ordered keys list\n this._values[key] = { v: value, i: this._keys.length - 1 };\n return this;\n };\n\n Map.prototype.values = function (key, value) {\n var self = this;\n var index = 0;\n\n return {\n next: function next() {\n var key = self._keys[index++];\n return {\n value: key !== undefined ? self._values[key].v : undefined,\n done: key !== undefined ? false : true\n };\n }\n };\n };\n\n // Last ismaster\n Object.defineProperty(Map.prototype, 'size', {\n enumerable: true,\n get: function get() {\n return this._keys.length;\n }\n });\n\n module.exports = Map;\n module.exports.Map = Map;\n}\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(17)))\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nfunction _extendableBuiltin(cls) {\n function ExtendableBuiltin() {\n var instance = Reflect.construct(cls, Array.from(arguments));\n Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n return instance;\n }\n\n ExtendableBuiltin.prototype = Object.create(cls.prototype, {\n constructor: {\n value: cls,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(ExtendableBuiltin, cls);\n } else {\n ExtendableBuiltin.__proto__ = cls;\n }\n\n return ExtendableBuiltin;\n}\n\n/**\n * Creates a new StitchError\n *\n * @class\n * @augments Error\n * @param {String} message The error message.\n * @param {Object} code The error code.\n * @return {StitchError} A StitchError instance.\n */\nvar StitchError = function (_extendableBuiltin2) {\n _inherits(StitchError, _extendableBuiltin2);\n\n function StitchError(message, code) {\n _classCallCheck(this, StitchError);\n\n var _this = _possibleConstructorReturn(this, (StitchError.__proto__ || Object.getPrototypeOf(StitchError)).call(this, message));\n\n _this.name = 'StitchError';\n _this.message = message;\n if (code !== undefined) {\n _this.code = code;\n }\n\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(_this, _this.constructor);\n } else {\n _this.stack = new Error(message).stack;\n }\n return _this;\n }\n\n return StitchError;\n}(_extendableBuiltin(Error));\n\nvar ErrAuthProviderNotFound = 'AuthProviderNotFound';\nvar ErrInvalidSession = 'InvalidSession';\nvar ErrUnauthorized = 'Unauthorized';\n\nexports.StitchError = StitchError;\nexports.ErrAuthProviderNotFound = ErrAuthProviderNotFound;\nexports.ErrInvalidSession = ErrInvalidSession;\nexports.ErrUnauthorized = ErrUnauthorized;\n\n/***/ }),\n/* 22 */\n/***/ (function(module, exports, __webpack_require__) {\n\n// the whatwg-fetch polyfill installs the fetch() function\n// on the global object (window or self)\n//\n// Return that as the export for use in Webpack, Browserify etc.\n__webpack_require__(73);\nvar globalObj = typeof self !== 'undefined' && self || this;\nmodule.exports = globalObj.fetch.bind(globalObj);\n\n\n/***/ }),\n/* 23 */\n/***/ (function(module, exports) {\n\n// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n/***/ }),\n/* 24 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\n__webpack_require__(22);\n\nvar _client = __webpack_require__(19);\n\nvar _client2 = _interopRequireDefault(_client);\n\nvar _common = __webpack_require__(16);\n\nvar _common2 = _interopRequireDefault(_common);\n\nvar _common3 = __webpack_require__(15);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* global window, fetch */\n/* eslint no-labels: ['error', { 'allowLoop': true }] */\n\n\nvar v2 = 2;\nvar v3 = 3;\n\nvar Admin = function (_StitchClient) {\n _inherits(Admin, _StitchClient);\n\n function Admin(baseUrl) {\n _classCallCheck(this, Admin);\n\n return _possibleConstructorReturn(this, (Admin.__proto__ || Object.getPrototypeOf(Admin)).call(this, '', { baseUrl: baseUrl, authCodec: _common3.ADMIN_CLIENT_CODEC }));\n }\n\n _createClass(Admin, [{\n key: 'logout',\n\n\n /**\n * Ends the session for the current user.\n *\n * @returns {Promise}\n */\n value: function logout() {\n var _this2 = this;\n\n return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', this).call(this, '/auth/session', 'DELETE', { refreshOnFailure: false, useRefreshToken: true, apiVersion: v3 }).then(function () {\n return _this2.auth.clear();\n });\n }\n\n /**\n * Returns profile information for the currently logged in user\n *\n * @returns {Promise}\n */\n\n }, {\n key: 'userProfile',\n value: function userProfile() {\n return this._v3._get('/auth/profile');\n }\n\n /**\n * Returns available providers for the currently logged in admin\n *\n * @returns {Promise}\n */\n\n }, {\n key: 'getAuthProviders',\n value: function getAuthProviders() {\n return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', this).call(this, '/auth/providers', 'GET', { noAuth: true, apiVersion: v3 }).then(function (response) {\n return response.json();\n });\n }\n\n /**\n * Returns an access token for the user\n *\n * @returns {Promise}\n */\n\n }, {\n key: 'doSessionPost',\n value: function doSessionPost() {\n return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', this).call(this, '/auth/session', 'POST', { refreshOnFailure: false, useRefreshToken: true, apiVersion: v3 }).then(function (response) {\n return response.json();\n });\n }\n\n /* Examples of how to access admin API with this client:\n *\n * List all apps\n * a.apps('580e6d055b199c221fcb821c').list()\n *\n * Fetch app under name 'planner'\n * a.apps('580e6d055b199c221fcb821c').app('planner').get()\n *\n * List services under the app 'planner'\n * a.apps('580e6d055b199c221fcb821c').app('planner').services().list()\n *\n * Delete a rule by ID\n * a.apps('580e6d055b199c221fcb821c').app('planner').services().service('mdb1').rules().rule('580e6d055b199c221fcb821d').remove()\n *\n */\n\n }, {\n key: 'apps',\n value: function apps(groupId) {\n var api = this._v3;\n var groupUrl = '/groups/' + groupId + '/apps';\n return {\n list: function list() {\n return api._get(groupUrl);\n },\n create: function create(data, options) {\n var query = options && options.defaults ? '?defaults=true' : '';\n return api._post(groupUrl + query, data);\n },\n\n app: function app(appId) {\n var appUrl = groupUrl + '/' + appId;\n return {\n get: function get() {\n return api._get(appUrl);\n },\n remove: function remove() {\n return api._delete(appUrl);\n },\n\n values: function values() {\n return {\n list: function list() {\n return api._get(appUrl + '/values');\n },\n create: function create(data) {\n return api._post(appUrl + '/values', data);\n },\n value: function value(valueId) {\n var valueUrl = appUrl + '/values/' + valueId;\n return {\n get: function get() {\n return api._get(valueUrl);\n },\n remove: function remove() {\n return api._delete(valueUrl);\n },\n update: function update(data) {\n return api._put(valueUrl, data);\n }\n };\n }\n };\n },\n\n services: function services() {\n return {\n list: function list() {\n return api._get(appUrl + '/services');\n },\n create: function create(data) {\n return api._post(appUrl + '/services', data);\n },\n service: function service(serviceId) {\n return {\n get: function get() {\n return api._get(appUrl + '/services/' + serviceId);\n },\n remove: function remove() {\n return api._delete(appUrl + '/services/' + serviceId);\n },\n runCommand: function runCommand(commandName, data) {\n return api._post(appUrl + '/services/' + serviceId + '/commands/' + commandName, data);\n },\n config: function config() {\n return {\n get: function get() {\n return api._get(appUrl + '/services/' + serviceId + '/config');\n },\n update: function update(data) {\n return api._patch(appUrl + '/services/' + serviceId + '/config', data);\n }\n };\n },\n\n rules: function rules() {\n return {\n list: function list() {\n return api._get(appUrl + '/services/' + serviceId + '/rules');\n },\n create: function create(data) {\n return api._post(appUrl + '/services/' + serviceId + '/rules', data);\n },\n rule: function rule(ruleId) {\n var ruleUrl = appUrl + '/services/' + serviceId + '/rules/' + ruleId;\n return {\n get: function get() {\n return api._get(ruleUrl);\n },\n update: function update(data) {\n return api._put(ruleUrl, data);\n },\n remove: function remove() {\n return api._delete(ruleUrl);\n }\n };\n }\n };\n },\n\n incomingWebhooks: function incomingWebhooks() {\n return {\n list: function list() {\n return api._get(appUrl + '/services/' + serviceId + '/incoming_webhooks');\n },\n create: function create(data) {\n return api._post(appUrl + '/services/' + serviceId + '/incoming_webhooks', data);\n },\n incomingWebhook: function incomingWebhook(incomingWebhookId) {\n var webhookUrl = appUrl + '/services/' + serviceId + '/incoming_webhooks/' + incomingWebhookId;\n return {\n get: function get() {\n return api._get(webhookUrl);\n },\n update: function update(data) {\n return api._put(webhookUrl, data);\n },\n remove: function remove() {\n return api._delete(webhookUrl);\n }\n };\n }\n };\n }\n };\n }\n };\n },\n\n pushNotifications: function pushNotifications() {\n return {\n list: function list(filter) {\n return api._get(appUrl + '/push/notifications', filter);\n },\n create: function create(data) {\n return api._post(appUrl + '/push/notifications', data);\n },\n pushNotification: function pushNotification(messageId) {\n return {\n get: function get() {\n return api._get(appUrl + '/push/notifications/' + messageId);\n },\n update: function update(data) {\n return api._put(appUrl + '/push/notifications/' + messageId, data);\n },\n remove: function remove() {\n return api._delete(appUrl + '/push/notifications/' + messageId);\n },\n send: function send() {\n return api._post(appUrl + '/push/notifications/' + messageId + '/send');\n }\n };\n }\n };\n },\n\n users: function users() {\n return {\n list: function list(filter) {\n return api._get(appUrl + '/users', filter);\n },\n create: function create(user) {\n return api._post(appUrl + '/users', user);\n },\n user: function user(uid) {\n return {\n get: function get() {\n return api._get(appUrl + '/users/' + uid);\n },\n logout: function logout() {\n return api._put(appUrl + '/users/' + uid + '/logout');\n },\n remove: function remove() {\n return api._delete(appUrl + '/users/' + uid);\n }\n };\n }\n };\n },\n\n debug: function debug() {\n return {\n executeFunction: function executeFunction(userId) {\n for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n args[_key - 2] = arguments[_key];\n }\n\n var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n\n return api._post(appUrl + '/debug/execute_function', { name: name, 'arguments': args }, { user_id: userId });\n },\n executeFunctionSource: function executeFunctionSource(userId) {\n var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n var evalSource = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n\n return api._post(appUrl + '/debug/execute_function_source', { source: source, 'eval_source': evalSource }, { user_id: userId });\n }\n };\n },\n\n authProviders: function authProviders() {\n return {\n list: function list() {\n return api._get(appUrl + '/auth_providers');\n },\n create: function create(data) {\n return api._post(appUrl + '/auth_providers', data);\n },\n authProvider: function authProvider(providerId) {\n return {\n get: function get() {\n return api._get(appUrl + '/auth_providers/' + providerId);\n },\n update: function update(data) {\n return api._patch(appUrl + '/auth_providers/' + providerId, data);\n },\n enable: function enable() {\n return api._put(appUrl + '/auth_providers/' + providerId + '/enable');\n },\n disable: function disable() {\n return api._put(appUrl + '/auth_providers/' + providerId + '/disable');\n },\n remove: function remove() {\n return api._delete(appUrl + '/auth_providers/' + providerId);\n }\n };\n }\n };\n },\n\n security: function security() {\n return {\n allowedRequestOrigins: function allowedRequestOrigins() {\n return {\n get: function get() {\n return api._get(appUrl + '/security/allowed_request_origins');\n },\n update: function update(data) {\n return api._post(appUrl + '/security/allowed_request_origins', data);\n }\n };\n }\n };\n },\n\n logs: function logs() {\n return {\n list: function list(filter) {\n return api._get(appUrl + '/logs', filter);\n }\n };\n },\n\n apiKeys: function apiKeys() {\n return {\n list: function list() {\n return api._get(appUrl + '/api_keys');\n },\n create: function create(data) {\n return api._post(appUrl + '/api_keys', data);\n },\n apiKey: function apiKey(apiKeyId) {\n return {\n get: function get() {\n return api._get(appUrl + '/api_keys/' + apiKeyId);\n },\n remove: function remove() {\n return api._delete(appUrl + '/api_keys/' + apiKeyId);\n },\n enable: function enable() {\n return api._put(appUrl + '/api_keys/' + apiKeyId + '/enable');\n },\n disable: function disable() {\n return api._put(appUrl + '/api_keys/' + apiKeyId + '/disable');\n }\n };\n }\n };\n },\n\n functions: function functions() {\n return {\n list: function list() {\n return api._get(appUrl + '/functions');\n },\n create: function create(data) {\n return api._post(appUrl + '/functions', data);\n },\n function: function _function(functionId) {\n return {\n get: function get() {\n return api._get(appUrl + '/functions/' + functionId);\n },\n update: function update(data) {\n return api._put(appUrl + '/functions/' + functionId, data);\n },\n remove: function remove() {\n return api._delete(appUrl + '/functions/' + functionId);\n }\n };\n }\n };\n }\n };\n }\n };\n }\n }, {\n key: 'v2',\n value: function v2() {\n var api = this._v2;\n return {\n\n apps: function apps(groupId) {\n var groupUrl = '/groups/' + groupId + '/apps';\n return {\n list: function list() {\n return api._get(groupUrl);\n },\n create: function create(data, options) {\n var query = options && options.defaults ? '?defaults=true' : '';\n return api._post(groupUrl + query, data);\n },\n\n app: function app(appId) {\n var appUrl = groupUrl + '/' + appId;\n return {\n get: function get() {\n return api._get(appUrl);\n },\n remove: function remove() {\n return api._delete(appUrl);\n },\n\n pipelines: function pipelines() {\n return {\n list: function list() {\n return api._get(appUrl + '/pipelines');\n },\n create: function create(data) {\n return api._post(appUrl + '/pipelines', data);\n },\n pipeline: function pipeline(pipelineId) {\n var pipelineUrl = appUrl + '/pipelines/' + pipelineId;\n return {\n get: function get() {\n return api._get(pipelineUrl);\n },\n remove: function remove() {\n return api._delete(pipelineUrl);\n },\n update: function update(data) {\n return api._put(pipelineUrl, data);\n }\n };\n }\n };\n },\n\n values: function values() {\n return {\n list: function list() {\n return api._get(appUrl + '/values');\n },\n create: function create(data) {\n return api._post(appUrl + '/values', data);\n },\n value: function value(valueId) {\n var valueUrl = appUrl + '/values/' + valueId;\n return {\n get: function get() {\n return api._get(valueUrl);\n },\n remove: function remove() {\n return api._delete(valueUrl);\n },\n update: function update(data) {\n return api._put(valueUrl, data);\n }\n };\n }\n };\n },\n\n services: function services() {\n return {\n list: function list() {\n return api._get(appUrl + '/services');\n },\n create: function create(data) {\n return api._post(appUrl + '/services', data);\n },\n service: function service(serviceId) {\n return {\n get: function get() {\n return api._get(appUrl + '/services/' + serviceId);\n },\n remove: function remove() {\n return api._delete(appUrl + '/services/' + serviceId);\n },\n runCommand: function runCommand(commandName, data) {\n return api._post(appUrl + '/services/' + serviceId + '/commands/' + commandName, data);\n },\n config: function config() {\n return {\n get: function get() {\n return api._get(appUrl + '/services/' + serviceId + '/config');\n },\n update: function update(data) {\n return api._patch(appUrl + '/services/' + serviceId + '/config', data);\n }\n };\n },\n\n rules: function rules() {\n return {\n list: function list() {\n return api._get(appUrl + '/services/' + serviceId + '/rules');\n },\n create: function create(data) {\n return api._post(appUrl + '/services/' + serviceId + '/rules', data);\n },\n rule: function rule(ruleId) {\n var ruleUrl = appUrl + '/services/' + serviceId + '/rules/' + ruleId;\n return {\n get: function get() {\n return api._get(ruleUrl);\n },\n update: function update(data) {\n return api._put(ruleUrl, data);\n },\n remove: function remove() {\n return api._delete(ruleUrl);\n }\n };\n }\n };\n },\n\n incomingWebhooks: function incomingWebhooks() {\n return {\n list: function list() {\n return api._get(appUrl + '/services/' + serviceId + '/incoming_webhooks');\n },\n create: function create(data) {\n return api._post(appUrl + '/services/' + serviceId + '/incoming_webhooks', data);\n },\n incomingWebhook: function incomingWebhook(incomingWebhookId) {\n var webhookUrl = appUrl + '/services/' + serviceId + '/incoming_webhooks/' + incomingWebhookId;\n return {\n get: function get() {\n return api._get(webhookUrl);\n },\n update: function update(data) {\n return api._put(webhookUrl, data);\n },\n remove: function remove() {\n return api._delete(webhookUrl);\n }\n };\n }\n };\n }\n\n };\n }\n };\n },\n\n pushNotifications: function pushNotifications() {\n return {\n list: function list(filter) {\n return api._get(appUrl + '/push/notifications', filter);\n },\n create: function create(data) {\n return api._post(appUrl + '/push/notifications', data);\n },\n pushNotification: function pushNotification(messageId) {\n return {\n get: function get() {\n return api._get(appUrl + '/push/notifications/' + messageId);\n },\n update: function update(data) {\n return api._put(appUrl + '/push/notifications/' + messageId, data);\n },\n setType: function setType(type) {\n return api._put(appUrl + '/push/notifications/' + messageId + '/type', { type: type });\n },\n remove: function remove() {\n return api._delete(appUrl + '/push/notifications/' + messageId);\n }\n };\n }\n };\n },\n\n users: function users() {\n return {\n list: function list(filter) {\n return api._get(appUrl + '/users', filter);\n },\n create: function create(user) {\n return api._post(appUrl + '/users', user);\n },\n user: function user(uid) {\n return {\n get: function get() {\n return api._get(appUrl + '/users/' + uid);\n },\n logout: function logout() {\n return api._put(appUrl + '/users/' + uid + '/logout');\n },\n remove: function remove() {\n return api._delete(appUrl + '/users/' + uid);\n }\n };\n }\n };\n },\n\n dev: function dev() {\n return {\n executePipeline: function executePipeline(body, userId, options) {\n return api._post(appUrl + '/dev/pipeline', body, Object.assign({}, options, { user_id: userId }));\n }\n };\n },\n\n authProviders: function authProviders() {\n return {\n list: function list() {\n return api._get(appUrl + '/auth_providers');\n },\n create: function create(data) {\n return api._post(appUrl + '/auth_providers', data);\n },\n authProvider: function authProvider(providerId) {\n return {\n get: function get() {\n return api._get(appUrl + '/auth_providers/' + providerId);\n },\n update: function update(data) {\n return api._patch(appUrl + '/auth_providers/' + providerId, data);\n },\n enable: function enable() {\n return api._put(appUrl + '/auth_providers/' + providerId + '/enable');\n },\n disable: function disable() {\n return api._put(appUrl + '/auth_providers/' + providerId + '/disable');\n },\n remove: function remove() {\n return api._delete(appUrl + '/auth_providers/' + providerId);\n }\n };\n }\n };\n },\n\n security: function security() {\n return {\n allowedRequestOrigins: function allowedRequestOrigins() {\n return {\n get: function get() {\n return api._get(appUrl + '/security/allowed_request_origins');\n },\n update: function update(data) {\n return api._post(appUrl + '/security/allowed_request_origins', data);\n }\n };\n }\n };\n },\n\n logs: function logs() {\n return {\n list: function list(filter) {\n return api._get(appUrl + '/logs', filter);\n }\n };\n },\n\n apiKeys: function apiKeys() {\n return {\n list: function list() {\n return api._get(appUrl + '/api_keys');\n },\n create: function create(data) {\n return api._post(appUrl + '/api_keys', data);\n },\n apiKey: function apiKey(apiKeyId) {\n return {\n get: function get() {\n return api._get(appUrl + '/api_keys/' + apiKeyId);\n },\n remove: function remove() {\n return api._delete(appUrl + '/api_keys/' + apiKeyId);\n },\n enable: function enable() {\n return api._put(appUrl + '/api_keys/' + apiKeyId + '/enable');\n },\n disable: function disable() {\n return api._put(appUrl + '/api_keys/' + apiKeyId + '/disable');\n }\n };\n }\n };\n }\n };\n }\n };\n }\n };\n }\n }, {\n key: '_admin',\n value: function _admin() {\n var _this3 = this;\n\n return {\n logs: function logs() {\n return {\n get: function get(filter) {\n return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', _this3).call(_this3, '/admin/logs', 'GET', { useRefreshToken: true, queryParams: filter });\n }\n };\n },\n users: function users() {\n return {\n list: function list(filter) {\n return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', _this3).call(_this3, '/admin/users', 'GET', { useRefreshToken: true, queryParams: filter });\n },\n user: function user(uid) {\n return {\n logout: function logout() {\n return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', _this3).call(_this3, '/admin/users/' + uid + '/logout', 'PUT', { useRefreshToken: true });\n }\n };\n }\n };\n }\n };\n }\n }, {\n key: '_isImpersonatingUser',\n value: function _isImpersonatingUser() {\n return this.auth.isImpersonatingUser();\n }\n }, {\n key: '_startImpersonation',\n value: function _startImpersonation(userId) {\n return this.auth.startImpersonation(this, userId);\n }\n }, {\n key: '_stopImpersonation',\n value: function _stopImpersonation() {\n return this.auth.stopImpersonation();\n }\n }, {\n key: 'type',\n get: function get() {\n return _common2.default;\n }\n }, {\n key: '_v3',\n get: function get() {\n var _this4 = this;\n\n var v3do = function v3do(url, method, options) {\n return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', _this4).call(_this4, url, method, Object.assign({}, { apiVersion: v3 }, options)).then(function (response) {\n var contentHeader = response.headers.get('content-type') || '';\n if (contentHeader.split(',').indexOf('application/json') >= 0) {\n return response.json();\n }\n return response;\n });\n };\n\n return {\n _get: function _get(url, queryParams) {\n return v3do(url, 'GET', { queryParams: queryParams });\n },\n _put: function _put(url, data) {\n return data ? v3do(url, 'PUT', { body: JSON.stringify(data) }) : v3do(url, 'PUT');\n },\n _patch: function _patch(url, data) {\n return data ? v3do(url, 'PATCH', { body: JSON.stringify(data) }) : v3do(url, 'PATCH');\n },\n _delete: function _delete(url) {\n return v3do(url, 'DELETE');\n },\n _post: function _post(url, body, queryParams) {\n return queryParams ? v3do(url, 'POST', { body: JSON.stringify(body), queryParams: queryParams }) : v3do(url, 'POST', { body: JSON.stringify(body) });\n }\n };\n }\n }, {\n key: '_v2',\n get: function get() {\n var _this5 = this;\n\n var v2do = function v2do(url, method, options) {\n return _get(Admin.prototype.__proto__ || Object.getPrototypeOf(Admin.prototype), '_do', _this5).call(_this5, url, method, Object.assign({}, { apiVersion: v2 }, options)).then(function (response) {\n var contentHeader = response.headers.get('content-type') || '';\n if (contentHeader.split(',').indexOf('application/json') >= 0) {\n return response.json();\n }\n return response;\n });\n };\n\n return {\n _get: function _get(url, queryParams) {\n return v2do(url, 'GET', { queryParams: queryParams });\n },\n _put: function _put(url, data) {\n return data ? v2do(url, 'PUT', { body: JSON.stringify(data) }) : v2do(url, 'PUT');\n },\n _patch: function _patch(url, data) {\n return data ? v2do(url, 'PATCH', { body: JSON.stringify(data) }) : v2do(url, 'PATCH');\n },\n _delete: function _delete(url) {\n return v2do(url, 'DELETE');\n },\n _post: function _post(url, body, queryParams) {\n return queryParams ? v2do(url, 'POST', { body: JSON.stringify(body), queryParams: queryParams }) : v2do(url, 'POST', { body: JSON.stringify(body) });\n }\n };\n }\n }]);\n\n return Admin;\n}(_client2.default);\n\nexports.default = Admin;\nmodule.exports = exports['default'];\n\n/***/ }),\n/* 25 */\n/***/ (function(module, exports, __webpack_require__) {\n\n;(function () {\n\n var object =\n true ? exports :\n typeof self != 'undefined' ? self : // #8: web workers\n $.global; // #31: ExtendScript\n\n var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n function InvalidCharacterError(message) {\n this.message = message;\n }\n InvalidCharacterError.prototype = new Error;\n InvalidCharacterError.prototype.name = 'InvalidCharacterError';\n\n // encoder\n // [https://gist.github.com/999166] by [https://github.com/nignag]\n object.btoa || (\n object.btoa = function (input) {\n var str = String(input);\n for (\n // initialize result and counter\n var block, charCode, idx = 0, map = chars, output = '';\n // if the next str index does not exist:\n // change the mapping table to \"=\"\n // check if d has no fractional digits\n str.charAt(idx | 0) || (map = '=', idx % 1);\n // \"8 - idx % 1 * 8\" generates the sequence 2, 4, 6, 8\n output += map.charAt(63 & block >> 8 - idx % 1 * 8)\n ) {\n charCode = str.charCodeAt(idx += 3/4);\n if (charCode > 0xFF) {\n throw new InvalidCharacterError(\"'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.\");\n }\n block = block << 8 | charCode;\n }\n return output;\n });\n\n // decoder\n // [https://gist.github.com/1020396] by [https://github.com/atk]\n object.atob || (\n object.atob = function (input) {\n var str = String(input).replace(/[=]+$/, ''); // #31: ExtendScript bad parse of /=\n if (str.length % 4 == 1) {\n throw new InvalidCharacterError(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = '';\n // get next character\n buffer = str.charAt(idx++);\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n return output;\n });\n\n}());\n\n\n/***/ }),\n/* 26 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Buffer) {\n\nvar writeIEEE754 = __webpack_require__(1).writeIEEE754,\n readIEEE754 = __webpack_require__(1).readIEEE754,\n Map = __webpack_require__(20),\n Long = __webpack_require__(3),\n Double = __webpack_require__(8),\n Timestamp = __webpack_require__(14),\n ObjectID = __webpack_require__(11),\n BSONRegExp = __webpack_require__(12),\n _Symbol = __webpack_require__(13),\n Int32 = __webpack_require__(18),\n Code = __webpack_require__(5),\n Decimal128 = __webpack_require__(7),\n MinKey = __webpack_require__(10),\n MaxKey = __webpack_require__(9),\n DBRef = __webpack_require__(6),\n Binary = __webpack_require__(4);\n\n// Parts of the parser\nvar deserialize = __webpack_require__(28),\n serializer = __webpack_require__(29),\n calculateObjectSize = __webpack_require__(27);\n\n/**\n * @ignore\n * @api private\n */\n// Max Size\nvar MAXSIZE = 1024 * 1024 * 17;\n// Max Document Buffer size\nvar buffer = new Buffer(MAXSIZE);\n\nvar BSON = function BSON() {};\n\n/**\n * Serialize a Javascript object.\n *\n * @param {Object} object the Javascript object to serialize.\n * @param {Boolean} [options.checkKeys] the serializer will check if keys are valid.\n * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**.\n * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**.\n * @return {Buffer} returns the Buffer object containing the serialized object.\n * @api public\n */\nBSON.prototype.serialize = function serialize(object, options) {\n options = options || {};\n // Unpack the options\n var checkKeys = typeof options.checkKeys == 'boolean' ? options.checkKeys : false;\n var serializeFunctions = typeof options.serializeFunctions == 'boolean' ? options.serializeFunctions : false;\n var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' ? options.ignoreUndefined : true;\n\n // Attempt to serialize\n var serializationIndex = serializer(buffer, object, checkKeys, 0, 0, serializeFunctions, ignoreUndefined, []);\n // Create the final buffer\n var finishedBuffer = new Buffer(serializationIndex);\n // Copy into the finished buffer\n buffer.copy(finishedBuffer, 0, 0, finishedBuffer.length);\n // Return the buffer\n return finishedBuffer;\n};\n\n/**\n * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization.\n *\n * @param {Object} object the Javascript object to serialize.\n * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object.\n * @param {Boolean} [options.checkKeys] the serializer will check if keys are valid.\n * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**.\n * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**.\n * @param {Number} [options.index] the index in the buffer where we wish to start serializing into.\n * @return {Number} returns the index pointing to the last written byte in the buffer.\n * @api public\n */\nBSON.prototype.serializeWithBufferAndIndex = function (object, finalBuffer, options) {\n options = options || {};\n // Unpack the options\n var checkKeys = typeof options.checkKeys == 'boolean' ? options.checkKeys : false;\n var serializeFunctions = typeof options.serializeFunctions == 'boolean' ? options.serializeFunctions : false;\n var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' ? options.ignoreUndefined : true;\n var startIndex = typeof options.index == 'number' ? options.index : 0;\n\n // Attempt to serialize\n var serializationIndex = serializer(buffer, object, checkKeys, startIndex || 0, 0, serializeFunctions, ignoreUndefined);\n buffer.copy(finalBuffer, startIndex, 0, serializationIndex);\n\n // Return the index\n return serializationIndex - 1;\n};\n\n/**\n * Deserialize data as BSON.\n *\n * @param {Buffer} buffer the buffer containing the serialized set of BSON documents.\n * @param {Object} [options.evalFunctions=false] evaluate functions in the BSON document scoped to the object deserialized.\n * @param {Object} [options.cacheFunctions=false] cache evaluated functions for reuse.\n * @param {Object} [options.cacheFunctionsCrc32=false] use a crc32 code for caching, otherwise use the string of the function.\n * @param {Object} [options.promoteLongs=true] when deserializing a Long will fit it into a Number if it's smaller than 53 bits\n * @param {Object} [options.promoteBuffers=false] when deserializing a Binary will return it as a node.js Buffer instance.\n * @param {Object} [options.promoteValues=false] when deserializing will promote BSON values to their Node.js closest equivalent types.\n * @param {Object} [options.fieldsAsRaw=null] allow to specify if there what fields we wish to return as unserialized raw buffer.\n * @param {Object} [options.bsonRegExp=false] return BSON regular expressions as BSONRegExp instances.\n * @return {Object} returns the deserialized Javascript Object.\n * @api public\n */\nBSON.prototype.deserialize = function (buffer, options) {\n return deserialize(buffer, options);\n};\n\n/**\n * Calculate the bson size for a passed in Javascript object.\n *\n * @param {Object} object the Javascript object to calculate the BSON byte size for.\n * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**.\n * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**.\n * @return {Number} returns the number of bytes the BSON object will take up.\n * @api public\n */\nBSON.prototype.calculateObjectSize = function (object, options) {\n options = options || {};\n\n var serializeFunctions = typeof options.serializeFunctions == 'boolean' ? options.serializeFunctions : false;\n var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' ? options.ignoreUndefined : true;\n\n return calculateObjectSize(object, serializeFunctions, ignoreUndefined);\n};\n\n/**\n * Deserialize stream data as BSON documents.\n *\n * @param {Buffer} data the buffer containing the serialized set of BSON documents.\n * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start.\n * @param {Number} numberOfDocuments number of documents to deserialize.\n * @param {Array} documents an array where to store the deserialized documents.\n * @param {Number} docStartIndex the index in the documents array from where to start inserting documents.\n * @param {Object} [options] additional options used for the deserialization.\n * @param {Object} [options.evalFunctions=false] evaluate functions in the BSON document scoped to the object deserialized.\n * @param {Object} [options.cacheFunctions=false] cache evaluated functions for reuse.\n * @param {Object} [options.cacheFunctionsCrc32=false] use a crc32 code for caching, otherwise use the string of the function.\n * @param {Object} [options.promoteLongs=true] when deserializing a Long will fit it into a Number if it's smaller than 53 bits\n * @param {Object} [options.promoteBuffers=false] when deserializing a Binary will return it as a node.js Buffer instance.\n * @param {Object} [options.promoteValues=false] when deserializing will promote BSON values to their Node.js closest equivalent types.\n * @param {Object} [options.fieldsAsRaw=null] allow to specify if there what fields we wish to return as unserialized raw buffer.\n * @param {Object} [options.bsonRegExp=false] return BSON regular expressions as BSONRegExp instances.\n * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents.\n * @api public\n */\nBSON.prototype.deserializeStream = function (data, startIndex, numberOfDocuments, documents, docStartIndex, options) {\n options = options != null ? options : {};\n var index = startIndex;\n // Loop over all documents\n for (var i = 0; i < numberOfDocuments; i++) {\n // Find size of the document\n var size = data[index] | data[index + 1] << 8 | data[index + 2] << 16 | data[index + 3] << 24;\n // Update options with index\n options['index'] = index;\n // Parse the document at this point\n documents[docStartIndex + i] = this.deserialize(data, options);\n // Adjust index by the document size\n index = index + size;\n }\n\n // Return object containing end index of parsing and list of documents\n return index;\n};\n\n/**\n * @ignore\n * @api private\n */\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\nBSON.BSON_INT64_MAX = Math.pow(2, 63) - 1;\nBSON.BSON_INT64_MIN = -Math.pow(2, 63);\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\n// Internal long versions\nvar JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double.\nvar JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double.\n\n/**\n * Number BSON Type\n *\n * @classconstant BSON_DATA_NUMBER\n **/\nBSON.BSON_DATA_NUMBER = 1;\n/**\n * String BSON Type\n *\n * @classconstant BSON_DATA_STRING\n **/\nBSON.BSON_DATA_STRING = 2;\n/**\n * Object BSON Type\n *\n * @classconstant BSON_DATA_OBJECT\n **/\nBSON.BSON_DATA_OBJECT = 3;\n/**\n * Array BSON Type\n *\n * @classconstant BSON_DATA_ARRAY\n **/\nBSON.BSON_DATA_ARRAY = 4;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_BINARY\n **/\nBSON.BSON_DATA_BINARY = 5;\n/**\n * ObjectID BSON Type\n *\n * @classconstant BSON_DATA_OID\n **/\nBSON.BSON_DATA_OID = 7;\n/**\n * Boolean BSON Type\n *\n * @classconstant BSON_DATA_BOOLEAN\n **/\nBSON.BSON_DATA_BOOLEAN = 8;\n/**\n * Date BSON Type\n *\n * @classconstant BSON_DATA_DATE\n **/\nBSON.BSON_DATA_DATE = 9;\n/**\n * null BSON Type\n *\n * @classconstant BSON_DATA_NULL\n **/\nBSON.BSON_DATA_NULL = 10;\n/**\n * RegExp BSON Type\n *\n * @classconstant BSON_DATA_REGEXP\n **/\nBSON.BSON_DATA_REGEXP = 11;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_CODE\n **/\nBSON.BSON_DATA_CODE = 13;\n/**\n * Symbol BSON Type\n *\n * @classconstant BSON_DATA_SYMBOL\n **/\nBSON.BSON_DATA_SYMBOL = 14;\n/**\n * Code with Scope BSON Type\n *\n * @classconstant BSON_DATA_CODE_W_SCOPE\n **/\nBSON.BSON_DATA_CODE_W_SCOPE = 15;\n/**\n * 32 bit Integer BSON Type\n *\n * @classconstant BSON_DATA_INT\n **/\nBSON.BSON_DATA_INT = 16;\n/**\n * Timestamp BSON Type\n *\n * @classconstant BSON_DATA_TIMESTAMP\n **/\nBSON.BSON_DATA_TIMESTAMP = 17;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_LONG\n **/\nBSON.BSON_DATA_LONG = 18;\n/**\n * MinKey BSON Type\n *\n * @classconstant BSON_DATA_MIN_KEY\n **/\nBSON.BSON_DATA_MIN_KEY = 0xff;\n/**\n * MaxKey BSON Type\n *\n * @classconstant BSON_DATA_MAX_KEY\n **/\nBSON.BSON_DATA_MAX_KEY = 0x7f;\n\n/**\n * Binary Default Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_DEFAULT\n **/\nBSON.BSON_BINARY_SUBTYPE_DEFAULT = 0;\n/**\n * Binary Function Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_FUNCTION\n **/\nBSON.BSON_BINARY_SUBTYPE_FUNCTION = 1;\n/**\n * Binary Byte Array Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY\n **/\nBSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;\n/**\n * Binary UUID Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_UUID\n **/\nBSON.BSON_BINARY_SUBTYPE_UUID = 3;\n/**\n * Binary MD5 Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_MD5\n **/\nBSON.BSON_BINARY_SUBTYPE_MD5 = 4;\n/**\n * Binary User Defined Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED\n **/\nBSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128;\n\n// Return BSON\nmodule.exports = BSON;\nmodule.exports.Code = Code;\nmodule.exports.Map = Map;\nmodule.exports.Symbol = _Symbol;\nmodule.exports.BSON = BSON;\nmodule.exports.DBRef = DBRef;\nmodule.exports.Binary = Binary;\nmodule.exports.ObjectID = ObjectID;\nmodule.exports.Long = Long;\nmodule.exports.Timestamp = Timestamp;\nmodule.exports.Double = Double;\nmodule.exports.Int32 = Int32;\nmodule.exports.MinKey = MinKey;\nmodule.exports.MaxKey = MaxKey;\nmodule.exports.BSONRegExp = BSONRegExp;\nmodule.exports.Decimal128 = Decimal128;\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))\n\n/***/ }),\n/* 27 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Buffer) {\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar writeIEEE754 = __webpack_require__(1).writeIEEE754,\n readIEEE754 = __webpack_require__(1).readIEEE754,\n Long = __webpack_require__(3).Long,\n Double = __webpack_require__(8).Double,\n Timestamp = __webpack_require__(14).Timestamp,\n ObjectID = __webpack_require__(11).ObjectID,\n _Symbol = __webpack_require__(13).Symbol,\n BSONRegExp = __webpack_require__(12).BSONRegExp,\n Code = __webpack_require__(5).Code,\n Decimal128 = __webpack_require__(7),\n MinKey = __webpack_require__(10).MinKey,\n MaxKey = __webpack_require__(9).MaxKey,\n DBRef = __webpack_require__(6).DBRef,\n Binary = __webpack_require__(4).Binary;\n\n// To ensure that 0.4 of node works correctly\nvar isDate = function isDate(d) {\n return (typeof d === 'undefined' ? 'undefined' : _typeof(d)) === 'object' && Object.prototype.toString.call(d) === '[object Date]';\n};\n\nvar calculateObjectSize = function calculateObjectSize(object, serializeFunctions, ignoreUndefined) {\n var totalLength = 4 + 1;\n\n if (Array.isArray(object)) {\n for (var i = 0; i < object.length; i++) {\n totalLength += calculateElement(i.toString(), object[i], serializeFunctions, true, ignoreUndefined);\n }\n } else {\n // If we have toBSON defined, override the current object\n if (object.toBSON) {\n object = object.toBSON();\n }\n\n // Calculate size\n for (var key in object) {\n totalLength += calculateElement(key, object[key], serializeFunctions, false, ignoreUndefined);\n }\n }\n\n return totalLength;\n};\n\n/**\n * @ignore\n * @api private\n */\nfunction calculateElement(name, value, serializeFunctions, isArray, ignoreUndefined) {\n // If we have toBSON defined, override the current object\n if (value && value.toBSON) {\n value = value.toBSON();\n }\n\n switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) {\n case 'string':\n return 1 + Buffer.byteLength(name, 'utf8') + 1 + 4 + Buffer.byteLength(value, 'utf8') + 1;\n case 'number':\n if (Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) {\n if (value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) {\n // 32 bit\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (4 + 1);\n } else {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (8 + 1);\n }\n } else {\n // 64 bit\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (8 + 1);\n }\n case 'undefined':\n if (isArray || !ignoreUndefined) return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1;\n return 0;\n case 'boolean':\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (1 + 1);\n case 'object':\n if (value == null || value instanceof MinKey || value instanceof MaxKey || value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1;\n } else if (value instanceof ObjectID || value['_bsontype'] == 'ObjectID') {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (12 + 1);\n } else if (value instanceof Date || isDate(value)) {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (8 + 1);\n } else if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (1 + 4 + 1) + value.length;\n } else if (value instanceof Long || value instanceof Double || value instanceof Timestamp || value['_bsontype'] == 'Long' || value['_bsontype'] == 'Double' || value['_bsontype'] == 'Timestamp') {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (8 + 1);\n } else if (value instanceof Decimal128 || value['_bsontype'] == 'Decimal128') {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (16 + 1);\n } else if (value instanceof Code || value['_bsontype'] == 'Code') {\n // Calculate size depending on the availability of a scope\n if (value.scope != null && Object.keys(value.scope).length > 0) {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + 4 + 4 + Buffer.byteLength(value.code.toString(), 'utf8') + 1 + calculateObjectSize(value.scope, serializeFunctions, ignoreUndefined);\n } else {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + 4 + Buffer.byteLength(value.code.toString(), 'utf8') + 1;\n }\n } else if (value instanceof Binary || value['_bsontype'] == 'Binary') {\n // Check what kind of subtype we have\n if (value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (value.position + 1 + 4 + 1 + 4);\n } else {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (value.position + 1 + 4 + 1);\n }\n } else if (value instanceof _Symbol || value['_bsontype'] == 'Symbol') {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + Buffer.byteLength(value.value, 'utf8') + 4 + 1 + 1;\n } else if (value instanceof DBRef || value['_bsontype'] == 'DBRef') {\n // Set up correct object for serialization\n var ordered_values = {\n '$ref': value.namespace,\n '$id': value.oid\n };\n\n // Add db reference if it exists\n if (null != value.db) {\n ordered_values['$db'] = value.db;\n }\n\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + calculateObjectSize(ordered_values, serializeFunctions, ignoreUndefined);\n } else if (value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]') {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + Buffer.byteLength(value.source, 'utf8') + 1 + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1;\n } else if (value instanceof BSONRegExp || value['_bsontype'] == 'BSONRegExp') {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + Buffer.byteLength(value.pattern, 'utf8') + 1 + Buffer.byteLength(value.options, 'utf8') + 1;\n } else {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + calculateObjectSize(value, serializeFunctions, ignoreUndefined) + 1;\n }\n case 'function':\n // WTF for 0.4.X where typeof /someregexp/ === 'function'\n if (value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]' || String.call(value) == '[object RegExp]') {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + Buffer.byteLength(value.source, 'utf8') + 1 + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1;\n } else {\n if (serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + 4 + 4 + Buffer.byteLength(value.toString(), 'utf8') + 1 + calculateObjectSize(value.scope, serializeFunctions, ignoreUndefined);\n } else if (serializeFunctions) {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + 4 + Buffer.byteLength(value.toString(), 'utf8') + 1;\n }\n }\n }\n\n return 0;\n}\n\nvar BSON = {};\n\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\nmodule.exports = calculateObjectSize;\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))\n\n/***/ }),\n/* 28 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Buffer) {\n\nvar readIEEE754 = __webpack_require__(1).readIEEE754,\n f = __webpack_require__(72).format,\n Long = __webpack_require__(3).Long,\n Double = __webpack_require__(8).Double,\n Timestamp = __webpack_require__(14).Timestamp,\n ObjectID = __webpack_require__(11).ObjectID,\n _Symbol = __webpack_require__(13).Symbol,\n Code = __webpack_require__(5).Code,\n MinKey = __webpack_require__(10).MinKey,\n MaxKey = __webpack_require__(9).MaxKey,\n Decimal128 = __webpack_require__(7),\n Int32 = __webpack_require__(18),\n DBRef = __webpack_require__(6).DBRef,\n BSONRegExp = __webpack_require__(12).BSONRegExp,\n Binary = __webpack_require__(4).Binary;\n\nvar deserialize = function deserialize(buffer, options, isArray) {\n options = options == null ? {} : options;\n var index = options && options.index ? options.index : 0;\n // Read the document size\n var size = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;\n\n // Ensure buffer is valid size\n if (size < 5 || buffer.length < size || size + index > buffer.length) {\n throw new Error(\"corrupt bson message\");\n }\n\n // Illegal end value\n if (buffer[index + size - 1] != 0) {\n throw new Error(\"One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00\");\n }\n\n // Start deserializtion\n return deserializeObject(buffer, index, options, isArray);\n};\n\nvar deserializeObject = function deserializeObject(buffer, index, options, isArray) {\n var evalFunctions = options['evalFunctions'] == null ? false : options['evalFunctions'];\n var cacheFunctions = options['cacheFunctions'] == null ? false : options['cacheFunctions'];\n var cacheFunctionsCrc32 = options['cacheFunctionsCrc32'] == null ? false : options['cacheFunctionsCrc32'];\n var fieldsAsRaw = options['fieldsAsRaw'] == null ? null : options['fieldsAsRaw'];\n\n // Return raw bson buffer instead of parsing it\n var raw = options['raw'] == null ? false : options['raw'];\n\n // Return BSONRegExp objects instead of native regular expressions\n var bsonRegExp = typeof options['bsonRegExp'] == 'boolean' ? options['bsonRegExp'] : false;\n\n // Controls the promotion of values vs wrapper classes\n var promoteBuffers = options['promoteBuffers'] == null ? false : options['promoteBuffers'];\n var promoteLongs = options['promoteLongs'] == null ? true : options['promoteLongs'];\n var promoteValues = options['promoteValues'] == null ? true : options['promoteValues'];\n\n // Set the start index\n var startIndex = index;\n\n // Validate that we have at least 4 bytes of buffer\n if (buffer.length < 5) throw new Error(\"corrupt bson message < 5 bytes long\");\n\n // Read the document size\n var size = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n // Ensure buffer is valid size\n if (size < 5 || size > buffer.length) throw new Error(\"corrupt bson message\");\n\n // Create holding object\n var object = isArray ? [] : {};\n // Used for arrays to skip having to perform utf8 decoding\n var arrayIndex = 0;\n\n // While we have more left data left keep parsing\n while (true) {\n // Read the type\n var elementType = buffer[index++];\n // If we get a zero it's the last byte, exit\n if (elementType == 0) {\n break;\n }\n\n // Get the start search index\n var i = index;\n // Locate the end of the c string\n while (buffer[i] !== 0x00 && i < buffer.length) {\n i++;\n }\n\n // If are at the end of the buffer there is a problem with the document\n if (i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\");\n var name = isArray ? arrayIndex++ : buffer.toString('utf8', index, i);\n\n index = i + 1;\n\n if (elementType == BSON.BSON_DATA_STRING) {\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n if (stringSize <= 0 || stringSize > buffer.length - index || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n object[name] = buffer.toString('utf8', index, index + stringSize - 1);\n index = index + stringSize;\n } else if (elementType == BSON.BSON_DATA_OID) {\n var oid = new Buffer(12);\n buffer.copy(oid, 0, index, index + 12);\n object[name] = new ObjectID(oid);\n index = index + 12;\n } else if (elementType == BSON.BSON_DATA_INT && promoteValues == false) {\n object[name] = new Int32(buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24);\n } else if (elementType == BSON.BSON_DATA_INT) {\n object[name] = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n } else if (elementType == BSON.BSON_DATA_NUMBER && promoteValues == false) {\n object[name] = new Double(buffer.readDoubleLE(index));\n index = index + 8;\n } else if (elementType == BSON.BSON_DATA_NUMBER) {\n object[name] = buffer.readDoubleLE(index);\n index = index + 8;\n } else if (elementType == BSON.BSON_DATA_DATE) {\n var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n object[name] = new Date(new Long(lowBits, highBits).toNumber());\n } else if (elementType == BSON.BSON_DATA_BOOLEAN) {\n if (buffer[index] != 0 && buffer[index] != 1) throw new Error('illegal boolean type value');\n object[name] = buffer[index++] == 1;\n } else if (elementType == BSON.BSON_DATA_OBJECT) {\n var _index = index;\n var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;\n if (objectSize <= 0 || objectSize > buffer.length - index) throw new Error(\"bad embedded document length in bson\");\n\n // We have a raw value\n if (raw) {\n object[name] = buffer.slice(index, index + objectSize);\n } else {\n object[name] = deserializeObject(buffer, _index, options, false);\n }\n\n index = index + objectSize;\n } else if (elementType == BSON.BSON_DATA_ARRAY) {\n var _index = index;\n var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;\n var arrayOptions = options;\n\n // Stop index\n var stopIndex = index + objectSize;\n\n // All elements of array to be returned as raw bson\n if (fieldsAsRaw && fieldsAsRaw[name]) {\n arrayOptions = {};\n for (var n in options) {\n arrayOptions[n] = options[n];\n }arrayOptions['raw'] = true;\n }\n\n object[name] = deserializeObject(buffer, _index, arrayOptions, true);\n index = index + objectSize;\n\n if (buffer[index - 1] != 0) throw new Error('invalid array terminator byte');\n if (index != stopIndex) throw new Error('corrupted array bson');\n } else if (elementType == BSON.BSON_DATA_UNDEFINED) {\n object[name] = undefined;\n } else if (elementType == BSON.BSON_DATA_NULL) {\n object[name] = null;\n } else if (elementType == BSON.BSON_DATA_LONG) {\n // Unpack the low and high bits\n var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var long = new Long(lowBits, highBits);\n // Promote the long if possible\n if (promoteLongs && promoteValues == true) {\n object[name] = long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG) ? long.toNumber() : long;\n } else {\n object[name] = long;\n }\n } else if (elementType == BSON.BSON_DATA_DECIMAL128) {\n // Buffer to contain the decimal bytes\n var bytes = new Buffer(16);\n // Copy the next 16 bytes into the bytes buffer\n buffer.copy(bytes, 0, index, index + 16);\n // Update index\n index = index + 16;\n // Assign the new Decimal128 value\n var decimal128 = new Decimal128(bytes);\n // If we have an alternative mapper use that\n object[name] = decimal128.toObject ? decimal128.toObject() : decimal128;\n } else if (elementType == BSON.BSON_DATA_BINARY) {\n var binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var totalBinarySize = binarySize;\n var subType = buffer[index++];\n\n // Did we have a negative binary size, throw\n if (binarySize < 0) throw new Error('Negative binary type element size found');\n\n // Is the length longer than the document\n if (binarySize > buffer.length) throw new Error('Binary type size larger than document size');\n\n // Decode as raw Buffer object if options specifies it\n if (buffer['slice'] != null) {\n // If we have subtype 2 skip the 4 bytes for the size\n if (subType == Binary.SUBTYPE_BYTE_ARRAY) {\n binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n if (binarySize < 0) throw new Error('Negative binary type element size found for subtype 0x02');\n if (binarySize > totalBinarySize - 4) throw new Error('Binary type with subtype 0x02 contains to long binary size');\n if (binarySize < totalBinarySize - 4) throw new Error('Binary type with subtype 0x02 contains to short binary size');\n }\n\n if (promoteBuffers && promoteValues) {\n object[name] = buffer.slice(index, index + binarySize);\n } else {\n object[name] = new Binary(buffer.slice(index, index + binarySize), subType);\n }\n } else {\n var _buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(binarySize)) : new Array(binarySize);\n // If we have subtype 2 skip the 4 bytes for the size\n if (subType == Binary.SUBTYPE_BYTE_ARRAY) {\n binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n if (binarySize < 0) throw new Error('Negative binary type element size found for subtype 0x02');\n if (binarySize > totalBinarySize - 4) throw new Error('Binary type with subtype 0x02 contains to long binary size');\n if (binarySize < totalBinarySize - 4) throw new Error('Binary type with subtype 0x02 contains to short binary size');\n }\n\n // Copy the data\n for (var i = 0; i < binarySize; i++) {\n _buffer[i] = buffer[index + i];\n }\n\n if (promoteBuffers && promoteValues) {\n object[name] = _buffer;\n } else {\n object[name] = new Binary(_buffer, subType);\n }\n }\n\n // Update the index\n index = index + binarySize;\n } else if (elementType == BSON.BSON_DATA_REGEXP && bsonRegExp == false) {\n // Get the start search index\n var i = index;\n // Locate the end of the c string\n while (buffer[i] !== 0x00 && i < buffer.length) {\n i++;\n }\n // If are at the end of the buffer there is a problem with the document\n if (i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\");\n // Return the C string\n var source = buffer.toString('utf8', index, i);\n // Create the regexp\n index = i + 1;\n\n // Get the start search index\n var i = index;\n // Locate the end of the c string\n while (buffer[i] !== 0x00 && i < buffer.length) {\n i++;\n }\n // If are at the end of the buffer there is a problem with the document\n if (i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\");\n // Return the C string\n var regExpOptions = buffer.toString('utf8', index, i);\n index = i + 1;\n\n // For each option add the corresponding one for javascript\n var optionsArray = new Array(regExpOptions.length);\n\n // Parse options\n for (var i = 0; i < regExpOptions.length; i++) {\n switch (regExpOptions[i]) {\n case 'm':\n optionsArray[i] = 'm';\n break;\n case 's':\n optionsArray[i] = 'g';\n break;\n case 'i':\n optionsArray[i] = 'i';\n break;\n }\n }\n\n object[name] = new RegExp(source, optionsArray.join(''));\n } else if (elementType == BSON.BSON_DATA_REGEXP && bsonRegExp == true) {\n // Get the start search index\n var i = index;\n // Locate the end of the c string\n while (buffer[i] !== 0x00 && i < buffer.length) {\n i++;\n }\n // If are at the end of the buffer there is a problem with the document\n if (i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\");\n // Return the C string\n var source = buffer.toString('utf8', index, i);\n index = i + 1;\n\n // Get the start search index\n var i = index;\n // Locate the end of the c string\n while (buffer[i] !== 0x00 && i < buffer.length) {\n i++;\n }\n // If are at the end of the buffer there is a problem with the document\n if (i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\");\n // Return the C string\n var regExpOptions = buffer.toString('utf8', index, i);\n index = i + 1;\n\n // Set the object\n object[name] = new BSONRegExp(source, regExpOptions);\n } else if (elementType == BSON.BSON_DATA_SYMBOL) {\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n if (stringSize <= 0 || stringSize > buffer.length - index || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n object[name] = new _Symbol(buffer.toString('utf8', index, index + stringSize - 1));\n index = index + stringSize;\n } else if (elementType == BSON.BSON_DATA_TIMESTAMP) {\n var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n object[name] = new Timestamp(lowBits, highBits);\n } else if (elementType == BSON.BSON_DATA_MIN_KEY) {\n object[name] = new MinKey();\n } else if (elementType == BSON.BSON_DATA_MAX_KEY) {\n object[name] = new MaxKey();\n } else if (elementType == BSON.BSON_DATA_CODE) {\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n if (stringSize <= 0 || stringSize > buffer.length - index || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n var functionString = buffer.toString('utf8', index, index + stringSize - 1);\n\n // If we are evaluating the functions\n if (evalFunctions) {\n var value = null;\n // If we have cache enabled let's look for the md5 of the function in the cache\n if (cacheFunctions) {\n var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString;\n // Got to do this to avoid V8 deoptimizing the call due to finding eval\n object[name] = isolateEvalWithHash(functionCache, hash, functionString, object);\n } else {\n object[name] = isolateEval(functionString);\n }\n } else {\n object[name] = new Code(functionString);\n }\n\n // Update parse index position\n index = index + stringSize;\n } else if (elementType == BSON.BSON_DATA_CODE_W_SCOPE) {\n var totalSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n // Element cannot be shorter than totalSize + stringSize + documentSize + terminator\n if (totalSize < 4 + 4 + 4 + 1) {\n throw new Error(\"code_w_scope total size shorter minimum expected length\");\n }\n\n // Get the code string size\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n // Check if we have a valid string\n if (stringSize <= 0 || stringSize > buffer.length - index || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n\n // Javascript function\n var functionString = buffer.toString('utf8', index, index + stringSize - 1);\n // Update parse index position\n index = index + stringSize;\n // Parse the element\n var _index = index;\n // Decode the size of the object document\n var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;\n // Decode the scope object\n var scopeObject = deserializeObject(buffer, _index, options, false);\n // Adjust the index\n index = index + objectSize;\n\n // Check if field length is to short\n if (totalSize < 4 + 4 + objectSize + stringSize) {\n throw new Error('code_w_scope total size is to short, truncating scope');\n }\n\n // Check if totalSize field is to long\n if (totalSize > 4 + 4 + objectSize + stringSize) {\n throw new Error('code_w_scope total size is to long, clips outer document');\n }\n\n // If we are evaluating the functions\n if (evalFunctions) {\n // Contains the value we are going to set\n var value = null;\n // If we have cache enabled let's look for the md5 of the function in the cache\n if (cacheFunctions) {\n var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString;\n // Got to do this to avoid V8 deoptimizing the call due to finding eval\n object[name] = isolateEvalWithHash(functionCache, hash, functionString, object);\n } else {\n object[name] = isolateEval(functionString);\n }\n\n object[name].scope = scopeObject;\n } else {\n object[name] = new Code(functionString, scopeObject);\n }\n } else if (elementType == BSON.BSON_DATA_DBPOINTER) {\n // Get the code string size\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n // Check if we have a valid string\n if (stringSize <= 0 || stringSize > buffer.length - index || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n // Namespace\n var namespace = buffer.toString('utf8', index, index + stringSize - 1);\n // Update parse index position\n index = index + stringSize;\n\n // Read the oid\n var oidBuffer = new Buffer(12);\n buffer.copy(oidBuffer, 0, index, index + 12);\n var oid = new ObjectID(oidBuffer);\n\n // Update the index\n index = index + 12;\n\n // Split the namespace\n var parts = namespace.split('.');\n var db = parts.shift();\n var collection = parts.join('.');\n // Upgrade to DBRef type\n object[name] = new DBRef(collection, oid, db);\n } else {\n throw new Error(\"Detected unknown BSON type \" + elementType.toString(16) + \" for fieldname \\\"\" + name + \"\\\", are you using the latest BSON parser\");\n }\n }\n\n // Check if the deserialization was against a valid array/object\n if (size != index - startIndex) {\n if (isArray) throw new Error('corrupt array bson');\n throw new Error('corrupt object bson');\n }\n\n // Check if we have a db ref object\n if (object['$id'] != null) object = new DBRef(object['$ref'], object['$id'], object['$db']);\n return object;\n};\n\n/**\n * Ensure eval is isolated.\n *\n * @ignore\n * @api private\n */\nvar isolateEvalWithHash = function isolateEvalWithHash(functionCache, hash, functionString, object) {\n // Contains the value we are going to set\n var value = null;\n\n // Check for cache hit, eval if missing and return cached function\n if (functionCache[hash] == null) {\n eval(\"value = \" + functionString);\n functionCache[hash] = value;\n }\n // Set the object\n return functionCache[hash].bind(object);\n};\n\n/**\n * Ensure eval is isolated.\n *\n * @ignore\n * @api private\n */\nvar isolateEval = function isolateEval(functionString) {\n // Contains the value we are going to set\n var value = null;\n // Eval the function\n eval(\"value = \" + functionString);\n return value;\n};\n\nvar BSON = {};\n\n/**\n * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5\n *\n * @ignore\n * @api private\n */\nvar functionCache = BSON.functionCache = {};\n\n/**\n * Number BSON Type\n *\n * @classconstant BSON_DATA_NUMBER\n **/\nBSON.BSON_DATA_NUMBER = 1;\n/**\n * String BSON Type\n *\n * @classconstant BSON_DATA_STRING\n **/\nBSON.BSON_DATA_STRING = 2;\n/**\n * Object BSON Type\n *\n * @classconstant BSON_DATA_OBJECT\n **/\nBSON.BSON_DATA_OBJECT = 3;\n/**\n * Array BSON Type\n *\n * @classconstant BSON_DATA_ARRAY\n **/\nBSON.BSON_DATA_ARRAY = 4;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_BINARY\n **/\nBSON.BSON_DATA_BINARY = 5;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_UNDEFINED\n **/\nBSON.BSON_DATA_UNDEFINED = 6;\n/**\n * ObjectID BSON Type\n *\n * @classconstant BSON_DATA_OID\n **/\nBSON.BSON_DATA_OID = 7;\n/**\n * Boolean BSON Type\n *\n * @classconstant BSON_DATA_BOOLEAN\n **/\nBSON.BSON_DATA_BOOLEAN = 8;\n/**\n * Date BSON Type\n *\n * @classconstant BSON_DATA_DATE\n **/\nBSON.BSON_DATA_DATE = 9;\n/**\n * null BSON Type\n *\n * @classconstant BSON_DATA_NULL\n **/\nBSON.BSON_DATA_NULL = 10;\n/**\n * RegExp BSON Type\n *\n * @classconstant BSON_DATA_REGEXP\n **/\nBSON.BSON_DATA_REGEXP = 11;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_DBPOINTER\n **/\nBSON.BSON_DATA_DBPOINTER = 12;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_CODE\n **/\nBSON.BSON_DATA_CODE = 13;\n/**\n * Symbol BSON Type\n *\n * @classconstant BSON_DATA_SYMBOL\n **/\nBSON.BSON_DATA_SYMBOL = 14;\n/**\n * Code with Scope BSON Type\n *\n * @classconstant BSON_DATA_CODE_W_SCOPE\n **/\nBSON.BSON_DATA_CODE_W_SCOPE = 15;\n/**\n * 32 bit Integer BSON Type\n *\n * @classconstant BSON_DATA_INT\n **/\nBSON.BSON_DATA_INT = 16;\n/**\n * Timestamp BSON Type\n *\n * @classconstant BSON_DATA_TIMESTAMP\n **/\nBSON.BSON_DATA_TIMESTAMP = 17;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_LONG\n **/\nBSON.BSON_DATA_LONG = 18;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_DECIMAL128\n **/\nBSON.BSON_DATA_DECIMAL128 = 19;\n/**\n * MinKey BSON Type\n *\n * @classconstant BSON_DATA_MIN_KEY\n **/\nBSON.BSON_DATA_MIN_KEY = 0xff;\n/**\n * MaxKey BSON Type\n *\n * @classconstant BSON_DATA_MAX_KEY\n **/\nBSON.BSON_DATA_MAX_KEY = 0x7f;\n\n/**\n * Binary Default Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_DEFAULT\n **/\nBSON.BSON_BINARY_SUBTYPE_DEFAULT = 0;\n/**\n * Binary Function Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_FUNCTION\n **/\nBSON.BSON_BINARY_SUBTYPE_FUNCTION = 1;\n/**\n * Binary Byte Array Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY\n **/\nBSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;\n/**\n * Binary UUID Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_UUID\n **/\nBSON.BSON_BINARY_SUBTYPE_UUID = 3;\n/**\n * Binary MD5 Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_MD5\n **/\nBSON.BSON_BINARY_SUBTYPE_MD5 = 4;\n/**\n * Binary User Defined Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED\n **/\nBSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128;\n\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\nBSON.BSON_INT64_MAX = Math.pow(2, 63) - 1;\nBSON.BSON_INT64_MIN = -Math.pow(2, 63);\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\n// Internal long versions\nvar JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double.\nvar JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double.\n\nmodule.exports = deserialize;\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))\n\n/***/ }),\n/* 29 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Buffer) {\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar writeIEEE754 = __webpack_require__(1).writeIEEE754,\n readIEEE754 = __webpack_require__(1).readIEEE754,\n Long = __webpack_require__(3).Long,\n Map = __webpack_require__(20),\n Double = __webpack_require__(8).Double,\n Timestamp = __webpack_require__(14).Timestamp,\n ObjectID = __webpack_require__(11).ObjectID,\n _Symbol = __webpack_require__(13).Symbol,\n Code = __webpack_require__(5).Code,\n BSONRegExp = __webpack_require__(12).BSONRegExp,\n Int32 = __webpack_require__(18).Int32,\n MinKey = __webpack_require__(10).MinKey,\n MaxKey = __webpack_require__(9).MaxKey,\n Decimal128 = __webpack_require__(7),\n DBRef = __webpack_require__(6).DBRef,\n Binary = __webpack_require__(4).Binary;\n\ntry {\n var _Buffer = Uint8Array;\n} catch (e) {\n var _Buffer = Buffer;\n}\n\nvar regexp = /\\x00/;\n\n// To ensure that 0.4 of node works correctly\nvar isDate = function isDate(d) {\n return (typeof d === 'undefined' ? 'undefined' : _typeof(d)) === 'object' && Object.prototype.toString.call(d) === '[object Date]';\n};\n\nvar isRegExp = function isRegExp(d) {\n return Object.prototype.toString.call(d) === '[object RegExp]';\n};\n\nvar serializeString = function serializeString(buffer, key, value, index, isArray) {\n // Encode String type\n buffer[index++] = BSON.BSON_DATA_STRING;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes + 1;\n buffer[index - 1] = 0;\n // Write the string\n var size = buffer.write(value, index + 4, 'utf8');\n // Write the size of the string to buffer\n buffer[index + 3] = size + 1 >> 24 & 0xff;\n buffer[index + 2] = size + 1 >> 16 & 0xff;\n buffer[index + 1] = size + 1 >> 8 & 0xff;\n buffer[index] = size + 1 & 0xff;\n // Update index\n index = index + 4 + size;\n // Write zero\n buffer[index++] = 0;\n return index;\n};\n\nvar serializeNumber = function serializeNumber(buffer, key, value, index, isArray) {\n // We have an integer value\n if (Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) {\n // If the value fits in 32 bits encode as int, if it fits in a double\n // encode it as a double, otherwise long\n if (value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) {\n // Set int type 32 bits or less\n buffer[index++] = BSON.BSON_DATA_INT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the int value\n buffer[index++] = value & 0xff;\n buffer[index++] = value >> 8 & 0xff;\n buffer[index++] = value >> 16 & 0xff;\n buffer[index++] = value >> 24 & 0xff;\n } else if (value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) {\n // Encode as double\n buffer[index++] = BSON.BSON_DATA_NUMBER;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write float\n writeIEEE754(buffer, value, index, 'little', 52, 8);\n // Ajust index\n index = index + 8;\n } else {\n // Set long type\n buffer[index++] = BSON.BSON_DATA_LONG;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n var longVal = Long.fromNumber(value);\n var lowBits = longVal.getLowBits();\n var highBits = longVal.getHighBits();\n // Encode low bits\n buffer[index++] = lowBits & 0xff;\n buffer[index++] = lowBits >> 8 & 0xff;\n buffer[index++] = lowBits >> 16 & 0xff;\n buffer[index++] = lowBits >> 24 & 0xff;\n // Encode high bits\n buffer[index++] = highBits & 0xff;\n buffer[index++] = highBits >> 8 & 0xff;\n buffer[index++] = highBits >> 16 & 0xff;\n buffer[index++] = highBits >> 24 & 0xff;\n }\n } else {\n // Encode as double\n buffer[index++] = BSON.BSON_DATA_NUMBER;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write float\n writeIEEE754(buffer, value, index, 'little', 52, 8);\n // Ajust index\n index = index + 8;\n }\n\n return index;\n};\n\nvar serializeNull = function serializeNull(buffer, key, value, index, isArray) {\n // Set long type\n buffer[index++] = BSON.BSON_DATA_NULL;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n return index;\n};\n\nvar serializeBoolean = function serializeBoolean(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_BOOLEAN;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Encode the boolean value\n buffer[index++] = value ? 1 : 0;\n return index;\n};\n\nvar serializeDate = function serializeDate(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_DATE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Write the date\n var dateInMilis = Long.fromNumber(value.getTime());\n var lowBits = dateInMilis.getLowBits();\n var highBits = dateInMilis.getHighBits();\n // Encode low bits\n buffer[index++] = lowBits & 0xff;\n buffer[index++] = lowBits >> 8 & 0xff;\n buffer[index++] = lowBits >> 16 & 0xff;\n buffer[index++] = lowBits >> 24 & 0xff;\n // Encode high bits\n buffer[index++] = highBits & 0xff;\n buffer[index++] = highBits >> 8 & 0xff;\n buffer[index++] = highBits >> 16 & 0xff;\n buffer[index++] = highBits >> 24 & 0xff;\n return index;\n};\n\nvar serializeRegExp = function serializeRegExp(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_REGEXP;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n if (value.source && value.source.match(regexp) != null) {\n throw Error(\"value \" + value.source + \" must not contain null bytes\");\n }\n // Adjust the index\n index = index + buffer.write(value.source, index, 'utf8');\n // Write zero\n buffer[index++] = 0x00;\n // Write the parameters\n if (value.global) buffer[index++] = 0x73; // s\n if (value.ignoreCase) buffer[index++] = 0x69; // i\n if (value.multiline) buffer[index++] = 0x6d; // m\n // Add ending zero\n buffer[index++] = 0x00;\n return index;\n};\n\nvar serializeBSONRegExp = function serializeBSONRegExp(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_REGEXP;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Check the pattern for 0 bytes\n if (value.pattern.match(regexp) != null) {\n // The BSON spec doesn't allow keys with null bytes because keys are\n // null-terminated.\n throw Error(\"pattern \" + value.pattern + \" must not contain null bytes\");\n }\n\n // Adjust the index\n index = index + buffer.write(value.pattern, index, 'utf8');\n // Write zero\n buffer[index++] = 0x00;\n // Write the options\n index = index + buffer.write(value.options.split('').sort().join(''), index, 'utf8');\n // Add ending zero\n buffer[index++] = 0x00;\n return index;\n};\n\nvar serializeMinMax = function serializeMinMax(buffer, key, value, index, isArray) {\n // Write the type of either min or max key\n if (value === null) {\n buffer[index++] = BSON.BSON_DATA_NULL;\n } else if (value instanceof MinKey) {\n buffer[index++] = BSON.BSON_DATA_MIN_KEY;\n } else {\n buffer[index++] = BSON.BSON_DATA_MAX_KEY;\n }\n\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n return index;\n};\n\nvar serializeObjectId = function serializeObjectId(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_OID;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Write the objectId into the shared buffer\n if (typeof value.id == 'string') {\n buffer.write(value.id, index, 'binary');\n } else if (value.id && value.id.copy) {\n value.id.copy(buffer, index, 0, 12);\n } else {\n throw new Error('object [' + JSON.stringify(value) + \"] is not a valid ObjectId\");\n }\n\n // Ajust index\n return index + 12;\n};\n\nvar serializeBuffer = function serializeBuffer(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_BINARY;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Get size of the buffer (current write point)\n var size = value.length;\n // Write the size of the string to buffer\n buffer[index++] = size & 0xff;\n buffer[index++] = size >> 8 & 0xff;\n buffer[index++] = size >> 16 & 0xff;\n buffer[index++] = size >> 24 & 0xff;\n // Write the default subtype\n buffer[index++] = BSON.BSON_BINARY_SUBTYPE_DEFAULT;\n // Copy the content form the binary field to the buffer\n value.copy(buffer, index, 0, size);\n // Adjust the index\n index = index + size;\n return index;\n};\n\nvar serializeObject = function serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, isArray, path) {\n for (var i = 0; i < path.length; i++) {\n if (path[i] === value) throw new Error('cyclic dependency detected');\n }\n\n // Push value to stack\n path.push(value);\n // Write the type\n buffer[index++] = Array.isArray(value) ? BSON.BSON_DATA_ARRAY : BSON.BSON_DATA_OBJECT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n var endIndex = serializeInto(buffer, value, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined, path);\n // Pop stack\n path.pop();\n // Write size\n var size = endIndex - index;\n return endIndex;\n};\n\nvar serializeDecimal128 = function serializeDecimal128(buffer, key, value, index, isArray) {\n buffer[index++] = BSON.BSON_DATA_DECIMAL128;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the data from the value\n value.bytes.copy(buffer, index, 0, 16);\n return index + 16;\n};\n\nvar serializeLong = function serializeLong(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = value._bsontype == 'Long' ? BSON.BSON_DATA_LONG : BSON.BSON_DATA_TIMESTAMP;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the date\n var lowBits = value.getLowBits();\n var highBits = value.getHighBits();\n // Encode low bits\n buffer[index++] = lowBits & 0xff;\n buffer[index++] = lowBits >> 8 & 0xff;\n buffer[index++] = lowBits >> 16 & 0xff;\n buffer[index++] = lowBits >> 24 & 0xff;\n // Encode high bits\n buffer[index++] = highBits & 0xff;\n buffer[index++] = highBits >> 8 & 0xff;\n buffer[index++] = highBits >> 16 & 0xff;\n buffer[index++] = highBits >> 24 & 0xff;\n return index;\n};\n\nvar serializeInt32 = function serializeInt32(buffer, key, value, index, isArray) {\n // Set int type 32 bits or less\n buffer[index++] = BSON.BSON_DATA_INT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the int value\n buffer[index++] = value & 0xff;\n buffer[index++] = value >> 8 & 0xff;\n buffer[index++] = value >> 16 & 0xff;\n buffer[index++] = value >> 24 & 0xff;\n return index;\n};\n\nvar serializeDouble = function serializeDouble(buffer, key, value, index, isArray) {\n // Encode as double\n buffer[index++] = BSON.BSON_DATA_NUMBER;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write float\n writeIEEE754(buffer, value, index, 'little', 52, 8);\n // Ajust index\n index = index + 8;\n return index;\n};\n\nvar serializeFunction = function serializeFunction(buffer, key, value, index, checkKeys, depth, isArray) {\n buffer[index++] = BSON.BSON_DATA_CODE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Function string\n var functionString = value.toString();\n // Write the string\n var size = buffer.write(functionString, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = size & 0xff;\n buffer[index + 1] = size >> 8 & 0xff;\n buffer[index + 2] = size >> 16 & 0xff;\n buffer[index + 3] = size >> 24 & 0xff;\n // Update index\n index = index + 4 + size - 1;\n // Write zero\n buffer[index++] = 0;\n return index;\n};\n\nvar serializeCode = function serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, isArray) {\n if (value.scope && _typeof(value.scope) == 'object') {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Starting index\n var startIndex = index;\n\n // Serialize the function\n // Get the function string\n var functionString = typeof value.code == 'string' ? value.code : value.code.toString();\n // Index adjustment\n index = index + 4;\n // Write string into buffer\n var codeSize = buffer.write(functionString, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = codeSize & 0xff;\n buffer[index + 1] = codeSize >> 8 & 0xff;\n buffer[index + 2] = codeSize >> 16 & 0xff;\n buffer[index + 3] = codeSize >> 24 & 0xff;\n // Write end 0\n buffer[index + 4 + codeSize - 1] = 0;\n // Write the\n index = index + codeSize + 4;\n\n //\n // Serialize the scope value\n var endIndex = serializeInto(buffer, value.scope, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined);\n index = endIndex - 1;\n\n // Writ the total\n var totalSize = endIndex - startIndex;\n\n // Write the total size of the object\n buffer[startIndex++] = totalSize & 0xff;\n buffer[startIndex++] = totalSize >> 8 & 0xff;\n buffer[startIndex++] = totalSize >> 16 & 0xff;\n buffer[startIndex++] = totalSize >> 24 & 0xff;\n // Write trailing zero\n buffer[index++] = 0;\n } else {\n buffer[index++] = BSON.BSON_DATA_CODE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Function string\n var functionString = value.code.toString();\n // Write the string\n var size = buffer.write(functionString, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = size & 0xff;\n buffer[index + 1] = size >> 8 & 0xff;\n buffer[index + 2] = size >> 16 & 0xff;\n buffer[index + 3] = size >> 24 & 0xff;\n // Update index\n index = index + 4 + size - 1;\n // Write zero\n buffer[index++] = 0;\n }\n\n return index;\n};\n\nvar serializeBinary = function serializeBinary(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_BINARY;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Extract the buffer\n var data = value.value(true);\n // Calculate size\n var size = value.position;\n // Add the deprecated 02 type 4 bytes of size to total\n if (value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) size = size + 4;\n // Write the size of the string to buffer\n buffer[index++] = size & 0xff;\n buffer[index++] = size >> 8 & 0xff;\n buffer[index++] = size >> 16 & 0xff;\n buffer[index++] = size >> 24 & 0xff;\n // Write the subtype to the buffer\n buffer[index++] = value.sub_type;\n\n // If we have binary type 2 the 4 first bytes are the size\n if (value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) {\n size = size - 4;\n buffer[index++] = size & 0xff;\n buffer[index++] = size >> 8 & 0xff;\n buffer[index++] = size >> 16 & 0xff;\n buffer[index++] = size >> 24 & 0xff;\n }\n\n // Write the data to the object\n data.copy(buffer, index, 0, value.position);\n // Adjust the index\n index = index + value.position;\n return index;\n};\n\nvar serializeSymbol = function serializeSymbol(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_SYMBOL;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the string\n var size = buffer.write(value.value, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = size & 0xff;\n buffer[index + 1] = size >> 8 & 0xff;\n buffer[index + 2] = size >> 16 & 0xff;\n buffer[index + 3] = size >> 24 & 0xff;\n // Update index\n index = index + 4 + size - 1;\n // Write zero\n buffer[index++] = 0x00;\n return index;\n};\n\nvar serializeDBRef = function serializeDBRef(buffer, key, value, index, depth, serializeFunctions, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_OBJECT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n var startIndex = index;\n var endIndex;\n\n // Serialize object\n if (null != value.db) {\n endIndex = serializeInto(buffer, {\n '$ref': value.namespace,\n '$id': value.oid,\n '$db': value.db\n }, false, index, depth + 1, serializeFunctions);\n } else {\n endIndex = serializeInto(buffer, {\n '$ref': value.namespace,\n '$id': value.oid\n }, false, index, depth + 1, serializeFunctions);\n }\n\n // Calculate object size\n var size = endIndex - startIndex;\n // Write the size\n buffer[startIndex++] = size & 0xff;\n buffer[startIndex++] = size >> 8 & 0xff;\n buffer[startIndex++] = size >> 16 & 0xff;\n buffer[startIndex++] = size >> 24 & 0xff;\n // Set index\n return endIndex;\n};\n\nvar serializeInto = function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializeFunctions, ignoreUndefined, path) {\n startingIndex = startingIndex || 0;\n path = path || [];\n\n // Push the object to the path\n path.push(object);\n\n // Start place to serialize into\n var index = startingIndex + 4;\n var self = this;\n\n // Special case isArray\n if (Array.isArray(object)) {\n // Get object keys\n for (var i = 0; i < object.length; i++) {\n var key = \"\" + i;\n var value = object[i];\n\n // Is there an override value\n if (value && value.toBSON) {\n if (typeof value.toBSON != 'function') throw new Error(\"toBSON is not a function\");\n value = value.toBSON();\n }\n\n var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);\n if (type == 'string') {\n index = serializeString(buffer, key, value, index, true);\n } else if (type == 'number') {\n index = serializeNumber(buffer, key, value, index, true);\n } else if (type == 'boolean') {\n index = serializeBoolean(buffer, key, value, index, true);\n } else if (value instanceof Date || isDate(value)) {\n index = serializeDate(buffer, key, value, index, true);\n } else if (value === undefined) {\n index = serializeNull(buffer, key, value, index, true);\n } else if (value === null) {\n index = serializeNull(buffer, key, value, index, true);\n } else if (value['_bsontype'] == 'ObjectID') {\n index = serializeObjectId(buffer, key, value, index, true);\n } else if (Buffer.isBuffer(value)) {\n index = serializeBuffer(buffer, key, value, index, true);\n } else if (value instanceof RegExp || isRegExp(value)) {\n index = serializeRegExp(buffer, key, value, index, true);\n } else if (type == 'object' && value['_bsontype'] == null) {\n index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, true, path);\n } else if (type == 'object' && value['_bsontype'] == 'Decimal128') {\n index = serializeDecimal128(buffer, key, value, index, true);\n } else if (value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {\n index = serializeLong(buffer, key, value, index, true);\n } else if (value['_bsontype'] == 'Double') {\n index = serializeDouble(buffer, key, value, index, true);\n } else if (typeof value == 'function' && serializeFunctions) {\n index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions, true);\n } else if (value['_bsontype'] == 'Code') {\n index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, true);\n } else if (value['_bsontype'] == 'Binary') {\n index = serializeBinary(buffer, key, value, index, true);\n } else if (value['_bsontype'] == 'Symbol') {\n index = serializeSymbol(buffer, key, value, index, true);\n } else if (value['_bsontype'] == 'DBRef') {\n index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, true);\n } else if (value['_bsontype'] == 'BSONRegExp') {\n index = serializeBSONRegExp(buffer, key, value, index, true);\n } else if (value['_bsontype'] == 'Int32') {\n index = serializeInt32(buffer, key, value, index, true);\n } else if (value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n index = serializeMinMax(buffer, key, value, index, true);\n }\n }\n } else if (object instanceof Map) {\n var iterator = object.entries();\n var done = false;\n\n while (!done) {\n // Unpack the next entry\n var entry = iterator.next();\n done = entry.done;\n // Are we done, then skip and terminate\n if (done) continue;\n\n // Get the entry values\n var key = entry.value[0];\n var value = entry.value[1];\n\n // Check the type of the value\n var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);\n\n // Check the key and throw error if it's illegal\n if (key != '$db' && key != '$ref' && key != '$id') {\n if (key.match(regexp) != null) {\n // The BSON spec doesn't allow keys with null bytes because keys are\n // null-terminated.\n throw Error(\"key \" + key + \" must not contain null bytes\");\n }\n\n if (checkKeys) {\n if ('$' == key[0]) {\n throw Error(\"key \" + key + \" must not start with '$'\");\n } else if (!!~key.indexOf('.')) {\n throw Error(\"key \" + key + \" must not contain '.'\");\n }\n }\n }\n\n if (type == 'string') {\n index = serializeString(buffer, key, value, index);\n } else if (type == 'number') {\n index = serializeNumber(buffer, key, value, index);\n } else if (type == 'boolean') {\n index = serializeBoolean(buffer, key, value, index);\n } else if (value instanceof Date || isDate(value)) {\n index = serializeDate(buffer, key, value, index);\n } else if (value === undefined && ignoreUndefined == true) {} else if (value === null || value === undefined) {\n index = serializeNull(buffer, key, value, index);\n } else if (value['_bsontype'] == 'ObjectID') {\n index = serializeObjectId(buffer, key, value, index);\n } else if (Buffer.isBuffer(value)) {\n index = serializeBuffer(buffer, key, value, index);\n } else if (value instanceof RegExp || isRegExp(value)) {\n index = serializeRegExp(buffer, key, value, index);\n } else if (type == 'object' && value['_bsontype'] == null) {\n index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, false, path);\n } else if (type == 'object' && value['_bsontype'] == 'Decimal128') {\n index = serializeDecimal128(buffer, key, value, index);\n } else if (value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {\n index = serializeLong(buffer, key, value, index);\n } else if (value['_bsontype'] == 'Double') {\n index = serializeDouble(buffer, key, value, index);\n } else if (value['_bsontype'] == 'Code') {\n index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined);\n } else if (typeof value == 'function' && serializeFunctions) {\n index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions);\n } else if (value['_bsontype'] == 'Binary') {\n index = serializeBinary(buffer, key, value, index);\n } else if (value['_bsontype'] == 'Symbol') {\n index = serializeSymbol(buffer, key, value, index);\n } else if (value['_bsontype'] == 'DBRef') {\n index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions);\n } else if (value['_bsontype'] == 'BSONRegExp') {\n index = serializeBSONRegExp(buffer, key, value, index);\n } else if (value['_bsontype'] == 'Int32') {\n index = serializeInt32(buffer, key, value, index);\n } else if (value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n index = serializeMinMax(buffer, key, value, index);\n }\n }\n } else {\n // Did we provide a custom serialization method\n if (object.toBSON) {\n if (typeof object.toBSON != 'function') throw new Error(\"toBSON is not a function\");\n object = object.toBSON();\n if (object != null && (typeof object === 'undefined' ? 'undefined' : _typeof(object)) != 'object') throw new Error(\"toBSON function did not return an object\");\n }\n\n // Iterate over all the keys\n for (var key in object) {\n var value = object[key];\n // Is there an override value\n if (value && value.toBSON) {\n if (typeof value.toBSON != 'function') throw new Error(\"toBSON is not a function\");\n value = value.toBSON();\n }\n\n // Check the type of the value\n var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);\n\n // Check the key and throw error if it's illegal\n if (key != '$db' && key != '$ref' && key != '$id') {\n if (key.match(regexp) != null) {\n // The BSON spec doesn't allow keys with null bytes because keys are\n // null-terminated.\n throw Error(\"key \" + key + \" must not contain null bytes\");\n }\n\n if (checkKeys) {\n if ('$' == key[0]) {\n throw Error(\"key \" + key + \" must not start with '$'\");\n } else if (!!~key.indexOf('.')) {\n throw Error(\"key \" + key + \" must not contain '.'\");\n }\n }\n }\n\n if (type == 'string') {\n index = serializeString(buffer, key, value, index);\n } else if (type == 'number') {\n index = serializeNumber(buffer, key, value, index);\n } else if (type == 'boolean') {\n index = serializeBoolean(buffer, key, value, index);\n } else if (value instanceof Date || isDate(value)) {\n index = serializeDate(buffer, key, value, index);\n } else if (value === undefined && ignoreUndefined == true) {} else if (value === null || value === undefined) {\n index = serializeNull(buffer, key, value, index);\n } else if (value['_bsontype'] == 'ObjectID') {\n index = serializeObjectId(buffer, key, value, index);\n } else if (Buffer.isBuffer(value)) {\n index = serializeBuffer(buffer, key, value, index);\n } else if (value instanceof RegExp || isRegExp(value)) {\n index = serializeRegExp(buffer, key, value, index);\n } else if (type == 'object' && value['_bsontype'] == null) {\n index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, false, path);\n } else if (type == 'object' && value['_bsontype'] == 'Decimal128') {\n index = serializeDecimal128(buffer, key, value, index);\n } else if (value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {\n index = serializeLong(buffer, key, value, index);\n } else if (value['_bsontype'] == 'Double') {\n index = serializeDouble(buffer, key, value, index);\n } else if (value['_bsontype'] == 'Code') {\n index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined);\n } else if (typeof value == 'function' && serializeFunctions) {\n index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions);\n } else if (value['_bsontype'] == 'Binary') {\n index = serializeBinary(buffer, key, value, index);\n } else if (value['_bsontype'] == 'Symbol') {\n index = serializeSymbol(buffer, key, value, index);\n } else if (value['_bsontype'] == 'DBRef') {\n index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions);\n } else if (value['_bsontype'] == 'BSONRegExp') {\n index = serializeBSONRegExp(buffer, key, value, index);\n } else if (value['_bsontype'] == 'Int32') {\n index = serializeInt32(buffer, key, value, index);\n } else if (value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n index = serializeMinMax(buffer, key, value, index);\n }\n }\n }\n\n // Remove the path\n path.pop();\n\n // Final padding byte for object\n buffer[index++] = 0x00;\n\n // Final size\n var size = index - startingIndex;\n // Write the size of the object\n buffer[startingIndex++] = size & 0xff;\n buffer[startingIndex++] = size >> 8 & 0xff;\n buffer[startingIndex++] = size >> 16 & 0xff;\n buffer[startingIndex++] = size >> 24 & 0xff;\n return index;\n};\n\nvar BSON = {};\n\n/**\n * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5\n *\n * @ignore\n * @api private\n */\nvar functionCache = BSON.functionCache = {};\n\n/**\n * Number BSON Type\n *\n * @classconstant BSON_DATA_NUMBER\n **/\nBSON.BSON_DATA_NUMBER = 1;\n/**\n * String BSON Type\n *\n * @classconstant BSON_DATA_STRING\n **/\nBSON.BSON_DATA_STRING = 2;\n/**\n * Object BSON Type\n *\n * @classconstant BSON_DATA_OBJECT\n **/\nBSON.BSON_DATA_OBJECT = 3;\n/**\n * Array BSON Type\n *\n * @classconstant BSON_DATA_ARRAY\n **/\nBSON.BSON_DATA_ARRAY = 4;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_BINARY\n **/\nBSON.BSON_DATA_BINARY = 5;\n/**\n * ObjectID BSON Type, deprecated\n *\n * @classconstant BSON_DATA_UNDEFINED\n **/\nBSON.BSON_DATA_UNDEFINED = 6;\n/**\n * ObjectID BSON Type\n *\n * @classconstant BSON_DATA_OID\n **/\nBSON.BSON_DATA_OID = 7;\n/**\n * Boolean BSON Type\n *\n * @classconstant BSON_DATA_BOOLEAN\n **/\nBSON.BSON_DATA_BOOLEAN = 8;\n/**\n * Date BSON Type\n *\n * @classconstant BSON_DATA_DATE\n **/\nBSON.BSON_DATA_DATE = 9;\n/**\n * null BSON Type\n *\n * @classconstant BSON_DATA_NULL\n **/\nBSON.BSON_DATA_NULL = 10;\n/**\n * RegExp BSON Type\n *\n * @classconstant BSON_DATA_REGEXP\n **/\nBSON.BSON_DATA_REGEXP = 11;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_CODE\n **/\nBSON.BSON_DATA_CODE = 13;\n/**\n * Symbol BSON Type\n *\n * @classconstant BSON_DATA_SYMBOL\n **/\nBSON.BSON_DATA_SYMBOL = 14;\n/**\n * Code with Scope BSON Type\n *\n * @classconstant BSON_DATA_CODE_W_SCOPE\n **/\nBSON.BSON_DATA_CODE_W_SCOPE = 15;\n/**\n * 32 bit Integer BSON Type\n *\n * @classconstant BSON_DATA_INT\n **/\nBSON.BSON_DATA_INT = 16;\n/**\n * Timestamp BSON Type\n *\n * @classconstant BSON_DATA_TIMESTAMP\n **/\nBSON.BSON_DATA_TIMESTAMP = 17;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_LONG\n **/\nBSON.BSON_DATA_LONG = 18;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_DECIMAL128\n **/\nBSON.BSON_DATA_DECIMAL128 = 19;\n/**\n * MinKey BSON Type\n *\n * @classconstant BSON_DATA_MIN_KEY\n **/\nBSON.BSON_DATA_MIN_KEY = 0xff;\n/**\n * MaxKey BSON Type\n *\n * @classconstant BSON_DATA_MAX_KEY\n **/\nBSON.BSON_DATA_MAX_KEY = 0x7f;\n/**\n * Binary Default Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_DEFAULT\n **/\nBSON.BSON_BINARY_SUBTYPE_DEFAULT = 0;\n/**\n * Binary Function Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_FUNCTION\n **/\nBSON.BSON_BINARY_SUBTYPE_FUNCTION = 1;\n/**\n * Binary Byte Array Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY\n **/\nBSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;\n/**\n * Binary UUID Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_UUID\n **/\nBSON.BSON_BINARY_SUBTYPE_UUID = 3;\n/**\n * Binary MD5 Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_MD5\n **/\nBSON.BSON_BINARY_SUBTYPE_MD5 = 4;\n/**\n * Binary User Defined Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED\n **/\nBSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128;\n\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\nBSON.BSON_INT64_MAX = Math.pow(2, 63) - 1;\nBSON.BSON_INT64_MIN = -Math.pow(2, 63);\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\n// Internal long versions\nvar JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double.\nvar JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double.\n\nmodule.exports = serializeInto;\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))\n\n/***/ }),\n/* 30 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* global window, document, fetch */\n\nvar _storage = __webpack_require__(32);\n\nvar _providers = __webpack_require__(31);\n\nvar _errors = __webpack_require__(21);\n\nvar _common = __webpack_require__(15);\n\nvar authCommon = _interopRequireWildcard(_common);\n\nvar _common2 = __webpack_require__(16);\n\nvar common = _interopRequireWildcard(_common2);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar jwtDecode = __webpack_require__(67);\n\nvar EMBEDDED_USER_AUTH_DATA_PARTS = 4;\n\nvar Auth = function () {\n function Auth(client, rootUrl, options) {\n _classCallCheck(this, Auth);\n\n options = Object.assign({}, {\n storageType: 'localStorage',\n codec: authCommon.APP_CLIENT_CODEC\n }, options);\n\n this.client = client;\n this.rootUrl = rootUrl;\n this.codec = options.codec;\n this.storage = (0, _storage.createStorage)(options.storageType);\n this.providers = (0, _providers.createProviders)(this);\n }\n\n _createClass(Auth, [{\n key: 'provider',\n value: function provider(name) {\n if (!this.providers.hasOwnProperty(name)) {\n throw new Error('Invalid auth provider specified: ' + name);\n }\n\n return this.providers[name];\n }\n }, {\n key: 'refreshToken',\n value: function refreshToken() {\n var _this = this;\n\n if (this.isImpersonatingUser()) {\n return this.refreshImpersonation(this.client);\n }\n\n return this.client.doSessionPost().then(function (json) {\n return _this.set(json);\n });\n }\n }, {\n key: 'pageRootUrl',\n value: function pageRootUrl() {\n return [window.location.protocol, '//', window.location.host, window.location.pathname].join('');\n }\n }, {\n key: 'error',\n value: function error() {\n return this._error;\n }\n }, {\n key: 'isAppClient',\n value: function isAppClient() {\n if (!this.client) {\n return true; // Handle the case where Auth is constructed with null\n }\n return this.client.type === common.APP_CLIENT_TYPE;\n }\n }, {\n key: 'handleRedirect',\n value: function handleRedirect() {\n if (typeof window === 'undefined') {\n // This means we're running in some environment other\n // than a browser - so handling a redirect makes no sense here.\n return;\n }\n if (!window.location || !window.location.hash) {\n return;\n }\n\n var ourState = this.storage.get(authCommon.STATE_KEY);\n var redirectFragment = window.location.hash.substring(1);\n var redirectState = this.parseRedirectFragment(redirectFragment, ourState);\n if (redirectState.lastError) {\n console.error('StitchClient: error from redirect: ' + redirectState.lastError);\n this._error = redirectState.lastError;\n window.history.replaceState(null, '', this.pageRootUrl());\n return;\n }\n\n if (!redirectState.found) {\n return;\n }\n\n this.storage.remove(authCommon.STATE_KEY);\n if (!redirectState.stateValid) {\n console.error('StitchClient: state values did not match!');\n window.history.replaceState(null, '', this.pageRootUrl());\n return;\n }\n\n if (!redirectState.ua) {\n console.error('StitchClient: no UA value was returned from redirect!');\n return;\n }\n\n // If we get here, the state is valid - set auth appropriately.\n this.set(redirectState.ua);\n window.history.replaceState(null, '', this.pageRootUrl());\n }\n }, {\n key: 'getCookie',\n value: function getCookie(name) {\n var splitCookies = document.cookie.split(' ');\n for (var i = 0; i < splitCookies.length; i++) {\n var cookie = splitCookies[i];\n var sepIdx = cookie.indexOf('=');\n var cookieName = cookie.substring(0, sepIdx);\n if (cookieName === name) {\n var cookieVal = cookie.substring(sepIdx + 1, cookie.length);\n if (cookieVal[cookieVal.length - 1] === ';') {\n return cookieVal.substring(0, cookie.length - 1);\n }\n return cookieVal;\n }\n }\n }\n }, {\n key: 'handleCookie',\n value: function handleCookie() {\n if (typeof window === 'undefined' || typeof document === 'undefined') {\n // This means we're running in some environment other\n // than a browser - so handling a cookie makes no sense here.\n return;\n }\n if (!document.cookie) {\n return;\n }\n\n var uaCookie = this.getCookie(authCommon.USER_AUTH_COOKIE_NAME);\n if (!uaCookie) {\n return;\n }\n\n document.cookie = authCommon.USER_AUTH_COOKIE_NAME + '=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT;';\n var userAuth = this.unmarshallUserAuth(uaCookie);\n this.set(userAuth);\n window.history.replaceState(null, '', this.pageRootUrl());\n }\n }, {\n key: 'clear',\n value: function clear() {\n this.storage.remove(authCommon.USER_AUTH_KEY);\n this.storage.remove(authCommon.REFRESH_TOKEN_KEY);\n this.clearImpersonation();\n }\n }, {\n key: 'getDeviceId',\n value: function getDeviceId() {\n return this.storage.get(authCommon.DEVICE_ID_KEY);\n }\n\n // Returns whether or not the access token is expired or is going to expire within 'withinSeconds'\n // seconds, according to current system time. Returns false if the token is malformed in any way.\n\n }, {\n key: 'isAccessTokenExpired',\n value: function isAccessTokenExpired() {\n var withinSeconds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : authCommon.DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS;\n\n var token = this.getAccessToken();\n if (!token) {\n return false;\n }\n\n var decodedToken = void 0;\n try {\n decodedToken = jwtDecode(token);\n } catch (e) {\n return false;\n }\n\n if (!decodedToken) {\n return false;\n }\n\n return decodedToken.exp && Math.floor(Date.now() / 1000) >= decodedToken.exp - withinSeconds;\n }\n }, {\n key: 'getAccessToken',\n value: function getAccessToken() {\n return this._get().accessToken;\n }\n }, {\n key: 'getRefreshToken',\n value: function getRefreshToken() {\n return this.storage.get(authCommon.REFRESH_TOKEN_KEY);\n }\n }, {\n key: 'set',\n value: function set(json) {\n if (!json) {\n return;\n }\n\n if (json[this.codec.refreshToken]) {\n var rt = json[this.codec.refreshToken];\n delete json[this.codec.refreshToken];\n this.storage.set(authCommon.REFRESH_TOKEN_KEY, rt);\n }\n\n if (json[this.codec.deviceId]) {\n var deviceId = json[this.codec.deviceId];\n delete json[this.codec.deviceId];\n this.storage.set(authCommon.DEVICE_ID_KEY, deviceId);\n }\n\n // Merge in new fields with old fields. Typically the first json value\n // is complete with every field inside a user auth, but subsequent requests\n // do not include everything. This merging behavior is safe so long as json\n // value responses with absent fields do not indicate that the field should\n // be unset.\n var newUserAuth = {};\n if (json[this.codec.accessToken]) {\n newUserAuth.accessToken = json[this.codec.accessToken];\n }\n if (json[this.codec.userId]) {\n newUserAuth.userId = json[this.codec.userId];\n }\n newUserAuth = Object.assign(this._get(), newUserAuth);\n this.storage.set(authCommon.USER_AUTH_KEY, JSON.stringify(newUserAuth));\n }\n }, {\n key: '_get',\n value: function _get() {\n var data = this.storage.get(authCommon.USER_AUTH_KEY);\n if (!data) {\n return {};\n }\n\n try {\n return JSON.parse(data);\n } catch (e) {\n // Need to back out and clear auth otherwise we will never\n // be able to do anything useful.\n this.clear();\n throw new _errors.StitchError('Failure retrieving stored auth');\n }\n }\n }, {\n key: 'authedId',\n value: function authedId() {\n return this._get().userId;\n }\n }, {\n key: 'isImpersonatingUser',\n value: function isImpersonatingUser() {\n return this.storage.get(authCommon.IMPERSONATION_ACTIVE_KEY) === 'true';\n }\n }, {\n key: 'refreshImpersonation',\n value: function refreshImpersonation(client) {\n var _this2 = this;\n\n var userId = this.storage.get(authCommon.IMPERSONATION_USER_KEY);\n return client._do('/admin/users/' + userId + '/impersonate', 'POST', { refreshOnFailure: false, useRefreshToken: true }).then(function (response) {\n return response.json();\n }).then(function (json) {\n return _this2.set(json);\n }).catch(function (e) {\n _this2.stopImpersonation();\n throw e; // rethrow\n });\n }\n }, {\n key: 'startImpersonation',\n value: function startImpersonation(client, userId) {\n if (!this.authedId()) {\n return Promise.reject(new _errors.StitchError('Must auth first'));\n }\n\n if (this.isImpersonatingUser()) {\n return Promise.reject(new _errors.StitchError('Already impersonating a user'));\n }\n\n this.storage.set(authCommon.IMPERSONATION_ACTIVE_KEY, 'true');\n this.storage.set(authCommon.IMPERSONATION_USER_KEY, userId);\n\n var realUserAuth = JSON.parse(this.storage.get(authCommon.USER_AUTH_KEY));\n this.storage.set(authCommon.IMPERSONATION_REAL_USER_AUTH_KEY, JSON.stringify(realUserAuth));\n return this.refreshImpersonation(client);\n }\n }, {\n key: 'stopImpersonation',\n value: function stopImpersonation() {\n var _this3 = this;\n\n if (!this.isImpersonatingUser()) {\n throw new _errors.StitchError('Not impersonating a user');\n }\n\n return new Promise(function (resolve, reject) {\n var realUserAuth = JSON.parse(_this3.storage.get(authCommon.IMPERSONATION_REAL_USER_AUTH_KEY));\n _this3.set(realUserAuth);\n _this3.clearImpersonation();\n resolve();\n });\n }\n }, {\n key: 'clearImpersonation',\n value: function clearImpersonation() {\n this.storage.remove(authCommon.IMPERSONATION_ACTIVE_KEY);\n this.storage.remove(authCommon.IMPERSONATION_USER_KEY);\n this.storage.remove(authCommon.IMPERSONATION_REAL_USER_AUTH_KEY);\n }\n }, {\n key: 'parseRedirectFragment',\n value: function parseRedirectFragment(fragment, ourState) {\n // After being redirected from oauth, the URL will look like:\n // https://todo.examples.stitch.mongodb.com/#_stitch_state=...&_stitch_ua=...\n // This function parses out stitch-specific tokens from the fragment and\n // builds an object describing the result.\n var vars = fragment.split('&');\n var result = { ua: null, found: false, stateValid: false, lastError: null };\n var shouldBreak = false;\n for (var i = 0; i < vars.length && !shouldBreak; ++i) {\n var pairParts = vars[i].split('=');\n var pairKey = decodeURIComponent(pairParts[0]);\n switch (pairKey) {\n case authCommon.STITCH_ERROR_KEY:\n result.lastError = decodeURIComponent(pairParts[1]);\n result.found = true;\n shouldBreak = true;\n break;\n case authCommon.USER_AUTH_KEY:\n try {\n result.ua = this.unmarshallUserAuth(decodeURIComponent(pairParts[1]));\n result.found = true;\n } catch (e) {\n result.lastError = e;\n }\n continue;\n case authCommon.STITCH_LINK_KEY:\n result.found = true;\n continue;\n case authCommon.STATE_KEY:\n result.found = true;\n var theirState = decodeURIComponent(pairParts[1]);\n if (ourState && ourState === theirState) {\n result.stateValid = true;\n }\n continue;\n default:\n continue;\n }\n }\n\n return result;\n }\n }, {\n key: 'unmarshallUserAuth',\n value: function unmarshallUserAuth(data) {\n var _ref;\n\n var parts = data.split('$');\n if (parts.length !== EMBEDDED_USER_AUTH_DATA_PARTS) {\n throw new RangeError('invalid user auth data provided: ' + data);\n }\n\n return _ref = {}, _defineProperty(_ref, this.codec.accessToken, parts[0]), _defineProperty(_ref, this.codec.refreshToken, parts[1]), _defineProperty(_ref, this.codec.userId, parts[2]), _defineProperty(_ref, this.codec.deviceId, parts[3]), _ref;\n }\n }]);\n\n return Auth;\n}();\n\nexports.default = Auth;\nmodule.exports = exports['default'];\n\n/***/ }),\n/* 31 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.createProviders = undefined;\n\nvar _common = __webpack_require__(16);\n\nvar common = _interopRequireWildcard(_common);\n\nvar _common2 = __webpack_require__(15);\n\nvar authCommon = _interopRequireWildcard(_common2);\n\nvar _util = __webpack_require__(2);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\n/**\n * Create the device info for this client.\n *\n * @memberof module:auth\n * @method getDeviceInfo\n * @param {String} appId The app ID for this client\n * @param {String} appVersion The version of the app\n * @returns {Object} The device info object\n */\nfunction getDeviceInfo(deviceId, appId) {\n var appVersion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n\n var deviceInfo = { appId: appId, appVersion: appVersion, sdkVersion: common.SDK_VERSION };\n\n if (deviceId) {\n deviceInfo.deviceId = deviceId;\n }\n\n var platform = (0, _util.getPlatform)();\n\n if (platform) {\n deviceInfo.platform = platform.name;\n deviceInfo.platformVersion = platform.version;\n }\n\n return deviceInfo;\n}\n\n/**\n * @namespace\n */\n/** @module auth */\nfunction anonProvider(auth) {\n return {\n /**\n * Login to a stitch application using anonymous authentication\n *\n * @memberof anonProvider\n * @instance\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: function authenticate() {\n var device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID);\n var fetchArgs = common.makeFetchArgs('GET');\n fetchArgs.cors = true;\n\n return fetch(auth.rootUrl + '/providers/anon-user/login?device=' + (0, _util.uriEncodeObject)(device), fetchArgs).then(common.checkStatus).then(function (response) {\n return response.json();\n }).then(function (json) {\n return auth.set(json);\n });\n }\n };\n}\n\n/**\n * @namespace\n */\nfunction customProvider(auth) {\n var providerRoute = 'providers/custom-token';\n var loginRoute = providerRoute + '/login';\n\n return {\n /**\n * Login to a stitch application using custom authentication\n *\n * @memberof customProvider\n * @instance\n * @param {String} JWT token to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: function authenticate(token) {\n var device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID);\n\n var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ token: token, options: { device: device } }));\n fetchArgs.cors = true;\n\n return fetch(auth.rootUrl + '/' + loginRoute, fetchArgs).then(common.checkStatus).then(function (response) {\n return response.json();\n }).then(function (json) {\n return auth.set(json);\n });\n }\n };\n}\n\n/** @namespace */\nfunction userPassProvider(auth) {\n // The ternary expression here is redundant but is just preserving previous behavior based on whether or not\n // the client is for the admin or client API.\n var providerRoute = auth.isAppClient() ? 'providers/local-userpass' : 'providers/local-userpass';\n var loginRoute = auth.isAppClient() ? providerRoute + '/login' : providerRoute + '/login';\n\n return {\n /**\n * Login to a stitch application using username and password authentication\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} username the username to use for authentication\n * @param {String} password the password to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: function authenticate(_ref) {\n var username = _ref.username,\n password = _ref.password;\n\n var device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID);\n\n var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ username: username, password: password, options: { device: device } }));\n fetchArgs.cors = true;\n\n return fetch(auth.rootUrl + '/' + loginRoute, fetchArgs).then(common.checkStatus).then(function (response) {\n return response.json();\n }).then(function (json) {\n return auth.set(json);\n });\n },\n\n /**\n * Completes the confirmation workflow from the stitch server\n * @memberof userPassProvider\n * @instance\n * @param {String} tokenId the tokenId provided by the stitch server\n * @param {String} token the token provided by the stitch server\n * @returns {Promise}\n */\n emailConfirm: function emailConfirm(tokenId, token) {\n var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ tokenId: tokenId, token: token }));\n fetchArgs.cors = true;\n\n return fetch(auth.rootUrl + '/' + providerRoute + '/confirm', fetchArgs).then(common.checkStatus).then(function (response) {\n return response.json();\n });\n },\n\n /**\n * Request that the stitch server send another email confirmation\n * for account creation.\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} email the email to send a confirmation email for\n * @returns {Promise}\n */\n sendEmailConfirm: function sendEmailConfirm(email) {\n var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email: email }));\n fetchArgs.cors = true;\n\n return fetch(auth.rootUrl + '/' + providerRoute + '/confirm/send', fetchArgs).then(common.checkStatus).then(function (response) {\n return response.json();\n });\n },\n\n /**\n * Sends a password reset request to the stitch server\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} email the email of the account to reset the password for\n * @returns {Promise}\n */\n sendPasswordReset: function sendPasswordReset(email) {\n var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email: email }));\n fetchArgs.cors = true;\n\n return fetch(auth.rootUrl + '/' + providerRoute + '/reset/send', fetchArgs).then(common.checkStatus).then(function (response) {\n return response.json();\n });\n },\n\n /**\n * Use information returned from the stitch server to complete the password\n * reset flow for a given email account, providing a new password for the account.\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} tokenId the tokenId provided by the stitch server\n * @param {String} token the token provided by the stitch server\n * @param {String} password the new password requested for this account\n * @returns {Promise}\n */\n passwordReset: function passwordReset(tokenId, token, password) {\n var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ tokenId: tokenId, token: token, password: password }));\n fetchArgs.cors = true;\n\n return fetch(auth.rootUrl + '/' + providerRoute + '/reset', fetchArgs).then(common.checkStatus).then(function (response) {\n return response.json();\n });\n },\n\n /**\n * Will trigger an email to the requested account containing a link with the\n * token and tokenId that must be returned to the server using emailConfirm()\n * to activate the account.\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} email the requested email for the account\n * @param {String} password the requested password for the account\n * @returns {Promise}\n */\n register: function register(email, password) {\n var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email: email, password: password }));\n fetchArgs.cors = true;\n\n return fetch(auth.rootUrl + '/' + providerRoute + '/register', fetchArgs).then(common.checkStatus).then(function (response) {\n return response.json();\n });\n }\n };\n}\n\n/** @namespace */\nfunction apiKeyProvider(auth) {\n // The ternary expression here is redundant but is just preserving previous behavior based on whether or not\n // the client is for the admin or client API.\n var loginRoute = auth.isAppClient() ? 'providers/api-key/login' : 'providers/api-key/login';\n\n return {\n /**\n * Login to a stitch application using an api key\n *\n * @memberof apiKeyProvider\n * @instance\n * @param {String} key the key for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: function authenticate(key) {\n var device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID);\n var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ 'key': key, 'options': { device: device } }));\n fetchArgs.cors = true;\n\n return fetch(auth.rootUrl + '/' + loginRoute, fetchArgs).then(common.checkStatus).then(function (response) {\n return response.json();\n }).then(function (json) {\n return auth.set(json);\n });\n }\n };\n}\n\n// The state we generate is to be used for any kind of request where we will\n// complete an authentication flow via a redirect. We store the generate in\n// a local storage bound to the app's origin. This ensures that any time we\n// receive a redirect, there must be a state parameter and it must match\n// what we ourselves have generated. This state MUST only be sent to\n// a trusted Stitch endpoint in order to preserve its integrity. Stitch will\n// store it in some way on its origin (currently a cookie stored on this client)\n// and use that state at the end of an auth flow as a parameter in the redirect URI.\nvar alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\nfunction generateState() {\n var state = '';\n for (var i = 0; i < 64; ++i) {\n state += alpha.charAt(Math.floor(Math.random() * alpha.length));\n }\n\n return state;\n}\n\nfunction getOAuthLoginURL(auth, providerName, redirectUrl) {\n if (redirectUrl === undefined) {\n redirectUrl = auth.pageRootUrl();\n }\n\n var state = generateState();\n auth.storage.set(authCommon.STATE_KEY, state);\n\n var device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID);\n\n var result = auth.rootUrl + '/providers/oauth2-' + providerName + '/login?redirect=' + encodeURI(redirectUrl) + '&state=' + state + '&device=' + (0, _util.uriEncodeObject)(device);\n return result;\n}\n\n/** @namespace */\nfunction googleProvider(auth) {\n return {\n /**\n * Login to a stitch application using google authentication\n *\n * @memberof googleProvider\n * @instance\n * @param {Object} data the redirectUrl data to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: function authenticate(data) {\n var redirectUrl = data && data.redirectUrl ? data.redirectUrl : undefined;\n window.location.replace(getOAuthLoginURL(auth, 'google', redirectUrl));\n return Promise.resolve();\n }\n };\n}\n\n/** @namespace */\nfunction facebookProvider(auth) {\n return {\n /**\n * Login to a stitch application using facebook authentication\n *\n * @memberof facebookProvider\n * @instance\n * @param {Object} data the redirectUrl data to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: function authenticate(data) {\n var redirectUrl = data && data.redirectUrl ? data.redirectUrl : undefined;\n window.location.replace(getOAuthLoginURL(auth, 'facebook', redirectUrl));\n return Promise.resolve();\n }\n };\n}\n\n/** @namespace */\nfunction mongodbCloudProvider(auth) {\n // The ternary expression here is redundant but is just preserving previous behavior based on whether or not\n // the client is for the admin or client API.\n var loginRoute = auth.isAppClient() ? 'providers/mongodb-cloud/login' : 'providers/mongodb-cloud/login';\n\n return {\n /**\n * Login to a stitch application using mongodb cloud authentication\n *\n * @memberof mongodbCloudProvider\n * @instance\n * @param {Object} data the username, apiKey, cors, and cookie data to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: function authenticate(data) {\n var username = data.username,\n apiKey = data.apiKey,\n cors = data.cors,\n cookie = data.cookie;\n\n var options = Object.assign({}, { cors: true, cookie: false }, { cors: cors, cookie: cookie });\n var device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID);\n var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ username: username, apiKey: apiKey, options: { device: device } }));\n fetchArgs.cors = true; // TODO: shouldn't this use the passed in `cors` value?\n fetchArgs.credentials = 'include';\n\n var url = auth.rootUrl + '/' + loginRoute;\n if (options.cookie) {\n return fetch(url + '?cookie=true', fetchArgs).then(common.checkStatus);\n }\n\n return fetch(url, fetchArgs).then(common.checkStatus).then(function (response) {\n return response.json();\n }).then(function (json) {\n return auth.set(json);\n });\n }\n };\n}\n\n// TODO: support auth-specific options\nfunction createProviders(auth) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n return {\n anon: anonProvider(auth),\n apiKey: apiKeyProvider(auth),\n google: googleProvider(auth),\n facebook: facebookProvider(auth),\n mongodbCloud: mongodbCloudProvider(auth),\n userpass: userPassProvider(auth),\n custom: customProvider(auth)\n };\n}\n\nexports.createProviders = createProviders;\n\n/***/ }),\n/* 32 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nexports.createStorage = createStorage;\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar MemoryStorage = function () {\n function MemoryStorage() {\n _classCallCheck(this, MemoryStorage);\n\n this._data = {};\n }\n\n _createClass(MemoryStorage, [{\n key: 'getItem',\n value: function getItem(key) {\n return key in this._data ? this._data[key] : null;\n }\n }, {\n key: 'setItem',\n value: function setItem(key, value) {\n this._data[key] = value;\n return this._data[key];\n }\n }, {\n key: 'removeItem',\n value: function removeItem(key) {\n delete this._data[key];\n return undefined;\n }\n }, {\n key: 'clear',\n value: function clear() {\n this._data = {};\n return this._data;\n }\n }]);\n\n return MemoryStorage;\n}();\n\nvar Storage = function () {\n function Storage(store) {\n _classCallCheck(this, Storage);\n\n this.store = store;\n }\n\n _createClass(Storage, [{\n key: 'get',\n value: function get(key) {\n return this.store.getItem(key);\n }\n }, {\n key: 'set',\n value: function set(key, value) {\n return this.store.setItem(key, value);\n }\n }, {\n key: 'remove',\n value: function remove(key) {\n return this.store.removeItem(key);\n }\n }, {\n key: 'clear',\n value: function clear() {\n return this.store.clear();\n }\n }]);\n\n return Storage;\n}();\n\nfunction createStorage(type) {\n if (type === 'localStorage') {\n if (typeof window !== 'undefined' && 'localStorage' in window && window.localStorage !== null) {\n return new Storage(window.localStorage);\n }\n } else if (type === 'sessionStorage') {\n if (typeof window !== 'undefined' && 'sessionStorage' in window && window.sessionStorage !== null) {\n return new Storage(window.sessionStorage);\n }\n }\n\n // default to memory storage\n return new Storage(new MemoryStorage());\n}\n\n/***/ }),\n/* 33 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Admin = exports.StitchClient = undefined;\n\nvar _client = __webpack_require__(19);\n\nvar _client2 = _interopRequireDefault(_client);\n\nvar _admin = __webpack_require__(24);\n\nvar _admin2 = _interopRequireDefault(_admin);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.StitchClient = _client2.default;\nexports.Admin = _admin2.default;\n\n/***/ }),\n/* 34 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _util = __webpack_require__(2);\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Convenience wrapper around AWS S3 service (not meant to be instantiated directly).\n *\n * @class\n * @return {S3Service} a S3Service instance.\n */\nvar S3Service = function () {\n function S3Service(stitchClient, serviceName) {\n _classCallCheck(this, S3Service);\n\n this.client = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Put an object to S3 via Stitch. For small uploads\n *\n * NOTE: body must be a pipeline stream\n *\n * @param {String} bucket which S3 bucket to use\n * @param {String} key which key (filename) to use\n * @param {String} acl which policy to apply\n * @param {String} contentType content type of uploaded data\n * @return {Promise}\n */\n\n\n _createClass(S3Service, [{\n key: 'put',\n value: function put(bucket, key, acl, contentType) {\n return (0, _util.serviceResponse)(this, {\n action: 'put',\n args: { bucket: bucket, key: key, acl: acl, contentType: contentType }\n });\n }\n\n /**\n * Sign a policy for putting via Stitch. For large uploads\n *\n * @param {String} bucket which S3 bucket to use\n * @param {String} key which key (filename) to use\n * @param {String} acl which policy to apply\n * @param {String} contentType content type of uploaded data\n * @return {Promise}\n */\n\n }, {\n key: 'signPolicy',\n value: function signPolicy(bucket, key, acl, contentType) {\n return (0, _util.serviceResponse)(this, {\n action: 'signPolicy',\n args: { bucket: bucket, key: key, acl: acl, contentType: contentType }\n });\n }\n }]);\n\n return S3Service;\n}();\n\nexports.default = S3Service;\nmodule.exports = exports['default'];\n\n/***/ }),\n/* 35 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _util = __webpack_require__(2);\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Convenience wrapper around AWS SES service (not meant to be instantiated directly).\n *\n * @class\n * @return {SESService} a SESService instance.\n */\nvar SESService = function () {\n function SESService(stitchClient, serviceName) {\n _classCallCheck(this, SESService);\n\n this.client = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Send an email\n *\n * @method\n * @param {String} from the email to send from\n * @param {String} to the email to send to\n * @param {String} subject the subject of the email\n * @param {String} body the body of the email\n * @return {Promise}\n */\n\n\n _createClass(SESService, [{\n key: 'send',\n value: function send(from, to, subject, body) {\n return (0, _util.serviceResponse)(this, {\n action: 'send',\n args: { from: from, to: to, subject: subject, body: body }\n });\n }\n }]);\n\n return SESService;\n}();\n\nexports.default = SESService;\nmodule.exports = exports['default'];\n\n/***/ }),\n/* 36 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _util = __webpack_require__(2);\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Convenience wrapper for HTTP service (not meant to be instantiated directly).\n *\n * @class\n * @return {HTTPService} a HTTPService instance.\n */\nvar HTTPService = function () {\n function HTTPService(client, serviceName) {\n _classCallCheck(this, HTTPService);\n\n this.client = client;\n this.serviceName = serviceName;\n }\n\n /**\n * Send a GET request to a resource (result must be application/json)\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of GET args\n * @param {Object} [options] optional settings for the GET operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n\n\n _createClass(HTTPService, [{\n key: 'get',\n value: function get(urlOrOptions) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n return buildResponse('get', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a POST request to a resource with payload\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of POST args\n * @param {Object} [options] optional settings for the POST operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n\n }, {\n key: 'post',\n value: function post(urlOrOptions) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n return buildResponse('post', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a PUT request to a resource with payload\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of PUT args\n * @param {Object} [options] optional settings for the PUT operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n\n }, {\n key: 'put',\n value: function put(urlOrOptions) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n return buildResponse('put', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a PATCH request to a resource with payload\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of PATCH args\n * @param {Object} [options] optional settings for the PATCH operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n\n }, {\n key: 'patch',\n value: function patch(urlOrOptions) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n return buildResponse('patch', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a DELETE request to a resource\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of DELETE args\n * @param {Object} [options] optional settings for the DELETE operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n\n }, {\n key: 'delete',\n value: function _delete(urlOrOptions) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n return buildResponse('delete', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a HEAD request to a resource\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of HEAD args\n * @param {Object} [options] optional settings for the HEAD operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n\n }, {\n key: 'head',\n value: function head(urlOrOptions) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n return buildResponse('head', this, buildArgs(urlOrOptions, options));\n }\n }]);\n\n return HTTPService;\n}();\n\nfunction buildArgs(urlOrOptions, options) {\n var args = void 0;\n if (typeof urlOrOptions !== 'string') {\n args = urlOrOptions;\n } else {\n args = { url: urlOrOptions };\n if (!!options.authUrl) args.authUrl = options.authUrl;\n }\n\n return args;\n}\n\nfunction buildResponse(action, service, args) {\n return (0, _util.serviceResponse)(service, {\n action: action,\n args: args\n });\n}\n\nexports.default = HTTPService;\nmodule.exports = exports['default'];\n\n/***/ }),\n/* 37 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _s3_service = __webpack_require__(34);\n\nvar _s3_service2 = _interopRequireDefault(_s3_service);\n\nvar _ses_service = __webpack_require__(35);\n\nvar _ses_service2 = _interopRequireDefault(_ses_service);\n\nvar _http_service = __webpack_require__(36);\n\nvar _http_service2 = _interopRequireDefault(_http_service);\n\nvar _mongodb_service = __webpack_require__(40);\n\nvar _mongodb_service2 = _interopRequireDefault(_mongodb_service);\n\nvar _twilio_service = __webpack_require__(41);\n\nvar _twilio_service2 = _interopRequireDefault(_twilio_service);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = {\n 'aws/s3': _s3_service2.default,\n 'aws/ses': _ses_service2.default,\n 'http': _http_service2.default,\n 'mongodb': _mongodb_service2.default,\n 'twilio': _twilio_service2.default\n};\nmodule.exports = exports['default'];\n\n/***/ }),\n/* 38 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _util = __webpack_require__(2);\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Create a new Collection instance (not meant to be instantiated directly).\n *\n * @class\n * @return {Collection} a Collection instance.\n */\nvar Collection = function () {\n function Collection(db, name) {\n _classCallCheck(this, Collection);\n\n this.db = db;\n this.name = name;\n }\n\n /**\n * Inserts a single document.\n *\n * @method\n * @param {Object} doc The document to insert.\n * @return {Promise} a Promise for the operation.\n */\n\n\n _createClass(Collection, [{\n key: 'insertOne',\n value: function insertOne(doc) {\n var args = { document: doc };\n return buildResponse('insertOne', this, buildArgs(this, args));\n }\n\n /**\n * Inserts multiple documents.\n *\n * @method\n * @param {Array} docs The documents to insert.\n * @return {Promise} Returns a Promise for the operation.\n */\n\n }, {\n key: 'insertMany',\n value: function insertMany(docs) {\n var args = { documents: Array.isArray(docs) ? docs : [docs] };\n return buildResponse('insertMany', this, buildArgs(this, args));\n }\n\n /**\n * Deletes a single document.\n *\n * @method\n * @param {Object} query The query used to match a single document.\n * @return {Promise} Returns a Promise for the operation.\n */\n\n }, {\n key: 'deleteOne',\n value: function deleteOne(query) {\n return buildResponse('deleteOne', this, buildArgs(this, { query: query }));\n }\n\n /**\n * Deletes all documents matching query.\n *\n * @method\n * @param {Object} query The query used to match the documents to delete.\n * @return {Promise} Returns a Promise for the operation.\n */\n\n }, {\n key: 'deleteMany',\n value: function deleteMany(query) {\n return buildResponse('deleteMany', this, buildArgs(this, { query: query }));\n }\n\n /**\n * Updates a single document.\n *\n * @method\n * @param {Object} query The query used to match a single document.\n * @param {Object} update The update operations to perform on the matching document.\n * @param {Object} [options] Additional options object.\n * @param {Boolean} [options.upsert=false] Perform an upsert operation.\n * @return {Promise} A Promise for the operation.\n */\n\n }, {\n key: 'updateOne',\n value: function updateOne(query, update) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n return updateOp(this, false, query, update, options);\n }\n\n /**\n * Updates multiple documents.\n *\n * @method\n * @param {Object} query The query used to match the documents.\n * @param {Object} update The update operations to perform on the matching documents.\n * @param {Object} [options] Additional options object.\n * @param {Boolean} [options.upsert=false] Perform an upsert operation.\n * @return {Promise} Returns a Promise for the operation.\n */\n\n }, {\n key: 'updateMany',\n value: function updateMany(query, update) {\n return updateOp(this, true, query, update);\n }\n\n /**\n * Finds documents.\n *\n * @method\n * @param {Object} query The query used to match documents.\n * @param {Object} [project] The query document projection.\n * @return {MongoQuery} An object which allows for `limit` and `sort` parameters to be set.\n * `execute` will return a {Promise} for the operation.\n */\n\n }, {\n key: 'find',\n value: function find(query, project) {\n return new MongoQuery(this, query, project);\n }\n\n /**\n * Executes an aggregation pipeline.\n *\n * @param {Array} pipeline The aggregation pipeline.\n * @returns {Array} The results of the aggregation.\n */\n\n }, {\n key: 'aggregate',\n value: function aggregate(pipeline) {\n return aggregateOp(this, pipeline);\n }\n\n /**\n * Gets the number of documents matching the filter.\n *\n * @param {Object} query The query used to match documents.\n * @param {Object} options Additional count options.\n * @param {Number} [options.limit=null] The maximum number of documents to return.\n * @return {Number} The results of the count operation.\n */\n\n }, {\n key: 'count',\n value: function count(query) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var outgoingOptions = void 0;\n if (options.limit) {\n outgoingOptions = { limit: options.limit };\n }\n\n return buildResponse('count', this, buildArgs(this, { count: true, query: query }, outgoingOptions));\n }\n }]);\n\n return Collection;\n}();\n\n// private\n\nfunction updateOp(service, isMulti, query, update) {\n var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};\n\n var action = isMulti ? 'updateMany' : 'updateOne';\n\n var outgoingOptions = void 0;\n if (!isMulti && options.upsert) {\n outgoingOptions = { upsert: true };\n }\n\n return buildResponse(action, service, buildArgs(service, { query: query, update: update }, outgoingOptions));\n}\n\nfunction findOp(_ref) {\n var service = _ref.service,\n query = _ref.query,\n project = _ref.project,\n limit = _ref.limit,\n sort = _ref.sort;\n\n return buildResponse('find', service, buildArgs(service, { query: query, project: project, limit: limit, sort: sort }));\n}\n\nfunction aggregateOp(service, pipeline) {\n return buildResponse('aggregate', service, buildArgs(service, { pipeline: pipeline }));\n}\n\nfunction buildArgs(_ref2, args) {\n var database = _ref2.db.name,\n collection = _ref2.name;\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n return Object.assign({ database: database, collection: collection }, args, options);\n}\n\nfunction buildResponse(action, service, args) {\n return (0, _util.serviceResponse)(service.db, {\n serviceName: service.db.service,\n action: action,\n args: args\n });\n}\n\n// mongo query (find) support\n\nfunction MongoQuery(service, query, project) {\n if (this instanceof MongoQuery) {\n this.service = service;\n this.query = query;\n this.project = project;\n return this;\n }\n return new MongoQuery(service, query, project);\n}\n\nMongoQuery.prototype.limit = function (limit) {\n this.limit = limit;\n return this;\n};\n\nMongoQuery.prototype.sort = function (sort) {\n this.sort = sort;\n return this;\n};\n\nMongoQuery.prototype.execute = function (resolve) {\n return findOp(this);\n};\n\nexports.default = Collection;\nmodule.exports = exports['default'];\n\n/***/ }),\n/* 39 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _collection = __webpack_require__(38);\n\nvar _collection2 = _interopRequireDefault(_collection);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Create a new DB instance (not meant to be instantiated directly).\n * @class\n * @return {DB} a DB instance.\n */\nvar DB = function () {\n function DB(client, service, name) {\n _classCallCheck(this, DB);\n\n this.client = client;\n this.service = service;\n this.name = name;\n }\n\n /**\n * Returns a Collection instance representing a MongoDB Collection object.\n *\n * @method\n * @param {String} name The collection name.\n * @param {Object} [options] Additional options.\n * @return {Collection} returns a Collection instance representing a MongoDb collection.\n */\n\n\n _createClass(DB, [{\n key: 'collection',\n value: function collection(name) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n return new _collection2.default(this, name, options);\n }\n }]);\n\n return DB;\n}();\n\nexports.default = DB;\nmodule.exports = exports['default'];\n\n/***/ }),\n/* 40 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _db = __webpack_require__(39);\n\nvar _db2 = _interopRequireDefault(_db);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Create a new MongoDBService instance (not meant to be instantiated directly).\n *\n * @class\n * @return {MongoDBService} a MongoDBService instance.\n */\nvar MongoDBService = function () {\n function MongoDBService(stitchClient, serviceName) {\n _classCallCheck(this, MongoDBService);\n\n this.stitchClient = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Get a DB instance\n *\n * @method\n * @param {String} databaseName The MongoDB database name\n * @param {Object} [options] Additional options.\n * @return {DB} returns a DB instance representing a MongoDB database.\n */\n\n\n _createClass(MongoDBService, [{\n key: 'db',\n value: function db(databaseName) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n return new _db2.default(this.stitchClient, this.serviceName, databaseName);\n }\n }]);\n\n return MongoDBService;\n}();\n\nexports.default = MongoDBService;\nmodule.exports = exports['default'];\n\n/***/ }),\n/* 41 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _util = __webpack_require__(2);\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Create a new TwilioService instance (not meant to be instantiated directly).\n *\n * @class\n * @return {TwilioService} a TwilioService instance.\n */\nvar TwilioService = function () {\n function TwilioService(stitchClient, serviceName) {\n _classCallCheck(this, TwilioService);\n\n this.client = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Send a text message to a number\n *\n * @method\n * @param {String} from number to send from\n * @param {String} to number to send to\n * @param {String} body SMS body content\n * @return {Promise}\n */\n\n\n _createClass(TwilioService, [{\n key: 'send',\n value: function send(from, to, body) {\n return (0, _util.serviceResponse)(this, {\n action: 'send',\n args: { from: from, to: to, body: body }\n });\n }\n }]);\n\n return TwilioService;\n}();\n\nexports.default = TwilioService;\nmodule.exports = exports['default'];\n\n/***/ }),\n/* 42 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar ExtJSON = __webpack_require__(57);\n\nmodule.exports = ExtJSON;\n\n/***/ }),\n/* 43 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Buffer) {\n\n/**\n * Module dependencies.\n * @ignore\n */\n\nfunction convert(integer) {\n var str = Number(integer).toString(16);\n return str.length === 1 ? '0' + str : str;\n}\n\nfunction toExtendedJSON(obj) {\n var base64String = obj.buffer.toString('base64');\n\n return {\n $binary: {\n base64: base64String,\n subType: convert(obj.sub_type)\n }\n };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n var type = doc.$binary.subType ? parseInt(doc.$binary.subType, 16) : 0;\n\n var data = new Buffer(doc.$binary.base64, 'base64');\n\n return new BSON.Binary(data, type);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))\n\n/***/ }),\n/* 44 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON(obj) {\n if (obj.scope) {\n return { $code: obj.code, $scope: obj.scope };\n }\n\n return { $code: obj.code };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Code(doc.$code, doc.$scope);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 45 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON(obj) {\n var o = {\n $ref: obj.collection,\n $id: obj.oid\n };\n if (obj.db) o.$db = obj.db;\n o = Object.assign(o, obj.fields);\n return o;\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n var copy = Object.assign({}, doc);\n ['$ref', '$id', '$db'].forEach(function (k) {\n return delete copy[k];\n });\n return new BSON.DBRef(doc.$ref, doc.$id, doc.$db, copy);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 46 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON(obj) {\n return { $numberDecimal: obj.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Decimal128.fromString(doc.$numberDecimal);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 47 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON(obj, options) {\n if (options.relaxed && isFinite(obj.value)) return obj.value;\n return { $numberDouble: obj.value.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Double(parseFloat(doc.$numberDouble));\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 48 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Binary = __webpack_require__(43);\nvar Code = __webpack_require__(44);\nvar DBRef = __webpack_require__(45);\nvar Decimal128 = __webpack_require__(46);\nvar Double = __webpack_require__(47);\nvar Int32 = __webpack_require__(49);\nvar Long = __webpack_require__(50);\nvar MaxKey = __webpack_require__(51);\nvar MinKey = __webpack_require__(52);\nvar ObjectID = __webpack_require__(53);\nvar BSONRegExp = __webpack_require__(54);\nvar _Symbol = __webpack_require__(55);\nvar Timestamp = __webpack_require__(56);\n\nmodule.exports = {\n Binary: Binary,\n Code: Code,\n DBRef: DBRef,\n Decimal128: Decimal128,\n Double: Double,\n Int32: Int32,\n Long: Long,\n MaxKey: MaxKey,\n MinKey: MinKey,\n ObjectID: ObjectID,\n BSONRegExp: BSONRegExp,\n Symbol: _Symbol,\n Timestamp: Timestamp\n};\n\n/***/ }),\n/* 49 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON(obj, options) {\n if (options && options.relaxed) return obj.value;\n return { $numberInt: obj.value.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Int32(doc.$numberInt);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 50 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON(obj, options) {\n if (options && options.relaxed) return obj.toNumber();\n return { $numberLong: obj.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return BSON.Long.fromString(doc.$numberLong);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 51 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON() {\n return { $maxKey: 1 };\n}\n\nfunction fromExtendedJSON(BSON) {\n return new BSON.MaxKey();\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 52 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON() {\n return { $minKey: 1 };\n}\n\nfunction fromExtendedJSON(BSON) {\n return new BSON.MinKey();\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 53 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON(obj) {\n if (obj.toHexString) return { $oid: obj.toHexString() };\n return { $oid: obj.toString('hex') };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.ObjectID(doc.$oid);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 54 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON(obj) {\n return { $regularExpression: { pattern: obj.pattern, options: obj.options } };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.BSONRegExp(doc.$regularExpression.pattern, doc.$regularExpression.options.split('').sort().join(''));\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 55 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON(obj) {\n return { $symbol: obj.value };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Symbol(doc.$symbol);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 56 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON(obj) {\n return {\n $timestamp: {\n t: obj.high_,\n i: obj.low_\n }\n };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Timestamp(doc.$timestamp.i, doc.$timestamp.t);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 57 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar codecs = __webpack_require__(48),\n BSON = __webpack_require__(26);\n\nvar BSONTypes = ['Binary', 'Code', 'DBRef', 'Decimal128', 'Double', 'Int32', 'Long', 'MaxKey', 'MinKey', 'ObjectID', 'BSONRegExp', 'Symbol', 'Timestamp'];\n\nsetBSONModule(BSON);\n\n// all the types where we don't need to do any special processing and can just pass the EJSON\n//straight to type.fromExtendedJSON\nvar keysToCodecs = {\n $oid: codecs.ObjectID,\n $binary: codecs.Binary,\n $symbol: codecs.Symbol,\n $numberDecimal: codecs.Decimal128,\n $numberLong: codecs.Long,\n $minKey: codecs.MinKey,\n $maxKey: codecs.MaxKey,\n $regularExpression: codecs.BSONRegExp,\n $timestamp: codecs.Timestamp\n};\n\nfunction setBSONModule(module) {\n BSONTypes.forEach(function (t) {\n if (!module[t]) throw new Error('passed in module does not contain all BSON types required');\n });\n BSON = module;\n}\n\nfunction deserializeValue(self, key, value, options) {\n if (typeof value === 'number') {\n // if it's an integer, should interpret as smallest BSON integer\n // that can represent it exactly. (if out of range, interpret as double.)\n if (Math.floor(value) === value) {\n var int32Range = value >= BSON_INT32_MIN && value <= BSON_INT32_MAX,\n int64Range = value >= BSON_INT64_MIN && value <= BSON_INT64_MAX;\n\n if (int32Range) return options.strict ? new BSON.Int32(value) : value;\n if (int64Range) return options.strict ? new BSON.Long.fromNumber(value) : value;\n }\n // If the number is a non-integer or out of integer range, should interpret as BSON Double.\n return new BSON.Double(value);\n }\n\n // from here on out we're looking for bson types, so bail if its not an object\n if (value == null || (typeof value === 'undefined' ? 'undefined' : _typeof(value)) !== 'object') return value;\n\n // upgrade deprecated undefined to null\n if (value.$undefined) return null;\n\n var keys = Object.keys(value).filter(function (k) {\n return k.startsWith('$') && value[k] != null;\n });\n for (var i = 0; i < keys.length; i++) {\n var c = keysToCodecs[keys[i]];\n if (c) return c.fromExtendedJSON(BSON, value);\n }\n\n if (value.$date != null) {\n var d = value.$date,\n date = new Date();\n\n if (typeof d === 'string') date.setTime(Date.parse(d));else if (d instanceof BSON.Long) date.setTime(d.toNumber());\n return date;\n }\n\n if (value.$code != null) {\n if (value.$scope) var scope = deserializeValue(self, null, value.$scope);\n var copy = Object.assign({}, value);\n copy.$scope = scope;\n return codecs.Code.fromExtendedJSON(BSON, value);\n }\n\n if (value.$numberDouble != null) {\n return options.strict ? codecs.Double.fromExtendedJSON(BSON, value) : parseFloat(value.$numberDouble);\n }\n\n if (value.$numberInt != null) {\n return options.strict ? codecs.Int32.fromExtendedJSON(BSON, value) : parseInt(value.$numberInt, 10);\n }\n\n if (value.$ref != null || value.$dbPointer != null) {\n var v = value.$ref ? value : value.$dbPointer;\n\n // we run into this in a \"degenerate EJSON\" case (with $id and $ref order flipped)\n // because of the order JSON.parse goes through the document\n if (v instanceof BSON.DBRef) return v;\n\n var dollarKeys = Object.keys(v).filter(function (k) {\n return k.startsWith('$');\n }),\n valid = true;\n dollarKeys.forEach(function (k) {\n if (['$ref', '$id', '$db'].indexOf(k) === -1) valid = false;\n });\n\n // only make DBRef if $ keys are all valid\n if (valid) return codecs.DBRef.fromExtendedJSON(BSON, v);\n }\n\n return value;\n}\n\nvar parse = function parse(text, options) {\n var self = this;\n options = options || { strict: true };\n\n return JSON.parse(text, function (key, value) {\n return deserializeValue(self, key, value, options);\n });\n};\n\n//\n// Serializer\n//\n\n// MAX INT32 boundaries\nvar BSON_INT32_MAX = 0x7fffffff,\n BSON_INT32_MIN = -0x80000000,\n BSON_INT64_MAX = 0x7fffffffffffffff,\n BSON_INT64_MIN = -0x8000000000000000;\n\nvar stringify = function stringify(value, reducer, indents, options) {\n var opts = {};\n if (options != null && (typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object') opts = options;else if (indents != null && (typeof indents === 'undefined' ? 'undefined' : _typeof(indents)) === 'object') {\n opts = indents;\n indents = 0;\n } else if (reducer != null && (typeof reducer === 'undefined' ? 'undefined' : _typeof(reducer)) === 'object') {\n opts = reducer;\n reducer = null;\n }\n\n var doc = Array.isArray(value) ? serializeArray(value, opts) : serializeDocument(value, opts);\n return JSON.stringify(doc, reducer, indents);\n};\n\nfunction serializeArray(array, options) {\n return array.map(function (v) {\n return serializeValue(v, options);\n });\n}\n\nfunction getISOString(date) {\n var isoStr = date.toISOString();\n // we should only show milliseconds in timestamp if they're non-zero\n return date.getUTCMilliseconds() !== 0 ? isoStr : isoStr.slice(0, -5) + 'Z';\n}\n\nfunction serializeValue(value, options) {\n if (Array.isArray(value)) return serializeArray(value, options);\n\n if (value === undefined) return null;\n\n if (value instanceof Date) {\n var dateNum = value.getTime(),\n\n // is it in year range 1970-9999?\n inRange = dateNum > -1 && dateNum < 253402318800000;\n\n return options.relaxed && inRange ? { $date: getISOString(value) } : { $date: { $numberLong: value.getTime().toString() } };\n }\n\n if (typeof value === 'number' && !options.relaxed) {\n // it's an integer\n if (Math.floor(value) === value) {\n var int32Range = value >= BSON_INT32_MIN && value <= BSON_INT32_MAX,\n int64Range = value >= BSON_INT64_MIN && value <= BSON_INT64_MAX;\n\n // interpret as being of the smallest BSON integer type that can represent the number exactly\n if (int32Range) return { $numberInt: value.toString() };\n if (int64Range) return { $numberLong: value.toString() };\n }\n return { $numberDouble: value.toString() };\n }\n\n if (value != null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') return serializeDocument(value, options);\n return value;\n}\n\nfunction serializeDocument(doc, options) {\n if (doc == null || (typeof doc === 'undefined' ? 'undefined' : _typeof(doc)) !== 'object') throw new Error('not an object instance');\n\n // the document itself is a BSON type\n if (doc._bsontype && BSONTypes.indexOf(doc._bsontype) !== -1) {\n // we need to separately serialize the embedded scope document\n if (doc._bsontype === 'Code' && doc.scope) {\n var tempScope = serializeDocument(doc.scope, options),\n tempDoc = Object.assign({}, doc, { scope: tempScope });\n return codecs['Code'].toExtendedJSON(tempDoc, options);\n // we need to separately serialize the embedded OID document\n } else if (doc._bsontype === 'DBRef' && doc.oid) {\n var tempId = serializeDocument(doc.oid, options),\n _tempDoc = Object.assign({}, doc, { oid: tempId });\n return codecs['DBRef'].toExtendedJSON(_tempDoc, options);\n }\n return codecs[doc._bsontype].toExtendedJSON(doc, options);\n }\n\n // the document is an object with nested BSON types\n var _doc = {};\n for (var name in doc) {\n var val = doc[name];\n if (Array.isArray(val)) {\n _doc[name] = serializeArray(val, options);\n } else if (val != null && val._bsontype && BSONTypes.indexOf(val._bsontype) !== -1) {\n // we need to separately serialize the embedded scope document\n if (val._bsontype === 'Code' && val.scope) {\n var _tempScope = serializeDocument(val.scope, options),\n tempVal = Object.assign({}, val, { scope: _tempScope });\n _doc[name] = codecs['Code'].toExtendedJSON(tempVal, options);\n // we need to separately serialize the embedded OID document\n } else if (val._bsontype === 'DBRef' && val.oid) {\n var _tempId = serializeDocument(val.oid, options),\n _tempVal = Object.assign({}, val, { oid: _tempId });\n _doc[name] = codecs['DBRef'].toExtendedJSON(_tempVal, options);\n } else _doc[name] = codecs[val._bsontype].toExtendedJSON(val, options);\n } else if (val instanceof Date) {\n _doc[name] = serializeValue(val, options);\n } else if (val != null && (typeof val === 'undefined' ? 'undefined' : _typeof(val)) === 'object') {\n _doc[name] = serializeDocument(val, options);\n }\n\n _doc[name] = serializeValue(val, options);\n }\n\n return _doc;\n}\n\nmodule.exports = {\n parse: parse,\n stringify: stringify,\n setBSONModule: setBSONModule,\n BSON: BSON\n};\n\n/***/ }),\n/* 58 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\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, 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; i < l; i += 4) {\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/* 59 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar detectBrowser = __webpack_require__(60);\n\nvar agent;\n\nif (typeof navigator !== 'undefined' && navigator) {\n agent = navigator.userAgent;\n}\n\nmodule.exports = detectBrowser(agent);\n\n\n/***/ }),\n/* 60 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar detectOS = __webpack_require__(61);\n\nmodule.exports = function detectBrowser(userAgentString) {\n if (!userAgentString) return null;\n\n var browsers = [\n [ 'edge', /Edge\\/([0-9\\._]+)/ ],\n [ 'yandexbrowser', /YaBrowser\\/([0-9\\._]+)/ ],\n [ 'vivaldi', /Vivaldi\\/([0-9\\.]+)/ ],\n [ 'kakaotalk', /KAKAOTALK\\s([0-9\\.]+)/ ],\n [ 'chrome', /(?!Chrom.*OPR)Chrom(?:e|ium)\\/([0-9\\.]+)(:?\\s|$)/ ],\n [ 'phantomjs', /PhantomJS\\/([0-9\\.]+)(:?\\s|$)/ ],\n [ 'crios', /CriOS\\/([0-9\\.]+)(:?\\s|$)/ ],\n [ 'firefox', /Firefox\\/([0-9\\.]+)(?:\\s|$)/ ],\n [ 'fxios', /FxiOS\\/([0-9\\.]+)/ ],\n [ 'opera', /Opera\\/([0-9\\.]+)(?:\\s|$)/ ],\n [ 'opera', /OPR\\/([0-9\\.]+)(:?\\s|$)$/ ],\n [ 'ie', /Trident\\/7\\.0.*rv\\:([0-9\\.]+).*\\).*Gecko$/ ],\n [ 'ie', /MSIE\\s([0-9\\.]+);.*Trident\\/[4-7].0/ ],\n [ 'ie', /MSIE\\s(7\\.0)/ ],\n [ 'bb10', /BB10;\\sTouch.*Version\\/([0-9\\.]+)/ ],\n [ 'android', /Android\\s([0-9\\.]+)/ ],\n [ 'ios', /Version\\/([0-9\\._]+).*Mobile.*Safari.*/ ],\n [ 'safari', /Version\\/([0-9\\._]+).*Safari/ ]\n ];\n\n return browsers.map(function (rule) {\n if (rule[1].test(userAgentString)) {\n var match = rule[1].exec(userAgentString);\n var version = match && match[1].split(/[._]/).slice(0,3);\n\n if (version && version.length < 3) {\n Array.prototype.push.apply(version, (version.length == 1) ? [0, 0] : [0]);\n }\n\n return {\n name: rule[0],\n version: version.join('.'),\n os: detectOS(userAgentString)\n };\n }\n }).filter(Boolean).shift();\n};\n\n\n/***/ }),\n/* 61 */\n/***/ (function(module, exports) {\n\nmodule.exports = function detectOS(userAgentString) {\n var operatingSystems = [\n {\n name: 'iOS',\n rule: /iP(hone|od|ad)/\n },\n {\n name: 'Android OS',\n rule: /Android/\n },\n {\n name: 'BlackBerry OS',\n rule: /BlackBerry|BB10/\n },\n {\n name: 'Windows Mobile',\n rule: /IEMobile/\n },\n {\n name: 'Amazon OS',\n rule: /Kindle/\n },\n {\n name: 'Windows 3.11',\n rule: /Win16/\n },\n {\n name: 'Windows 95',\n rule: /(Windows 95)|(Win95)|(Windows_95)/\n },\n {\n name: 'Windows 98',\n rule: /(Windows 98)|(Win98)/\n },\n {\n name: 'Windows 2000',\n rule: /(Windows NT 5.0)|(Windows 2000)/\n },\n {\n name: 'Windows XP',\n rule: /(Windows NT 5.1)|(Windows XP)/\n },\n {\n name: 'Windows Server 2003',\n rule: /(Windows NT 5.2)/\n },\n {\n name: 'Windows Vista',\n rule: /(Windows NT 6.0)/\n },\n {\n name: 'Windows 7',\n rule: /(Windows NT 6.1)/\n },\n {\n name: 'Windows 8',\n rule: /(Windows NT 6.2)/\n },\n {\n name: 'Windows 8.1',\n rule: /(Windows NT 6.3)/\n },\n {\n name: 'Windows 10',\n rule: /(Windows NT 10.0)/\n },\n {\n name: 'Windows ME',\n rule: /Windows ME/\n },\n {\n name: 'Open BSD',\n rule: /OpenBSD/\n },\n {\n name: 'Sun OS',\n rule: /SunOS/\n },\n {\n name: 'Linux',\n rule: /(Linux)|(X11)/\n },\n {\n name: 'Mac OS',\n rule: /(Mac_PowerPC)|(Macintosh)/\n },\n {\n name: 'QNX',\n rule: /QNX/\n },\n {\n name: 'BeOS',\n rule: /BeOS/\n },\n {\n name: 'OS/2',\n rule: /OS\\/2/\n },\n {\n name: 'Search Bot',\n rule: /(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves\\/Teoma)|(ia_archiver)/\n }\n ];\n\n var detected = operatingSystems.filter(function (os) {\n if (userAgentString.match(os.rule)) {\n return true;\n }\n });\n\n return detected && detected[0] ? detected[0].name : null;\n};\n\n\n/***/ }),\n/* 62 */\n/***/ (function(module, exports) {\n\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n\n\n/***/ }),\n/* 63 */\n/***/ (function(module, exports) {\n\nif (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n\n\n/***/ }),\n/* 64 */\n/***/ (function(module, exports) {\n\nvar toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n\n\n/***/ }),\n/* 65 */\n/***/ (function(module, exports) {\n\n/**\n * The code was extracted from:\n * https://github.com/davidchambers/Base64.js\n */\n\nvar chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\nfunction InvalidCharacterError(message) {\n this.message = message;\n}\n\nInvalidCharacterError.prototype = new Error();\nInvalidCharacterError.prototype.name = 'InvalidCharacterError';\n\nfunction polyfill (input) {\n var str = String(input).replace(/=+$/, '');\n if (str.length % 4 == 1) {\n throw new InvalidCharacterError(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = '';\n // get next character\n buffer = str.charAt(idx++);\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n return output;\n}\n\n\nmodule.exports = typeof window !== 'undefined' && window.atob && window.atob.bind(window) || polyfill;\n\n\n/***/ }),\n/* 66 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar atob = __webpack_require__(65);\n\nfunction b64DecodeUnicode(str) {\n return decodeURIComponent(atob(str).replace(/(.)/g, function (m, p) {\n var code = p.charCodeAt(0).toString(16).toUpperCase();\n if (code.length < 2) {\n code = '0' + code;\n }\n return '%' + code;\n }));\n}\n\nmodule.exports = function(str) {\n var output = str.replace(/-/g, \"+\").replace(/_/g, \"/\");\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += \"==\";\n break;\n case 3:\n output += \"=\";\n break;\n default:\n throw \"Illegal base64url string!\";\n }\n\n try{\n return b64DecodeUnicode(output);\n } catch (err) {\n return atob(output);\n }\n};\n\n\n/***/ }),\n/* 67 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar base64_url_decode = __webpack_require__(66);\n\nfunction InvalidTokenError(message) {\n this.message = message;\n}\n\nInvalidTokenError.prototype = new Error();\nInvalidTokenError.prototype.name = 'InvalidTokenError';\n\nmodule.exports = function (token,options) {\n if (typeof token !== 'string') {\n throw new InvalidTokenError('Invalid token specified');\n }\n\n options = options || {};\n var pos = options.header === true ? 0 : 1;\n try {\n return JSON.parse(base64_url_decode(token.split('.')[pos]));\n } catch (e) {\n throw new InvalidTokenError('Invalid token specified: ' + e.message);\n }\n};\n\nmodule.exports.InvalidTokenError = InvalidTokenError;\n\n\n/***/ }),\n/* 68 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n\n\n/***/ }),\n/* 69 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar strictUriEncode = __webpack_require__(70);\nvar objectAssign = __webpack_require__(68);\n\nfunction encoderForArrayFormat(opts) {\n\tswitch (opts.arrayFormat) {\n\t\tcase 'index':\n\t\t\treturn function (key, value, index) {\n\t\t\t\treturn value === null ? [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'[',\n\t\t\t\t\tindex,\n\t\t\t\t\t']'\n\t\t\t\t].join('') : [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'[',\n\t\t\t\t\tencode(index, opts),\n\t\t\t\t\t']=',\n\t\t\t\t\tencode(value, opts)\n\t\t\t\t].join('');\n\t\t\t};\n\n\t\tcase 'bracket':\n\t\t\treturn function (key, value) {\n\t\t\t\treturn value === null ? encode(key, opts) : [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'[]=',\n\t\t\t\t\tencode(value, opts)\n\t\t\t\t].join('');\n\t\t\t};\n\n\t\tdefault:\n\t\t\treturn function (key, value) {\n\t\t\t\treturn value === null ? encode(key, opts) : [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'=',\n\t\t\t\t\tencode(value, opts)\n\t\t\t\t].join('');\n\t\t\t};\n\t}\n}\n\nfunction parserForArrayFormat(opts) {\n\tvar result;\n\n\tswitch (opts.arrayFormat) {\n\t\tcase 'index':\n\t\t\treturn function (key, value, accumulator) {\n\t\t\t\tresult = /\\[(\\d*)\\]$/.exec(key);\n\n\t\t\t\tkey = key.replace(/\\[\\d*\\]$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = {};\n\t\t\t\t}\n\n\t\t\t\taccumulator[key][result[1]] = value;\n\t\t\t};\n\n\t\tcase 'bracket':\n\t\t\treturn function (key, value, accumulator) {\n\t\t\t\tresult = /(\\[\\])$/.exec(key);\n\t\t\t\tkey = key.replace(/\\[\\]$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t} else if (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = [value];\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [].concat(accumulator[key], value);\n\t\t\t};\n\n\t\tdefault:\n\t\t\treturn function (key, value, accumulator) {\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [].concat(accumulator[key], value);\n\t\t\t};\n\t}\n}\n\nfunction encode(value, opts) {\n\tif (opts.encode) {\n\t\treturn opts.strict ? strictUriEncode(value) : encodeURIComponent(value);\n\t}\n\n\treturn value;\n}\n\nfunction keysSorter(input) {\n\tif (Array.isArray(input)) {\n\t\treturn input.sort();\n\t} else if (typeof input === 'object') {\n\t\treturn keysSorter(Object.keys(input)).sort(function (a, b) {\n\t\t\treturn Number(a) - Number(b);\n\t\t}).map(function (key) {\n\t\t\treturn input[key];\n\t\t});\n\t}\n\n\treturn input;\n}\n\nexports.extract = function (str) {\n\treturn str.split('?')[1] || '';\n};\n\nexports.parse = function (str, opts) {\n\topts = objectAssign({arrayFormat: 'none'}, opts);\n\n\tvar formatter = parserForArrayFormat(opts);\n\n\t// Create an object with no prototype\n\t// https://github.com/sindresorhus/query-string/issues/47\n\tvar ret = Object.create(null);\n\n\tif (typeof str !== 'string') {\n\t\treturn ret;\n\t}\n\n\tstr = str.trim().replace(/^(\\?|#|&)/, '');\n\n\tif (!str) {\n\t\treturn ret;\n\t}\n\n\tstr.split('&').forEach(function (param) {\n\t\tvar parts = param.replace(/\\+/g, ' ').split('=');\n\t\t// Firefox (pre 40) decodes `%3D` to `=`\n\t\t// https://github.com/sindresorhus/query-string/pull/37\n\t\tvar key = parts.shift();\n\t\tvar val = parts.length > 0 ? parts.join('=') : undefined;\n\n\t\t// missing `=` should be `null`:\n\t\t// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters\n\t\tval = val === undefined ? null : decodeURIComponent(val);\n\n\t\tformatter(decodeURIComponent(key), val, ret);\n\t});\n\n\treturn Object.keys(ret).sort().reduce(function (result, key) {\n\t\tvar val = ret[key];\n\t\tif (Boolean(val) && typeof val === 'object' && !Array.isArray(val)) {\n\t\t\t// Sort object keys, not values\n\t\t\tresult[key] = keysSorter(val);\n\t\t} else {\n\t\t\tresult[key] = val;\n\t\t}\n\n\t\treturn result;\n\t}, Object.create(null));\n};\n\nexports.stringify = function (obj, opts) {\n\tvar defaults = {\n\t\tencode: true,\n\t\tstrict: true,\n\t\tarrayFormat: 'none'\n\t};\n\n\topts = objectAssign(defaults, opts);\n\n\tvar formatter = encoderForArrayFormat(opts);\n\n\treturn obj ? Object.keys(obj).sort().map(function (key) {\n\t\tvar val = obj[key];\n\n\t\tif (val === undefined) {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (val === null) {\n\t\t\treturn encode(key, opts);\n\t\t}\n\n\t\tif (Array.isArray(val)) {\n\t\t\tvar result = [];\n\n\t\t\tval.slice().forEach(function (val2) {\n\t\t\t\tif (val2 === undefined) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tresult.push(formatter(key, val2, result.length));\n\t\t\t});\n\n\t\t\treturn result.join('&');\n\t\t}\n\n\t\treturn encode(key, opts) + '=' + encode(val, opts);\n\t}).filter(function (x) {\n\t\treturn x.length > 0;\n\t}).join('&') : '';\n};\n\n\n/***/ }),\n/* 70 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nmodule.exports = function (str) {\n\treturn encodeURIComponent(str).replace(/[!'()*]/g, function (c) {\n\t\treturn '%' + c.charCodeAt(0).toString(16).toUpperCase();\n\t});\n};\n\n\n/***/ }),\n/* 71 */\n/***/ (function(module, exports) {\n\nmodule.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}\n\n/***/ }),\n/* 72 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexports.debuglog = function(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = __webpack_require__(71);\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = __webpack_require__(63);\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(17), __webpack_require__(23)))\n\n/***/ }),\n/* 73 */\n/***/ (function(module, exports) {\n\n(function(self) {\n 'use strict';\n\n if (self.fetch) {\n return\n }\n\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob: 'FileReader' in self && 'Blob' in self && (function() {\n try {\n new Blob()\n return true\n } catch(e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ]\n\n var isDataView = function(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n var isArrayBufferView = ArrayBuffer.isView || function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n }\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name)\n }\n if (/[^a-z0-9\\-#$%&'*+.\\^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value)\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift()\n return {done: value === undefined, value: value}\n }\n }\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n }\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {}\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value)\n }, this)\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1])\n }, this)\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name])\n }, this)\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name)\n value = normalizeValue(value)\n var oldValue = this.map[name]\n this.map[name] = oldValue ? oldValue+','+value : value\n }\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)]\n }\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name)\n return this.has(name) ? this.map[name] : null\n }\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n }\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value)\n }\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this)\n }\n }\n }\n\n Headers.prototype.keys = function() {\n var items = []\n this.forEach(function(value, name) { items.push(name) })\n return iteratorFor(items)\n }\n\n Headers.prototype.values = function() {\n var items = []\n this.forEach(function(value) { items.push(value) })\n return iteratorFor(items)\n }\n\n Headers.prototype.entries = function() {\n var items = []\n this.forEach(function(value, name) { items.push([name, value]) })\n return iteratorFor(items)\n }\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result)\n }\n reader.onerror = function() {\n reject(reader.error)\n }\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsArrayBuffer(blob)\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsText(blob)\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf)\n var chars = new Array(view.length)\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i])\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength)\n view.set(new Uint8Array(buf))\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false\n\n this._initBody = function(body) {\n this._bodyInit = body\n if (!body) {\n this._bodyText = ''\n } else if (typeof body === 'string') {\n this._bodyText = body\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString()\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer)\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer])\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body)\n } else {\n throw new Error('unsupported BodyInit type')\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8')\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type)\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')\n }\n }\n }\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n }\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n }\n }\n\n this.text = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n }\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n }\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n }\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase()\n return (methods.indexOf(upcased) > -1) ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {}\n var body = options.body\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url\n this.credentials = input.credentials\n if (!options.headers) {\n this.headers = new Headers(input.headers)\n }\n this.method = input.method\n this.mode = input.mode\n if (!body && input._bodyInit != null) {\n body = input._bodyInit\n input.bodyUsed = true\n }\n } else {\n this.url = String(input)\n }\n\n this.credentials = options.credentials || this.credentials || 'omit'\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers)\n }\n this.method = normalizeMethod(options.method || this.method || 'GET')\n this.mode = options.mode || this.mode || null\n this.referrer = null\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body)\n }\n\n Request.prototype.clone = function() {\n return new Request(this, { body: this._bodyInit })\n }\n\n function decode(body) {\n var form = new FormData()\n body.trim().split('&').forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=')\n var name = split.shift().replace(/\\+/g, ' ')\n var value = split.join('=').replace(/\\+/g, ' ')\n form.append(decodeURIComponent(name), decodeURIComponent(value))\n }\n })\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers()\n rawHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':')\n var key = parts.shift().trim()\n if (key) {\n var value = parts.join(':').trim()\n headers.append(key, value)\n }\n })\n return headers\n }\n\n Body.call(Request.prototype)\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {}\n }\n\n this.type = 'default'\n this.status = 'status' in options ? options.status : 200\n this.ok = this.status >= 200 && this.status < 300\n this.statusText = 'statusText' in options ? options.statusText : 'OK'\n this.headers = new Headers(options.headers)\n this.url = options.url || ''\n this._initBody(bodyInit)\n }\n\n Body.call(Response.prototype)\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n }\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''})\n response.type = 'error'\n return response\n }\n\n var redirectStatuses = [301, 302, 303, 307, 308]\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n }\n\n self.Headers = Headers\n self.Request = Request\n self.Response = Response\n\n self.fetch = function(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init)\n var xhr = new XMLHttpRequest()\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n }\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL')\n var body = 'response' in xhr ? xhr.response : xhr.responseText\n resolve(new Response(body, options))\n }\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'))\n }\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'))\n }\n\n xhr.open(request.method, request.url, true)\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob'\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value)\n })\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)\n })\n }\n self.fetch.polyfill = true\n})(typeof self !== 'undefined' ? self : this);\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// stitch.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 \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\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.l = 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// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 33);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 5f2c9227c84dbba4c004","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/buffer/index.js\n// module id = 0\n// module chunks = 0","// Copyright (c) 2008, Fair Oaks Labs, Inc.\n// All rights reserved.\n// \n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are met:\n// \n// * Redistributions of source code must retain the above copyright notice,\n// this list of conditions and the following disclaimer.\n// \n// * Redistributions in binary form must reproduce the above copyright notice,\n// this list of conditions and the following disclaimer in the documentation\n// and/or other materials provided with the distribution.\n// \n// * Neither the name of Fair Oaks Labs, Inc. nor the names of its contributors\n// may be used to endorse or promote products derived from this software\n// without specific prior written permission.\n// \n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n// POSSIBILITY OF SUCH DAMAGE.\n//\n//\n// Modifications to writeIEEE754 to support negative zeroes made by Brian White\n\nvar readIEEE754 = function(buffer, offset, endian, mLen, nBytes) {\n var e, m,\n bBE = (endian === 'big'),\n eLen = nBytes * 8 - mLen - 1,\n eMax = (1 << eLen) - 1,\n eBias = eMax >> 1,\n nBits = -7,\n i = bBE ? 0 : (nBytes - 1),\n d = bBE ? 1 : -1,\n s = buffer[offset + i];\n\n i += d;\n\n e = s & ((1 << (-nBits)) - 1);\n s >>= (-nBits);\n nBits += eLen;\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8);\n\n m = e & ((1 << (-nBits)) - 1);\n e >>= (-nBits);\n nBits += mLen;\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8);\n\n if (e === 0) {\n e = 1 - eBias;\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity);\n } else {\n m = m + Math.pow(2, mLen);\n e = e - eBias;\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen);\n};\n\nvar writeIEEE754 = function(buffer, value, offset, endian, mLen, nBytes) {\n var e, m, c,\n bBE = (endian === 'big'),\n eLen = nBytes * 8 - mLen - 1,\n eMax = (1 << eLen) - 1,\n eBias = eMax >> 1,\n rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),\n i = bBE ? (nBytes-1) : 0,\n d = bBE ? -1 : 1,\n s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;\n\n value = Math.abs(value);\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0;\n e = eMax;\n } else {\n e = Math.floor(Math.log(value) / Math.LN2);\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--;\n c *= 2;\n }\n if (e+eBias >= 1) {\n value += rt / c;\n } else {\n value += rt * Math.pow(2, 1 - eBias);\n }\n if (value * c >= 2) {\n e++;\n c /= 2;\n }\n\n if (e + eBias >= eMax) {\n m = 0;\n e = eMax;\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen);\n e = e + eBias;\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);\n e = 0;\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8);\n\n e = (e << mLen) | m;\n eLen += mLen;\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8);\n\n buffer[offset + i - d] |= s * 128;\n};\n\nexports.readIEEE754 = readIEEE754;\nexports.writeIEEE754 = writeIEEE754;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/float_parser.js","import * as platform from 'detect-browser';\nimport * as base64 from 'Base64';\n\nconst RESULT_METADATA_KEY = '_stitch_metadata';\n\n/** @namespace util */\n\n/**\n * Utility which creates a function that extracts metadata\n * from the server in the response to a pipeline request,\n * and attaches it to the final result after the finalizer has been applied.\n *\n * @memberof util\n * @param {Function} [func] optional finalizer to transform the response data\n */\nexport const collectMetadata = (func) => {\n const attachMetadata = metadata => (res) => {\n if (typeof res === 'object' && !Object.prototype.hasOwnProperty.call(res, RESULT_METADATA_KEY)) {\n Object.defineProperty(\n res,\n RESULT_METADATA_KEY,\n {enumerable: false, configurable: false, writable: false, value: metadata}\n );\n }\n return Promise.resolve(res);\n };\n const captureMetadata = (data) => {\n let metadata = {};\n if (data.warnings) {\n // Metadata is not yet attached to result, grab any data that needs to be added.\n metadata.warnings = data.warnings;\n }\n if (!func) {\n return Promise.resolve(data).then(attachMetadata(metadata));\n }\n return Promise.resolve(data).then(func).then(attachMetadata(metadata));\n };\n return captureMetadata;\n};\n\n/**\n * Utility function for displaying deprecation notices\n *\n * @memberof util\n * @param {Function} fn the function to deprecate\n * @param {String} msg the message to display to the user regarding deprecation\n */\nfunction deprecate(fn, msg) {\n let alreadyWarned = false;\n function deprecated() {\n if (!alreadyWarned) {\n alreadyWarned = true;\n console.warn('DeprecationWarning: ' + msg);\n }\n\n return fn.apply(this, arguments);\n }\n\n deprecated.__proto__ = fn; // eslint-disable-line\n if (fn.prototype) {\n deprecated.prototype = fn.prototype;\n }\n\n return deprecated;\n}\n\n/**\n * Utility method for executing a service action as a function call.\n *\n * @memberof util\n * @param {Object} service the service to execute the action on\n * @param {String} action the service action to execute\n * @param {Array} args the arguments to supply to the service action invocation\n * @returns {Promise} the API response from the executed service action\n */\nfunction serviceResponse(service, { serviceName = service.serviceName, action, args }) {\n const { client } = service;\n\n if (!client) {\n throw new Error('Service has no client');\n }\n\n return client.executeServiceFunction(serviceName, action, args);\n}\n\n/**\n * Utility function to get the platform.\n *\n * @memberof util\n * @returns {Object} An object of the form {name: ..., version: ...}, or null\n */\nfunction getPlatform() {\n return platform ? platform : null;\n}\n\n/**\n * Utility function to encode a JSON object into a valid string that can be\n * inserted in a URI. The object is first stringified, then encoded in base64,\n * and finally encoded via the builtin encodeURIComponent function.\n *\n * @memberof util\n * @param {Object} obj The object to encode\n * @returns {String} The encoded object\n */\nfunction uriEncodeObject(obj) {\n return encodeURIComponent(base64.btoa(JSON.stringify(obj)));\n}\n\nexport {\n deprecate,\n serviceResponse,\n getPlatform,\n uriEncodeObject\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/util.js","// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n// Copyright 2009 Google Inc. All Rights Reserved\n\n/**\n * Defines a Long class for representing a 64-bit two's-complement\n * integer value, which faithfully simulates the behavior of a Java \"Long\". This\n * implementation is derived from LongLib in GWT.\n *\n * Constructs a 64-bit two's-complement integer, given its low and high 32-bit\n * values as *signed* integers. See the from* functions below for more\n * convenient ways of constructing Longs.\n *\n * The internal representation of a Long is the two given signed, 32-bit values.\n * We use 32-bit pieces because these are the size of integers on which\n * Javascript performs bit-operations. For operations like addition and\n * multiplication, we split each number into 16-bit pieces, which can easily be\n * multiplied within Javascript's floating-point representation without overflow\n * or change in sign.\n *\n * In the algorithms below, we frequently reduce the negative case to the\n * positive case by negating the input(s) and then post-processing the result.\n * Note that we must ALWAYS check specially whether those values are MIN_VALUE\n * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\n * a positive number, it overflows back into a negative). Not handling this\n * case would often result in infinite recursion.\n *\n * @class\n * @param {number} low the low (signed) 32 bits of the Long.\n * @param {number} high the high (signed) 32 bits of the Long.\n * @return {Long}\n */\nfunction Long(low, high) {\n if(!(this instanceof Long)) return new Long(low, high);\n \n this._bsontype = 'Long';\n /**\n * @type {number}\n * @ignore\n */\n this.low_ = low | 0; // force into 32 signed bits.\n\n /**\n * @type {number}\n * @ignore\n */\n this.high_ = high | 0; // force into 32 signed bits.\n};\n\n/**\n * Return the int value.\n *\n * @method\n * @return {number} the value, assuming it is a 32-bit integer.\n */\nLong.prototype.toInt = function() {\n return this.low_;\n};\n\n/**\n * Return the Number value.\n *\n * @method\n * @return {number} the closest floating-point representation to this value.\n */\nLong.prototype.toNumber = function() {\n return this.high_ * Long.TWO_PWR_32_DBL_ +\n this.getLowBitsUnsigned();\n};\n\n/**\n * Return the JSON value.\n *\n * @method\n * @return {string} the JSON representation.\n */\nLong.prototype.toJSON = function() {\n return this.toString();\n}\n\n/**\n * Return the String value.\n *\n * @method\n * @param {number} [opt_radix] the radix in which the text should be written.\n * @return {string} the textual representation of this value.\n */\nLong.prototype.toString = function(opt_radix) {\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (this.isZero()) {\n return '0';\n }\n\n if (this.isNegative()) {\n if (this.equals(Long.MIN_VALUE)) {\n // We need to change the Long value before it can be negated, so we remove\n // the bottom-most digit in this base and then recurse to do the rest.\n var radixLong = Long.fromNumber(radix);\n var div = this.div(radixLong);\n var rem = div.multiply(radixLong).subtract(this);\n return div.toString(radix) + rem.toInt().toString(radix);\n } else {\n return '-' + this.negate().toString(radix);\n }\n }\n\n // Do several (6) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Long.fromNumber(Math.pow(radix, 6));\n\n var rem = this;\n var result = '';\n while (true) {\n var remDiv = rem.div(radixToPower);\n var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt();\n var digits = intval.toString(radix);\n\n rem = remDiv;\n if (rem.isZero()) {\n return digits + result;\n } else {\n while (digits.length < 6) {\n digits = '0' + digits;\n }\n result = '' + digits + result;\n }\n }\n};\n\n/**\n * Return the high 32-bits value.\n *\n * @method\n * @return {number} the high 32-bits as a signed value.\n */\nLong.prototype.getHighBits = function() {\n return this.high_;\n};\n\n/**\n * Return the low 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as a signed value.\n */\nLong.prototype.getLowBits = function() {\n return this.low_;\n};\n\n/**\n * Return the low unsigned 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as an unsigned value.\n */\nLong.prototype.getLowBitsUnsigned = function() {\n return (this.low_ >= 0) ?\n this.low_ : Long.TWO_PWR_32_DBL_ + this.low_;\n};\n\n/**\n * Returns the number of bits needed to represent the absolute value of this Long.\n *\n * @method\n * @return {number} Returns the number of bits needed to represent the absolute value of this Long.\n */\nLong.prototype.getNumBitsAbs = function() {\n if (this.isNegative()) {\n if (this.equals(Long.MIN_VALUE)) {\n return 64;\n } else {\n return this.negate().getNumBitsAbs();\n }\n } else {\n var val = this.high_ != 0 ? this.high_ : this.low_;\n for (var bit = 31; bit > 0; bit--) {\n if ((val & (1 << bit)) != 0) {\n break;\n }\n }\n return this.high_ != 0 ? bit + 33 : bit + 1;\n }\n};\n\n/**\n * Return whether this value is zero.\n *\n * @method\n * @return {boolean} whether this value is zero.\n */\nLong.prototype.isZero = function() {\n return this.high_ == 0 && this.low_ == 0;\n};\n\n/**\n * Return whether this value is negative.\n *\n * @method\n * @return {boolean} whether this value is negative.\n */\nLong.prototype.isNegative = function() {\n return this.high_ < 0;\n};\n\n/**\n * Return whether this value is odd.\n *\n * @method\n * @return {boolean} whether this value is odd.\n */\nLong.prototype.isOdd = function() {\n return (this.low_ & 1) == 1;\n};\n\n/**\n * Return whether this Long equals the other\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long equals the other\n */\nLong.prototype.equals = function(other) {\n return (this.high_ == other.high_) && (this.low_ == other.low_);\n};\n\n/**\n * Return whether this Long does not equal the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long does not equal the other.\n */\nLong.prototype.notEquals = function(other) {\n return (this.high_ != other.high_) || (this.low_ != other.low_);\n};\n\n/**\n * Return whether this Long is less than the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is less than the other.\n */\nLong.prototype.lessThan = function(other) {\n return this.compare(other) < 0;\n};\n\n/**\n * Return whether this Long is less than or equal to the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is less than or equal to the other.\n */\nLong.prototype.lessThanOrEqual = function(other) {\n return this.compare(other) <= 0;\n};\n\n/**\n * Return whether this Long is greater than the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is greater than the other.\n */\nLong.prototype.greaterThan = function(other) {\n return this.compare(other) > 0;\n};\n\n/**\n * Return whether this Long is greater than or equal to the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is greater than or equal to the other.\n */\nLong.prototype.greaterThanOrEqual = function(other) {\n return this.compare(other) >= 0;\n};\n\n/**\n * Compares this Long with the given one.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater.\n */\nLong.prototype.compare = function(other) {\n if (this.equals(other)) {\n return 0;\n }\n\n var thisNeg = this.isNegative();\n var otherNeg = other.isNegative();\n if (thisNeg && !otherNeg) {\n return -1;\n }\n if (!thisNeg && otherNeg) {\n return 1;\n }\n\n // at this point, the signs are the same, so subtraction will not overflow\n if (this.subtract(other).isNegative()) {\n return -1;\n } else {\n return 1;\n }\n};\n\n/**\n * The negation of this value.\n *\n * @method\n * @return {Long} the negation of this value.\n */\nLong.prototype.negate = function() {\n if (this.equals(Long.MIN_VALUE)) {\n return Long.MIN_VALUE;\n } else {\n return this.not().add(Long.ONE);\n }\n};\n\n/**\n * Returns the sum of this and the given Long.\n *\n * @method\n * @param {Long} other Long to add to this one.\n * @return {Long} the sum of this and the given Long.\n */\nLong.prototype.add = function(other) {\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 + b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 + b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 + b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 + b48;\n c48 &= 0xFFFF;\n return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32);\n};\n\n/**\n * Returns the difference of this and the given Long.\n *\n * @method\n * @param {Long} other Long to subtract from this.\n * @return {Long} the difference of this and the given Long.\n */\nLong.prototype.subtract = function(other) {\n return this.add(other.negate());\n};\n\n/**\n * Returns the product of this and the given Long.\n *\n * @method\n * @param {Long} other Long to multiply with this.\n * @return {Long} the product of this and the other.\n */\nLong.prototype.multiply = function(other) {\n if (this.isZero()) {\n return Long.ZERO;\n } else if (other.isZero()) {\n return Long.ZERO;\n }\n\n if (this.equals(Long.MIN_VALUE)) {\n return other.isOdd() ? Long.MIN_VALUE : Long.ZERO;\n } else if (other.equals(Long.MIN_VALUE)) {\n return this.isOdd() ? Long.MIN_VALUE : Long.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().multiply(other.negate());\n } else {\n return this.negate().multiply(other).negate();\n }\n } else if (other.isNegative()) {\n return this.multiply(other.negate()).negate();\n }\n\n // If both Longs are small, use float multiplication\n if (this.lessThan(Long.TWO_PWR_24_) &&\n other.lessThan(Long.TWO_PWR_24_)) {\n return Long.fromNumber(this.toNumber() * other.toNumber());\n }\n\n // Divide each Long into 4 chunks of 16 bits, and then add up 4x4 products.\n // We can skip products that would overflow.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 * b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 * b00;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c16 += a00 * b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 * b00;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a16 * b16;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a00 * b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\n c48 &= 0xFFFF;\n return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32);\n};\n\n/**\n * Returns this Long divided by the given one.\n *\n * @method\n * @param {Long} other Long by which to divide.\n * @return {Long} this Long divided by the given one.\n */\nLong.prototype.div = function(other) {\n if (other.isZero()) {\n throw Error('division by zero');\n } else if (this.isZero()) {\n return Long.ZERO;\n }\n\n if (this.equals(Long.MIN_VALUE)) {\n if (other.equals(Long.ONE) ||\n other.equals(Long.NEG_ONE)) {\n return Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\n } else if (other.equals(Long.MIN_VALUE)) {\n return Long.ONE;\n } else {\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\n var halfThis = this.shiftRight(1);\n var approx = halfThis.div(other).shiftLeft(1);\n if (approx.equals(Long.ZERO)) {\n return other.isNegative() ? Long.ONE : Long.NEG_ONE;\n } else {\n var rem = this.subtract(other.multiply(approx));\n var result = approx.add(rem.div(other));\n return result;\n }\n }\n } else if (other.equals(Long.MIN_VALUE)) {\n return Long.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().div(other.negate());\n } else {\n return this.negate().div(other).negate();\n }\n } else if (other.isNegative()) {\n return this.div(other.negate()).negate();\n }\n\n // Repeat the following until the remainder is less than other: find a\n // floating-point that approximates remainder / other *from below*, add this\n // into the result, and subtract it from the remainder. It is critical that\n // the approximate value is less than or equal to the real value so that the\n // remainder never becomes negative.\n var res = Long.ZERO;\n var rem = this;\n while (rem.greaterThanOrEqual(other)) {\n // Approximate the result of division. This may be a little greater or\n // smaller than the actual value.\n var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber()));\n\n // We will tweak the approximate result by changing it in the 48-th digit or\n // the smallest non-fractional digit, whichever is larger.\n var log2 = Math.ceil(Math.log(approx) / Math.LN2);\n var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48);\n\n // Decrease the approximation until it is smaller than the remainder. Note\n // that if it is too large, the product overflows and is negative.\n var approxRes = Long.fromNumber(approx);\n var approxRem = approxRes.multiply(other);\n while (approxRem.isNegative() || approxRem.greaterThan(rem)) {\n approx -= delta;\n approxRes = Long.fromNumber(approx);\n approxRem = approxRes.multiply(other);\n }\n\n // We know the answer can't be zero... and actually, zero would cause\n // infinite recursion since we would make no progress.\n if (approxRes.isZero()) {\n approxRes = Long.ONE;\n }\n\n res = res.add(approxRes);\n rem = rem.subtract(approxRem);\n }\n return res;\n};\n\n/**\n * Returns this Long modulo the given one.\n *\n * @method\n * @param {Long} other Long by which to mod.\n * @return {Long} this Long modulo the given one.\n */\nLong.prototype.modulo = function(other) {\n return this.subtract(this.div(other).multiply(other));\n};\n\n/**\n * The bitwise-NOT of this value.\n *\n * @method\n * @return {Long} the bitwise-NOT of this value.\n */\nLong.prototype.not = function() {\n return Long.fromBits(~this.low_, ~this.high_);\n};\n\n/**\n * Returns the bitwise-AND of this Long and the given one.\n *\n * @method\n * @param {Long} other the Long with which to AND.\n * @return {Long} the bitwise-AND of this and the other.\n */\nLong.prototype.and = function(other) {\n return Long.fromBits(this.low_ & other.low_, this.high_ & other.high_);\n};\n\n/**\n * Returns the bitwise-OR of this Long and the given one.\n *\n * @method\n * @param {Long} other the Long with which to OR.\n * @return {Long} the bitwise-OR of this and the other.\n */\nLong.prototype.or = function(other) {\n return Long.fromBits(this.low_ | other.low_, this.high_ | other.high_);\n};\n\n/**\n * Returns the bitwise-XOR of this Long and the given one.\n *\n * @method\n * @param {Long} other the Long with which to XOR.\n * @return {Long} the bitwise-XOR of this and the other.\n */\nLong.prototype.xor = function(other) {\n return Long.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_);\n};\n\n/**\n * Returns this Long with bits shifted to the left by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Long} this shifted to the left by the given amount.\n */\nLong.prototype.shiftLeft = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var low = this.low_;\n if (numBits < 32) {\n var high = this.high_;\n return Long.fromBits(\n low << numBits,\n (high << numBits) | (low >>> (32 - numBits)));\n } else {\n return Long.fromBits(0, low << (numBits - 32));\n }\n }\n};\n\n/**\n * Returns this Long with bits shifted to the right by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Long} this shifted to the right by the given amount.\n */\nLong.prototype.shiftRight = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Long.fromBits(\n (low >>> numBits) | (high << (32 - numBits)),\n high >> numBits);\n } else {\n return Long.fromBits(\n high >> (numBits - 32),\n high >= 0 ? 0 : -1);\n }\n }\n};\n\n/**\n * Returns this Long with bits shifted to the right by the given amount, with the new top bits matching the current sign bit.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Long} this shifted to the right by the given amount, with zeros placed into the new leading bits.\n */\nLong.prototype.shiftRightUnsigned = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Long.fromBits(\n (low >>> numBits) | (high << (32 - numBits)),\n high >>> numBits);\n } else if (numBits == 32) {\n return Long.fromBits(high, 0);\n } else {\n return Long.fromBits(high >>> (numBits - 32), 0);\n }\n }\n};\n\n/**\n * Returns a Long representing the given (32-bit) integer value.\n *\n * @method\n * @param {number} value the 32-bit integer in question.\n * @return {Long} the corresponding Long value.\n */\nLong.fromInt = function(value) {\n if (-128 <= value && value < 128) {\n var cachedObj = Long.INT_CACHE_[value];\n if (cachedObj) {\n return cachedObj;\n }\n }\n\n var obj = new Long(value | 0, value < 0 ? -1 : 0);\n if (-128 <= value && value < 128) {\n Long.INT_CACHE_[value] = obj;\n }\n return obj;\n};\n\n/**\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n *\n * @method\n * @param {number} value the number in question.\n * @return {Long} the corresponding Long value.\n */\nLong.fromNumber = function(value) {\n if (isNaN(value) || !isFinite(value)) {\n return Long.ZERO;\n } else if (value <= -Long.TWO_PWR_63_DBL_) {\n return Long.MIN_VALUE;\n } else if (value + 1 >= Long.TWO_PWR_63_DBL_) {\n return Long.MAX_VALUE;\n } else if (value < 0) {\n return Long.fromNumber(-value).negate();\n } else {\n return new Long(\n (value % Long.TWO_PWR_32_DBL_) | 0,\n (value / Long.TWO_PWR_32_DBL_) | 0);\n }\n};\n\n/**\n * Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits.\n *\n * @method\n * @param {number} lowBits the low 32-bits.\n * @param {number} highBits the high 32-bits.\n * @return {Long} the corresponding Long value.\n */\nLong.fromBits = function(lowBits, highBits) {\n return new Long(lowBits, highBits);\n};\n\n/**\n * Returns a Long representation of the given string, written using the given radix.\n *\n * @method\n * @param {string} str the textual representation of the Long.\n * @param {number} opt_radix the radix in which the text is written.\n * @return {Long} the corresponding Long value.\n */\nLong.fromString = function(str, opt_radix) {\n if (str.length == 0) {\n throw Error('number format error: empty string');\n }\n\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (str.charAt(0) == '-') {\n return Long.fromString(str.substring(1), radix).negate();\n } else if (str.indexOf('-') >= 0) {\n throw Error('number format error: interior \"-\" character: ' + str);\n }\n\n // Do several (8) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Long.fromNumber(Math.pow(radix, 8));\n\n var result = Long.ZERO;\n for (var i = 0; i < str.length; i += 8) {\n var size = Math.min(8, str.length - i);\n var value = parseInt(str.substring(i, i + size), radix);\n if (size < 8) {\n var power = Long.fromNumber(Math.pow(radix, size));\n result = result.multiply(power).add(Long.fromNumber(value));\n } else {\n result = result.multiply(radixToPower);\n result = result.add(Long.fromNumber(value));\n }\n }\n return result;\n};\n\n// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the\n// from* methods on which they depend.\n\n\n/**\n * A cache of the Long representations of small integer values.\n * @type {Object}\n * @ignore\n */\nLong.INT_CACHE_ = {};\n\n// NOTE: the compiler should inline these constant values below and then remove\n// these variables, so there should be no runtime penalty for these.\n\n/**\n * Number used repeated below in calculations. This must appear before the\n * first call to any from* function below.\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_16_DBL_ = 1 << 16;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_24_DBL_ = 1 << 24;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_32_DBL_ = Long.TWO_PWR_16_DBL_ * Long.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_31_DBL_ = Long.TWO_PWR_32_DBL_ / 2;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_48_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_64_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_32_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_63_DBL_ = Long.TWO_PWR_64_DBL_ / 2;\n\n/** @type {Long} */\nLong.ZERO = Long.fromInt(0);\n\n/** @type {Long} */\nLong.ONE = Long.fromInt(1);\n\n/** @type {Long} */\nLong.NEG_ONE = Long.fromInt(-1);\n\n/** @type {Long} */\nLong.MAX_VALUE =\n Long.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0);\n\n/** @type {Long} */\nLong.MIN_VALUE = Long.fromBits(0, 0x80000000 | 0);\n\n/**\n * @type {Long}\n * @ignore\n */\nLong.TWO_PWR_24_ = Long.fromInt(1 << 24);\n\n/**\n * Expose.\n */\nmodule.exports = Long;\nmodule.exports.Long = Long;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/long.js","/**\n * Module dependencies.\n * @ignore\n */\n\n// Test if we're in Node via presence of \"global\" not absence of \"window\"\n// to support hybrid environments like Electron\nif(typeof global !== 'undefined') {\n var Buffer = require('buffer').Buffer; // TODO just use global Buffer\n}\n\n/**\n * A class representation of the BSON Binary type.\n *\n * Sub types\n * - **BSON.BSON_BINARY_SUBTYPE_DEFAULT**, default BSON type.\n * - **BSON.BSON_BINARY_SUBTYPE_FUNCTION**, BSON function type.\n * - **BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY**, BSON byte array type.\n * - **BSON.BSON_BINARY_SUBTYPE_UUID**, BSON uuid type.\n * - **BSON.BSON_BINARY_SUBTYPE_MD5**, BSON md5 type.\n * - **BSON.BSON_BINARY_SUBTYPE_USER_DEFINED**, BSON user defined type.\n *\n * @class\n * @param {Buffer} buffer a buffer object containing the binary data.\n * @param {Number} [subType] the option binary type.\n * @return {Binary}\n */\nfunction Binary(buffer, subType) {\n if(!(this instanceof Binary)) return new Binary(buffer, subType);\n\n this._bsontype = 'Binary';\n\n if(buffer instanceof Number) {\n this.sub_type = buffer;\n this.position = 0;\n } else {\n this.sub_type = subType == null ? BSON_BINARY_SUBTYPE_DEFAULT : subType;\n this.position = 0;\n }\n\n if(buffer != null && !(buffer instanceof Number)) {\n // Only accept Buffer, Uint8Array or Arrays\n if(typeof buffer == 'string') {\n // Different ways of writing the length of the string for the different types\n if(typeof Buffer != 'undefined') {\n this.buffer = new Buffer(buffer);\n } else if(typeof Uint8Array != 'undefined' || (Object.prototype.toString.call(buffer) == '[object Array]')) {\n this.buffer = writeStringToArray(buffer);\n } else {\n throw new Error(\"only String, Buffer, Uint8Array or Array accepted\");\n }\n } else {\n this.buffer = buffer;\n }\n this.position = buffer.length;\n } else {\n if(typeof Buffer != 'undefined') {\n this.buffer = new Buffer(Binary.BUFFER_SIZE);\n } else if(typeof Uint8Array != 'undefined'){\n this.buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE));\n } else {\n this.buffer = new Array(Binary.BUFFER_SIZE);\n }\n // Set position to start of buffer\n this.position = 0;\n }\n};\n\n/**\n * Updates this binary with byte_value.\n *\n * @method\n * @param {string} byte_value a single byte we wish to write.\n */\nBinary.prototype.put = function put(byte_value) {\n // If it's a string and a has more than one character throw an error\n if(byte_value['length'] != null && typeof byte_value != 'number' && byte_value.length != 1) throw new Error(\"only accepts single character String, Uint8Array or Array\");\n if(typeof byte_value != 'number' && byte_value < 0 || byte_value > 255) throw new Error(\"only accepts number in a valid unsigned byte range 0-255\");\n\n // Decode the byte value once\n var decoded_byte = null;\n if(typeof byte_value == 'string') {\n decoded_byte = byte_value.charCodeAt(0);\n } else if(byte_value['length'] != null) {\n decoded_byte = byte_value[0];\n } else {\n decoded_byte = byte_value;\n }\n\n if(this.buffer.length > this.position) {\n this.buffer[this.position++] = decoded_byte;\n } else {\n if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) {\n // Create additional overflow buffer\n var buffer = new Buffer(Binary.BUFFER_SIZE + this.buffer.length);\n // Combine the two buffers together\n this.buffer.copy(buffer, 0, 0, this.buffer.length);\n this.buffer = buffer;\n this.buffer[this.position++] = decoded_byte;\n } else {\n var buffer = null;\n // Create a new buffer (typed or normal array)\n if(Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') {\n buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE + this.buffer.length));\n } else {\n buffer = new Array(Binary.BUFFER_SIZE + this.buffer.length);\n }\n\n // We need to copy all the content to the new array\n for(var i = 0; i < this.buffer.length; i++) {\n buffer[i] = this.buffer[i];\n }\n\n // Reassign the buffer\n this.buffer = buffer;\n // Write the byte\n this.buffer[this.position++] = decoded_byte;\n }\n }\n};\n\n/**\n * Writes a buffer or string to the binary.\n *\n * @method\n * @param {(Buffer|string)} string a string or buffer to be written to the Binary BSON object.\n * @param {number} offset specify the binary of where to write the content.\n * @return {null}\n */\nBinary.prototype.write = function write(string, offset) {\n offset = typeof offset == 'number' ? offset : this.position;\n\n // If the buffer is to small let's extend the buffer\n if(this.buffer.length < offset + string.length) {\n var buffer = null;\n // If we are in node.js\n if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) {\n buffer = new Buffer(this.buffer.length + string.length);\n this.buffer.copy(buffer, 0, 0, this.buffer.length);\n } else if(Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') {\n // Create a new buffer\n buffer = new Uint8Array(new ArrayBuffer(this.buffer.length + string.length))\n // Copy the content\n for(var i = 0; i < this.position; i++) {\n buffer[i] = this.buffer[i];\n }\n }\n\n // Assign the new buffer\n this.buffer = buffer;\n }\n\n if(typeof Buffer != 'undefined' && Buffer.isBuffer(string) && Buffer.isBuffer(this.buffer)) {\n string.copy(this.buffer, offset, 0, string.length);\n this.position = (offset + string.length) > this.position ? (offset + string.length) : this.position;\n // offset = string.length\n } else if(typeof Buffer != 'undefined' && typeof string == 'string' && Buffer.isBuffer(this.buffer)) {\n this.buffer.write(string, offset, 'binary');\n this.position = (offset + string.length) > this.position ? (offset + string.length) : this.position;\n // offset = string.length;\n } else if(Object.prototype.toString.call(string) == '[object Uint8Array]'\n || Object.prototype.toString.call(string) == '[object Array]' && typeof string != 'string') {\n for(var i = 0; i < string.length; i++) {\n this.buffer[offset++] = string[i];\n }\n\n this.position = offset > this.position ? offset : this.position;\n } else if(typeof string == 'string') {\n for(var i = 0; i < string.length; i++) {\n this.buffer[offset++] = string.charCodeAt(i);\n }\n\n this.position = offset > this.position ? offset : this.position;\n }\n};\n\n/**\n * Reads **length** bytes starting at **position**.\n *\n * @method\n * @param {number} position read from the given position in the Binary.\n * @param {number} length the number of bytes to read.\n * @return {Buffer}\n */\nBinary.prototype.read = function read(position, length) {\n length = length && length > 0\n ? length\n : this.position;\n\n // Let's return the data based on the type we have\n if(this.buffer['slice']) {\n return this.buffer.slice(position, position + length);\n } else {\n // Create a buffer to keep the result\n var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(length)) : new Array(length);\n for(var i = 0; i < length; i++) {\n buffer[i] = this.buffer[position++];\n }\n }\n // Return the buffer\n return buffer;\n};\n\n/**\n * Returns the value of this binary as a string.\n *\n * @method\n * @return {string}\n */\nBinary.prototype.value = function value(asRaw) {\n asRaw = asRaw == null ? false : asRaw;\n\n // Optimize to serialize for the situation where the data == size of buffer\n if(asRaw && typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer) && this.buffer.length == this.position)\n return this.buffer;\n\n // If it's a node.js buffer object\n if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) {\n return asRaw ? this.buffer.slice(0, this.position) : this.buffer.toString('binary', 0, this.position);\n } else {\n if(asRaw) {\n // we support the slice command use it\n if(this.buffer['slice'] != null) {\n return this.buffer.slice(0, this.position);\n } else {\n // Create a new buffer to copy content to\n var newBuffer = Object.prototype.toString.call(this.buffer) == '[object Uint8Array]' ? new Uint8Array(new ArrayBuffer(this.position)) : new Array(this.position);\n // Copy content\n for(var i = 0; i < this.position; i++) {\n newBuffer[i] = this.buffer[i];\n }\n // Return the buffer\n return newBuffer;\n }\n } else {\n return convertArraytoUtf8BinaryString(this.buffer, 0, this.position);\n }\n }\n};\n\n/**\n * Length.\n *\n * @method\n * @return {number} the length of the binary.\n */\nBinary.prototype.length = function length() {\n return this.position;\n};\n\n/**\n * @ignore\n */\nBinary.prototype.toJSON = function() {\n return this.buffer != null ? this.buffer.toString('base64') : '';\n}\n\n/**\n * @ignore\n */\nBinary.prototype.toString = function(format) {\n return this.buffer != null ? this.buffer.slice(0, this.position).toString(format) : '';\n}\n\n/**\n * Binary default subtype\n * @ignore\n */\nvar BSON_BINARY_SUBTYPE_DEFAULT = 0;\n\n/**\n * @ignore\n */\nvar writeStringToArray = function(data) {\n // Create a buffer\n var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(data.length)) : new Array(data.length);\n // Write the content to the buffer\n for(var i = 0; i < data.length; i++) {\n buffer[i] = data.charCodeAt(i);\n }\n // Write the string to the buffer\n return buffer;\n}\n\n/**\n * Convert Array ot Uint8Array to Binary String\n *\n * @ignore\n */\nvar convertArraytoUtf8BinaryString = function(byteArray, startIndex, endIndex) {\n var result = \"\";\n for(var i = startIndex; i < endIndex; i++) {\n result = result + String.fromCharCode(byteArray[i]);\n }\n return result;\n};\n\nBinary.BUFFER_SIZE = 256;\n\n/**\n * Default BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_DEFAULT = 0;\n/**\n * Function BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_FUNCTION = 1;\n/**\n * Byte Array BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_BYTE_ARRAY = 2;\n/**\n * OLD UUID BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_UUID_OLD = 3;\n/**\n * UUID BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_UUID = 4;\n/**\n * MD5 BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_MD5 = 5;\n/**\n * User BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_USER_DEFINED = 128;\n\n/**\n * Expose.\n */\nmodule.exports = Binary;\nmodule.exports.Binary = Binary;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/binary.js","/**\n * A class representation of the BSON Code type.\n *\n * @class\n * @param {(string|function)} code a string or function.\n * @param {Object} [scope] an optional scope for the function.\n * @return {Code}\n */\nvar Code = function Code(code, scope) {\n if(!(this instanceof Code)) return new Code(code, scope);\n this._bsontype = 'Code';\n this.code = code;\n this.scope = scope;\n};\n\n/**\n * @ignore\n */\nCode.prototype.toJSON = function() {\n return {scope:this.scope, code:this.code};\n}\n\nmodule.exports = Code;\nmodule.exports.Code = Code;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/code.js","/**\n * A class representation of the BSON DBRef type.\n *\n * @class\n * @param {string} namespace the collection name.\n * @param {ObjectID} oid the reference ObjectID.\n * @param {string} [db] optional db name, if omitted the reference is local to the current db.\n * @return {DBRef}\n */\nfunction DBRef(namespace, oid, db) {\n if(!(this instanceof DBRef)) return new DBRef(namespace, oid, db);\n \n this._bsontype = 'DBRef';\n this.namespace = namespace;\n this.oid = oid;\n this.db = db;\n};\n\n/**\n * @ignore\n * @api private\n */\nDBRef.prototype.toJSON = function() {\n return {\n '$ref':this.namespace,\n '$id':this.oid,\n '$db':this.db == null ? '' : this.db\n };\n}\n\nmodule.exports = DBRef;\nmodule.exports.DBRef = DBRef;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/db_ref.js","\"use strict\"\n\nvar Long = require('./long');\n\nvar PARSE_STRING_REGEXP = /^(\\+|\\-)?(\\d+|(\\d*\\.\\d*))?(E|e)?([\\-\\+])?(\\d+)?$/;\nvar PARSE_INF_REGEXP = /^(\\+|\\-)?(Infinity|inf)$/i;\nvar PARSE_NAN_REGEXP = /^(\\+|\\-)?NaN$/i;\n\nvar EXPONENT_MAX = 6111;\nvar EXPONENT_MIN = -6176;\nvar EXPONENT_BIAS = 6176;\nvar MAX_DIGITS = 34;\n\n// Nan value bits as 32 bit values (due to lack of longs)\nvar NAN_BUFFER = [0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].reverse();\n// Infinity value bits 32 bit values (due to lack of longs)\nvar INF_NEGATIVE_BUFFER = [0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].reverse();\nvar INF_POSITIVE_BUFFER = [0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].reverse();\n\nvar EXPONENT_REGEX = /^([\\-\\+])?(\\d+)?$/;\n\n\n// Detect if the value is a digit\nvar isDigit = function(value) {\n return !isNaN(parseInt(value, 10));\n}\n\n// Divide two uint128 values\nvar divideu128 = function(value) {\n var DIVISOR = Long.fromNumber(1000 * 1000 * 1000);\n var _rem = Long.fromNumber(0);\n var i = 0;\n\n if(!value.parts[0] && !value.parts[1] &&\n !value.parts[2] && !value.parts[3]) {\n return { quotient: value, rem: _rem };\n }\n\n for(var i = 0; i <= 3; i++) {\n // Adjust remainder to match value of next dividend\n _rem = _rem.shiftLeft(32);\n // Add the divided to _rem\n _rem = _rem.add(new Long(value.parts[i], 0));\n value.parts[i] = _rem.div(DIVISOR).low_;\n _rem = _rem.modulo(DIVISOR);\n }\n\n return { quotient: value, rem: _rem };\n}\n\n// Multiply two Long values and return the 128 bit value\nvar multiply64x2 = function(left, right) {\n if(!left && !right) {\n return {high: Long.fromNumber(0), low: Long.fromNumber(0)};\n }\n\n var leftHigh = left.shiftRightUnsigned(32);\n var leftLow = new Long(left.getLowBits(), 0);\n var rightHigh = right.shiftRightUnsigned(32);\n var rightLow = new Long(right.getLowBits(), 0);\n\n var productHigh = leftHigh.multiply(rightHigh);\n var productMid = leftHigh.multiply(rightLow);\n var productMid2 = leftLow.multiply(rightHigh);\n var productLow = leftLow.multiply(rightLow);\n\n productHigh = productHigh.add(productMid.shiftRightUnsigned(32));\n productMid = new Long(productMid.getLowBits(), 0)\n .add(productMid2)\n .add(productLow.shiftRightUnsigned(32));\n\n productHigh = productHigh.add(productMid.shiftRightUnsigned(32));\n productLow = productMid.shiftLeft(32).add(new Long(productLow.getLowBits(), 0));\n\n // Return the 128 bit result\n return {high: productHigh, low: productLow};\n}\n\nvar lessThan = function(left, right) {\n // Make values unsigned\n var uhleft = left.high_ >>> 0;\n var uhright = right.high_ >>> 0;\n\n // Compare high bits first\n if(uhleft < uhright) {\n return true\n } else if(uhleft == uhright) {\n var ulleft = left.low_ >>> 0;\n var ulright = right.low_ >>> 0;\n if(ulleft < ulright) return true;\n }\n\n return false;\n}\n\nvar longtoHex = function(value) {\n var buffer = new Buffer(8);\n var index = 0;\n // Encode the low 64 bits of the decimal\n // Encode low bits\n buffer[index++] = value.low_ & 0xff;\n buffer[index++] = (value.low_ >> 8) & 0xff;\n buffer[index++] = (value.low_ >> 16) & 0xff;\n buffer[index++] = (value.low_ >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = value.high_ & 0xff;\n buffer[index++] = (value.high_ >> 8) & 0xff;\n buffer[index++] = (value.high_ >> 16) & 0xff;\n buffer[index++] = (value.high_ >> 24) & 0xff;\n return buffer.reverse().toString('hex');\n}\n\nvar int32toHex = function(value) {\n var buffer = new Buffer(4);\n var index = 0;\n // Encode the low 64 bits of the decimal\n // Encode low bits\n buffer[index++] = value & 0xff;\n buffer[index++] = (value >> 8) & 0xff;\n buffer[index++] = (value >> 16) & 0xff;\n buffer[index++] = (value >> 24) & 0xff;\n return buffer.reverse().toString('hex');\n}\n\nvar Decimal128 = function(bytes) {\n this._bsontype = 'Decimal128';\n this.bytes = bytes;\n}\n\nDecimal128.fromString = function(string) {\n // Parse state tracking\n var isNegative = false;\n var sawRadix = false;\n var foundNonZero = false;\n\n // Total number of significant digits (no leading or trailing zero)\n var significantDigits = 0;\n // Total number of significand digits read\n var nDigitsRead = 0;\n // Total number of digits (no leading zeros)\n var nDigits = 0;\n // The number of the digits after radix\n var radixPosition = 0;\n // The index of the first non-zero in *str*\n var firstNonZero = 0;\n\n // Digits Array\n var digits = [0];\n // The number of digits in digits\n var nDigitsStored = 0;\n // Insertion pointer for digits\n var digitsInsert = 0;\n // The index of the first non-zero digit\n var firstDigit = 0;\n // The index of the last digit\n var lastDigit = 0;\n\n // Exponent\n var exponent = 0;\n // loop index over array\n var i = 0;\n // The high 17 digits of the significand\n var significandHigh = [0, 0];\n // The low 17 digits of the significand\n var significandLow = [0, 0];\n // The biased exponent\n var biasedExponent = 0;\n\n // Read index\n var index = 0;\n\n // Trim the string\n string = string.trim();\n\n // Results\n var stringMatch = string.match(PARSE_STRING_REGEXP);\n var infMatch = string.match(PARSE_INF_REGEXP);\n var nanMatch = string.match(PARSE_NAN_REGEXP);\n\n // Validate the string\n if(!stringMatch\n && ! infMatch\n && ! nanMatch || string.length == 0) {\n throw new Error(\"\" + string + \" not a valid Decimal128 string\");\n }\n\n // Check if we have an illegal exponent format\n if(stringMatch && stringMatch[4] && stringMatch[2] === undefined) {\n throw new Error(\"\" + string + \" not a valid Decimal128 string\");\n }\n\n // Get the negative or positive sign\n if(string[index] == '+' || string[index] == '-') {\n isNegative = string[index++] == '-';\n }\n\n // Check if user passed Infinity or NaN\n if(!isDigit(string[index]) && string[index] != '.') {\n if(string[index] == 'i' || string[index] == 'I') {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER));\n } else if(string[index] == 'N') {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n }\n\n // Read all the digits\n while(isDigit(string[index]) || string[index] == '.') {\n if(string[index] == '.') {\n if(sawRadix) {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n\n sawRadix = true;\n index = index + 1;\n continue;\n }\n\n if(nDigitsStored < 34) {\n if(string[index] != '0' || foundNonZero) {\n if(!foundNonZero) {\n firstNonZero = nDigitsRead;\n }\n\n foundNonZero = true;\n\n // Only store 34 digits\n digits[digitsInsert++] = parseInt(string[index], 10);\n nDigitsStored = nDigitsStored + 1;\n }\n }\n\n if(foundNonZero) {\n nDigits = nDigits + 1;\n }\n\n if(sawRadix) {\n radixPosition = radixPosition + 1;\n }\n\n nDigitsRead = nDigitsRead + 1;\n index = index + 1;\n }\n\n if(sawRadix && !nDigitsRead) {\n throw new Error(\"\" + string + \" not a valid Decimal128 string\");\n }\n\n // Read exponent if exists\n if(string[index] == 'e' || string[index] == 'E') {\n // Read exponent digits\n var match = string.substr(++index).match(EXPONENT_REGEX);\n\n // No digits read\n if(!match || !match[2]) {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n\n // Get exponent\n exponent = parseInt(match[0], 10);\n\n // Adjust the index\n index = index + match[0].length;\n }\n\n // Return not a number\n if(string[index]) {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n\n // Done reading input\n // Find first non-zero digit in digits\n firstDigit = 0;\n\n if(!nDigitsStored) {\n firstDigit = 0;\n lastDigit = 0;\n digits[0] = 0;\n nDigits = 1;\n nDigitsStored = 1;\n significantDigits = 0;\n } else {\n lastDigit = nDigitsStored - 1;\n significantDigits = nDigits;\n\n if(exponent != 0 && significantDigits != 1) {\n while(string[firstNonZero + significantDigits - 1] == '0') {\n significantDigits = significantDigits - 1;\n }\n }\n }\n\n // Normalization of exponent\n // Correct exponent based on radix position, and shift significand as needed\n // to represent user input\n\n // Overflow prevention\n if(exponent <= radixPosition && radixPosition - exponent > (1 << 14)) {\n exponent = EXPONENT_MIN;\n } else {\n exponent = exponent - radixPosition;\n }\n\n // Attempt to normalize the exponent\n while(exponent > EXPONENT_MAX) {\n // Shift exponent to significand and decrease\n lastDigit = lastDigit + 1;\n\n if(lastDigit - firstDigit > MAX_DIGITS) {\n // Check if we have a zero then just hard clamp, otherwise fail\n var digitsString = digits.join('');\n if(digitsString.match(/^0+$/)) {\n exponent = EXPONENT_MAX;\n break;\n } else {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER));\n }\n }\n\n exponent = exponent - 1;\n }\n\n while(exponent < EXPONENT_MIN || nDigitsStored < nDigits) {\n // Shift last digit\n if(lastDigit == 0) {\n exponent = EXPONENT_MIN;\n significantDigits = 0;\n break;\n }\n\n if(nDigitsStored < nDigits) {\n // adjust to match digits not stored\n nDigits = nDigits - 1;\n } else {\n // adjust to round\n lastDigit = lastDigit - 1;\n }\n\n if(exponent < EXPONENT_MAX) {\n exponent = exponent + 1;\n } else {\n // Check if we have a zero then just hard clamp, otherwise fail\n var digitsString = digits.join('');\n if(digitsString.match(/^0+$/)) {\n exponent = EXPONENT_MAX;\n break;\n } else {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER))\n }\n }\n }\n\n\n // Round\n // We've normalized the exponent, but might still need to round.\n if((lastDigit - firstDigit + 1 < significantDigits) && string[significantDigits] != '0') {\n var endOfString = nDigitsRead;\n\n // If we have seen a radix point, 'string' is 1 longer than we have\n // documented with ndigits_read, so inc the position of the first nonzero\n // digit and the position that digits are read to.\n if(sawRadix && exponent == EXPONENT_MIN) {\n firstNonZero = firstNonZero + 1;\n endOfString = endOfString + 1;\n }\n\n var roundDigit = parseInt(string[firstNonZero + lastDigit + 1], 10);\n var roundBit = 0;\n\n if(roundDigit >= 5) {\n roundBit = 1;\n\n if(roundDigit == 5) {\n roundBit = digits[lastDigit] % 2 == 1;\n\n for(var i = firstNonZero + lastDigit + 2; i < endOfString; i++) {\n if(parseInt(string[i], 10)) {\n roundBit = 1;\n break;\n }\n }\n }\n }\n\n if(roundBit) {\n var dIdx = lastDigit;\n\n for(; dIdx >= 0; dIdx--) {\n if(++digits[dIdx] > 9) {\n digits[dIdx] = 0;\n\n // overflowed most significant digit\n if(dIdx == 0) {\n if(exponent < EXPONENT_MAX) {\n exponent = exponent + 1;\n digits[dIdx] = 1;\n } else {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER))\n }\n }\n } else {\n break;\n }\n }\n }\n }\n\n // Encode significand\n // The high 17 digits of the significand\n significandHigh = Long.fromNumber(0);\n // The low 17 digits of the significand\n significandLow = Long.fromNumber(0);\n\n // read a zero\n if(significantDigits == 0) {\n significandHigh = Long.fromNumber(0);\n significandLow = Long.fromNumber(0);\n } else if(lastDigit - firstDigit < 17) {\n var dIdx = firstDigit;\n significandLow = Long.fromNumber(digits[dIdx++]);\n significandHigh = new Long(0, 0);\n\n for(; dIdx <= lastDigit; dIdx++) {\n significandLow = significandLow.multiply(Long.fromNumber(10));\n significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));\n }\n } else {\n var dIdx = firstDigit;\n significandHigh = Long.fromNumber(digits[dIdx++]);\n\n for(; dIdx <= lastDigit - 17; dIdx++) {\n significandHigh = significandHigh.multiply(Long.fromNumber(10));\n significandHigh = significandHigh.add(Long.fromNumber(digits[dIdx]));\n }\n\n significandLow = Long.fromNumber(digits[dIdx++]);\n\n for(; dIdx <= lastDigit; dIdx++) {\n significandLow = significandLow.multiply(Long.fromNumber(10));\n significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));\n }\n }\n\n var significand = multiply64x2(significandHigh, Long.fromString(\"100000000000000000\"));\n\n significand.low = significand.low.add(significandLow);\n\n if(lessThan(significand.low, significandLow)) {\n significand.high = significand.high.add(Long.fromNumber(1));\n }\n\n // Biased exponent\n var biasedExponent = (exponent + EXPONENT_BIAS);\n var dec = { low: Long.fromNumber(0), high: Long.fromNumber(0) };\n\n // Encode combination, exponent, and significand.\n if(significand.high.shiftRightUnsigned(49).and(Long.fromNumber(1)).equals(Long.fromNumber)) {\n // Encode '11' into bits 1 to 3\n dec.high = dec.high.or(Long.fromNumber(0x3).shiftLeft(61));\n dec.high = dec.high.or(Long.fromNumber(biasedExponent).and(Long.fromNumber(0x3fff).shiftLeft(47)));\n dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x7fffffffffff)));\n } else {\n dec.high = dec.high.or(Long.fromNumber(biasedExponent & 0x3fff).shiftLeft(49));\n dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x1ffffffffffff)));\n }\n\n dec.low = significand.low;\n\n // Encode sign\n if(isNegative) {\n dec.high = dec.high.or(Long.fromString('9223372036854775808'));\n }\n\n // Encode into a buffer\n var buffer = new Buffer(16);\n var index = 0;\n\n // Encode the low 64 bits of the decimal\n // Encode low bits\n buffer[index++] = dec.low.low_ & 0xff;\n buffer[index++] = (dec.low.low_ >> 8) & 0xff;\n buffer[index++] = (dec.low.low_ >> 16) & 0xff;\n buffer[index++] = (dec.low.low_ >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = dec.low.high_ & 0xff;\n buffer[index++] = (dec.low.high_ >> 8) & 0xff;\n buffer[index++] = (dec.low.high_ >> 16) & 0xff;\n buffer[index++] = (dec.low.high_ >> 24) & 0xff;\n\n // Encode the high 64 bits of the decimal\n // Encode low bits\n buffer[index++] = dec.high.low_ & 0xff;\n buffer[index++] = (dec.high.low_ >> 8) & 0xff;\n buffer[index++] = (dec.high.low_ >> 16) & 0xff;\n buffer[index++] = (dec.high.low_ >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = dec.high.high_ & 0xff;\n buffer[index++] = (dec.high.high_ >> 8) & 0xff;\n buffer[index++] = (dec.high.high_ >> 16) & 0xff;\n buffer[index++] = (dec.high.high_ >> 24) & 0xff;\n\n // Return the new Decimal128\n return new Decimal128(buffer);\n}\n\n// Extract least significant 5 bits\nvar COMBINATION_MASK = 0x1f;\n// Extract least significant 14 bits\nvar EXPONENT_MASK = 0x3fff;\n// Value of combination field for Inf\nvar COMBINATION_INFINITY = 30;\n// Value of combination field for NaN\nvar COMBINATION_NAN = 31;\n// Value of combination field for NaN\nvar COMBINATION_SNAN = 32;\n// decimal128 exponent bias\nvar EXPONENT_BIAS = 6176;\n\nDecimal128.prototype.toString = function() {\n // Note: bits in this routine are referred to starting at 0,\n // from the sign bit, towards the coefficient.\n\n // bits 0 - 31\n var high;\n // bits 32 - 63\n var midh;\n // bits 64 - 95\n var midl;\n // bits 96 - 127\n var low;\n // bits 1 - 5\n var combination;\n // decoded biased exponent (14 bits)\n var biased_exponent;\n // the number of significand digits\n var significand_digits = 0;\n // the base-10 digits in the significand\n var significand = new Array(36);\n for(var i = 0; i < significand.length; i++) significand[i] = 0;\n // read pointer into significand\n var index = 0;\n\n // unbiased exponent\n var exponent;\n // the exponent if scientific notation is used\n var scientific_exponent;\n\n // true if the number is zero\n var is_zero = false;\n\n // the most signifcant significand bits (50-46)\n var significand_msb;\n // temporary storage for significand decoding\n var significand128 = {parts: new Array(4)};\n // indexing variables\n var i;\n var j, k;\n\n // Output string\n var string = [];\n\n // Unpack index\n var index = 0;\n\n // Buffer reference\n var buffer = this.bytes;\n\n // Unpack the low 64bits into a long\n low = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n midl = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n // Unpack the high 64bits into a long\n midh = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n high = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n // Unpack index\n var index = 0;\n\n // Create the state of the decimal\n var dec = {\n low: new Long(low, midl),\n high: new Long(midh, high) };\n\n if(dec.high.lessThan(Long.ZERO)) {\n string.push('-');\n }\n\n // Decode combination field and exponent\n combination = (high >> 26) & COMBINATION_MASK;\n\n if((combination >> 3) == 3) {\n // Check for 'special' values\n if(combination == COMBINATION_INFINITY) {\n return string.join('') + \"Infinity\";\n } else if(combination == COMBINATION_NAN) {\n return \"NaN\";\n } else {\n biased_exponent = (high >> 15) & EXPONENT_MASK;\n significand_msb = 0x08 + ((high >> 14) & 0x01);\n }\n } else {\n significand_msb = (high >> 14) & 0x07;\n biased_exponent = (high >> 17) & EXPONENT_MASK;\n }\n\n exponent = biased_exponent - EXPONENT_BIAS;\n\n // Create string of significand digits\n\n // Convert the 114-bit binary number represented by\n // (significand_high, significand_low) to at most 34 decimal\n // digits through modulo and division.\n significand128.parts[0] = (high & 0x3fff) + ((significand_msb & 0xf) << 14);\n significand128.parts[1] = midh;\n significand128.parts[2] = midl;\n significand128.parts[3] = low;\n\n if(significand128.parts[0] == 0 && significand128.parts[1] == 0\n && significand128.parts[2] == 0 && significand128.parts[3] == 0) {\n is_zero = true;\n } else {\n for(var k = 3; k >= 0; k--) {\n var least_digits = 0;\n // Peform the divide\n var result = divideu128(significand128);\n significand128 = result.quotient;\n least_digits = result.rem.low_;\n\n // We now have the 9 least significant digits (in base 2).\n // Convert and output to string.\n if(!least_digits) continue;\n\n for(var j = 8; j >= 0; j--) {\n // significand[k * 9 + j] = Math.round(least_digits % 10);\n significand[k * 9 + j] = least_digits % 10;\n // least_digits = Math.round(least_digits / 10);\n least_digits = Math.floor(least_digits / 10);\n }\n }\n }\n\n // Output format options:\n // Scientific - [-]d.dddE(+/-)dd or [-]dE(+/-)dd\n // Regular - ddd.ddd\n\n if(is_zero) {\n significand_digits = 1;\n significand[index] = 0;\n } else {\n significand_digits = 36;\n var i = 0;\n\n while(!significand[index]) {\n i++;\n significand_digits = significand_digits - 1;\n index = index + 1;\n }\n }\n\n scientific_exponent = significand_digits - 1 + exponent;\n\n // The scientific exponent checks are dictated by the string conversion\n // specification and are somewhat arbitrary cutoffs.\n //\n // We must check exponent > 0, because if this is the case, the number\n // has trailing zeros. However, we *cannot* output these trailing zeros,\n // because doing so would change the precision of the value, and would\n // change stored data if the string converted number is round tripped.\n\n if(scientific_exponent >= 34 || scientific_exponent <= -7 ||\n exponent > 0) {\n // Scientific format\n string.push(significand[index++]);\n significand_digits = significand_digits - 1;\n\n if(significand_digits) {\n string.push('.');\n }\n\n for(var i = 0; i < significand_digits; i++) {\n string.push(significand[index++]);\n }\n\n // Exponent\n string.push('E');\n if(scientific_exponent > 0) {\n string.push('+' + scientific_exponent);\n } else {\n string.push(scientific_exponent);\n }\n } else {\n // Regular format with no decimal place\n if(exponent >= 0) {\n for(var i = 0; i < significand_digits; i++) {\n string.push(significand[index++]);\n }\n } else {\n var radix_position = significand_digits + exponent;\n\n // non-zero digits before radix\n if(radix_position > 0) {\n for(var i = 0; i < radix_position; i++) {\n string.push(significand[index++]);\n }\n } else {\n string.push('0');\n }\n\n string.push('.');\n // add leading zeros after radix\n while(radix_position++ < 0) {\n string.push('0');\n }\n\n for(var i = 0; i < significand_digits - Math.max(radix_position - 1, 0); i++) {\n string.push(significand[index++]);\n }\n }\n }\n\n return string.join('');\n}\n\nDecimal128.prototype.toJSON = function() {\n return { \"$numberDecimal\": this.toString() };\n}\n\nmodule.exports = Decimal128;\nmodule.exports.Decimal128 = Decimal128;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/decimal128.js","/**\n * A class representation of the BSON Double type.\n *\n * @class\n * @param {number} value the number we want to represent as a double.\n * @return {Double}\n */\nfunction Double(value) {\n if(!(this instanceof Double)) return new Double(value);\n\n this._bsontype = 'Double';\n this.value = value;\n}\n\n/**\n * Access the number value.\n *\n * @method\n * @return {number} returns the wrapped double number.\n */\nDouble.prototype.valueOf = function() {\n return this.value;\n};\n\n/**\n * @ignore\n */\nDouble.prototype.toJSON = function() {\n return this.value;\n}\n\nmodule.exports = Double;\nmodule.exports.Double = Double;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/double.js","/**\n * A class representation of the BSON MaxKey type.\n *\n * @class\n * @return {MaxKey} A MaxKey instance\n */\nfunction MaxKey() {\n if(!(this instanceof MaxKey)) return new MaxKey();\n \n this._bsontype = 'MaxKey'; \n}\n\nmodule.exports = MaxKey;\nmodule.exports.MaxKey = MaxKey;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/max_key.js","/**\n * A class representation of the BSON MinKey type.\n *\n * @class\n * @return {MinKey} A MinKey instance\n */\nfunction MinKey() {\n if(!(this instanceof MinKey)) return new MinKey();\n \n this._bsontype = 'MinKey';\n}\n\nmodule.exports = MinKey;\nmodule.exports.MinKey = MinKey;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/min_key.js","/**\n * Machine id.\n *\n * Create a random 3-byte value (i.e. unique for this\n * process). Other drivers use a md5 of the machine id here, but\n * that would mean an asyc call to gethostname, so we don't bother.\n * @ignore\n */\nvar MACHINE_ID = parseInt(Math.random() * 0xFFFFFF, 10);\n\n// Regular expression that checks for hex value\nvar checkForHexRegExp = new RegExp(\"^[0-9a-fA-F]{24}$\");\nvar hasBufferType = false;\n\n// Check if buffer exists\ntry {\n if(Buffer && Buffer.from) hasBufferType = true;\n} catch(err) {};\n\n/**\n* Create a new ObjectID instance\n*\n* @class\n* @param {(string|number)} id Can be a 24 byte hex string, 12 byte binary string or a Number.\n* @property {number} generationTime The generation time of this ObjectId instance\n* @return {ObjectID} instance of ObjectID.\n*/\nvar ObjectID = function ObjectID(id) {\n // Duck-typing to support ObjectId from different npm packages\n if(id instanceof ObjectID) return id;\n if(!(this instanceof ObjectID)) return new ObjectID(id);\n\n this._bsontype = 'ObjectID';\n\n // The most common usecase (blank id, new objectId instance)\n if(id == null || typeof id == 'number') {\n // Generate a new id\n this.id = this.generate(id);\n // If we are caching the hex string\n if(ObjectID.cacheHexString) this.__id = this.toString('hex');\n // Return the object\n return;\n }\n\n // Check if the passed in id is valid\n var valid = ObjectID.isValid(id);\n\n // Throw an error if it's not a valid setup\n if(!valid && id != null){\n throw new Error(\"Argument passed in must be a single String of 12 bytes or a string of 24 hex characters\");\n } else if(valid && typeof id == 'string' && id.length == 24 && hasBufferType) {\n return new ObjectID(new Buffer(id, 'hex'));\n } else if(valid && typeof id == 'string' && id.length == 24) {\n return ObjectID.createFromHexString(id);\n } else if(id != null && id.length === 12) {\n // assume 12 byte string\n this.id = id;\n } else if(id != null && id.toHexString) {\n // Duck-typing to support ObjectId from different npm packages\n return id;\n } else {\n throw new Error(\"Argument passed in must be a single String of 12 bytes or a string of 24 hex characters\");\n }\n\n if(ObjectID.cacheHexString) this.__id = this.toString('hex');\n};\n\n// Allow usage of ObjectId as well as ObjectID\nvar ObjectId = ObjectID;\n\n// Precomputed hex table enables speedy hex string conversion\nvar hexTable = [];\nfor (var i = 0; i < 256; i++) {\n hexTable[i] = (i <= 15 ? '0' : '') + i.toString(16);\n}\n\n/**\n* Return the ObjectID id as a 24 byte hex string representation\n*\n* @method\n* @return {string} return the 24 byte hex string representation.\n*/\nObjectID.prototype.toHexString = function() {\n if(ObjectID.cacheHexString && this.__id) return this.__id;\n\n var hexString = '';\n if(!this.id || !this.id.length) {\n throw new Error('invalid ObjectId, ObjectId.id must be either a string or a Buffer, but is [' + JSON.stringify(this.id) + ']');\n }\n\n if(this.id instanceof _Buffer) {\n hexString = convertToHex(this.id);\n if(ObjectID.cacheHexString) this.__id = hexString;\n return hexString;\n }\n\n for (var i = 0; i < this.id.length; i++) {\n hexString += hexTable[this.id.charCodeAt(i)];\n }\n\n if(ObjectID.cacheHexString) this.__id = hexString;\n return hexString;\n};\n\n/**\n* Update the ObjectID index used in generating new ObjectID's on the driver\n*\n* @method\n* @return {number} returns next index value.\n* @ignore\n*/\nObjectID.prototype.get_inc = function() {\n return ObjectID.index = (ObjectID.index + 1) % 0xFFFFFF;\n};\n\n/**\n* Update the ObjectID index used in generating new ObjectID's on the driver\n*\n* @method\n* @return {number} returns next index value.\n* @ignore\n*/\nObjectID.prototype.getInc = function() {\n return this.get_inc();\n};\n\n/**\n* Generate a 12 byte id buffer used in ObjectID's\n*\n* @method\n* @param {number} [time] optional parameter allowing to pass in a second based timestamp.\n* @return {Buffer} return the 12 byte id buffer string.\n*/\nObjectID.prototype.generate = function(time) {\n if ('number' != typeof time) {\n time = ~~(Date.now()/1000);\n }\n\n // Use pid\n var pid = (typeof process === 'undefined' ? Math.floor(Math.random() * 100000) : process.pid) % 0xFFFF;\n var inc = this.get_inc();\n // Buffer used\n var buffer = new Buffer(12);\n // Encode time\n buffer[3] = time & 0xff;\n buffer[2] = (time >> 8) & 0xff;\n buffer[1] = (time >> 16) & 0xff;\n buffer[0] = (time >> 24) & 0xff;\n // Encode machine\n buffer[6] = MACHINE_ID & 0xff;\n buffer[5] = (MACHINE_ID >> 8) & 0xff;\n buffer[4] = (MACHINE_ID >> 16) & 0xff;\n // Encode pid\n buffer[8] = pid & 0xff;\n buffer[7] = (pid >> 8) & 0xff;\n // Encode index\n buffer[11] = inc & 0xff;\n buffer[10] = (inc >> 8) & 0xff;\n buffer[9] = (inc >> 16) & 0xff;\n // Return the buffer\n return buffer;\n};\n\n/**\n* Converts the id into a 24 byte hex string for printing\n*\n* @param {String} format The Buffer toString format parameter.\n* @return {String} return the 24 byte hex string representation.\n* @ignore\n*/\nObjectID.prototype.toString = function(format) {\n // Is the id a buffer then use the buffer toString method to return the format\n if(this.id && this.id.copy) {\n return this.id.toString(typeof format === 'string' ? format : 'hex');\n }\n\n // if(this.buffer )\n return this.toHexString();\n};\n\n/**\n* Converts to a string representation of this Id.\n*\n* @return {String} return the 24 byte hex string representation.\n* @ignore\n*/\nObjectID.prototype.inspect = ObjectID.prototype.toString;\n\n/**\n* Converts to its JSON representation.\n*\n* @return {String} return the 24 byte hex string representation.\n* @ignore\n*/\nObjectID.prototype.toJSON = function() {\n return this.toHexString();\n};\n\n/**\n* Compares the equality of this ObjectID with `otherID`.\n*\n* @method\n* @param {object} otherID ObjectID instance to compare against.\n* @return {boolean} the result of comparing two ObjectID's\n*/\nObjectID.prototype.equals = function equals (otherId) {\n var id;\n\n if(otherId instanceof ObjectID) {\n return this.toString() == otherId.toString();\n } else if(typeof otherId == 'string' && ObjectID.isValid(otherId) && otherId.length == 12 && this.id instanceof _Buffer) {\n return otherId === this.id.toString('binary');\n } else if(typeof otherId == 'string' && ObjectID.isValid(otherId) && otherId.length == 24) {\n return otherId.toLowerCase() === this.toHexString();\n } else if(typeof otherId == 'string' && ObjectID.isValid(otherId) && otherId.length == 12) {\n return otherId === this.id;\n } else if(otherId != null && (otherId instanceof ObjectID || otherId.toHexString)) {\n return otherId.toHexString() === this.toHexString();\n } else {\n return false;\n }\n}\n\n/**\n* Returns the generation date (accurate up to the second) that this ID was generated.\n*\n* @method\n* @return {date} the generation date\n*/\nObjectID.prototype.getTimestamp = function() {\n var timestamp = new Date();\n var time = this.id[3] | this.id[2] << 8 | this.id[1] << 16 | this.id[0] << 24;\n timestamp.setTime(Math.floor(time) * 1000);\n return timestamp;\n}\n\n/**\n* @ignore\n*/\nObjectID.index = ~~(Math.random() * 0xFFFFFF);\n\n/**\n* @ignore\n*/\nObjectID.createPk = function createPk () {\n return new ObjectID();\n};\n\n/**\n* Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID.\n*\n* @method\n* @param {number} time an integer number representing a number of seconds.\n* @return {ObjectID} return the created ObjectID\n*/\nObjectID.createFromTime = function createFromTime (time) {\n var buffer = new Buffer([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);\n // Encode time into first 4 bytes\n buffer[3] = time & 0xff;\n buffer[2] = (time >> 8) & 0xff;\n buffer[1] = (time >> 16) & 0xff;\n buffer[0] = (time >> 24) & 0xff;\n // Return the new objectId\n return new ObjectID(buffer);\n};\n\n// Lookup tables\nvar encodeLookup = '0123456789abcdef'.split('')\nvar decodeLookup = []\nvar i = 0\nwhile (i < 10) decodeLookup[0x30 + i] = i++\nwhile (i < 16) decodeLookup[0x41 - 10 + i] = decodeLookup[0x61 - 10 + i] = i++\n\nvar _Buffer = Buffer;\nvar convertToHex = function(bytes) {\n return bytes.toString('hex');\n}\n\n/**\n* Creates an ObjectID from a hex string representation of an ObjectID.\n*\n* @method\n* @param {string} hexString create a ObjectID from a passed in 24 byte hexstring.\n* @return {ObjectID} return the created ObjectID\n*/\nObjectID.createFromHexString = function createFromHexString (string) {\n // Throw an error if it's not a valid setup\n if(typeof string === 'undefined' || string != null && string.length != 24) {\n throw new Error(\"Argument passed in must be a single String of 12 bytes or a string of 24 hex characters\");\n }\n\n // Use Buffer.from method if available\n if(hasBufferType) return new ObjectID(new Buffer(string, 'hex'));\n\n // Calculate lengths\n var array = new _Buffer(12);\n var n = 0;\n var i = 0;\n\n while (i < 24) {\n array[n++] = decodeLookup[string.charCodeAt(i++)] << 4 | decodeLookup[string.charCodeAt(i++)]\n }\n\n return new ObjectID(array);\n};\n\n/**\n* Checks if a value is a valid bson ObjectId\n*\n* @method\n* @return {boolean} return true if the value is a valid bson ObjectId, return false otherwise.\n*/\nObjectID.isValid = function isValid(id) {\n if(id == null) return false;\n\n if(typeof id == 'number') {\n return true;\n }\n\n if(typeof id == 'string') {\n return id.length == 12 || (id.length == 24 && checkForHexRegExp.test(id));\n }\n\n if(id instanceof ObjectID) {\n return true;\n }\n\n if(id instanceof _Buffer) {\n return true;\n }\n\n // Duck-Typing detection of ObjectId like objects\n if(id.toHexString) {\n return id.id.length == 12 || (id.id.length == 24 && checkForHexRegExp.test(id.id));\n }\n\n return false;\n};\n\n/**\n* @ignore\n*/\nObject.defineProperty(ObjectID.prototype, \"generationTime\", {\n enumerable: true\n , get: function () {\n return this.id[3] | this.id[2] << 8 | this.id[1] << 16 | this.id[0] << 24;\n }\n , set: function (value) {\n // Encode time into first 4 bytes\n this.id[3] = value & 0xff;\n this.id[2] = (value >> 8) & 0xff;\n this.id[1] = (value >> 16) & 0xff;\n this.id[0] = (value >> 24) & 0xff;\n }\n});\n\n/**\n * Expose.\n */\nmodule.exports = ObjectID;\nmodule.exports.ObjectID = ObjectID;\nmodule.exports.ObjectId = ObjectID;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/objectid.js","/**\n * A class representation of the BSON RegExp type.\n *\n * @class\n * @return {BSONRegExp} A MinKey instance\n */\nfunction BSONRegExp(pattern, options) {\n if(!(this instanceof BSONRegExp)) return new BSONRegExp();\n\n // Execute\n this._bsontype = 'BSONRegExp';\n this.pattern = pattern || '';\n this.options = options || '';\n\n // Validate options\n for(var i = 0; i < this.options.length; i++) {\n if(!(this.options[i] == 'i'\n || this.options[i] == 'm'\n || this.options[i] == 'x'\n || this.options[i] == 'l'\n || this.options[i] == 's'\n || this.options[i] == 'u'\n )) {\n throw new Error('the regular expression options [' + this.options[i] + \"] is not supported\");\n }\n }\n}\n\nmodule.exports = BSONRegExp;\nmodule.exports.BSONRegExp = BSONRegExp;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/regexp.js","/**\n * A class representation of the BSON Symbol type.\n *\n * @class\n * @deprecated\n * @param {string} value the string representing the symbol.\n * @return {Symbol}\n */\nfunction Symbol(value) {\n if(!(this instanceof Symbol)) return new Symbol(value);\n this._bsontype = 'Symbol';\n this.value = value;\n}\n\n/**\n * Access the wrapped string value.\n *\n * @method\n * @return {String} returns the wrapped string.\n */\nSymbol.prototype.valueOf = function() {\n return this.value;\n};\n\n/**\n * @ignore\n */\nSymbol.prototype.toString = function() {\n return this.value;\n}\n\n/**\n * @ignore\n */\nSymbol.prototype.inspect = function() {\n return this.value;\n}\n\n/**\n * @ignore\n */\nSymbol.prototype.toJSON = function() {\n return this.value;\n}\n\nmodule.exports = Symbol;\nmodule.exports.Symbol = Symbol;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/symbol.js","// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n// Copyright 2009 Google Inc. All Rights Reserved\n\n/**\n * This type is for INTERNAL use in MongoDB only and should not be used in applications.\n * The appropriate corresponding type is the JavaScript Date type.\n * \n * Defines a Timestamp class for representing a 64-bit two's-complement\n * integer value, which faithfully simulates the behavior of a Java \"Timestamp\". This\n * implementation is derived from TimestampLib in GWT.\n *\n * Constructs a 64-bit two's-complement integer, given its low and high 32-bit\n * values as *signed* integers. See the from* functions below for more\n * convenient ways of constructing Timestamps.\n *\n * The internal representation of a Timestamp is the two given signed, 32-bit values.\n * We use 32-bit pieces because these are the size of integers on which\n * Javascript performs bit-operations. For operations like addition and\n * multiplication, we split each number into 16-bit pieces, which can easily be\n * multiplied within Javascript's floating-point representation without overflow\n * or change in sign.\n *\n * In the algorithms below, we frequently reduce the negative case to the\n * positive case by negating the input(s) and then post-processing the result.\n * Note that we must ALWAYS check specially whether those values are MIN_VALUE\n * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\n * a positive number, it overflows back into a negative). Not handling this\n * case would often result in infinite recursion.\n *\n * @class\n * @param {number} low the low (signed) 32 bits of the Timestamp.\n * @param {number} high the high (signed) 32 bits of the Timestamp.\n */\nfunction Timestamp(low, high) {\n if(!(this instanceof Timestamp)) return new Timestamp(low, high);\n this._bsontype = 'Timestamp';\n /**\n * @type {number}\n * @ignore\n */\n this.low_ = low | 0; // force into 32 signed bits.\n\n /**\n * @type {number}\n * @ignore\n */\n this.high_ = high | 0; // force into 32 signed bits.\n};\n\n/**\n * Return the int value.\n *\n * @return {number} the value, assuming it is a 32-bit integer.\n */\nTimestamp.prototype.toInt = function() {\n return this.low_;\n};\n\n/**\n * Return the Number value.\n *\n * @method\n * @return {number} the closest floating-point representation to this value.\n */\nTimestamp.prototype.toNumber = function() {\n return this.high_ * Timestamp.TWO_PWR_32_DBL_ +\n this.getLowBitsUnsigned();\n};\n\n/**\n * Return the JSON value.\n *\n * @method\n * @return {string} the JSON representation.\n */\nTimestamp.prototype.toJSON = function() {\n return this.toString();\n}\n\n/**\n * Return the String value.\n *\n * @method\n * @param {number} [opt_radix] the radix in which the text should be written.\n * @return {string} the textual representation of this value.\n */\nTimestamp.prototype.toString = function(opt_radix) {\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (this.isZero()) {\n return '0';\n }\n\n if (this.isNegative()) {\n if (this.equals(Timestamp.MIN_VALUE)) {\n // We need to change the Timestamp value before it can be negated, so we remove\n // the bottom-most digit in this base and then recurse to do the rest.\n var radixTimestamp = Timestamp.fromNumber(radix);\n var div = this.div(radixTimestamp);\n var rem = div.multiply(radixTimestamp).subtract(this);\n return div.toString(radix) + rem.toInt().toString(radix);\n } else {\n return '-' + this.negate().toString(radix);\n }\n }\n\n // Do several (6) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Timestamp.fromNumber(Math.pow(radix, 6));\n\n var rem = this;\n var result = '';\n while (true) {\n var remDiv = rem.div(radixToPower);\n var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt();\n var digits = intval.toString(radix);\n\n rem = remDiv;\n if (rem.isZero()) {\n return digits + result;\n } else {\n while (digits.length < 6) {\n digits = '0' + digits;\n }\n result = '' + digits + result;\n }\n }\n};\n\n/**\n * Return the high 32-bits value.\n *\n * @method\n * @return {number} the high 32-bits as a signed value.\n */\nTimestamp.prototype.getHighBits = function() {\n return this.high_;\n};\n\n/**\n * Return the low 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as a signed value.\n */\nTimestamp.prototype.getLowBits = function() {\n return this.low_;\n};\n\n/**\n * Return the low unsigned 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as an unsigned value.\n */\nTimestamp.prototype.getLowBitsUnsigned = function() {\n return (this.low_ >= 0) ?\n this.low_ : Timestamp.TWO_PWR_32_DBL_ + this.low_;\n};\n\n/**\n * Returns the number of bits needed to represent the absolute value of this Timestamp.\n *\n * @method\n * @return {number} Returns the number of bits needed to represent the absolute value of this Timestamp.\n */\nTimestamp.prototype.getNumBitsAbs = function() {\n if (this.isNegative()) {\n if (this.equals(Timestamp.MIN_VALUE)) {\n return 64;\n } else {\n return this.negate().getNumBitsAbs();\n }\n } else {\n var val = this.high_ != 0 ? this.high_ : this.low_;\n for (var bit = 31; bit > 0; bit--) {\n if ((val & (1 << bit)) != 0) {\n break;\n }\n }\n return this.high_ != 0 ? bit + 33 : bit + 1;\n }\n};\n\n/**\n * Return whether this value is zero.\n *\n * @method\n * @return {boolean} whether this value is zero.\n */\nTimestamp.prototype.isZero = function() {\n return this.high_ == 0 && this.low_ == 0;\n};\n\n/**\n * Return whether this value is negative.\n *\n * @method\n * @return {boolean} whether this value is negative.\n */\nTimestamp.prototype.isNegative = function() {\n return this.high_ < 0;\n};\n\n/**\n * Return whether this value is odd.\n *\n * @method\n * @return {boolean} whether this value is odd.\n */\nTimestamp.prototype.isOdd = function() {\n return (this.low_ & 1) == 1;\n};\n\n/**\n * Return whether this Timestamp equals the other\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp equals the other\n */\nTimestamp.prototype.equals = function(other) {\n return (this.high_ == other.high_) && (this.low_ == other.low_);\n};\n\n/**\n * Return whether this Timestamp does not equal the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp does not equal the other.\n */\nTimestamp.prototype.notEquals = function(other) {\n return (this.high_ != other.high_) || (this.low_ != other.low_);\n};\n\n/**\n * Return whether this Timestamp is less than the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is less than the other.\n */\nTimestamp.prototype.lessThan = function(other) {\n return this.compare(other) < 0;\n};\n\n/**\n * Return whether this Timestamp is less than or equal to the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is less than or equal to the other.\n */\nTimestamp.prototype.lessThanOrEqual = function(other) {\n return this.compare(other) <= 0;\n};\n\n/**\n * Return whether this Timestamp is greater than the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is greater than the other.\n */\nTimestamp.prototype.greaterThan = function(other) {\n return this.compare(other) > 0;\n};\n\n/**\n * Return whether this Timestamp is greater than or equal to the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is greater than or equal to the other.\n */\nTimestamp.prototype.greaterThanOrEqual = function(other) {\n return this.compare(other) >= 0;\n};\n\n/**\n * Compares this Timestamp with the given one.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater.\n */\nTimestamp.prototype.compare = function(other) {\n if (this.equals(other)) {\n return 0;\n }\n\n var thisNeg = this.isNegative();\n var otherNeg = other.isNegative();\n if (thisNeg && !otherNeg) {\n return -1;\n }\n if (!thisNeg && otherNeg) {\n return 1;\n }\n\n // at this point, the signs are the same, so subtraction will not overflow\n if (this.subtract(other).isNegative()) {\n return -1;\n } else {\n return 1;\n }\n};\n\n/**\n * The negation of this value.\n *\n * @method\n * @return {Timestamp} the negation of this value.\n */\nTimestamp.prototype.negate = function() {\n if (this.equals(Timestamp.MIN_VALUE)) {\n return Timestamp.MIN_VALUE;\n } else {\n return this.not().add(Timestamp.ONE);\n }\n};\n\n/**\n * Returns the sum of this and the given Timestamp.\n *\n * @method\n * @param {Timestamp} other Timestamp to add to this one.\n * @return {Timestamp} the sum of this and the given Timestamp.\n */\nTimestamp.prototype.add = function(other) {\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 + b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 + b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 + b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 + b48;\n c48 &= 0xFFFF;\n return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32);\n};\n\n/**\n * Returns the difference of this and the given Timestamp.\n *\n * @method\n * @param {Timestamp} other Timestamp to subtract from this.\n * @return {Timestamp} the difference of this and the given Timestamp.\n */\nTimestamp.prototype.subtract = function(other) {\n return this.add(other.negate());\n};\n\n/**\n * Returns the product of this and the given Timestamp.\n *\n * @method\n * @param {Timestamp} other Timestamp to multiply with this.\n * @return {Timestamp} the product of this and the other.\n */\nTimestamp.prototype.multiply = function(other) {\n if (this.isZero()) {\n return Timestamp.ZERO;\n } else if (other.isZero()) {\n return Timestamp.ZERO;\n }\n\n if (this.equals(Timestamp.MIN_VALUE)) {\n return other.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO;\n } else if (other.equals(Timestamp.MIN_VALUE)) {\n return this.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().multiply(other.negate());\n } else {\n return this.negate().multiply(other).negate();\n }\n } else if (other.isNegative()) {\n return this.multiply(other.negate()).negate();\n }\n\n // If both Timestamps are small, use float multiplication\n if (this.lessThan(Timestamp.TWO_PWR_24_) &&\n other.lessThan(Timestamp.TWO_PWR_24_)) {\n return Timestamp.fromNumber(this.toNumber() * other.toNumber());\n }\n\n // Divide each Timestamp into 4 chunks of 16 bits, and then add up 4x4 products.\n // We can skip products that would overflow.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 * b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 * b00;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c16 += a00 * b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 * b00;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a16 * b16;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a00 * b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\n c48 &= 0xFFFF;\n return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32);\n};\n\n/**\n * Returns this Timestamp divided by the given one.\n *\n * @method\n * @param {Timestamp} other Timestamp by which to divide.\n * @return {Timestamp} this Timestamp divided by the given one.\n */\nTimestamp.prototype.div = function(other) {\n if (other.isZero()) {\n throw Error('division by zero');\n } else if (this.isZero()) {\n return Timestamp.ZERO;\n }\n\n if (this.equals(Timestamp.MIN_VALUE)) {\n if (other.equals(Timestamp.ONE) ||\n other.equals(Timestamp.NEG_ONE)) {\n return Timestamp.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\n } else if (other.equals(Timestamp.MIN_VALUE)) {\n return Timestamp.ONE;\n } else {\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\n var halfThis = this.shiftRight(1);\n var approx = halfThis.div(other).shiftLeft(1);\n if (approx.equals(Timestamp.ZERO)) {\n return other.isNegative() ? Timestamp.ONE : Timestamp.NEG_ONE;\n } else {\n var rem = this.subtract(other.multiply(approx));\n var result = approx.add(rem.div(other));\n return result;\n }\n }\n } else if (other.equals(Timestamp.MIN_VALUE)) {\n return Timestamp.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().div(other.negate());\n } else {\n return this.negate().div(other).negate();\n }\n } else if (other.isNegative()) {\n return this.div(other.negate()).negate();\n }\n\n // Repeat the following until the remainder is less than other: find a\n // floating-point that approximates remainder / other *from below*, add this\n // into the result, and subtract it from the remainder. It is critical that\n // the approximate value is less than or equal to the real value so that the\n // remainder never becomes negative.\n var res = Timestamp.ZERO;\n var rem = this;\n while (rem.greaterThanOrEqual(other)) {\n // Approximate the result of division. This may be a little greater or\n // smaller than the actual value.\n var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber()));\n\n // We will tweak the approximate result by changing it in the 48-th digit or\n // the smallest non-fractional digit, whichever is larger.\n var log2 = Math.ceil(Math.log(approx) / Math.LN2);\n var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48);\n\n // Decrease the approximation until it is smaller than the remainder. Note\n // that if it is too large, the product overflows and is negative.\n var approxRes = Timestamp.fromNumber(approx);\n var approxRem = approxRes.multiply(other);\n while (approxRem.isNegative() || approxRem.greaterThan(rem)) {\n approx -= delta;\n approxRes = Timestamp.fromNumber(approx);\n approxRem = approxRes.multiply(other);\n }\n\n // We know the answer can't be zero... and actually, zero would cause\n // infinite recursion since we would make no progress.\n if (approxRes.isZero()) {\n approxRes = Timestamp.ONE;\n }\n\n res = res.add(approxRes);\n rem = rem.subtract(approxRem);\n }\n return res;\n};\n\n/**\n * Returns this Timestamp modulo the given one.\n *\n * @method\n * @param {Timestamp} other Timestamp by which to mod.\n * @return {Timestamp} this Timestamp modulo the given one.\n */\nTimestamp.prototype.modulo = function(other) {\n return this.subtract(this.div(other).multiply(other));\n};\n\n/**\n * The bitwise-NOT of this value.\n *\n * @method\n * @return {Timestamp} the bitwise-NOT of this value.\n */\nTimestamp.prototype.not = function() {\n return Timestamp.fromBits(~this.low_, ~this.high_);\n};\n\n/**\n * Returns the bitwise-AND of this Timestamp and the given one.\n *\n * @method\n * @param {Timestamp} other the Timestamp with which to AND.\n * @return {Timestamp} the bitwise-AND of this and the other.\n */\nTimestamp.prototype.and = function(other) {\n return Timestamp.fromBits(this.low_ & other.low_, this.high_ & other.high_);\n};\n\n/**\n * Returns the bitwise-OR of this Timestamp and the given one.\n *\n * @method\n * @param {Timestamp} other the Timestamp with which to OR.\n * @return {Timestamp} the bitwise-OR of this and the other.\n */\nTimestamp.prototype.or = function(other) {\n return Timestamp.fromBits(this.low_ | other.low_, this.high_ | other.high_);\n};\n\n/**\n * Returns the bitwise-XOR of this Timestamp and the given one.\n *\n * @method\n * @param {Timestamp} other the Timestamp with which to XOR.\n * @return {Timestamp} the bitwise-XOR of this and the other.\n */\nTimestamp.prototype.xor = function(other) {\n return Timestamp.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_);\n};\n\n/**\n * Returns this Timestamp with bits shifted to the left by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Timestamp} this shifted to the left by the given amount.\n */\nTimestamp.prototype.shiftLeft = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var low = this.low_;\n if (numBits < 32) {\n var high = this.high_;\n return Timestamp.fromBits(\n low << numBits,\n (high << numBits) | (low >>> (32 - numBits)));\n } else {\n return Timestamp.fromBits(0, low << (numBits - 32));\n }\n }\n};\n\n/**\n * Returns this Timestamp with bits shifted to the right by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Timestamp} this shifted to the right by the given amount.\n */\nTimestamp.prototype.shiftRight = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Timestamp.fromBits(\n (low >>> numBits) | (high << (32 - numBits)),\n high >> numBits);\n } else {\n return Timestamp.fromBits(\n high >> (numBits - 32),\n high >= 0 ? 0 : -1);\n }\n }\n};\n\n/**\n * Returns this Timestamp with bits shifted to the right by the given amount, with the new top bits matching the current sign bit.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Timestamp} this shifted to the right by the given amount, with zeros placed into the new leading bits.\n */\nTimestamp.prototype.shiftRightUnsigned = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Timestamp.fromBits(\n (low >>> numBits) | (high << (32 - numBits)),\n high >>> numBits);\n } else if (numBits == 32) {\n return Timestamp.fromBits(high, 0);\n } else {\n return Timestamp.fromBits(high >>> (numBits - 32), 0);\n }\n }\n};\n\n/**\n * Returns a Timestamp representing the given (32-bit) integer value.\n *\n * @method\n * @param {number} value the 32-bit integer in question.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromInt = function(value) {\n if (-128 <= value && value < 128) {\n var cachedObj = Timestamp.INT_CACHE_[value];\n if (cachedObj) {\n return cachedObj;\n }\n }\n\n var obj = new Timestamp(value | 0, value < 0 ? -1 : 0);\n if (-128 <= value && value < 128) {\n Timestamp.INT_CACHE_[value] = obj;\n }\n return obj;\n};\n\n/**\n * Returns a Timestamp representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n *\n * @method\n * @param {number} value the number in question.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromNumber = function(value) {\n if (isNaN(value) || !isFinite(value)) {\n return Timestamp.ZERO;\n } else if (value <= -Timestamp.TWO_PWR_63_DBL_) {\n return Timestamp.MIN_VALUE;\n } else if (value + 1 >= Timestamp.TWO_PWR_63_DBL_) {\n return Timestamp.MAX_VALUE;\n } else if (value < 0) {\n return Timestamp.fromNumber(-value).negate();\n } else {\n return new Timestamp(\n (value % Timestamp.TWO_PWR_32_DBL_) | 0,\n (value / Timestamp.TWO_PWR_32_DBL_) | 0);\n }\n};\n\n/**\n * Returns a Timestamp representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits.\n *\n * @method\n * @param {number} lowBits the low 32-bits.\n * @param {number} highBits the high 32-bits.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromBits = function(lowBits, highBits) {\n return new Timestamp(lowBits, highBits);\n};\n\n/**\n * Returns a Timestamp representation of the given string, written using the given radix.\n *\n * @method\n * @param {string} str the textual representation of the Timestamp.\n * @param {number} opt_radix the radix in which the text is written.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromString = function(str, opt_radix) {\n if (str.length == 0) {\n throw Error('number format error: empty string');\n }\n\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (str.charAt(0) == '-') {\n return Timestamp.fromString(str.substring(1), radix).negate();\n } else if (str.indexOf('-') >= 0) {\n throw Error('number format error: interior \"-\" character: ' + str);\n }\n\n // Do several (8) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Timestamp.fromNumber(Math.pow(radix, 8));\n\n var result = Timestamp.ZERO;\n for (var i = 0; i < str.length; i += 8) {\n var size = Math.min(8, str.length - i);\n var value = parseInt(str.substring(i, i + size), radix);\n if (size < 8) {\n var power = Timestamp.fromNumber(Math.pow(radix, size));\n result = result.multiply(power).add(Timestamp.fromNumber(value));\n } else {\n result = result.multiply(radixToPower);\n result = result.add(Timestamp.fromNumber(value));\n }\n }\n return result;\n};\n\n// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the\n// from* methods on which they depend.\n\n\n/**\n * A cache of the Timestamp representations of small integer values.\n * @type {Object}\n * @ignore\n */\nTimestamp.INT_CACHE_ = {};\n\n// NOTE: the compiler should inline these constant values below and then remove\n// these variables, so there should be no runtime penalty for these.\n\n/**\n * Number used repeated below in calculations. This must appear before the\n * first call to any from* function below.\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_16_DBL_ = 1 << 16;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_24_DBL_ = 1 << 24;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_32_DBL_ = Timestamp.TWO_PWR_16_DBL_ * Timestamp.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_31_DBL_ = Timestamp.TWO_PWR_32_DBL_ / 2;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_48_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_64_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_32_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_63_DBL_ = Timestamp.TWO_PWR_64_DBL_ / 2;\n\n/** @type {Timestamp} */\nTimestamp.ZERO = Timestamp.fromInt(0);\n\n/** @type {Timestamp} */\nTimestamp.ONE = Timestamp.fromInt(1);\n\n/** @type {Timestamp} */\nTimestamp.NEG_ONE = Timestamp.fromInt(-1);\n\n/** @type {Timestamp} */\nTimestamp.MAX_VALUE =\n Timestamp.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0);\n\n/** @type {Timestamp} */\nTimestamp.MIN_VALUE = Timestamp.fromBits(0, 0x80000000 | 0);\n\n/**\n * @type {Timestamp}\n * @ignore\n */\nTimestamp.TWO_PWR_24_ = Timestamp.fromInt(1 << 24);\n\n/**\n * Expose.\n */\nmodule.exports = Timestamp;\nmodule.exports.Timestamp = Timestamp;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/timestamp.js","export const USER_AUTH_KEY = '_stitch_ua';\nexport const REFRESH_TOKEN_KEY = '_stitch_rt';\nexport const DEVICE_ID_KEY = '_stitch_did';\nexport const STATE_KEY = '_stitch_state';\nexport const IMPERSONATION_ACTIVE_KEY = '_stitch_impers_active';\nexport const IMPERSONATION_USER_KEY = '_stitch_impers_user';\nexport const IMPERSONATION_REAL_USER_AUTH_KEY = '_stitch_impers_real_ua';\nexport const USER_AUTH_COOKIE_NAME = 'stitch_ua';\nexport const STITCH_ERROR_KEY = '_stitch_error';\nexport const STITCH_LINK_KEY = '_stitch_link';\nexport const DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS = 10;\n\nexport const APP_CLIENT_CODEC = {\n 'accessToken': 'access_token',\n 'refreshToken': 'refresh_token',\n 'deviceId': 'device_id',\n 'userId': 'user_id'\n};\n\nexport const ADMIN_CLIENT_CODEC = {\n 'accessToken': 'access_token',\n 'refreshToken': 'refresh_token',\n 'deviceId': 'device_id',\n 'userId': 'user_id'\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/auth/common.js","export const JSONTYPE = 'application/json';\nexport const APP_CLIENT_TYPE = 'app';\nexport const ADMIN_CLIENT_TYPE = 'admin';\nexport const DEFAULT_STITCH_SERVER_URL = 'https://stitch.mongodb.com';\n\n// VERSION is substituted with the package.json version number at build time\nlet version = 'unknown';\nif (typeof VERSION !== 'undefined') {\n version = VERSION;\n}\nexport const SDK_VERSION = version;\n\nexport const checkStatus = (response) => {\n if (response.status >= 200 && response.status < 300) {\n return response;\n }\n\n let error = new Error(response.statusText);\n error.response = response;\n\n // set error to statusText by default; this will be overwritten when (and if)\n // the response is successfully parsed into json below\n error.error = response.statusText;\n\n return response.json()\n .catch(() => Promise.reject(error))\n .then(json => Promise.reject(Object.assign(error, json)));\n};\n\nexport const makeFetchArgs = (method, body) => {\n const init = {\n method: method,\n headers: { 'Accept': JSONTYPE, 'Content-Type': JSONTYPE }\n };\n\n if (body) {\n init.body = body;\n }\n\n init.cors = true;\n return init;\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/common.js","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 17\n// module chunks = 0","var Int32 = function(value) {\n if(!(this instanceof Int32)) return new Int32(value);\n\n this._bsontype = 'Int32';\n this.value = value;\n}\n\n/**\n * Access the number value.\n *\n * @method\n * @return {number} returns the wrapped int32 number.\n */\nInt32.prototype.valueOf = function() {\n return this.value;\n};\n\n/**\n * @ignore\n */\nInt32.prototype.toJSON = function() {\n return this.value;\n}\n\nmodule.exports = Int32;\nmodule.exports.Int32 = Int32;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/int_32.js","/* global window, fetch */\n/* eslint no-labels: ['error', { 'allowLoop': true }] */\nimport 'fetch-everywhere';\nimport Auth from './auth';\nimport { APP_CLIENT_CODEC } from './auth/common';\nimport ServiceRegistry from './services';\nimport * as common from './common';\nimport ExtJSON from 'mongodb-extjson';\nimport queryString from 'query-string';\nimport { deprecate } from './util';\nimport {\n StitchError,\n ErrInvalidSession,\n ErrUnauthorized\n} from './errors';\n\nconst v1 = 1;\nconst v2 = 2;\nconst v3 = 3;\nconst API_TYPE_PUBLIC = 'public';\nconst API_TYPE_PRIVATE = 'private';\nconst API_TYPE_CLIENT = 'client';\nconst API_TYPE_APP = 'app';\n\n/**\n * Create a new StitchClient instance.\n *\n * @class\n * @return {StitchClient} a StitchClient instance.\n */\nexport default class StitchClient {\n constructor(clientAppID, options) {\n let baseUrl = common.DEFAULT_STITCH_SERVER_URL;\n if (options && options.baseUrl) {\n baseUrl = options.baseUrl;\n }\n\n this.clientAppID = clientAppID;\n\n this.authUrl = (\n clientAppID ?\n `${baseUrl}/api/client/v2.0/app/${clientAppID}/auth` :\n `${baseUrl}/api/admin/v3.0/auth`\n );\n\n this.rootURLsByAPIVersion = {\n [v1]: {\n [API_TYPE_PUBLIC]: `${baseUrl}/api/public/v1.0`,\n [API_TYPE_CLIENT]: `${baseUrl}/api/client/v1.0`,\n [API_TYPE_PRIVATE]: `${baseUrl}/api/private/v1.0`,\n [API_TYPE_APP]: (clientAppID ?\n `${baseUrl}/api/client/v1.0/app/${clientAppID}` :\n `${baseUrl}/api/public/v1.0`)\n },\n [v2]: {\n [API_TYPE_PUBLIC]: `${baseUrl}/api/public/v2.0`,\n [API_TYPE_CLIENT]: `${baseUrl}/api/client/v2.0`,\n [API_TYPE_PRIVATE]: `${baseUrl}/api/private/v2.0`,\n [API_TYPE_APP]: (clientAppID ?\n `${baseUrl}/api/client/v2.0/app/${clientAppID}` :\n `${baseUrl}/api/public/v2.0`)\n },\n [v3]: {\n [API_TYPE_PUBLIC]: `${baseUrl}/api/public/v3.0`,\n [API_TYPE_CLIENT]: `${baseUrl}/api/client/v3.0`,\n [API_TYPE_APP]: (clientAppID ?\n `${baseUrl}/api/client/v3.0/app/${clientAppID}` :\n `${baseUrl}/api/admin/v3.0`)\n }\n };\n\n const authOptions = {codec: APP_CLIENT_CODEC};\n if (options && options.authCodec) {\n authOptions.codec = options.authCodec;\n }\n this.auth = new Auth(this, this.authUrl, authOptions);\n this.auth.handleRedirect();\n this.auth.handleCookie();\n\n // deprecated API\n this.authManager = {\n apiKeyAuth: (key) => this.authenticate('apiKey', key),\n localAuth: (email, password) => this.login(email, password),\n mongodbCloudAuth: (username, apiKey, opts) =>\n this.authenticate('mongodbCloud', Object.assign({ username, apiKey }, opts))\n };\n\n this.authManager.apiKeyAuth =\n deprecate(this.authManager.apiKeyAuth, 'use `client.authenticate(\"apiKey\", \"key\")` instead of `client.authManager.apiKey`');\n this.authManager.localAuth =\n deprecate(this.authManager.localAuth, 'use `client.login` instead of `client.authManager.localAuth`');\n this.authManager.mongodbCloudAuth =\n deprecate(this.authManager.mongodbCloudAuth, 'use `client.authenticate(\"mongodbCloud\", opts)` instead of `client.authManager.mongodbCloudAuth`');\n }\n\n get type() {\n return common.APP_CLIENT_TYPE;\n }\n\n /**\n * Login to stitch instance, optionally providing a username and password. In\n * the event that these are omitted, anonymous authentication is used.\n *\n * @param {String} [email] the email address used for login\n * @param {String} [password] the password for the provided email address\n * @param {Object} [options] additional authentication options\n * @returns {Promise}\n */\n login(email, password, options = {}) {\n if (email === undefined || password === undefined) {\n return this.authenticate('anon', options);\n }\n\n return this.authenticate('userpass', Object.assign({ username: email, password }, options));\n }\n\n /**\n * Send a request to the server indicating the provided email would like\n * to sign up for an account. This will trigger a confirmation email containing\n * a token which must be used with the `emailConfirm` method of the `userpass`\n * auth provider in order to complete registration. The user will not be able\n * to log in until that flow has been completed.\n *\n * @param {String} email the email used to sign up for the app\n * @param {String} password the password used to sign up for the app\n * @param {Object} [options] additional authentication options\n * @returns {Promise}\n */\n register(email, password, options = {}) {\n return this.auth.provider('userpass').register(email, password, options);\n }\n\n /**\n * Submits an authentication request to the specified provider providing any\n * included options (read: user data). If auth data already exists and the\n * existing auth data has an access token, then these credentials are returned.\n *\n * @param {String} providerType the provider used for authentication (e.g. 'userpass', 'facebook', 'google')\n * @param {Object} [options] additional authentication options\n * @returns {Promise} which resolves to a String value: the authed userId\n */\n authenticate(providerType, options = {}) {\n // reuse existing auth if present\n if (this.auth.getAccessToken()) {\n return Promise.resolve(this.auth.authedId());\n }\n\n return this.auth.provider(providerType).authenticate(options)\n .then(() => this.auth.authedId());\n }\n\n /**\n * Ends the session for the current user.\n *\n * @returns {Promise}\n */\n logout() {\n return this._do(\n '/auth/session',\n 'DELETE',\n {\n refreshOnFailure: false,\n useRefreshToken: true,\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT]\n }\n ).then(() => this.auth.clear());\n }\n\n /**\n * @return {*} Returns any error from the Stitch authentication system.\n */\n authError() {\n return this.auth.error();\n }\n\n /**\n * Returns profile information for the currently logged in user\n *\n * @returns {Promise}\n */\n userProfile() {\n return this._do(\n '/auth/profile',\n 'GET',\n {rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT]},\n )\n .then(response => response.json());\n }\n /**\n * @return {String} Returns the currently authed user's ID.\n */\n authedId() {\n return this.auth.authedId();\n }\n\n /**\n * Factory method for accessing Stitch services.\n *\n * @method\n * @param {String} type The service type [mongodb, {String}]\n * @param {String} name The service name.\n * @return {Object} returns a named service.\n */\n service(type, name) {\n if (this.constructor !== StitchClient) {\n throw new StitchError('`service` is a factory method, do not use `new`');\n }\n\n if (!ServiceRegistry.hasOwnProperty(type)) {\n throw new StitchError('Invalid service type specified: ' + type);\n }\n\n const ServiceType = ServiceRegistry[type];\n return new ServiceType(this, name);\n }\n\n /**\n * Executes a function.\n *\n * @param {String} name The name of the function.\n * @param {...*} args Arguments to pass to the function.\n */\n executeFunction(name, ...args) {\n return this._doFunctionCall({\n name,\n arguments: args\n });\n }\n\n /**\n * Executes a service function.\n *\n * @param {String} service The name of the service.\n * @param {String} action The name of the service action.\n * @param {...*} args Arguments to pass to the service action.\n */\n executeServiceFunction(service, action, ...args) {\n return this._doFunctionCall({\n service,\n name: action,\n arguments: args\n });\n }\n\n _doFunctionCall(request) {\n let responseDecoder = (d) => ExtJSON.parse(d, { strict: false });\n let responseEncoder = (d) => ExtJSON.stringify(d);\n\n return this._do('/functions/call', 'POST', { body: responseEncoder(request) })\n .then(response => response.text())\n .then(body => responseDecoder(body));\n }\n\n /**\n * Returns an access token for the user\n *\n * @returns {Promise}\n */\n doSessionPost() {\n return this._do(\n '/auth/session',\n 'POST',\n {\n refreshOnFailure: false,\n useRefreshToken: true,\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT]\n }\n )\n .then(response => response.json());\n }\n\n _do(resource, method, options) {\n options = Object.assign({}, {\n refreshOnFailure: true,\n useRefreshToken: false,\n apiVersion: v2,\n apiType: API_TYPE_APP,\n rootURL: undefined\n }, options);\n\n if (!options.noAuth) {\n if (!this.authedId()) {\n return Promise.reject(new StitchError('Must auth first', ErrUnauthorized));\n }\n\n // If access token is expired, proactively get a new one\n if (!options.useRefreshToken && this.auth.isAccessTokenExpired()) {\n return this.auth.refreshToken().then(() => {\n options.refreshOnFailure = false;\n return this._do(resource, method, options);\n });\n }\n }\n\n const appURL = this.rootURLsByAPIVersion[options.apiVersion][options.apiType];\n let url = `${appURL}${resource}`;\n if (options.rootURL) {\n url = `${options.rootURL}${resource}`;\n }\n let fetchArgs = common.makeFetchArgs(method, options.body);\n\n if (!!options.headers) {\n Object.assign(fetchArgs.headers, options.headers);\n }\n\n if (!options.noAuth) {\n let token =\n options.useRefreshToken ? this.auth.getRefreshToken() : this.auth.getAccessToken();\n fetchArgs.headers.Authorization = `Bearer ${token}`;\n }\n\n if (options.queryParams) {\n url = `${url}?${queryString.stringify(options.queryParams)}`;\n }\n\n return fetch(url, fetchArgs)\n .then((response) => {\n // Okay: passthrough\n if (response.status >= 200 && response.status < 300) {\n return Promise.resolve(response);\n }\n\n if (response.headers.get('Content-Type') === common.JSONTYPE) {\n return response.json()\n .then((json) => {\n // Only want to try refreshing token when there's an invalid session\n if ('error_code' in json && json.error_code === ErrInvalidSession) {\n if (!options.refreshOnFailure) {\n this.auth.clear();\n const error = new StitchError(json.error, json.error_code);\n error.response = response;\n error.json = json;\n throw error;\n }\n\n return this.auth.refreshToken()\n .then(() => {\n options.refreshOnFailure = false;\n return this._do(resource, method, options);\n });\n }\n\n const error = new StitchError(json.error, json.error_code);\n error.response = response;\n error.json = json;\n return Promise.reject(error);\n });\n }\n\n const error = new Error(response.statusText);\n error.response = response;\n return Promise.reject(error);\n });\n }\n\n // Deprecated API\n authWithOAuth(providerType, redirectUrl) {\n return this.auth.provider(providerType).authenticate({ redirectUrl });\n }\n\n anonymousAuth() {\n return this.authenticate('anon');\n }\n}\n\nStitchClient.prototype.authWithOAuth =\n deprecate(StitchClient.prototype.authWithOAuth, 'use `authenticate` instead of `authWithOAuth`');\nStitchClient.prototype.anonymousAuth =\n deprecate(StitchClient.prototype.anonymousAuth, 'use `login()` instead of `anonymousAuth`');\n\n\n\n// WEBPACK FOOTER //\n// ./src/client.js","\"use strict\"\n\n// We have an ES6 Map available, return the native instance\nif(typeof global.Map !== 'undefined') {\n module.exports = global.Map;\n module.exports.Map = global.Map;\n} else {\n // We will return a polyfill\n var Map = function(array) {\n this._keys = [];\n this._values = {};\n\n for(var i = 0; i < array.length; i++) {\n if(array[i] == null) continue; // skip null and undefined\n var entry = array[i];\n var key = entry[0];\n var value = entry[1];\n // Add the key to the list of keys in order\n this._keys.push(key);\n // Add the key and value to the values dictionary with a point\n // to the location in the ordered keys list\n this._values[key] = {v: value, i: this._keys.length - 1};\n }\n }\n\n Map.prototype.clear = function() {\n this._keys = [];\n this._values = {};\n }\n\n Map.prototype.delete = function(key) {\n var value = this._values[key];\n if(value == null) return false;\n // Delete entry\n delete this._values[key];\n // Remove the key from the ordered keys list\n this._keys.splice(value.i, 1);\n return true;\n }\n\n Map.prototype.entries = function() {\n var self = this;\n var index = 0;\n\n return {\n next: function() {\n var key = self._keys[index++];\n return {\n value: key !== undefined ? [key, self._values[key].v] : undefined,\n done: key !== undefined ? false : true\n }\n }\n };\n }\n\n Map.prototype.forEach = function(callback, self) {\n self = self || this;\n\n for(var i = 0; i < this._keys.length; i++) {\n var key = this._keys[i];\n // Call the forEach callback\n callback.call(self, this._values[key].v, key, self);\n }\n }\n\n Map.prototype.get = function(key) {\n return this._values[key] ? this._values[key].v : undefined;\n }\n\n Map.prototype.has = function(key) {\n return this._values[key] != null;\n }\n\n Map.prototype.keys = function(key) {\n var self = this;\n var index = 0;\n\n return {\n next: function() {\n var key = self._keys[index++];\n return {\n value: key !== undefined ? key : undefined,\n done: key !== undefined ? false : true\n }\n }\n };\n }\n\n Map.prototype.set = function(key, value) {\n if(this._values[key]) {\n this._values[key].v = value;\n return this;\n }\n\n // Add the key to the list of keys in order\n this._keys.push(key);\n // Add the key and value to the values dictionary with a point\n // to the location in the ordered keys list\n this._values[key] = {v: value, i: this._keys.length - 1};\n return this;\n }\n\n Map.prototype.values = function(key, value) {\n var self = this;\n var index = 0;\n\n return {\n next: function() {\n var key = self._keys[index++];\n return {\n value: key !== undefined ? self._values[key].v : undefined,\n done: key !== undefined ? false : true\n }\n }\n };\n }\n\n // Last ismaster\n Object.defineProperty(Map.prototype, 'size', {\n enumerable:true,\n get: function() { return this._keys.length; }\n });\n\n module.exports = Map;\n module.exports.Map = Map;\n}\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/map.js","/**\n * Creates a new StitchError\n *\n * @class\n * @augments Error\n * @param {String} message The error message.\n * @param {Object} code The error code.\n * @return {StitchError} A StitchError instance.\n */\nclass StitchError extends Error {\n constructor(message, code) {\n super(message);\n this.name = 'StitchError';\n this.message = message;\n if (code !== undefined) {\n this.code = code;\n }\n\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(this, this.constructor);\n } else {\n this.stack = (new Error(message)).stack;\n }\n }\n}\n\nconst ErrAuthProviderNotFound = 'AuthProviderNotFound';\nconst ErrInvalidSession = 'InvalidSession';\nconst ErrUnauthorized = 'Unauthorized';\n\n\nexport {\n StitchError,\n ErrAuthProviderNotFound,\n ErrInvalidSession,\n ErrUnauthorized\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/errors.js","// the whatwg-fetch polyfill installs the fetch() function\n// on the global object (window or self)\n//\n// Return that as the export for use in Webpack, Browserify etc.\nrequire('whatwg-fetch');\nvar globalObj = typeof self !== 'undefined' && self || this;\nmodule.exports = globalObj.fetch.bind(globalObj);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/fetch-everywhere/fetch-npm-browserify.js\n// module id = 22\n// module chunks = 0","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/process/browser.js\n// module id = 23\n// module chunks = 0","/* global window, fetch */\n/* eslint no-labels: ['error', { 'allowLoop': true }] */\nimport 'fetch-everywhere';\nimport StitchClient from './client';\nimport ADMIN_CLIENT_TYPE from './common';\nimport { ADMIN_CLIENT_CODEC } from './auth/common';\n\nconst v2 = 2;\nconst v3 = 3;\n\nexport default class Admin extends StitchClient {\n constructor(baseUrl) {\n super('', {baseUrl, authCodec: ADMIN_CLIENT_CODEC});\n }\n\n get type() {\n return ADMIN_CLIENT_TYPE;\n }\n\n get _v3() {\n const v3do = (url, method, options) =>\n super._do(\n url,\n method,\n Object.assign({}, { apiVersion: v3 }, options)\n ).then(response => {\n const contentHeader = response.headers.get('content-type') || '';\n if (contentHeader.split(',').indexOf('application/json') >= 0) {\n return response.json();\n }\n return response;\n });\n\n return {\n _get: (url, queryParams) => v3do(url, 'GET', {queryParams}),\n _put: (url, data) =>\n (data ?\n v3do(url, 'PUT', {body: JSON.stringify(data)}) :\n v3do(url, 'PUT')),\n _patch: (url, data) =>\n (data ?\n v3do(url, 'PATCH', {body: JSON.stringify(data)}) :\n v3do(url, 'PATCH')),\n _delete: (url) => v3do(url, 'DELETE'),\n _post: (url, body, queryParams) =>\n (queryParams ?\n v3do(url, 'POST', { body: JSON.stringify(body), queryParams }) :\n v3do(url, 'POST', { body: JSON.stringify(body) }))\n };\n }\n\n get _v2() {\n const v2do = (url, method, options) =>\n super._do(\n url,\n method,\n Object.assign({}, { apiVersion: v2 }, options)\n ).then(response => {\n const contentHeader = response.headers.get('content-type') || '';\n if (contentHeader.split(',').indexOf('application/json') >= 0) {\n return response.json();\n }\n return response;\n });\n\n return {\n _get: (url, queryParams) => v2do(url, 'GET', {queryParams}),\n _put: (url, data) =>\n (data ?\n v2do(url, 'PUT', {body: JSON.stringify(data)}) :\n v2do(url, 'PUT')),\n _patch: (url, data) =>\n (data ?\n v2do(url, 'PATCH', {body: JSON.stringify(data)}) :\n v2do(url, 'PATCH')),\n _delete: (url) => v2do(url, 'DELETE'),\n _post: (url, body, queryParams) =>\n (queryParams ?\n v2do(url, 'POST', { body: JSON.stringify(body), queryParams }) :\n v2do(url, 'POST', { body: JSON.stringify(body) }))\n };\n }\n\n /**\n * Ends the session for the current user.\n *\n * @returns {Promise}\n */\n logout() {\n return super._do('/auth/session', 'DELETE', { refreshOnFailure: false, useRefreshToken: true, apiVersion: v3 })\n .then(() => this.auth.clear());\n }\n\n /**\n * Returns profile information for the currently logged in user\n *\n * @returns {Promise}\n */\n userProfile() {\n return this._v3._get('/auth/profile');\n }\n\n /**\n * Returns available providers for the currently logged in admin\n *\n * @returns {Promise}\n */\n getAuthProviders() {\n return super._do('/auth/providers', 'GET', { noAuth: true, apiVersion: v3 })\n .then(response => response.json());\n }\n\n /**\n * Returns an access token for the user\n *\n * @returns {Promise}\n */\n doSessionPost() {\n return super._do('/auth/session', 'POST', { refreshOnFailure: false, useRefreshToken: true, apiVersion: v3 })\n .then(response => response.json());\n }\n\n /* Examples of how to access admin API with this client:\n *\n * List all apps\n * a.apps('580e6d055b199c221fcb821c').list()\n *\n * Fetch app under name 'planner'\n * a.apps('580e6d055b199c221fcb821c').app('planner').get()\n *\n * List services under the app 'planner'\n * a.apps('580e6d055b199c221fcb821c').app('planner').services().list()\n *\n * Delete a rule by ID\n * a.apps('580e6d055b199c221fcb821c').app('planner').services().service('mdb1').rules().rule('580e6d055b199c221fcb821d').remove()\n *\n */\n apps(groupId) {\n const api = this._v3;\n const groupUrl = `/groups/${groupId}/apps`;\n return {\n list: () => api._get(groupUrl),\n create: (data, options) => {\n let query = (options && options.defaults) ? '?defaults=true' : '';\n return api._post(groupUrl + query, data);\n },\n\n app: (appId) => {\n const appUrl = `${groupUrl}/${appId}`;\n return {\n get: () => api._get(appUrl),\n remove: () => api._delete(appUrl),\n\n values: () => ({\n list: () => api._get(`${appUrl}/values`),\n create: (data) => api._post( `${appUrl}/values`, data),\n value: (valueId) => {\n const valueUrl = `${appUrl}/values/${valueId}`;\n return {\n get: ()=> api._get(valueUrl),\n remove: ()=> api._delete(valueUrl),\n update: (data) => api._put(valueUrl, data)\n };\n }\n }),\n\n services: () => ({\n list: () => api._get(`${appUrl}/services`),\n create: (data) => api._post(`${appUrl}/services`, data),\n service: (serviceId) => ({\n get: () => api._get(`${appUrl}/services/${serviceId}`),\n remove: () => api._delete(`${appUrl}/services/${serviceId}`),\n runCommand: (commandName, data) => api._post(`${appUrl}/services/${serviceId}/commands/${commandName}`, data),\n config: ()=> ({\n get: () => api._get(`${appUrl}/services/${serviceId}/config`),\n update: (data) => api._patch(`${appUrl}/services/${serviceId}/config`, data)\n }),\n\n rules: () => ({\n list: () => api._get(`${appUrl}/services/${serviceId}/rules`),\n create: (data) => api._post(`${appUrl}/services/${serviceId}/rules`, data),\n rule: (ruleId) => {\n const ruleUrl = `${appUrl}/services/${serviceId}/rules/${ruleId}`;\n return {\n get: () => api._get(ruleUrl),\n update: (data) => api._put(ruleUrl, data),\n remove: () => api._delete(ruleUrl)\n };\n }\n }),\n\n incomingWebhooks: () => ({\n list: () => api._get(`${appUrl}/services/${serviceId}/incoming_webhooks`),\n create: (data) => api._post(`${appUrl}/services/${serviceId}/incoming_webhooks`, data),\n incomingWebhook: (incomingWebhookId) => {\n const webhookUrl = `${appUrl}/services/${serviceId}/incoming_webhooks/${incomingWebhookId}`;\n return {\n get: () => api._get(webhookUrl),\n update: (data) => api._put(webhookUrl, data),\n remove: () => api._delete(webhookUrl)\n };\n }\n })\n })\n }),\n\n pushNotifications: () => ({\n list: (filter) => api._get(`${appUrl}/push/notifications`, filter),\n create: (data) => api._post(`${appUrl}/push/notifications`, data),\n pushNotification: (messageId) => ({\n get: () => api._get(`${appUrl}/push/notifications/${messageId}`),\n update: (data) => api._put(`${appUrl}/push/notifications/${messageId}`, data),\n remove: () => api._delete(`${appUrl}/push/notifications/${messageId}`),\n send: () => api._post(`${appUrl}/push/notifications/${messageId}/send`)\n })\n }),\n\n users: () => ({\n list: (filter) => api._get(`${appUrl}/users`, filter),\n create: (user) => api._post(`${appUrl}/users`, user),\n user: (uid) => ({\n get: () => api._get(`${appUrl}/users/${uid}`),\n logout: () => api._put(`${appUrl}/users/${uid}/logout`),\n remove: () => api._delete(`${appUrl}/users/${uid}`)\n })\n }),\n\n debug: () => ({\n executeFunction: (userId, name = '', ...args) => {\n return api._post(\n `${appUrl}/debug/execute_function`,\n {name, 'arguments': args},\n { user_id: userId });\n },\n executeFunctionSource: (userId, source = '', evalSource = '') => {\n return api._post(\n `${appUrl}/debug/execute_function_source`,\n {source, 'eval_source': evalSource},\n { user_id: userId });\n }\n }),\n\n authProviders: () => ({\n list: () => api._get(`${appUrl}/auth_providers`),\n create: (data) => api._post(`${appUrl}/auth_providers`, data),\n authProvider: (providerId) => ({\n get: () => api._get(`${appUrl}/auth_providers/${providerId}`),\n update: (data) => api._patch(`${appUrl}/auth_providers/${providerId}`, data),\n enable: () => api._put(`${appUrl}/auth_providers/${providerId}/enable`),\n disable: () => api._put(`${appUrl}/auth_providers/${providerId}/disable`),\n remove: () => api._delete(`${appUrl}/auth_providers/${providerId}`)\n })\n }),\n\n security: () => ({\n allowedRequestOrigins: () => ({\n get: () => api._get(`${appUrl}/security/allowed_request_origins`),\n update: (data) => api._post(`${appUrl}/security/allowed_request_origins`, data)\n })\n }),\n\n logs: () => ({\n list: (filter) => api._get(`${appUrl}/logs`, filter)\n }),\n\n apiKeys: () => ({\n list: () => api._get(`${appUrl}/api_keys`),\n create: (data) => api._post(`${appUrl}/api_keys`, data),\n apiKey: (apiKeyId) => ({\n get: () => api._get(`${appUrl}/api_keys/${apiKeyId}`),\n remove: () => api._delete(`${appUrl}/api_keys/${apiKeyId}`),\n enable: () => api._put(`${appUrl}/api_keys/${apiKeyId}/enable`),\n disable: () => api._put(`${appUrl}/api_keys/${apiKeyId}/disable`)\n })\n }),\n\n functions: () => ({\n list: () => api._get(`${appUrl}/functions`),\n create: (data) => api._post(`${appUrl}/functions`, data),\n function: (functionId) => ({\n get: () => api._get(`${appUrl}/functions/${functionId}`),\n update: (data) => api._put(`${appUrl}/functions/${functionId}`, data),\n remove: () => api._delete(`${appUrl}/functions/${functionId}`)\n })\n })\n };\n }\n };\n }\n\n v2() {\n const api = this._v2;\n return {\n\n apps: (groupId) => {\n const groupUrl = `/groups/${groupId}/apps`;\n return {\n list: () => api._get(groupUrl),\n create: (data, options) => {\n let query = (options && options.defaults) ? '?defaults=true' : '';\n return api._post(groupUrl + query, data);\n },\n\n app: (appId) => {\n const appUrl = `${groupUrl}/${appId}`;\n return {\n get: () => api._get(appUrl),\n remove: () => api._delete(appUrl),\n\n pipelines: () => ({\n list: () => api._get(`${appUrl}/pipelines`),\n create: (data) => api._post( `${appUrl}/pipelines`, data),\n pipeline: (pipelineId) => {\n const pipelineUrl = `${appUrl}/pipelines/${pipelineId}`;\n return {\n get: ()=> api._get(pipelineUrl),\n remove: ()=> api._delete(pipelineUrl),\n update: (data) => api._put(pipelineUrl, data)\n };\n }\n }),\n\n values: () => ({\n list: () => api._get(`${appUrl}/values`),\n create: (data) => api._post( `${appUrl}/values`, data),\n value: (valueId) => {\n const valueUrl = `${appUrl}/values/${valueId}`;\n return {\n get: ()=> api._get(valueUrl),\n remove: ()=> api._delete(valueUrl),\n update: (data) => api._put(valueUrl, data)\n };\n }\n }),\n\n services: () => ({\n list: () => api._get(`${appUrl}/services`),\n create: (data) => api._post(`${appUrl}/services`, data),\n service: (serviceId) => ({\n get: () => api._get(`${appUrl}/services/${serviceId}`),\n remove: () => api._delete(`${appUrl}/services/${serviceId}`),\n runCommand: (commandName, data) => api._post(`${appUrl}/services/${serviceId}/commands/${commandName}`, data),\n config: ()=> ({\n get: () => api._get(`${appUrl}/services/${serviceId}/config`),\n update: (data) => api._patch(`${appUrl}/services/${serviceId}/config`, data)\n }),\n\n rules: () => ({\n list: () => api._get(`${appUrl}/services/${serviceId}/rules`),\n create: (data) => api._post(`${appUrl}/services/${serviceId}/rules`, data),\n rule: (ruleId) => {\n const ruleUrl = `${appUrl}/services/${serviceId}/rules/${ruleId}`;\n return {\n get: () => api._get(ruleUrl),\n update: (data) => api._put(ruleUrl, data),\n remove: () => api._delete(ruleUrl)\n };\n }\n }),\n\n incomingWebhooks: () => ({\n list: () => api._get(`${appUrl}/services/${serviceId}/incoming_webhooks`),\n create: (data) => api._post(`${appUrl}/services/${serviceId}/incoming_webhooks`, data),\n incomingWebhook: (incomingWebhookId) => {\n const webhookUrl = `${appUrl}/services/${serviceId}/incoming_webhooks/${incomingWebhookId}`;\n return {\n get: () => api._get(webhookUrl),\n update: (data) => api._put(webhookUrl, data),\n remove: () => api._delete(webhookUrl)\n };\n }\n })\n\n })\n }),\n\n pushNotifications: () => ({\n list: (filter) => api._get(`${appUrl}/push/notifications`, filter),\n create: (data) => api._post(`${appUrl}/push/notifications`, data),\n pushNotification: (messageId) => ({\n get: () => api._get(`${appUrl}/push/notifications/${messageId}`),\n update: (data) => api._put(`${appUrl}/push/notifications/${messageId}`, data),\n setType: (type) => api._put(`${appUrl}/push/notifications/${messageId}/type`, { type }),\n remove: () => api._delete(`${appUrl}/push/notifications/${messageId}`)\n })\n }),\n\n users: () => ({\n list: (filter) => api._get(`${appUrl}/users`, filter),\n create: (user) => api._post(`${appUrl}/users`, user),\n user: (uid) => ({\n get: () => api._get(`${appUrl}/users/${uid}`),\n logout: () => api._put(`${appUrl}/users/${uid}/logout`),\n remove: () => api._delete(`${appUrl}/users/${uid}`)\n })\n }),\n\n dev: () => ({\n executePipeline: (body, userId, options) => {\n return api._post(\n `${appUrl}/dev/pipeline`,\n body,\n Object.assign({}, options, { user_id: userId }));\n }\n }),\n\n authProviders: () => ({\n list: () => api._get(`${appUrl}/auth_providers`),\n create: (data) => api._post(`${appUrl}/auth_providers`, data),\n authProvider: (providerId) => ({\n get: () => api._get(`${appUrl}/auth_providers/${providerId}`),\n update: (data) => api._patch(`${appUrl}/auth_providers/${providerId}`, data),\n enable: () => api._put(`${appUrl}/auth_providers/${providerId}/enable`),\n disable: () => api._put(`${appUrl}/auth_providers/${providerId}/disable`),\n remove: () => api._delete(`${appUrl}/auth_providers/${providerId}`)\n })\n }),\n\n security: () => ({\n allowedRequestOrigins: () => ({\n get: () => api._get(`${appUrl}/security/allowed_request_origins`),\n update: (data) => api._post(`${appUrl}/security/allowed_request_origins`, data)\n })\n }),\n\n logs: () => ({\n list: (filter) => api._get(`${appUrl}/logs`, filter)\n }),\n\n apiKeys: () => ({\n list: () => api._get(`${appUrl}/api_keys`),\n create: (data) => api._post(`${appUrl}/api_keys`, data),\n apiKey: (apiKeyId) => ({\n get: () => api._get(`${appUrl}/api_keys/${apiKeyId}`),\n remove: () => api._delete(`${appUrl}/api_keys/${apiKeyId}`),\n enable: () => api._put(`${appUrl}/api_keys/${apiKeyId}/enable`),\n disable: () => api._put(`${appUrl}/api_keys/${apiKeyId}/disable`)\n })\n })\n };\n }\n };\n }\n };\n }\n\n _admin() {\n return {\n logs: () => ({\n get: (filter) => super._do('/admin/logs', 'GET', { useRefreshToken: true, queryParams: filter })\n }),\n users: () => ({\n list: (filter) => super._do('/admin/users', 'GET', { useRefreshToken: true, queryParams: filter }),\n user: (uid) => ({\n logout: () => super._do(`/admin/users/${uid}/logout`, 'PUT', { useRefreshToken: true })\n })\n })\n };\n }\n\n _isImpersonatingUser() {\n return this.auth.isImpersonatingUser();\n }\n\n _startImpersonation(userId) {\n return this.auth.startImpersonation(this, userId);\n }\n\n _stopImpersonation() {\n return this.auth.stopImpersonation();\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/admin.js",";(function () {\n\n var object =\n typeof exports != 'undefined' ? exports :\n typeof self != 'undefined' ? self : // #8: web workers\n $.global; // #31: ExtendScript\n\n var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n function InvalidCharacterError(message) {\n this.message = message;\n }\n InvalidCharacterError.prototype = new Error;\n InvalidCharacterError.prototype.name = 'InvalidCharacterError';\n\n // encoder\n // [https://gist.github.com/999166] by [https://github.com/nignag]\n object.btoa || (\n object.btoa = function (input) {\n var str = String(input);\n for (\n // initialize result and counter\n var block, charCode, idx = 0, map = chars, output = '';\n // if the next str index does not exist:\n // change the mapping table to \"=\"\n // check if d has no fractional digits\n str.charAt(idx | 0) || (map = '=', idx % 1);\n // \"8 - idx % 1 * 8\" generates the sequence 2, 4, 6, 8\n output += map.charAt(63 & block >> 8 - idx % 1 * 8)\n ) {\n charCode = str.charCodeAt(idx += 3/4);\n if (charCode > 0xFF) {\n throw new InvalidCharacterError(\"'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.\");\n }\n block = block << 8 | charCode;\n }\n return output;\n });\n\n // decoder\n // [https://gist.github.com/1020396] by [https://github.com/atk]\n object.atob || (\n object.atob = function (input) {\n var str = String(input).replace(/[=]+$/, ''); // #31: ExtendScript bad parse of /=\n if (str.length % 4 == 1) {\n throw new InvalidCharacterError(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = '';\n // get next character\n buffer = str.charAt(idx++);\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n return output;\n });\n\n}());\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/Base64/base64.js\n// module id = 25\n// module chunks = 0","\"use strict\"\n\nvar writeIEEE754 = require('./float_parser').writeIEEE754,\n\treadIEEE754 = require('./float_parser').readIEEE754,\n Map = require('./map'),\n\tLong = require('./long'),\n Double = require('./double'),\n Timestamp = require('./timestamp'),\n ObjectID = require('./objectid'),\n BSONRegExp = require('./regexp'),\n Symbol = require('./symbol'),\n\tInt32 = require('./int_32'),\n Code = require('./code'),\n\tDecimal128 = require('./decimal128'),\n MinKey = require('./min_key'),\n MaxKey = require('./max_key'),\n DBRef = require('./db_ref'),\n Binary = require('./binary');\n\n// Parts of the parser\nvar deserialize = require('./parser/deserializer'),\n\tserializer = require('./parser/serializer'),\n\tcalculateObjectSize = require('./parser/calculate_size');\n\n/**\n * @ignore\n * @api private\n */\n// Max Size\nvar MAXSIZE = (1024*1024*17);\n// Max Document Buffer size\nvar buffer = new Buffer(MAXSIZE);\n\nvar BSON = function() {\n}\n\n/**\n * Serialize a Javascript object.\n *\n * @param {Object} object the Javascript object to serialize.\n * @param {Boolean} [options.checkKeys] the serializer will check if keys are valid.\n * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**.\n * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**.\n * @return {Buffer} returns the Buffer object containing the serialized object.\n * @api public\n */\nBSON.prototype.serialize = function serialize(object, options) {\n\toptions = options || {};\n\t// Unpack the options\n\tvar checkKeys = typeof options.checkKeys == 'boolean'\n\t\t? options.checkKeys : false;\n\tvar serializeFunctions = typeof options.serializeFunctions == 'boolean'\n\t\t? options.serializeFunctions : false;\n\tvar ignoreUndefined = typeof options.ignoreUndefined == 'boolean'\n\t\t? options.ignoreUndefined : true;\n\n\t// Attempt to serialize\n\tvar serializationIndex = serializer(buffer, object, checkKeys, 0, 0, serializeFunctions, ignoreUndefined, []);\n\t// Create the final buffer\n\tvar finishedBuffer = new Buffer(serializationIndex);\n\t// Copy into the finished buffer\n\tbuffer.copy(finishedBuffer, 0, 0, finishedBuffer.length);\n\t// Return the buffer\n\treturn finishedBuffer;\n}\n\n/**\n * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization.\n *\n * @param {Object} object the Javascript object to serialize.\n * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object.\n * @param {Boolean} [options.checkKeys] the serializer will check if keys are valid.\n * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**.\n * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**.\n * @param {Number} [options.index] the index in the buffer where we wish to start serializing into.\n * @return {Number} returns the index pointing to the last written byte in the buffer.\n * @api public\n */\nBSON.prototype.serializeWithBufferAndIndex = function(object, finalBuffer, options) {\n\toptions = options || {};\n\t// Unpack the options\n\tvar checkKeys = typeof options.checkKeys == 'boolean'\n\t\t? options.checkKeys : false;\n\tvar serializeFunctions = typeof options.serializeFunctions == 'boolean'\n\t\t? options.serializeFunctions : false;\n\tvar ignoreUndefined = typeof options.ignoreUndefined == 'boolean'\n\t\t? options.ignoreUndefined : true;\n\tvar startIndex = typeof options.index == 'number'\n\t\t? options.index : 0;\n\n\t// Attempt to serialize\n\tvar serializationIndex = serializer(buffer, object, checkKeys, startIndex || 0, 0, serializeFunctions, ignoreUndefined);\n\tbuffer.copy(finalBuffer, startIndex, 0, serializationIndex);\n\n\t// Return the index\n\treturn serializationIndex - 1;\n}\n\n/**\n * Deserialize data as BSON.\n *\n * @param {Buffer} buffer the buffer containing the serialized set of BSON documents.\n * @param {Object} [options.evalFunctions=false] evaluate functions in the BSON document scoped to the object deserialized.\n * @param {Object} [options.cacheFunctions=false] cache evaluated functions for reuse.\n * @param {Object} [options.cacheFunctionsCrc32=false] use a crc32 code for caching, otherwise use the string of the function.\n * @param {Object} [options.promoteLongs=true] when deserializing a Long will fit it into a Number if it's smaller than 53 bits\n * @param {Object} [options.promoteBuffers=false] when deserializing a Binary will return it as a node.js Buffer instance.\n * @param {Object} [options.promoteValues=false] when deserializing will promote BSON values to their Node.js closest equivalent types.\n * @param {Object} [options.fieldsAsRaw=null] allow to specify if there what fields we wish to return as unserialized raw buffer.\n * @param {Object} [options.bsonRegExp=false] return BSON regular expressions as BSONRegExp instances.\n * @return {Object} returns the deserialized Javascript Object.\n * @api public\n */\nBSON.prototype.deserialize = function(buffer, options) {\n return deserialize(buffer, options);\n}\n\n/**\n * Calculate the bson size for a passed in Javascript object.\n *\n * @param {Object} object the Javascript object to calculate the BSON byte size for.\n * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**.\n * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**.\n * @return {Number} returns the number of bytes the BSON object will take up.\n * @api public\n */\nBSON.prototype.calculateObjectSize = function(object, options) {\n\toptions = options || {};\n\n\tvar serializeFunctions = typeof options.serializeFunctions == 'boolean'\n\t\t? options.serializeFunctions : false;\n\tvar ignoreUndefined = typeof options.ignoreUndefined == 'boolean'\n\t\t? options.ignoreUndefined : true;\n\n return calculateObjectSize(object, serializeFunctions, ignoreUndefined);\n}\n\n/**\n * Deserialize stream data as BSON documents.\n *\n * @param {Buffer} data the buffer containing the serialized set of BSON documents.\n * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start.\n * @param {Number} numberOfDocuments number of documents to deserialize.\n * @param {Array} documents an array where to store the deserialized documents.\n * @param {Number} docStartIndex the index in the documents array from where to start inserting documents.\n * @param {Object} [options] additional options used for the deserialization.\n * @param {Object} [options.evalFunctions=false] evaluate functions in the BSON document scoped to the object deserialized.\n * @param {Object} [options.cacheFunctions=false] cache evaluated functions for reuse.\n * @param {Object} [options.cacheFunctionsCrc32=false] use a crc32 code for caching, otherwise use the string of the function.\n * @param {Object} [options.promoteLongs=true] when deserializing a Long will fit it into a Number if it's smaller than 53 bits\n * @param {Object} [options.promoteBuffers=false] when deserializing a Binary will return it as a node.js Buffer instance.\n * @param {Object} [options.promoteValues=false] when deserializing will promote BSON values to their Node.js closest equivalent types.\n * @param {Object} [options.fieldsAsRaw=null] allow to specify if there what fields we wish to return as unserialized raw buffer.\n * @param {Object} [options.bsonRegExp=false] return BSON regular expressions as BSONRegExp instances.\n * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents.\n * @api public\n */\nBSON.prototype.deserializeStream = function(data, startIndex, numberOfDocuments, documents, docStartIndex, options) {\n options = options != null ? options : {};\n var index = startIndex;\n // Loop over all documents\n for(var i = 0; i < numberOfDocuments; i++) {\n // Find size of the document\n var size = data[index] | data[index + 1] << 8 | data[index + 2] << 16 | data[index + 3] << 24;\n // Update options with index\n options['index'] = index;\n // Parse the document at this point\n documents[docStartIndex + i] = this.deserialize(data, options);\n // Adjust index by the document size\n index = index + size;\n }\n\n // Return object containing end index of parsing and list of documents\n return index;\n}\n\n/**\n * @ignore\n * @api private\n */\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\nBSON.BSON_INT64_MAX = Math.pow(2, 63) - 1;\nBSON.BSON_INT64_MIN = -Math.pow(2, 63);\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\n// Internal long versions\nvar JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double.\nvar JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double.\n\n/**\n * Number BSON Type\n *\n * @classconstant BSON_DATA_NUMBER\n **/\nBSON.BSON_DATA_NUMBER = 1;\n/**\n * String BSON Type\n *\n * @classconstant BSON_DATA_STRING\n **/\nBSON.BSON_DATA_STRING = 2;\n/**\n * Object BSON Type\n *\n * @classconstant BSON_DATA_OBJECT\n **/\nBSON.BSON_DATA_OBJECT = 3;\n/**\n * Array BSON Type\n *\n * @classconstant BSON_DATA_ARRAY\n **/\nBSON.BSON_DATA_ARRAY = 4;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_BINARY\n **/\nBSON.BSON_DATA_BINARY = 5;\n/**\n * ObjectID BSON Type\n *\n * @classconstant BSON_DATA_OID\n **/\nBSON.BSON_DATA_OID = 7;\n/**\n * Boolean BSON Type\n *\n * @classconstant BSON_DATA_BOOLEAN\n **/\nBSON.BSON_DATA_BOOLEAN = 8;\n/**\n * Date BSON Type\n *\n * @classconstant BSON_DATA_DATE\n **/\nBSON.BSON_DATA_DATE = 9;\n/**\n * null BSON Type\n *\n * @classconstant BSON_DATA_NULL\n **/\nBSON.BSON_DATA_NULL = 10;\n/**\n * RegExp BSON Type\n *\n * @classconstant BSON_DATA_REGEXP\n **/\nBSON.BSON_DATA_REGEXP = 11;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_CODE\n **/\nBSON.BSON_DATA_CODE = 13;\n/**\n * Symbol BSON Type\n *\n * @classconstant BSON_DATA_SYMBOL\n **/\nBSON.BSON_DATA_SYMBOL = 14;\n/**\n * Code with Scope BSON Type\n *\n * @classconstant BSON_DATA_CODE_W_SCOPE\n **/\nBSON.BSON_DATA_CODE_W_SCOPE = 15;\n/**\n * 32 bit Integer BSON Type\n *\n * @classconstant BSON_DATA_INT\n **/\nBSON.BSON_DATA_INT = 16;\n/**\n * Timestamp BSON Type\n *\n * @classconstant BSON_DATA_TIMESTAMP\n **/\nBSON.BSON_DATA_TIMESTAMP = 17;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_LONG\n **/\nBSON.BSON_DATA_LONG = 18;\n/**\n * MinKey BSON Type\n *\n * @classconstant BSON_DATA_MIN_KEY\n **/\nBSON.BSON_DATA_MIN_KEY = 0xff;\n/**\n * MaxKey BSON Type\n *\n * @classconstant BSON_DATA_MAX_KEY\n **/\nBSON.BSON_DATA_MAX_KEY = 0x7f;\n\n/**\n * Binary Default Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_DEFAULT\n **/\nBSON.BSON_BINARY_SUBTYPE_DEFAULT = 0;\n/**\n * Binary Function Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_FUNCTION\n **/\nBSON.BSON_BINARY_SUBTYPE_FUNCTION = 1;\n/**\n * Binary Byte Array Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY\n **/\nBSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;\n/**\n * Binary UUID Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_UUID\n **/\nBSON.BSON_BINARY_SUBTYPE_UUID = 3;\n/**\n * Binary MD5 Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_MD5\n **/\nBSON.BSON_BINARY_SUBTYPE_MD5 = 4;\n/**\n * Binary User Defined Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED\n **/\nBSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128;\n\n// Return BSON\nmodule.exports = BSON;\nmodule.exports.Code = Code;\nmodule.exports.Map = Map;\nmodule.exports.Symbol = Symbol;\nmodule.exports.BSON = BSON;\nmodule.exports.DBRef = DBRef;\nmodule.exports.Binary = Binary;\nmodule.exports.ObjectID = ObjectID;\nmodule.exports.Long = Long;\nmodule.exports.Timestamp = Timestamp;\nmodule.exports.Double = Double;\nmodule.exports.Int32 = Int32;\nmodule.exports.MinKey = MinKey;\nmodule.exports.MaxKey = MaxKey;\nmodule.exports.BSONRegExp = BSONRegExp;\nmodule.exports.Decimal128 = Decimal128;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/bson.js","\"use strict\"\n\nvar writeIEEE754 = require('../float_parser').writeIEEE754\n\t, readIEEE754 = require('../float_parser').readIEEE754\n\t, Long = require('../long').Long\n , Double = require('../double').Double\n , Timestamp = require('../timestamp').Timestamp\n , ObjectID = require('../objectid').ObjectID\n , Symbol = require('../symbol').Symbol\n , BSONRegExp = require('../regexp').BSONRegExp\n , Code = require('../code').Code\n\t, Decimal128 = require('../decimal128')\n , MinKey = require('../min_key').MinKey\n , MaxKey = require('../max_key').MaxKey\n , DBRef = require('../db_ref').DBRef\n , Binary = require('../binary').Binary;\n\n// To ensure that 0.4 of node works correctly\nvar isDate = function isDate(d) {\n return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]';\n}\n\nvar calculateObjectSize = function calculateObjectSize(object, serializeFunctions, ignoreUndefined) {\n var totalLength = (4 + 1);\n\n if(Array.isArray(object)) {\n for(var i = 0; i < object.length; i++) {\n totalLength += calculateElement(i.toString(), object[i], serializeFunctions, true, ignoreUndefined)\n }\n } else {\n\t\t// If we have toBSON defined, override the current object\n\t\tif(object.toBSON) {\n\t\t\tobject = object.toBSON();\n\t\t}\n\n\t\t// Calculate size\n for(var key in object) {\n totalLength += calculateElement(key, object[key], serializeFunctions, false, ignoreUndefined)\n }\n }\n\n return totalLength;\n}\n\n/**\n * @ignore\n * @api private\n */\nfunction calculateElement(name, value, serializeFunctions, isArray, ignoreUndefined) {\n\t// If we have toBSON defined, override the current object\n if(value && value.toBSON){\n value = value.toBSON();\n }\n\n switch(typeof value) {\n case 'string':\n return 1 + Buffer.byteLength(name, 'utf8') + 1 + 4 + Buffer.byteLength(value, 'utf8') + 1;\n case 'number':\n if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) {\n if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { // 32 bit\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (4 + 1);\n } else {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1);\n }\n } else { // 64 bit\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1);\n }\n case 'undefined':\n if(isArray || !ignoreUndefined) return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1);\n return 0;\n case 'boolean':\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1 + 1);\n case 'object':\n if(value == null || value instanceof MinKey || value instanceof MaxKey || value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1);\n } else if(value instanceof ObjectID || value['_bsontype'] == 'ObjectID') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (12 + 1);\n } else if(value instanceof Date || isDate(value)) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1);\n } else if(typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1 + 4 + 1) + value.length;\n } else if(value instanceof Long || value instanceof Double || value instanceof Timestamp\n || value['_bsontype'] == 'Long' || value['_bsontype'] == 'Double' || value['_bsontype'] == 'Timestamp') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1);\n\t\t\t} else if(value instanceof Decimal128 || value['_bsontype'] == 'Decimal128') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (16 + 1);\n } else if(value instanceof Code || value['_bsontype'] == 'Code') {\n // Calculate size depending on the availability of a scope\n if(value.scope != null && Object.keys(value.scope).length > 0) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + 4 + Buffer.byteLength(value.code.toString(), 'utf8') + 1 + calculateObjectSize(value.scope, serializeFunctions, ignoreUndefined);\n } else {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + Buffer.byteLength(value.code.toString(), 'utf8') + 1;\n }\n } else if(value instanceof Binary || value['_bsontype'] == 'Binary') {\n // Check what kind of subtype we have\n if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (value.position + 1 + 4 + 1 + 4);\n } else {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (value.position + 1 + 4 + 1);\n }\n } else if(value instanceof Symbol || value['_bsontype'] == 'Symbol') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + Buffer.byteLength(value.value, 'utf8') + 4 + 1 + 1;\n } else if(value instanceof DBRef || value['_bsontype'] == 'DBRef') {\n // Set up correct object for serialization\n var ordered_values = {\n '$ref': value.namespace\n , '$id' : value.oid\n };\n\n // Add db reference if it exists\n if(null != value.db) {\n ordered_values['$db'] = value.db;\n }\n\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + calculateObjectSize(ordered_values, serializeFunctions, ignoreUndefined);\n } else if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + Buffer.byteLength(value.source, 'utf8') + 1\n + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1\n } else if(value instanceof BSONRegExp || value['_bsontype'] == 'BSONRegExp') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + Buffer.byteLength(value.pattern, 'utf8') + 1\n + Buffer.byteLength(value.options, 'utf8') + 1\n } else {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + calculateObjectSize(value, serializeFunctions, ignoreUndefined) + 1;\n }\n case 'function':\n // WTF for 0.4.X where typeof /someregexp/ === 'function'\n if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]' || String.call(value) == '[object RegExp]') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + Buffer.byteLength(value.source, 'utf8') + 1\n + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1\n } else {\n if(serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + 4 + Buffer.byteLength(value.toString(), 'utf8') + 1 + calculateObjectSize(value.scope, serializeFunctions, ignoreUndefined);\n } else if(serializeFunctions) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + Buffer.byteLength(value.toString(), 'utf8') + 1;\n }\n }\n }\n\n return 0;\n}\n\nvar BSON = {};\n\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\nmodule.exports = calculateObjectSize;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/parser/calculate_size.js","\"use strict\"\n\nvar readIEEE754 = require('../float_parser').readIEEE754,\n\tf = require('util').format,\n\tLong = require('../long').Long,\n Double = require('../double').Double,\n Timestamp = require('../timestamp').Timestamp,\n ObjectID = require('../objectid').ObjectID,\n Symbol = require('../symbol').Symbol,\n Code = require('../code').Code,\n MinKey = require('../min_key').MinKey,\n MaxKey = require('../max_key').MaxKey,\n\tDecimal128 = require('../decimal128'),\n\tInt32 = require('../int_32'),\n DBRef = require('../db_ref').DBRef,\n BSONRegExp = require('../regexp').BSONRegExp,\n Binary = require('../binary').Binary;\n\nvar deserialize = function(buffer, options, isArray) {\n\toptions = options == null ? {} : options;\n\tvar index = options && options.index ? options.index : 0;\n\t// Read the document size\n var size = buffer[index] | buffer[index+1] << 8 | buffer[index+2] << 16 | buffer[index+3] << 24;\n\n\t// Ensure buffer is valid size\n if(size < 5 || buffer.length < size || (size + index) > buffer.length) {\n\t\tthrow new Error(\"corrupt bson message\");\n\t}\n\n\t// Illegal end value\n\tif(buffer[index + size - 1] != 0) {\n\t\tthrow new Error(\"One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00\");\n\t}\n\n\t// Start deserializtion\n\treturn deserializeObject(buffer, index, options, isArray);\n}\n\nvar deserializeObject = function(buffer, index, options, isArray) {\n\tvar evalFunctions = options['evalFunctions'] == null ? false : options['evalFunctions'];\n var cacheFunctions = options['cacheFunctions'] == null ? false : options['cacheFunctions'];\n var cacheFunctionsCrc32 = options['cacheFunctionsCrc32'] == null ? false : options['cacheFunctionsCrc32'];\n\tvar fieldsAsRaw = options['fieldsAsRaw'] == null ? null : options['fieldsAsRaw'];\n\n\t// Return raw bson buffer instead of parsing it\n\tvar raw = options['raw'] == null ? false : options['raw'];\n\n\t// Return BSONRegExp objects instead of native regular expressions\n var bsonRegExp = typeof options['bsonRegExp'] == 'boolean' ? options['bsonRegExp'] : false;\n\n\t// Controls the promotion of values vs wrapper classes\n\tvar promoteBuffers = options['promoteBuffers'] == null ? false : options['promoteBuffers'];\n\tvar promoteLongs = options['promoteLongs'] == null ? true : options['promoteLongs'];\n\tvar promoteValues = options['promoteValues'] == null ? true : options['promoteValues'];\n\n\t// Set the start index\n\tvar startIndex = index;\n\n // Validate that we have at least 4 bytes of buffer\n if(buffer.length < 5) throw new Error(\"corrupt bson message < 5 bytes long\");\n\n\t// Read the document size\n var size = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n\t// Ensure buffer is valid size\n if(size < 5 || size > buffer.length) throw new Error(\"corrupt bson message\");\n\n // Create holding object\n var object = isArray ? [] : {};\n\t// Used for arrays to skip having to perform utf8 decoding\n\tvar arrayIndex = 0;\n\n // While we have more left data left keep parsing\n while(true) {\n // Read the type\n var elementType = buffer[index++];\n // If we get a zero it's the last byte, exit\n if(elementType == 0) {\n\t\t\tbreak;\n\t\t}\n\n\t\t// Get the start search index\n\t\tvar i = index;\n\t\t// Locate the end of the c string\n\t\twhile(buffer[i] !== 0x00 && i < buffer.length) {\n\t\t\ti++\n\t\t}\n\n\t\t// If are at the end of the buffer there is a problem with the document\n\t\tif(i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\")\n\t\tvar name = isArray ? arrayIndex++ : buffer.toString('utf8', index, i);\n\n\t\tindex = i + 1;\n\n\t\tif(elementType == BSON.BSON_DATA_STRING) {\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\tif(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n object[name] = buffer.toString('utf8', index, index + stringSize - 1);\n index = index + stringSize;\n\t\t} else if(elementType == BSON.BSON_DATA_OID) {\n\t\t\tvar oid = new Buffer(12);\n\t\t\tbuffer.copy(oid, 0, index, index + 12);\n object[name] = new ObjectID(oid);\n index = index + 12;\n\t\t} else if(elementType == BSON.BSON_DATA_INT && promoteValues == false) {\n\t\t\tobject[name] = new Int32(buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24);\n\t\t} else if(elementType == BSON.BSON_DATA_INT) {\n object[name] = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t} else if(elementType == BSON.BSON_DATA_NUMBER && promoteValues == false) {\n\t\t\tobject[name] = new Double(buffer.readDoubleLE(index));\n\t\t\tindex = index + 8;\n\t\t} else if(elementType == BSON.BSON_DATA_NUMBER) {\n\t\t\tobject[name] = buffer.readDoubleLE(index);\n index = index + 8;\n\t\t} else if(elementType == BSON.BSON_DATA_DATE) {\n var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n object[name] = new Date(new Long(lowBits, highBits).toNumber());\n\t\t} else if(elementType == BSON.BSON_DATA_BOOLEAN) {\n\t\t\tif(buffer[index] != 0 && buffer[index] != 1) throw new Error('illegal boolean type value');\n object[name] = buffer[index++] == 1;\n\t\t} else if(elementType == BSON.BSON_DATA_OBJECT) {\n\t\t\tvar _index = index;\n var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;\n\t\t\tif(objectSize <= 0 || objectSize > (buffer.length - index)) throw new Error(\"bad embedded document length in bson\");\n\n\t\t\t// We have a raw value\n\t\t\tif(raw) {\n\t object[name] = buffer.slice(index, index + objectSize);\n\t\t\t} else {\n\t object[name] = deserializeObject(buffer, _index, options, false);\n\t\t\t}\n\n index = index + objectSize;\n\t\t} else if(elementType == BSON.BSON_DATA_ARRAY) {\n\t\t\tvar _index = index;\n var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;\n\t\t\tvar arrayOptions = options;\n\n\t\t\t// Stop index\n\t\t\tvar stopIndex = index + objectSize;\n\n\t\t\t// All elements of array to be returned as raw bson\n\t\t\tif(fieldsAsRaw && fieldsAsRaw[name]) {\n\t\t\t\tarrayOptions = {};\n\t\t\t\tfor(var n in options) arrayOptions[n] = options[n];\n\t\t\t\tarrayOptions['raw'] = true;\n\t\t\t}\n\n object[name] = deserializeObject(buffer, _index, arrayOptions, true);\n index = index + objectSize;\n\n\t\t\tif(buffer[index - 1] != 0) throw new Error('invalid array terminator byte');\n\t\t\tif(index != stopIndex) throw new Error('corrupted array bson');\n\t\t} else if(elementType == BSON.BSON_DATA_UNDEFINED) {\n object[name] = undefined;\n\t\t} else if(elementType == BSON.BSON_DATA_NULL) {\n\t\t\tobject[name] = null;\n\t\t} else if(elementType == BSON.BSON_DATA_LONG) {\n // Unpack the low and high bits\n var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var long = new Long(lowBits, highBits);\n // Promote the long if possible\n if(promoteLongs && promoteValues == true) {\n object[name] = long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG) ? long.toNumber() : long;\n } else {\n object[name] = long;\n }\n\t\t} else if(elementType == BSON.BSON_DATA_DECIMAL128) {\n\t\t\t// Buffer to contain the decimal bytes\n\t\t\tvar bytes = new Buffer(16);\n\t\t\t// Copy the next 16 bytes into the bytes buffer\n\t\t\tbuffer.copy(bytes, 0, index, index + 16);\n\t\t\t// Update index\n\t\t\tindex = index + 16;\n\t\t\t// Assign the new Decimal128 value\n\t\t\tvar decimal128 = new Decimal128(bytes);\n\t\t\t// If we have an alternative mapper use that\n\t\t\tobject[name] = decimal128.toObject ? decimal128.toObject() : decimal128;\n\t\t} else if(elementType == BSON.BSON_DATA_BINARY) {\n var binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\tvar totalBinarySize = binarySize;\n var subType = buffer[index++];\n\n\t\t\t// Did we have a negative binary size, throw\n\t\t\tif(binarySize < 0) throw new Error('Negative binary type element size found');\n\n\t\t\t// Is the length longer than the document\n\t\t\tif(binarySize > buffer.length) throw new Error('Binary type size larger than document size');\n\n\t\t\t// Decode as raw Buffer object if options specifies it\n if(buffer['slice'] != null) {\n // If we have subtype 2 skip the 4 bytes for the size\n if(subType == Binary.SUBTYPE_BYTE_ARRAY) {\n binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\t\t\tif(binarySize < 0) throw new Error('Negative binary type element size found for subtype 0x02');\n\t\t\t\t\tif(binarySize > (totalBinarySize - 4)) throw new Error('Binary type with subtype 0x02 contains to long binary size');\n\t\t\t\t\tif(binarySize < (totalBinarySize - 4)) throw new Error('Binary type with subtype 0x02 contains to short binary size');\n }\n\n if(promoteBuffers && promoteValues) {\n object[name] = buffer.slice(index, index + binarySize);\n } else {\n object[name] = new Binary(buffer.slice(index, index + binarySize), subType);\n }\n } else {\n var _buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(binarySize)) : new Array(binarySize);\n // If we have subtype 2 skip the 4 bytes for the size\n if(subType == Binary.SUBTYPE_BYTE_ARRAY) {\n binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\t\t\tif(binarySize < 0) throw new Error('Negative binary type element size found for subtype 0x02');\n\t\t\t\t\tif(binarySize > (totalBinarySize - 4)) throw new Error('Binary type with subtype 0x02 contains to long binary size');\n\t\t\t\t\tif(binarySize < (totalBinarySize - 4)) throw new Error('Binary type with subtype 0x02 contains to short binary size');\n }\n\n // Copy the data\n for(var i = 0; i < binarySize; i++) {\n _buffer[i] = buffer[index + i];\n }\n\n if(promoteBuffers && promoteValues) {\n object[name] = _buffer;\n } else {\n object[name] = new Binary(_buffer, subType);\n }\n }\n\n // Update the index\n index = index + binarySize;\n\t\t} else if(elementType == BSON.BSON_DATA_REGEXP && bsonRegExp == false) {\n\t\t\t// Get the start search index\n\t\t\tvar i = index;\n\t\t\t// Locate the end of the c string\n\t\t\twhile(buffer[i] !== 0x00 && i < buffer.length) {\n\t\t\t\ti++\n\t\t\t}\n\t\t\t// If are at the end of the buffer there is a problem with the document\n\t\t\tif(i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\")\n\t\t\t// Return the C string\n\t\t\tvar source = buffer.toString('utf8', index, i);\n // Create the regexp\n\t\t\tindex = i + 1;\n\n\t\t\t// Get the start search index\n\t\t\tvar i = index;\n\t\t\t// Locate the end of the c string\n\t\t\twhile(buffer[i] !== 0x00 && i < buffer.length) {\n\t\t\t\ti++\n\t\t\t}\n\t\t\t// If are at the end of the buffer there is a problem with the document\n\t\t\tif(i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\")\n\t\t\t// Return the C string\n\t\t\tvar regExpOptions = buffer.toString('utf8', index, i);\n\t\t\tindex = i + 1;\n\n // For each option add the corresponding one for javascript\n var optionsArray = new Array(regExpOptions.length);\n\n // Parse options\n for(var i = 0; i < regExpOptions.length; i++) {\n switch(regExpOptions[i]) {\n case 'm':\n optionsArray[i] = 'm';\n break;\n case 's':\n optionsArray[i] = 'g';\n break;\n case 'i':\n optionsArray[i] = 'i';\n break;\n }\n }\n\n object[name] = new RegExp(source, optionsArray.join(''));\n } else if(elementType == BSON.BSON_DATA_REGEXP && bsonRegExp == true) {\n\t\t\t// Get the start search index\n\t\t\tvar i = index;\n\t\t\t// Locate the end of the c string\n\t\t\twhile(buffer[i] !== 0x00 && i < buffer.length) {\n\t\t\t\ti++\n\t\t\t}\n\t\t\t// If are at the end of the buffer there is a problem with the document\n\t\t\tif(i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\")\n\t\t\t// Return the C string\n\t\t\tvar source = buffer.toString('utf8', index, i);\n index = i + 1;\n\n\t\t\t// Get the start search index\n\t\t\tvar i = index;\n\t\t\t// Locate the end of the c string\n\t\t\twhile(buffer[i] !== 0x00 && i < buffer.length) {\n\t\t\t\ti++\n\t\t\t}\n\t\t\t// If are at the end of the buffer there is a problem with the document\n\t\t\tif(i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\")\n\t\t\t// Return the C string\n\t\t\tvar regExpOptions = buffer.toString('utf8', index, i);\n index = i + 1;\n\n // Set the object\n object[name] = new BSONRegExp(source, regExpOptions);\n\t\t} else if(elementType == BSON.BSON_DATA_SYMBOL) {\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\tif(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n object[name] = new Symbol(buffer.toString('utf8', index, index + stringSize - 1));\n index = index + stringSize;\n\t\t} else if(elementType == BSON.BSON_DATA_TIMESTAMP) {\n var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n object[name] = new Timestamp(lowBits, highBits);\n\t\t} else if(elementType == BSON.BSON_DATA_MIN_KEY) {\n object[name] = new MinKey();\n\t\t} else if(elementType == BSON.BSON_DATA_MAX_KEY) {\n object[name] = new MaxKey();\n\t\t} else if(elementType == BSON.BSON_DATA_CODE) {\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\tif(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n var functionString = buffer.toString('utf8', index, index + stringSize - 1);\n\n // If we are evaluating the functions\n if(evalFunctions) {\n var value = null;\n // If we have cache enabled let's look for the md5 of the function in the cache\n if(cacheFunctions) {\n var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString;\n // Got to do this to avoid V8 deoptimizing the call due to finding eval\n object[name] = isolateEvalWithHash(functionCache, hash, functionString, object);\n } else {\n object[name] = isolateEval(functionString);\n }\n } else {\n object[name] = new Code(functionString);\n }\n\n // Update parse index position\n index = index + stringSize;\n\t\t} else if(elementType == BSON.BSON_DATA_CODE_W_SCOPE) {\n var totalSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n\t\t\t// Element cannot be shorter than totalSize + stringSize + documentSize + terminator\n\t\t\tif(totalSize < (4 + 4 + 4 + 1)) {\n\t\t\t\tthrow new Error(\"code_w_scope total size shorter minimum expected length\");\n\t\t\t}\n\n\t\t\t// Get the code string size\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\t// Check if we have a valid string\n\t\t\tif(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n\n // Javascript function\n var functionString = buffer.toString('utf8', index, index + stringSize - 1);\n // Update parse index position\n index = index + stringSize;\n // Parse the element\n\t\t\tvar _index = index;\n // Decode the size of the object document\n var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;\n // Decode the scope object\n var scopeObject = deserializeObject(buffer, _index, options, false);\n // Adjust the index\n index = index + objectSize;\n\n\t\t\t// Check if field length is to short\n\t\t\tif(totalSize < (4 + 4 + objectSize + stringSize)) {\n\t\t\t\tthrow new Error('code_w_scope total size is to short, truncating scope');\n\t\t\t}\n\n\t\t\t// Check if totalSize field is to long\n\t\t\tif(totalSize > (4 + 4 + objectSize + stringSize)) {\n\t\t\t\tthrow new Error('code_w_scope total size is to long, clips outer document');\n\t\t\t}\n\n // If we are evaluating the functions\n if(evalFunctions) {\n // Contains the value we are going to set\n var value = null;\n // If we have cache enabled let's look for the md5 of the function in the cache\n if(cacheFunctions) {\n var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString;\n // Got to do this to avoid V8 deoptimizing the call due to finding eval\n object[name] = isolateEvalWithHash(functionCache, hash, functionString, object);\n } else {\n object[name] = isolateEval(functionString);\n }\n\n object[name].scope = scopeObject;\n } else {\n object[name] = new Code(functionString, scopeObject);\n }\n\t\t} else if(elementType == BSON.BSON_DATA_DBPOINTER) {\n\t\t\t// Get the code string size\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\t// Check if we have a valid string\n\t\t\tif(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n\t\t\t// Namespace\n var namespace = buffer.toString('utf8', index, index + stringSize - 1);\n\t\t\t// Update parse index position\n index = index + stringSize;\n\n\t\t\t// Read the oid\n\t\t\tvar oidBuffer = new Buffer(12);\n\t\t\tbuffer.copy(oidBuffer, 0, index, index + 12);\n var oid = new ObjectID(oidBuffer);\n\n\t\t\t// Update the index\n\t\t\tindex = index + 12;\n\n\t\t\t// Split the namespace\n\t\t\tvar parts = namespace.split('.');\n\t\t\tvar db = parts.shift();\n\t\t\tvar collection = parts.join('.');\n\t\t\t// Upgrade to DBRef type\n\t\t\tobject[name] = new DBRef(collection, oid, db);\n } else {\n\t\t\tthrow new Error(\"Detected unknown BSON type \" + elementType.toString(16) + \" for fieldname \\\"\" + name + \"\\\", are you using the latest BSON parser\");\n\t\t}\n }\n\n\t// Check if the deserialization was against a valid array/object\n\tif(size != (index - startIndex)) {\n\t\tif(isArray) throw new Error('corrupt array bson');\n\t\tthrow new Error('corrupt object bson');\n\t}\n\n // Check if we have a db ref object\n if(object['$id'] != null) object = new DBRef(object['$ref'], object['$id'], object['$db']);\n return object;\n}\n\n/**\n * Ensure eval is isolated.\n *\n * @ignore\n * @api private\n */\nvar isolateEvalWithHash = function(functionCache, hash, functionString, object) {\n // Contains the value we are going to set\n var value = null;\n\n // Check for cache hit, eval if missing and return cached function\n if(functionCache[hash] == null) {\n eval(\"value = \" + functionString);\n functionCache[hash] = value;\n }\n // Set the object\n return functionCache[hash].bind(object);\n}\n\n/**\n * Ensure eval is isolated.\n *\n * @ignore\n * @api private\n */\nvar isolateEval = function(functionString) {\n // Contains the value we are going to set\n var value = null;\n // Eval the function\n eval(\"value = \" + functionString);\n return value;\n}\n\nvar BSON = {};\n\n/**\n * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5\n *\n * @ignore\n * @api private\n */\nvar functionCache = BSON.functionCache = {};\n\n/**\n * Number BSON Type\n *\n * @classconstant BSON_DATA_NUMBER\n **/\nBSON.BSON_DATA_NUMBER = 1;\n/**\n * String BSON Type\n *\n * @classconstant BSON_DATA_STRING\n **/\nBSON.BSON_DATA_STRING = 2;\n/**\n * Object BSON Type\n *\n * @classconstant BSON_DATA_OBJECT\n **/\nBSON.BSON_DATA_OBJECT = 3;\n/**\n * Array BSON Type\n *\n * @classconstant BSON_DATA_ARRAY\n **/\nBSON.BSON_DATA_ARRAY = 4;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_BINARY\n **/\nBSON.BSON_DATA_BINARY = 5;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_UNDEFINED\n **/\nBSON.BSON_DATA_UNDEFINED = 6;\n/**\n * ObjectID BSON Type\n *\n * @classconstant BSON_DATA_OID\n **/\nBSON.BSON_DATA_OID = 7;\n/**\n * Boolean BSON Type\n *\n * @classconstant BSON_DATA_BOOLEAN\n **/\nBSON.BSON_DATA_BOOLEAN = 8;\n/**\n * Date BSON Type\n *\n * @classconstant BSON_DATA_DATE\n **/\nBSON.BSON_DATA_DATE = 9;\n/**\n * null BSON Type\n *\n * @classconstant BSON_DATA_NULL\n **/\nBSON.BSON_DATA_NULL = 10;\n/**\n * RegExp BSON Type\n *\n * @classconstant BSON_DATA_REGEXP\n **/\nBSON.BSON_DATA_REGEXP = 11;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_DBPOINTER\n **/\nBSON.BSON_DATA_DBPOINTER = 12;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_CODE\n **/\nBSON.BSON_DATA_CODE = 13;\n/**\n * Symbol BSON Type\n *\n * @classconstant BSON_DATA_SYMBOL\n **/\nBSON.BSON_DATA_SYMBOL = 14;\n/**\n * Code with Scope BSON Type\n *\n * @classconstant BSON_DATA_CODE_W_SCOPE\n **/\nBSON.BSON_DATA_CODE_W_SCOPE = 15;\n/**\n * 32 bit Integer BSON Type\n *\n * @classconstant BSON_DATA_INT\n **/\nBSON.BSON_DATA_INT = 16;\n/**\n * Timestamp BSON Type\n *\n * @classconstant BSON_DATA_TIMESTAMP\n **/\nBSON.BSON_DATA_TIMESTAMP = 17;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_LONG\n **/\nBSON.BSON_DATA_LONG = 18;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_DECIMAL128\n **/\nBSON.BSON_DATA_DECIMAL128 = 19;\n/**\n * MinKey BSON Type\n *\n * @classconstant BSON_DATA_MIN_KEY\n **/\nBSON.BSON_DATA_MIN_KEY = 0xff;\n/**\n * MaxKey BSON Type\n *\n * @classconstant BSON_DATA_MAX_KEY\n **/\nBSON.BSON_DATA_MAX_KEY = 0x7f;\n\n/**\n * Binary Default Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_DEFAULT\n **/\nBSON.BSON_BINARY_SUBTYPE_DEFAULT = 0;\n/**\n * Binary Function Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_FUNCTION\n **/\nBSON.BSON_BINARY_SUBTYPE_FUNCTION = 1;\n/**\n * Binary Byte Array Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY\n **/\nBSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;\n/**\n * Binary UUID Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_UUID\n **/\nBSON.BSON_BINARY_SUBTYPE_UUID = 3;\n/**\n * Binary MD5 Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_MD5\n **/\nBSON.BSON_BINARY_SUBTYPE_MD5 = 4;\n/**\n * Binary User Defined Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED\n **/\nBSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128;\n\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\nBSON.BSON_INT64_MAX = Math.pow(2, 63) - 1;\nBSON.BSON_INT64_MIN = -Math.pow(2, 63);\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\n// Internal long versions\nvar JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double.\nvar JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double.\n\nmodule.exports = deserialize\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/parser/deserializer.js","\"use strict\"\n\nvar writeIEEE754 = require('../float_parser').writeIEEE754,\n readIEEE754 = require('../float_parser').readIEEE754,\n Long = require('../long').Long,\n Map = require('../map'),\n Double = require('../double').Double,\n Timestamp = require('../timestamp').Timestamp,\n ObjectID = require('../objectid').ObjectID,\n Symbol = require('../symbol').Symbol,\n Code = require('../code').Code,\n BSONRegExp = require('../regexp').BSONRegExp,\n Int32 = require('../int_32').Int32,\n MinKey = require('../min_key').MinKey,\n MaxKey = require('../max_key').MaxKey,\n Decimal128 = require('../decimal128'),\n DBRef = require('../db_ref').DBRef,\n Binary = require('../binary').Binary;\n\ntry {\n var _Buffer = Uint8Array;\n} catch(e) {\n var _Buffer = Buffer;\n}\n\nvar regexp = /\\x00/\n\n// To ensure that 0.4 of node works correctly\nvar isDate = function isDate(d) {\n return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]';\n}\n\nvar isRegExp = function isRegExp(d) {\n return Object.prototype.toString.call(d) === '[object RegExp]';\n}\n\nvar serializeString = function(buffer, key, value, index, isArray) {\n // Encode String type\n buffer[index++] = BSON.BSON_DATA_STRING;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes + 1;\n buffer[index - 1] = 0;\n // Write the string\n var size = buffer.write(value, index + 4, 'utf8');\n // Write the size of the string to buffer\n buffer[index + 3] = (size + 1 >> 24) & 0xff;\n buffer[index + 2] = (size + 1 >> 16) & 0xff;\n buffer[index + 1] = (size + 1 >> 8) & 0xff;\n buffer[index] = size + 1 & 0xff;\n // Update index\n index = index + 4 + size;\n // Write zero\n buffer[index++] = 0;\n return index;\n}\n\nvar serializeNumber = function(buffer, key, value, index, isArray) {\n // We have an integer value\n if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) {\n // If the value fits in 32 bits encode as int, if it fits in a double\n // encode it as a double, otherwise long\n if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) {\n // Set int type 32 bits or less\n buffer[index++] = BSON.BSON_DATA_INT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the int value\n buffer[index++] = value & 0xff;\n buffer[index++] = (value >> 8) & 0xff;\n buffer[index++] = (value >> 16) & 0xff;\n buffer[index++] = (value >> 24) & 0xff;\n } else if(value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) {\n // Encode as double\n buffer[index++] = BSON.BSON_DATA_NUMBER;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write float\n writeIEEE754(buffer, value, index, 'little', 52, 8);\n // Ajust index\n index = index + 8;\n } else {\n // Set long type\n buffer[index++] = BSON.BSON_DATA_LONG;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n var longVal = Long.fromNumber(value);\n var lowBits = longVal.getLowBits();\n var highBits = longVal.getHighBits();\n // Encode low bits\n buffer[index++] = lowBits & 0xff;\n buffer[index++] = (lowBits >> 8) & 0xff;\n buffer[index++] = (lowBits >> 16) & 0xff;\n buffer[index++] = (lowBits >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = highBits & 0xff;\n buffer[index++] = (highBits >> 8) & 0xff;\n buffer[index++] = (highBits >> 16) & 0xff;\n buffer[index++] = (highBits >> 24) & 0xff;\n }\n } else {\n // Encode as double\n buffer[index++] = BSON.BSON_DATA_NUMBER;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write float\n writeIEEE754(buffer, value, index, 'little', 52, 8);\n // Ajust index\n index = index + 8;\n }\n\n return index;\n}\n\nvar serializeNull = function(buffer, key, value, index, isArray) {\n // Set long type\n buffer[index++] = BSON.BSON_DATA_NULL;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n return index;\n}\n\nvar serializeBoolean = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_BOOLEAN;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Encode the boolean value\n buffer[index++] = value ? 1 : 0;\n return index;\n}\n\nvar serializeDate = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_DATE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Write the date\n var dateInMilis = Long.fromNumber(value.getTime());\n var lowBits = dateInMilis.getLowBits();\n var highBits = dateInMilis.getHighBits();\n // Encode low bits\n buffer[index++] = lowBits & 0xff;\n buffer[index++] = (lowBits >> 8) & 0xff;\n buffer[index++] = (lowBits >> 16) & 0xff;\n buffer[index++] = (lowBits >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = highBits & 0xff;\n buffer[index++] = (highBits >> 8) & 0xff;\n buffer[index++] = (highBits >> 16) & 0xff;\n buffer[index++] = (highBits >> 24) & 0xff;\n return index;\n}\n\nvar serializeRegExp = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_REGEXP;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n if (value.source && value.source.match(regexp) != null) {\n throw Error(\"value \" + value.source + \" must not contain null bytes\");\n }\n // Adjust the index\n index = index + buffer.write(value.source, index, 'utf8');\n // Write zero\n buffer[index++] = 0x00;\n // Write the parameters\n if(value.global) buffer[index++] = 0x73; // s\n if(value.ignoreCase) buffer[index++] = 0x69; // i\n if(value.multiline) buffer[index++] = 0x6d; // m\n // Add ending zero\n buffer[index++] = 0x00;\n return index;\n}\n\nvar serializeBSONRegExp = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_REGEXP;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Check the pattern for 0 bytes\n if (value.pattern.match(regexp) != null) {\n // The BSON spec doesn't allow keys with null bytes because keys are\n // null-terminated.\n throw Error(\"pattern \" + value.pattern + \" must not contain null bytes\");\n }\n\n // Adjust the index\n index = index + buffer.write(value.pattern, index, 'utf8');\n // Write zero\n buffer[index++] = 0x00;\n // Write the options\n index = index + buffer.write(value.options.split('').sort().join(''), index, 'utf8');\n // Add ending zero\n buffer[index++] = 0x00;\n return index;\n}\n\nvar serializeMinMax = function(buffer, key, value, index, isArray) {\n // Write the type of either min or max key\n if(value === null) {\n buffer[index++] = BSON.BSON_DATA_NULL;\n } else if(value instanceof MinKey) {\n buffer[index++] = BSON.BSON_DATA_MIN_KEY;\n } else {\n buffer[index++] = BSON.BSON_DATA_MAX_KEY;\n }\n\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n return index;\n}\n\nvar serializeObjectId = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_OID;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Write the objectId into the shared buffer\n if(typeof value.id == 'string') {\n buffer.write(value.id, index, 'binary')\n } else if(value.id && value.id.copy){\n value.id.copy(buffer, index, 0, 12);\n } else {\n throw new Error('object [' + JSON.stringify(value) + \"] is not a valid ObjectId\");\n }\n\n // Ajust index\n return index + 12;\n}\n\nvar serializeBuffer = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_BINARY;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Get size of the buffer (current write point)\n var size = value.length;\n // Write the size of the string to buffer\n buffer[index++] = size & 0xff;\n buffer[index++] = (size >> 8) & 0xff;\n buffer[index++] = (size >> 16) & 0xff;\n buffer[index++] = (size >> 24) & 0xff;\n // Write the default subtype\n buffer[index++] = BSON.BSON_BINARY_SUBTYPE_DEFAULT;\n // Copy the content form the binary field to the buffer\n value.copy(buffer, index, 0, size);\n // Adjust the index\n index = index + size;\n return index;\n}\n\nvar serializeObject = function(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, isArray, path) {\n for(var i = 0; i < path.length; i++) {\n if(path[i] === value) throw new Error('cyclic dependency detected');\n }\n\n // Push value to stack\n path.push(value);\n // Write the type\n buffer[index++] = Array.isArray(value) ? BSON.BSON_DATA_ARRAY : BSON.BSON_DATA_OBJECT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n var endIndex = serializeInto(buffer, value, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined, path);\n // Pop stack\n path.pop();\n // Write size\n var size = endIndex - index;\n return endIndex;\n}\n\nvar serializeDecimal128 = function(buffer, key, value, index, isArray) {\n buffer[index++] = BSON.BSON_DATA_DECIMAL128;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the data from the value\n value.bytes.copy(buffer, index, 0, 16);\n return index + 16;\n}\n\nvar serializeLong = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = value._bsontype == 'Long' ? BSON.BSON_DATA_LONG : BSON.BSON_DATA_TIMESTAMP;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the date\n var lowBits = value.getLowBits();\n var highBits = value.getHighBits();\n // Encode low bits\n buffer[index++] = lowBits & 0xff;\n buffer[index++] = (lowBits >> 8) & 0xff;\n buffer[index++] = (lowBits >> 16) & 0xff;\n buffer[index++] = (lowBits >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = highBits & 0xff;\n buffer[index++] = (highBits >> 8) & 0xff;\n buffer[index++] = (highBits >> 16) & 0xff;\n buffer[index++] = (highBits >> 24) & 0xff;\n return index;\n}\n\nvar serializeInt32 = function(buffer, key, value, index, isArray) {\n // Set int type 32 bits or less\n buffer[index++] = BSON.BSON_DATA_INT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the int value\n buffer[index++] = value & 0xff;\n buffer[index++] = (value >> 8) & 0xff;\n buffer[index++] = (value >> 16) & 0xff;\n buffer[index++] = (value >> 24) & 0xff;\n return index;\n}\n\nvar serializeDouble = function(buffer, key, value, index, isArray) {\n // Encode as double\n buffer[index++] = BSON.BSON_DATA_NUMBER;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write float\n writeIEEE754(buffer, value, index, 'little', 52, 8);\n // Ajust index\n index = index + 8;\n return index;\n}\n\nvar serializeFunction = function(buffer, key, value, index, checkKeys, depth, isArray) {\n buffer[index++] = BSON.BSON_DATA_CODE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Function string\n var functionString = value.toString();\n // Write the string\n var size = buffer.write(functionString, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = size & 0xff;\n buffer[index + 1] = (size >> 8) & 0xff;\n buffer[index + 2] = (size >> 16) & 0xff;\n buffer[index + 3] = (size >> 24) & 0xff;\n // Update index\n index = index + 4 + size - 1;\n // Write zero\n buffer[index++] = 0;\n return index;\n}\n\nvar serializeCode = function(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, isArray) {\n if(value.scope && typeof value.scope == 'object') {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Starting index\n var startIndex = index;\n\n // Serialize the function\n // Get the function string\n var functionString = typeof value.code == 'string' ? value.code : value.code.toString();\n // Index adjustment\n index = index + 4;\n // Write string into buffer\n var codeSize = buffer.write(functionString, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = codeSize & 0xff;\n buffer[index + 1] = (codeSize >> 8) & 0xff;\n buffer[index + 2] = (codeSize >> 16) & 0xff;\n buffer[index + 3] = (codeSize >> 24) & 0xff;\n // Write end 0\n buffer[index + 4 + codeSize - 1] = 0;\n // Write the\n index = index + codeSize + 4;\n\n //\n // Serialize the scope value\n var endIndex = serializeInto(buffer, value.scope, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined)\n index = endIndex - 1;\n\n // Writ the total\n var totalSize = endIndex - startIndex;\n\n // Write the total size of the object\n buffer[startIndex++] = totalSize & 0xff;\n buffer[startIndex++] = (totalSize >> 8) & 0xff;\n buffer[startIndex++] = (totalSize >> 16) & 0xff;\n buffer[startIndex++] = (totalSize >> 24) & 0xff;\n // Write trailing zero\n buffer[index++] = 0;\n } else {\n buffer[index++] = BSON.BSON_DATA_CODE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Function string\n var functionString = value.code.toString();\n // Write the string\n var size = buffer.write(functionString, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = size & 0xff;\n buffer[index + 1] = (size >> 8) & 0xff;\n buffer[index + 2] = (size >> 16) & 0xff;\n buffer[index + 3] = (size >> 24) & 0xff;\n // Update index\n index = index + 4 + size - 1;\n // Write zero\n buffer[index++] = 0;\n }\n\n return index;\n}\n\nvar serializeBinary = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_BINARY;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Extract the buffer\n var data = value.value(true);\n // Calculate size\n var size = value.position;\n // Add the deprecated 02 type 4 bytes of size to total\n if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) size = size + 4;\n // Write the size of the string to buffer\n buffer[index++] = size & 0xff;\n buffer[index++] = (size >> 8) & 0xff;\n buffer[index++] = (size >> 16) & 0xff;\n buffer[index++] = (size >> 24) & 0xff;\n // Write the subtype to the buffer\n buffer[index++] = value.sub_type;\n\n // If we have binary type 2 the 4 first bytes are the size\n if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) {\n size = size - 4;\n buffer[index++] = size & 0xff;\n buffer[index++] = (size >> 8) & 0xff;\n buffer[index++] = (size >> 16) & 0xff;\n buffer[index++] = (size >> 24) & 0xff;\n }\n\n // Write the data to the object\n data.copy(buffer, index, 0, value.position);\n // Adjust the index\n index = index + value.position;\n return index;\n}\n\nvar serializeSymbol = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_SYMBOL;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the string\n var size = buffer.write(value.value, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = size & 0xff;\n buffer[index + 1] = (size >> 8) & 0xff;\n buffer[index + 2] = (size >> 16) & 0xff;\n buffer[index + 3] = (size >> 24) & 0xff;\n // Update index\n index = index + 4 + size - 1;\n // Write zero\n buffer[index++] = 0x00;\n return index;\n}\n\nvar serializeDBRef = function(buffer, key, value, index, depth, serializeFunctions, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_OBJECT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n var startIndex = index;\n var endIndex;\n\n // Serialize object\n if(null != value.db) {\n endIndex = serializeInto(buffer, {\n '$ref': value.namespace\n , '$id' : value.oid\n , '$db' : value.db\n }, false, index, depth + 1, serializeFunctions);\n } else {\n endIndex = serializeInto(buffer, {\n '$ref': value.namespace\n , '$id' : value.oid\n }, false, index, depth + 1, serializeFunctions);\n }\n\n // Calculate object size\n var size = endIndex - startIndex;\n // Write the size\n buffer[startIndex++] = size & 0xff;\n buffer[startIndex++] = (size >> 8) & 0xff;\n buffer[startIndex++] = (size >> 16) & 0xff;\n buffer[startIndex++] = (size >> 24) & 0xff;\n // Set index\n return endIndex;\n}\n\nvar serializeInto = function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializeFunctions, ignoreUndefined, path) {\n startingIndex = startingIndex || 0;\n path = path || [];\n\n // Push the object to the path\n path.push(object);\n\n // Start place to serialize into\n var index = startingIndex + 4;\n var self = this;\n\n // Special case isArray\n if(Array.isArray(object)) {\n // Get object keys\n for(var i = 0; i < object.length; i++) {\n var key = \"\" + i;\n var value = object[i];\n\n // Is there an override value\n if(value && value.toBSON) {\n if(typeof value.toBSON != 'function') throw new Error(\"toBSON is not a function\");\n value = value.toBSON();\n }\n\n var type = typeof value;\n if(type == 'string') {\n index = serializeString(buffer, key, value, index, true);\n } else if(type == 'number') {\n index = serializeNumber(buffer, key, value, index, true);\n } else if(type == 'boolean') {\n index = serializeBoolean(buffer, key, value, index, true);\n } else if(value instanceof Date || isDate(value)) {\n index = serializeDate(buffer, key, value, index, true);\n } else if(value === undefined) {\n index = serializeNull(buffer, key, value, index, true);\n } else if(value === null) {\n index = serializeNull(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'ObjectID') {\n index = serializeObjectId(buffer, key, value, index, true);\n } else if(Buffer.isBuffer(value)) {\n index = serializeBuffer(buffer, key, value, index, true);\n } else if(value instanceof RegExp || isRegExp(value)) {\n index = serializeRegExp(buffer, key, value, index, true);\n } else if(type == 'object' && value['_bsontype'] == null) {\n index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, true, path);\n } else if(type == 'object' && value['_bsontype'] == 'Decimal128') {\n index = serializeDecimal128(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {\n index = serializeLong(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'Double') {\n index = serializeDouble(buffer, key, value, index, true);\n } else if(typeof value == 'function' && serializeFunctions) {\n index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions, true);\n } else if(value['_bsontype'] == 'Code') {\n index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, true);\n } else if(value['_bsontype'] == 'Binary') {\n index = serializeBinary(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'Symbol') {\n index = serializeSymbol(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'DBRef') {\n index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, true);\n } else if(value['_bsontype'] == 'BSONRegExp') {\n index = serializeBSONRegExp(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'Int32') {\n index = serializeInt32(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n index = serializeMinMax(buffer, key, value, index, true);\n }\n }\n } else if(object instanceof Map) {\n var iterator = object.entries();\n var done = false;\n\n while(!done) {\n // Unpack the next entry\n var entry = iterator.next();\n done = entry.done;\n // Are we done, then skip and terminate\n if(done) continue;\n\n // Get the entry values\n var key = entry.value[0];\n var value = entry.value[1];\n\n // Check the type of the value\n var type = typeof value;\n\n // Check the key and throw error if it's illegal\n if(key != '$db' && key != '$ref' && key != '$id') {\n if (key.match(regexp) != null) {\n // The BSON spec doesn't allow keys with null bytes because keys are\n // null-terminated.\n throw Error(\"key \" + key + \" must not contain null bytes\");\n }\n\n if (checkKeys) {\n if('$' == key[0]) {\n throw Error(\"key \" + key + \" must not start with '$'\");\n } else if (!!~key.indexOf('.')) {\n throw Error(\"key \" + key + \" must not contain '.'\");\n }\n }\n }\n\n if(type == 'string') {\n index = serializeString(buffer, key, value, index);\n } else if(type == 'number') {\n index = serializeNumber(buffer, key, value, index);\n } else if(type == 'boolean') {\n index = serializeBoolean(buffer, key, value, index);\n } else if(value instanceof Date || isDate(value)) {\n index = serializeDate(buffer, key, value, index);\n } else if(value === undefined && ignoreUndefined == true) {\n } else if(value === null || value === undefined) {\n index = serializeNull(buffer, key, value, index);\n } else if(value['_bsontype'] == 'ObjectID') {\n index = serializeObjectId(buffer, key, value, index);\n } else if(Buffer.isBuffer(value)) {\n index = serializeBuffer(buffer, key, value, index);\n } else if(value instanceof RegExp || isRegExp(value)) {\n index = serializeRegExp(buffer, key, value, index);\n } else if(type == 'object' && value['_bsontype'] == null) {\n index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, false, path);\n } else if(type == 'object' && value['_bsontype'] == 'Decimal128') {\n index = serializeDecimal128(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {\n index = serializeLong(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Double') {\n index = serializeDouble(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Code') {\n index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined);\n } else if(typeof value == 'function' && serializeFunctions) {\n index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions);\n } else if(value['_bsontype'] == 'Binary') {\n index = serializeBinary(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Symbol') {\n index = serializeSymbol(buffer, key, value, index);\n } else if(value['_bsontype'] == 'DBRef') {\n index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions);\n } else if(value['_bsontype'] == 'BSONRegExp') {\n index = serializeBSONRegExp(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Int32') {\n index = serializeInt32(buffer, key, value, index);\n } else if(value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n index = serializeMinMax(buffer, key, value, index);\n }\n }\n } else {\n // Did we provide a custom serialization method\n if(object.toBSON) {\n if(typeof object.toBSON != 'function') throw new Error(\"toBSON is not a function\");\n object = object.toBSON();\n if(object != null && typeof object != 'object') throw new Error(\"toBSON function did not return an object\");\n }\n\n // Iterate over all the keys\n for(var key in object) {\n var value = object[key];\n // Is there an override value\n if(value && value.toBSON) {\n if(typeof value.toBSON != 'function') throw new Error(\"toBSON is not a function\");\n value = value.toBSON();\n }\n\n // Check the type of the value\n var type = typeof value;\n\n // Check the key and throw error if it's illegal\n if(key != '$db' && key != '$ref' && key != '$id') {\n if (key.match(regexp) != null) {\n // The BSON spec doesn't allow keys with null bytes because keys are\n // null-terminated.\n throw Error(\"key \" + key + \" must not contain null bytes\");\n }\n\n if (checkKeys) {\n if('$' == key[0]) {\n throw Error(\"key \" + key + \" must not start with '$'\");\n } else if (!!~key.indexOf('.')) {\n throw Error(\"key \" + key + \" must not contain '.'\");\n }\n }\n }\n\n if(type == 'string') {\n index = serializeString(buffer, key, value, index);\n } else if(type == 'number') {\n index = serializeNumber(buffer, key, value, index);\n } else if(type == 'boolean') {\n index = serializeBoolean(buffer, key, value, index);\n } else if(value instanceof Date || isDate(value)) {\n index = serializeDate(buffer, key, value, index);\n } else if(value === undefined && ignoreUndefined == true) {\n } else if(value === null || value === undefined) {\n index = serializeNull(buffer, key, value, index);\n } else if(value['_bsontype'] == 'ObjectID') {\n index = serializeObjectId(buffer, key, value, index);\n } else if(Buffer.isBuffer(value)) {\n index = serializeBuffer(buffer, key, value, index);\n } else if(value instanceof RegExp || isRegExp(value)) {\n index = serializeRegExp(buffer, key, value, index);\n } else if(type == 'object' && value['_bsontype'] == null) {\n index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, false, path);\n } else if(type == 'object' && value['_bsontype'] == 'Decimal128') {\n index = serializeDecimal128(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {\n index = serializeLong(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Double') {\n index = serializeDouble(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Code') {\n index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined);\n } else if(typeof value == 'function' && serializeFunctions) {\n index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions);\n } else if(value['_bsontype'] == 'Binary') {\n index = serializeBinary(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Symbol') {\n index = serializeSymbol(buffer, key, value, index);\n } else if(value['_bsontype'] == 'DBRef') {\n index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions);\n } else if(value['_bsontype'] == 'BSONRegExp') {\n index = serializeBSONRegExp(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Int32') {\n index = serializeInt32(buffer, key, value, index);\n } else if(value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n index = serializeMinMax(buffer, key, value, index);\n }\n }\n }\n\n // Remove the path\n path.pop();\n\n // Final padding byte for object\n buffer[index++] = 0x00;\n\n // Final size\n var size = index - startingIndex;\n // Write the size of the object\n buffer[startingIndex++] = size & 0xff;\n buffer[startingIndex++] = (size >> 8) & 0xff;\n buffer[startingIndex++] = (size >> 16) & 0xff;\n buffer[startingIndex++] = (size >> 24) & 0xff;\n return index;\n}\n\nvar BSON = {};\n\n/**\n * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5\n *\n * @ignore\n * @api private\n */\nvar functionCache = BSON.functionCache = {};\n\n/**\n * Number BSON Type\n *\n * @classconstant BSON_DATA_NUMBER\n **/\nBSON.BSON_DATA_NUMBER = 1;\n/**\n * String BSON Type\n *\n * @classconstant BSON_DATA_STRING\n **/\nBSON.BSON_DATA_STRING = 2;\n/**\n * Object BSON Type\n *\n * @classconstant BSON_DATA_OBJECT\n **/\nBSON.BSON_DATA_OBJECT = 3;\n/**\n * Array BSON Type\n *\n * @classconstant BSON_DATA_ARRAY\n **/\nBSON.BSON_DATA_ARRAY = 4;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_BINARY\n **/\nBSON.BSON_DATA_BINARY = 5;\n/**\n * ObjectID BSON Type, deprecated\n *\n * @classconstant BSON_DATA_UNDEFINED\n **/\nBSON.BSON_DATA_UNDEFINED = 6;\n/**\n * ObjectID BSON Type\n *\n * @classconstant BSON_DATA_OID\n **/\nBSON.BSON_DATA_OID = 7;\n/**\n * Boolean BSON Type\n *\n * @classconstant BSON_DATA_BOOLEAN\n **/\nBSON.BSON_DATA_BOOLEAN = 8;\n/**\n * Date BSON Type\n *\n * @classconstant BSON_DATA_DATE\n **/\nBSON.BSON_DATA_DATE = 9;\n/**\n * null BSON Type\n *\n * @classconstant BSON_DATA_NULL\n **/\nBSON.BSON_DATA_NULL = 10;\n/**\n * RegExp BSON Type\n *\n * @classconstant BSON_DATA_REGEXP\n **/\nBSON.BSON_DATA_REGEXP = 11;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_CODE\n **/\nBSON.BSON_DATA_CODE = 13;\n/**\n * Symbol BSON Type\n *\n * @classconstant BSON_DATA_SYMBOL\n **/\nBSON.BSON_DATA_SYMBOL = 14;\n/**\n * Code with Scope BSON Type\n *\n * @classconstant BSON_DATA_CODE_W_SCOPE\n **/\nBSON.BSON_DATA_CODE_W_SCOPE = 15;\n/**\n * 32 bit Integer BSON Type\n *\n * @classconstant BSON_DATA_INT\n **/\nBSON.BSON_DATA_INT = 16;\n/**\n * Timestamp BSON Type\n *\n * @classconstant BSON_DATA_TIMESTAMP\n **/\nBSON.BSON_DATA_TIMESTAMP = 17;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_LONG\n **/\nBSON.BSON_DATA_LONG = 18;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_DECIMAL128\n **/\nBSON.BSON_DATA_DECIMAL128 = 19;\n/**\n * MinKey BSON Type\n *\n * @classconstant BSON_DATA_MIN_KEY\n **/\nBSON.BSON_DATA_MIN_KEY = 0xff;\n/**\n * MaxKey BSON Type\n *\n * @classconstant BSON_DATA_MAX_KEY\n **/\nBSON.BSON_DATA_MAX_KEY = 0x7f;\n/**\n * Binary Default Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_DEFAULT\n **/\nBSON.BSON_BINARY_SUBTYPE_DEFAULT = 0;\n/**\n * Binary Function Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_FUNCTION\n **/\nBSON.BSON_BINARY_SUBTYPE_FUNCTION = 1;\n/**\n * Binary Byte Array Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY\n **/\nBSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;\n/**\n * Binary UUID Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_UUID\n **/\nBSON.BSON_BINARY_SUBTYPE_UUID = 3;\n/**\n * Binary MD5 Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_MD5\n **/\nBSON.BSON_BINARY_SUBTYPE_MD5 = 4;\n/**\n * Binary User Defined Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED\n **/\nBSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128;\n\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\nBSON.BSON_INT64_MAX = Math.pow(2, 63) - 1;\nBSON.BSON_INT64_MIN = -Math.pow(2, 63);\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\n// Internal long versions\nvar JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double.\nvar JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double.\n\nmodule.exports = serializeInto;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/parser/serializer.js","/* global window, document, fetch */\n\nimport { createStorage } from './storage';\nimport { createProviders } from './providers';\nimport { StitchError } from '../errors';\nimport * as authCommon from './common';\nimport * as common from '../common';\n\nconst jwtDecode = require('jwt-decode');\n\nconst EMBEDDED_USER_AUTH_DATA_PARTS = 4;\n\nexport default class Auth {\n constructor(client, rootUrl, options) {\n options = Object.assign({}, {\n storageType: 'localStorage',\n codec: authCommon.APP_CLIENT_CODEC\n }, options);\n\n this.client = client;\n this.rootUrl = rootUrl;\n this.codec = options.codec;\n this.storage = createStorage(options.storageType);\n this.providers = createProviders(this);\n }\n\n provider(name) {\n if (!this.providers.hasOwnProperty(name)) {\n throw new Error('Invalid auth provider specified: ' + name);\n }\n\n return this.providers[name];\n }\n\n refreshToken() {\n if (this.isImpersonatingUser()) {\n return this.refreshImpersonation(this.client);\n }\n\n return this.client.doSessionPost().then(json => this.set(json));\n }\n\n pageRootUrl() {\n return [window.location.protocol, '//', window.location.host, window.location.pathname].join('');\n }\n\n error() {\n return this._error;\n }\n\n isAppClient() {\n if (!this.client) {\n return true; // Handle the case where Auth is constructed with null\n }\n return this.client.type === common.APP_CLIENT_TYPE;\n }\n\n handleRedirect() {\n if (typeof (window) === 'undefined') {\n // This means we're running in some environment other\n // than a browser - so handling a redirect makes no sense here.\n return;\n }\n if (!window.location || !window.location.hash) {\n return;\n }\n\n let ourState = this.storage.get(authCommon.STATE_KEY);\n let redirectFragment = window.location.hash.substring(1);\n const redirectState = this.parseRedirectFragment(redirectFragment, ourState);\n if (redirectState.lastError) {\n console.error(`StitchClient: error from redirect: ${redirectState.lastError}`);\n this._error = redirectState.lastError;\n window.history.replaceState(null, '', this.pageRootUrl());\n return;\n }\n\n if (!redirectState.found) {\n return;\n }\n\n this.storage.remove(authCommon.STATE_KEY);\n if (!redirectState.stateValid) {\n console.error('StitchClient: state values did not match!');\n window.history.replaceState(null, '', this.pageRootUrl());\n return;\n }\n\n if (!redirectState.ua) {\n console.error('StitchClient: no UA value was returned from redirect!');\n return;\n }\n\n // If we get here, the state is valid - set auth appropriately.\n this.set(redirectState.ua);\n window.history.replaceState(null, '', this.pageRootUrl());\n }\n\n getCookie(name) {\n let splitCookies = document.cookie.split(' ');\n for (let i = 0; i < splitCookies.length; i++) {\n let cookie = splitCookies[i];\n let sepIdx = cookie.indexOf('=');\n let cookieName = cookie.substring(0, sepIdx);\n if (cookieName === name) {\n let cookieVal = cookie.substring(sepIdx + 1, cookie.length);\n if (cookieVal[cookieVal.length - 1] === ';') {\n return cookieVal.substring(0, cookie.length - 1);\n }\n return cookieVal;\n }\n }\n }\n\n handleCookie() {\n if (typeof (window) === 'undefined' || typeof (document) === 'undefined') {\n // This means we're running in some environment other\n // than a browser - so handling a cookie makes no sense here.\n return;\n }\n if (!document.cookie) {\n return;\n }\n\n let uaCookie = this.getCookie(authCommon.USER_AUTH_COOKIE_NAME);\n if (!uaCookie) {\n return;\n }\n\n document.cookie = `${authCommon.USER_AUTH_COOKIE_NAME}=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT;`;\n const userAuth = this.unmarshallUserAuth(uaCookie);\n this.set(userAuth);\n window.history.replaceState(null, '', this.pageRootUrl());\n }\n\n clear() {\n this.storage.remove(authCommon.USER_AUTH_KEY);\n this.storage.remove(authCommon.REFRESH_TOKEN_KEY);\n this.clearImpersonation();\n }\n\n getDeviceId() {\n return this.storage.get(authCommon.DEVICE_ID_KEY);\n }\n\n // Returns whether or not the access token is expired or is going to expire within 'withinSeconds'\n // seconds, according to current system time. Returns false if the token is malformed in any way.\n isAccessTokenExpired(withinSeconds = authCommon.DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS) {\n let token = this.getAccessToken();\n if (!token) {\n return false;\n }\n\n let decodedToken;\n try {\n decodedToken = jwtDecode(token);\n } catch (e) {\n return false;\n }\n\n if (!decodedToken) {\n return false;\n }\n\n return decodedToken.exp && Math.floor(Date.now() / 1000) >= decodedToken.exp - withinSeconds;\n }\n\n getAccessToken() {\n return this._get().accessToken;\n }\n\n getRefreshToken() {\n return this.storage.get(authCommon.REFRESH_TOKEN_KEY);\n }\n\n set(json) {\n if (!json) {\n return;\n }\n\n if (json[this.codec.refreshToken]) {\n let rt = json[this.codec.refreshToken];\n delete json[this.codec.refreshToken];\n this.storage.set(authCommon.REFRESH_TOKEN_KEY, rt);\n }\n\n if (json[this.codec.deviceId]) {\n const deviceId = json[this.codec.deviceId];\n delete json[this.codec.deviceId];\n this.storage.set(authCommon.DEVICE_ID_KEY, deviceId);\n }\n\n // Merge in new fields with old fields. Typically the first json value\n // is complete with every field inside a user auth, but subsequent requests\n // do not include everything. This merging behavior is safe so long as json\n // value responses with absent fields do not indicate that the field should\n // be unset.\n let newUserAuth = {};\n if (json[this.codec.accessToken]) {\n newUserAuth.accessToken = json[this.codec.accessToken];\n }\n if (json[this.codec.userId]) {\n newUserAuth.userId = json[this.codec.userId];\n }\n newUserAuth = Object.assign(this._get(), newUserAuth);\n this.storage.set(authCommon.USER_AUTH_KEY, JSON.stringify(newUserAuth));\n }\n\n _get() {\n const data = this.storage.get(authCommon.USER_AUTH_KEY);\n if (!data) {\n return {};\n }\n\n try {\n return JSON.parse(data);\n } catch (e) {\n // Need to back out and clear auth otherwise we will never\n // be able to do anything useful.\n this.clear();\n throw new StitchError('Failure retrieving stored auth');\n }\n }\n\n authedId() {\n return this._get().userId;\n }\n\n isImpersonatingUser() {\n return this.storage.get(authCommon.IMPERSONATION_ACTIVE_KEY) === 'true';\n }\n\n refreshImpersonation(client) {\n let userId = this.storage.get(authCommon.IMPERSONATION_USER_KEY);\n return client._do(`/admin/users/${userId}/impersonate`, 'POST', { refreshOnFailure: false, useRefreshToken: true })\n .then(response => response.json())\n .then(json => this.set(json))\n .catch(e => {\n this.stopImpersonation();\n throw e; // rethrow\n });\n }\n\n startImpersonation(client, userId) {\n if (!this.authedId()) {\n return Promise.reject(new StitchError('Must auth first'));\n }\n\n if (this.isImpersonatingUser()) {\n return Promise.reject(new StitchError('Already impersonating a user'));\n }\n\n this.storage.set(authCommon.IMPERSONATION_ACTIVE_KEY, 'true');\n this.storage.set(authCommon.IMPERSONATION_USER_KEY, userId);\n\n let realUserAuth = JSON.parse(this.storage.get(authCommon.USER_AUTH_KEY));\n this.storage.set(authCommon.IMPERSONATION_REAL_USER_AUTH_KEY, JSON.stringify(realUserAuth));\n return this.refreshImpersonation(client);\n }\n\n stopImpersonation() {\n if (!this.isImpersonatingUser()) {\n throw new StitchError('Not impersonating a user');\n }\n\n return new Promise((resolve, reject) => {\n let realUserAuth = JSON.parse(this.storage.get(authCommon.IMPERSONATION_REAL_USER_AUTH_KEY));\n this.set(realUserAuth);\n this.clearImpersonation();\n resolve();\n });\n }\n\n clearImpersonation() {\n this.storage.remove(authCommon.IMPERSONATION_ACTIVE_KEY);\n this.storage.remove(authCommon.IMPERSONATION_USER_KEY);\n this.storage.remove(authCommon.IMPERSONATION_REAL_USER_AUTH_KEY);\n }\n\n parseRedirectFragment(fragment, ourState) {\n // After being redirected from oauth, the URL will look like:\n // https://todo.examples.stitch.mongodb.com/#_stitch_state=...&_stitch_ua=...\n // This function parses out stitch-specific tokens from the fragment and\n // builds an object describing the result.\n const vars = fragment.split('&');\n const result = { ua: null, found: false, stateValid: false, lastError: null };\n let shouldBreak = false;\n for (let i = 0; i < vars.length && !shouldBreak; ++i) {\n const pairParts = vars[i].split('=');\n const pairKey = decodeURIComponent(pairParts[0]);\n switch (pairKey) {\n case authCommon.STITCH_ERROR_KEY:\n result.lastError = decodeURIComponent(pairParts[1]);\n result.found = true;\n shouldBreak = true;\n break;\n case authCommon.USER_AUTH_KEY:\n try {\n result.ua = this.unmarshallUserAuth(decodeURIComponent(pairParts[1]));\n result.found = true;\n } catch (e) {\n result.lastError = e;\n }\n continue;\n case authCommon.STITCH_LINK_KEY:\n result.found = true;\n continue;\n case authCommon.STATE_KEY:\n result.found = true;\n let theirState = decodeURIComponent(pairParts[1]);\n if (ourState && ourState === theirState) {\n result.stateValid = true;\n }\n continue;\n default: continue;\n }\n }\n\n return result;\n }\n\n unmarshallUserAuth(data) {\n let parts = data.split('$');\n if (parts.length !== EMBEDDED_USER_AUTH_DATA_PARTS) {\n throw new RangeError('invalid user auth data provided: ' + data);\n }\n\n return {\n [this.codec.accessToken]: parts[0],\n [this.codec.refreshToken]: parts[1],\n [this.codec.userId]: parts[2],\n [this.codec.deviceId]: parts[3]\n };\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/auth/index.js","/** @module auth */\nimport * as common from '../common';\nimport * as authCommon from './common';\nimport { getPlatform, uriEncodeObject } from '../util';\n\n/**\n * Create the device info for this client.\n *\n * @memberof module:auth\n * @method getDeviceInfo\n * @param {String} appId The app ID for this client\n * @param {String} appVersion The version of the app\n * @returns {Object} The device info object\n */\nfunction getDeviceInfo(deviceId, appId, appVersion = '') {\n const deviceInfo = { appId, appVersion, sdkVersion: common.SDK_VERSION };\n\n if (deviceId) {\n deviceInfo.deviceId = deviceId;\n }\n\n const platform = getPlatform();\n\n if (platform) {\n deviceInfo.platform = platform.name;\n deviceInfo.platformVersion = platform.version;\n }\n\n return deviceInfo;\n}\n\n/**\n * @namespace\n */\nfunction anonProvider(auth) {\n return {\n /**\n * Login to a stitch application using anonymous authentication\n *\n * @memberof anonProvider\n * @instance\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: () => {\n const device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID);\n const fetchArgs = common.makeFetchArgs('GET');\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/providers/anon-user/login?device=${uriEncodeObject(device)}`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json));\n }\n };\n}\n\n/**\n * @namespace\n */\nfunction customProvider(auth) {\n const providerRoute = 'providers/custom-token';\n const loginRoute = `${providerRoute}/login`;\n\n return {\n /**\n * Login to a stitch application using custom authentication\n *\n * @memberof customProvider\n * @instance\n * @param {String} JWT token to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: (token) => {\n const device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID);\n\n const fetchArgs = common.makeFetchArgs(\n 'POST',\n JSON.stringify({ token, options: { device } })\n );\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${loginRoute}`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json));\n }\n };\n}\n\n/** @namespace */\nfunction userPassProvider(auth) {\n // The ternary expression here is redundant but is just preserving previous behavior based on whether or not\n // the client is for the admin or client API.\n const providerRoute = auth.isAppClient() ? 'providers/local-userpass' : 'providers/local-userpass';\n const loginRoute = auth.isAppClient() ? `${providerRoute}/login` : `${providerRoute}/login`;\n\n return {\n /**\n * Login to a stitch application using username and password authentication\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} username the username to use for authentication\n * @param {String} password the password to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: ({ username, password }) => {\n const device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID);\n\n const fetchArgs = common.makeFetchArgs(\n 'POST',\n JSON.stringify({ username, password, options: { device } })\n );\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${loginRoute}`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json));\n },\n\n /**\n * Completes the confirmation workflow from the stitch server\n * @memberof userPassProvider\n * @instance\n * @param {String} tokenId the tokenId provided by the stitch server\n * @param {String} token the token provided by the stitch server\n * @returns {Promise}\n */\n emailConfirm: (tokenId, token) => {\n const fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ tokenId, token }));\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${providerRoute}/confirm`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json());\n },\n\n /**\n * Request that the stitch server send another email confirmation\n * for account creation.\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} email the email to send a confirmation email for\n * @returns {Promise}\n */\n sendEmailConfirm: (email) => {\n const fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email }));\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${providerRoute}/confirm/send`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json());\n },\n\n /**\n * Sends a password reset request to the stitch server\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} email the email of the account to reset the password for\n * @returns {Promise}\n */\n sendPasswordReset: (email) => {\n const fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email }));\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${providerRoute}/reset/send`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json());\n },\n\n /**\n * Use information returned from the stitch server to complete the password\n * reset flow for a given email account, providing a new password for the account.\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} tokenId the tokenId provided by the stitch server\n * @param {String} token the token provided by the stitch server\n * @param {String} password the new password requested for this account\n * @returns {Promise}\n */\n passwordReset: (tokenId, token, password) => {\n const fetchArgs =\n common.makeFetchArgs('POST', JSON.stringify({ tokenId, token, password }));\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${providerRoute}/reset`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json());\n },\n\n\n /**\n * Will trigger an email to the requested account containing a link with the\n * token and tokenId that must be returned to the server using emailConfirm()\n * to activate the account.\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} email the requested email for the account\n * @param {String} password the requested password for the account\n * @returns {Promise}\n */\n register: (email, password) => {\n const fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email, password }));\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${providerRoute}/register`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json());\n }\n };\n}\n\n/** @namespace */\nfunction apiKeyProvider(auth) {\n // The ternary expression here is redundant but is just preserving previous behavior based on whether or not\n // the client is for the admin or client API.\n const loginRoute = auth.isAppClient() ? 'providers/api-key/login' : 'providers/api-key/login';\n\n return {\n /**\n * Login to a stitch application using an api key\n *\n * @memberof apiKeyProvider\n * @instance\n * @param {String} key the key for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: key => {\n const device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID);\n const fetchArgs = common.makeFetchArgs(\n 'POST',\n JSON.stringify({ 'key': key, 'options': { device } })\n );\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${loginRoute}`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json));\n }\n };\n}\n\n// The state we generate is to be used for any kind of request where we will\n// complete an authentication flow via a redirect. We store the generate in\n// a local storage bound to the app's origin. This ensures that any time we\n// receive a redirect, there must be a state parameter and it must match\n// what we ourselves have generated. This state MUST only be sent to\n// a trusted Stitch endpoint in order to preserve its integrity. Stitch will\n// store it in some way on its origin (currently a cookie stored on this client)\n// and use that state at the end of an auth flow as a parameter in the redirect URI.\nconst alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\nfunction generateState() {\n let state = '';\n for (let i = 0; i < 64; ++i) {\n state += alpha.charAt(Math.floor(Math.random() * alpha.length));\n }\n\n return state;\n}\n\nfunction getOAuthLoginURL(auth, providerName, redirectUrl) {\n if (redirectUrl === undefined) {\n redirectUrl = auth.pageRootUrl();\n }\n\n const state = generateState();\n auth.storage.set(authCommon.STATE_KEY, state);\n\n const device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID);\n\n const result = `${auth.rootUrl}/providers/oauth2-${providerName}/login?redirect=${encodeURI(redirectUrl)}&state=${state}&device=${uriEncodeObject(device)}`;\n return result;\n}\n\n/** @namespace */\nfunction googleProvider(auth) {\n return {\n /**\n * Login to a stitch application using google authentication\n *\n * @memberof googleProvider\n * @instance\n * @param {Object} data the redirectUrl data to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: data => {\n const redirectUrl = (data && data.redirectUrl) ? data.redirectUrl : undefined;\n window.location.replace(getOAuthLoginURL(auth, 'google', redirectUrl));\n return Promise.resolve();\n }\n };\n}\n\n/** @namespace */\nfunction facebookProvider(auth) {\n return {\n /**\n * Login to a stitch application using facebook authentication\n *\n * @memberof facebookProvider\n * @instance\n * @param {Object} data the redirectUrl data to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: data => {\n const redirectUrl = (data && data.redirectUrl) ? data.redirectUrl : undefined;\n window.location.replace(getOAuthLoginURL(auth, 'facebook', redirectUrl));\n return Promise.resolve();\n }\n };\n}\n\n/** @namespace */\nfunction mongodbCloudProvider(auth) {\n // The ternary expression here is redundant but is just preserving previous behavior based on whether or not\n // the client is for the admin or client API.\n const loginRoute = auth.isAppClient() ? 'providers/mongodb-cloud/login' : 'providers/mongodb-cloud/login';\n\n return {\n /**\n * Login to a stitch application using mongodb cloud authentication\n *\n * @memberof mongodbCloudProvider\n * @instance\n * @param {Object} data the username, apiKey, cors, and cookie data to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: data => {\n const { username, apiKey, cors, cookie } = data;\n const options = Object.assign({}, { cors: true, cookie: false }, { cors: cors, cookie: cookie });\n const device = getDeviceInfo(auth.getDeviceId(), !!auth.client && auth.client.clientAppID);\n const fetchArgs = common.makeFetchArgs(\n 'POST',\n JSON.stringify({ username, apiKey, options: { device } })\n );\n fetchArgs.cors = true; // TODO: shouldn't this use the passed in `cors` value?\n fetchArgs.credentials = 'include';\n\n let url = `${auth.rootUrl}/${loginRoute}`;\n if (options.cookie) {\n return fetch(url + '?cookie=true', fetchArgs)\n .then(common.checkStatus);\n }\n\n return fetch(url, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json));\n }\n };\n}\n\n// TODO: support auth-specific options\nfunction createProviders(auth, options = {}) {\n return {\n anon: anonProvider(auth),\n apiKey: apiKeyProvider(auth),\n google: googleProvider(auth),\n facebook: facebookProvider(auth),\n mongodbCloud: mongodbCloudProvider(auth),\n userpass: userPassProvider(auth),\n custom: customProvider(auth)\n };\n}\n\nexport { createProviders };\n\n\n\n// WEBPACK FOOTER //\n// ./src/auth/providers.js","class MemoryStorage {\n constructor() {\n this._data = {};\n }\n\n getItem(key) {\n return (key in this._data) ? this._data[key] : null;\n }\n\n setItem(key, value) {\n this._data[key] = value;\n return this._data[key];\n }\n\n removeItem(key) {\n delete this._data[key];\n return undefined;\n }\n\n clear() {\n this._data = {};\n return this._data;\n }\n}\n\nclass Storage {\n constructor(store) {\n this.store = store;\n }\n\n get(key) { return this.store.getItem(key); }\n set(key, value) { return this.store.setItem(key, value); }\n remove(key) { return this.store.removeItem(key); }\n clear() { return this.store.clear(); }\n}\n\nexport function createStorage(type) {\n if (type === 'localStorage') {\n if ((typeof window !== 'undefined') && 'localStorage' in window && window.localStorage !== null) {\n return new Storage(window.localStorage);\n }\n } else if (type === 'sessionStorage') {\n if ((typeof window !== 'undefined') && 'sessionStorage' in window && window.sessionStorage !== null) {\n return new Storage(window.sessionStorage);\n }\n }\n\n // default to memory storage\n return new Storage(new MemoryStorage());\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/auth/storage.js","import StitchClient from './client';\nimport Admin from './admin';\n\nexport {\n StitchClient,\n Admin\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js","import { serviceResponse } from '../../util';\n\n/**\n * Convenience wrapper around AWS S3 service (not meant to be instantiated directly).\n *\n * @class\n * @return {S3Service} a S3Service instance.\n */\nclass S3Service {\n constructor(stitchClient, serviceName) {\n this.client = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Put an object to S3 via Stitch. For small uploads\n *\n * NOTE: body must be a pipeline stream\n *\n * @param {String} bucket which S3 bucket to use\n * @param {String} key which key (filename) to use\n * @param {String} acl which policy to apply\n * @param {String} contentType content type of uploaded data\n * @return {Promise}\n */\n put(bucket, key, acl, contentType) {\n return serviceResponse(this, {\n action: 'put',\n args: { bucket, key, acl, contentType }\n });\n }\n\n /**\n * Sign a policy for putting via Stitch. For large uploads\n *\n * @param {String} bucket which S3 bucket to use\n * @param {String} key which key (filename) to use\n * @param {String} acl which policy to apply\n * @param {String} contentType content type of uploaded data\n * @return {Promise}\n */\n signPolicy(bucket, key, acl, contentType) {\n return serviceResponse(this, {\n action: 'signPolicy',\n args: { bucket, key, acl, contentType }\n });\n }\n}\n\nexport default S3Service;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/aws/s3_service.js","import { serviceResponse } from '../../util';\n\n/**\n * Convenience wrapper around AWS SES service (not meant to be instantiated directly).\n *\n * @class\n * @return {SESService} a SESService instance.\n */\nclass SESService {\n constructor(stitchClient, serviceName) {\n this.client = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Send an email\n *\n * @method\n * @param {String} from the email to send from\n * @param {String} to the email to send to\n * @param {String} subject the subject of the email\n * @param {String} body the body of the email\n * @return {Promise}\n */\n send(from, to, subject, body) {\n return serviceResponse(this, {\n action: 'send',\n args: { from, to, subject, body }\n });\n }\n}\n\nexport default SESService;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/aws/ses_service.js","import { serviceResponse } from '../../util';\n\n/**\n * Convenience wrapper for HTTP service (not meant to be instantiated directly).\n *\n * @class\n * @return {HTTPService} a HTTPService instance.\n */\nclass HTTPService {\n constructor(client, serviceName) {\n this.client = client;\n this.serviceName = serviceName;\n }\n\n /**\n * Send a GET request to a resource (result must be application/json)\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of GET args\n * @param {Object} [options] optional settings for the GET operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n get(urlOrOptions, options = {}) {\n return buildResponse('get', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a POST request to a resource with payload\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of POST args\n * @param {Object} [options] optional settings for the POST operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n post(urlOrOptions, options = {}) {\n return buildResponse('post', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a PUT request to a resource with payload\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of PUT args\n * @param {Object} [options] optional settings for the PUT operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n put(urlOrOptions, options = {}) {\n return buildResponse('put', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a PATCH request to a resource with payload\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of PATCH args\n * @param {Object} [options] optional settings for the PATCH operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n patch(urlOrOptions, options = {}) {\n return buildResponse('patch', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a DELETE request to a resource\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of DELETE args\n * @param {Object} [options] optional settings for the DELETE operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n delete(urlOrOptions, options = {}) {\n return buildResponse('delete', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a HEAD request to a resource\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of HEAD args\n * @param {Object} [options] optional settings for the HEAD operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n head(urlOrOptions, options = {}) {\n return buildResponse('head', this, buildArgs(urlOrOptions, options));\n }\n}\n\nfunction buildArgs(urlOrOptions, options) {\n let args;\n if (typeof urlOrOptions !== 'string') {\n args = urlOrOptions;\n } else {\n args = { url: urlOrOptions };\n if (!!options.authUrl) args.authUrl = options.authUrl;\n }\n\n return args;\n}\n\nfunction buildResponse(action, service, args) {\n return serviceResponse(service, {\n action,\n args\n });\n}\n\nexport default HTTPService;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/http/http_service.js","import S3Service from './aws/s3_service';\nimport SESService from './aws/ses_service';\nimport HTTPService from './http/http_service';\nimport MongoDBService from './mongodb/mongodb_service';\nimport TwilioService from './twilio/twilio_service';\n\nexport default {\n 'aws/s3': S3Service,\n 'aws/ses': SESService,\n 'http': HTTPService,\n 'mongodb': MongoDBService,\n 'twilio': TwilioService\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/index.js","import { serviceResponse } from '../../util';\n\n/**\n * Create a new Collection instance (not meant to be instantiated directly).\n *\n * @class\n * @return {Collection} a Collection instance.\n */\nclass Collection {\n constructor(db, name) {\n this.db = db;\n this.name = name;\n }\n\n /**\n * Inserts a single document.\n *\n * @method\n * @param {Object} doc The document to insert.\n * @return {Promise} a Promise for the operation.\n */\n insertOne(doc) {\n const args = { document: doc };\n return buildResponse('insertOne', this, buildArgs(this, args));\n }\n\n /**\n * Inserts multiple documents.\n *\n * @method\n * @param {Array} docs The documents to insert.\n * @return {Promise} Returns a Promise for the operation.\n */\n insertMany(docs) {\n const args = { documents: Array.isArray(docs) ? docs : [ docs ] };\n return buildResponse('insertMany', this, buildArgs(this, args));\n }\n\n /**\n * Deletes a single document.\n *\n * @method\n * @param {Object} query The query used to match a single document.\n * @return {Promise} Returns a Promise for the operation.\n */\n deleteOne(query) {\n return buildResponse('deleteOne', this, buildArgs(this, { query }));\n }\n\n /**\n * Deletes all documents matching query.\n *\n * @method\n * @param {Object} query The query used to match the documents to delete.\n * @return {Promise} Returns a Promise for the operation.\n */\n deleteMany(query) {\n return buildResponse('deleteMany', this, buildArgs(this, { query }));\n }\n\n /**\n * Updates a single document.\n *\n * @method\n * @param {Object} query The query used to match a single document.\n * @param {Object} update The update operations to perform on the matching document.\n * @param {Object} [options] Additional options object.\n * @param {Boolean} [options.upsert=false] Perform an upsert operation.\n * @return {Promise} A Promise for the operation.\n */\n updateOne(query, update, options = {}) {\n return updateOp(this, false, query, update, options);\n }\n\n /**\n * Updates multiple documents.\n *\n * @method\n * @param {Object} query The query used to match the documents.\n * @param {Object} update The update operations to perform on the matching documents.\n * @param {Object} [options] Additional options object.\n * @param {Boolean} [options.upsert=false] Perform an upsert operation.\n * @return {Promise} Returns a Promise for the operation.\n */\n updateMany(query, update) {\n return updateOp(this, true, query, update);\n }\n\n /**\n * Finds documents.\n *\n * @method\n * @param {Object} query The query used to match documents.\n * @param {Object} [project] The query document projection.\n * @return {MongoQuery} An object which allows for `limit` and `sort` parameters to be set.\n * `execute` will return a {Promise} for the operation.\n */\n find(query, project) {\n return new MongoQuery(this, query, project);\n }\n\n /**\n * Executes an aggregation pipeline.\n *\n * @param {Array} pipeline The aggregation pipeline.\n * @returns {Array} The results of the aggregation.\n */\n aggregate(pipeline) {\n return aggregateOp(this, pipeline);\n }\n\n /**\n * Gets the number of documents matching the filter.\n *\n * @param {Object} query The query used to match documents.\n * @param {Object} options Additional count options.\n * @param {Number} [options.limit=null] The maximum number of documents to return.\n * @return {Number} The results of the count operation.\n */\n count(query, options = {}) {\n let outgoingOptions;\n if (options.limit) {\n outgoingOptions = { limit: options.limit };\n }\n\n return buildResponse('count', this, buildArgs(this, { count: true, query }, outgoingOptions));\n }\n}\n\n// private\n\nfunction updateOp(service, isMulti, query, update, options = {}) {\n const action = isMulti ? 'updateMany' : 'updateOne';\n\n let outgoingOptions;\n if (!isMulti && options.upsert) {\n outgoingOptions = { upsert: true };\n }\n\n return buildResponse(action, service, buildArgs(service, { query, update }, outgoingOptions));\n}\n\nfunction findOp({ service, query, project, limit, sort }) {\n return buildResponse('find', service, buildArgs(service, { query, project, limit, sort }));\n}\n\nfunction aggregateOp(service, pipeline) {\n return buildResponse('aggregate', service, buildArgs(service, { pipeline }));\n}\n\nfunction buildArgs({ db: { name: database }, name: collection }, args, options = {}) {\n return Object.assign(\n { database, collection },\n args,\n options\n );\n}\n\nfunction buildResponse(action, service, args) {\n return serviceResponse(service.db, {\n serviceName: service.db.service,\n action,\n args\n });\n}\n\n// mongo query (find) support\n\nfunction MongoQuery(service, query, project) {\n if (this instanceof MongoQuery) {\n this.service = service;\n this.query = query;\n this.project = project;\n return this;\n }\n return new MongoQuery(service, query, project);\n}\n\nMongoQuery.prototype.limit = function(limit) {\n this.limit = limit;\n return this;\n};\n\nMongoQuery.prototype.sort = function(sort) {\n this.sort = sort;\n return this;\n};\n\nMongoQuery.prototype.execute = function(resolve) {\n return findOp(this);\n};\n\nexport default Collection;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/mongodb/collection.js","import Collection from './collection';\n\n/**\n * Create a new DB instance (not meant to be instantiated directly).\n * @class\n * @return {DB} a DB instance.\n */\nclass DB {\n constructor(client, service, name) {\n this.client = client;\n this.service = service;\n this.name = name;\n }\n\n /**\n * Returns a Collection instance representing a MongoDB Collection object.\n *\n * @method\n * @param {String} name The collection name.\n * @param {Object} [options] Additional options.\n * @return {Collection} returns a Collection instance representing a MongoDb collection.\n */\n collection(name, options = {}) {\n return new Collection(this, name, options);\n }\n}\n\nexport default DB;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/mongodb/db.js","import DB from './db';\n\n/**\n * Create a new MongoDBService instance (not meant to be instantiated directly).\n *\n * @class\n * @return {MongoDBService} a MongoDBService instance.\n */\nclass MongoDBService {\n constructor(stitchClient, serviceName) {\n this.stitchClient = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Get a DB instance\n *\n * @method\n * @param {String} databaseName The MongoDB database name\n * @param {Object} [options] Additional options.\n * @return {DB} returns a DB instance representing a MongoDB database.\n */\n db(databaseName, options = {}) {\n return new DB(this.stitchClient, this.serviceName, databaseName);\n }\n}\n\n\nexport default MongoDBService;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/mongodb/mongodb_service.js","import { serviceResponse } from '../../util';\n\n/**\n * Create a new TwilioService instance (not meant to be instantiated directly).\n *\n * @class\n * @return {TwilioService} a TwilioService instance.\n */\nclass TwilioService {\n constructor(stitchClient, serviceName) {\n this.client = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Send a text message to a number\n *\n * @method\n * @param {String} from number to send from\n * @param {String} to number to send to\n * @param {String} body SMS body content\n * @return {Promise}\n */\n send(from, to, body) {\n return serviceResponse(this, {\n action: 'send',\n args: { from, to, body }\n });\n }\n}\n\nexport default TwilioService;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/twilio/twilio_service.js","var ExtJSON = require('./lib/ext_json');\n\nmodule.exports = ExtJSON;\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/index.js","'use strict';\n\n/**\n * Module dependencies.\n * @ignore\n */\nfunction convert(integer) {\n var str = Number(integer).toString(16);\n return str.length === 1 ? '0' + str : str;\n}\n\nfunction toExtendedJSON(obj) {\n var base64String = obj.buffer.toString('base64');\n\n return {\n $binary: {\n base64: base64String,\n subType: convert(obj.sub_type)\n }\n };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n var type = doc.$binary.subType ? parseInt(doc.$binary.subType, 16) : 0;\n\n var data = new Buffer(doc.$binary.base64, 'base64');\n\n return new BSON.Binary(data, type);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/binary.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n if (obj.scope) {\n return { $code: obj.code, $scope: obj.scope };\n }\n\n return { $code: obj.code };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Code(doc.$code, doc.$scope);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/code.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n var o = {\n $ref: obj.collection,\n $id: obj.oid\n };\n if (obj.db) o.$db = obj.db;\n o = Object.assign(o, obj.fields);\n return o;\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n var copy = Object.assign({}, doc);\n ['$ref', '$id', '$db'].forEach(k => delete copy[k]);\n return new BSON.DBRef(doc.$ref, doc.$id, doc.$db, copy);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/db_ref.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n return { $numberDecimal: obj.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Decimal128.fromString(doc.$numberDecimal);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/decimal128.js","'use strict';\n\nfunction toExtendedJSON(obj, options) {\n if (options.relaxed && isFinite(obj.value)) return obj.value;\n return { $numberDouble: obj.value.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Double(parseFloat(doc.$numberDouble));\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/double.js","'use strict';\n\nvar Binary = require('./binary');\nvar Code = require('./code');\nvar DBRef = require('./db_ref');\nvar Decimal128 = require('./decimal128');\nvar Double = require('./double');\nvar Int32 = require('./int_32');\nvar Long = require('./long');\nvar MaxKey = require('./max_key');\nvar MinKey = require('./min_key');\nvar ObjectID = require('./objectid');\nvar BSONRegExp = require('./regexp');\nvar Symbol = require('./symbol');\nvar Timestamp = require('./timestamp');\n\nmodule.exports = {\n Binary: Binary,\n Code: Code,\n DBRef: DBRef,\n Decimal128: Decimal128,\n Double: Double,\n Int32: Int32,\n Long: Long,\n MaxKey: MaxKey,\n MinKey: MinKey,\n ObjectID: ObjectID,\n BSONRegExp: BSONRegExp,\n Symbol: Symbol,\n Timestamp: Timestamp\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/index.js","'use strict';\n\nfunction toExtendedJSON(obj, options) {\n if (options && options.relaxed) return obj.value;\n return { $numberInt: obj.value.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Int32(doc.$numberInt);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/int_32.js","'use strict';\n\nfunction toExtendedJSON(obj, options) {\n if (options && options.relaxed) return obj.toNumber();\n return { $numberLong: obj.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return BSON.Long.fromString(doc.$numberLong);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/long.js","'use strict';\n\nfunction toExtendedJSON() {\n return { $maxKey: 1 };\n}\n\nfunction fromExtendedJSON(BSON) {\n return new BSON.MaxKey();\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/max_key.js","'use strict';\n\nfunction toExtendedJSON() {\n return { $minKey: 1 };\n}\n\nfunction fromExtendedJSON(BSON) {\n return new BSON.MinKey();\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/min_key.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n if (obj.toHexString) return { $oid: obj.toHexString() };\n return { $oid: obj.toString('hex') };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.ObjectID(doc.$oid);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/objectid.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n return { $regularExpression: { pattern: obj.pattern, options: obj.options } };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.BSONRegExp(\n doc.$regularExpression.pattern,\n doc.$regularExpression.options\n .split('')\n .sort()\n .join('')\n );\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/regexp.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n return { $symbol: obj.value };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Symbol(doc.$symbol);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/symbol.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n return {\n $timestamp: {\n t: obj.high_,\n i: obj.low_\n }\n };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Timestamp(doc.$timestamp.i, doc.$timestamp.t);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/timestamp.js","'use strict';\n\nlet codecs = require('./bson'),\n BSON = require('bson');\n\nvar BSONTypes = [\n 'Binary',\n 'Code',\n 'DBRef',\n 'Decimal128',\n 'Double',\n 'Int32',\n 'Long',\n 'MaxKey',\n 'MinKey',\n 'ObjectID',\n 'BSONRegExp',\n 'Symbol',\n 'Timestamp'\n];\n\nsetBSONModule(BSON);\n\n// all the types where we don't need to do any special processing and can just pass the EJSON\n//straight to type.fromExtendedJSON\nvar keysToCodecs = {\n $oid: codecs.ObjectID,\n $binary: codecs.Binary,\n $symbol: codecs.Symbol,\n $numberDecimal: codecs.Decimal128,\n $numberLong: codecs.Long,\n $minKey: codecs.MinKey,\n $maxKey: codecs.MaxKey,\n $regularExpression: codecs.BSONRegExp,\n $timestamp: codecs.Timestamp\n};\n\nfunction setBSONModule(module) {\n BSONTypes.forEach(t => {\n if (!module[t]) throw new Error('passed in module does not contain all BSON types required');\n });\n BSON = module;\n}\n\nfunction deserializeValue(self, key, value, options) {\n if (typeof value === 'number') {\n // if it's an integer, should interpret as smallest BSON integer\n // that can represent it exactly. (if out of range, interpret as double.)\n if (Math.floor(value) === value) {\n let int32Range = value >= BSON_INT32_MIN && value <= BSON_INT32_MAX,\n int64Range = value >= BSON_INT64_MIN && value <= BSON_INT64_MAX;\n\n if (int32Range) return options.strict ? new BSON.Int32(value) : value;\n if (int64Range) return options.strict ? new BSON.Long.fromNumber(value) : value;\n }\n // If the number is a non-integer or out of integer range, should interpret as BSON Double.\n return new BSON.Double(value);\n }\n\n // from here on out we're looking for bson types, so bail if its not an object\n if (value == null || typeof value !== 'object') return value;\n\n // upgrade deprecated undefined to null\n if (value.$undefined) return null;\n\n var keys = Object.keys(value).filter(k => k.startsWith('$') && value[k] != null);\n for (let i = 0; i < keys.length; i++) {\n let c = keysToCodecs[keys[i]];\n if (c) return c.fromExtendedJSON(BSON, value);\n }\n\n if (value.$date != null) {\n let d = value.$date,\n date = new Date();\n\n if (typeof d === 'string') date.setTime(Date.parse(d));\n else if (d instanceof BSON.Long) date.setTime(d.toNumber());\n return date;\n }\n\n if (value.$code != null) {\n if (value.$scope) var scope = deserializeValue(self, null, value.$scope);\n let copy = Object.assign({}, value);\n copy.$scope = scope;\n return codecs.Code.fromExtendedJSON(BSON, value);\n }\n\n if (value.$numberDouble != null) {\n return options.strict\n ? codecs.Double.fromExtendedJSON(BSON, value)\n : parseFloat(value.$numberDouble);\n }\n\n if (value.$numberInt != null) {\n return options.strict\n ? codecs.Int32.fromExtendedJSON(BSON, value)\n : parseInt(value.$numberInt, 10);\n }\n\n if (value.$ref != null || value.$dbPointer != null) {\n let v = value.$ref ? value : value.$dbPointer;\n\n // we run into this in a \"degenerate EJSON\" case (with $id and $ref order flipped)\n // because of the order JSON.parse goes through the document\n if (v instanceof BSON.DBRef) return v;\n\n let dollarKeys = Object.keys(v).filter(k => k.startsWith('$')),\n valid = true;\n dollarKeys.forEach(k => {\n if (['$ref', '$id', '$db'].indexOf(k) === -1) valid = false;\n });\n\n // only make DBRef if $ keys are all valid\n if (valid) return codecs.DBRef.fromExtendedJSON(BSON, v);\n }\n\n return value;\n}\n\nconst parse = function(text, options) {\n var self = this;\n options = options || { strict: true };\n\n return JSON.parse(text, function(key, value) {\n return deserializeValue(self, key, value, options);\n });\n};\n\n//\n// Serializer\n//\n\n// MAX INT32 boundaries\nconst BSON_INT32_MAX = 0x7fffffff,\n BSON_INT32_MIN = -0x80000000,\n BSON_INT64_MAX = 0x7fffffffffffffff,\n BSON_INT64_MIN = -0x8000000000000000;\n\nconst stringify = function(value, reducer, indents, options) {\n var opts = {};\n if (options != null && typeof options === 'object') opts = options;\n else if (indents != null && typeof indents === 'object') {\n opts = indents;\n indents = 0;\n } else if (reducer != null && typeof reducer === 'object') {\n opts = reducer;\n reducer = null;\n }\n\n var doc = Array.isArray(value) ? serializeArray(value, opts) : serializeDocument(value, opts);\n return JSON.stringify(doc, reducer, indents);\n};\n\nfunction serializeArray(array, options) {\n return array.map(v => serializeValue(v, options));\n}\n\nfunction getISOString(date) {\n var isoStr = date.toISOString();\n // we should only show milliseconds in timestamp if they're non-zero\n return date.getUTCMilliseconds() !== 0 ? isoStr : isoStr.slice(0, -5) + 'Z';\n}\n\nfunction serializeValue(value, options) {\n if (Array.isArray(value)) return serializeArray(value, options);\n\n if (value === undefined) return null;\n\n if (value instanceof Date) {\n let dateNum = value.getTime(),\n // is it in year range 1970-9999?\n inRange = dateNum > -1 && dateNum < 253402318800000;\n\n return options.relaxed && inRange\n ? { $date: getISOString(value) }\n : { $date: { $numberLong: value.getTime().toString() } };\n }\n\n if (typeof value === 'number' && !options.relaxed) {\n // it's an integer\n if (Math.floor(value) === value) {\n let int32Range = value >= BSON_INT32_MIN && value <= BSON_INT32_MAX,\n int64Range = value >= BSON_INT64_MIN && value <= BSON_INT64_MAX;\n\n // interpret as being of the smallest BSON integer type that can represent the number exactly\n if (int32Range) return { $numberInt: value.toString() };\n if (int64Range) return { $numberLong: value.toString() };\n }\n return { $numberDouble: value.toString() };\n }\n\n if (value != null && typeof value === 'object') return serializeDocument(value, options);\n return value;\n}\n\nfunction serializeDocument(doc, options) {\n if (doc == null || typeof doc !== 'object') throw new Error('not an object instance');\n\n // the document itself is a BSON type\n if (doc._bsontype && BSONTypes.indexOf(doc._bsontype) !== -1) {\n // we need to separately serialize the embedded scope document\n if (doc._bsontype === 'Code' && doc.scope) {\n let tempScope = serializeDocument(doc.scope, options),\n tempDoc = Object.assign({}, doc, { scope: tempScope });\n return codecs['Code'].toExtendedJSON(tempDoc, options);\n // we need to separately serialize the embedded OID document\n } else if (doc._bsontype === 'DBRef' && doc.oid) {\n let tempId = serializeDocument(doc.oid, options),\n tempDoc = Object.assign({}, doc, { oid: tempId });\n return codecs['DBRef'].toExtendedJSON(tempDoc, options);\n }\n return codecs[doc._bsontype].toExtendedJSON(doc, options);\n }\n\n // the document is an object with nested BSON types\n var _doc = {};\n for (var name in doc) {\n let val = doc[name];\n if (Array.isArray(val)) {\n _doc[name] = serializeArray(val, options);\n } else if (val != null && val._bsontype && BSONTypes.indexOf(val._bsontype) !== -1) {\n // we need to separately serialize the embedded scope document\n if (val._bsontype === 'Code' && val.scope) {\n let tempScope = serializeDocument(val.scope, options),\n tempVal = Object.assign({}, val, { scope: tempScope });\n _doc[name] = codecs['Code'].toExtendedJSON(tempVal, options);\n // we need to separately serialize the embedded OID document\n } else if (val._bsontype === 'DBRef' && val.oid) {\n let tempId = serializeDocument(val.oid, options),\n tempVal = Object.assign({}, val, { oid: tempId });\n _doc[name] = codecs['DBRef'].toExtendedJSON(tempVal, options);\n } else _doc[name] = codecs[val._bsontype].toExtendedJSON(val, options);\n } else if (val instanceof Date) {\n _doc[name] = serializeValue(val, options);\n } else if (val != null && typeof val === 'object') {\n _doc[name] = serializeDocument(val, options);\n }\n\n _doc[name] = serializeValue(val, options);\n }\n\n return _doc;\n}\n\nmodule.exports = {\n parse: parse,\n stringify: stringify,\n setBSONModule: setBSONModule,\n BSON: BSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/ext_json.js","'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, 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; i < l; i += 4) {\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 = 58\n// module chunks = 0","var detectBrowser = require('./lib/detectBrowser');\n\nvar agent;\n\nif (typeof navigator !== 'undefined' && navigator) {\n agent = navigator.userAgent;\n}\n\nmodule.exports = detectBrowser(agent);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/detect-browser/browser.js\n// module id = 59\n// module chunks = 0","var detectOS = require('./detectOS.js');\n\nmodule.exports = function detectBrowser(userAgentString) {\n if (!userAgentString) return null;\n\n var browsers = [\n [ 'edge', /Edge\\/([0-9\\._]+)/ ],\n [ 'yandexbrowser', /YaBrowser\\/([0-9\\._]+)/ ],\n [ 'vivaldi', /Vivaldi\\/([0-9\\.]+)/ ],\n [ 'kakaotalk', /KAKAOTALK\\s([0-9\\.]+)/ ],\n [ 'chrome', /(?!Chrom.*OPR)Chrom(?:e|ium)\\/([0-9\\.]+)(:?\\s|$)/ ],\n [ 'phantomjs', /PhantomJS\\/([0-9\\.]+)(:?\\s|$)/ ],\n [ 'crios', /CriOS\\/([0-9\\.]+)(:?\\s|$)/ ],\n [ 'firefox', /Firefox\\/([0-9\\.]+)(?:\\s|$)/ ],\n [ 'fxios', /FxiOS\\/([0-9\\.]+)/ ],\n [ 'opera', /Opera\\/([0-9\\.]+)(?:\\s|$)/ ],\n [ 'opera', /OPR\\/([0-9\\.]+)(:?\\s|$)$/ ],\n [ 'ie', /Trident\\/7\\.0.*rv\\:([0-9\\.]+).*\\).*Gecko$/ ],\n [ 'ie', /MSIE\\s([0-9\\.]+);.*Trident\\/[4-7].0/ ],\n [ 'ie', /MSIE\\s(7\\.0)/ ],\n [ 'bb10', /BB10;\\sTouch.*Version\\/([0-9\\.]+)/ ],\n [ 'android', /Android\\s([0-9\\.]+)/ ],\n [ 'ios', /Version\\/([0-9\\._]+).*Mobile.*Safari.*/ ],\n [ 'safari', /Version\\/([0-9\\._]+).*Safari/ ]\n ];\n\n return browsers.map(function (rule) {\n if (rule[1].test(userAgentString)) {\n var match = rule[1].exec(userAgentString);\n var version = match && match[1].split(/[._]/).slice(0,3);\n\n if (version && version.length < 3) {\n Array.prototype.push.apply(version, (version.length == 1) ? [0, 0] : [0]);\n }\n\n return {\n name: rule[0],\n version: version.join('.'),\n os: detectOS(userAgentString)\n };\n }\n }).filter(Boolean).shift();\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/detect-browser/lib/detectBrowser.js\n// module id = 60\n// module chunks = 0","module.exports = function detectOS(userAgentString) {\n var operatingSystems = [\n {\n name: 'iOS',\n rule: /iP(hone|od|ad)/\n },\n {\n name: 'Android OS',\n rule: /Android/\n },\n {\n name: 'BlackBerry OS',\n rule: /BlackBerry|BB10/\n },\n {\n name: 'Windows Mobile',\n rule: /IEMobile/\n },\n {\n name: 'Amazon OS',\n rule: /Kindle/\n },\n {\n name: 'Windows 3.11',\n rule: /Win16/\n },\n {\n name: 'Windows 95',\n rule: /(Windows 95)|(Win95)|(Windows_95)/\n },\n {\n name: 'Windows 98',\n rule: /(Windows 98)|(Win98)/\n },\n {\n name: 'Windows 2000',\n rule: /(Windows NT 5.0)|(Windows 2000)/\n },\n {\n name: 'Windows XP',\n rule: /(Windows NT 5.1)|(Windows XP)/\n },\n {\n name: 'Windows Server 2003',\n rule: /(Windows NT 5.2)/\n },\n {\n name: 'Windows Vista',\n rule: /(Windows NT 6.0)/\n },\n {\n name: 'Windows 7',\n rule: /(Windows NT 6.1)/\n },\n {\n name: 'Windows 8',\n rule: /(Windows NT 6.2)/\n },\n {\n name: 'Windows 8.1',\n rule: /(Windows NT 6.3)/\n },\n {\n name: 'Windows 10',\n rule: /(Windows NT 10.0)/\n },\n {\n name: 'Windows ME',\n rule: /Windows ME/\n },\n {\n name: 'Open BSD',\n rule: /OpenBSD/\n },\n {\n name: 'Sun OS',\n rule: /SunOS/\n },\n {\n name: 'Linux',\n rule: /(Linux)|(X11)/\n },\n {\n name: 'Mac OS',\n rule: /(Mac_PowerPC)|(Macintosh)/\n },\n {\n name: 'QNX',\n rule: /QNX/\n },\n {\n name: 'BeOS',\n rule: /BeOS/\n },\n {\n name: 'OS/2',\n rule: /OS\\/2/\n },\n {\n name: 'Search Bot',\n rule: /(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves\\/Teoma)|(ia_archiver)/\n }\n ];\n\n var detected = operatingSystems.filter(function (os) {\n if (userAgentString.match(os.rule)) {\n return true;\n }\n });\n\n return detected && detected[0] ? detected[0].name : null;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/detect-browser/lib/detectOS.js\n// module id = 61\n// module chunks = 0","exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/ieee754/index.js\n// module id = 62\n// module chunks = 0","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/inherits/inherits_browser.js\n// module id = 63\n// module chunks = 0","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/isarray/index.js\n// module id = 64\n// module chunks = 0","/**\n * The code was extracted from:\n * https://github.com/davidchambers/Base64.js\n */\n\nvar chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\nfunction InvalidCharacterError(message) {\n this.message = message;\n}\n\nInvalidCharacterError.prototype = new Error();\nInvalidCharacterError.prototype.name = 'InvalidCharacterError';\n\nfunction polyfill (input) {\n var str = String(input).replace(/=+$/, '');\n if (str.length % 4 == 1) {\n throw new InvalidCharacterError(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = '';\n // get next character\n buffer = str.charAt(idx++);\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n return output;\n}\n\n\nmodule.exports = typeof window !== 'undefined' && window.atob && window.atob.bind(window) || polyfill;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/jwt-decode/lib/atob.js\n// module id = 65\n// module chunks = 0","var atob = require('./atob');\n\nfunction b64DecodeUnicode(str) {\n return decodeURIComponent(atob(str).replace(/(.)/g, function (m, p) {\n var code = p.charCodeAt(0).toString(16).toUpperCase();\n if (code.length < 2) {\n code = '0' + code;\n }\n return '%' + code;\n }));\n}\n\nmodule.exports = function(str) {\n var output = str.replace(/-/g, \"+\").replace(/_/g, \"/\");\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += \"==\";\n break;\n case 3:\n output += \"=\";\n break;\n default:\n throw \"Illegal base64url string!\";\n }\n\n try{\n return b64DecodeUnicode(output);\n } catch (err) {\n return atob(output);\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/jwt-decode/lib/base64_url_decode.js\n// module id = 66\n// module chunks = 0","'use strict';\n\nvar base64_url_decode = require('./base64_url_decode');\n\nfunction InvalidTokenError(message) {\n this.message = message;\n}\n\nInvalidTokenError.prototype = new Error();\nInvalidTokenError.prototype.name = 'InvalidTokenError';\n\nmodule.exports = function (token,options) {\n if (typeof token !== 'string') {\n throw new InvalidTokenError('Invalid token specified');\n }\n\n options = options || {};\n var pos = options.header === true ? 0 : 1;\n try {\n return JSON.parse(base64_url_decode(token.split('.')[pos]));\n } catch (e) {\n throw new InvalidTokenError('Invalid token specified: ' + e.message);\n }\n};\n\nmodule.exports.InvalidTokenError = InvalidTokenError;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/jwt-decode/lib/index.js\n// module id = 67\n// module chunks = 0","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/object-assign/index.js\n// module id = 68\n// module chunks = 0","'use strict';\nvar strictUriEncode = require('strict-uri-encode');\nvar objectAssign = require('object-assign');\n\nfunction encoderForArrayFormat(opts) {\n\tswitch (opts.arrayFormat) {\n\t\tcase 'index':\n\t\t\treturn function (key, value, index) {\n\t\t\t\treturn value === null ? [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'[',\n\t\t\t\t\tindex,\n\t\t\t\t\t']'\n\t\t\t\t].join('') : [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'[',\n\t\t\t\t\tencode(index, opts),\n\t\t\t\t\t']=',\n\t\t\t\t\tencode(value, opts)\n\t\t\t\t].join('');\n\t\t\t};\n\n\t\tcase 'bracket':\n\t\t\treturn function (key, value) {\n\t\t\t\treturn value === null ? encode(key, opts) : [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'[]=',\n\t\t\t\t\tencode(value, opts)\n\t\t\t\t].join('');\n\t\t\t};\n\n\t\tdefault:\n\t\t\treturn function (key, value) {\n\t\t\t\treturn value === null ? encode(key, opts) : [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'=',\n\t\t\t\t\tencode(value, opts)\n\t\t\t\t].join('');\n\t\t\t};\n\t}\n}\n\nfunction parserForArrayFormat(opts) {\n\tvar result;\n\n\tswitch (opts.arrayFormat) {\n\t\tcase 'index':\n\t\t\treturn function (key, value, accumulator) {\n\t\t\t\tresult = /\\[(\\d*)\\]$/.exec(key);\n\n\t\t\t\tkey = key.replace(/\\[\\d*\\]$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = {};\n\t\t\t\t}\n\n\t\t\t\taccumulator[key][result[1]] = value;\n\t\t\t};\n\n\t\tcase 'bracket':\n\t\t\treturn function (key, value, accumulator) {\n\t\t\t\tresult = /(\\[\\])$/.exec(key);\n\t\t\t\tkey = key.replace(/\\[\\]$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t} else if (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = [value];\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [].concat(accumulator[key], value);\n\t\t\t};\n\n\t\tdefault:\n\t\t\treturn function (key, value, accumulator) {\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [].concat(accumulator[key], value);\n\t\t\t};\n\t}\n}\n\nfunction encode(value, opts) {\n\tif (opts.encode) {\n\t\treturn opts.strict ? strictUriEncode(value) : encodeURIComponent(value);\n\t}\n\n\treturn value;\n}\n\nfunction keysSorter(input) {\n\tif (Array.isArray(input)) {\n\t\treturn input.sort();\n\t} else if (typeof input === 'object') {\n\t\treturn keysSorter(Object.keys(input)).sort(function (a, b) {\n\t\t\treturn Number(a) - Number(b);\n\t\t}).map(function (key) {\n\t\t\treturn input[key];\n\t\t});\n\t}\n\n\treturn input;\n}\n\nexports.extract = function (str) {\n\treturn str.split('?')[1] || '';\n};\n\nexports.parse = function (str, opts) {\n\topts = objectAssign({arrayFormat: 'none'}, opts);\n\n\tvar formatter = parserForArrayFormat(opts);\n\n\t// Create an object with no prototype\n\t// https://github.com/sindresorhus/query-string/issues/47\n\tvar ret = Object.create(null);\n\n\tif (typeof str !== 'string') {\n\t\treturn ret;\n\t}\n\n\tstr = str.trim().replace(/^(\\?|#|&)/, '');\n\n\tif (!str) {\n\t\treturn ret;\n\t}\n\n\tstr.split('&').forEach(function (param) {\n\t\tvar parts = param.replace(/\\+/g, ' ').split('=');\n\t\t// Firefox (pre 40) decodes `%3D` to `=`\n\t\t// https://github.com/sindresorhus/query-string/pull/37\n\t\tvar key = parts.shift();\n\t\tvar val = parts.length > 0 ? parts.join('=') : undefined;\n\n\t\t// missing `=` should be `null`:\n\t\t// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters\n\t\tval = val === undefined ? null : decodeURIComponent(val);\n\n\t\tformatter(decodeURIComponent(key), val, ret);\n\t});\n\n\treturn Object.keys(ret).sort().reduce(function (result, key) {\n\t\tvar val = ret[key];\n\t\tif (Boolean(val) && typeof val === 'object' && !Array.isArray(val)) {\n\t\t\t// Sort object keys, not values\n\t\t\tresult[key] = keysSorter(val);\n\t\t} else {\n\t\t\tresult[key] = val;\n\t\t}\n\n\t\treturn result;\n\t}, Object.create(null));\n};\n\nexports.stringify = function (obj, opts) {\n\tvar defaults = {\n\t\tencode: true,\n\t\tstrict: true,\n\t\tarrayFormat: 'none'\n\t};\n\n\topts = objectAssign(defaults, opts);\n\n\tvar formatter = encoderForArrayFormat(opts);\n\n\treturn obj ? Object.keys(obj).sort().map(function (key) {\n\t\tvar val = obj[key];\n\n\t\tif (val === undefined) {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (val === null) {\n\t\t\treturn encode(key, opts);\n\t\t}\n\n\t\tif (Array.isArray(val)) {\n\t\t\tvar result = [];\n\n\t\t\tval.slice().forEach(function (val2) {\n\t\t\t\tif (val2 === undefined) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tresult.push(formatter(key, val2, result.length));\n\t\t\t});\n\n\t\t\treturn result.join('&');\n\t\t}\n\n\t\treturn encode(key, opts) + '=' + encode(val, opts);\n\t}).filter(function (x) {\n\t\treturn x.length > 0;\n\t}).join('&') : '';\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/query-string/index.js\n// module id = 69\n// module chunks = 0","'use strict';\nmodule.exports = function (str) {\n\treturn encodeURIComponent(str).replace(/[!'()*]/g, function (c) {\n\t\treturn '%' + c.charCodeAt(0).toString(16).toUpperCase();\n\t});\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/strict-uri-encode/index.js\n// module id = 70\n// module chunks = 0","module.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/util/support/isBufferBrowser.js\n// module id = 71\n// module chunks = 0","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexports.debuglog = function(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/util/util.js\n// module id = 72\n// module chunks = 0","(function(self) {\n 'use strict';\n\n if (self.fetch) {\n return\n }\n\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob: 'FileReader' in self && 'Blob' in self && (function() {\n try {\n new Blob()\n return true\n } catch(e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ]\n\n var isDataView = function(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n var isArrayBufferView = ArrayBuffer.isView || function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n }\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name)\n }\n if (/[^a-z0-9\\-#$%&'*+.\\^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value)\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift()\n return {done: value === undefined, value: value}\n }\n }\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n }\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {}\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value)\n }, this)\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1])\n }, this)\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name])\n }, this)\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name)\n value = normalizeValue(value)\n var oldValue = this.map[name]\n this.map[name] = oldValue ? oldValue+','+value : value\n }\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)]\n }\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name)\n return this.has(name) ? this.map[name] : null\n }\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n }\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value)\n }\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this)\n }\n }\n }\n\n Headers.prototype.keys = function() {\n var items = []\n this.forEach(function(value, name) { items.push(name) })\n return iteratorFor(items)\n }\n\n Headers.prototype.values = function() {\n var items = []\n this.forEach(function(value) { items.push(value) })\n return iteratorFor(items)\n }\n\n Headers.prototype.entries = function() {\n var items = []\n this.forEach(function(value, name) { items.push([name, value]) })\n return iteratorFor(items)\n }\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result)\n }\n reader.onerror = function() {\n reject(reader.error)\n }\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsArrayBuffer(blob)\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsText(blob)\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf)\n var chars = new Array(view.length)\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i])\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength)\n view.set(new Uint8Array(buf))\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false\n\n this._initBody = function(body) {\n this._bodyInit = body\n if (!body) {\n this._bodyText = ''\n } else if (typeof body === 'string') {\n this._bodyText = body\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString()\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer)\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer])\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body)\n } else {\n throw new Error('unsupported BodyInit type')\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8')\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type)\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')\n }\n }\n }\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n }\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n }\n }\n\n this.text = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n }\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n }\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n }\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase()\n return (methods.indexOf(upcased) > -1) ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {}\n var body = options.body\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url\n this.credentials = input.credentials\n if (!options.headers) {\n this.headers = new Headers(input.headers)\n }\n this.method = input.method\n this.mode = input.mode\n if (!body && input._bodyInit != null) {\n body = input._bodyInit\n input.bodyUsed = true\n }\n } else {\n this.url = String(input)\n }\n\n this.credentials = options.credentials || this.credentials || 'omit'\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers)\n }\n this.method = normalizeMethod(options.method || this.method || 'GET')\n this.mode = options.mode || this.mode || null\n this.referrer = null\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body)\n }\n\n Request.prototype.clone = function() {\n return new Request(this, { body: this._bodyInit })\n }\n\n function decode(body) {\n var form = new FormData()\n body.trim().split('&').forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=')\n var name = split.shift().replace(/\\+/g, ' ')\n var value = split.join('=').replace(/\\+/g, ' ')\n form.append(decodeURIComponent(name), decodeURIComponent(value))\n }\n })\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers()\n rawHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':')\n var key = parts.shift().trim()\n if (key) {\n var value = parts.join(':').trim()\n headers.append(key, value)\n }\n })\n return headers\n }\n\n Body.call(Request.prototype)\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {}\n }\n\n this.type = 'default'\n this.status = 'status' in options ? options.status : 200\n this.ok = this.status >= 200 && this.status < 300\n this.statusText = 'statusText' in options ? options.statusText : 'OK'\n this.headers = new Headers(options.headers)\n this.url = options.url || ''\n this._initBody(bodyInit)\n }\n\n Body.call(Response.prototype)\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n }\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''})\n response.type = 'error'\n return response\n }\n\n var redirectStatuses = [301, 302, 303, 307, 308]\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n }\n\n self.Headers = Headers\n self.Request = Request\n self.Response = Response\n\n self.fetch = function(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init)\n var xhr = new XMLHttpRequest()\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n }\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL')\n var body = 'response' in xhr ? xhr.response : xhr.responseText\n resolve(new Response(body, options))\n }\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'))\n }\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'))\n }\n\n xhr.open(request.method, request.url, true)\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob'\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value)\n })\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)\n })\n }\n self.fetch.polyfill = true\n})(typeof self !== 'undefined' ? self : this);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/whatwg-fetch/fetch.js\n// module id = 73\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///stitch.min.js","webpack:///webpack/bootstrap 236f48f2d3f9b4334561","webpack:///./~/buffer/index.js","webpack:///./~/bson/lib/bson/float_parser.js","webpack:///./src/util.js","webpack:///./~/bson/lib/bson/long.js","webpack:///./src/auth/common.js","webpack:///./~/bson/lib/bson/binary.js","webpack:///./~/bson/lib/bson/code.js","webpack:///./~/bson/lib/bson/db_ref.js","webpack:///./~/bson/lib/bson/decimal128.js","webpack:///./~/bson/lib/bson/double.js","webpack:///./~/bson/lib/bson/max_key.js","webpack:///./~/bson/lib/bson/min_key.js","webpack:///./~/bson/lib/bson/objectid.js","webpack:///./~/bson/lib/bson/regexp.js","webpack:///./~/bson/lib/bson/symbol.js","webpack:///./~/bson/lib/bson/timestamp.js","webpack:///./src/common.js","webpack:///(webpack)/buildin/global.js","webpack:///./~/bson/lib/bson/int_32.js","webpack:///./src/errors.js","webpack:///./src/client.js","webpack:///./~/mongodb-extjson/index.js","webpack:///./~/bson/lib/bson/map.js","webpack:///./src/auth/providers.js","webpack:///./~/fetch-everywhere/fetch-npm-browserify.js","webpack:///./~/process/browser.js","webpack:///./src/admin.js","webpack:///./~/Base64/base64.js","webpack:///./~/bson/lib/bson/bson.js","webpack:///./~/bson/lib/bson/parser/calculate_size.js","webpack:///./~/bson/lib/bson/parser/deserializer.js","webpack:///./~/bson/lib/bson/parser/serializer.js","webpack:///./src/auth/index.js","webpack:///./src/auth/storage.js","webpack:///./src/index.js","webpack:///./src/services/aws/s3_service.js","webpack:///./src/services/aws/ses_service.js","webpack:///./src/services/http/http_service.js","webpack:///./src/services/index.js","webpack:///./src/services/mongodb/collection.js","webpack:///./src/services/mongodb/db.js","webpack:///./src/services/mongodb/mongodb_service.js","webpack:///./src/services/twilio/twilio_service.js","webpack:///./~/mongodb-extjson/lib/bson/binary.js","webpack:///./~/mongodb-extjson/lib/bson/code.js","webpack:///./~/mongodb-extjson/lib/bson/db_ref.js","webpack:///./~/mongodb-extjson/lib/bson/decimal128.js","webpack:///./~/mongodb-extjson/lib/bson/double.js","webpack:///./~/mongodb-extjson/lib/bson/index.js","webpack:///./~/mongodb-extjson/lib/bson/int_32.js","webpack:///./~/mongodb-extjson/lib/bson/long.js","webpack:///./~/mongodb-extjson/lib/bson/max_key.js","webpack:///./~/mongodb-extjson/lib/bson/min_key.js","webpack:///./~/mongodb-extjson/lib/bson/objectid.js","webpack:///./~/mongodb-extjson/lib/bson/regexp.js","webpack:///./~/mongodb-extjson/lib/bson/symbol.js","webpack:///./~/mongodb-extjson/lib/bson/timestamp.js","webpack:///./~/mongodb-extjson/lib/ext_json.js","webpack:///./~/base64-js/index.js","webpack:///./~/detect-browser/browser.js","webpack:///./~/detect-browser/lib/detectBrowser.js","webpack:///./~/detect-browser/lib/detectOS.js","webpack:///./~/ieee754/index.js","webpack:///./~/inherits/inherits_browser.js","webpack:///./~/isarray/index.js","webpack:///./~/jwt-decode/lib/atob.js","webpack:///./~/jwt-decode/lib/base64_url_decode.js","webpack:///./~/jwt-decode/lib/index.js","webpack:///./~/object-assign/index.js","webpack:///./~/query-string/index.js","webpack:///./~/strict-uri-encode/index.js","webpack:///./~/util/support/isBufferBrowser.js","webpack:///./~/util/util.js","webpack:///./~/whatwg-fetch/fetch.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","value","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","global","kMaxLength","Buffer","TYPED_ARRAY_SUPPORT","createBuffer","that","length","RangeError","Uint8Array","__proto__","arg","encodingOrOffset","Error","allocUnsafe","from","TypeError","ArrayBuffer","fromArrayBuffer","fromString","fromObject","assertSize","size","alloc","fill","encoding","undefined","checked","string","isEncoding","byteLength","actual","write","slice","fromArrayLike","array","byteOffset","obj","isBuffer","len","copy","buffer","isnan","type","isArray","data","toString","SlowBuffer","isView","loweredCase","utf8ToBytes","base64ToBytes","toLowerCase","slowToString","start","end","hexSlice","utf8Slice","asciiSlice","latin1Slice","base64Slice","utf16leSlice","swap","b","bidirectionalIndexOf","val","dir","isNaN","arrayIndexOf","indexOf","lastIndexOf","arr","read","buf","indexSize","readUInt16BE","arrLength","valLength","String","foundIndex","found","j","hexWrite","offset","Number","remaining","strLen","parsed","parseInt","substr","utf8Write","blitBuffer","asciiWrite","asciiToBytes","latin1Write","base64Write","ucs2Write","utf16leToBytes","base64","fromByteArray","Math","min","res","firstByte","codePoint","bytesPerSequence","secondByte","thirdByte","fourthByte","tempCodePoint","push","decodeCodePointsArray","codePoints","MAX_ARGUMENTS_LENGTH","fromCharCode","apply","ret","out","toHex","bytes","checkOffset","ext","checkInt","max","objectWriteUInt16","littleEndian","objectWriteUInt32","checkIEEE754","writeFloat","noAssert","ieee754","writeDouble","base64clean","str","stringtrim","replace","INVALID_BASE64_RE","trim","units","Infinity","leadSurrogate","charCodeAt","byteArray","hi","lo","toByteArray","src","dst","INSPECT_MAX_BYTES","foo","subarray","e","poolSize","_augment","Symbol","species","allocUnsafeSlow","_isBuffer","compare","a","x","y","concat","list","pos","swap16","swap32","swap64","arguments","equals","inspect","match","join","target","thisStart","thisEnd","thisCopy","targetCopy","includes","isFinite","toJSON","Array","_arr","newBuf","sliceLen","readUIntLE","mul","readUIntBE","readUInt8","readUInt16LE","readUInt32LE","readUInt32BE","readIntLE","pow","readIntBE","readInt8","readInt16LE","readInt16BE","readInt32LE","readInt32BE","readFloatLE","readFloatBE","readDoubleLE","readDoubleBE","writeUIntLE","writeUIntBE","writeUInt8","floor","writeUInt16LE","writeUInt16BE","writeUInt32LE","writeUInt32BE","writeIntLE","limit","sub","writeIntBE","writeInt8","writeInt16LE","writeInt16BE","writeInt32LE","writeInt32BE","writeFloatLE","writeFloatBE","writeDoubleLE","writeDoubleBE","targetStart","set","code","readIEEE754","endian","mLen","nBytes","bBE","eLen","eMax","eBias","nBits","NaN","writeIEEE754","rt","abs","log","LN2","deprecate","fn","msg","deprecated","alreadyWarned","console","warn","serviceResponse","service","_ref","_ref$serviceName","serviceName","action","args","client","executeServiceFunction","uriEncodeObject","encodeURIComponent","btoa","JSON","stringify","collectMetadata","_typeof","iterator","constructor","_Base","newObj","key","default","func","attachMetadata","metadata","writable","Promise","resolve","warnings","then","Long","low","high","_bsontype","low_","high_","toInt","toNumber","TWO_PWR_32_DBL_","getLowBitsUnsigned","opt_radix","radix","isZero","isNegative","MIN_VALUE","radixLong","fromNumber","div","rem","multiply","subtract","negate","radixToPower","result","remDiv","intval","digits","getHighBits","getLowBits","getNumBitsAbs","bit","isOdd","other","notEquals","lessThan","lessThanOrEqual","greaterThan","greaterThanOrEqual","thisNeg","otherNeg","not","add","ONE","a48","a32","a16","a00","b48","b32","b16","b00","c48","c32","c16","c00","fromBits","ZERO","TWO_PWR_24_","NEG_ONE","halfThis","shiftRight","approx","shiftLeft","log2","ceil","delta","approxRes","approxRem","modulo","and","or","xor","numBits","shiftRightUnsigned","fromInt","cachedObj","INT_CACHE_","TWO_PWR_63_DBL_","MAX_VALUE","lowBits","highBits","charAt","substring","power","TWO_PWR_16_DBL_","TWO_PWR_24_DBL_","TWO_PWR_31_DBL_","TWO_PWR_48_DBL_","TWO_PWR_64_DBL_","USER_AUTH_KEY","REFRESH_TOKEN_KEY","DEVICE_ID_KEY","STATE_KEY","USER_AUTH_COOKIE_NAME","STITCH_ERROR_KEY","STITCH_LINK_KEY","USER_LOGGED_IN_PT_KEY","STITCH_REDIRECT_PROVIDER","DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS","APP_CLIENT_CODEC","accessToken","refreshToken","deviceId","userId","ADMIN_CLIENT_CODEC","Binary","subType","sub_type","position","BSON_BINARY_SUBTYPE_DEFAULT","BUFFER_SIZE","writeStringToArray","put","byte_value","decoded_byte","asRaw","newBuffer","convertArraytoUtf8BinaryString","format","startIndex","endIndex","SUBTYPE_DEFAULT","SUBTYPE_FUNCTION","SUBTYPE_BYTE_ARRAY","SUBTYPE_UUID_OLD","SUBTYPE_UUID","SUBTYPE_MD5","SUBTYPE_USER_DEFINED","Code","scope","DBRef","namespace","oid","db","$ref","$id","$db","PARSE_STRING_REGEXP","PARSE_INF_REGEXP","PARSE_NAN_REGEXP","EXPONENT_BIAS","NAN_BUFFER","reverse","INF_NEGATIVE_BUFFER","INF_POSITIVE_BUFFER","EXPONENT_REGEX","isDigit","divideu128","DIVISOR","_rem","parts","quotient","multiply64x2","left","right","leftHigh","leftLow","rightHigh","rightLow","productHigh","productMid","productMid2","productLow","uhleft","uhright","Decimal128","sawRadix","foundNonZero","significantDigits","nDigitsRead","nDigits","radixPosition","firstNonZero","nDigitsStored","digitsInsert","firstDigit","lastDigit","exponent","significandHigh","significandLow","biasedExponent","index","stringMatch","infMatch","nanMatch","digitsString","endOfString","roundDigit","roundBit","dIdx","significand","dec","midh","midl","combination","biased_exponent","significand_digits","scientific_exponent","significand_msb","k","is_zero","significand128","least_digits","radix_position","$numberDecimal","Double","valueOf","MaxKey","MinKey","process","MACHINE_ID","random","checkForHexRegExp","RegExp","hasBufferType","err","ObjectID","id","generate","cacheHexString","__id","valid","isValid","createFromHexString","toHexString","hexTable","hexString","_Buffer","convertToHex","get_inc","getInc","time","Date","now","pid","inc","otherId","getTimestamp","timestamp","setTime","createPk","createFromTime","decodeLookup","split","test","ObjectId","BSONRegExp","pattern","options","Timestamp","radixTimestamp","makeFetchArgs","checkStatus","SDK_VERSION","DEFAULT_STITCH_SERVER_URL","ADMIN_CLIENT_TYPE","APP_CLIENT_TYPE","JSONTYPE","_errors","version","response","status","headers","json","error","StitchError","error_code","reject","statusText","method","body","init","Accept","Content-Type","cors","g","Function","eval","window","Int32","_classCallCheck","instance","Constructor","_possibleConstructorReturn","self","ReferenceError","_inherits","subClass","superClass","create","setPrototypeOf","_extendableBuiltin2","message","_this","getPrototypeOf","captureStackTrace","stack","cls","ExtendableBuiltin","Reflect","construct","ErrAuthProviderNotFound","ErrInvalidSession","ErrUnauthorized","_interopRequireDefault","_defineProperty","newStitchClient","clientAppID","_v","_v2","_v3","_stitchClient$rootURL","stitchClient","baseUrl","common","authUrl","rootURLsByAPIVersion","v1","API_TYPE_PUBLIC","API_TYPE_CLIENT","API_TYPE_PRIVATE","API_TYPE_APP","v2","v3","authOptions","codec","storage","storageType","platform","authCodec","_auth","AuthFactory","auth","all","handleRedirect","handleCookie","StitchClient","StitchClientFactory","_createClass","defineProperties","props","descriptor","protoProps","staticProps","_providers","_common","_services","_services2","_common2","_mongodbExtjson","_mongodbExtjson2","_queryString","_queryString2","email","password","authenticate","PROVIDER_TYPE_ANON","assign","username","provider","register","providerType","authenticateFn","authedId","isAuthenticated","getLoggedInProviderType","logout","_this2","_do","refreshOnFailure","useRefreshToken","rootURL","clear","ServiceType","_len","_key","_doFunctionCall","_len2","_key2","request","responseDecoder","parse","strict","text","userApiKeyName","keyID","url","fetchArgs","resource","_this3","fetch","appURL","apiVersion","apiType","queryParams","_this4","_fetchArgs2","_fetchArgs","noAuth","_fetch","token","getRefreshToken","getAccessToken","Authorization","isAccessTokenExpired","ExtJSON","Map","_keys","_values","entry","v","delete","splice","entries","next","done","forEach","callback","has","keys","values","_interopRequireWildcard","anonProvider","getDeviceId","device","getDeviceInfo","rootUrl","_util","customProvider","PROVIDER_TYPE_CUSTOM","userPassProvider","providerRoute","isAppClient","loginRoute","PROVIDER_TYPE_USERPASS","emailConfirm","tokenId","sendEmailConfirm","sendPasswordReset","passwordReset","apiKeyProvider","PROVIDER_TYPE_APIKEY","generateState","state","alpha","getOAuthLoginURL","providerName","redirectUrl","pageRootUrl","authCommon","encodeURI","googleProvider","authCode","PROVIDER_TYPE_GOOGLE","location","facebookProvider","PROVIDER_TYPE_FACEBOOK","mongodbCloudProvider","apiKey","cookie","credentials","PROVIDER_TYPE_MONGODB_CLOUD","createProviders","_ref2","globalObj","bind","defaultSetTimout","defaultClearTimeout","runTimeout","fun","cachedSetTimeout","setTimeout","runClearTimeout","marker","cachedClearTimeout","clearTimeout","cleanUpNextTick","draining","currentQueue","queue","queueIndex","drainQueue","timeout","run","Item","noop","nextTick","title","browser","env","argv","versions","on","addListener","once","off","removeListener","removeAllListeners","emit","prependListener","prependOnceListener","listeners","binding","cwd","chdir","umask","StitchAdminClient","StitchAdminClientFactory","_get","receiver","desc","getOwnPropertyDescriptor","parent","_client","_common3","_StitchClient","groupId","api","groupUrl","query","defaults","_post","app","appId","appUrl","remove","_delete","valueId","valueUrl","update","_put","services","serviceId","runCommand","commandName","config","_patch","rules","rule","ruleId","ruleUrl","incomingWebhooks","incomingWebhook","incomingWebhookId","webhookUrl","pushNotifications","filter","pushNotification","messageId","send","users","user","uid","devices","enable","disable","debug","executeFunction","user_id","executeFunctionSource","source","evalSource","eval_source","authProviders","authProvider","providerId","security","allowedRequestOrigins","logs","apiKeys","apiKeyId","functions","function","functionId","apps","pipelines","pipeline","pipelineId","pipelineUrl","setType","dev","executePipeline","v3do","_this5","v2do","InvalidCharacterError","chars","input","block","charCode","idx","map","output","atob","bs","bc","deserialize","serializer","calculateObjectSize","BSON","serialize","checkKeys","serializeFunctions","ignoreUndefined","serializationIndex","finishedBuffer","serializeWithBufferAndIndex","finalBuffer","deserializeStream","numberOfDocuments","documents","docStartIndex","BSON_INT32_MAX","BSON_INT32_MIN","BSON_INT64_MAX","BSON_INT64_MIN","JS_INT_MAX","JS_INT_MIN","BSON_DATA_NUMBER","BSON_DATA_STRING","BSON_DATA_OBJECT","BSON_DATA_ARRAY","BSON_DATA_BINARY","BSON_DATA_OID","BSON_DATA_BOOLEAN","BSON_DATA_DATE","BSON_DATA_NULL","BSON_DATA_REGEXP","BSON_DATA_CODE","BSON_DATA_SYMBOL","BSON_DATA_CODE_W_SCOPE","BSON_DATA_INT","BSON_DATA_TIMESTAMP","BSON_DATA_LONG","BSON_DATA_MIN_KEY","BSON_DATA_MAX_KEY","BSON_BINARY_SUBTYPE_FUNCTION","BSON_BINARY_SUBTYPE_BYTE_ARRAY","BSON_BINARY_SUBTYPE_UUID","BSON_BINARY_SUBTYPE_MD5","BSON_BINARY_SUBTYPE_USER_DEFINED","calculateElement","toBSON","isDate","ordered_values","ignoreCase","multiline","totalLength","f","deserializeObject","evalFunctions","cacheFunctions","cacheFunctionsCrc32","fieldsAsRaw","raw","bsonRegExp","promoteBuffers","promoteLongs","promoteValues","arrayIndex","elementType","stringSize","_index","objectSize","arrayOptions","stopIndex","BSON_DATA_UNDEFINED","long","JS_INT_MAX_LONG","JS_INT_MIN_LONG","BSON_DATA_DECIMAL128","decimal128","toObject","binarySize","totalBinarySize","_buffer","regExpOptions","optionsArray","functionString","hash","crc32","isolateEvalWithHash","functionCache","isolateEval","totalSize","scopeObject","BSON_DATA_DBPOINTER","oidBuffer","shift","collection","regexp","isRegExp","serializeString","serializeNumber","numberOfWrittenBytes","longVal","serializeNull","serializeBoolean","serializeDate","dateInMilis","getTime","serializeRegExp","serializeBSONRegExp","sort","serializeMinMax","serializeObjectId","serializeBuffer","serializeObject","depth","path","serializeInto","pop","serializeDecimal128","serializeLong","serializeInt32","serializeDouble","serializeFunction","serializeCode","codeSize","serializeBinary","serializeSymbol","serializeDBRef","startingIndex","newAuth","Auth","_platform","_storage","createStorage","providers","_slicedToArray","authObj","loggedInProviderType","sliceIterator","_n","_d","_e","_s","_i","_detectBrowser","jwtDecode","appVersion","deviceInfo","sdkVersion","platformVersion","doSessionPost","protocol","host","pathname","_error","redirectProvider","_ref3","_ref4","ourState","_redirectProvider","redirectFragment","redirectState","parseRedirectFragment","lastError","history","replaceState","stateValid","ua","splitCookies","document","sepIdx","cookieVal","uaCookie","getCookie","userAuth","unmarshallUserAuth","withinSeconds","decodedToken","exp","authType","newUserAuth","setters","fragment","vars","shouldBreak","pairParts","decodeURIComponent","theirState","_ref5","_runMigration","migrations","store","getItem","item","setItem","_generateKey","removeItem","_VERSION_KEY","_VERSION","localStorage","Storage","sessionStorage","MemoryStorage","_data","_orderedKeys","_migration","_admin","S3Service","bucket","acl","contentType","SESService","to","subject","buildArgs","urlOrOptions","buildResponse","HTTPService","_s3_service","_s3_service2","_ses_service","_ses_service2","_http_service","_http_service2","_mongodb_service","_mongodb_service2","_twilio_service","_twilio_service2","aws/s3","aws/ses","http","mongodb","twilio","updateOp","isMulti","outgoingOptions","upsert","findOp","project","aggregateOp","database","MongoQuery","Collection","doc","docs","count","execute","_collection","_collection2","DB","_db","_db2","MongoDBService","databaseName","TwilioService","convert","integer","toExtendedJSON","$binary","fromExtendedJSON","$code","$scope","fields","relaxed","$numberDouble","parseFloat","$numberInt","$numberLong","$maxKey","$minKey","$oid","$regularExpression","$symbol","$timestamp","t","setBSONModule","BSONTypes","deserializeValue","int32Range","int64Range","$undefined","startsWith","keysToCodecs","$date","date","codecs","$dbPointer","dollarKeys","serializeArray","serializeValue","getISOString","isoStr","toISOString","getUTCMilliseconds","dateNum","inRange","serializeDocument","tempScope","tempDoc","tempId","_doc","tempVal","reducer","indents","opts","placeHoldersCount","b64","tmp","placeHolders","Arr","L","revLookup","tripletToBase64","num","lookup","encodeChunk","uint8","extraBytes","len2","agent","detectBrowser","navigator","userAgent","detectOS","userAgentString","exec","os","Boolean","operatingSystems","detected","isLE","ctor","superCtor","super_","TempCtor","polyfill","b64DecodeUnicode","toUpperCase","InvalidTokenError","base64_url_decode","header","getOwnPropertySymbols","propIsEnumerable","propertyIsEnumerable","test1","getOwnPropertyNames","test2","test3","letter","symbols","encoderForArrayFormat","arrayFormat","encode","parserForArrayFormat","accumulator","strictUriEncode","keysSorter","objectAssign","extract","formatter","param","reduce","val2","ctx","seen","stylize","stylizeNoColor","colors","isBoolean","showHidden","_extend","isUndefined","customInspect","stylizeWithColor","formatValue","styleType","style","styles","arrayToHash","recurseTimes","isFunction","isString","primitive","formatPrimitive","visibleKeys","isError","formatError","base","braces","toUTCString","formatArray","formatProperty","reduceToSingleString","simple","isNumber","isNull","line","numLinesEst","prev","cur","ar","isNullOrUndefined","isSymbol","re","isObject","objectToString","isPrimitive","pad","getHours","getMinutes","getSeconds","getDate","months","getMonth","prop","formatRegExp","objects","_","warned","throwDeprecation","traceDeprecation","trace","noDeprecation","debugEnviron","debugs","debuglog","NODE_DEBUG","bold","italic","underline","inverse","white","grey","black","blue","cyan","green","magenta","red","yellow","special","number","boolean","null","inherits","origin","normalizeName","normalizeValue","iteratorFor","items","support","iterable","Headers","append","consumed","bodyUsed","fileReaderReady","reader","onload","onerror","readBlobAsArrayBuffer","blob","FileReader","promise","readAsArrayBuffer","readBlobAsText","readAsText","readArrayBufferAsText","view","bufferClone","Body","_initBody","_bodyInit","_bodyText","Blob","isPrototypeOf","_bodyBlob","formData","FormData","_bodyFormData","searchParams","URLSearchParams","arrayBuffer","isDataView","_bodyArrayBuffer","isArrayBufferView","rejected","decode","normalizeMethod","upcased","methods","Request","mode","referrer","form","parseHeaders","rawHeaders","Response","bodyInit","ok","viewClasses","DataView","oldValue","thisArg","clone","redirectStatuses","redirect","xhr","XMLHttpRequest","getAllResponseHeaders","responseURL","responseText","ontimeout","open","withCredentials","responseType","setRequestHeader"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,OAAA,YAAAH,GACA,gBAAAC,SACAA,QAAA,OAAAD,IAEAD,EAAA,OAAAC,KACCK,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAP,OAGA,IAAAC,GAAAO,EAAAD,IACAE,EAAAF,EACAG,GAAA,EACAV,WAUA,OANAK,GAAAE,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAS,GAAA,EAGAT,EAAAD,QAvBA,GAAAQ,KA+DA,OAnCAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAG,EAAA,SAAAK,GAA2C,MAAAA,IAG3CR,EAAAS,EAAA,SAAAf,EAAAgB,EAAAC,GACAX,EAAAY,EAAAlB,EAAAgB,IACAG,OAAAC,eAAApB,EAAAg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AAA,GAEA,YAAAP,EAAAiF,cACAioB,EAAAO,iBAAA,GAGA,gBAAAP,IAAAzD,EAAAW,OACA8C,EAAAQ,aAAA,QAGA1tB,EAAArH,QAAA0J,QAAA,SAAAzsB,EAAAE,GACAo3C,EAAAS,iBAAA73C,EAAAF,KAGAs3C,EAAAxiB,SAAA,KAAA1K,EAAA+qB,UAAA,KAAA/qB,EAAA+qB,cAGA9wB,EAAA0G,MAAA2hB,UAAA,IACC,mBAAAroB,WAAA/kB","file":"stitch.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"stitch\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"stitch\"] = factory();\n\telse\n\t\troot[\"stitch\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"stitch\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"stitch\"] = factory();\n\telse\n\t\troot[\"stitch\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\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.l = 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// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 34);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(global) {/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n\n\nvar base64 = __webpack_require__(58)\nvar ieee754 = __webpack_require__(62)\nvar isArray = __webpack_require__(64)\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(17)))\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n// Copyright (c) 2008, Fair Oaks Labs, Inc.\n// All rights reserved.\n// \n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are met:\n// \n// * Redistributions of source code must retain the above copyright notice,\n// this list of conditions and the following disclaimer.\n// \n// * Redistributions in binary form must reproduce the above copyright notice,\n// this list of conditions and the following disclaimer in the documentation\n// and/or other materials provided with the distribution.\n// \n// * Neither the name of Fair Oaks Labs, Inc. nor the names of its contributors\n// may be used to endorse or promote products derived from this software\n// without specific prior written permission.\n// \n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n// POSSIBILITY OF SUCH DAMAGE.\n//\n//\n// Modifications to writeIEEE754 to support negative zeroes made by Brian White\n\nvar readIEEE754 = function readIEEE754(buffer, offset, endian, mLen, nBytes) {\n var e,\n m,\n bBE = endian === 'big',\n eLen = nBytes * 8 - mLen - 1,\n eMax = (1 << eLen) - 1,\n eBias = eMax >> 1,\n nBits = -7,\n i = bBE ? 0 : nBytes - 1,\n d = bBE ? 1 : -1,\n s = buffer[offset + i];\n\n i += d;\n\n e = s & (1 << -nBits) - 1;\n s >>= -nBits;\n nBits += eLen;\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & (1 << -nBits) - 1;\n e >>= -nBits;\n nBits += mLen;\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias;\n } else if (e === eMax) {\n return m ? NaN : (s ? -1 : 1) * Infinity;\n } else {\n m = m + Math.pow(2, mLen);\n e = e - eBias;\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen);\n};\n\nvar writeIEEE754 = function writeIEEE754(buffer, value, offset, endian, mLen, nBytes) {\n var e,\n m,\n c,\n bBE = endian === 'big',\n eLen = nBytes * 8 - mLen - 1,\n eMax = (1 << eLen) - 1,\n eBias = eMax >> 1,\n rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0,\n i = bBE ? nBytes - 1 : 0,\n d = bBE ? -1 : 1,\n s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;\n\n value = Math.abs(value);\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0;\n e = eMax;\n } else {\n e = Math.floor(Math.log(value) / Math.LN2);\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--;\n c *= 2;\n }\n if (e + eBias >= 1) {\n value += rt / c;\n } else {\n value += rt * Math.pow(2, 1 - eBias);\n }\n if (value * c >= 2) {\n e++;\n c /= 2;\n }\n\n if (e + eBias >= eMax) {\n m = 0;\n e = eMax;\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen);\n e = e + eBias;\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);\n e = 0;\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = e << mLen | m;\n eLen += mLen;\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128;\n};\n\nexports.readIEEE754 = readIEEE754;\nexports.writeIEEE754 = writeIEEE754;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.uriEncodeObject = exports.serviceResponse = exports.deprecate = exports.collectMetadata = undefined;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _Base = __webpack_require__(27);\n\nvar base64 = _interopRequireWildcard(_Base);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nvar RESULT_METADATA_KEY = '_stitch_metadata';\n\n/** @namespace util */\n\n/**\n * Utility which creates a function that extracts metadata\n * from the server in the response to a pipeline request,\n * and attaches it to the final result after the finalizer has been applied.\n *\n * @memberof util\n * @param {Function} [func] optional finalizer to transform the response data\n */\nvar collectMetadata = exports.collectMetadata = function collectMetadata(func) {\n var attachMetadata = function attachMetadata(metadata) {\n return function (res) {\n if ((typeof res === 'undefined' ? 'undefined' : _typeof(res)) === 'object' && !Object.prototype.hasOwnProperty.call(res, RESULT_METADATA_KEY)) {\n Object.defineProperty(res, RESULT_METADATA_KEY, { enumerable: false, configurable: false, writable: false, value: metadata });\n }\n return Promise.resolve(res);\n };\n };\n var captureMetadata = function captureMetadata(data) {\n var metadata = {};\n if (data.warnings) {\n // Metadata is not yet attached to result, grab any data that needs to be added.\n metadata.warnings = data.warnings;\n }\n if (!func) {\n return Promise.resolve(data).then(attachMetadata(metadata));\n }\n return Promise.resolve(data).then(func).then(attachMetadata(metadata));\n };\n return captureMetadata;\n};\n\n/**\n * Utility function for displaying deprecation notices\n *\n * @memberof util\n * @param {Function} fn the function to deprecate\n * @param {String} msg the message to display to the user regarding deprecation\n */\nfunction deprecate(fn, msg) {\n var alreadyWarned = false;\n function deprecated() {\n if (!alreadyWarned) {\n alreadyWarned = true;\n console.warn('DeprecationWarning: ' + msg);\n }\n\n return fn.apply(this, arguments);\n }\n\n deprecated.__proto__ = fn; // eslint-disable-line\n if (fn.prototype) {\n deprecated.prototype = fn.prototype;\n }\n\n return deprecated;\n}\n\n/**\n * Utility method for executing a service action as a function call.\n *\n * @memberof util\n * @param {Object} service the service to execute the action on\n * @param {String} action the service action to execute\n * @param {Array} args the arguments to supply to the service action invocation\n * @returns {Promise} the API response from the executed service action\n */\nfunction serviceResponse(service, _ref) {\n var _ref$serviceName = _ref.serviceName,\n serviceName = _ref$serviceName === undefined ? service.serviceName : _ref$serviceName,\n action = _ref.action,\n args = _ref.args;\n var client = service.client;\n\n\n if (!client) {\n throw new Error('Service has no client');\n }\n\n return client.executeServiceFunction(serviceName, action, args);\n}\n\n/**\n * Utility function to encode a JSON object into a valid string that can be\n * inserted in a URI. The object is first stringified, then encoded in base64,\n * and finally encoded via the builtin encodeURIComponent function.\n *\n * @memberof util\n * @param {Object} obj The object to encode\n * @returns {String} The encoded object\n */\nfunction uriEncodeObject(obj) {\n return encodeURIComponent(base64.btoa(JSON.stringify(obj)));\n}\n\nexports.deprecate = deprecate;\nexports.serviceResponse = serviceResponse;\nexports.uriEncodeObject = uriEncodeObject;\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n// Copyright 2009 Google Inc. All Rights Reserved\n\n/**\n * Defines a Long class for representing a 64-bit two's-complement\n * integer value, which faithfully simulates the behavior of a Java \"Long\". This\n * implementation is derived from LongLib in GWT.\n *\n * Constructs a 64-bit two's-complement integer, given its low and high 32-bit\n * values as *signed* integers. See the from* functions below for more\n * convenient ways of constructing Longs.\n *\n * The internal representation of a Long is the two given signed, 32-bit values.\n * We use 32-bit pieces because these are the size of integers on which\n * Javascript performs bit-operations. For operations like addition and\n * multiplication, we split each number into 16-bit pieces, which can easily be\n * multiplied within Javascript's floating-point representation without overflow\n * or change in sign.\n *\n * In the algorithms below, we frequently reduce the negative case to the\n * positive case by negating the input(s) and then post-processing the result.\n * Note that we must ALWAYS check specially whether those values are MIN_VALUE\n * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\n * a positive number, it overflows back into a negative). Not handling this\n * case would often result in infinite recursion.\n *\n * @class\n * @param {number} low the low (signed) 32 bits of the Long.\n * @param {number} high the high (signed) 32 bits of the Long.\n * @return {Long}\n */\nfunction Long(low, high) {\n if (!(this instanceof Long)) return new Long(low, high);\n\n this._bsontype = 'Long';\n /**\n * @type {number}\n * @ignore\n */\n this.low_ = low | 0; // force into 32 signed bits.\n\n /**\n * @type {number}\n * @ignore\n */\n this.high_ = high | 0; // force into 32 signed bits.\n};\n\n/**\n * Return the int value.\n *\n * @method\n * @return {number} the value, assuming it is a 32-bit integer.\n */\nLong.prototype.toInt = function () {\n return this.low_;\n};\n\n/**\n * Return the Number value.\n *\n * @method\n * @return {number} the closest floating-point representation to this value.\n */\nLong.prototype.toNumber = function () {\n return this.high_ * Long.TWO_PWR_32_DBL_ + this.getLowBitsUnsigned();\n};\n\n/**\n * Return the JSON value.\n *\n * @method\n * @return {string} the JSON representation.\n */\nLong.prototype.toJSON = function () {\n return this.toString();\n};\n\n/**\n * Return the String value.\n *\n * @method\n * @param {number} [opt_radix] the radix in which the text should be written.\n * @return {string} the textual representation of this value.\n */\nLong.prototype.toString = function (opt_radix) {\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (this.isZero()) {\n return '0';\n }\n\n if (this.isNegative()) {\n if (this.equals(Long.MIN_VALUE)) {\n // We need to change the Long value before it can be negated, so we remove\n // the bottom-most digit in this base and then recurse to do the rest.\n var radixLong = Long.fromNumber(radix);\n var div = this.div(radixLong);\n var rem = div.multiply(radixLong).subtract(this);\n return div.toString(radix) + rem.toInt().toString(radix);\n } else {\n return '-' + this.negate().toString(radix);\n }\n }\n\n // Do several (6) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Long.fromNumber(Math.pow(radix, 6));\n\n var rem = this;\n var result = '';\n while (true) {\n var remDiv = rem.div(radixToPower);\n var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt();\n var digits = intval.toString(radix);\n\n rem = remDiv;\n if (rem.isZero()) {\n return digits + result;\n } else {\n while (digits.length < 6) {\n digits = '0' + digits;\n }\n result = '' + digits + result;\n }\n }\n};\n\n/**\n * Return the high 32-bits value.\n *\n * @method\n * @return {number} the high 32-bits as a signed value.\n */\nLong.prototype.getHighBits = function () {\n return this.high_;\n};\n\n/**\n * Return the low 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as a signed value.\n */\nLong.prototype.getLowBits = function () {\n return this.low_;\n};\n\n/**\n * Return the low unsigned 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as an unsigned value.\n */\nLong.prototype.getLowBitsUnsigned = function () {\n return this.low_ >= 0 ? this.low_ : Long.TWO_PWR_32_DBL_ + this.low_;\n};\n\n/**\n * Returns the number of bits needed to represent the absolute value of this Long.\n *\n * @method\n * @return {number} Returns the number of bits needed to represent the absolute value of this Long.\n */\nLong.prototype.getNumBitsAbs = function () {\n if (this.isNegative()) {\n if (this.equals(Long.MIN_VALUE)) {\n return 64;\n } else {\n return this.negate().getNumBitsAbs();\n }\n } else {\n var val = this.high_ != 0 ? this.high_ : this.low_;\n for (var bit = 31; bit > 0; bit--) {\n if ((val & 1 << bit) != 0) {\n break;\n }\n }\n return this.high_ != 0 ? bit + 33 : bit + 1;\n }\n};\n\n/**\n * Return whether this value is zero.\n *\n * @method\n * @return {boolean} whether this value is zero.\n */\nLong.prototype.isZero = function () {\n return this.high_ == 0 && this.low_ == 0;\n};\n\n/**\n * Return whether this value is negative.\n *\n * @method\n * @return {boolean} whether this value is negative.\n */\nLong.prototype.isNegative = function () {\n return this.high_ < 0;\n};\n\n/**\n * Return whether this value is odd.\n *\n * @method\n * @return {boolean} whether this value is odd.\n */\nLong.prototype.isOdd = function () {\n return (this.low_ & 1) == 1;\n};\n\n/**\n * Return whether this Long equals the other\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long equals the other\n */\nLong.prototype.equals = function (other) {\n return this.high_ == other.high_ && this.low_ == other.low_;\n};\n\n/**\n * Return whether this Long does not equal the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long does not equal the other.\n */\nLong.prototype.notEquals = function (other) {\n return this.high_ != other.high_ || this.low_ != other.low_;\n};\n\n/**\n * Return whether this Long is less than the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is less than the other.\n */\nLong.prototype.lessThan = function (other) {\n return this.compare(other) < 0;\n};\n\n/**\n * Return whether this Long is less than or equal to the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is less than or equal to the other.\n */\nLong.prototype.lessThanOrEqual = function (other) {\n return this.compare(other) <= 0;\n};\n\n/**\n * Return whether this Long is greater than the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is greater than the other.\n */\nLong.prototype.greaterThan = function (other) {\n return this.compare(other) > 0;\n};\n\n/**\n * Return whether this Long is greater than or equal to the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is greater than or equal to the other.\n */\nLong.prototype.greaterThanOrEqual = function (other) {\n return this.compare(other) >= 0;\n};\n\n/**\n * Compares this Long with the given one.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater.\n */\nLong.prototype.compare = function (other) {\n if (this.equals(other)) {\n return 0;\n }\n\n var thisNeg = this.isNegative();\n var otherNeg = other.isNegative();\n if (thisNeg && !otherNeg) {\n return -1;\n }\n if (!thisNeg && otherNeg) {\n return 1;\n }\n\n // at this point, the signs are the same, so subtraction will not overflow\n if (this.subtract(other).isNegative()) {\n return -1;\n } else {\n return 1;\n }\n};\n\n/**\n * The negation of this value.\n *\n * @method\n * @return {Long} the negation of this value.\n */\nLong.prototype.negate = function () {\n if (this.equals(Long.MIN_VALUE)) {\n return Long.MIN_VALUE;\n } else {\n return this.not().add(Long.ONE);\n }\n};\n\n/**\n * Returns the sum of this and the given Long.\n *\n * @method\n * @param {Long} other Long to add to this one.\n * @return {Long} the sum of this and the given Long.\n */\nLong.prototype.add = function (other) {\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0,\n c32 = 0,\n c16 = 0,\n c00 = 0;\n c00 += a00 + b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 + b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 + b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 + b48;\n c48 &= 0xFFFF;\n return Long.fromBits(c16 << 16 | c00, c48 << 16 | c32);\n};\n\n/**\n * Returns the difference of this and the given Long.\n *\n * @method\n * @param {Long} other Long to subtract from this.\n * @return {Long} the difference of this and the given Long.\n */\nLong.prototype.subtract = function (other) {\n return this.add(other.negate());\n};\n\n/**\n * Returns the product of this and the given Long.\n *\n * @method\n * @param {Long} other Long to multiply with this.\n * @return {Long} the product of this and the other.\n */\nLong.prototype.multiply = function (other) {\n if (this.isZero()) {\n return Long.ZERO;\n } else if (other.isZero()) {\n return Long.ZERO;\n }\n\n if (this.equals(Long.MIN_VALUE)) {\n return other.isOdd() ? Long.MIN_VALUE : Long.ZERO;\n } else if (other.equals(Long.MIN_VALUE)) {\n return this.isOdd() ? Long.MIN_VALUE : Long.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().multiply(other.negate());\n } else {\n return this.negate().multiply(other).negate();\n }\n } else if (other.isNegative()) {\n return this.multiply(other.negate()).negate();\n }\n\n // If both Longs are small, use float multiplication\n if (this.lessThan(Long.TWO_PWR_24_) && other.lessThan(Long.TWO_PWR_24_)) {\n return Long.fromNumber(this.toNumber() * other.toNumber());\n }\n\n // Divide each Long into 4 chunks of 16 bits, and then add up 4x4 products.\n // We can skip products that would overflow.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0,\n c32 = 0,\n c16 = 0,\n c00 = 0;\n c00 += a00 * b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 * b00;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c16 += a00 * b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 * b00;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a16 * b16;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a00 * b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\n c48 &= 0xFFFF;\n return Long.fromBits(c16 << 16 | c00, c48 << 16 | c32);\n};\n\n/**\n * Returns this Long divided by the given one.\n *\n * @method\n * @param {Long} other Long by which to divide.\n * @return {Long} this Long divided by the given one.\n */\nLong.prototype.div = function (other) {\n if (other.isZero()) {\n throw Error('division by zero');\n } else if (this.isZero()) {\n return Long.ZERO;\n }\n\n if (this.equals(Long.MIN_VALUE)) {\n if (other.equals(Long.ONE) || other.equals(Long.NEG_ONE)) {\n return Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\n } else if (other.equals(Long.MIN_VALUE)) {\n return Long.ONE;\n } else {\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\n var halfThis = this.shiftRight(1);\n var approx = halfThis.div(other).shiftLeft(1);\n if (approx.equals(Long.ZERO)) {\n return other.isNegative() ? Long.ONE : Long.NEG_ONE;\n } else {\n var rem = this.subtract(other.multiply(approx));\n var result = approx.add(rem.div(other));\n return result;\n }\n }\n } else if (other.equals(Long.MIN_VALUE)) {\n return Long.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().div(other.negate());\n } else {\n return this.negate().div(other).negate();\n }\n } else if (other.isNegative()) {\n return this.div(other.negate()).negate();\n }\n\n // Repeat the following until the remainder is less than other: find a\n // floating-point that approximates remainder / other *from below*, add this\n // into the result, and subtract it from the remainder. It is critical that\n // the approximate value is less than or equal to the real value so that the\n // remainder never becomes negative.\n var res = Long.ZERO;\n var rem = this;\n while (rem.greaterThanOrEqual(other)) {\n // Approximate the result of division. This may be a little greater or\n // smaller than the actual value.\n var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber()));\n\n // We will tweak the approximate result by changing it in the 48-th digit or\n // the smallest non-fractional digit, whichever is larger.\n var log2 = Math.ceil(Math.log(approx) / Math.LN2);\n var delta = log2 <= 48 ? 1 : Math.pow(2, log2 - 48);\n\n // Decrease the approximation until it is smaller than the remainder. Note\n // that if it is too large, the product overflows and is negative.\n var approxRes = Long.fromNumber(approx);\n var approxRem = approxRes.multiply(other);\n while (approxRem.isNegative() || approxRem.greaterThan(rem)) {\n approx -= delta;\n approxRes = Long.fromNumber(approx);\n approxRem = approxRes.multiply(other);\n }\n\n // We know the answer can't be zero... and actually, zero would cause\n // infinite recursion since we would make no progress.\n if (approxRes.isZero()) {\n approxRes = Long.ONE;\n }\n\n res = res.add(approxRes);\n rem = rem.subtract(approxRem);\n }\n return res;\n};\n\n/**\n * Returns this Long modulo the given one.\n *\n * @method\n * @param {Long} other Long by which to mod.\n * @return {Long} this Long modulo the given one.\n */\nLong.prototype.modulo = function (other) {\n return this.subtract(this.div(other).multiply(other));\n};\n\n/**\n * The bitwise-NOT of this value.\n *\n * @method\n * @return {Long} the bitwise-NOT of this value.\n */\nLong.prototype.not = function () {\n return Long.fromBits(~this.low_, ~this.high_);\n};\n\n/**\n * Returns the bitwise-AND of this Long and the given one.\n *\n * @method\n * @param {Long} other the Long with which to AND.\n * @return {Long} the bitwise-AND of this and the other.\n */\nLong.prototype.and = function (other) {\n return Long.fromBits(this.low_ & other.low_, this.high_ & other.high_);\n};\n\n/**\n * Returns the bitwise-OR of this Long and the given one.\n *\n * @method\n * @param {Long} other the Long with which to OR.\n * @return {Long} the bitwise-OR of this and the other.\n */\nLong.prototype.or = function (other) {\n return Long.fromBits(this.low_ | other.low_, this.high_ | other.high_);\n};\n\n/**\n * Returns the bitwise-XOR of this Long and the given one.\n *\n * @method\n * @param {Long} other the Long with which to XOR.\n * @return {Long} the bitwise-XOR of this and the other.\n */\nLong.prototype.xor = function (other) {\n return Long.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_);\n};\n\n/**\n * Returns this Long with bits shifted to the left by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Long} this shifted to the left by the given amount.\n */\nLong.prototype.shiftLeft = function (numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var low = this.low_;\n if (numBits < 32) {\n var high = this.high_;\n return Long.fromBits(low << numBits, high << numBits | low >>> 32 - numBits);\n } else {\n return Long.fromBits(0, low << numBits - 32);\n }\n }\n};\n\n/**\n * Returns this Long with bits shifted to the right by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Long} this shifted to the right by the given amount.\n */\nLong.prototype.shiftRight = function (numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Long.fromBits(low >>> numBits | high << 32 - numBits, high >> numBits);\n } else {\n return Long.fromBits(high >> numBits - 32, high >= 0 ? 0 : -1);\n }\n }\n};\n\n/**\n * Returns this Long with bits shifted to the right by the given amount, with the new top bits matching the current sign bit.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Long} this shifted to the right by the given amount, with zeros placed into the new leading bits.\n */\nLong.prototype.shiftRightUnsigned = function (numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Long.fromBits(low >>> numBits | high << 32 - numBits, high >>> numBits);\n } else if (numBits == 32) {\n return Long.fromBits(high, 0);\n } else {\n return Long.fromBits(high >>> numBits - 32, 0);\n }\n }\n};\n\n/**\n * Returns a Long representing the given (32-bit) integer value.\n *\n * @method\n * @param {number} value the 32-bit integer in question.\n * @return {Long} the corresponding Long value.\n */\nLong.fromInt = function (value) {\n if (-128 <= value && value < 128) {\n var cachedObj = Long.INT_CACHE_[value];\n if (cachedObj) {\n return cachedObj;\n }\n }\n\n var obj = new Long(value | 0, value < 0 ? -1 : 0);\n if (-128 <= value && value < 128) {\n Long.INT_CACHE_[value] = obj;\n }\n return obj;\n};\n\n/**\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n *\n * @method\n * @param {number} value the number in question.\n * @return {Long} the corresponding Long value.\n */\nLong.fromNumber = function (value) {\n if (isNaN(value) || !isFinite(value)) {\n return Long.ZERO;\n } else if (value <= -Long.TWO_PWR_63_DBL_) {\n return Long.MIN_VALUE;\n } else if (value + 1 >= Long.TWO_PWR_63_DBL_) {\n return Long.MAX_VALUE;\n } else if (value < 0) {\n return Long.fromNumber(-value).negate();\n } else {\n return new Long(value % Long.TWO_PWR_32_DBL_ | 0, value / Long.TWO_PWR_32_DBL_ | 0);\n }\n};\n\n/**\n * Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits.\n *\n * @method\n * @param {number} lowBits the low 32-bits.\n * @param {number} highBits the high 32-bits.\n * @return {Long} the corresponding Long value.\n */\nLong.fromBits = function (lowBits, highBits) {\n return new Long(lowBits, highBits);\n};\n\n/**\n * Returns a Long representation of the given string, written using the given radix.\n *\n * @method\n * @param {string} str the textual representation of the Long.\n * @param {number} opt_radix the radix in which the text is written.\n * @return {Long} the corresponding Long value.\n */\nLong.fromString = function (str, opt_radix) {\n if (str.length == 0) {\n throw Error('number format error: empty string');\n }\n\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (str.charAt(0) == '-') {\n return Long.fromString(str.substring(1), radix).negate();\n } else if (str.indexOf('-') >= 0) {\n throw Error('number format error: interior \"-\" character: ' + str);\n }\n\n // Do several (8) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Long.fromNumber(Math.pow(radix, 8));\n\n var result = Long.ZERO;\n for (var i = 0; i < str.length; i += 8) {\n var size = Math.min(8, str.length - i);\n var value = parseInt(str.substring(i, i + size), radix);\n if (size < 8) {\n var power = Long.fromNumber(Math.pow(radix, size));\n result = result.multiply(power).add(Long.fromNumber(value));\n } else {\n result = result.multiply(radixToPower);\n result = result.add(Long.fromNumber(value));\n }\n }\n return result;\n};\n\n// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the\n// from* methods on which they depend.\n\n\n/**\n * A cache of the Long representations of small integer values.\n * @type {Object}\n * @ignore\n */\nLong.INT_CACHE_ = {};\n\n// NOTE: the compiler should inline these constant values below and then remove\n// these variables, so there should be no runtime penalty for these.\n\n/**\n * Number used repeated below in calculations. This must appear before the\n * first call to any from* function below.\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_16_DBL_ = 1 << 16;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_24_DBL_ = 1 << 24;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_32_DBL_ = Long.TWO_PWR_16_DBL_ * Long.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_31_DBL_ = Long.TWO_PWR_32_DBL_ / 2;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_48_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_64_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_32_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_63_DBL_ = Long.TWO_PWR_64_DBL_ / 2;\n\n/** @type {Long} */\nLong.ZERO = Long.fromInt(0);\n\n/** @type {Long} */\nLong.ONE = Long.fromInt(1);\n\n/** @type {Long} */\nLong.NEG_ONE = Long.fromInt(-1);\n\n/** @type {Long} */\nLong.MAX_VALUE = Long.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0);\n\n/** @type {Long} */\nLong.MIN_VALUE = Long.fromBits(0, 0x80000000 | 0);\n\n/**\n * @type {Long}\n * @ignore\n */\nLong.TWO_PWR_24_ = Long.fromInt(1 << 24);\n\n/**\n * Expose.\n */\nmodule.exports = Long;\nmodule.exports.Long = Long;\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar USER_AUTH_KEY = exports.USER_AUTH_KEY = '_stitch_ua';\nvar REFRESH_TOKEN_KEY = exports.REFRESH_TOKEN_KEY = '_stitch_rt';\nvar DEVICE_ID_KEY = exports.DEVICE_ID_KEY = '_stitch_did';\nvar STATE_KEY = exports.STATE_KEY = '_stitch_state';\nvar USER_AUTH_COOKIE_NAME = exports.USER_AUTH_COOKIE_NAME = 'stitch_ua';\nvar STITCH_ERROR_KEY = exports.STITCH_ERROR_KEY = '_stitch_error';\nvar STITCH_LINK_KEY = exports.STITCH_LINK_KEY = '_stitch_link';\nvar USER_LOGGED_IN_PT_KEY = exports.USER_LOGGED_IN_PT_KEY = '_stitch_pt';\nvar STITCH_REDIRECT_PROVIDER = exports.STITCH_REDIRECT_PROVIDER = '_stitch_rp';\n\nvar DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS = exports.DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS = 10;\n\nvar APP_CLIENT_CODEC = exports.APP_CLIENT_CODEC = {\n 'accessToken': 'access_token',\n 'refreshToken': 'refresh_token',\n 'deviceId': 'device_id',\n 'userId': 'user_id'\n};\n\nvar ADMIN_CLIENT_CODEC = exports.ADMIN_CLIENT_CODEC = {\n 'accessToken': 'access_token',\n 'refreshToken': 'refresh_token',\n 'deviceId': 'device_id',\n 'userId': 'user_id'\n};\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(global) {\n\n/**\n * Module dependencies.\n * @ignore\n */\n\n// Test if we're in Node via presence of \"global\" not absence of \"window\"\n// to support hybrid environments like Electron\nif (typeof global !== 'undefined') {\n var Buffer = __webpack_require__(0).Buffer; // TODO just use global Buffer\n}\n\n/**\n * A class representation of the BSON Binary type.\n *\n * Sub types\n * - **BSON.BSON_BINARY_SUBTYPE_DEFAULT**, default BSON type.\n * - **BSON.BSON_BINARY_SUBTYPE_FUNCTION**, BSON function type.\n * - **BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY**, BSON byte array type.\n * - **BSON.BSON_BINARY_SUBTYPE_UUID**, BSON uuid type.\n * - **BSON.BSON_BINARY_SUBTYPE_MD5**, BSON md5 type.\n * - **BSON.BSON_BINARY_SUBTYPE_USER_DEFINED**, BSON user defined type.\n *\n * @class\n * @param {Buffer} buffer a buffer object containing the binary data.\n * @param {Number} [subType] the option binary type.\n * @return {Binary}\n */\nfunction Binary(buffer, subType) {\n if (!(this instanceof Binary)) return new Binary(buffer, subType);\n\n this._bsontype = 'Binary';\n\n if (buffer instanceof Number) {\n this.sub_type = buffer;\n this.position = 0;\n } else {\n this.sub_type = subType == null ? BSON_BINARY_SUBTYPE_DEFAULT : subType;\n this.position = 0;\n }\n\n if (buffer != null && !(buffer instanceof Number)) {\n // Only accept Buffer, Uint8Array or Arrays\n if (typeof buffer == 'string') {\n // Different ways of writing the length of the string for the different types\n if (typeof Buffer != 'undefined') {\n this.buffer = new Buffer(buffer);\n } else if (typeof Uint8Array != 'undefined' || Object.prototype.toString.call(buffer) == '[object Array]') {\n this.buffer = writeStringToArray(buffer);\n } else {\n throw new Error(\"only String, Buffer, Uint8Array or Array accepted\");\n }\n } else {\n this.buffer = buffer;\n }\n this.position = buffer.length;\n } else {\n if (typeof Buffer != 'undefined') {\n this.buffer = new Buffer(Binary.BUFFER_SIZE);\n } else if (typeof Uint8Array != 'undefined') {\n this.buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE));\n } else {\n this.buffer = new Array(Binary.BUFFER_SIZE);\n }\n // Set position to start of buffer\n this.position = 0;\n }\n};\n\n/**\n * Updates this binary with byte_value.\n *\n * @method\n * @param {string} byte_value a single byte we wish to write.\n */\nBinary.prototype.put = function put(byte_value) {\n // If it's a string and a has more than one character throw an error\n if (byte_value['length'] != null && typeof byte_value != 'number' && byte_value.length != 1) throw new Error(\"only accepts single character String, Uint8Array or Array\");\n if (typeof byte_value != 'number' && byte_value < 0 || byte_value > 255) throw new Error(\"only accepts number in a valid unsigned byte range 0-255\");\n\n // Decode the byte value once\n var decoded_byte = null;\n if (typeof byte_value == 'string') {\n decoded_byte = byte_value.charCodeAt(0);\n } else if (byte_value['length'] != null) {\n decoded_byte = byte_value[0];\n } else {\n decoded_byte = byte_value;\n }\n\n if (this.buffer.length > this.position) {\n this.buffer[this.position++] = decoded_byte;\n } else {\n if (typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) {\n // Create additional overflow buffer\n var buffer = new Buffer(Binary.BUFFER_SIZE + this.buffer.length);\n // Combine the two buffers together\n this.buffer.copy(buffer, 0, 0, this.buffer.length);\n this.buffer = buffer;\n this.buffer[this.position++] = decoded_byte;\n } else {\n var buffer = null;\n // Create a new buffer (typed or normal array)\n if (Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') {\n buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE + this.buffer.length));\n } else {\n buffer = new Array(Binary.BUFFER_SIZE + this.buffer.length);\n }\n\n // We need to copy all the content to the new array\n for (var i = 0; i < this.buffer.length; i++) {\n buffer[i] = this.buffer[i];\n }\n\n // Reassign the buffer\n this.buffer = buffer;\n // Write the byte\n this.buffer[this.position++] = decoded_byte;\n }\n }\n};\n\n/**\n * Writes a buffer or string to the binary.\n *\n * @method\n * @param {(Buffer|string)} string a string or buffer to be written to the Binary BSON object.\n * @param {number} offset specify the binary of where to write the content.\n * @return {null}\n */\nBinary.prototype.write = function write(string, offset) {\n offset = typeof offset == 'number' ? offset : this.position;\n\n // If the buffer is to small let's extend the buffer\n if (this.buffer.length < offset + string.length) {\n var buffer = null;\n // If we are in node.js\n if (typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) {\n buffer = new Buffer(this.buffer.length + string.length);\n this.buffer.copy(buffer, 0, 0, this.buffer.length);\n } else if (Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') {\n // Create a new buffer\n buffer = new Uint8Array(new ArrayBuffer(this.buffer.length + string.length));\n // Copy the content\n for (var i = 0; i < this.position; i++) {\n buffer[i] = this.buffer[i];\n }\n }\n\n // Assign the new buffer\n this.buffer = buffer;\n }\n\n if (typeof Buffer != 'undefined' && Buffer.isBuffer(string) && Buffer.isBuffer(this.buffer)) {\n string.copy(this.buffer, offset, 0, string.length);\n this.position = offset + string.length > this.position ? offset + string.length : this.position;\n // offset = string.length\n } else if (typeof Buffer != 'undefined' && typeof string == 'string' && Buffer.isBuffer(this.buffer)) {\n this.buffer.write(string, offset, 'binary');\n this.position = offset + string.length > this.position ? offset + string.length : this.position;\n // offset = string.length;\n } else if (Object.prototype.toString.call(string) == '[object Uint8Array]' || Object.prototype.toString.call(string) == '[object Array]' && typeof string != 'string') {\n for (var i = 0; i < string.length; i++) {\n this.buffer[offset++] = string[i];\n }\n\n this.position = offset > this.position ? offset : this.position;\n } else if (typeof string == 'string') {\n for (var i = 0; i < string.length; i++) {\n this.buffer[offset++] = string.charCodeAt(i);\n }\n\n this.position = offset > this.position ? offset : this.position;\n }\n};\n\n/**\n * Reads **length** bytes starting at **position**.\n *\n * @method\n * @param {number} position read from the given position in the Binary.\n * @param {number} length the number of bytes to read.\n * @return {Buffer}\n */\nBinary.prototype.read = function read(position, length) {\n length = length && length > 0 ? length : this.position;\n\n // Let's return the data based on the type we have\n if (this.buffer['slice']) {\n return this.buffer.slice(position, position + length);\n } else {\n // Create a buffer to keep the result\n var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(length)) : new Array(length);\n for (var i = 0; i < length; i++) {\n buffer[i] = this.buffer[position++];\n }\n }\n // Return the buffer\n return buffer;\n};\n\n/**\n * Returns the value of this binary as a string.\n *\n * @method\n * @return {string}\n */\nBinary.prototype.value = function value(asRaw) {\n asRaw = asRaw == null ? false : asRaw;\n\n // Optimize to serialize for the situation where the data == size of buffer\n if (asRaw && typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer) && this.buffer.length == this.position) return this.buffer;\n\n // If it's a node.js buffer object\n if (typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) {\n return asRaw ? this.buffer.slice(0, this.position) : this.buffer.toString('binary', 0, this.position);\n } else {\n if (asRaw) {\n // we support the slice command use it\n if (this.buffer['slice'] != null) {\n return this.buffer.slice(0, this.position);\n } else {\n // Create a new buffer to copy content to\n var newBuffer = Object.prototype.toString.call(this.buffer) == '[object Uint8Array]' ? new Uint8Array(new ArrayBuffer(this.position)) : new Array(this.position);\n // Copy content\n for (var i = 0; i < this.position; i++) {\n newBuffer[i] = this.buffer[i];\n }\n // Return the buffer\n return newBuffer;\n }\n } else {\n return convertArraytoUtf8BinaryString(this.buffer, 0, this.position);\n }\n }\n};\n\n/**\n * Length.\n *\n * @method\n * @return {number} the length of the binary.\n */\nBinary.prototype.length = function length() {\n return this.position;\n};\n\n/**\n * @ignore\n */\nBinary.prototype.toJSON = function () {\n return this.buffer != null ? this.buffer.toString('base64') : '';\n};\n\n/**\n * @ignore\n */\nBinary.prototype.toString = function (format) {\n return this.buffer != null ? this.buffer.slice(0, this.position).toString(format) : '';\n};\n\n/**\n * Binary default subtype\n * @ignore\n */\nvar BSON_BINARY_SUBTYPE_DEFAULT = 0;\n\n/**\n * @ignore\n */\nvar writeStringToArray = function writeStringToArray(data) {\n // Create a buffer\n var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(data.length)) : new Array(data.length);\n // Write the content to the buffer\n for (var i = 0; i < data.length; i++) {\n buffer[i] = data.charCodeAt(i);\n }\n // Write the string to the buffer\n return buffer;\n};\n\n/**\n * Convert Array ot Uint8Array to Binary String\n *\n * @ignore\n */\nvar convertArraytoUtf8BinaryString = function convertArraytoUtf8BinaryString(byteArray, startIndex, endIndex) {\n var result = \"\";\n for (var i = startIndex; i < endIndex; i++) {\n result = result + String.fromCharCode(byteArray[i]);\n }\n return result;\n};\n\nBinary.BUFFER_SIZE = 256;\n\n/**\n * Default BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_DEFAULT = 0;\n/**\n * Function BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_FUNCTION = 1;\n/**\n * Byte Array BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_BYTE_ARRAY = 2;\n/**\n * OLD UUID BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_UUID_OLD = 3;\n/**\n * UUID BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_UUID = 4;\n/**\n * MD5 BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_MD5 = 5;\n/**\n * User BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_USER_DEFINED = 128;\n\n/**\n * Expose.\n */\nmodule.exports = Binary;\nmodule.exports.Binary = Binary;\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(17)))\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * A class representation of the BSON Code type.\n *\n * @class\n * @param {(string|function)} code a string or function.\n * @param {Object} [scope] an optional scope for the function.\n * @return {Code}\n */\nvar Code = function Code(code, scope) {\n if (!(this instanceof Code)) return new Code(code, scope);\n this._bsontype = 'Code';\n this.code = code;\n this.scope = scope;\n};\n\n/**\n * @ignore\n */\nCode.prototype.toJSON = function () {\n return { scope: this.scope, code: this.code };\n};\n\nmodule.exports = Code;\nmodule.exports.Code = Code;\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * A class representation of the BSON DBRef type.\n *\n * @class\n * @param {string} namespace the collection name.\n * @param {ObjectID} oid the reference ObjectID.\n * @param {string} [db] optional db name, if omitted the reference is local to the current db.\n * @return {DBRef}\n */\nfunction DBRef(namespace, oid, db) {\n if (!(this instanceof DBRef)) return new DBRef(namespace, oid, db);\n\n this._bsontype = 'DBRef';\n this.namespace = namespace;\n this.oid = oid;\n this.db = db;\n};\n\n/**\n * @ignore\n * @api private\n */\nDBRef.prototype.toJSON = function () {\n return {\n '$ref': this.namespace,\n '$id': this.oid,\n '$db': this.db == null ? '' : this.db\n };\n};\n\nmodule.exports = DBRef;\nmodule.exports.DBRef = DBRef;\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Buffer) {\n\nvar Long = __webpack_require__(3);\n\nvar PARSE_STRING_REGEXP = /^(\\+|\\-)?(\\d+|(\\d*\\.\\d*))?(E|e)?([\\-\\+])?(\\d+)?$/;\nvar PARSE_INF_REGEXP = /^(\\+|\\-)?(Infinity|inf)$/i;\nvar PARSE_NAN_REGEXP = /^(\\+|\\-)?NaN$/i;\n\nvar EXPONENT_MAX = 6111;\nvar EXPONENT_MIN = -6176;\nvar EXPONENT_BIAS = 6176;\nvar MAX_DIGITS = 34;\n\n// Nan value bits as 32 bit values (due to lack of longs)\nvar NAN_BUFFER = [0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].reverse();\n// Infinity value bits 32 bit values (due to lack of longs)\nvar INF_NEGATIVE_BUFFER = [0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].reverse();\nvar INF_POSITIVE_BUFFER = [0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].reverse();\n\nvar EXPONENT_REGEX = /^([\\-\\+])?(\\d+)?$/;\n\n// Detect if the value is a digit\nvar isDigit = function isDigit(value) {\n return !isNaN(parseInt(value, 10));\n};\n\n// Divide two uint128 values\nvar divideu128 = function divideu128(value) {\n var DIVISOR = Long.fromNumber(1000 * 1000 * 1000);\n var _rem = Long.fromNumber(0);\n var i = 0;\n\n if (!value.parts[0] && !value.parts[1] && !value.parts[2] && !value.parts[3]) {\n return { quotient: value, rem: _rem };\n }\n\n for (var i = 0; i <= 3; i++) {\n // Adjust remainder to match value of next dividend\n _rem = _rem.shiftLeft(32);\n // Add the divided to _rem\n _rem = _rem.add(new Long(value.parts[i], 0));\n value.parts[i] = _rem.div(DIVISOR).low_;\n _rem = _rem.modulo(DIVISOR);\n }\n\n return { quotient: value, rem: _rem };\n};\n\n// Multiply two Long values and return the 128 bit value\nvar multiply64x2 = function multiply64x2(left, right) {\n if (!left && !right) {\n return { high: Long.fromNumber(0), low: Long.fromNumber(0) };\n }\n\n var leftHigh = left.shiftRightUnsigned(32);\n var leftLow = new Long(left.getLowBits(), 0);\n var rightHigh = right.shiftRightUnsigned(32);\n var rightLow = new Long(right.getLowBits(), 0);\n\n var productHigh = leftHigh.multiply(rightHigh);\n var productMid = leftHigh.multiply(rightLow);\n var productMid2 = leftLow.multiply(rightHigh);\n var productLow = leftLow.multiply(rightLow);\n\n productHigh = productHigh.add(productMid.shiftRightUnsigned(32));\n productMid = new Long(productMid.getLowBits(), 0).add(productMid2).add(productLow.shiftRightUnsigned(32));\n\n productHigh = productHigh.add(productMid.shiftRightUnsigned(32));\n productLow = productMid.shiftLeft(32).add(new Long(productLow.getLowBits(), 0));\n\n // Return the 128 bit result\n return { high: productHigh, low: productLow };\n};\n\nvar lessThan = function lessThan(left, right) {\n // Make values unsigned\n var uhleft = left.high_ >>> 0;\n var uhright = right.high_ >>> 0;\n\n // Compare high bits first\n if (uhleft < uhright) {\n return true;\n } else if (uhleft == uhright) {\n var ulleft = left.low_ >>> 0;\n var ulright = right.low_ >>> 0;\n if (ulleft < ulright) return true;\n }\n\n return false;\n};\n\nvar longtoHex = function longtoHex(value) {\n var buffer = new Buffer(8);\n var index = 0;\n // Encode the low 64 bits of the decimal\n // Encode low bits\n buffer[index++] = value.low_ & 0xff;\n buffer[index++] = value.low_ >> 8 & 0xff;\n buffer[index++] = value.low_ >> 16 & 0xff;\n buffer[index++] = value.low_ >> 24 & 0xff;\n // Encode high bits\n buffer[index++] = value.high_ & 0xff;\n buffer[index++] = value.high_ >> 8 & 0xff;\n buffer[index++] = value.high_ >> 16 & 0xff;\n buffer[index++] = value.high_ >> 24 & 0xff;\n return buffer.reverse().toString('hex');\n};\n\nvar int32toHex = function int32toHex(value) {\n var buffer = new Buffer(4);\n var index = 0;\n // Encode the low 64 bits of the decimal\n // Encode low bits\n buffer[index++] = value & 0xff;\n buffer[index++] = value >> 8 & 0xff;\n buffer[index++] = value >> 16 & 0xff;\n buffer[index++] = value >> 24 & 0xff;\n return buffer.reverse().toString('hex');\n};\n\nvar Decimal128 = function Decimal128(bytes) {\n this._bsontype = 'Decimal128';\n this.bytes = bytes;\n};\n\nDecimal128.fromString = function (string) {\n // Parse state tracking\n var isNegative = false;\n var sawRadix = false;\n var foundNonZero = false;\n\n // Total number of significant digits (no leading or trailing zero)\n var significantDigits = 0;\n // Total number of significand digits read\n var nDigitsRead = 0;\n // Total number of digits (no leading zeros)\n var nDigits = 0;\n // The number of the digits after radix\n var radixPosition = 0;\n // The index of the first non-zero in *str*\n var firstNonZero = 0;\n\n // Digits Array\n var digits = [0];\n // The number of digits in digits\n var nDigitsStored = 0;\n // Insertion pointer for digits\n var digitsInsert = 0;\n // The index of the first non-zero digit\n var firstDigit = 0;\n // The index of the last digit\n var lastDigit = 0;\n\n // Exponent\n var exponent = 0;\n // loop index over array\n var i = 0;\n // The high 17 digits of the significand\n var significandHigh = [0, 0];\n // The low 17 digits of the significand\n var significandLow = [0, 0];\n // The biased exponent\n var biasedExponent = 0;\n\n // Read index\n var index = 0;\n\n // Trim the string\n string = string.trim();\n\n // Results\n var stringMatch = string.match(PARSE_STRING_REGEXP);\n var infMatch = string.match(PARSE_INF_REGEXP);\n var nanMatch = string.match(PARSE_NAN_REGEXP);\n\n // Validate the string\n if (!stringMatch && !infMatch && !nanMatch || string.length == 0) {\n throw new Error(\"\" + string + \" not a valid Decimal128 string\");\n }\n\n // Check if we have an illegal exponent format\n if (stringMatch && stringMatch[4] && stringMatch[2] === undefined) {\n throw new Error(\"\" + string + \" not a valid Decimal128 string\");\n }\n\n // Get the negative or positive sign\n if (string[index] == '+' || string[index] == '-') {\n isNegative = string[index++] == '-';\n }\n\n // Check if user passed Infinity or NaN\n if (!isDigit(string[index]) && string[index] != '.') {\n if (string[index] == 'i' || string[index] == 'I') {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER));\n } else if (string[index] == 'N') {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n }\n\n // Read all the digits\n while (isDigit(string[index]) || string[index] == '.') {\n if (string[index] == '.') {\n if (sawRadix) {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n\n sawRadix = true;\n index = index + 1;\n continue;\n }\n\n if (nDigitsStored < 34) {\n if (string[index] != '0' || foundNonZero) {\n if (!foundNonZero) {\n firstNonZero = nDigitsRead;\n }\n\n foundNonZero = true;\n\n // Only store 34 digits\n digits[digitsInsert++] = parseInt(string[index], 10);\n nDigitsStored = nDigitsStored + 1;\n }\n }\n\n if (foundNonZero) {\n nDigits = nDigits + 1;\n }\n\n if (sawRadix) {\n radixPosition = radixPosition + 1;\n }\n\n nDigitsRead = nDigitsRead + 1;\n index = index + 1;\n }\n\n if (sawRadix && !nDigitsRead) {\n throw new Error(\"\" + string + \" not a valid Decimal128 string\");\n }\n\n // Read exponent if exists\n if (string[index] == 'e' || string[index] == 'E') {\n // Read exponent digits\n var match = string.substr(++index).match(EXPONENT_REGEX);\n\n // No digits read\n if (!match || !match[2]) {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n\n // Get exponent\n exponent = parseInt(match[0], 10);\n\n // Adjust the index\n index = index + match[0].length;\n }\n\n // Return not a number\n if (string[index]) {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n\n // Done reading input\n // Find first non-zero digit in digits\n firstDigit = 0;\n\n if (!nDigitsStored) {\n firstDigit = 0;\n lastDigit = 0;\n digits[0] = 0;\n nDigits = 1;\n nDigitsStored = 1;\n significantDigits = 0;\n } else {\n lastDigit = nDigitsStored - 1;\n significantDigits = nDigits;\n\n if (exponent != 0 && significantDigits != 1) {\n while (string[firstNonZero + significantDigits - 1] == '0') {\n significantDigits = significantDigits - 1;\n }\n }\n }\n\n // Normalization of exponent\n // Correct exponent based on radix position, and shift significand as needed\n // to represent user input\n\n // Overflow prevention\n if (exponent <= radixPosition && radixPosition - exponent > 1 << 14) {\n exponent = EXPONENT_MIN;\n } else {\n exponent = exponent - radixPosition;\n }\n\n // Attempt to normalize the exponent\n while (exponent > EXPONENT_MAX) {\n // Shift exponent to significand and decrease\n lastDigit = lastDigit + 1;\n\n if (lastDigit - firstDigit > MAX_DIGITS) {\n // Check if we have a zero then just hard clamp, otherwise fail\n var digitsString = digits.join('');\n if (digitsString.match(/^0+$/)) {\n exponent = EXPONENT_MAX;\n break;\n } else {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER));\n }\n }\n\n exponent = exponent - 1;\n }\n\n while (exponent < EXPONENT_MIN || nDigitsStored < nDigits) {\n // Shift last digit\n if (lastDigit == 0) {\n exponent = EXPONENT_MIN;\n significantDigits = 0;\n break;\n }\n\n if (nDigitsStored < nDigits) {\n // adjust to match digits not stored\n nDigits = nDigits - 1;\n } else {\n // adjust to round\n lastDigit = lastDigit - 1;\n }\n\n if (exponent < EXPONENT_MAX) {\n exponent = exponent + 1;\n } else {\n // Check if we have a zero then just hard clamp, otherwise fail\n var digitsString = digits.join('');\n if (digitsString.match(/^0+$/)) {\n exponent = EXPONENT_MAX;\n break;\n } else {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER));\n }\n }\n }\n\n // Round\n // We've normalized the exponent, but might still need to round.\n if (lastDigit - firstDigit + 1 < significantDigits && string[significantDigits] != '0') {\n var endOfString = nDigitsRead;\n\n // If we have seen a radix point, 'string' is 1 longer than we have\n // documented with ndigits_read, so inc the position of the first nonzero\n // digit and the position that digits are read to.\n if (sawRadix && exponent == EXPONENT_MIN) {\n firstNonZero = firstNonZero + 1;\n endOfString = endOfString + 1;\n }\n\n var roundDigit = parseInt(string[firstNonZero + lastDigit + 1], 10);\n var roundBit = 0;\n\n if (roundDigit >= 5) {\n roundBit = 1;\n\n if (roundDigit == 5) {\n roundBit = digits[lastDigit] % 2 == 1;\n\n for (var i = firstNonZero + lastDigit + 2; i < endOfString; i++) {\n if (parseInt(string[i], 10)) {\n roundBit = 1;\n break;\n }\n }\n }\n }\n\n if (roundBit) {\n var dIdx = lastDigit;\n\n for (; dIdx >= 0; dIdx--) {\n if (++digits[dIdx] > 9) {\n digits[dIdx] = 0;\n\n // overflowed most significant digit\n if (dIdx == 0) {\n if (exponent < EXPONENT_MAX) {\n exponent = exponent + 1;\n digits[dIdx] = 1;\n } else {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER));\n }\n }\n } else {\n break;\n }\n }\n }\n }\n\n // Encode significand\n // The high 17 digits of the significand\n significandHigh = Long.fromNumber(0);\n // The low 17 digits of the significand\n significandLow = Long.fromNumber(0);\n\n // read a zero\n if (significantDigits == 0) {\n significandHigh = Long.fromNumber(0);\n significandLow = Long.fromNumber(0);\n } else if (lastDigit - firstDigit < 17) {\n var dIdx = firstDigit;\n significandLow = Long.fromNumber(digits[dIdx++]);\n significandHigh = new Long(0, 0);\n\n for (; dIdx <= lastDigit; dIdx++) {\n significandLow = significandLow.multiply(Long.fromNumber(10));\n significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));\n }\n } else {\n var dIdx = firstDigit;\n significandHigh = Long.fromNumber(digits[dIdx++]);\n\n for (; dIdx <= lastDigit - 17; dIdx++) {\n significandHigh = significandHigh.multiply(Long.fromNumber(10));\n significandHigh = significandHigh.add(Long.fromNumber(digits[dIdx]));\n }\n\n significandLow = Long.fromNumber(digits[dIdx++]);\n\n for (; dIdx <= lastDigit; dIdx++) {\n significandLow = significandLow.multiply(Long.fromNumber(10));\n significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));\n }\n }\n\n var significand = multiply64x2(significandHigh, Long.fromString(\"100000000000000000\"));\n\n significand.low = significand.low.add(significandLow);\n\n if (lessThan(significand.low, significandLow)) {\n significand.high = significand.high.add(Long.fromNumber(1));\n }\n\n // Biased exponent\n var biasedExponent = exponent + EXPONENT_BIAS;\n var dec = { low: Long.fromNumber(0), high: Long.fromNumber(0) };\n\n // Encode combination, exponent, and significand.\n if (significand.high.shiftRightUnsigned(49).and(Long.fromNumber(1)).equals(Long.fromNumber)) {\n // Encode '11' into bits 1 to 3\n dec.high = dec.high.or(Long.fromNumber(0x3).shiftLeft(61));\n dec.high = dec.high.or(Long.fromNumber(biasedExponent).and(Long.fromNumber(0x3fff).shiftLeft(47)));\n dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x7fffffffffff)));\n } else {\n dec.high = dec.high.or(Long.fromNumber(biasedExponent & 0x3fff).shiftLeft(49));\n dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x1ffffffffffff)));\n }\n\n dec.low = significand.low;\n\n // Encode sign\n if (isNegative) {\n dec.high = dec.high.or(Long.fromString('9223372036854775808'));\n }\n\n // Encode into a buffer\n var buffer = new Buffer(16);\n var index = 0;\n\n // Encode the low 64 bits of the decimal\n // Encode low bits\n buffer[index++] = dec.low.low_ & 0xff;\n buffer[index++] = dec.low.low_ >> 8 & 0xff;\n buffer[index++] = dec.low.low_ >> 16 & 0xff;\n buffer[index++] = dec.low.low_ >> 24 & 0xff;\n // Encode high bits\n buffer[index++] = dec.low.high_ & 0xff;\n buffer[index++] = dec.low.high_ >> 8 & 0xff;\n buffer[index++] = dec.low.high_ >> 16 & 0xff;\n buffer[index++] = dec.low.high_ >> 24 & 0xff;\n\n // Encode the high 64 bits of the decimal\n // Encode low bits\n buffer[index++] = dec.high.low_ & 0xff;\n buffer[index++] = dec.high.low_ >> 8 & 0xff;\n buffer[index++] = dec.high.low_ >> 16 & 0xff;\n buffer[index++] = dec.high.low_ >> 24 & 0xff;\n // Encode high bits\n buffer[index++] = dec.high.high_ & 0xff;\n buffer[index++] = dec.high.high_ >> 8 & 0xff;\n buffer[index++] = dec.high.high_ >> 16 & 0xff;\n buffer[index++] = dec.high.high_ >> 24 & 0xff;\n\n // Return the new Decimal128\n return new Decimal128(buffer);\n};\n\n// Extract least significant 5 bits\nvar COMBINATION_MASK = 0x1f;\n// Extract least significant 14 bits\nvar EXPONENT_MASK = 0x3fff;\n// Value of combination field for Inf\nvar COMBINATION_INFINITY = 30;\n// Value of combination field for NaN\nvar COMBINATION_NAN = 31;\n// Value of combination field for NaN\nvar COMBINATION_SNAN = 32;\n// decimal128 exponent bias\nvar EXPONENT_BIAS = 6176;\n\nDecimal128.prototype.toString = function () {\n // Note: bits in this routine are referred to starting at 0,\n // from the sign bit, towards the coefficient.\n\n // bits 0 - 31\n var high;\n // bits 32 - 63\n var midh;\n // bits 64 - 95\n var midl;\n // bits 96 - 127\n var low;\n // bits 1 - 5\n var combination;\n // decoded biased exponent (14 bits)\n var biased_exponent;\n // the number of significand digits\n var significand_digits = 0;\n // the base-10 digits in the significand\n var significand = new Array(36);\n for (var i = 0; i < significand.length; i++) {\n significand[i] = 0;\n } // read pointer into significand\n var index = 0;\n\n // unbiased exponent\n var exponent;\n // the exponent if scientific notation is used\n var scientific_exponent;\n\n // true if the number is zero\n var is_zero = false;\n\n // the most signifcant significand bits (50-46)\n var significand_msb;\n // temporary storage for significand decoding\n var significand128 = { parts: new Array(4) };\n // indexing variables\n var i;\n var j, k;\n\n // Output string\n var string = [];\n\n // Unpack index\n var index = 0;\n\n // Buffer reference\n var buffer = this.bytes;\n\n // Unpack the low 64bits into a long\n low = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n midl = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n // Unpack the high 64bits into a long\n midh = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n high = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n // Unpack index\n var index = 0;\n\n // Create the state of the decimal\n var dec = {\n low: new Long(low, midl),\n high: new Long(midh, high) };\n\n if (dec.high.lessThan(Long.ZERO)) {\n string.push('-');\n }\n\n // Decode combination field and exponent\n combination = high >> 26 & COMBINATION_MASK;\n\n if (combination >> 3 == 3) {\n // Check for 'special' values\n if (combination == COMBINATION_INFINITY) {\n return string.join('') + \"Infinity\";\n } else if (combination == COMBINATION_NAN) {\n return \"NaN\";\n } else {\n biased_exponent = high >> 15 & EXPONENT_MASK;\n significand_msb = 0x08 + (high >> 14 & 0x01);\n }\n } else {\n significand_msb = high >> 14 & 0x07;\n biased_exponent = high >> 17 & EXPONENT_MASK;\n }\n\n exponent = biased_exponent - EXPONENT_BIAS;\n\n // Create string of significand digits\n\n // Convert the 114-bit binary number represented by\n // (significand_high, significand_low) to at most 34 decimal\n // digits through modulo and division.\n significand128.parts[0] = (high & 0x3fff) + ((significand_msb & 0xf) << 14);\n significand128.parts[1] = midh;\n significand128.parts[2] = midl;\n significand128.parts[3] = low;\n\n if (significand128.parts[0] == 0 && significand128.parts[1] == 0 && significand128.parts[2] == 0 && significand128.parts[3] == 0) {\n is_zero = true;\n } else {\n for (var k = 3; k >= 0; k--) {\n var least_digits = 0;\n // Peform the divide\n var result = divideu128(significand128);\n significand128 = result.quotient;\n least_digits = result.rem.low_;\n\n // We now have the 9 least significant digits (in base 2).\n // Convert and output to string.\n if (!least_digits) continue;\n\n for (var j = 8; j >= 0; j--) {\n // significand[k * 9 + j] = Math.round(least_digits % 10);\n significand[k * 9 + j] = least_digits % 10;\n // least_digits = Math.round(least_digits / 10);\n least_digits = Math.floor(least_digits / 10);\n }\n }\n }\n\n // Output format options:\n // Scientific - [-]d.dddE(+/-)dd or [-]dE(+/-)dd\n // Regular - ddd.ddd\n\n if (is_zero) {\n significand_digits = 1;\n significand[index] = 0;\n } else {\n significand_digits = 36;\n var i = 0;\n\n while (!significand[index]) {\n i++;\n significand_digits = significand_digits - 1;\n index = index + 1;\n }\n }\n\n scientific_exponent = significand_digits - 1 + exponent;\n\n // The scientific exponent checks are dictated by the string conversion\n // specification and are somewhat arbitrary cutoffs.\n //\n // We must check exponent > 0, because if this is the case, the number\n // has trailing zeros. However, we *cannot* output these trailing zeros,\n // because doing so would change the precision of the value, and would\n // change stored data if the string converted number is round tripped.\n\n if (scientific_exponent >= 34 || scientific_exponent <= -7 || exponent > 0) {\n // Scientific format\n string.push(significand[index++]);\n significand_digits = significand_digits - 1;\n\n if (significand_digits) {\n string.push('.');\n }\n\n for (var i = 0; i < significand_digits; i++) {\n string.push(significand[index++]);\n }\n\n // Exponent\n string.push('E');\n if (scientific_exponent > 0) {\n string.push('+' + scientific_exponent);\n } else {\n string.push(scientific_exponent);\n }\n } else {\n // Regular format with no decimal place\n if (exponent >= 0) {\n for (var i = 0; i < significand_digits; i++) {\n string.push(significand[index++]);\n }\n } else {\n var radix_position = significand_digits + exponent;\n\n // non-zero digits before radix\n if (radix_position > 0) {\n for (var i = 0; i < radix_position; i++) {\n string.push(significand[index++]);\n }\n } else {\n string.push('0');\n }\n\n string.push('.');\n // add leading zeros after radix\n while (radix_position++ < 0) {\n string.push('0');\n }\n\n for (var i = 0; i < significand_digits - Math.max(radix_position - 1, 0); i++) {\n string.push(significand[index++]);\n }\n }\n }\n\n return string.join('');\n};\n\nDecimal128.prototype.toJSON = function () {\n return { \"$numberDecimal\": this.toString() };\n};\n\nmodule.exports = Decimal128;\nmodule.exports.Decimal128 = Decimal128;\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * A class representation of the BSON Double type.\n *\n * @class\n * @param {number} value the number we want to represent as a double.\n * @return {Double}\n */\nfunction Double(value) {\n if (!(this instanceof Double)) return new Double(value);\n\n this._bsontype = 'Double';\n this.value = value;\n}\n\n/**\n * Access the number value.\n *\n * @method\n * @return {number} returns the wrapped double number.\n */\nDouble.prototype.valueOf = function () {\n return this.value;\n};\n\n/**\n * @ignore\n */\nDouble.prototype.toJSON = function () {\n return this.value;\n};\n\nmodule.exports = Double;\nmodule.exports.Double = Double;\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * A class representation of the BSON MaxKey type.\n *\n * @class\n * @return {MaxKey} A MaxKey instance\n */\nfunction MaxKey() {\n if (!(this instanceof MaxKey)) return new MaxKey();\n\n this._bsontype = 'MaxKey';\n}\n\nmodule.exports = MaxKey;\nmodule.exports.MaxKey = MaxKey;\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * A class representation of the BSON MinKey type.\n *\n * @class\n * @return {MinKey} A MinKey instance\n */\nfunction MinKey() {\n if (!(this instanceof MinKey)) return new MinKey();\n\n this._bsontype = 'MinKey';\n}\n\nmodule.exports = MinKey;\nmodule.exports.MinKey = MinKey;\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Buffer, process) {\n\n/**\n * Machine id.\n *\n * Create a random 3-byte value (i.e. unique for this\n * process). Other drivers use a md5 of the machine id here, but\n * that would mean an asyc call to gethostname, so we don't bother.\n * @ignore\n */\nvar MACHINE_ID = parseInt(Math.random() * 0xFFFFFF, 10);\n\n// Regular expression that checks for hex value\nvar checkForHexRegExp = new RegExp(\"^[0-9a-fA-F]{24}$\");\nvar hasBufferType = false;\n\n// Check if buffer exists\ntry {\n if (Buffer && Buffer.from) hasBufferType = true;\n} catch (err) {};\n\n/**\n* Create a new ObjectID instance\n*\n* @class\n* @param {(string|number)} id Can be a 24 byte hex string, 12 byte binary string or a Number.\n* @property {number} generationTime The generation time of this ObjectId instance\n* @return {ObjectID} instance of ObjectID.\n*/\nvar ObjectID = function ObjectID(id) {\n // Duck-typing to support ObjectId from different npm packages\n if (id instanceof ObjectID) return id;\n if (!(this instanceof ObjectID)) return new ObjectID(id);\n\n this._bsontype = 'ObjectID';\n\n // The most common usecase (blank id, new objectId instance)\n if (id == null || typeof id == 'number') {\n // Generate a new id\n this.id = this.generate(id);\n // If we are caching the hex string\n if (ObjectID.cacheHexString) this.__id = this.toString('hex');\n // Return the object\n return;\n }\n\n // Check if the passed in id is valid\n var valid = ObjectID.isValid(id);\n\n // Throw an error if it's not a valid setup\n if (!valid && id != null) {\n throw new Error(\"Argument passed in must be a single String of 12 bytes or a string of 24 hex characters\");\n } else if (valid && typeof id == 'string' && id.length == 24 && hasBufferType) {\n return new ObjectID(new Buffer(id, 'hex'));\n } else if (valid && typeof id == 'string' && id.length == 24) {\n return ObjectID.createFromHexString(id);\n } else if (id != null && id.length === 12) {\n // assume 12 byte string\n this.id = id;\n } else if (id != null && id.toHexString) {\n // Duck-typing to support ObjectId from different npm packages\n return id;\n } else {\n throw new Error(\"Argument passed in must be a single String of 12 bytes or a string of 24 hex characters\");\n }\n\n if (ObjectID.cacheHexString) this.__id = this.toString('hex');\n};\n\n// Allow usage of ObjectId as well as ObjectID\nvar ObjectId = ObjectID;\n\n// Precomputed hex table enables speedy hex string conversion\nvar hexTable = [];\nfor (var i = 0; i < 256; i++) {\n hexTable[i] = (i <= 15 ? '0' : '') + i.toString(16);\n}\n\n/**\n* Return the ObjectID id as a 24 byte hex string representation\n*\n* @method\n* @return {string} return the 24 byte hex string representation.\n*/\nObjectID.prototype.toHexString = function () {\n if (ObjectID.cacheHexString && this.__id) return this.__id;\n\n var hexString = '';\n if (!this.id || !this.id.length) {\n throw new Error('invalid ObjectId, ObjectId.id must be either a string or a Buffer, but is [' + JSON.stringify(this.id) + ']');\n }\n\n if (this.id instanceof _Buffer) {\n hexString = convertToHex(this.id);\n if (ObjectID.cacheHexString) this.__id = hexString;\n return hexString;\n }\n\n for (var i = 0; i < this.id.length; i++) {\n hexString += hexTable[this.id.charCodeAt(i)];\n }\n\n if (ObjectID.cacheHexString) this.__id = hexString;\n return hexString;\n};\n\n/**\n* Update the ObjectID index used in generating new ObjectID's on the driver\n*\n* @method\n* @return {number} returns next index value.\n* @ignore\n*/\nObjectID.prototype.get_inc = function () {\n return ObjectID.index = (ObjectID.index + 1) % 0xFFFFFF;\n};\n\n/**\n* Update the ObjectID index used in generating new ObjectID's on the driver\n*\n* @method\n* @return {number} returns next index value.\n* @ignore\n*/\nObjectID.prototype.getInc = function () {\n return this.get_inc();\n};\n\n/**\n* Generate a 12 byte id buffer used in ObjectID's\n*\n* @method\n* @param {number} [time] optional parameter allowing to pass in a second based timestamp.\n* @return {Buffer} return the 12 byte id buffer string.\n*/\nObjectID.prototype.generate = function (time) {\n if ('number' != typeof time) {\n time = ~~(Date.now() / 1000);\n }\n\n // Use pid\n var pid = (typeof process === 'undefined' ? Math.floor(Math.random() * 100000) : process.pid) % 0xFFFF;\n var inc = this.get_inc();\n // Buffer used\n var buffer = new Buffer(12);\n // Encode time\n buffer[3] = time & 0xff;\n buffer[2] = time >> 8 & 0xff;\n buffer[1] = time >> 16 & 0xff;\n buffer[0] = time >> 24 & 0xff;\n // Encode machine\n buffer[6] = MACHINE_ID & 0xff;\n buffer[5] = MACHINE_ID >> 8 & 0xff;\n buffer[4] = MACHINE_ID >> 16 & 0xff;\n // Encode pid\n buffer[8] = pid & 0xff;\n buffer[7] = pid >> 8 & 0xff;\n // Encode index\n buffer[11] = inc & 0xff;\n buffer[10] = inc >> 8 & 0xff;\n buffer[9] = inc >> 16 & 0xff;\n // Return the buffer\n return buffer;\n};\n\n/**\n* Converts the id into a 24 byte hex string for printing\n*\n* @param {String} format The Buffer toString format parameter.\n* @return {String} return the 24 byte hex string representation.\n* @ignore\n*/\nObjectID.prototype.toString = function (format) {\n // Is the id a buffer then use the buffer toString method to return the format\n if (this.id && this.id.copy) {\n return this.id.toString(typeof format === 'string' ? format : 'hex');\n }\n\n // if(this.buffer )\n return this.toHexString();\n};\n\n/**\n* Converts to a string representation of this Id.\n*\n* @return {String} return the 24 byte hex string representation.\n* @ignore\n*/\nObjectID.prototype.inspect = ObjectID.prototype.toString;\n\n/**\n* Converts to its JSON representation.\n*\n* @return {String} return the 24 byte hex string representation.\n* @ignore\n*/\nObjectID.prototype.toJSON = function () {\n return this.toHexString();\n};\n\n/**\n* Compares the equality of this ObjectID with `otherID`.\n*\n* @method\n* @param {object} otherID ObjectID instance to compare against.\n* @return {boolean} the result of comparing two ObjectID's\n*/\nObjectID.prototype.equals = function equals(otherId) {\n var id;\n\n if (otherId instanceof ObjectID) {\n return this.toString() == otherId.toString();\n } else if (typeof otherId == 'string' && ObjectID.isValid(otherId) && otherId.length == 12 && this.id instanceof _Buffer) {\n return otherId === this.id.toString('binary');\n } else if (typeof otherId == 'string' && ObjectID.isValid(otherId) && otherId.length == 24) {\n return otherId.toLowerCase() === this.toHexString();\n } else if (typeof otherId == 'string' && ObjectID.isValid(otherId) && otherId.length == 12) {\n return otherId === this.id;\n } else if (otherId != null && (otherId instanceof ObjectID || otherId.toHexString)) {\n return otherId.toHexString() === this.toHexString();\n } else {\n return false;\n }\n};\n\n/**\n* Returns the generation date (accurate up to the second) that this ID was generated.\n*\n* @method\n* @return {date} the generation date\n*/\nObjectID.prototype.getTimestamp = function () {\n var timestamp = new Date();\n var time = this.id[3] | this.id[2] << 8 | this.id[1] << 16 | this.id[0] << 24;\n timestamp.setTime(Math.floor(time) * 1000);\n return timestamp;\n};\n\n/**\n* @ignore\n*/\nObjectID.index = ~~(Math.random() * 0xFFFFFF);\n\n/**\n* @ignore\n*/\nObjectID.createPk = function createPk() {\n return new ObjectID();\n};\n\n/**\n* Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID.\n*\n* @method\n* @param {number} time an integer number representing a number of seconds.\n* @return {ObjectID} return the created ObjectID\n*/\nObjectID.createFromTime = function createFromTime(time) {\n var buffer = new Buffer([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);\n // Encode time into first 4 bytes\n buffer[3] = time & 0xff;\n buffer[2] = time >> 8 & 0xff;\n buffer[1] = time >> 16 & 0xff;\n buffer[0] = time >> 24 & 0xff;\n // Return the new objectId\n return new ObjectID(buffer);\n};\n\n// Lookup tables\nvar encodeLookup = '0123456789abcdef'.split('');\nvar decodeLookup = [];\nvar i = 0;\nwhile (i < 10) {\n decodeLookup[0x30 + i] = i++;\n}while (i < 16) {\n decodeLookup[0x41 - 10 + i] = decodeLookup[0x61 - 10 + i] = i++;\n}var _Buffer = Buffer;\nvar convertToHex = function convertToHex(bytes) {\n return bytes.toString('hex');\n};\n\n/**\n* Creates an ObjectID from a hex string representation of an ObjectID.\n*\n* @method\n* @param {string} hexString create a ObjectID from a passed in 24 byte hexstring.\n* @return {ObjectID} return the created ObjectID\n*/\nObjectID.createFromHexString = function createFromHexString(string) {\n // Throw an error if it's not a valid setup\n if (typeof string === 'undefined' || string != null && string.length != 24) {\n throw new Error(\"Argument passed in must be a single String of 12 bytes or a string of 24 hex characters\");\n }\n\n // Use Buffer.from method if available\n if (hasBufferType) return new ObjectID(new Buffer(string, 'hex'));\n\n // Calculate lengths\n var array = new _Buffer(12);\n var n = 0;\n var i = 0;\n\n while (i < 24) {\n array[n++] = decodeLookup[string.charCodeAt(i++)] << 4 | decodeLookup[string.charCodeAt(i++)];\n }\n\n return new ObjectID(array);\n};\n\n/**\n* Checks if a value is a valid bson ObjectId\n*\n* @method\n* @return {boolean} return true if the value is a valid bson ObjectId, return false otherwise.\n*/\nObjectID.isValid = function isValid(id) {\n if (id == null) return false;\n\n if (typeof id == 'number') {\n return true;\n }\n\n if (typeof id == 'string') {\n return id.length == 12 || id.length == 24 && checkForHexRegExp.test(id);\n }\n\n if (id instanceof ObjectID) {\n return true;\n }\n\n if (id instanceof _Buffer) {\n return true;\n }\n\n // Duck-Typing detection of ObjectId like objects\n if (id.toHexString) {\n return id.id.length == 12 || id.id.length == 24 && checkForHexRegExp.test(id.id);\n }\n\n return false;\n};\n\n/**\n* @ignore\n*/\nObject.defineProperty(ObjectID.prototype, \"generationTime\", {\n enumerable: true,\n get: function get() {\n return this.id[3] | this.id[2] << 8 | this.id[1] << 16 | this.id[0] << 24;\n },\n set: function set(value) {\n // Encode time into first 4 bytes\n this.id[3] = value & 0xff;\n this.id[2] = value >> 8 & 0xff;\n this.id[1] = value >> 16 & 0xff;\n this.id[0] = value >> 24 & 0xff;\n }\n});\n\n/**\n * Expose.\n */\nmodule.exports = ObjectID;\nmodule.exports.ObjectID = ObjectID;\nmodule.exports.ObjectId = ObjectID;\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer, __webpack_require__(25)))\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * A class representation of the BSON RegExp type.\n *\n * @class\n * @return {BSONRegExp} A MinKey instance\n */\nfunction BSONRegExp(pattern, options) {\n if (!(this instanceof BSONRegExp)) return new BSONRegExp();\n\n // Execute\n this._bsontype = 'BSONRegExp';\n this.pattern = pattern || '';\n this.options = options || '';\n\n // Validate options\n for (var i = 0; i < this.options.length; i++) {\n if (!(this.options[i] == 'i' || this.options[i] == 'm' || this.options[i] == 'x' || this.options[i] == 'l' || this.options[i] == 's' || this.options[i] == 'u')) {\n throw new Error('the regular expression options [' + this.options[i] + \"] is not supported\");\n }\n }\n}\n\nmodule.exports = BSONRegExp;\nmodule.exports.BSONRegExp = BSONRegExp;\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * A class representation of the BSON Symbol type.\n *\n * @class\n * @deprecated\n * @param {string} value the string representing the symbol.\n * @return {Symbol}\n */\nfunction _Symbol(value) {\n if (!(this instanceof _Symbol)) return new _Symbol(value);\n this._bsontype = 'Symbol';\n this.value = value;\n}\n\n/**\n * Access the wrapped string value.\n *\n * @method\n * @return {String} returns the wrapped string.\n */\n_Symbol.prototype.valueOf = function () {\n return this.value;\n};\n\n/**\n * @ignore\n */\n_Symbol.prototype.toString = function () {\n return this.value;\n};\n\n/**\n * @ignore\n */\n_Symbol.prototype.inspect = function () {\n return this.value;\n};\n\n/**\n * @ignore\n */\n_Symbol.prototype.toJSON = function () {\n return this.value;\n};\n\nmodule.exports = _Symbol;\nmodule.exports.Symbol = _Symbol;\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n// Copyright 2009 Google Inc. All Rights Reserved\n\n/**\n * This type is for INTERNAL use in MongoDB only and should not be used in applications.\n * The appropriate corresponding type is the JavaScript Date type.\n * \n * Defines a Timestamp class for representing a 64-bit two's-complement\n * integer value, which faithfully simulates the behavior of a Java \"Timestamp\". This\n * implementation is derived from TimestampLib in GWT.\n *\n * Constructs a 64-bit two's-complement integer, given its low and high 32-bit\n * values as *signed* integers. See the from* functions below for more\n * convenient ways of constructing Timestamps.\n *\n * The internal representation of a Timestamp is the two given signed, 32-bit values.\n * We use 32-bit pieces because these are the size of integers on which\n * Javascript performs bit-operations. For operations like addition and\n * multiplication, we split each number into 16-bit pieces, which can easily be\n * multiplied within Javascript's floating-point representation without overflow\n * or change in sign.\n *\n * In the algorithms below, we frequently reduce the negative case to the\n * positive case by negating the input(s) and then post-processing the result.\n * Note that we must ALWAYS check specially whether those values are MIN_VALUE\n * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\n * a positive number, it overflows back into a negative). Not handling this\n * case would often result in infinite recursion.\n *\n * @class\n * @param {number} low the low (signed) 32 bits of the Timestamp.\n * @param {number} high the high (signed) 32 bits of the Timestamp.\n */\nfunction Timestamp(low, high) {\n if (!(this instanceof Timestamp)) return new Timestamp(low, high);\n this._bsontype = 'Timestamp';\n /**\n * @type {number}\n * @ignore\n */\n this.low_ = low | 0; // force into 32 signed bits.\n\n /**\n * @type {number}\n * @ignore\n */\n this.high_ = high | 0; // force into 32 signed bits.\n};\n\n/**\n * Return the int value.\n *\n * @return {number} the value, assuming it is a 32-bit integer.\n */\nTimestamp.prototype.toInt = function () {\n return this.low_;\n};\n\n/**\n * Return the Number value.\n *\n * @method\n * @return {number} the closest floating-point representation to this value.\n */\nTimestamp.prototype.toNumber = function () {\n return this.high_ * Timestamp.TWO_PWR_32_DBL_ + this.getLowBitsUnsigned();\n};\n\n/**\n * Return the JSON value.\n *\n * @method\n * @return {string} the JSON representation.\n */\nTimestamp.prototype.toJSON = function () {\n return this.toString();\n};\n\n/**\n * Return the String value.\n *\n * @method\n * @param {number} [opt_radix] the radix in which the text should be written.\n * @return {string} the textual representation of this value.\n */\nTimestamp.prototype.toString = function (opt_radix) {\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (this.isZero()) {\n return '0';\n }\n\n if (this.isNegative()) {\n if (this.equals(Timestamp.MIN_VALUE)) {\n // We need to change the Timestamp value before it can be negated, so we remove\n // the bottom-most digit in this base and then recurse to do the rest.\n var radixTimestamp = Timestamp.fromNumber(radix);\n var div = this.div(radixTimestamp);\n var rem = div.multiply(radixTimestamp).subtract(this);\n return div.toString(radix) + rem.toInt().toString(radix);\n } else {\n return '-' + this.negate().toString(radix);\n }\n }\n\n // Do several (6) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Timestamp.fromNumber(Math.pow(radix, 6));\n\n var rem = this;\n var result = '';\n while (true) {\n var remDiv = rem.div(radixToPower);\n var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt();\n var digits = intval.toString(radix);\n\n rem = remDiv;\n if (rem.isZero()) {\n return digits + result;\n } else {\n while (digits.length < 6) {\n digits = '0' + digits;\n }\n result = '' + digits + result;\n }\n }\n};\n\n/**\n * Return the high 32-bits value.\n *\n * @method\n * @return {number} the high 32-bits as a signed value.\n */\nTimestamp.prototype.getHighBits = function () {\n return this.high_;\n};\n\n/**\n * Return the low 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as a signed value.\n */\nTimestamp.prototype.getLowBits = function () {\n return this.low_;\n};\n\n/**\n * Return the low unsigned 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as an unsigned value.\n */\nTimestamp.prototype.getLowBitsUnsigned = function () {\n return this.low_ >= 0 ? this.low_ : Timestamp.TWO_PWR_32_DBL_ + this.low_;\n};\n\n/**\n * Returns the number of bits needed to represent the absolute value of this Timestamp.\n *\n * @method\n * @return {number} Returns the number of bits needed to represent the absolute value of this Timestamp.\n */\nTimestamp.prototype.getNumBitsAbs = function () {\n if (this.isNegative()) {\n if (this.equals(Timestamp.MIN_VALUE)) {\n return 64;\n } else {\n return this.negate().getNumBitsAbs();\n }\n } else {\n var val = this.high_ != 0 ? this.high_ : this.low_;\n for (var bit = 31; bit > 0; bit--) {\n if ((val & 1 << bit) != 0) {\n break;\n }\n }\n return this.high_ != 0 ? bit + 33 : bit + 1;\n }\n};\n\n/**\n * Return whether this value is zero.\n *\n * @method\n * @return {boolean} whether this value is zero.\n */\nTimestamp.prototype.isZero = function () {\n return this.high_ == 0 && this.low_ == 0;\n};\n\n/**\n * Return whether this value is negative.\n *\n * @method\n * @return {boolean} whether this value is negative.\n */\nTimestamp.prototype.isNegative = function () {\n return this.high_ < 0;\n};\n\n/**\n * Return whether this value is odd.\n *\n * @method\n * @return {boolean} whether this value is odd.\n */\nTimestamp.prototype.isOdd = function () {\n return (this.low_ & 1) == 1;\n};\n\n/**\n * Return whether this Timestamp equals the other\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp equals the other\n */\nTimestamp.prototype.equals = function (other) {\n return this.high_ == other.high_ && this.low_ == other.low_;\n};\n\n/**\n * Return whether this Timestamp does not equal the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp does not equal the other.\n */\nTimestamp.prototype.notEquals = function (other) {\n return this.high_ != other.high_ || this.low_ != other.low_;\n};\n\n/**\n * Return whether this Timestamp is less than the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is less than the other.\n */\nTimestamp.prototype.lessThan = function (other) {\n return this.compare(other) < 0;\n};\n\n/**\n * Return whether this Timestamp is less than or equal to the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is less than or equal to the other.\n */\nTimestamp.prototype.lessThanOrEqual = function (other) {\n return this.compare(other) <= 0;\n};\n\n/**\n * Return whether this Timestamp is greater than the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is greater than the other.\n */\nTimestamp.prototype.greaterThan = function (other) {\n return this.compare(other) > 0;\n};\n\n/**\n * Return whether this Timestamp is greater than or equal to the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is greater than or equal to the other.\n */\nTimestamp.prototype.greaterThanOrEqual = function (other) {\n return this.compare(other) >= 0;\n};\n\n/**\n * Compares this Timestamp with the given one.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater.\n */\nTimestamp.prototype.compare = function (other) {\n if (this.equals(other)) {\n return 0;\n }\n\n var thisNeg = this.isNegative();\n var otherNeg = other.isNegative();\n if (thisNeg && !otherNeg) {\n return -1;\n }\n if (!thisNeg && otherNeg) {\n return 1;\n }\n\n // at this point, the signs are the same, so subtraction will not overflow\n if (this.subtract(other).isNegative()) {\n return -1;\n } else {\n return 1;\n }\n};\n\n/**\n * The negation of this value.\n *\n * @method\n * @return {Timestamp} the negation of this value.\n */\nTimestamp.prototype.negate = function () {\n if (this.equals(Timestamp.MIN_VALUE)) {\n return Timestamp.MIN_VALUE;\n } else {\n return this.not().add(Timestamp.ONE);\n }\n};\n\n/**\n * Returns the sum of this and the given Timestamp.\n *\n * @method\n * @param {Timestamp} other Timestamp to add to this one.\n * @return {Timestamp} the sum of this and the given Timestamp.\n */\nTimestamp.prototype.add = function (other) {\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0,\n c32 = 0,\n c16 = 0,\n c00 = 0;\n c00 += a00 + b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 + b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 + b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 + b48;\n c48 &= 0xFFFF;\n return Timestamp.fromBits(c16 << 16 | c00, c48 << 16 | c32);\n};\n\n/**\n * Returns the difference of this and the given Timestamp.\n *\n * @method\n * @param {Timestamp} other Timestamp to subtract from this.\n * @return {Timestamp} the difference of this and the given Timestamp.\n */\nTimestamp.prototype.subtract = function (other) {\n return this.add(other.negate());\n};\n\n/**\n * Returns the product of this and the given Timestamp.\n *\n * @method\n * @param {Timestamp} other Timestamp to multiply with this.\n * @return {Timestamp} the product of this and the other.\n */\nTimestamp.prototype.multiply = function (other) {\n if (this.isZero()) {\n return Timestamp.ZERO;\n } else if (other.isZero()) {\n return Timestamp.ZERO;\n }\n\n if (this.equals(Timestamp.MIN_VALUE)) {\n return other.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO;\n } else if (other.equals(Timestamp.MIN_VALUE)) {\n return this.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().multiply(other.negate());\n } else {\n return this.negate().multiply(other).negate();\n }\n } else if (other.isNegative()) {\n return this.multiply(other.negate()).negate();\n }\n\n // If both Timestamps are small, use float multiplication\n if (this.lessThan(Timestamp.TWO_PWR_24_) && other.lessThan(Timestamp.TWO_PWR_24_)) {\n return Timestamp.fromNumber(this.toNumber() * other.toNumber());\n }\n\n // Divide each Timestamp into 4 chunks of 16 bits, and then add up 4x4 products.\n // We can skip products that would overflow.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0,\n c32 = 0,\n c16 = 0,\n c00 = 0;\n c00 += a00 * b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 * b00;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c16 += a00 * b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 * b00;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a16 * b16;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a00 * b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\n c48 &= 0xFFFF;\n return Timestamp.fromBits(c16 << 16 | c00, c48 << 16 | c32);\n};\n\n/**\n * Returns this Timestamp divided by the given one.\n *\n * @method\n * @param {Timestamp} other Timestamp by which to divide.\n * @return {Timestamp} this Timestamp divided by the given one.\n */\nTimestamp.prototype.div = function (other) {\n if (other.isZero()) {\n throw Error('division by zero');\n } else if (this.isZero()) {\n return Timestamp.ZERO;\n }\n\n if (this.equals(Timestamp.MIN_VALUE)) {\n if (other.equals(Timestamp.ONE) || other.equals(Timestamp.NEG_ONE)) {\n return Timestamp.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\n } else if (other.equals(Timestamp.MIN_VALUE)) {\n return Timestamp.ONE;\n } else {\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\n var halfThis = this.shiftRight(1);\n var approx = halfThis.div(other).shiftLeft(1);\n if (approx.equals(Timestamp.ZERO)) {\n return other.isNegative() ? Timestamp.ONE : Timestamp.NEG_ONE;\n } else {\n var rem = this.subtract(other.multiply(approx));\n var result = approx.add(rem.div(other));\n return result;\n }\n }\n } else if (other.equals(Timestamp.MIN_VALUE)) {\n return Timestamp.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().div(other.negate());\n } else {\n return this.negate().div(other).negate();\n }\n } else if (other.isNegative()) {\n return this.div(other.negate()).negate();\n }\n\n // Repeat the following until the remainder is less than other: find a\n // floating-point that approximates remainder / other *from below*, add this\n // into the result, and subtract it from the remainder. It is critical that\n // the approximate value is less than or equal to the real value so that the\n // remainder never becomes negative.\n var res = Timestamp.ZERO;\n var rem = this;\n while (rem.greaterThanOrEqual(other)) {\n // Approximate the result of division. This may be a little greater or\n // smaller than the actual value.\n var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber()));\n\n // We will tweak the approximate result by changing it in the 48-th digit or\n // the smallest non-fractional digit, whichever is larger.\n var log2 = Math.ceil(Math.log(approx) / Math.LN2);\n var delta = log2 <= 48 ? 1 : Math.pow(2, log2 - 48);\n\n // Decrease the approximation until it is smaller than the remainder. Note\n // that if it is too large, the product overflows and is negative.\n var approxRes = Timestamp.fromNumber(approx);\n var approxRem = approxRes.multiply(other);\n while (approxRem.isNegative() || approxRem.greaterThan(rem)) {\n approx -= delta;\n approxRes = Timestamp.fromNumber(approx);\n approxRem = approxRes.multiply(other);\n }\n\n // We know the answer can't be zero... and actually, zero would cause\n // infinite recursion since we would make no progress.\n if (approxRes.isZero()) {\n approxRes = Timestamp.ONE;\n }\n\n res = res.add(approxRes);\n rem = rem.subtract(approxRem);\n }\n return res;\n};\n\n/**\n * Returns this Timestamp modulo the given one.\n *\n * @method\n * @param {Timestamp} other Timestamp by which to mod.\n * @return {Timestamp} this Timestamp modulo the given one.\n */\nTimestamp.prototype.modulo = function (other) {\n return this.subtract(this.div(other).multiply(other));\n};\n\n/**\n * The bitwise-NOT of this value.\n *\n * @method\n * @return {Timestamp} the bitwise-NOT of this value.\n */\nTimestamp.prototype.not = function () {\n return Timestamp.fromBits(~this.low_, ~this.high_);\n};\n\n/**\n * Returns the bitwise-AND of this Timestamp and the given one.\n *\n * @method\n * @param {Timestamp} other the Timestamp with which to AND.\n * @return {Timestamp} the bitwise-AND of this and the other.\n */\nTimestamp.prototype.and = function (other) {\n return Timestamp.fromBits(this.low_ & other.low_, this.high_ & other.high_);\n};\n\n/**\n * Returns the bitwise-OR of this Timestamp and the given one.\n *\n * @method\n * @param {Timestamp} other the Timestamp with which to OR.\n * @return {Timestamp} the bitwise-OR of this and the other.\n */\nTimestamp.prototype.or = function (other) {\n return Timestamp.fromBits(this.low_ | other.low_, this.high_ | other.high_);\n};\n\n/**\n * Returns the bitwise-XOR of this Timestamp and the given one.\n *\n * @method\n * @param {Timestamp} other the Timestamp with which to XOR.\n * @return {Timestamp} the bitwise-XOR of this and the other.\n */\nTimestamp.prototype.xor = function (other) {\n return Timestamp.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_);\n};\n\n/**\n * Returns this Timestamp with bits shifted to the left by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Timestamp} this shifted to the left by the given amount.\n */\nTimestamp.prototype.shiftLeft = function (numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var low = this.low_;\n if (numBits < 32) {\n var high = this.high_;\n return Timestamp.fromBits(low << numBits, high << numBits | low >>> 32 - numBits);\n } else {\n return Timestamp.fromBits(0, low << numBits - 32);\n }\n }\n};\n\n/**\n * Returns this Timestamp with bits shifted to the right by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Timestamp} this shifted to the right by the given amount.\n */\nTimestamp.prototype.shiftRight = function (numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Timestamp.fromBits(low >>> numBits | high << 32 - numBits, high >> numBits);\n } else {\n return Timestamp.fromBits(high >> numBits - 32, high >= 0 ? 0 : -1);\n }\n }\n};\n\n/**\n * Returns this Timestamp with bits shifted to the right by the given amount, with the new top bits matching the current sign bit.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Timestamp} this shifted to the right by the given amount, with zeros placed into the new leading bits.\n */\nTimestamp.prototype.shiftRightUnsigned = function (numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Timestamp.fromBits(low >>> numBits | high << 32 - numBits, high >>> numBits);\n } else if (numBits == 32) {\n return Timestamp.fromBits(high, 0);\n } else {\n return Timestamp.fromBits(high >>> numBits - 32, 0);\n }\n }\n};\n\n/**\n * Returns a Timestamp representing the given (32-bit) integer value.\n *\n * @method\n * @param {number} value the 32-bit integer in question.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromInt = function (value) {\n if (-128 <= value && value < 128) {\n var cachedObj = Timestamp.INT_CACHE_[value];\n if (cachedObj) {\n return cachedObj;\n }\n }\n\n var obj = new Timestamp(value | 0, value < 0 ? -1 : 0);\n if (-128 <= value && value < 128) {\n Timestamp.INT_CACHE_[value] = obj;\n }\n return obj;\n};\n\n/**\n * Returns a Timestamp representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n *\n * @method\n * @param {number} value the number in question.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromNumber = function (value) {\n if (isNaN(value) || !isFinite(value)) {\n return Timestamp.ZERO;\n } else if (value <= -Timestamp.TWO_PWR_63_DBL_) {\n return Timestamp.MIN_VALUE;\n } else if (value + 1 >= Timestamp.TWO_PWR_63_DBL_) {\n return Timestamp.MAX_VALUE;\n } else if (value < 0) {\n return Timestamp.fromNumber(-value).negate();\n } else {\n return new Timestamp(value % Timestamp.TWO_PWR_32_DBL_ | 0, value / Timestamp.TWO_PWR_32_DBL_ | 0);\n }\n};\n\n/**\n * Returns a Timestamp representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits.\n *\n * @method\n * @param {number} lowBits the low 32-bits.\n * @param {number} highBits the high 32-bits.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromBits = function (lowBits, highBits) {\n return new Timestamp(lowBits, highBits);\n};\n\n/**\n * Returns a Timestamp representation of the given string, written using the given radix.\n *\n * @method\n * @param {string} str the textual representation of the Timestamp.\n * @param {number} opt_radix the radix in which the text is written.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromString = function (str, opt_radix) {\n if (str.length == 0) {\n throw Error('number format error: empty string');\n }\n\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (str.charAt(0) == '-') {\n return Timestamp.fromString(str.substring(1), radix).negate();\n } else if (str.indexOf('-') >= 0) {\n throw Error('number format error: interior \"-\" character: ' + str);\n }\n\n // Do several (8) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Timestamp.fromNumber(Math.pow(radix, 8));\n\n var result = Timestamp.ZERO;\n for (var i = 0; i < str.length; i += 8) {\n var size = Math.min(8, str.length - i);\n var value = parseInt(str.substring(i, i + size), radix);\n if (size < 8) {\n var power = Timestamp.fromNumber(Math.pow(radix, size));\n result = result.multiply(power).add(Timestamp.fromNumber(value));\n } else {\n result = result.multiply(radixToPower);\n result = result.add(Timestamp.fromNumber(value));\n }\n }\n return result;\n};\n\n// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the\n// from* methods on which they depend.\n\n\n/**\n * A cache of the Timestamp representations of small integer values.\n * @type {Object}\n * @ignore\n */\nTimestamp.INT_CACHE_ = {};\n\n// NOTE: the compiler should inline these constant values below and then remove\n// these variables, so there should be no runtime penalty for these.\n\n/**\n * Number used repeated below in calculations. This must appear before the\n * first call to any from* function below.\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_16_DBL_ = 1 << 16;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_24_DBL_ = 1 << 24;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_32_DBL_ = Timestamp.TWO_PWR_16_DBL_ * Timestamp.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_31_DBL_ = Timestamp.TWO_PWR_32_DBL_ / 2;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_48_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_64_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_32_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_63_DBL_ = Timestamp.TWO_PWR_64_DBL_ / 2;\n\n/** @type {Timestamp} */\nTimestamp.ZERO = Timestamp.fromInt(0);\n\n/** @type {Timestamp} */\nTimestamp.ONE = Timestamp.fromInt(1);\n\n/** @type {Timestamp} */\nTimestamp.NEG_ONE = Timestamp.fromInt(-1);\n\n/** @type {Timestamp} */\nTimestamp.MAX_VALUE = Timestamp.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0);\n\n/** @type {Timestamp} */\nTimestamp.MIN_VALUE = Timestamp.fromBits(0, 0x80000000 | 0);\n\n/**\n * @type {Timestamp}\n * @ignore\n */\nTimestamp.TWO_PWR_24_ = Timestamp.fromInt(1 << 24);\n\n/**\n * Expose.\n */\nmodule.exports = Timestamp;\nmodule.exports.Timestamp = Timestamp;\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.makeFetchArgs = exports.checkStatus = exports.SDK_VERSION = exports.DEFAULT_STITCH_SERVER_URL = exports.ADMIN_CLIENT_TYPE = exports.APP_CLIENT_TYPE = exports.JSONTYPE = undefined;\n\nvar _errors = __webpack_require__(19);\n\nvar JSONTYPE = exports.JSONTYPE = 'application/json';\nvar APP_CLIENT_TYPE = exports.APP_CLIENT_TYPE = 'app';\nvar ADMIN_CLIENT_TYPE = exports.ADMIN_CLIENT_TYPE = 'admin';\nvar DEFAULT_STITCH_SERVER_URL = exports.DEFAULT_STITCH_SERVER_URL = 'https://stitch.mongodb.com';\n\n// VERSION is substituted with the package.json version number at build time\nvar version = 'unknown';\nif (true) {\n version = \"3.0.0\";\n}\nvar SDK_VERSION = exports.SDK_VERSION = version;\n\nvar checkStatus = exports.checkStatus = function checkStatus(response) {\n if (response.status >= 200 && response.status < 300) {\n return response;\n }\n\n if (response.headers.get('Content-Type') === JSONTYPE) {\n return response.json().then(function (json) {\n var error = new _errors.StitchError(json.error, json.error_code);\n error.response = response;\n error.json = json;\n return Promise.reject(error);\n });\n }\n\n var error = new Error(response.statusText);\n error.response = response;\n return Promise.reject(error);\n};\n\nvar makeFetchArgs = exports.makeFetchArgs = function makeFetchArgs(method, body) {\n var init = {\n method: method,\n headers: { 'Accept': JSONTYPE, 'Content-Type': JSONTYPE }\n };\n\n if (body) {\n init.body = body;\n }\n\n init.cors = true;\n return init;\n};\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports) {\n\nvar g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Int32 = function Int32(value) {\n if (!(this instanceof Int32)) return new Int32(value);\n\n this._bsontype = 'Int32';\n this.value = value;\n};\n\n/**\n * Access the number value.\n *\n * @method\n * @return {number} returns the wrapped int32 number.\n */\nInt32.prototype.valueOf = function () {\n return this.value;\n};\n\n/**\n * @ignore\n */\nInt32.prototype.toJSON = function () {\n return this.value;\n};\n\nmodule.exports = Int32;\nmodule.exports.Int32 = Int32;\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nfunction _extendableBuiltin(cls) {\n function ExtendableBuiltin() {\n var instance = Reflect.construct(cls, Array.from(arguments));\n Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n return instance;\n }\n\n ExtendableBuiltin.prototype = Object.create(cls.prototype, {\n constructor: {\n value: cls,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(ExtendableBuiltin, cls);\n } else {\n ExtendableBuiltin.__proto__ = cls;\n }\n\n return ExtendableBuiltin;\n}\n\n/**\n * Creates a new StitchError\n *\n * @class\n * @augments Error\n * @param {String} message The error message.\n * @param {Object} code The error code.\n * @return {StitchError} A StitchError instance.\n */\nvar StitchError = function (_extendableBuiltin2) {\n _inherits(StitchError, _extendableBuiltin2);\n\n function StitchError(message, code) {\n _classCallCheck(this, StitchError);\n\n var _this = _possibleConstructorReturn(this, (StitchError.__proto__ || Object.getPrototypeOf(StitchError)).call(this, message));\n\n _this.name = 'StitchError';\n _this.message = message;\n if (code !== undefined) {\n _this.code = code;\n }\n\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(_this, _this.constructor);\n } else {\n _this.stack = new Error(message).stack;\n }\n return _this;\n }\n\n return StitchError;\n}(_extendableBuiltin(Error));\n\nvar ErrAuthProviderNotFound = 'AuthProviderNotFound';\nvar ErrInvalidSession = 'InvalidSession';\nvar ErrUnauthorized = 'Unauthorized';\n\nexports.StitchError = StitchError;\nexports.ErrAuthProviderNotFound = ErrAuthProviderNotFound;\nexports.ErrInvalidSession = ErrInvalidSession;\nexports.ErrUnauthorized = ErrUnauthorized;\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.StitchClient = exports.StitchClientFactory = undefined;\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* global window, fetch */\n/* eslint no-labels: ['error', { 'allowLoop': true }] */\n\n\nexports.newStitchClient = newStitchClient;\n\n__webpack_require__(24);\n\nvar _auth = __webpack_require__(32);\n\nvar _providers = __webpack_require__(23);\n\nvar _common = __webpack_require__(4);\n\nvar _services = __webpack_require__(38);\n\nvar _services2 = _interopRequireDefault(_services);\n\nvar _common2 = __webpack_require__(16);\n\nvar common = _interopRequireWildcard(_common2);\n\nvar _mongodbExtjson = __webpack_require__(21);\n\nvar _mongodbExtjson2 = _interopRequireDefault(_mongodbExtjson);\n\nvar _queryString = __webpack_require__(69);\n\nvar _queryString2 = _interopRequireDefault(_queryString);\n\nvar _errors = __webpack_require__(19);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar v1 = 1;\nvar v2 = 2;\nvar v3 = 3;\nvar API_TYPE_PUBLIC = 'public';\nvar API_TYPE_PRIVATE = 'private';\nvar API_TYPE_CLIENT = 'client';\nvar API_TYPE_APP = 'app';\n\n/**\n * Factory class to create a new StitchClient asynchronously.\n */\n\nvar StitchClientFactory = exports.StitchClientFactory = function () {\n function StitchClientFactory() {\n _classCallCheck(this, StitchClientFactory);\n\n throw new _errors.StitchError('StitchClient can only be made from the StitchClientFactory.create function');\n }\n\n _createClass(StitchClientFactory, null, [{\n key: 'create',\n value: function create(clientAppID) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n return newStitchClient(StitchClient.prototype, clientAppID, options);\n }\n }]);\n\n return StitchClientFactory;\n}();\n\nfunction newStitchClient(prototype, clientAppID) {\n var _v, _v2, _v3, _stitchClient$rootURL;\n\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n var stitchClient = Object.create(prototype);\n var baseUrl = common.DEFAULT_STITCH_SERVER_URL;\n if (options.baseUrl) {\n baseUrl = options.baseUrl;\n }\n\n stitchClient.clientAppID = clientAppID;\n\n stitchClient.authUrl = clientAppID ? baseUrl + '/api/client/v2.0/app/' + clientAppID + '/auth' : baseUrl + '/api/admin/v3.0/auth';\n\n stitchClient.rootURLsByAPIVersion = (_stitchClient$rootURL = {}, _defineProperty(_stitchClient$rootURL, v1, (_v = {}, _defineProperty(_v, API_TYPE_PUBLIC, baseUrl + '/api/public/v1.0'), _defineProperty(_v, API_TYPE_CLIENT, baseUrl + '/api/client/v1.0'), _defineProperty(_v, API_TYPE_PRIVATE, baseUrl + '/api/private/v1.0'), _defineProperty(_v, API_TYPE_APP, clientAppID ? baseUrl + '/api/client/v1.0/app/' + clientAppID : baseUrl + '/api/public/v1.0'), _v)), _defineProperty(_stitchClient$rootURL, v2, (_v2 = {}, _defineProperty(_v2, API_TYPE_PUBLIC, baseUrl + '/api/public/v2.0'), _defineProperty(_v2, API_TYPE_CLIENT, baseUrl + '/api/client/v2.0'), _defineProperty(_v2, API_TYPE_PRIVATE, baseUrl + '/api/private/v2.0'), _defineProperty(_v2, API_TYPE_APP, clientAppID ? baseUrl + '/api/client/v2.0/app/' + clientAppID : baseUrl + '/api/public/v2.0'), _v2)), _defineProperty(_stitchClient$rootURL, v3, (_v3 = {}, _defineProperty(_v3, API_TYPE_PUBLIC, baseUrl + '/api/public/v3.0'), _defineProperty(_v3, API_TYPE_CLIENT, baseUrl + '/api/client/v3.0'), _defineProperty(_v3, API_TYPE_APP, clientAppID ? baseUrl + '/api/client/v3.0/app/' + clientAppID : baseUrl + '/api/admin/v3.0'), _v3)), _stitchClient$rootURL);\n\n var authOptions = {\n codec: _common.APP_CLIENT_CODEC,\n storage: options.storage\n };\n\n if (options.storageType) {\n authOptions.storageType = options.storageType;\n }\n if (options.platform) {\n authOptions.platform = options.platform;\n }\n if (options.authCodec) {\n authOptions.codec = options.authCodec;\n }\n\n var authPromise = _auth.AuthFactory.create(stitchClient, stitchClient.authUrl, authOptions);\n return authPromise.then(function (auth) {\n stitchClient.auth = auth;\n return Promise.all([stitchClient.auth.handleRedirect(), stitchClient.auth.handleCookie()]);\n }).then(function () {\n return stitchClient;\n });\n}\n/**\n * Prototype for StitchClient class.\n * This is the internal implementation for StitchClient and should not\n * be exposed.\n *\n * @class\n */\n\nvar StitchClient = exports.StitchClient = function () {\n function StitchClient() {\n _classCallCheck(this, StitchClient);\n\n throw new _errors.StitchError('StitchClient can only be made from the StitchClientFactory.create function');\n }\n\n _createClass(StitchClient, [{\n key: 'login',\n\n\n /**\n * Login to stitch instance, optionally providing a username and password. In\n * the event that these are omitted, anonymous authentication is used.\n *\n * @param {String} [email] the email address used for login\n * @param {String} [password] the password for the provided email address\n * @param {Object} [options] additional authentication options\n * @returns {Promise}\n */\n value: function login(email, password) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n if (email === undefined || password === undefined) {\n return this.authenticate(_providers.PROVIDER_TYPE_ANON, options);\n }\n\n return this.authenticate('userpass', Object.assign({ username: email, password: password }, options));\n }\n\n /**\n * Send a request to the server indicating the provided email would like\n * to sign up for an account. This will trigger a confirmation email containing\n * a token which must be used with the `emailConfirm` method of the `userpass`\n * auth provider in order to complete registration. The user will not be able\n * to log in until that flow has been completed.\n *\n * @param {String} email the email used to sign up for the app\n * @param {String} password the password used to sign up for the app\n * @param {Object} [options] additional authentication options\n * @returns {Promise}\n */\n\n }, {\n key: 'register',\n value: function register(email, password) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n return this.auth.provider('userpass').register(email, password, options);\n }\n\n /**\n * Submits an authentication request to the specified provider providing any\n * included options (read: user data). If auth data already exists and the\n * existing auth data has an access token, then these credentials are returned.\n *\n * @param {String} providerType the provider used for authentication (e.g. 'userpass', 'facebook', 'google')\n * @param {Object} [options] additional authentication options\n * @returns {Promise} which resolves to a String value: the authed userId\n */\n\n }, {\n key: 'authenticate',\n value: function authenticate(providerType) {\n var _this = this;\n\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n // reuse existing auth if present\n var authenticateFn = function authenticateFn() {\n return _this.auth.provider(providerType).authenticate(options).then(function () {\n return _this.authedId();\n });\n };\n\n if (this.isAuthenticated()) {\n if (providerType === _providers.PROVIDER_TYPE_ANON && this.auth.getLoggedInProviderType() === _providers.PROVIDER_TYPE_ANON) {\n return Promise.resolve(this.auth.authedId); // is authenticated, skip log in\n }\n\n return this.logout().then(function () {\n return authenticateFn();\n }); // will not be authenticated, continue log in\n }\n\n // is not authenticated, continue log in\n return authenticateFn();\n }\n\n /**\n * Ends the session for the current user.\n *\n * @returns {Promise}\n */\n\n }, {\n key: 'logout',\n value: function logout() {\n var _this2 = this;\n\n return this._do('/auth/session', 'DELETE', {\n refreshOnFailure: false,\n useRefreshToken: true,\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT]\n }).then(function () {\n return _this2.auth.clear();\n }, function () {\n return _this2.auth.clear();\n });\n }\n\n /**\n * @return {*} Returns any error from the Stitch authentication system.\n */\n\n }, {\n key: 'authError',\n value: function authError() {\n return this.auth.error();\n }\n\n /**\n * Returns profile information for the currently logged in user\n *\n * @returns {Promise}\n */\n\n }, {\n key: 'userProfile',\n value: function userProfile() {\n return this._do('/auth/profile', 'GET', { rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT] }).then(function (response) {\n return response.json();\n });\n }\n\n /**\n * @return {Boolean} whether or not the current client is authenticated\n */\n\n }, {\n key: 'isAuthenticated',\n value: function isAuthenticated() {\n return !!this.authedId();\n }\n\n /**\n * @return {String} Returns a string of the currently authed user's ID.\n */\n\n }, {\n key: 'authedId',\n value: function authedId() {\n return this.auth.authedId;\n }\n\n /**\n * Factory method for accessing Stitch services.\n *\n * @method\n * @param {String} type The service type [mongodb, {String}]\n * @param {String} name The service name.\n * @return {Object} returns a named service.\n */\n\n }, {\n key: 'service',\n value: function service(type, name) {\n if (this.constructor !== StitchClient) {\n throw new _errors.StitchError('`service` is a factory method, do not use `new`');\n }\n\n if (!_services2.default.hasOwnProperty(type)) {\n throw new _errors.StitchError('Invalid service type specified: ' + type);\n }\n\n var ServiceType = _services2.default[type];\n return new ServiceType(this, name);\n }\n\n /**\n * Executes a function.\n *\n * @param {String} name The name of the function.\n * @param {...*} args Arguments to pass to the function.\n */\n\n }, {\n key: 'executeFunction',\n value: function executeFunction(name) {\n for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n return this._doFunctionCall({\n name: name,\n arguments: args\n });\n }\n\n /**\n * Executes a service function.\n *\n * @param {String} service The name of the service.\n * @param {String} action The name of the service action.\n * @param {...*} args Arguments to pass to the service action.\n */\n\n }, {\n key: 'executeServiceFunction',\n value: function executeServiceFunction(service, action) {\n for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {\n args[_key2 - 2] = arguments[_key2];\n }\n\n return this._doFunctionCall({\n service: service,\n name: action,\n arguments: args\n });\n }\n }, {\n key: '_doFunctionCall',\n value: function _doFunctionCall(request) {\n var responseDecoder = function responseDecoder(d) {\n return _mongodbExtjson2.default.parse(d, { strict: false });\n };\n var responseEncoder = function responseEncoder(d) {\n return _mongodbExtjson2.default.stringify(d);\n };\n\n return this._do('/functions/call', 'POST', { body: responseEncoder(request) }).then(function (response) {\n return response.text();\n }).then(function (body) {\n return responseDecoder(body);\n });\n }\n\n /**\n * Returns an access token for the user\n *\n * @returns {Promise}\n */\n\n }, {\n key: 'doSessionPost',\n value: function doSessionPost() {\n return this._do('/auth/session', 'POST', {\n refreshOnFailure: false,\n useRefreshToken: true,\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT]\n }).then(function (response) {\n return response.json();\n });\n }\n\n /**\n * Returns an array of api keys\n *\n * @returns {Promise}\n */\n\n }, {\n key: 'getApiKeys',\n value: function getApiKeys() {\n return this._do('/auth/api_keys', 'GET', {\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT],\n useRefreshToken: true\n }).then(function (response) {\n return response.json();\n });\n }\n\n /**\n * Creates a user api key\n *\n * @param {String} userApiKeyName the user defined name of the userApiKey\n * @returns {Promise}\n */\n\n }, {\n key: 'createApiKey',\n value: function createApiKey(userApiKeyName) {\n return this._do('/auth/api_keys', 'POST', { rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT],\n useRefreshToken: true,\n body: JSON.stringify({ 'name': userApiKeyName })\n }).then(function (response) {\n return response.json();\n });\n }\n\n /**\n * Returns a user api key\n *\n * @param {String} keyID the ID of the key\n * @returns {Promise}\n */\n\n }, {\n key: 'getApiKeyByID',\n value: function getApiKeyByID(keyID) {\n return this._do('/auth/api_keys/' + keyID, 'GET', {\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT],\n useRefreshToken: true\n }).then(function (response) {\n return response.json();\n });\n }\n\n /**\n * Deletes a user api key\n *\n * @param {String} keyID the ID of the key\n * @returns {Promise}\n */\n\n }, {\n key: 'deleteApiKeyByID',\n value: function deleteApiKeyByID(keyID) {\n return this._do('/auth/api_keys/' + keyID, 'DELETE', {\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT],\n useRefreshToken: true\n });\n }\n\n /**\n * Enable a user api key\n *\n * @param {String} keyID the ID of the key\n * @returns {Promise}\n */\n\n }, {\n key: 'enableApiKeyByID',\n value: function enableApiKeyByID(keyID) {\n return this._do('/auth/api_keys/' + keyID + '/enable', 'PUT', {\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT],\n useRefreshToken: true\n });\n }\n\n /**\n * Disable a user api key\n *\n * @param {String} keyID the ID of the key\n * @returns {Promise}\n */\n\n }, {\n key: 'disableApiKeyByID',\n value: function disableApiKeyByID(keyID) {\n return this._do('/auth/api_keys/' + keyID + '/disable', 'PUT', {\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT],\n useRefreshToken: true\n });\n }\n }, {\n key: '_fetch',\n value: function _fetch(url, fetchArgs, resource, method, options) {\n var _this3 = this;\n\n return fetch(url, fetchArgs).then(function (response) {\n // Okay: passthrough\n if (response.status >= 200 && response.status < 300) {\n return Promise.resolve(response);\n }\n\n if (response.headers.get('Content-Type') === common.JSONTYPE) {\n return response.json().then(function (json) {\n // Only want to try refreshing token when there's an invalid session\n if ('error_code' in json && json.error_code === _errors.ErrInvalidSession) {\n if (!options.refreshOnFailure) {\n return _this3.auth.clear().then(function () {\n var error = new _errors.StitchError(json.error, json.error_code);\n error.response = response;\n error.json = json;\n throw error;\n });\n }\n\n return _this3.auth.refreshToken().then(function () {\n options.refreshOnFailure = false;\n return _this3._do(resource, method, options);\n });\n }\n\n var error = new _errors.StitchError(json.error, json.error_code);\n error.response = response;\n error.json = json;\n return Promise.reject(error);\n });\n }\n\n var error = new Error(response.statusText);\n error.response = response;\n return Promise.reject(error);\n });\n }\n }, {\n key: '_fetchArgs',\n value: function _fetchArgs(resource, method, options) {\n var appURL = this.rootURLsByAPIVersion[options.apiVersion][options.apiType];\n var url = '' + appURL + resource;\n if (options.rootURL) {\n url = '' + options.rootURL + resource;\n }\n var fetchArgs = common.makeFetchArgs(method, options.body);\n\n if (!!options.headers) {\n Object.assign(fetchArgs.headers, options.headers);\n }\n\n if (options.queryParams) {\n url = url + '?' + _queryString2.default.stringify(options.queryParams);\n }\n\n return { url: url, fetchArgs: fetchArgs };\n }\n }, {\n key: '_do',\n value: function _do(resource, method, options) {\n var _this4 = this;\n\n options = Object.assign({}, {\n refreshOnFailure: true,\n useRefreshToken: false,\n apiVersion: v2,\n apiType: API_TYPE_APP,\n rootURL: undefined\n }, options);\n\n var _fetchArgs2 = this._fetchArgs(resource, method, options),\n url = _fetchArgs2.url,\n fetchArgs = _fetchArgs2.fetchArgs;\n\n if (options.noAuth) {\n return this._fetch(url, fetchArgs, resource, method, options);\n }\n\n if (!this.isAuthenticated()) {\n return Promise.reject(new _errors.StitchError('Must auth first', _errors.ErrUnauthorized));\n }\n var token = options.useRefreshToken ? this.auth.getRefreshToken() : this.auth.getAccessToken();\n\n // If access token is expired, proactively get a new one\n if (!options.useRefreshToken) {\n if (this.auth.isAccessTokenExpired()) {\n return this.auth.refreshToken().then(function () {\n options.refreshOnFailure = false;\n return _this4._do(resource, method, options);\n });\n }\n\n fetchArgs.headers.Authorization = 'Bearer ' + token;\n return this._fetch(url, fetchArgs, resource, method, options);\n }\n\n fetchArgs.headers.Authorization = 'Bearer ' + token;\n return this._fetch(url, fetchArgs, resource, method, options);\n }\n }, {\n key: 'type',\n get: function get() {\n return common.APP_CLIENT_TYPE;\n }\n }]);\n\n return StitchClient;\n}();\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar ExtJSON = __webpack_require__(57);\n\nmodule.exports = ExtJSON;\n\n/***/ }),\n/* 22 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(global) {\n\n// We have an ES6 Map available, return the native instance\n\nif (typeof global.Map !== 'undefined') {\n module.exports = global.Map;\n module.exports.Map = global.Map;\n} else {\n // We will return a polyfill\n var Map = function Map(array) {\n this._keys = [];\n this._values = {};\n\n for (var i = 0; i < array.length; i++) {\n if (array[i] == null) continue; // skip null and undefined\n var entry = array[i];\n var key = entry[0];\n var value = entry[1];\n // Add the key to the list of keys in order\n this._keys.push(key);\n // Add the key and value to the values dictionary with a point\n // to the location in the ordered keys list\n this._values[key] = { v: value, i: this._keys.length - 1 };\n }\n };\n\n Map.prototype.clear = function () {\n this._keys = [];\n this._values = {};\n };\n\n Map.prototype.delete = function (key) {\n var value = this._values[key];\n if (value == null) return false;\n // Delete entry\n delete this._values[key];\n // Remove the key from the ordered keys list\n this._keys.splice(value.i, 1);\n return true;\n };\n\n Map.prototype.entries = function () {\n var self = this;\n var index = 0;\n\n return {\n next: function next() {\n var key = self._keys[index++];\n return {\n value: key !== undefined ? [key, self._values[key].v] : undefined,\n done: key !== undefined ? false : true\n };\n }\n };\n };\n\n Map.prototype.forEach = function (callback, self) {\n self = self || this;\n\n for (var i = 0; i < this._keys.length; i++) {\n var key = this._keys[i];\n // Call the forEach callback\n callback.call(self, this._values[key].v, key, self);\n }\n };\n\n Map.prototype.get = function (key) {\n return this._values[key] ? this._values[key].v : undefined;\n };\n\n Map.prototype.has = function (key) {\n return this._values[key] != null;\n };\n\n Map.prototype.keys = function (key) {\n var self = this;\n var index = 0;\n\n return {\n next: function next() {\n var key = self._keys[index++];\n return {\n value: key !== undefined ? key : undefined,\n done: key !== undefined ? false : true\n };\n }\n };\n };\n\n Map.prototype.set = function (key, value) {\n if (this._values[key]) {\n this._values[key].v = value;\n return this;\n }\n\n // Add the key to the list of keys in order\n this._keys.push(key);\n // Add the key and value to the values dictionary with a point\n // to the location in the ordered keys list\n this._values[key] = { v: value, i: this._keys.length - 1 };\n return this;\n };\n\n Map.prototype.values = function (key, value) {\n var self = this;\n var index = 0;\n\n return {\n next: function next() {\n var key = self._keys[index++];\n return {\n value: key !== undefined ? self._values[key].v : undefined,\n done: key !== undefined ? false : true\n };\n }\n };\n };\n\n // Last ismaster\n Object.defineProperty(Map.prototype, 'size', {\n enumerable: true,\n get: function get() {\n return this._keys.length;\n }\n });\n\n module.exports = Map;\n module.exports.Map = Map;\n}\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(17)))\n\n/***/ }),\n/* 23 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.createProviders = exports.PROVIDER_TYPE_MONGODB_CLOUD = exports.PROVIDER_TYPE_FACEBOOK = exports.PROVIDER_TYPE_GOOGLE = exports.PROVIDER_TYPE_APIKEY = exports.PROVIDER_TYPE_USERPASS = exports.PROVIDER_TYPE_CUSTOM = exports.PROVIDER_TYPE_ANON = undefined;\n\nvar _common = __webpack_require__(16);\n\nvar common = _interopRequireWildcard(_common);\n\nvar _common2 = __webpack_require__(4);\n\nvar authCommon = _interopRequireWildcard(_common2);\n\nvar _util = __webpack_require__(2);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /** @module auth */\n\n\nvar PROVIDER_TYPE_ANON = exports.PROVIDER_TYPE_ANON = 'anon';\nvar PROVIDER_TYPE_CUSTOM = exports.PROVIDER_TYPE_CUSTOM = 'custom';\nvar PROVIDER_TYPE_USERPASS = exports.PROVIDER_TYPE_USERPASS = 'userpass';\nvar PROVIDER_TYPE_APIKEY = exports.PROVIDER_TYPE_APIKEY = 'apiKey';\nvar PROVIDER_TYPE_GOOGLE = exports.PROVIDER_TYPE_GOOGLE = 'google';\nvar PROVIDER_TYPE_FACEBOOK = exports.PROVIDER_TYPE_FACEBOOK = 'facebook';\nvar PROVIDER_TYPE_MONGODB_CLOUD = exports.PROVIDER_TYPE_MONGODB_CLOUD = 'mongodbCloud';\n\n/**\n * @namespace\n */\nfunction anonProvider(auth) {\n return {\n /**\n * Login to a stitch application using anonymous authentication\n *\n * @memberof anonProvider\n * @instance\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: function authenticate() {\n var deviceId = auth.getDeviceId();\n var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n var fetchArgs = common.makeFetchArgs('GET');\n fetchArgs.cors = true;\n\n return fetch(auth.rootUrl + '/providers/anon-user/login?device=' + (0, _util.uriEncodeObject)(device), fetchArgs).then(common.checkStatus).then(function (response) {\n return response.json();\n }).then(function (json) {\n return auth.set(json, PROVIDER_TYPE_ANON);\n });\n }\n };\n}\n\n/**\n * @namespace\n */\nfunction customProvider(auth) {\n var providerRoute = 'providers/custom-token';\n var loginRoute = providerRoute + '/login';\n\n return {\n /**\n * Login to a stitch application using custom authentication\n *\n * @memberof customProvider\n * @instance\n * @param {String} JWT token to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: function authenticate(token) {\n var deviceId = auth.getDeviceId();\n var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n\n var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ token: token, options: { device: device } }));\n fetchArgs.cors = true;\n\n return fetch(auth.rootUrl + '/' + loginRoute, fetchArgs).then(common.checkStatus).then(function (response) {\n return response.json();\n }).then(function (json) {\n return auth.set(json, PROVIDER_TYPE_CUSTOM);\n });\n }\n };\n}\n\n/** @namespace */\nfunction userPassProvider(auth) {\n // The ternary expression here is redundant but is just preserving previous behavior based on whether or not\n // the client is for the admin or client API.\n var providerRoute = auth.isAppClient() ? 'providers/local-userpass' : 'providers/local-userpass';\n var loginRoute = auth.isAppClient() ? providerRoute + '/login' : providerRoute + '/login';\n\n return {\n /**\n * Login to a stitch application using username and password authentication\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} username the username to use for authentication\n * @param {String} password the password to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: function authenticate(_ref) {\n var username = _ref.username,\n password = _ref.password;\n\n var deviceId = auth.getDeviceId();\n var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n\n var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ username: username, password: password, options: { device: device } }));\n fetchArgs.cors = true;\n\n return fetch(auth.rootUrl + '/' + loginRoute, fetchArgs).then(common.checkStatus).then(function (response) {\n return response.json();\n }).then(function (json) {\n return auth.set(json, PROVIDER_TYPE_USERPASS);\n });\n },\n\n /**\n * Completes the confirmation workflow from the stitch server\n * @memberof userPassProvider\n * @instance\n * @param {String} tokenId the tokenId provided by the stitch server\n * @param {String} token the token provided by the stitch server\n * @returns {Promise}\n */\n emailConfirm: function emailConfirm(tokenId, token) {\n var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ tokenId: tokenId, token: token }));\n fetchArgs.cors = true;\n\n return fetch(auth.rootUrl + '/' + providerRoute + '/confirm', fetchArgs).then(common.checkStatus).then(function (response) {\n return response.json();\n });\n },\n\n /**\n * Request that the stitch server send another email confirmation\n * for account creation.\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} email the email to send a confirmation email for\n * @returns {Promise}\n */\n sendEmailConfirm: function sendEmailConfirm(email) {\n var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email: email }));\n fetchArgs.cors = true;\n\n return fetch(auth.rootUrl + '/' + providerRoute + '/confirm/send', fetchArgs).then(common.checkStatus).then(function (response) {\n return response.json();\n });\n },\n\n /**\n * Sends a password reset request to the stitch server\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} email the email of the account to reset the password for\n * @returns {Promise}\n */\n sendPasswordReset: function sendPasswordReset(email) {\n var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email: email }));\n fetchArgs.cors = true;\n\n return fetch(auth.rootUrl + '/' + providerRoute + '/reset/send', fetchArgs).then(common.checkStatus).then(function (response) {\n return response.json();\n });\n },\n\n /**\n * Use information returned from the stitch server to complete the password\n * reset flow for a given email account, providing a new password for the account.\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} tokenId the tokenId provided by the stitch server\n * @param {String} token the token provided by the stitch server\n * @param {String} password the new password requested for this account\n * @returns {Promise}\n */\n passwordReset: function passwordReset(tokenId, token, password) {\n var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ tokenId: tokenId, token: token, password: password }));\n fetchArgs.cors = true;\n\n return fetch(auth.rootUrl + '/' + providerRoute + '/reset', fetchArgs).then(common.checkStatus).then(function (response) {\n return response.json();\n });\n },\n\n /**\n * Will trigger an email to the requested account containing a link with the\n * token and tokenId that must be returned to the server using emailConfirm()\n * to activate the account.\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} email the requested email for the account\n * @param {String} password the requested password for the account\n * @returns {Promise}\n */\n register: function register(email, password) {\n var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email: email, password: password }));\n fetchArgs.cors = true;\n\n return fetch(auth.rootUrl + '/' + providerRoute + '/register', fetchArgs).then(common.checkStatus).then(function (response) {\n return response.json();\n });\n }\n };\n}\n\n/** @namespace */\nfunction apiKeyProvider(auth) {\n // The ternary expression here is redundant but is just preserving previous behavior based on whether or not\n // the client is for the admin or client API.\n var loginRoute = auth.isAppClient() ? 'providers/api-key/login' : 'providers/api-key/login';\n\n return {\n /**\n * Login to a stitch application using an api key\n *\n * @memberof apiKeyProvider\n * @instance\n * @param {String} key the key for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: function authenticate(key) {\n var deviceId = auth.getDeviceId();\n var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ 'key': key, 'options': { device: device } }));\n fetchArgs.cors = true;\n return fetch(auth.rootUrl + '/' + loginRoute, fetchArgs).then(common.checkStatus).then(function (response) {\n return response.json();\n }).then(function (json) {\n return auth.set(json, PROVIDER_TYPE_APIKEY);\n });\n }\n };\n}\n\n// The state we generate is to be used for any kind of request where we will\n// complete an authentication flow via a redirect. We store the generate in\n// a local storage bound to the app's origin. This ensures that any time we\n// receive a redirect, there must be a state parameter and it must match\n// what we ourselves have generated. This state MUST only be sent to\n// a trusted Stitch endpoint in order to preserve its integrity. Stitch will\n// store it in some way on its origin (currently a cookie stored on this client)\n// and use that state at the end of an auth flow as a parameter in the redirect URI.\nvar alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\nfunction generateState() {\n var state = '';\n for (var i = 0; i < 64; ++i) {\n state += alpha.charAt(Math.floor(Math.random() * alpha.length));\n }\n\n return state;\n}\n\nfunction getOAuthLoginURL(auth, providerName, redirectUrl) {\n if (redirectUrl === undefined) {\n redirectUrl = auth.pageRootUrl();\n }\n\n var state = generateState();\n return auth.storage.set(authCommon.STATE_KEY, state).then(function () {\n return auth.getDeviceId();\n }).then(function (deviceId) {\n var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n\n var result = auth.rootUrl + '/providers/oauth2-' + providerName + '/login?redirect=' + encodeURI(redirectUrl) + '&state=' + state + '&device=' + (0, _util.uriEncodeObject)(device);\n return result;\n });\n}\n\n/** @namespace */\nfunction googleProvider(auth) {\n var loginRoute = auth.isAppClient() ? 'providers/oauth2-google/login' : 'providers/oauth2-google/login';\n\n return {\n /**\n * Login to a stitch application using google authentication\n *\n * @memberof googleProvider\n * @instance\n * @param {Object} data the redirectUrl data to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: function authenticate(data) {\n var authCode = data.authCode;\n\n if (authCode) {\n var deviceId = auth.getDeviceId();\n var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n\n var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ authCode: authCode, options: { device: device } }));\n\n return fetch(auth.rootUrl + '/' + loginRoute, fetchArgs).then(common.checkStatus).then(function (response) {\n return response.json();\n }).then(function (json) {\n return auth.set(json, PROVIDER_TYPE_GOOGLE);\n });\n }\n\n var redirectUrl = data && data.redirectUrl ? data.redirectUrl : undefined;\n return auth.storage.set(authCommon.STITCH_REDIRECT_PROVIDER, PROVIDER_TYPE_GOOGLE).then(function () {\n return getOAuthLoginURL(auth, PROVIDER_TYPE_GOOGLE, redirectUrl);\n }).then(function (res) {\n return window.location.replace(res);\n });\n }\n };\n}\n\n/** @namespace */\nfunction facebookProvider(auth) {\n var loginRoute = auth.isAppClient() ? 'providers/oauth2-facebook/login' : 'providers/oauth2-facebook/login';\n\n return {\n /**\n * Login to a stitch application using facebook authentication\n *\n * @memberof facebookProvider\n * @instance\n * @param {Object} data the redirectUrl data to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: function authenticate(data) {\n var accessToken = data.accessToken;\n\n\n if (accessToken) {\n var deviceId = auth.getDeviceId();\n var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n\n var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ accessToken: accessToken, options: { device: device } }));\n\n return fetch(auth.rootUrl + '/' + loginRoute, fetchArgs).then(common.checkStatus).then(function (response) {\n return response.json();\n }).then(function (json) {\n return auth.set(json, PROVIDER_TYPE_FACEBOOK);\n });\n }\n\n var redirectUrl = data && data.redirectUrl ? data.redirectUrl : undefined;\n return auth.storage.set(authCommon.STITCH_REDIRECT_PROVIDER, PROVIDER_TYPE_FACEBOOK).then(function () {\n return getOAuthLoginURL(auth, PROVIDER_TYPE_FACEBOOK, redirectUrl);\n }).then(function (res) {\n return window.location.replace(res);\n });\n }\n };\n}\n\n/** @namespace */\nfunction mongodbCloudProvider(auth) {\n // The ternary expression here is redundant but is just preserving previous behavior based on whether or not\n // the client is for the admin or client API.\n var loginRoute = auth.isAppClient() ? 'providers/mongodb-cloud/login' : 'providers/mongodb-cloud/login';\n\n return {\n /**\n * Login to a stitch application using mongodb cloud authentication\n *\n * @memberof mongodbCloudProvider\n * @instance\n * @param {Object} data the username, apiKey, cors, and cookie data to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: function authenticate(data) {\n var username = data.username,\n apiKey = data.apiKey,\n cors = data.cors,\n cookie = data.cookie;\n\n var options = Object.assign({}, { cors: true, cookie: false }, { cors: cors, cookie: cookie });\n var deviceId = auth.getDeviceId();\n var device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n var fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ username: username, apiKey: apiKey, options: { device: device } }));\n fetchArgs.cors = true; // TODO: shouldn't this use the passed in `cors` value?\n fetchArgs.credentials = 'include';\n\n var url = auth.rootUrl + '/' + loginRoute;\n if (options.cookie) {\n return fetch(url + '?cookie=true', fetchArgs).then(common.checkStatus);\n }\n\n return fetch(url, fetchArgs).then(common.checkStatus).then(function (response) {\n return response.json();\n }).then(function (json) {\n return auth.set(json, PROVIDER_TYPE_MONGODB_CLOUD);\n });\n }\n };\n}\n\n// TODO: support auth-specific options\nfunction createProviders(auth) {\n var _ref2;\n\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n return _ref2 = {}, _defineProperty(_ref2, PROVIDER_TYPE_ANON, anonProvider(auth)), _defineProperty(_ref2, PROVIDER_TYPE_APIKEY, apiKeyProvider(auth)), _defineProperty(_ref2, PROVIDER_TYPE_GOOGLE, googleProvider(auth)), _defineProperty(_ref2, PROVIDER_TYPE_FACEBOOK, facebookProvider(auth)), _defineProperty(_ref2, PROVIDER_TYPE_MONGODB_CLOUD, mongodbCloudProvider(auth)), _defineProperty(_ref2, PROVIDER_TYPE_USERPASS, userPassProvider(auth)), _defineProperty(_ref2, PROVIDER_TYPE_CUSTOM, customProvider(auth)), _ref2;\n}\n\nexports.createProviders = createProviders;\n\n/***/ }),\n/* 24 */\n/***/ (function(module, exports, __webpack_require__) {\n\n// the whatwg-fetch polyfill installs the fetch() function\n// on the global object (window or self)\n//\n// Return that as the export for use in Webpack, Browserify etc.\n__webpack_require__(73);\nvar globalObj = typeof self !== 'undefined' && self || this;\nmodule.exports = globalObj.fetch.bind(globalObj);\n\n\n/***/ }),\n/* 25 */\n/***/ (function(module, exports) {\n\n// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n/***/ }),\n/* 26 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.StitchAdminClient = exports.StitchAdminClientFactory = undefined;\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* global window, fetch */\n/* eslint no-labels: ['error', { 'allowLoop': true }] */\n\n\n__webpack_require__(24);\n\nvar _client = __webpack_require__(20);\n\nvar _common = __webpack_require__(16);\n\nvar _common2 = _interopRequireDefault(_common);\n\nvar _common3 = __webpack_require__(4);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar v2 = 2;\nvar v3 = 3;\n\nvar StitchAdminClientFactory = exports.StitchAdminClientFactory = function () {\n function StitchAdminClientFactory() {\n _classCallCheck(this, StitchAdminClientFactory);\n\n throw new StitchError('StitchAdminClient can only be made from the StitchAdminClientFactory.create function');\n }\n\n _createClass(StitchAdminClientFactory, null, [{\n key: 'create',\n value: function create(baseUrl) {\n return (0, _client.newStitchClient)(StitchAdminClient.prototype, '', { baseUrl: baseUrl, authCodec: _common3.ADMIN_CLIENT_CODEC });\n }\n }]);\n\n return StitchAdminClientFactory;\n}();\n\nvar StitchAdminClient = exports.StitchAdminClient = function (_StitchClient) {\n _inherits(StitchAdminClient, _StitchClient);\n\n function StitchAdminClient() {\n _classCallCheck(this, StitchAdminClient);\n\n var _this = _possibleConstructorReturn(this, (StitchAdminClient.__proto__ || Object.getPrototypeOf(StitchAdminClient)).call(this));\n\n throw new StitchError('StitchAdminClient can only be made from the StitchAdminClientFactory.create function');\n return _this;\n }\n\n _createClass(StitchAdminClient, [{\n key: 'logout',\n\n\n /**\n * Ends the session for the current user.\n *\n * @returns {Promise}\n */\n value: function logout() {\n var _this2 = this;\n\n return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', this).call(this, '/auth/session', 'DELETE', { refreshOnFailure: false, useRefreshToken: true, apiVersion: v3 }).then(function () {\n return _this2.auth.clear();\n });\n }\n\n /**\n * Returns profile information for the currently logged in user\n *\n * @returns {Promise}\n */\n\n }, {\n key: 'userProfile',\n value: function userProfile() {\n return this._v3._get('/auth/profile');\n }\n\n /**\n * Returns available providers for the currently logged in admin\n *\n * @returns {Promise}\n */\n\n }, {\n key: 'getAuthProviders',\n value: function getAuthProviders() {\n return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', this).call(this, '/auth/providers', 'GET', { noAuth: true, apiVersion: v3 }).then(function (response) {\n return response.json();\n });\n }\n\n /**\n * Returns an access token for the user\n *\n * @returns {Promise}\n */\n\n }, {\n key: 'doSessionPost',\n value: function doSessionPost() {\n return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', this).call(this, '/auth/session', 'POST', { refreshOnFailure: false, useRefreshToken: true, apiVersion: v3 }).then(function (response) {\n return response.json();\n });\n }\n\n /* Examples of how to access admin API with this client:\n *\n * List all apps\n * a.apps('580e6d055b199c221fcb821c').list()\n *\n * Fetch app under name 'planner'\n * a.apps('580e6d055b199c221fcb821c').app('planner').get()\n *\n * List services under the app 'planner'\n * a.apps('580e6d055b199c221fcb821c').app('planner').services().list()\n *\n * Delete a rule by ID\n * a.apps('580e6d055b199c221fcb821c').app('planner').services().service('mdb1').rules().rule('580e6d055b199c221fcb821d').remove()\n *\n */\n\n }, {\n key: 'apps',\n value: function apps(groupId) {\n var api = this._v3;\n var groupUrl = '/groups/' + groupId + '/apps';\n return {\n list: function list() {\n return api._get(groupUrl);\n },\n create: function create(data, options) {\n var query = options && options.defaults ? '?defaults=true' : '';\n return api._post(groupUrl + query, data);\n },\n\n app: function app(appId) {\n var appUrl = groupUrl + '/' + appId;\n return {\n get: function get() {\n return api._get(appUrl);\n },\n remove: function remove() {\n return api._delete(appUrl);\n },\n\n values: function values() {\n return {\n list: function list() {\n return api._get(appUrl + '/values');\n },\n create: function create(data) {\n return api._post(appUrl + '/values', data);\n },\n value: function value(valueId) {\n var valueUrl = appUrl + '/values/' + valueId;\n return {\n get: function get() {\n return api._get(valueUrl);\n },\n remove: function remove() {\n return api._delete(valueUrl);\n },\n update: function update(data) {\n return api._put(valueUrl, data);\n }\n };\n }\n };\n },\n\n services: function services() {\n return {\n list: function list() {\n return api._get(appUrl + '/services');\n },\n create: function create(data) {\n return api._post(appUrl + '/services', data);\n },\n service: function service(serviceId) {\n return {\n get: function get() {\n return api._get(appUrl + '/services/' + serviceId);\n },\n remove: function remove() {\n return api._delete(appUrl + '/services/' + serviceId);\n },\n runCommand: function runCommand(commandName, data) {\n return api._post(appUrl + '/services/' + serviceId + '/commands/' + commandName, data);\n },\n config: function config() {\n return {\n get: function get() {\n return api._get(appUrl + '/services/' + serviceId + '/config');\n },\n update: function update(data) {\n return api._patch(appUrl + '/services/' + serviceId + '/config', data);\n }\n };\n },\n\n rules: function rules() {\n return {\n list: function list() {\n return api._get(appUrl + '/services/' + serviceId + '/rules');\n },\n create: function create(data) {\n return api._post(appUrl + '/services/' + serviceId + '/rules', data);\n },\n rule: function rule(ruleId) {\n var ruleUrl = appUrl + '/services/' + serviceId + '/rules/' + ruleId;\n return {\n get: function get() {\n return api._get(ruleUrl);\n },\n update: function update(data) {\n return api._put(ruleUrl, data);\n },\n remove: function remove() {\n return api._delete(ruleUrl);\n }\n };\n }\n };\n },\n\n incomingWebhooks: function incomingWebhooks() {\n return {\n list: function list() {\n return api._get(appUrl + '/services/' + serviceId + '/incoming_webhooks');\n },\n create: function create(data) {\n return api._post(appUrl + '/services/' + serviceId + '/incoming_webhooks', data);\n },\n incomingWebhook: function incomingWebhook(incomingWebhookId) {\n var webhookUrl = appUrl + '/services/' + serviceId + '/incoming_webhooks/' + incomingWebhookId;\n return {\n get: function get() {\n return api._get(webhookUrl);\n },\n update: function update(data) {\n return api._put(webhookUrl, data);\n },\n remove: function remove() {\n return api._delete(webhookUrl);\n }\n };\n }\n };\n }\n };\n }\n };\n },\n\n pushNotifications: function pushNotifications() {\n return {\n list: function list(filter) {\n return api._get(appUrl + '/push/notifications', filter);\n },\n create: function create(data) {\n return api._post(appUrl + '/push/notifications', data);\n },\n pushNotification: function pushNotification(messageId) {\n return {\n get: function get() {\n return api._get(appUrl + '/push/notifications/' + messageId);\n },\n update: function update(data) {\n return api._put(appUrl + '/push/notifications/' + messageId, data);\n },\n remove: function remove() {\n return api._delete(appUrl + '/push/notifications/' + messageId);\n },\n send: function send() {\n return api._post(appUrl + '/push/notifications/' + messageId + '/send');\n }\n };\n }\n };\n },\n\n users: function users() {\n return {\n list: function list(filter) {\n return api._get(appUrl + '/users', filter);\n },\n create: function create(user) {\n return api._post(appUrl + '/users', user);\n },\n user: function user(uid) {\n return {\n get: function get() {\n return api._get(appUrl + '/users/' + uid);\n },\n devices: function devices() {\n return {\n get: function get() {\n return api._get(appUrl + '/users/' + uid + '/devices');\n }\n };\n },\n logout: function logout() {\n return api._put(appUrl + '/users/' + uid + '/logout');\n },\n enable: function enable() {\n return api._put(appUrl + '/users/' + uid + '/enable');\n },\n disable: function disable() {\n return api._put(appUrl + '/users/' + uid + '/disable');\n },\n remove: function remove() {\n return api._delete(appUrl + '/users/' + uid);\n }\n };\n }\n };\n },\n\n debug: function debug() {\n return {\n executeFunction: function executeFunction(userId) {\n for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n args[_key - 2] = arguments[_key];\n }\n\n var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n\n return api._post(appUrl + '/debug/execute_function', { name: name, 'arguments': args }, { user_id: userId });\n },\n executeFunctionSource: function executeFunctionSource(userId) {\n var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n var evalSource = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n\n return api._post(appUrl + '/debug/execute_function_source', { source: source, 'eval_source': evalSource }, { user_id: userId });\n }\n };\n },\n\n authProviders: function authProviders() {\n return {\n list: function list() {\n return api._get(appUrl + '/auth_providers');\n },\n create: function create(data) {\n return api._post(appUrl + '/auth_providers', data);\n },\n authProvider: function authProvider(providerId) {\n return {\n get: function get() {\n return api._get(appUrl + '/auth_providers/' + providerId);\n },\n update: function update(data) {\n return api._patch(appUrl + '/auth_providers/' + providerId, data);\n },\n enable: function enable() {\n return api._put(appUrl + '/auth_providers/' + providerId + '/enable');\n },\n disable: function disable() {\n return api._put(appUrl + '/auth_providers/' + providerId + '/disable');\n },\n remove: function remove() {\n return api._delete(appUrl + '/auth_providers/' + providerId);\n }\n };\n }\n };\n },\n\n security: function security() {\n return {\n allowedRequestOrigins: function allowedRequestOrigins() {\n return {\n get: function get() {\n return api._get(appUrl + '/security/allowed_request_origins');\n },\n update: function update(data) {\n return api._post(appUrl + '/security/allowed_request_origins', data);\n }\n };\n }\n };\n },\n\n logs: function logs() {\n return {\n list: function list(filter) {\n return api._get(appUrl + '/logs', filter);\n }\n };\n },\n\n apiKeys: function apiKeys() {\n return {\n list: function list() {\n return api._get(appUrl + '/api_keys');\n },\n create: function create(data) {\n return api._post(appUrl + '/api_keys', data);\n },\n apiKey: function apiKey(apiKeyId) {\n return {\n get: function get() {\n return api._get(appUrl + '/api_keys/' + apiKeyId);\n },\n remove: function remove() {\n return api._delete(appUrl + '/api_keys/' + apiKeyId);\n },\n enable: function enable() {\n return api._put(appUrl + '/api_keys/' + apiKeyId + '/enable');\n },\n disable: function disable() {\n return api._put(appUrl + '/api_keys/' + apiKeyId + '/disable');\n }\n };\n }\n };\n },\n\n functions: function functions() {\n return {\n list: function list() {\n return api._get(appUrl + '/functions');\n },\n create: function create(data) {\n return api._post(appUrl + '/functions', data);\n },\n function: function _function(functionId) {\n return {\n get: function get() {\n return api._get(appUrl + '/functions/' + functionId);\n },\n update: function update(data) {\n return api._put(appUrl + '/functions/' + functionId, data);\n },\n remove: function remove() {\n return api._delete(appUrl + '/functions/' + functionId);\n }\n };\n }\n };\n }\n };\n }\n };\n }\n }, {\n key: 'v2',\n value: function v2() {\n var api = this._v2;\n return {\n\n apps: function apps(groupId) {\n var groupUrl = '/groups/' + groupId + '/apps';\n return {\n list: function list() {\n return api._get(groupUrl);\n },\n create: function create(data, options) {\n var query = options && options.defaults ? '?defaults=true' : '';\n return api._post(groupUrl + query, data);\n },\n\n app: function app(appId) {\n var appUrl = groupUrl + '/' + appId;\n return {\n get: function get() {\n return api._get(appUrl);\n },\n remove: function remove() {\n return api._delete(appUrl);\n },\n\n pipelines: function pipelines() {\n return {\n list: function list() {\n return api._get(appUrl + '/pipelines');\n },\n create: function create(data) {\n return api._post(appUrl + '/pipelines', data);\n },\n pipeline: function pipeline(pipelineId) {\n var pipelineUrl = appUrl + '/pipelines/' + pipelineId;\n return {\n get: function get() {\n return api._get(pipelineUrl);\n },\n remove: function remove() {\n return api._delete(pipelineUrl);\n },\n update: function update(data) {\n return api._put(pipelineUrl, data);\n }\n };\n }\n };\n },\n\n values: function values() {\n return {\n list: function list() {\n return api._get(appUrl + '/values');\n },\n create: function create(data) {\n return api._post(appUrl + '/values', data);\n },\n value: function value(valueId) {\n var valueUrl = appUrl + '/values/' + valueId;\n return {\n get: function get() {\n return api._get(valueUrl);\n },\n remove: function remove() {\n return api._delete(valueUrl);\n },\n update: function update(data) {\n return api._put(valueUrl, data);\n }\n };\n }\n };\n },\n\n services: function services() {\n return {\n list: function list() {\n return api._get(appUrl + '/services');\n },\n create: function create(data) {\n return api._post(appUrl + '/services', data);\n },\n service: function service(serviceId) {\n return {\n get: function get() {\n return api._get(appUrl + '/services/' + serviceId);\n },\n remove: function remove() {\n return api._delete(appUrl + '/services/' + serviceId);\n },\n runCommand: function runCommand(commandName, data) {\n return api._post(appUrl + '/services/' + serviceId + '/commands/' + commandName, data);\n },\n config: function config() {\n return {\n get: function get() {\n return api._get(appUrl + '/services/' + serviceId + '/config');\n },\n update: function update(data) {\n return api._patch(appUrl + '/services/' + serviceId + '/config', data);\n }\n };\n },\n\n rules: function rules() {\n return {\n list: function list() {\n return api._get(appUrl + '/services/' + serviceId + '/rules');\n },\n create: function create(data) {\n return api._post(appUrl + '/services/' + serviceId + '/rules', data);\n },\n rule: function rule(ruleId) {\n var ruleUrl = appUrl + '/services/' + serviceId + '/rules/' + ruleId;\n return {\n get: function get() {\n return api._get(ruleUrl);\n },\n update: function update(data) {\n return api._put(ruleUrl, data);\n },\n remove: function remove() {\n return api._delete(ruleUrl);\n }\n };\n }\n };\n },\n\n incomingWebhooks: function incomingWebhooks() {\n return {\n list: function list() {\n return api._get(appUrl + '/services/' + serviceId + '/incoming_webhooks');\n },\n create: function create(data) {\n return api._post(appUrl + '/services/' + serviceId + '/incoming_webhooks', data);\n },\n incomingWebhook: function incomingWebhook(incomingWebhookId) {\n var webhookUrl = appUrl + '/services/' + serviceId + '/incoming_webhooks/' + incomingWebhookId;\n return {\n get: function get() {\n return api._get(webhookUrl);\n },\n update: function update(data) {\n return api._put(webhookUrl, data);\n },\n remove: function remove() {\n return api._delete(webhookUrl);\n }\n };\n }\n };\n }\n\n };\n }\n };\n },\n\n pushNotifications: function pushNotifications() {\n return {\n list: function list(filter) {\n return api._get(appUrl + '/push/notifications', filter);\n },\n create: function create(data) {\n return api._post(appUrl + '/push/notifications', data);\n },\n pushNotification: function pushNotification(messageId) {\n return {\n get: function get() {\n return api._get(appUrl + '/push/notifications/' + messageId);\n },\n update: function update(data) {\n return api._put(appUrl + '/push/notifications/' + messageId, data);\n },\n setType: function setType(type) {\n return api._put(appUrl + '/push/notifications/' + messageId + '/type', { type: type });\n },\n remove: function remove() {\n return api._delete(appUrl + '/push/notifications/' + messageId);\n }\n };\n }\n };\n },\n\n users: function users() {\n return {\n list: function list(filter) {\n return api._get(appUrl + '/users', filter);\n },\n create: function create(user) {\n return api._post(appUrl + '/users', user);\n },\n user: function user(uid) {\n return {\n get: function get() {\n return api._get(appUrl + '/users/' + uid);\n },\n logout: function logout() {\n return api._put(appUrl + '/users/' + uid + '/logout');\n },\n remove: function remove() {\n return api._delete(appUrl + '/users/' + uid);\n }\n };\n }\n };\n },\n\n dev: function dev() {\n return {\n executePipeline: function executePipeline(body, userId, options) {\n return api._post(appUrl + '/dev/pipeline', body, Object.assign({}, options, { user_id: userId }));\n }\n };\n },\n\n authProviders: function authProviders() {\n return {\n list: function list() {\n return api._get(appUrl + '/auth_providers');\n },\n create: function create(data) {\n return api._post(appUrl + '/auth_providers', data);\n },\n authProvider: function authProvider(providerId) {\n return {\n get: function get() {\n return api._get(appUrl + '/auth_providers/' + providerId);\n },\n update: function update(data) {\n return api._patch(appUrl + '/auth_providers/' + providerId, data);\n },\n enable: function enable() {\n return api._put(appUrl + '/auth_providers/' + providerId + '/enable');\n },\n disable: function disable() {\n return api._put(appUrl + '/auth_providers/' + providerId + '/disable');\n },\n remove: function remove() {\n return api._delete(appUrl + '/auth_providers/' + providerId);\n }\n };\n }\n };\n },\n\n security: function security() {\n return {\n allowedRequestOrigins: function allowedRequestOrigins() {\n return {\n get: function get() {\n return api._get(appUrl + '/security/allowed_request_origins');\n },\n update: function update(data) {\n return api._post(appUrl + '/security/allowed_request_origins', data);\n }\n };\n }\n };\n },\n\n logs: function logs() {\n return {\n list: function list(filter) {\n return api._get(appUrl + '/logs', filter);\n }\n };\n },\n\n apiKeys: function apiKeys() {\n return {\n list: function list() {\n return api._get(appUrl + '/api_keys');\n },\n create: function create(data) {\n return api._post(appUrl + '/api_keys', data);\n },\n apiKey: function apiKey(apiKeyId) {\n return {\n get: function get() {\n return api._get(appUrl + '/api_keys/' + apiKeyId);\n },\n remove: function remove() {\n return api._delete(appUrl + '/api_keys/' + apiKeyId);\n },\n enable: function enable() {\n return api._put(appUrl + '/api_keys/' + apiKeyId + '/enable');\n },\n disable: function disable() {\n return api._put(appUrl + '/api_keys/' + apiKeyId + '/disable');\n }\n };\n }\n };\n }\n };\n }\n };\n }\n };\n }\n }, {\n key: '_admin',\n value: function _admin() {\n var _this3 = this;\n\n return {\n logs: function logs() {\n return {\n get: function get(filter) {\n return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', _this3).call(_this3, '/admin/logs', 'GET', { useRefreshToken: true, queryParams: filter });\n }\n };\n },\n users: function users() {\n return {\n list: function list(filter) {\n return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', _this3).call(_this3, '/admin/users', 'GET', { useRefreshToken: true, queryParams: filter });\n },\n user: function user(uid) {\n return {\n logout: function logout() {\n return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', _this3).call(_this3, '/admin/users/' + uid + '/logout', 'PUT', { useRefreshToken: true });\n }\n };\n }\n };\n }\n };\n }\n }, {\n key: 'type',\n get: function get() {\n return _common2.default;\n }\n }, {\n key: '_v3',\n get: function get() {\n var _this4 = this;\n\n var v3do = function v3do(url, method, options) {\n return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', _this4).call(_this4, url, method, Object.assign({}, { apiVersion: v3 }, options)).then(function (response) {\n var contentHeader = response.headers.get('content-type') || '';\n if (contentHeader.split(',').indexOf('application/json') >= 0) {\n return response.json();\n }\n return response;\n });\n };\n\n return {\n _get: function _get(url, queryParams) {\n return v3do(url, 'GET', { queryParams: queryParams });\n },\n _put: function _put(url, data) {\n return data ? v3do(url, 'PUT', { body: JSON.stringify(data) }) : v3do(url, 'PUT');\n },\n _patch: function _patch(url, data) {\n return data ? v3do(url, 'PATCH', { body: JSON.stringify(data) }) : v3do(url, 'PATCH');\n },\n _delete: function _delete(url) {\n return v3do(url, 'DELETE');\n },\n _post: function _post(url, body, queryParams) {\n return queryParams ? v3do(url, 'POST', { body: JSON.stringify(body), queryParams: queryParams }) : v3do(url, 'POST', { body: JSON.stringify(body) });\n }\n };\n }\n }, {\n key: '_v2',\n get: function get() {\n var _this5 = this;\n\n var v2do = function v2do(url, method, options) {\n return _get(StitchAdminClient.prototype.__proto__ || Object.getPrototypeOf(StitchAdminClient.prototype), '_do', _this5).call(_this5, url, method, Object.assign({}, { apiVersion: v2 }, options)).then(function (response) {\n var contentHeader = response.headers.get('content-type') || '';\n if (contentHeader.split(',').indexOf('application/json') >= 0) {\n return response.json();\n }\n return response;\n });\n };\n\n return {\n _get: function _get(url, queryParams) {\n return v2do(url, 'GET', { queryParams: queryParams });\n },\n _put: function _put(url, data) {\n return data ? v2do(url, 'PUT', { body: JSON.stringify(data) }) : v2do(url, 'PUT');\n },\n _patch: function _patch(url, data) {\n return data ? v2do(url, 'PATCH', { body: JSON.stringify(data) }) : v2do(url, 'PATCH');\n },\n _delete: function _delete(url) {\n return v2do(url, 'DELETE');\n },\n _post: function _post(url, body, queryParams) {\n return queryParams ? v2do(url, 'POST', { body: JSON.stringify(body), queryParams: queryParams }) : v2do(url, 'POST', { body: JSON.stringify(body) });\n }\n };\n }\n }]);\n\n return StitchAdminClient;\n}(_client.StitchClient);\n\n/***/ }),\n/* 27 */\n/***/ (function(module, exports, __webpack_require__) {\n\n;(function () {\n\n var object =\n true ? exports :\n typeof self != 'undefined' ? self : // #8: web workers\n $.global; // #31: ExtendScript\n\n var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n function InvalidCharacterError(message) {\n this.message = message;\n }\n InvalidCharacterError.prototype = new Error;\n InvalidCharacterError.prototype.name = 'InvalidCharacterError';\n\n // encoder\n // [https://gist.github.com/999166] by [https://github.com/nignag]\n object.btoa || (\n object.btoa = function (input) {\n var str = String(input);\n for (\n // initialize result and counter\n var block, charCode, idx = 0, map = chars, output = '';\n // if the next str index does not exist:\n // change the mapping table to \"=\"\n // check if d has no fractional digits\n str.charAt(idx | 0) || (map = '=', idx % 1);\n // \"8 - idx % 1 * 8\" generates the sequence 2, 4, 6, 8\n output += map.charAt(63 & block >> 8 - idx % 1 * 8)\n ) {\n charCode = str.charCodeAt(idx += 3/4);\n if (charCode > 0xFF) {\n throw new InvalidCharacterError(\"'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.\");\n }\n block = block << 8 | charCode;\n }\n return output;\n });\n\n // decoder\n // [https://gist.github.com/1020396] by [https://github.com/atk]\n object.atob || (\n object.atob = function (input) {\n var str = String(input).replace(/[=]+$/, ''); // #31: ExtendScript bad parse of /=\n if (str.length % 4 == 1) {\n throw new InvalidCharacterError(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = '';\n // get next character\n buffer = str.charAt(idx++);\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n return output;\n });\n\n}());\n\n\n/***/ }),\n/* 28 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Buffer) {\n\nvar writeIEEE754 = __webpack_require__(1).writeIEEE754,\n readIEEE754 = __webpack_require__(1).readIEEE754,\n Map = __webpack_require__(22),\n Long = __webpack_require__(3),\n Double = __webpack_require__(9),\n Timestamp = __webpack_require__(15),\n ObjectID = __webpack_require__(12),\n BSONRegExp = __webpack_require__(13),\n _Symbol = __webpack_require__(14),\n Int32 = __webpack_require__(18),\n Code = __webpack_require__(6),\n Decimal128 = __webpack_require__(8),\n MinKey = __webpack_require__(11),\n MaxKey = __webpack_require__(10),\n DBRef = __webpack_require__(7),\n Binary = __webpack_require__(5);\n\n// Parts of the parser\nvar deserialize = __webpack_require__(30),\n serializer = __webpack_require__(31),\n calculateObjectSize = __webpack_require__(29);\n\n/**\n * @ignore\n * @api private\n */\n// Max Size\nvar MAXSIZE = 1024 * 1024 * 17;\n// Max Document Buffer size\nvar buffer = new Buffer(MAXSIZE);\n\nvar BSON = function BSON() {};\n\n/**\n * Serialize a Javascript object.\n *\n * @param {Object} object the Javascript object to serialize.\n * @param {Boolean} [options.checkKeys] the serializer will check if keys are valid.\n * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**.\n * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**.\n * @return {Buffer} returns the Buffer object containing the serialized object.\n * @api public\n */\nBSON.prototype.serialize = function serialize(object, options) {\n options = options || {};\n // Unpack the options\n var checkKeys = typeof options.checkKeys == 'boolean' ? options.checkKeys : false;\n var serializeFunctions = typeof options.serializeFunctions == 'boolean' ? options.serializeFunctions : false;\n var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' ? options.ignoreUndefined : true;\n\n // Attempt to serialize\n var serializationIndex = serializer(buffer, object, checkKeys, 0, 0, serializeFunctions, ignoreUndefined, []);\n // Create the final buffer\n var finishedBuffer = new Buffer(serializationIndex);\n // Copy into the finished buffer\n buffer.copy(finishedBuffer, 0, 0, finishedBuffer.length);\n // Return the buffer\n return finishedBuffer;\n};\n\n/**\n * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization.\n *\n * @param {Object} object the Javascript object to serialize.\n * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object.\n * @param {Boolean} [options.checkKeys] the serializer will check if keys are valid.\n * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**.\n * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**.\n * @param {Number} [options.index] the index in the buffer where we wish to start serializing into.\n * @return {Number} returns the index pointing to the last written byte in the buffer.\n * @api public\n */\nBSON.prototype.serializeWithBufferAndIndex = function (object, finalBuffer, options) {\n options = options || {};\n // Unpack the options\n var checkKeys = typeof options.checkKeys == 'boolean' ? options.checkKeys : false;\n var serializeFunctions = typeof options.serializeFunctions == 'boolean' ? options.serializeFunctions : false;\n var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' ? options.ignoreUndefined : true;\n var startIndex = typeof options.index == 'number' ? options.index : 0;\n\n // Attempt to serialize\n var serializationIndex = serializer(buffer, object, checkKeys, startIndex || 0, 0, serializeFunctions, ignoreUndefined);\n buffer.copy(finalBuffer, startIndex, 0, serializationIndex);\n\n // Return the index\n return serializationIndex - 1;\n};\n\n/**\n * Deserialize data as BSON.\n *\n * @param {Buffer} buffer the buffer containing the serialized set of BSON documents.\n * @param {Object} [options.evalFunctions=false] evaluate functions in the BSON document scoped to the object deserialized.\n * @param {Object} [options.cacheFunctions=false] cache evaluated functions for reuse.\n * @param {Object} [options.cacheFunctionsCrc32=false] use a crc32 code for caching, otherwise use the string of the function.\n * @param {Object} [options.promoteLongs=true] when deserializing a Long will fit it into a Number if it's smaller than 53 bits\n * @param {Object} [options.promoteBuffers=false] when deserializing a Binary will return it as a node.js Buffer instance.\n * @param {Object} [options.promoteValues=false] when deserializing will promote BSON values to their Node.js closest equivalent types.\n * @param {Object} [options.fieldsAsRaw=null] allow to specify if there what fields we wish to return as unserialized raw buffer.\n * @param {Object} [options.bsonRegExp=false] return BSON regular expressions as BSONRegExp instances.\n * @return {Object} returns the deserialized Javascript Object.\n * @api public\n */\nBSON.prototype.deserialize = function (buffer, options) {\n return deserialize(buffer, options);\n};\n\n/**\n * Calculate the bson size for a passed in Javascript object.\n *\n * @param {Object} object the Javascript object to calculate the BSON byte size for.\n * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**.\n * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**.\n * @return {Number} returns the number of bytes the BSON object will take up.\n * @api public\n */\nBSON.prototype.calculateObjectSize = function (object, options) {\n options = options || {};\n\n var serializeFunctions = typeof options.serializeFunctions == 'boolean' ? options.serializeFunctions : false;\n var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' ? options.ignoreUndefined : true;\n\n return calculateObjectSize(object, serializeFunctions, ignoreUndefined);\n};\n\n/**\n * Deserialize stream data as BSON documents.\n *\n * @param {Buffer} data the buffer containing the serialized set of BSON documents.\n * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start.\n * @param {Number} numberOfDocuments number of documents to deserialize.\n * @param {Array} documents an array where to store the deserialized documents.\n * @param {Number} docStartIndex the index in the documents array from where to start inserting documents.\n * @param {Object} [options] additional options used for the deserialization.\n * @param {Object} [options.evalFunctions=false] evaluate functions in the BSON document scoped to the object deserialized.\n * @param {Object} [options.cacheFunctions=false] cache evaluated functions for reuse.\n * @param {Object} [options.cacheFunctionsCrc32=false] use a crc32 code for caching, otherwise use the string of the function.\n * @param {Object} [options.promoteLongs=true] when deserializing a Long will fit it into a Number if it's smaller than 53 bits\n * @param {Object} [options.promoteBuffers=false] when deserializing a Binary will return it as a node.js Buffer instance.\n * @param {Object} [options.promoteValues=false] when deserializing will promote BSON values to their Node.js closest equivalent types.\n * @param {Object} [options.fieldsAsRaw=null] allow to specify if there what fields we wish to return as unserialized raw buffer.\n * @param {Object} [options.bsonRegExp=false] return BSON regular expressions as BSONRegExp instances.\n * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents.\n * @api public\n */\nBSON.prototype.deserializeStream = function (data, startIndex, numberOfDocuments, documents, docStartIndex, options) {\n options = options != null ? options : {};\n var index = startIndex;\n // Loop over all documents\n for (var i = 0; i < numberOfDocuments; i++) {\n // Find size of the document\n var size = data[index] | data[index + 1] << 8 | data[index + 2] << 16 | data[index + 3] << 24;\n // Update options with index\n options['index'] = index;\n // Parse the document at this point\n documents[docStartIndex + i] = this.deserialize(data, options);\n // Adjust index by the document size\n index = index + size;\n }\n\n // Return object containing end index of parsing and list of documents\n return index;\n};\n\n/**\n * @ignore\n * @api private\n */\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\nBSON.BSON_INT64_MAX = Math.pow(2, 63) - 1;\nBSON.BSON_INT64_MIN = -Math.pow(2, 63);\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\n// Internal long versions\nvar JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double.\nvar JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double.\n\n/**\n * Number BSON Type\n *\n * @classconstant BSON_DATA_NUMBER\n **/\nBSON.BSON_DATA_NUMBER = 1;\n/**\n * String BSON Type\n *\n * @classconstant BSON_DATA_STRING\n **/\nBSON.BSON_DATA_STRING = 2;\n/**\n * Object BSON Type\n *\n * @classconstant BSON_DATA_OBJECT\n **/\nBSON.BSON_DATA_OBJECT = 3;\n/**\n * Array BSON Type\n *\n * @classconstant BSON_DATA_ARRAY\n **/\nBSON.BSON_DATA_ARRAY = 4;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_BINARY\n **/\nBSON.BSON_DATA_BINARY = 5;\n/**\n * ObjectID BSON Type\n *\n * @classconstant BSON_DATA_OID\n **/\nBSON.BSON_DATA_OID = 7;\n/**\n * Boolean BSON Type\n *\n * @classconstant BSON_DATA_BOOLEAN\n **/\nBSON.BSON_DATA_BOOLEAN = 8;\n/**\n * Date BSON Type\n *\n * @classconstant BSON_DATA_DATE\n **/\nBSON.BSON_DATA_DATE = 9;\n/**\n * null BSON Type\n *\n * @classconstant BSON_DATA_NULL\n **/\nBSON.BSON_DATA_NULL = 10;\n/**\n * RegExp BSON Type\n *\n * @classconstant BSON_DATA_REGEXP\n **/\nBSON.BSON_DATA_REGEXP = 11;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_CODE\n **/\nBSON.BSON_DATA_CODE = 13;\n/**\n * Symbol BSON Type\n *\n * @classconstant BSON_DATA_SYMBOL\n **/\nBSON.BSON_DATA_SYMBOL = 14;\n/**\n * Code with Scope BSON Type\n *\n * @classconstant BSON_DATA_CODE_W_SCOPE\n **/\nBSON.BSON_DATA_CODE_W_SCOPE = 15;\n/**\n * 32 bit Integer BSON Type\n *\n * @classconstant BSON_DATA_INT\n **/\nBSON.BSON_DATA_INT = 16;\n/**\n * Timestamp BSON Type\n *\n * @classconstant BSON_DATA_TIMESTAMP\n **/\nBSON.BSON_DATA_TIMESTAMP = 17;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_LONG\n **/\nBSON.BSON_DATA_LONG = 18;\n/**\n * MinKey BSON Type\n *\n * @classconstant BSON_DATA_MIN_KEY\n **/\nBSON.BSON_DATA_MIN_KEY = 0xff;\n/**\n * MaxKey BSON Type\n *\n * @classconstant BSON_DATA_MAX_KEY\n **/\nBSON.BSON_DATA_MAX_KEY = 0x7f;\n\n/**\n * Binary Default Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_DEFAULT\n **/\nBSON.BSON_BINARY_SUBTYPE_DEFAULT = 0;\n/**\n * Binary Function Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_FUNCTION\n **/\nBSON.BSON_BINARY_SUBTYPE_FUNCTION = 1;\n/**\n * Binary Byte Array Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY\n **/\nBSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;\n/**\n * Binary UUID Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_UUID\n **/\nBSON.BSON_BINARY_SUBTYPE_UUID = 3;\n/**\n * Binary MD5 Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_MD5\n **/\nBSON.BSON_BINARY_SUBTYPE_MD5 = 4;\n/**\n * Binary User Defined Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED\n **/\nBSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128;\n\n// Return BSON\nmodule.exports = BSON;\nmodule.exports.Code = Code;\nmodule.exports.Map = Map;\nmodule.exports.Symbol = _Symbol;\nmodule.exports.BSON = BSON;\nmodule.exports.DBRef = DBRef;\nmodule.exports.Binary = Binary;\nmodule.exports.ObjectID = ObjectID;\nmodule.exports.Long = Long;\nmodule.exports.Timestamp = Timestamp;\nmodule.exports.Double = Double;\nmodule.exports.Int32 = Int32;\nmodule.exports.MinKey = MinKey;\nmodule.exports.MaxKey = MaxKey;\nmodule.exports.BSONRegExp = BSONRegExp;\nmodule.exports.Decimal128 = Decimal128;\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))\n\n/***/ }),\n/* 29 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Buffer) {\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar writeIEEE754 = __webpack_require__(1).writeIEEE754,\n readIEEE754 = __webpack_require__(1).readIEEE754,\n Long = __webpack_require__(3).Long,\n Double = __webpack_require__(9).Double,\n Timestamp = __webpack_require__(15).Timestamp,\n ObjectID = __webpack_require__(12).ObjectID,\n _Symbol = __webpack_require__(14).Symbol,\n BSONRegExp = __webpack_require__(13).BSONRegExp,\n Code = __webpack_require__(6).Code,\n Decimal128 = __webpack_require__(8),\n MinKey = __webpack_require__(11).MinKey,\n MaxKey = __webpack_require__(10).MaxKey,\n DBRef = __webpack_require__(7).DBRef,\n Binary = __webpack_require__(5).Binary;\n\n// To ensure that 0.4 of node works correctly\nvar isDate = function isDate(d) {\n return (typeof d === 'undefined' ? 'undefined' : _typeof(d)) === 'object' && Object.prototype.toString.call(d) === '[object Date]';\n};\n\nvar calculateObjectSize = function calculateObjectSize(object, serializeFunctions, ignoreUndefined) {\n var totalLength = 4 + 1;\n\n if (Array.isArray(object)) {\n for (var i = 0; i < object.length; i++) {\n totalLength += calculateElement(i.toString(), object[i], serializeFunctions, true, ignoreUndefined);\n }\n } else {\n // If we have toBSON defined, override the current object\n if (object.toBSON) {\n object = object.toBSON();\n }\n\n // Calculate size\n for (var key in object) {\n totalLength += calculateElement(key, object[key], serializeFunctions, false, ignoreUndefined);\n }\n }\n\n return totalLength;\n};\n\n/**\n * @ignore\n * @api private\n */\nfunction calculateElement(name, value, serializeFunctions, isArray, ignoreUndefined) {\n // If we have toBSON defined, override the current object\n if (value && value.toBSON) {\n value = value.toBSON();\n }\n\n switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) {\n case 'string':\n return 1 + Buffer.byteLength(name, 'utf8') + 1 + 4 + Buffer.byteLength(value, 'utf8') + 1;\n case 'number':\n if (Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) {\n if (value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) {\n // 32 bit\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (4 + 1);\n } else {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (8 + 1);\n }\n } else {\n // 64 bit\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (8 + 1);\n }\n case 'undefined':\n if (isArray || !ignoreUndefined) return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1;\n return 0;\n case 'boolean':\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (1 + 1);\n case 'object':\n if (value == null || value instanceof MinKey || value instanceof MaxKey || value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1;\n } else if (value instanceof ObjectID || value['_bsontype'] == 'ObjectID') {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (12 + 1);\n } else if (value instanceof Date || isDate(value)) {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (8 + 1);\n } else if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (1 + 4 + 1) + value.length;\n } else if (value instanceof Long || value instanceof Double || value instanceof Timestamp || value['_bsontype'] == 'Long' || value['_bsontype'] == 'Double' || value['_bsontype'] == 'Timestamp') {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (8 + 1);\n } else if (value instanceof Decimal128 || value['_bsontype'] == 'Decimal128') {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (16 + 1);\n } else if (value instanceof Code || value['_bsontype'] == 'Code') {\n // Calculate size depending on the availability of a scope\n if (value.scope != null && Object.keys(value.scope).length > 0) {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + 4 + 4 + Buffer.byteLength(value.code.toString(), 'utf8') + 1 + calculateObjectSize(value.scope, serializeFunctions, ignoreUndefined);\n } else {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + 4 + Buffer.byteLength(value.code.toString(), 'utf8') + 1;\n }\n } else if (value instanceof Binary || value['_bsontype'] == 'Binary') {\n // Check what kind of subtype we have\n if (value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (value.position + 1 + 4 + 1 + 4);\n } else {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (value.position + 1 + 4 + 1);\n }\n } else if (value instanceof _Symbol || value['_bsontype'] == 'Symbol') {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + Buffer.byteLength(value.value, 'utf8') + 4 + 1 + 1;\n } else if (value instanceof DBRef || value['_bsontype'] == 'DBRef') {\n // Set up correct object for serialization\n var ordered_values = {\n '$ref': value.namespace,\n '$id': value.oid\n };\n\n // Add db reference if it exists\n if (null != value.db) {\n ordered_values['$db'] = value.db;\n }\n\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + calculateObjectSize(ordered_values, serializeFunctions, ignoreUndefined);\n } else if (value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]') {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + Buffer.byteLength(value.source, 'utf8') + 1 + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1;\n } else if (value instanceof BSONRegExp || value['_bsontype'] == 'BSONRegExp') {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + Buffer.byteLength(value.pattern, 'utf8') + 1 + Buffer.byteLength(value.options, 'utf8') + 1;\n } else {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + calculateObjectSize(value, serializeFunctions, ignoreUndefined) + 1;\n }\n case 'function':\n // WTF for 0.4.X where typeof /someregexp/ === 'function'\n if (value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]' || String.call(value) == '[object RegExp]') {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + Buffer.byteLength(value.source, 'utf8') + 1 + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1;\n } else {\n if (serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + 4 + 4 + Buffer.byteLength(value.toString(), 'utf8') + 1 + calculateObjectSize(value.scope, serializeFunctions, ignoreUndefined);\n } else if (serializeFunctions) {\n return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + 4 + Buffer.byteLength(value.toString(), 'utf8') + 1;\n }\n }\n }\n\n return 0;\n}\n\nvar BSON = {};\n\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\nmodule.exports = calculateObjectSize;\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))\n\n/***/ }),\n/* 30 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Buffer) {\n\nvar readIEEE754 = __webpack_require__(1).readIEEE754,\n f = __webpack_require__(72).format,\n Long = __webpack_require__(3).Long,\n Double = __webpack_require__(9).Double,\n Timestamp = __webpack_require__(15).Timestamp,\n ObjectID = __webpack_require__(12).ObjectID,\n _Symbol = __webpack_require__(14).Symbol,\n Code = __webpack_require__(6).Code,\n MinKey = __webpack_require__(11).MinKey,\n MaxKey = __webpack_require__(10).MaxKey,\n Decimal128 = __webpack_require__(8),\n Int32 = __webpack_require__(18),\n DBRef = __webpack_require__(7).DBRef,\n BSONRegExp = __webpack_require__(13).BSONRegExp,\n Binary = __webpack_require__(5).Binary;\n\nvar deserialize = function deserialize(buffer, options, isArray) {\n options = options == null ? {} : options;\n var index = options && options.index ? options.index : 0;\n // Read the document size\n var size = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;\n\n // Ensure buffer is valid size\n if (size < 5 || buffer.length < size || size + index > buffer.length) {\n throw new Error(\"corrupt bson message\");\n }\n\n // Illegal end value\n if (buffer[index + size - 1] != 0) {\n throw new Error(\"One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00\");\n }\n\n // Start deserializtion\n return deserializeObject(buffer, index, options, isArray);\n};\n\nvar deserializeObject = function deserializeObject(buffer, index, options, isArray) {\n var evalFunctions = options['evalFunctions'] == null ? false : options['evalFunctions'];\n var cacheFunctions = options['cacheFunctions'] == null ? false : options['cacheFunctions'];\n var cacheFunctionsCrc32 = options['cacheFunctionsCrc32'] == null ? false : options['cacheFunctionsCrc32'];\n var fieldsAsRaw = options['fieldsAsRaw'] == null ? null : options['fieldsAsRaw'];\n\n // Return raw bson buffer instead of parsing it\n var raw = options['raw'] == null ? false : options['raw'];\n\n // Return BSONRegExp objects instead of native regular expressions\n var bsonRegExp = typeof options['bsonRegExp'] == 'boolean' ? options['bsonRegExp'] : false;\n\n // Controls the promotion of values vs wrapper classes\n var promoteBuffers = options['promoteBuffers'] == null ? false : options['promoteBuffers'];\n var promoteLongs = options['promoteLongs'] == null ? true : options['promoteLongs'];\n var promoteValues = options['promoteValues'] == null ? true : options['promoteValues'];\n\n // Set the start index\n var startIndex = index;\n\n // Validate that we have at least 4 bytes of buffer\n if (buffer.length < 5) throw new Error(\"corrupt bson message < 5 bytes long\");\n\n // Read the document size\n var size = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n // Ensure buffer is valid size\n if (size < 5 || size > buffer.length) throw new Error(\"corrupt bson message\");\n\n // Create holding object\n var object = isArray ? [] : {};\n // Used for arrays to skip having to perform utf8 decoding\n var arrayIndex = 0;\n\n // While we have more left data left keep parsing\n while (true) {\n // Read the type\n var elementType = buffer[index++];\n // If we get a zero it's the last byte, exit\n if (elementType == 0) {\n break;\n }\n\n // Get the start search index\n var i = index;\n // Locate the end of the c string\n while (buffer[i] !== 0x00 && i < buffer.length) {\n i++;\n }\n\n // If are at the end of the buffer there is a problem with the document\n if (i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\");\n var name = isArray ? arrayIndex++ : buffer.toString('utf8', index, i);\n\n index = i + 1;\n\n if (elementType == BSON.BSON_DATA_STRING) {\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n if (stringSize <= 0 || stringSize > buffer.length - index || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n object[name] = buffer.toString('utf8', index, index + stringSize - 1);\n index = index + stringSize;\n } else if (elementType == BSON.BSON_DATA_OID) {\n var oid = new Buffer(12);\n buffer.copy(oid, 0, index, index + 12);\n object[name] = new ObjectID(oid);\n index = index + 12;\n } else if (elementType == BSON.BSON_DATA_INT && promoteValues == false) {\n object[name] = new Int32(buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24);\n } else if (elementType == BSON.BSON_DATA_INT) {\n object[name] = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n } else if (elementType == BSON.BSON_DATA_NUMBER && promoteValues == false) {\n object[name] = new Double(buffer.readDoubleLE(index));\n index = index + 8;\n } else if (elementType == BSON.BSON_DATA_NUMBER) {\n object[name] = buffer.readDoubleLE(index);\n index = index + 8;\n } else if (elementType == BSON.BSON_DATA_DATE) {\n var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n object[name] = new Date(new Long(lowBits, highBits).toNumber());\n } else if (elementType == BSON.BSON_DATA_BOOLEAN) {\n if (buffer[index] != 0 && buffer[index] != 1) throw new Error('illegal boolean type value');\n object[name] = buffer[index++] == 1;\n } else if (elementType == BSON.BSON_DATA_OBJECT) {\n var _index = index;\n var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;\n if (objectSize <= 0 || objectSize > buffer.length - index) throw new Error(\"bad embedded document length in bson\");\n\n // We have a raw value\n if (raw) {\n object[name] = buffer.slice(index, index + objectSize);\n } else {\n object[name] = deserializeObject(buffer, _index, options, false);\n }\n\n index = index + objectSize;\n } else if (elementType == BSON.BSON_DATA_ARRAY) {\n var _index = index;\n var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;\n var arrayOptions = options;\n\n // Stop index\n var stopIndex = index + objectSize;\n\n // All elements of array to be returned as raw bson\n if (fieldsAsRaw && fieldsAsRaw[name]) {\n arrayOptions = {};\n for (var n in options) {\n arrayOptions[n] = options[n];\n }arrayOptions['raw'] = true;\n }\n\n object[name] = deserializeObject(buffer, _index, arrayOptions, true);\n index = index + objectSize;\n\n if (buffer[index - 1] != 0) throw new Error('invalid array terminator byte');\n if (index != stopIndex) throw new Error('corrupted array bson');\n } else if (elementType == BSON.BSON_DATA_UNDEFINED) {\n object[name] = undefined;\n } else if (elementType == BSON.BSON_DATA_NULL) {\n object[name] = null;\n } else if (elementType == BSON.BSON_DATA_LONG) {\n // Unpack the low and high bits\n var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var long = new Long(lowBits, highBits);\n // Promote the long if possible\n if (promoteLongs && promoteValues == true) {\n object[name] = long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG) ? long.toNumber() : long;\n } else {\n object[name] = long;\n }\n } else if (elementType == BSON.BSON_DATA_DECIMAL128) {\n // Buffer to contain the decimal bytes\n var bytes = new Buffer(16);\n // Copy the next 16 bytes into the bytes buffer\n buffer.copy(bytes, 0, index, index + 16);\n // Update index\n index = index + 16;\n // Assign the new Decimal128 value\n var decimal128 = new Decimal128(bytes);\n // If we have an alternative mapper use that\n object[name] = decimal128.toObject ? decimal128.toObject() : decimal128;\n } else if (elementType == BSON.BSON_DATA_BINARY) {\n var binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var totalBinarySize = binarySize;\n var subType = buffer[index++];\n\n // Did we have a negative binary size, throw\n if (binarySize < 0) throw new Error('Negative binary type element size found');\n\n // Is the length longer than the document\n if (binarySize > buffer.length) throw new Error('Binary type size larger than document size');\n\n // Decode as raw Buffer object if options specifies it\n if (buffer['slice'] != null) {\n // If we have subtype 2 skip the 4 bytes for the size\n if (subType == Binary.SUBTYPE_BYTE_ARRAY) {\n binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n if (binarySize < 0) throw new Error('Negative binary type element size found for subtype 0x02');\n if (binarySize > totalBinarySize - 4) throw new Error('Binary type with subtype 0x02 contains to long binary size');\n if (binarySize < totalBinarySize - 4) throw new Error('Binary type with subtype 0x02 contains to short binary size');\n }\n\n if (promoteBuffers && promoteValues) {\n object[name] = buffer.slice(index, index + binarySize);\n } else {\n object[name] = new Binary(buffer.slice(index, index + binarySize), subType);\n }\n } else {\n var _buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(binarySize)) : new Array(binarySize);\n // If we have subtype 2 skip the 4 bytes for the size\n if (subType == Binary.SUBTYPE_BYTE_ARRAY) {\n binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n if (binarySize < 0) throw new Error('Negative binary type element size found for subtype 0x02');\n if (binarySize > totalBinarySize - 4) throw new Error('Binary type with subtype 0x02 contains to long binary size');\n if (binarySize < totalBinarySize - 4) throw new Error('Binary type with subtype 0x02 contains to short binary size');\n }\n\n // Copy the data\n for (var i = 0; i < binarySize; i++) {\n _buffer[i] = buffer[index + i];\n }\n\n if (promoteBuffers && promoteValues) {\n object[name] = _buffer;\n } else {\n object[name] = new Binary(_buffer, subType);\n }\n }\n\n // Update the index\n index = index + binarySize;\n } else if (elementType == BSON.BSON_DATA_REGEXP && bsonRegExp == false) {\n // Get the start search index\n var i = index;\n // Locate the end of the c string\n while (buffer[i] !== 0x00 && i < buffer.length) {\n i++;\n }\n // If are at the end of the buffer there is a problem with the document\n if (i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\");\n // Return the C string\n var source = buffer.toString('utf8', index, i);\n // Create the regexp\n index = i + 1;\n\n // Get the start search index\n var i = index;\n // Locate the end of the c string\n while (buffer[i] !== 0x00 && i < buffer.length) {\n i++;\n }\n // If are at the end of the buffer there is a problem with the document\n if (i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\");\n // Return the C string\n var regExpOptions = buffer.toString('utf8', index, i);\n index = i + 1;\n\n // For each option add the corresponding one for javascript\n var optionsArray = new Array(regExpOptions.length);\n\n // Parse options\n for (var i = 0; i < regExpOptions.length; i++) {\n switch (regExpOptions[i]) {\n case 'm':\n optionsArray[i] = 'm';\n break;\n case 's':\n optionsArray[i] = 'g';\n break;\n case 'i':\n optionsArray[i] = 'i';\n break;\n }\n }\n\n object[name] = new RegExp(source, optionsArray.join(''));\n } else if (elementType == BSON.BSON_DATA_REGEXP && bsonRegExp == true) {\n // Get the start search index\n var i = index;\n // Locate the end of the c string\n while (buffer[i] !== 0x00 && i < buffer.length) {\n i++;\n }\n // If are at the end of the buffer there is a problem with the document\n if (i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\");\n // Return the C string\n var source = buffer.toString('utf8', index, i);\n index = i + 1;\n\n // Get the start search index\n var i = index;\n // Locate the end of the c string\n while (buffer[i] !== 0x00 && i < buffer.length) {\n i++;\n }\n // If are at the end of the buffer there is a problem with the document\n if (i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\");\n // Return the C string\n var regExpOptions = buffer.toString('utf8', index, i);\n index = i + 1;\n\n // Set the object\n object[name] = new BSONRegExp(source, regExpOptions);\n } else if (elementType == BSON.BSON_DATA_SYMBOL) {\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n if (stringSize <= 0 || stringSize > buffer.length - index || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n object[name] = new _Symbol(buffer.toString('utf8', index, index + stringSize - 1));\n index = index + stringSize;\n } else if (elementType == BSON.BSON_DATA_TIMESTAMP) {\n var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n object[name] = new Timestamp(lowBits, highBits);\n } else if (elementType == BSON.BSON_DATA_MIN_KEY) {\n object[name] = new MinKey();\n } else if (elementType == BSON.BSON_DATA_MAX_KEY) {\n object[name] = new MaxKey();\n } else if (elementType == BSON.BSON_DATA_CODE) {\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n if (stringSize <= 0 || stringSize > buffer.length - index || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n var functionString = buffer.toString('utf8', index, index + stringSize - 1);\n\n // If we are evaluating the functions\n if (evalFunctions) {\n var value = null;\n // If we have cache enabled let's look for the md5 of the function in the cache\n if (cacheFunctions) {\n var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString;\n // Got to do this to avoid V8 deoptimizing the call due to finding eval\n object[name] = isolateEvalWithHash(functionCache, hash, functionString, object);\n } else {\n object[name] = isolateEval(functionString);\n }\n } else {\n object[name] = new Code(functionString);\n }\n\n // Update parse index position\n index = index + stringSize;\n } else if (elementType == BSON.BSON_DATA_CODE_W_SCOPE) {\n var totalSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n // Element cannot be shorter than totalSize + stringSize + documentSize + terminator\n if (totalSize < 4 + 4 + 4 + 1) {\n throw new Error(\"code_w_scope total size shorter minimum expected length\");\n }\n\n // Get the code string size\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n // Check if we have a valid string\n if (stringSize <= 0 || stringSize > buffer.length - index || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n\n // Javascript function\n var functionString = buffer.toString('utf8', index, index + stringSize - 1);\n // Update parse index position\n index = index + stringSize;\n // Parse the element\n var _index = index;\n // Decode the size of the object document\n var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;\n // Decode the scope object\n var scopeObject = deserializeObject(buffer, _index, options, false);\n // Adjust the index\n index = index + objectSize;\n\n // Check if field length is to short\n if (totalSize < 4 + 4 + objectSize + stringSize) {\n throw new Error('code_w_scope total size is to short, truncating scope');\n }\n\n // Check if totalSize field is to long\n if (totalSize > 4 + 4 + objectSize + stringSize) {\n throw new Error('code_w_scope total size is to long, clips outer document');\n }\n\n // If we are evaluating the functions\n if (evalFunctions) {\n // Contains the value we are going to set\n var value = null;\n // If we have cache enabled let's look for the md5 of the function in the cache\n if (cacheFunctions) {\n var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString;\n // Got to do this to avoid V8 deoptimizing the call due to finding eval\n object[name] = isolateEvalWithHash(functionCache, hash, functionString, object);\n } else {\n object[name] = isolateEval(functionString);\n }\n\n object[name].scope = scopeObject;\n } else {\n object[name] = new Code(functionString, scopeObject);\n }\n } else if (elementType == BSON.BSON_DATA_DBPOINTER) {\n // Get the code string size\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n // Check if we have a valid string\n if (stringSize <= 0 || stringSize > buffer.length - index || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n // Namespace\n var namespace = buffer.toString('utf8', index, index + stringSize - 1);\n // Update parse index position\n index = index + stringSize;\n\n // Read the oid\n var oidBuffer = new Buffer(12);\n buffer.copy(oidBuffer, 0, index, index + 12);\n var oid = new ObjectID(oidBuffer);\n\n // Update the index\n index = index + 12;\n\n // Split the namespace\n var parts = namespace.split('.');\n var db = parts.shift();\n var collection = parts.join('.');\n // Upgrade to DBRef type\n object[name] = new DBRef(collection, oid, db);\n } else {\n throw new Error(\"Detected unknown BSON type \" + elementType.toString(16) + \" for fieldname \\\"\" + name + \"\\\", are you using the latest BSON parser\");\n }\n }\n\n // Check if the deserialization was against a valid array/object\n if (size != index - startIndex) {\n if (isArray) throw new Error('corrupt array bson');\n throw new Error('corrupt object bson');\n }\n\n // Check if we have a db ref object\n if (object['$id'] != null) object = new DBRef(object['$ref'], object['$id'], object['$db']);\n return object;\n};\n\n/**\n * Ensure eval is isolated.\n *\n * @ignore\n * @api private\n */\nvar isolateEvalWithHash = function isolateEvalWithHash(functionCache, hash, functionString, object) {\n // Contains the value we are going to set\n var value = null;\n\n // Check for cache hit, eval if missing and return cached function\n if (functionCache[hash] == null) {\n eval(\"value = \" + functionString);\n functionCache[hash] = value;\n }\n // Set the object\n return functionCache[hash].bind(object);\n};\n\n/**\n * Ensure eval is isolated.\n *\n * @ignore\n * @api private\n */\nvar isolateEval = function isolateEval(functionString) {\n // Contains the value we are going to set\n var value = null;\n // Eval the function\n eval(\"value = \" + functionString);\n return value;\n};\n\nvar BSON = {};\n\n/**\n * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5\n *\n * @ignore\n * @api private\n */\nvar functionCache = BSON.functionCache = {};\n\n/**\n * Number BSON Type\n *\n * @classconstant BSON_DATA_NUMBER\n **/\nBSON.BSON_DATA_NUMBER = 1;\n/**\n * String BSON Type\n *\n * @classconstant BSON_DATA_STRING\n **/\nBSON.BSON_DATA_STRING = 2;\n/**\n * Object BSON Type\n *\n * @classconstant BSON_DATA_OBJECT\n **/\nBSON.BSON_DATA_OBJECT = 3;\n/**\n * Array BSON Type\n *\n * @classconstant BSON_DATA_ARRAY\n **/\nBSON.BSON_DATA_ARRAY = 4;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_BINARY\n **/\nBSON.BSON_DATA_BINARY = 5;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_UNDEFINED\n **/\nBSON.BSON_DATA_UNDEFINED = 6;\n/**\n * ObjectID BSON Type\n *\n * @classconstant BSON_DATA_OID\n **/\nBSON.BSON_DATA_OID = 7;\n/**\n * Boolean BSON Type\n *\n * @classconstant BSON_DATA_BOOLEAN\n **/\nBSON.BSON_DATA_BOOLEAN = 8;\n/**\n * Date BSON Type\n *\n * @classconstant BSON_DATA_DATE\n **/\nBSON.BSON_DATA_DATE = 9;\n/**\n * null BSON Type\n *\n * @classconstant BSON_DATA_NULL\n **/\nBSON.BSON_DATA_NULL = 10;\n/**\n * RegExp BSON Type\n *\n * @classconstant BSON_DATA_REGEXP\n **/\nBSON.BSON_DATA_REGEXP = 11;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_DBPOINTER\n **/\nBSON.BSON_DATA_DBPOINTER = 12;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_CODE\n **/\nBSON.BSON_DATA_CODE = 13;\n/**\n * Symbol BSON Type\n *\n * @classconstant BSON_DATA_SYMBOL\n **/\nBSON.BSON_DATA_SYMBOL = 14;\n/**\n * Code with Scope BSON Type\n *\n * @classconstant BSON_DATA_CODE_W_SCOPE\n **/\nBSON.BSON_DATA_CODE_W_SCOPE = 15;\n/**\n * 32 bit Integer BSON Type\n *\n * @classconstant BSON_DATA_INT\n **/\nBSON.BSON_DATA_INT = 16;\n/**\n * Timestamp BSON Type\n *\n * @classconstant BSON_DATA_TIMESTAMP\n **/\nBSON.BSON_DATA_TIMESTAMP = 17;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_LONG\n **/\nBSON.BSON_DATA_LONG = 18;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_DECIMAL128\n **/\nBSON.BSON_DATA_DECIMAL128 = 19;\n/**\n * MinKey BSON Type\n *\n * @classconstant BSON_DATA_MIN_KEY\n **/\nBSON.BSON_DATA_MIN_KEY = 0xff;\n/**\n * MaxKey BSON Type\n *\n * @classconstant BSON_DATA_MAX_KEY\n **/\nBSON.BSON_DATA_MAX_KEY = 0x7f;\n\n/**\n * Binary Default Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_DEFAULT\n **/\nBSON.BSON_BINARY_SUBTYPE_DEFAULT = 0;\n/**\n * Binary Function Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_FUNCTION\n **/\nBSON.BSON_BINARY_SUBTYPE_FUNCTION = 1;\n/**\n * Binary Byte Array Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY\n **/\nBSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;\n/**\n * Binary UUID Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_UUID\n **/\nBSON.BSON_BINARY_SUBTYPE_UUID = 3;\n/**\n * Binary MD5 Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_MD5\n **/\nBSON.BSON_BINARY_SUBTYPE_MD5 = 4;\n/**\n * Binary User Defined Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED\n **/\nBSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128;\n\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\nBSON.BSON_INT64_MAX = Math.pow(2, 63) - 1;\nBSON.BSON_INT64_MIN = -Math.pow(2, 63);\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\n// Internal long versions\nvar JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double.\nvar JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double.\n\nmodule.exports = deserialize;\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))\n\n/***/ }),\n/* 31 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Buffer) {\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar writeIEEE754 = __webpack_require__(1).writeIEEE754,\n readIEEE754 = __webpack_require__(1).readIEEE754,\n Long = __webpack_require__(3).Long,\n Map = __webpack_require__(22),\n Double = __webpack_require__(9).Double,\n Timestamp = __webpack_require__(15).Timestamp,\n ObjectID = __webpack_require__(12).ObjectID,\n _Symbol = __webpack_require__(14).Symbol,\n Code = __webpack_require__(6).Code,\n BSONRegExp = __webpack_require__(13).BSONRegExp,\n Int32 = __webpack_require__(18).Int32,\n MinKey = __webpack_require__(11).MinKey,\n MaxKey = __webpack_require__(10).MaxKey,\n Decimal128 = __webpack_require__(8),\n DBRef = __webpack_require__(7).DBRef,\n Binary = __webpack_require__(5).Binary;\n\ntry {\n var _Buffer = Uint8Array;\n} catch (e) {\n var _Buffer = Buffer;\n}\n\nvar regexp = /\\x00/;\n\n// To ensure that 0.4 of node works correctly\nvar isDate = function isDate(d) {\n return (typeof d === 'undefined' ? 'undefined' : _typeof(d)) === 'object' && Object.prototype.toString.call(d) === '[object Date]';\n};\n\nvar isRegExp = function isRegExp(d) {\n return Object.prototype.toString.call(d) === '[object RegExp]';\n};\n\nvar serializeString = function serializeString(buffer, key, value, index, isArray) {\n // Encode String type\n buffer[index++] = BSON.BSON_DATA_STRING;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes + 1;\n buffer[index - 1] = 0;\n // Write the string\n var size = buffer.write(value, index + 4, 'utf8');\n // Write the size of the string to buffer\n buffer[index + 3] = size + 1 >> 24 & 0xff;\n buffer[index + 2] = size + 1 >> 16 & 0xff;\n buffer[index + 1] = size + 1 >> 8 & 0xff;\n buffer[index] = size + 1 & 0xff;\n // Update index\n index = index + 4 + size;\n // Write zero\n buffer[index++] = 0;\n return index;\n};\n\nvar serializeNumber = function serializeNumber(buffer, key, value, index, isArray) {\n // We have an integer value\n if (Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) {\n // If the value fits in 32 bits encode as int, if it fits in a double\n // encode it as a double, otherwise long\n if (value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) {\n // Set int type 32 bits or less\n buffer[index++] = BSON.BSON_DATA_INT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the int value\n buffer[index++] = value & 0xff;\n buffer[index++] = value >> 8 & 0xff;\n buffer[index++] = value >> 16 & 0xff;\n buffer[index++] = value >> 24 & 0xff;\n } else if (value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) {\n // Encode as double\n buffer[index++] = BSON.BSON_DATA_NUMBER;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write float\n writeIEEE754(buffer, value, index, 'little', 52, 8);\n // Ajust index\n index = index + 8;\n } else {\n // Set long type\n buffer[index++] = BSON.BSON_DATA_LONG;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n var longVal = Long.fromNumber(value);\n var lowBits = longVal.getLowBits();\n var highBits = longVal.getHighBits();\n // Encode low bits\n buffer[index++] = lowBits & 0xff;\n buffer[index++] = lowBits >> 8 & 0xff;\n buffer[index++] = lowBits >> 16 & 0xff;\n buffer[index++] = lowBits >> 24 & 0xff;\n // Encode high bits\n buffer[index++] = highBits & 0xff;\n buffer[index++] = highBits >> 8 & 0xff;\n buffer[index++] = highBits >> 16 & 0xff;\n buffer[index++] = highBits >> 24 & 0xff;\n }\n } else {\n // Encode as double\n buffer[index++] = BSON.BSON_DATA_NUMBER;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write float\n writeIEEE754(buffer, value, index, 'little', 52, 8);\n // Ajust index\n index = index + 8;\n }\n\n return index;\n};\n\nvar serializeNull = function serializeNull(buffer, key, value, index, isArray) {\n // Set long type\n buffer[index++] = BSON.BSON_DATA_NULL;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n return index;\n};\n\nvar serializeBoolean = function serializeBoolean(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_BOOLEAN;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Encode the boolean value\n buffer[index++] = value ? 1 : 0;\n return index;\n};\n\nvar serializeDate = function serializeDate(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_DATE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Write the date\n var dateInMilis = Long.fromNumber(value.getTime());\n var lowBits = dateInMilis.getLowBits();\n var highBits = dateInMilis.getHighBits();\n // Encode low bits\n buffer[index++] = lowBits & 0xff;\n buffer[index++] = lowBits >> 8 & 0xff;\n buffer[index++] = lowBits >> 16 & 0xff;\n buffer[index++] = lowBits >> 24 & 0xff;\n // Encode high bits\n buffer[index++] = highBits & 0xff;\n buffer[index++] = highBits >> 8 & 0xff;\n buffer[index++] = highBits >> 16 & 0xff;\n buffer[index++] = highBits >> 24 & 0xff;\n return index;\n};\n\nvar serializeRegExp = function serializeRegExp(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_REGEXP;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n if (value.source && value.source.match(regexp) != null) {\n throw Error(\"value \" + value.source + \" must not contain null bytes\");\n }\n // Adjust the index\n index = index + buffer.write(value.source, index, 'utf8');\n // Write zero\n buffer[index++] = 0x00;\n // Write the parameters\n if (value.global) buffer[index++] = 0x73; // s\n if (value.ignoreCase) buffer[index++] = 0x69; // i\n if (value.multiline) buffer[index++] = 0x6d; // m\n // Add ending zero\n buffer[index++] = 0x00;\n return index;\n};\n\nvar serializeBSONRegExp = function serializeBSONRegExp(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_REGEXP;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Check the pattern for 0 bytes\n if (value.pattern.match(regexp) != null) {\n // The BSON spec doesn't allow keys with null bytes because keys are\n // null-terminated.\n throw Error(\"pattern \" + value.pattern + \" must not contain null bytes\");\n }\n\n // Adjust the index\n index = index + buffer.write(value.pattern, index, 'utf8');\n // Write zero\n buffer[index++] = 0x00;\n // Write the options\n index = index + buffer.write(value.options.split('').sort().join(''), index, 'utf8');\n // Add ending zero\n buffer[index++] = 0x00;\n return index;\n};\n\nvar serializeMinMax = function serializeMinMax(buffer, key, value, index, isArray) {\n // Write the type of either min or max key\n if (value === null) {\n buffer[index++] = BSON.BSON_DATA_NULL;\n } else if (value instanceof MinKey) {\n buffer[index++] = BSON.BSON_DATA_MIN_KEY;\n } else {\n buffer[index++] = BSON.BSON_DATA_MAX_KEY;\n }\n\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n return index;\n};\n\nvar serializeObjectId = function serializeObjectId(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_OID;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Write the objectId into the shared buffer\n if (typeof value.id == 'string') {\n buffer.write(value.id, index, 'binary');\n } else if (value.id && value.id.copy) {\n value.id.copy(buffer, index, 0, 12);\n } else {\n throw new Error('object [' + JSON.stringify(value) + \"] is not a valid ObjectId\");\n }\n\n // Ajust index\n return index + 12;\n};\n\nvar serializeBuffer = function serializeBuffer(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_BINARY;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Get size of the buffer (current write point)\n var size = value.length;\n // Write the size of the string to buffer\n buffer[index++] = size & 0xff;\n buffer[index++] = size >> 8 & 0xff;\n buffer[index++] = size >> 16 & 0xff;\n buffer[index++] = size >> 24 & 0xff;\n // Write the default subtype\n buffer[index++] = BSON.BSON_BINARY_SUBTYPE_DEFAULT;\n // Copy the content form the binary field to the buffer\n value.copy(buffer, index, 0, size);\n // Adjust the index\n index = index + size;\n return index;\n};\n\nvar serializeObject = function serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, isArray, path) {\n for (var i = 0; i < path.length; i++) {\n if (path[i] === value) throw new Error('cyclic dependency detected');\n }\n\n // Push value to stack\n path.push(value);\n // Write the type\n buffer[index++] = Array.isArray(value) ? BSON.BSON_DATA_ARRAY : BSON.BSON_DATA_OBJECT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n var endIndex = serializeInto(buffer, value, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined, path);\n // Pop stack\n path.pop();\n // Write size\n var size = endIndex - index;\n return endIndex;\n};\n\nvar serializeDecimal128 = function serializeDecimal128(buffer, key, value, index, isArray) {\n buffer[index++] = BSON.BSON_DATA_DECIMAL128;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the data from the value\n value.bytes.copy(buffer, index, 0, 16);\n return index + 16;\n};\n\nvar serializeLong = function serializeLong(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = value._bsontype == 'Long' ? BSON.BSON_DATA_LONG : BSON.BSON_DATA_TIMESTAMP;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the date\n var lowBits = value.getLowBits();\n var highBits = value.getHighBits();\n // Encode low bits\n buffer[index++] = lowBits & 0xff;\n buffer[index++] = lowBits >> 8 & 0xff;\n buffer[index++] = lowBits >> 16 & 0xff;\n buffer[index++] = lowBits >> 24 & 0xff;\n // Encode high bits\n buffer[index++] = highBits & 0xff;\n buffer[index++] = highBits >> 8 & 0xff;\n buffer[index++] = highBits >> 16 & 0xff;\n buffer[index++] = highBits >> 24 & 0xff;\n return index;\n};\n\nvar serializeInt32 = function serializeInt32(buffer, key, value, index, isArray) {\n // Set int type 32 bits or less\n buffer[index++] = BSON.BSON_DATA_INT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the int value\n buffer[index++] = value & 0xff;\n buffer[index++] = value >> 8 & 0xff;\n buffer[index++] = value >> 16 & 0xff;\n buffer[index++] = value >> 24 & 0xff;\n return index;\n};\n\nvar serializeDouble = function serializeDouble(buffer, key, value, index, isArray) {\n // Encode as double\n buffer[index++] = BSON.BSON_DATA_NUMBER;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write float\n writeIEEE754(buffer, value, index, 'little', 52, 8);\n // Ajust index\n index = index + 8;\n return index;\n};\n\nvar serializeFunction = function serializeFunction(buffer, key, value, index, checkKeys, depth, isArray) {\n buffer[index++] = BSON.BSON_DATA_CODE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Function string\n var functionString = value.toString();\n // Write the string\n var size = buffer.write(functionString, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = size & 0xff;\n buffer[index + 1] = size >> 8 & 0xff;\n buffer[index + 2] = size >> 16 & 0xff;\n buffer[index + 3] = size >> 24 & 0xff;\n // Update index\n index = index + 4 + size - 1;\n // Write zero\n buffer[index++] = 0;\n return index;\n};\n\nvar serializeCode = function serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, isArray) {\n if (value.scope && _typeof(value.scope) == 'object') {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Starting index\n var startIndex = index;\n\n // Serialize the function\n // Get the function string\n var functionString = typeof value.code == 'string' ? value.code : value.code.toString();\n // Index adjustment\n index = index + 4;\n // Write string into buffer\n var codeSize = buffer.write(functionString, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = codeSize & 0xff;\n buffer[index + 1] = codeSize >> 8 & 0xff;\n buffer[index + 2] = codeSize >> 16 & 0xff;\n buffer[index + 3] = codeSize >> 24 & 0xff;\n // Write end 0\n buffer[index + 4 + codeSize - 1] = 0;\n // Write the\n index = index + codeSize + 4;\n\n //\n // Serialize the scope value\n var endIndex = serializeInto(buffer, value.scope, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined);\n index = endIndex - 1;\n\n // Writ the total\n var totalSize = endIndex - startIndex;\n\n // Write the total size of the object\n buffer[startIndex++] = totalSize & 0xff;\n buffer[startIndex++] = totalSize >> 8 & 0xff;\n buffer[startIndex++] = totalSize >> 16 & 0xff;\n buffer[startIndex++] = totalSize >> 24 & 0xff;\n // Write trailing zero\n buffer[index++] = 0;\n } else {\n buffer[index++] = BSON.BSON_DATA_CODE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Function string\n var functionString = value.code.toString();\n // Write the string\n var size = buffer.write(functionString, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = size & 0xff;\n buffer[index + 1] = size >> 8 & 0xff;\n buffer[index + 2] = size >> 16 & 0xff;\n buffer[index + 3] = size >> 24 & 0xff;\n // Update index\n index = index + 4 + size - 1;\n // Write zero\n buffer[index++] = 0;\n }\n\n return index;\n};\n\nvar serializeBinary = function serializeBinary(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_BINARY;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Extract the buffer\n var data = value.value(true);\n // Calculate size\n var size = value.position;\n // Add the deprecated 02 type 4 bytes of size to total\n if (value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) size = size + 4;\n // Write the size of the string to buffer\n buffer[index++] = size & 0xff;\n buffer[index++] = size >> 8 & 0xff;\n buffer[index++] = size >> 16 & 0xff;\n buffer[index++] = size >> 24 & 0xff;\n // Write the subtype to the buffer\n buffer[index++] = value.sub_type;\n\n // If we have binary type 2 the 4 first bytes are the size\n if (value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) {\n size = size - 4;\n buffer[index++] = size & 0xff;\n buffer[index++] = size >> 8 & 0xff;\n buffer[index++] = size >> 16 & 0xff;\n buffer[index++] = size >> 24 & 0xff;\n }\n\n // Write the data to the object\n data.copy(buffer, index, 0, value.position);\n // Adjust the index\n index = index + value.position;\n return index;\n};\n\nvar serializeSymbol = function serializeSymbol(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_SYMBOL;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the string\n var size = buffer.write(value.value, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = size & 0xff;\n buffer[index + 1] = size >> 8 & 0xff;\n buffer[index + 2] = size >> 16 & 0xff;\n buffer[index + 3] = size >> 24 & 0xff;\n // Update index\n index = index + 4 + size - 1;\n // Write zero\n buffer[index++] = 0x00;\n return index;\n};\n\nvar serializeDBRef = function serializeDBRef(buffer, key, value, index, depth, serializeFunctions, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_OBJECT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n var startIndex = index;\n var endIndex;\n\n // Serialize object\n if (null != value.db) {\n endIndex = serializeInto(buffer, {\n '$ref': value.namespace,\n '$id': value.oid,\n '$db': value.db\n }, false, index, depth + 1, serializeFunctions);\n } else {\n endIndex = serializeInto(buffer, {\n '$ref': value.namespace,\n '$id': value.oid\n }, false, index, depth + 1, serializeFunctions);\n }\n\n // Calculate object size\n var size = endIndex - startIndex;\n // Write the size\n buffer[startIndex++] = size & 0xff;\n buffer[startIndex++] = size >> 8 & 0xff;\n buffer[startIndex++] = size >> 16 & 0xff;\n buffer[startIndex++] = size >> 24 & 0xff;\n // Set index\n return endIndex;\n};\n\nvar serializeInto = function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializeFunctions, ignoreUndefined, path) {\n startingIndex = startingIndex || 0;\n path = path || [];\n\n // Push the object to the path\n path.push(object);\n\n // Start place to serialize into\n var index = startingIndex + 4;\n var self = this;\n\n // Special case isArray\n if (Array.isArray(object)) {\n // Get object keys\n for (var i = 0; i < object.length; i++) {\n var key = \"\" + i;\n var value = object[i];\n\n // Is there an override value\n if (value && value.toBSON) {\n if (typeof value.toBSON != 'function') throw new Error(\"toBSON is not a function\");\n value = value.toBSON();\n }\n\n var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);\n if (type == 'string') {\n index = serializeString(buffer, key, value, index, true);\n } else if (type == 'number') {\n index = serializeNumber(buffer, key, value, index, true);\n } else if (type == 'boolean') {\n index = serializeBoolean(buffer, key, value, index, true);\n } else if (value instanceof Date || isDate(value)) {\n index = serializeDate(buffer, key, value, index, true);\n } else if (value === undefined) {\n index = serializeNull(buffer, key, value, index, true);\n } else if (value === null) {\n index = serializeNull(buffer, key, value, index, true);\n } else if (value['_bsontype'] == 'ObjectID') {\n index = serializeObjectId(buffer, key, value, index, true);\n } else if (Buffer.isBuffer(value)) {\n index = serializeBuffer(buffer, key, value, index, true);\n } else if (value instanceof RegExp || isRegExp(value)) {\n index = serializeRegExp(buffer, key, value, index, true);\n } else if (type == 'object' && value['_bsontype'] == null) {\n index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, true, path);\n } else if (type == 'object' && value['_bsontype'] == 'Decimal128') {\n index = serializeDecimal128(buffer, key, value, index, true);\n } else if (value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {\n index = serializeLong(buffer, key, value, index, true);\n } else if (value['_bsontype'] == 'Double') {\n index = serializeDouble(buffer, key, value, index, true);\n } else if (typeof value == 'function' && serializeFunctions) {\n index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions, true);\n } else if (value['_bsontype'] == 'Code') {\n index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, true);\n } else if (value['_bsontype'] == 'Binary') {\n index = serializeBinary(buffer, key, value, index, true);\n } else if (value['_bsontype'] == 'Symbol') {\n index = serializeSymbol(buffer, key, value, index, true);\n } else if (value['_bsontype'] == 'DBRef') {\n index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, true);\n } else if (value['_bsontype'] == 'BSONRegExp') {\n index = serializeBSONRegExp(buffer, key, value, index, true);\n } else if (value['_bsontype'] == 'Int32') {\n index = serializeInt32(buffer, key, value, index, true);\n } else if (value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n index = serializeMinMax(buffer, key, value, index, true);\n }\n }\n } else if (object instanceof Map) {\n var iterator = object.entries();\n var done = false;\n\n while (!done) {\n // Unpack the next entry\n var entry = iterator.next();\n done = entry.done;\n // Are we done, then skip and terminate\n if (done) continue;\n\n // Get the entry values\n var key = entry.value[0];\n var value = entry.value[1];\n\n // Check the type of the value\n var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);\n\n // Check the key and throw error if it's illegal\n if (key != '$db' && key != '$ref' && key != '$id') {\n if (key.match(regexp) != null) {\n // The BSON spec doesn't allow keys with null bytes because keys are\n // null-terminated.\n throw Error(\"key \" + key + \" must not contain null bytes\");\n }\n\n if (checkKeys) {\n if ('$' == key[0]) {\n throw Error(\"key \" + key + \" must not start with '$'\");\n } else if (!!~key.indexOf('.')) {\n throw Error(\"key \" + key + \" must not contain '.'\");\n }\n }\n }\n\n if (type == 'string') {\n index = serializeString(buffer, key, value, index);\n } else if (type == 'number') {\n index = serializeNumber(buffer, key, value, index);\n } else if (type == 'boolean') {\n index = serializeBoolean(buffer, key, value, index);\n } else if (value instanceof Date || isDate(value)) {\n index = serializeDate(buffer, key, value, index);\n } else if (value === undefined && ignoreUndefined == true) {} else if (value === null || value === undefined) {\n index = serializeNull(buffer, key, value, index);\n } else if (value['_bsontype'] == 'ObjectID') {\n index = serializeObjectId(buffer, key, value, index);\n } else if (Buffer.isBuffer(value)) {\n index = serializeBuffer(buffer, key, value, index);\n } else if (value instanceof RegExp || isRegExp(value)) {\n index = serializeRegExp(buffer, key, value, index);\n } else if (type == 'object' && value['_bsontype'] == null) {\n index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, false, path);\n } else if (type == 'object' && value['_bsontype'] == 'Decimal128') {\n index = serializeDecimal128(buffer, key, value, index);\n } else if (value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {\n index = serializeLong(buffer, key, value, index);\n } else if (value['_bsontype'] == 'Double') {\n index = serializeDouble(buffer, key, value, index);\n } else if (value['_bsontype'] == 'Code') {\n index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined);\n } else if (typeof value == 'function' && serializeFunctions) {\n index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions);\n } else if (value['_bsontype'] == 'Binary') {\n index = serializeBinary(buffer, key, value, index);\n } else if (value['_bsontype'] == 'Symbol') {\n index = serializeSymbol(buffer, key, value, index);\n } else if (value['_bsontype'] == 'DBRef') {\n index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions);\n } else if (value['_bsontype'] == 'BSONRegExp') {\n index = serializeBSONRegExp(buffer, key, value, index);\n } else if (value['_bsontype'] == 'Int32') {\n index = serializeInt32(buffer, key, value, index);\n } else if (value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n index = serializeMinMax(buffer, key, value, index);\n }\n }\n } else {\n // Did we provide a custom serialization method\n if (object.toBSON) {\n if (typeof object.toBSON != 'function') throw new Error(\"toBSON is not a function\");\n object = object.toBSON();\n if (object != null && (typeof object === 'undefined' ? 'undefined' : _typeof(object)) != 'object') throw new Error(\"toBSON function did not return an object\");\n }\n\n // Iterate over all the keys\n for (var key in object) {\n var value = object[key];\n // Is there an override value\n if (value && value.toBSON) {\n if (typeof value.toBSON != 'function') throw new Error(\"toBSON is not a function\");\n value = value.toBSON();\n }\n\n // Check the type of the value\n var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);\n\n // Check the key and throw error if it's illegal\n if (key != '$db' && key != '$ref' && key != '$id') {\n if (key.match(regexp) != null) {\n // The BSON spec doesn't allow keys with null bytes because keys are\n // null-terminated.\n throw Error(\"key \" + key + \" must not contain null bytes\");\n }\n\n if (checkKeys) {\n if ('$' == key[0]) {\n throw Error(\"key \" + key + \" must not start with '$'\");\n } else if (!!~key.indexOf('.')) {\n throw Error(\"key \" + key + \" must not contain '.'\");\n }\n }\n }\n\n if (type == 'string') {\n index = serializeString(buffer, key, value, index);\n } else if (type == 'number') {\n index = serializeNumber(buffer, key, value, index);\n } else if (type == 'boolean') {\n index = serializeBoolean(buffer, key, value, index);\n } else if (value instanceof Date || isDate(value)) {\n index = serializeDate(buffer, key, value, index);\n } else if (value === undefined && ignoreUndefined == true) {} else if (value === null || value === undefined) {\n index = serializeNull(buffer, key, value, index);\n } else if (value['_bsontype'] == 'ObjectID') {\n index = serializeObjectId(buffer, key, value, index);\n } else if (Buffer.isBuffer(value)) {\n index = serializeBuffer(buffer, key, value, index);\n } else if (value instanceof RegExp || isRegExp(value)) {\n index = serializeRegExp(buffer, key, value, index);\n } else if (type == 'object' && value['_bsontype'] == null) {\n index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, false, path);\n } else if (type == 'object' && value['_bsontype'] == 'Decimal128') {\n index = serializeDecimal128(buffer, key, value, index);\n } else if (value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {\n index = serializeLong(buffer, key, value, index);\n } else if (value['_bsontype'] == 'Double') {\n index = serializeDouble(buffer, key, value, index);\n } else if (value['_bsontype'] == 'Code') {\n index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined);\n } else if (typeof value == 'function' && serializeFunctions) {\n index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions);\n } else if (value['_bsontype'] == 'Binary') {\n index = serializeBinary(buffer, key, value, index);\n } else if (value['_bsontype'] == 'Symbol') {\n index = serializeSymbol(buffer, key, value, index);\n } else if (value['_bsontype'] == 'DBRef') {\n index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions);\n } else if (value['_bsontype'] == 'BSONRegExp') {\n index = serializeBSONRegExp(buffer, key, value, index);\n } else if (value['_bsontype'] == 'Int32') {\n index = serializeInt32(buffer, key, value, index);\n } else if (value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n index = serializeMinMax(buffer, key, value, index);\n }\n }\n }\n\n // Remove the path\n path.pop();\n\n // Final padding byte for object\n buffer[index++] = 0x00;\n\n // Final size\n var size = index - startingIndex;\n // Write the size of the object\n buffer[startingIndex++] = size & 0xff;\n buffer[startingIndex++] = size >> 8 & 0xff;\n buffer[startingIndex++] = size >> 16 & 0xff;\n buffer[startingIndex++] = size >> 24 & 0xff;\n return index;\n};\n\nvar BSON = {};\n\n/**\n * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5\n *\n * @ignore\n * @api private\n */\nvar functionCache = BSON.functionCache = {};\n\n/**\n * Number BSON Type\n *\n * @classconstant BSON_DATA_NUMBER\n **/\nBSON.BSON_DATA_NUMBER = 1;\n/**\n * String BSON Type\n *\n * @classconstant BSON_DATA_STRING\n **/\nBSON.BSON_DATA_STRING = 2;\n/**\n * Object BSON Type\n *\n * @classconstant BSON_DATA_OBJECT\n **/\nBSON.BSON_DATA_OBJECT = 3;\n/**\n * Array BSON Type\n *\n * @classconstant BSON_DATA_ARRAY\n **/\nBSON.BSON_DATA_ARRAY = 4;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_BINARY\n **/\nBSON.BSON_DATA_BINARY = 5;\n/**\n * ObjectID BSON Type, deprecated\n *\n * @classconstant BSON_DATA_UNDEFINED\n **/\nBSON.BSON_DATA_UNDEFINED = 6;\n/**\n * ObjectID BSON Type\n *\n * @classconstant BSON_DATA_OID\n **/\nBSON.BSON_DATA_OID = 7;\n/**\n * Boolean BSON Type\n *\n * @classconstant BSON_DATA_BOOLEAN\n **/\nBSON.BSON_DATA_BOOLEAN = 8;\n/**\n * Date BSON Type\n *\n * @classconstant BSON_DATA_DATE\n **/\nBSON.BSON_DATA_DATE = 9;\n/**\n * null BSON Type\n *\n * @classconstant BSON_DATA_NULL\n **/\nBSON.BSON_DATA_NULL = 10;\n/**\n * RegExp BSON Type\n *\n * @classconstant BSON_DATA_REGEXP\n **/\nBSON.BSON_DATA_REGEXP = 11;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_CODE\n **/\nBSON.BSON_DATA_CODE = 13;\n/**\n * Symbol BSON Type\n *\n * @classconstant BSON_DATA_SYMBOL\n **/\nBSON.BSON_DATA_SYMBOL = 14;\n/**\n * Code with Scope BSON Type\n *\n * @classconstant BSON_DATA_CODE_W_SCOPE\n **/\nBSON.BSON_DATA_CODE_W_SCOPE = 15;\n/**\n * 32 bit Integer BSON Type\n *\n * @classconstant BSON_DATA_INT\n **/\nBSON.BSON_DATA_INT = 16;\n/**\n * Timestamp BSON Type\n *\n * @classconstant BSON_DATA_TIMESTAMP\n **/\nBSON.BSON_DATA_TIMESTAMP = 17;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_LONG\n **/\nBSON.BSON_DATA_LONG = 18;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_DECIMAL128\n **/\nBSON.BSON_DATA_DECIMAL128 = 19;\n/**\n * MinKey BSON Type\n *\n * @classconstant BSON_DATA_MIN_KEY\n **/\nBSON.BSON_DATA_MIN_KEY = 0xff;\n/**\n * MaxKey BSON Type\n *\n * @classconstant BSON_DATA_MAX_KEY\n **/\nBSON.BSON_DATA_MAX_KEY = 0x7f;\n/**\n * Binary Default Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_DEFAULT\n **/\nBSON.BSON_BINARY_SUBTYPE_DEFAULT = 0;\n/**\n * Binary Function Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_FUNCTION\n **/\nBSON.BSON_BINARY_SUBTYPE_FUNCTION = 1;\n/**\n * Binary Byte Array Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY\n **/\nBSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;\n/**\n * Binary UUID Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_UUID\n **/\nBSON.BSON_BINARY_SUBTYPE_UUID = 3;\n/**\n * Binary MD5 Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_MD5\n **/\nBSON.BSON_BINARY_SUBTYPE_MD5 = 4;\n/**\n * Binary User Defined Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED\n **/\nBSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128;\n\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\nBSON.BSON_INT64_MAX = Math.pow(2, 63) - 1;\nBSON.BSON_INT64_MIN = -Math.pow(2, 63);\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\n// Internal long versions\nvar JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double.\nvar JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double.\n\nmodule.exports = serializeInto;\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))\n\n/***/ }),\n/* 32 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Auth = exports.AuthFactory = undefined;\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* global window, document, fetch */\n\nexports.newAuth = newAuth;\n\nvar _storage = __webpack_require__(33);\n\nvar _providers = __webpack_require__(23);\n\nvar _errors = __webpack_require__(19);\n\nvar _common = __webpack_require__(4);\n\nvar authCommon = _interopRequireWildcard(_common);\n\nvar _common2 = __webpack_require__(16);\n\nvar common = _interopRequireWildcard(_common2);\n\nvar _detectBrowser = __webpack_require__(59);\n\nvar _platform = _interopRequireWildcard(_detectBrowser);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar jwtDecode = __webpack_require__(67);\n\nvar EMBEDDED_USER_AUTH_DATA_PARTS = 4;\n\nvar AuthFactory = exports.AuthFactory = function () {\n function AuthFactory() {\n _classCallCheck(this, AuthFactory);\n\n throw new _errors.StitchError('Auth can only be made from the AuthFactory.create function');\n }\n\n _createClass(AuthFactory, null, [{\n key: 'create',\n value: function create(client, rootUrl, options) {\n return newAuth(client, rootUrl, options);\n }\n }]);\n\n return AuthFactory;\n}();\n\nfunction newAuth(client, rootUrl, options) {\n var auth = Object.create(Auth.prototype);\n var namespace = void 0;\n if (!client || client.clientAppID === '') {\n namespace = 'admin';\n } else {\n namespace = 'client.' + client.clientAppID;\n }\n\n options = Object.assign({\n codec: authCommon.APP_CLIENT_CODEC,\n namespace: namespace,\n storageType: 'localStorage'\n }, options);\n\n auth.client = client;\n auth.rootUrl = rootUrl;\n auth.codec = options.codec;\n auth.platform = options.platform || _platform;\n auth.storage = (0, _storage.createStorage)(options);\n auth.providers = (0, _providers.createProviders)(auth, options);\n\n return Promise.all([auth._get(), auth.storage.get(authCommon.REFRESH_TOKEN_KEY), auth.storage.get(authCommon.USER_LOGGED_IN_PT_KEY), auth.storage.get(authCommon.DEVICE_ID_KEY)]).then(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 4),\n authObj = _ref2[0],\n rt = _ref2[1],\n loggedInProviderType = _ref2[2],\n deviceId = _ref2[3];\n\n auth.auth = authObj;\n auth.authedId = authObj.userId;\n auth.rt = rt;\n auth.loggedInProviderType = loggedInProviderType;\n auth.deviceId = deviceId;\n\n return auth;\n });\n}\n\nvar Auth = exports.Auth = function () {\n function Auth(client, rootUrl, options) {\n _classCallCheck(this, Auth);\n\n throw new _errors.StitchError('Auth can only be made from the AuthFactory.create function');\n }\n\n /**\n * Create the device info for this client.\n *\n * @memberof module:auth\n * @method getDeviceInfo\n * @param {String} appId The app ID for this client\n * @param {String} appVersion The version of the app\n * @returns {Object} The device info object\n */\n\n\n _createClass(Auth, [{\n key: 'getDeviceInfo',\n value: function getDeviceInfo(deviceId, appId) {\n var appVersion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n\n var deviceInfo = { appId: appId, appVersion: appVersion, sdkVersion: common.SDK_VERSION };\n\n if (deviceId) {\n deviceInfo.deviceId = deviceId;\n }\n\n if (this.platform) {\n deviceInfo.platform = this.platform.name;\n deviceInfo.platformVersion = this.platform.version;\n }\n\n return deviceInfo;\n }\n }, {\n key: 'provider',\n value: function provider(name) {\n if (!this.providers.hasOwnProperty(name)) {\n throw new Error('Invalid auth provider specified: ' + name);\n }\n\n return this.providers[name];\n }\n }, {\n key: 'refreshToken',\n value: function refreshToken() {\n var _this = this;\n\n return this.client.doSessionPost().then(function (json) {\n return _this.set(json);\n });\n }\n }, {\n key: 'pageRootUrl',\n value: function pageRootUrl() {\n return [window.location.protocol, '//', window.location.host, window.location.pathname].join('');\n }\n }, {\n key: 'error',\n value: function error() {\n return this._error;\n }\n }, {\n key: 'isAppClient',\n value: function isAppClient() {\n if (!this.client) {\n return true; // Handle the case where Auth is constructed with null\n }\n return this.client.type === common.APP_CLIENT_TYPE;\n }\n }, {\n key: 'handleRedirect',\n value: function handleRedirect() {\n var _this2 = this;\n\n if (typeof window === 'undefined') {\n // This means we're running in some environment other\n // than a browser - so handling a redirect makes no sense here.\n return;\n }\n if (!window.location || !window.location.hash) {\n return;\n }\n\n var redirectProvider = void 0;\n return Promise.all([this.storage.get(authCommon.STATE_KEY), this.storage.get(authCommon.STITCH_REDIRECT_PROVIDER)]).then(function (_ref3) {\n var _ref4 = _slicedToArray(_ref3, 2),\n ourState = _ref4[0],\n _redirectProvider = _ref4[1];\n\n var redirectFragment = window.location.hash.substring(1);\n redirectProvider = _redirectProvider;\n var redirectState = _this2.parseRedirectFragment(redirectFragment, ourState);\n if (redirectState.lastError || !redirectProvider) {\n console.error('StitchClient: error from redirect: ' + (redirectState.lastError ? redirectState.lastError : 'provider type not set'));\n _this2._error = redirectState.lastError;\n window.history.replaceState(null, '', _this2.pageRootUrl());\n return;\n }\n\n if (!redirectState.found) {\n return;\n }\n\n return Promise.all([_this2.storage.remove(authCommon.STATE_KEY), _this2.storage.remove(authCommon.STITCH_REDIRECT_PROVIDER)]).then(function () {\n return redirectState;\n });\n }).then(function (redirectState) {\n if (!redirectState.stateValid) {\n console.error('StitchClient: state values did not match!');\n window.history.replaceState(null, '', _this2.pageRootUrl());\n return;\n }\n\n if (!redirectState.ua) {\n console.error('StitchClient: no UA value was returned from redirect!');\n return;\n }\n\n // If we get here, the state is valid - set auth appropriately.\n return _this2.set(redirectState.ua, redirectProvider);\n }).then(function () {\n return window.history.replaceState(null, '', _this2.pageRootUrl());\n });\n }\n }, {\n key: 'getCookie',\n value: function getCookie(name) {\n var splitCookies = document.cookie.split(' ');\n for (var i = 0; i < splitCookies.length; i++) {\n var cookie = splitCookies[i];\n var sepIdx = cookie.indexOf('=');\n var cookieName = cookie.substring(0, sepIdx);\n if (cookieName === name) {\n var cookieVal = cookie.substring(sepIdx + 1, cookie.length);\n if (cookieVal[cookieVal.length - 1] === ';') {\n return cookieVal.substring(0, cookie.length - 1);\n }\n return cookieVal;\n }\n }\n }\n }, {\n key: 'handleCookie',\n value: function handleCookie() {\n var _this3 = this;\n\n if (typeof window === 'undefined' || typeof document === 'undefined') {\n // This means we're running in some environment other\n // than a browser - so handling a cookie makes no sense here.\n return;\n }\n if (!document.cookie) {\n return;\n }\n\n var uaCookie = this.getCookie(authCommon.USER_AUTH_COOKIE_NAME);\n if (!uaCookie) {\n return;\n }\n\n document.cookie = authCommon.USER_AUTH_COOKIE_NAME + '=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT;';\n var userAuth = this.unmarshallUserAuth(uaCookie);\n return this.set(userAuth, _providers.PROVIDER_TYPE_MONGODB_CLOUD).then(function () {\n return window.history.replaceState(null, '', _this3.pageRootUrl());\n });\n }\n }, {\n key: 'clear',\n value: function clear() {\n this.auth = null;\n this.authedId = null;\n this.rt = null;\n this.loggedInProviderType = null;\n\n return Promise.all([this.storage.remove(authCommon.USER_AUTH_KEY), this.storage.remove(authCommon.REFRESH_TOKEN_KEY), this.storage.remove(authCommon.USER_LOGGED_IN_PT_KEY), this.storage.remove(authCommon.STITCH_REDIRECT_PROVIDER)]);\n }\n }, {\n key: 'getDeviceId',\n value: function getDeviceId() {\n return this.deviceId;\n }\n\n // Returns whether or not the access token is expired or is going to expire within 'withinSeconds'\n // seconds, according to current system time. Returns false if the token is malformed in any way.\n\n }, {\n key: 'isAccessTokenExpired',\n value: function isAccessTokenExpired() {\n var withinSeconds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : authCommon.DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS;\n\n var token = this.getAccessToken();\n if (!token) {\n return false;\n }\n\n var decodedToken = void 0;\n try {\n decodedToken = jwtDecode(token);\n } catch (e) {\n return false;\n }\n\n if (!decodedToken) {\n return false;\n }\n\n return decodedToken.exp && Math.floor(Date.now() / 1000) >= decodedToken.exp - withinSeconds;\n }\n }, {\n key: 'getAccessToken',\n value: function getAccessToken() {\n return this.auth.accessToken;\n }\n }, {\n key: 'getRefreshToken',\n value: function getRefreshToken() {\n return this.rt;\n }\n }, {\n key: 'set',\n value: function set(json) {\n var _this4 = this;\n\n var authType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n\n if (!json) {\n return;\n }\n\n var newUserAuth = {};\n var setters = [];\n\n if (authType) {\n this.loggedInProviderType = authType;\n setters.push(this.storage.set(authCommon.USER_LOGGED_IN_PT_KEY, authType));\n }\n\n if (json[this.codec.refreshToken]) {\n this.rt = json[this.codec.refreshToken];\n delete json[this.codec.refreshToken];\n setters.push(this.storage.set(authCommon.REFRESH_TOKEN_KEY, this.rt));\n }\n\n if (json[this.codec.deviceId]) {\n this.deviceId = json[this.codec.deviceId];\n delete json[this.codec.deviceId];\n setters.push(this.storage.set(authCommon.DEVICE_ID_KEY, this.deviceId));\n }\n\n // Merge in new fields with old fields. Typically the first json value\n // is complete with every field inside a user auth, but subsequent requests\n // do not include everything. This merging behavior is safe so long as json\n // value responses with absent fields do not indicate that the field should\n // be unset.\n if (json[this.codec.accessToken]) {\n newUserAuth.accessToken = json[this.codec.accessToken];\n }\n if (json[this.codec.userId]) {\n newUserAuth.userId = json[this.codec.userId];\n }\n\n this.auth = Object.assign(this.auth ? this.auth : {}, newUserAuth);\n this.authedId = this.auth.userId;\n setters.push(this.storage.set(authCommon.USER_AUTH_KEY, JSON.stringify(this.auth)));\n return Promise.all(setters).then(function () {\n return _this4.auth;\n });\n }\n }, {\n key: '_get',\n value: function _get() {\n var _this5 = this;\n\n return this.storage.get(authCommon.USER_AUTH_KEY).then(function (data) {\n if (!data) {\n return {};\n }\n\n try {\n return JSON.parse(data);\n } catch (e) {\n // Need to back out and clear auth otherwise we will never\n // be able to do anything useful.\n return _this5.clear().then(function () {\n throw new _errors.StitchError('Failure retrieving stored auth');\n });\n }\n });\n }\n }, {\n key: 'getLoggedInProviderType',\n value: function getLoggedInProviderType() {\n return this.loggedInProviderType;\n }\n }, {\n key: 'parseRedirectFragment',\n value: function parseRedirectFragment(fragment, ourState) {\n // After being redirected from oauth, the URL will look like:\n // https://todo.examples.stitch.mongodb.com/#_stitch_state=...&_stitch_ua=...\n // This function parses out stitch-specific tokens from the fragment and\n // builds an object describing the result.\n var vars = fragment.split('&');\n var result = { ua: null, found: false, stateValid: false, lastError: null };\n var shouldBreak = false;\n for (var i = 0; i < vars.length && !shouldBreak; ++i) {\n var pairParts = vars[i].split('=');\n var pairKey = decodeURIComponent(pairParts[0]);\n switch (pairKey) {\n case authCommon.STITCH_ERROR_KEY:\n result.lastError = decodeURIComponent(pairParts[1]);\n result.found = true;\n shouldBreak = true;\n break;\n case authCommon.USER_AUTH_KEY:\n try {\n result.ua = this.unmarshallUserAuth(decodeURIComponent(pairParts[1]));\n result.found = true;\n } catch (e) {\n result.lastError = e;\n }\n continue;\n case authCommon.STITCH_LINK_KEY:\n result.found = true;\n continue;\n case authCommon.STATE_KEY:\n result.found = true;\n var theirState = decodeURIComponent(pairParts[1]);\n if (ourState && ourState === theirState) {\n result.stateValid = true;\n }\n continue;\n default:\n continue;\n }\n }\n\n return result;\n }\n }, {\n key: 'unmarshallUserAuth',\n value: function unmarshallUserAuth(data) {\n var _ref5;\n\n var parts = data.split('$');\n if (parts.length !== EMBEDDED_USER_AUTH_DATA_PARTS) {\n throw new RangeError('invalid user auth data provided: ' + data);\n }\n\n return _ref5 = {}, _defineProperty(_ref5, this.codec.accessToken, parts[0]), _defineProperty(_ref5, this.codec.refreshToken, parts[1]), _defineProperty(_ref5, this.codec.userId, parts[2]), _defineProperty(_ref5, this.codec.deviceId, parts[3]), _ref5;\n }\n }]);\n\n return Auth;\n}();\n\n/***/ }),\n/* 33 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.MemoryStorage = undefined;\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nexports.createStorage = createStorage;\n\nvar _common = __webpack_require__(4);\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar MemoryStorage = exports.MemoryStorage = function () {\n function MemoryStorage() {\n _classCallCheck(this, MemoryStorage);\n\n this._data = {};\n this._orderedKeys = [];\n this.length = 0;\n }\n\n _createClass(MemoryStorage, [{\n key: 'getItem',\n value: function getItem(key) {\n return key in this._data ? this._data[key] : null;\n }\n }, {\n key: 'setItem',\n value: function setItem(key, value) {\n this._orderedKeys.push(key);\n this._data[key] = value;\n this.length++;\n return this._data[key];\n }\n }, {\n key: 'removeItem',\n value: function removeItem(key) {\n this._orderedKeys.pop(key);\n delete this._data[key];\n this.length--;\n return undefined;\n }\n }, {\n key: 'key',\n value: function key(index) {\n return this._orderedKeys[index];\n }\n }]);\n\n return MemoryStorage;\n}();\n\nvar _VERSION = 1;\nvar _VERSION_KEY = '__stitch_storage_version__';\n\n/**\n * Run a migration on the currently used storage\n * that checks to see if the current version is up to date.\n * If the version has not been set, this method will migrate\n * to the latest version.\n * @param {Integer} version version number of storage\n * @param {Object} storage storage class being checked\n * @returns {Promise} nullable promise containing migration logic\n */\nfunction _runMigration(version, storage) {\n switch (version) {\n case null:\n case undefined:\n // return a promise,\n // mapping each of the store's keys to a Promise\n // that fetches the each value for each key,\n // sets the old value to the new \"namespaced\" key\n // remove the old key value pair,\n // and set the version number\n var migrations = [_common.USER_AUTH_KEY, _common.REFRESH_TOKEN_KEY, _common.DEVICE_ID_KEY, _common.STATE_KEY].map(function (key) {\n return Promise.resolve(storage.store.getItem(key)).then(function (item) {\n return !!item && storage.store.setItem(storage._generateKey(key), item);\n }).then(function () {\n return storage.store.removeItem(key);\n });\n });\n return Promise.all(migrations).then(function () {\n return storage.store.setItem(_VERSION_KEY, _VERSION);\n });\n // in future versions, `case 1:`, `case 2:` and so on\n // could be added to perform similar migrations\n default:\n break;\n }\n}\n\nvar Storage = function () {\n /**\n * @param {Storage} store implementer of Storage interface\n * @param {String} namespace clientAppID to be used for namespacing\n * @param\n */\n function Storage(store, namespace) {\n var _this = this;\n\n _classCallCheck(this, Storage);\n\n this.store = store;\n this.namespace = '_stitch.' + namespace;\n\n this._migration = Promise.resolve(this.store.getItem(_VERSION_KEY)).then(function (version) {\n return _runMigration(version, _this);\n });\n }\n\n _createClass(Storage, [{\n key: '_generateKey',\n value: function _generateKey(key) {\n return this.namespace + '.' + key;\n }\n }, {\n key: 'get',\n value: function get(key) {\n var _this2 = this;\n\n return Promise.resolve(this._migration).then(function () {\n return _this2.store.getItem(_this2._generateKey(key));\n });\n }\n }, {\n key: 'set',\n value: function set(key, value) {\n var _this3 = this;\n\n return Promise.resolve(this._migration).then(function () {\n return _this3.store.setItem(_this3._generateKey(key), value);\n }).then(function () {\n return value;\n });\n }\n }, {\n key: 'remove',\n value: function remove(key) {\n var _this4 = this;\n\n return Promise.resolve(this._migration).then(function () {\n return _this4.store.removeItem(_this4._generateKey(key));\n });\n }\n }]);\n\n return Storage;\n}();\n\nfunction createStorage(options) {\n var storageType = options.storageType,\n storage = options.storage,\n namespace = options.namespace;\n\n\n if (storageType === 'localStorage') {\n if (typeof window !== 'undefined' && 'localStorage' in window && window.localStorage !== null) {\n return new Storage(window.localStorage, namespace);\n }\n } else if (storageType === 'sessionStorage') {\n if (typeof window !== 'undefined' && 'sessionStorage' in window && window.sessionStorage !== null) {\n return new Storage(window.sessionStorage, namespace);\n }\n } else if (storageType == 'customStorage') {\n //eslint-disable-line eqeqeq\n return new Storage(storage, namespace);\n }\n\n // default to memory storage\n return new Storage(new MemoryStorage(), namespace);\n}\n\n/***/ }),\n/* 34 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.BSON = exports.StitchAdminClientFactory = exports.StitchClientFactory = undefined;\n\nvar _client = __webpack_require__(20);\n\nvar _admin = __webpack_require__(26);\n\nvar _mongodbExtjson = __webpack_require__(21);\n\nexports.StitchClientFactory = _client.StitchClientFactory;\nexports.StitchAdminClientFactory = _admin.StitchAdminClientFactory;\nexports.BSON = _mongodbExtjson.BSON;\n\n/***/ }),\n/* 35 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _util = __webpack_require__(2);\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Convenience wrapper around AWS S3 service (not meant to be instantiated directly).\n *\n * @class\n * @return {S3Service} a S3Service instance.\n */\nvar S3Service = function () {\n function S3Service(stitchClient, serviceName) {\n _classCallCheck(this, S3Service);\n\n this.client = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Put an object to S3 via Stitch. For small uploads\n *\n * NOTE: body must be a pipeline stream\n *\n * @param {String} bucket which S3 bucket to use\n * @param {String} key which key (filename) to use\n * @param {String} acl which policy to apply\n * @param {String} contentType content type of uploaded data\n * @return {Promise}\n */\n\n\n _createClass(S3Service, [{\n key: 'put',\n value: function put(bucket, key, acl, contentType) {\n return (0, _util.serviceResponse)(this, {\n action: 'put',\n args: { bucket: bucket, key: key, acl: acl, contentType: contentType }\n });\n }\n\n /**\n * Sign a policy for putting via Stitch. For large uploads\n *\n * @param {String} bucket which S3 bucket to use\n * @param {String} key which key (filename) to use\n * @param {String} acl which policy to apply\n * @param {String} contentType content type of uploaded data\n * @return {Promise}\n */\n\n }, {\n key: 'signPolicy',\n value: function signPolicy(bucket, key, acl, contentType) {\n return (0, _util.serviceResponse)(this, {\n action: 'signPolicy',\n args: { bucket: bucket, key: key, acl: acl, contentType: contentType }\n });\n }\n }]);\n\n return S3Service;\n}();\n\nexports.default = S3Service;\nmodule.exports = exports['default'];\n\n/***/ }),\n/* 36 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _util = __webpack_require__(2);\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Convenience wrapper around AWS SES service (not meant to be instantiated directly).\n *\n * @class\n * @return {SESService} a SESService instance.\n */\nvar SESService = function () {\n function SESService(stitchClient, serviceName) {\n _classCallCheck(this, SESService);\n\n this.client = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Send an email\n *\n * @method\n * @param {String} from the email to send from\n * @param {String} to the email to send to\n * @param {String} subject the subject of the email\n * @param {String} body the body of the email\n * @return {Promise}\n */\n\n\n _createClass(SESService, [{\n key: 'send',\n value: function send(from, to, subject, body) {\n return (0, _util.serviceResponse)(this, {\n action: 'send',\n args: { from: from, to: to, subject: subject, body: body }\n });\n }\n }]);\n\n return SESService;\n}();\n\nexports.default = SESService;\nmodule.exports = exports['default'];\n\n/***/ }),\n/* 37 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _util = __webpack_require__(2);\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Convenience wrapper for HTTP service (not meant to be instantiated directly).\n *\n * @class\n * @return {HTTPService} a HTTPService instance.\n */\nvar HTTPService = function () {\n function HTTPService(client, serviceName) {\n _classCallCheck(this, HTTPService);\n\n this.client = client;\n this.serviceName = serviceName;\n }\n\n /**\n * Send a GET request to a resource (result must be application/json)\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of GET args\n * @param {Object} [options] optional settings for the GET operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n\n\n _createClass(HTTPService, [{\n key: 'get',\n value: function get(urlOrOptions) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n return buildResponse('get', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a POST request to a resource with payload\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of POST args\n * @param {Object} [options] optional settings for the POST operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n\n }, {\n key: 'post',\n value: function post(urlOrOptions) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n return buildResponse('post', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a PUT request to a resource with payload\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of PUT args\n * @param {Object} [options] optional settings for the PUT operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n\n }, {\n key: 'put',\n value: function put(urlOrOptions) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n return buildResponse('put', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a PATCH request to a resource with payload\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of PATCH args\n * @param {Object} [options] optional settings for the PATCH operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n\n }, {\n key: 'patch',\n value: function patch(urlOrOptions) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n return buildResponse('patch', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a DELETE request to a resource\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of DELETE args\n * @param {Object} [options] optional settings for the DELETE operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n\n }, {\n key: 'delete',\n value: function _delete(urlOrOptions) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n return buildResponse('delete', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a HEAD request to a resource\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of HEAD args\n * @param {Object} [options] optional settings for the HEAD operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n\n }, {\n key: 'head',\n value: function head(urlOrOptions) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n return buildResponse('head', this, buildArgs(urlOrOptions, options));\n }\n }]);\n\n return HTTPService;\n}();\n\nfunction buildArgs(urlOrOptions, options) {\n var args = void 0;\n if (typeof urlOrOptions !== 'string') {\n args = urlOrOptions;\n } else {\n args = { url: urlOrOptions };\n if (!!options.authUrl) args.authUrl = options.authUrl;\n }\n\n return args;\n}\n\nfunction buildResponse(action, service, args) {\n return (0, _util.serviceResponse)(service, {\n action: action,\n args: args\n });\n}\n\nexports.default = HTTPService;\nmodule.exports = exports['default'];\n\n/***/ }),\n/* 38 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _s3_service = __webpack_require__(35);\n\nvar _s3_service2 = _interopRequireDefault(_s3_service);\n\nvar _ses_service = __webpack_require__(36);\n\nvar _ses_service2 = _interopRequireDefault(_ses_service);\n\nvar _http_service = __webpack_require__(37);\n\nvar _http_service2 = _interopRequireDefault(_http_service);\n\nvar _mongodb_service = __webpack_require__(41);\n\nvar _mongodb_service2 = _interopRequireDefault(_mongodb_service);\n\nvar _twilio_service = __webpack_require__(42);\n\nvar _twilio_service2 = _interopRequireDefault(_twilio_service);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = {\n 'aws/s3': _s3_service2.default,\n 'aws/ses': _ses_service2.default,\n 'http': _http_service2.default,\n 'mongodb': _mongodb_service2.default,\n 'twilio': _twilio_service2.default\n};\nmodule.exports = exports['default'];\n\n/***/ }),\n/* 39 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _util = __webpack_require__(2);\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Create a new Collection instance (not meant to be instantiated directly).\n *\n * @class\n * @return {Collection} a Collection instance.\n */\nvar Collection = function () {\n function Collection(db, name) {\n _classCallCheck(this, Collection);\n\n this.db = db;\n this.name = name;\n }\n\n /**\n * Inserts a single document.\n *\n * @method\n * @param {Object} doc The document to insert.\n * @return {Promise} a Promise for the operation.\n */\n\n\n _createClass(Collection, [{\n key: 'insertOne',\n value: function insertOne(doc) {\n var args = { document: doc };\n return buildResponse('insertOne', this, buildArgs(this, args));\n }\n\n /**\n * Inserts multiple documents.\n *\n * @method\n * @param {Array} docs The documents to insert.\n * @return {Promise} Returns a Promise for the operation.\n */\n\n }, {\n key: 'insertMany',\n value: function insertMany(docs) {\n var args = { documents: Array.isArray(docs) ? docs : [docs] };\n return buildResponse('insertMany', this, buildArgs(this, args));\n }\n\n /**\n * Deletes a single document.\n *\n * @method\n * @param {Object} query The query used to match a single document.\n * @return {Promise} Returns a Promise for the operation.\n */\n\n }, {\n key: 'deleteOne',\n value: function deleteOne(query) {\n return buildResponse('deleteOne', this, buildArgs(this, { query: query }));\n }\n\n /**\n * Deletes all documents matching query.\n *\n * @method\n * @param {Object} query The query used to match the documents to delete.\n * @return {Promise} Returns a Promise for the operation.\n */\n\n }, {\n key: 'deleteMany',\n value: function deleteMany(query) {\n return buildResponse('deleteMany', this, buildArgs(this, { query: query }));\n }\n\n /**\n * Updates a single document.\n *\n * @method\n * @param {Object} query The query used to match a single document.\n * @param {Object} update The update operations to perform on the matching document.\n * @param {Object} [options] Additional options object.\n * @param {Boolean} [options.upsert=false] Perform an upsert operation.\n * @return {Promise} A Promise for the operation.\n */\n\n }, {\n key: 'updateOne',\n value: function updateOne(query, update) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n return updateOp(this, false, query, update, options);\n }\n\n /**\n * Updates multiple documents.\n *\n * @method\n * @param {Object} query The query used to match the documents.\n * @param {Object} update The update operations to perform on the matching documents.\n * @param {Object} [options] Additional options object.\n * @param {Boolean} [options.upsert=false] Perform an upsert operation.\n * @return {Promise} Returns a Promise for the operation.\n */\n\n }, {\n key: 'updateMany',\n value: function updateMany(query, update) {\n return updateOp(this, true, query, update);\n }\n\n /**\n * Finds documents.\n *\n * @method\n * @param {Object} query The query used to match documents.\n * @param {Object} [project] The query document projection.\n * @return {MongoQuery} An object which allows for `limit` and `sort` parameters to be set.\n * `execute` will return a {Promise} for the operation.\n */\n\n }, {\n key: 'find',\n value: function find(query, project) {\n return new MongoQuery(this, query, project);\n }\n\n /**\n * Finds one document.\n *\n * @method\n * @param {Object} query The query used to match documents.\n * @param {Object} [project] The query document projection.\n * @return {Promise} Returns a Promise for the operation\n */\n\n }, {\n key: 'findOne',\n value: function findOne(query, project) {\n return buildResponse('findOne', this, buildArgs(this, { query: query, project: project }));\n }\n\n /**\n * Executes an aggregation pipeline.\n *\n * @param {Array} pipeline The aggregation pipeline.\n * @returns {Array} The results of the aggregation.\n */\n\n }, {\n key: 'aggregate',\n value: function aggregate(pipeline) {\n return aggregateOp(this, pipeline);\n }\n\n /**\n * Gets the number of documents matching the filter.\n *\n * @param {Object} query The query used to match documents.\n * @param {Object} options Additional count options.\n * @param {Number} [options.limit=null] The maximum number of documents to return.\n * @return {Number} The results of the count operation.\n */\n\n }, {\n key: 'count',\n value: function count(query) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var outgoingOptions = void 0;\n if (options.limit) {\n outgoingOptions = { limit: options.limit };\n }\n\n return buildResponse('count', this, buildArgs(this, { count: true, query: query }, outgoingOptions));\n }\n }]);\n\n return Collection;\n}();\n\n// private\n\nfunction updateOp(service, isMulti, query, update) {\n var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};\n\n var action = isMulti ? 'updateMany' : 'updateOne';\n\n var outgoingOptions = void 0;\n if (!isMulti && options.upsert) {\n outgoingOptions = { upsert: true };\n }\n\n return buildResponse(action, service, buildArgs(service, { query: query, update: update }, outgoingOptions));\n}\n\nfunction findOp(_ref) {\n var service = _ref.service,\n query = _ref.query,\n project = _ref.project,\n limit = _ref.limit,\n sort = _ref.sort;\n\n return buildResponse('find', service, buildArgs(service, { query: query, project: project, limit: limit, sort: sort }));\n}\n\nfunction aggregateOp(service, pipeline) {\n return buildResponse('aggregate', service, buildArgs(service, { pipeline: pipeline }));\n}\n\nfunction buildArgs(_ref2, args) {\n var database = _ref2.db.name,\n collection = _ref2.name;\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n return Object.assign({ database: database, collection: collection }, args, options);\n}\n\nfunction buildResponse(action, service, args) {\n return (0, _util.serviceResponse)(service.db, {\n serviceName: service.db.service,\n action: action,\n args: args\n });\n}\n\n// mongo query (find) support\n\nfunction MongoQuery(service, query, project) {\n if (this instanceof MongoQuery) {\n this.service = service;\n this.query = query;\n this.project = project;\n return this;\n }\n return new MongoQuery(service, query, project);\n}\n\nMongoQuery.prototype.limit = function (limit) {\n this.limit = limit;\n return this;\n};\n\nMongoQuery.prototype.sort = function (sort) {\n this.sort = sort;\n return this;\n};\n\nMongoQuery.prototype.execute = function (resolve) {\n return findOp(this);\n};\n\nexports.default = Collection;\nmodule.exports = exports['default'];\n\n/***/ }),\n/* 40 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _collection = __webpack_require__(39);\n\nvar _collection2 = _interopRequireDefault(_collection);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Create a new DB instance (not meant to be instantiated directly).\n * @class\n * @return {DB} a DB instance.\n */\nvar DB = function () {\n function DB(client, service, name) {\n _classCallCheck(this, DB);\n\n this.client = client;\n this.service = service;\n this.name = name;\n }\n\n /**\n * Returns a Collection instance representing a MongoDB Collection object.\n *\n * @method\n * @param {String} name The collection name.\n * @param {Object} [options] Additional options.\n * @return {Collection} returns a Collection instance representing a MongoDb collection.\n */\n\n\n _createClass(DB, [{\n key: 'collection',\n value: function collection(name) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n return new _collection2.default(this, name, options);\n }\n }]);\n\n return DB;\n}();\n\nexports.default = DB;\nmodule.exports = exports['default'];\n\n/***/ }),\n/* 41 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _db = __webpack_require__(40);\n\nvar _db2 = _interopRequireDefault(_db);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Create a new MongoDBService instance (not meant to be instantiated directly).\n *\n * @class\n * @return {MongoDBService} a MongoDBService instance.\n */\nvar MongoDBService = function () {\n function MongoDBService(stitchClient, serviceName) {\n _classCallCheck(this, MongoDBService);\n\n this.stitchClient = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Get a DB instance\n *\n * @method\n * @param {String} databaseName The MongoDB database name\n * @param {Object} [options] Additional options.\n * @return {DB} returns a DB instance representing a MongoDB database.\n */\n\n\n _createClass(MongoDBService, [{\n key: 'db',\n value: function db(databaseName) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n return new _db2.default(this.stitchClient, this.serviceName, databaseName);\n }\n }]);\n\n return MongoDBService;\n}();\n\nexports.default = MongoDBService;\nmodule.exports = exports['default'];\n\n/***/ }),\n/* 42 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _util = __webpack_require__(2);\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Create a new TwilioService instance (not meant to be instantiated directly).\n *\n * @class\n * @return {TwilioService} a TwilioService instance.\n */\nvar TwilioService = function () {\n function TwilioService(stitchClient, serviceName) {\n _classCallCheck(this, TwilioService);\n\n this.client = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Send a text message to a number\n *\n * @method\n * @param {String} from number to send from\n * @param {String} to number to send to\n * @param {String} body SMS body content\n * @return {Promise}\n */\n\n\n _createClass(TwilioService, [{\n key: 'send',\n value: function send(from, to, body) {\n return (0, _util.serviceResponse)(this, {\n action: 'send',\n args: { from: from, to: to, body: body }\n });\n }\n }]);\n\n return TwilioService;\n}();\n\nexports.default = TwilioService;\nmodule.exports = exports['default'];\n\n/***/ }),\n/* 43 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Buffer) {\n\n/**\n * Module dependencies.\n * @ignore\n */\n\nfunction convert(integer) {\n var str = Number(integer).toString(16);\n return str.length === 1 ? '0' + str : str;\n}\n\nfunction toExtendedJSON(obj) {\n var base64String = obj.buffer.toString('base64');\n\n return {\n $binary: {\n base64: base64String,\n subType: convert(obj.sub_type)\n }\n };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n var type = doc.$binary.subType ? parseInt(doc.$binary.subType, 16) : 0;\n\n var data = new Buffer(doc.$binary.base64, 'base64');\n\n return new BSON.Binary(data, type);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))\n\n/***/ }),\n/* 44 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON(obj) {\n if (obj.scope) {\n return { $code: obj.code, $scope: obj.scope };\n }\n\n return { $code: obj.code };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Code(doc.$code, doc.$scope);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 45 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON(obj) {\n var o = {\n $ref: obj.collection,\n $id: obj.oid\n };\n if (obj.db) o.$db = obj.db;\n o = Object.assign(o, obj.fields);\n return o;\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n var copy = Object.assign({}, doc);\n ['$ref', '$id', '$db'].forEach(function (k) {\n return delete copy[k];\n });\n return new BSON.DBRef(doc.$ref, doc.$id, doc.$db, copy);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 46 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON(obj) {\n return { $numberDecimal: obj.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Decimal128.fromString(doc.$numberDecimal);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 47 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON(obj, options) {\n if (options.relaxed && isFinite(obj.value)) return obj.value;\n return { $numberDouble: obj.value.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Double(parseFloat(doc.$numberDouble));\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 48 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Binary = __webpack_require__(43);\nvar Code = __webpack_require__(44);\nvar DBRef = __webpack_require__(45);\nvar Decimal128 = __webpack_require__(46);\nvar Double = __webpack_require__(47);\nvar Int32 = __webpack_require__(49);\nvar Long = __webpack_require__(50);\nvar MaxKey = __webpack_require__(51);\nvar MinKey = __webpack_require__(52);\nvar ObjectID = __webpack_require__(53);\nvar BSONRegExp = __webpack_require__(54);\nvar _Symbol = __webpack_require__(55);\nvar Timestamp = __webpack_require__(56);\n\nmodule.exports = {\n Binary: Binary,\n Code: Code,\n DBRef: DBRef,\n Decimal128: Decimal128,\n Double: Double,\n Int32: Int32,\n Long: Long,\n MaxKey: MaxKey,\n MinKey: MinKey,\n ObjectID: ObjectID,\n BSONRegExp: BSONRegExp,\n Symbol: _Symbol,\n Timestamp: Timestamp\n};\n\n/***/ }),\n/* 49 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON(obj, options) {\n if (options && options.relaxed) return obj.value;\n return { $numberInt: obj.value.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Int32(doc.$numberInt);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 50 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON(obj, options) {\n if (options && options.relaxed) return obj.toNumber();\n return { $numberLong: obj.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return BSON.Long.fromString(doc.$numberLong);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 51 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON() {\n return { $maxKey: 1 };\n}\n\nfunction fromExtendedJSON(BSON) {\n return new BSON.MaxKey();\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 52 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON() {\n return { $minKey: 1 };\n}\n\nfunction fromExtendedJSON(BSON) {\n return new BSON.MinKey();\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 53 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON(obj) {\n if (obj.toHexString) return { $oid: obj.toHexString() };\n return { $oid: obj.toString('hex') };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.ObjectID(doc.$oid);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 54 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON(obj) {\n return { $regularExpression: { pattern: obj.pattern, options: obj.options } };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.BSONRegExp(doc.$regularExpression.pattern, doc.$regularExpression.options.split('').sort().join(''));\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 55 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON(obj) {\n return { $symbol: obj.value };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Symbol(doc.$symbol);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 56 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nfunction toExtendedJSON(obj) {\n return {\n $timestamp: {\n t: obj.high_,\n i: obj.low_\n }\n };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Timestamp(doc.$timestamp.i, doc.$timestamp.t);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n/***/ }),\n/* 57 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar codecs = __webpack_require__(48),\n BSON = __webpack_require__(28);\n\nvar BSONTypes = ['Binary', 'Code', 'DBRef', 'Decimal128', 'Double', 'Int32', 'Long', 'MaxKey', 'MinKey', 'ObjectID', 'BSONRegExp', 'Symbol', 'Timestamp'];\n\nsetBSONModule(BSON);\n\n// all the types where we don't need to do any special processing and can just pass the EJSON\n//straight to type.fromExtendedJSON\nvar keysToCodecs = {\n $oid: codecs.ObjectID,\n $binary: codecs.Binary,\n $symbol: codecs.Symbol,\n $numberDecimal: codecs.Decimal128,\n $numberLong: codecs.Long,\n $minKey: codecs.MinKey,\n $maxKey: codecs.MaxKey,\n $regularExpression: codecs.BSONRegExp,\n $timestamp: codecs.Timestamp\n};\n\nfunction setBSONModule(module) {\n BSONTypes.forEach(function (t) {\n if (!module[t]) throw new Error('passed in module does not contain all BSON types required');\n });\n BSON = module;\n}\n\nfunction deserializeValue(self, key, value, options) {\n if (typeof value === 'number') {\n // if it's an integer, should interpret as smallest BSON integer\n // that can represent it exactly. (if out of range, interpret as double.)\n if (Math.floor(value) === value) {\n var int32Range = value >= BSON_INT32_MIN && value <= BSON_INT32_MAX,\n int64Range = value >= BSON_INT64_MIN && value <= BSON_INT64_MAX;\n\n if (int32Range) return options.strict ? new BSON.Int32(value) : value;\n if (int64Range) return options.strict ? new BSON.Long.fromNumber(value) : value;\n }\n // If the number is a non-integer or out of integer range, should interpret as BSON Double.\n return new BSON.Double(value);\n }\n\n // from here on out we're looking for bson types, so bail if its not an object\n if (value == null || (typeof value === 'undefined' ? 'undefined' : _typeof(value)) !== 'object') return value;\n\n // upgrade deprecated undefined to null\n if (value.$undefined) return null;\n\n var keys = Object.keys(value).filter(function (k) {\n return k.startsWith('$') && value[k] != null;\n });\n for (var i = 0; i < keys.length; i++) {\n var c = keysToCodecs[keys[i]];\n if (c) return c.fromExtendedJSON(BSON, value);\n }\n\n if (value.$date != null) {\n var d = value.$date,\n date = new Date();\n\n if (typeof d === 'string') date.setTime(Date.parse(d));else if (d instanceof BSON.Long) date.setTime(d.toNumber());\n return date;\n }\n\n if (value.$code != null) {\n if (value.$scope) var scope = deserializeValue(self, null, value.$scope);\n var copy = Object.assign({}, value);\n copy.$scope = scope;\n return codecs.Code.fromExtendedJSON(BSON, value);\n }\n\n if (value.$numberDouble != null) {\n return options.strict ? codecs.Double.fromExtendedJSON(BSON, value) : parseFloat(value.$numberDouble);\n }\n\n if (value.$numberInt != null) {\n return options.strict ? codecs.Int32.fromExtendedJSON(BSON, value) : parseInt(value.$numberInt, 10);\n }\n\n if (value.$ref != null || value.$dbPointer != null) {\n var v = value.$ref ? value : value.$dbPointer;\n\n // we run into this in a \"degenerate EJSON\" case (with $id and $ref order flipped)\n // because of the order JSON.parse goes through the document\n if (v instanceof BSON.DBRef) return v;\n\n var dollarKeys = Object.keys(v).filter(function (k) {\n return k.startsWith('$');\n }),\n valid = true;\n dollarKeys.forEach(function (k) {\n if (['$ref', '$id', '$db'].indexOf(k) === -1) valid = false;\n });\n\n // only make DBRef if $ keys are all valid\n if (valid) return codecs.DBRef.fromExtendedJSON(BSON, v);\n }\n\n return value;\n}\n\nvar parse = function parse(text, options) {\n var self = this;\n options = options || { strict: true };\n\n return JSON.parse(text, function (key, value) {\n return deserializeValue(self, key, value, options);\n });\n};\n\n//\n// Serializer\n//\n\n// MAX INT32 boundaries\nvar BSON_INT32_MAX = 0x7fffffff,\n BSON_INT32_MIN = -0x80000000,\n BSON_INT64_MAX = 0x7fffffffffffffff,\n BSON_INT64_MIN = -0x8000000000000000;\n\nvar stringify = function stringify(value, reducer, indents, options) {\n var opts = {};\n if (options != null && (typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object') opts = options;else if (indents != null && (typeof indents === 'undefined' ? 'undefined' : _typeof(indents)) === 'object') {\n opts = indents;\n indents = 0;\n } else if (reducer != null && (typeof reducer === 'undefined' ? 'undefined' : _typeof(reducer)) === 'object') {\n opts = reducer;\n reducer = null;\n }\n\n var doc = Array.isArray(value) ? serializeArray(value, opts) : serializeDocument(value, opts);\n return JSON.stringify(doc, reducer, indents);\n};\n\nfunction serializeArray(array, options) {\n return array.map(function (v) {\n return serializeValue(v, options);\n });\n}\n\nfunction getISOString(date) {\n var isoStr = date.toISOString();\n // we should only show milliseconds in timestamp if they're non-zero\n return date.getUTCMilliseconds() !== 0 ? isoStr : isoStr.slice(0, -5) + 'Z';\n}\n\nfunction serializeValue(value, options) {\n if (Array.isArray(value)) return serializeArray(value, options);\n\n if (value === undefined) return null;\n\n if (value instanceof Date) {\n var dateNum = value.getTime(),\n\n // is it in year range 1970-9999?\n inRange = dateNum > -1 && dateNum < 253402318800000;\n\n return options.relaxed && inRange ? { $date: getISOString(value) } : { $date: { $numberLong: value.getTime().toString() } };\n }\n\n if (typeof value === 'number' && !options.relaxed) {\n // it's an integer\n if (Math.floor(value) === value) {\n var int32Range = value >= BSON_INT32_MIN && value <= BSON_INT32_MAX,\n int64Range = value >= BSON_INT64_MIN && value <= BSON_INT64_MAX;\n\n // interpret as being of the smallest BSON integer type that can represent the number exactly\n if (int32Range) return { $numberInt: value.toString() };\n if (int64Range) return { $numberLong: value.toString() };\n }\n return { $numberDouble: value.toString() };\n }\n\n if (value != null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') return serializeDocument(value, options);\n return value;\n}\n\nfunction serializeDocument(doc, options) {\n if (doc == null || (typeof doc === 'undefined' ? 'undefined' : _typeof(doc)) !== 'object') throw new Error('not an object instance');\n\n // the document itself is a BSON type\n if (doc._bsontype && BSONTypes.indexOf(doc._bsontype) !== -1) {\n // we need to separately serialize the embedded scope document\n if (doc._bsontype === 'Code' && doc.scope) {\n var tempScope = serializeDocument(doc.scope, options),\n tempDoc = Object.assign({}, doc, { scope: tempScope });\n return codecs['Code'].toExtendedJSON(tempDoc, options);\n // we need to separately serialize the embedded OID document\n } else if (doc._bsontype === 'DBRef' && doc.oid) {\n var tempId = serializeDocument(doc.oid, options),\n _tempDoc = Object.assign({}, doc, { oid: tempId });\n return codecs['DBRef'].toExtendedJSON(_tempDoc, options);\n }\n return codecs[doc._bsontype].toExtendedJSON(doc, options);\n }\n\n // the document is an object with nested BSON types\n var _doc = {};\n for (var name in doc) {\n var val = doc[name];\n if (Array.isArray(val)) {\n _doc[name] = serializeArray(val, options);\n } else if (val != null && val._bsontype && BSONTypes.indexOf(val._bsontype) !== -1) {\n // we need to separately serialize the embedded scope document\n if (val._bsontype === 'Code' && val.scope) {\n var _tempScope = serializeDocument(val.scope, options),\n tempVal = Object.assign({}, val, { scope: _tempScope });\n _doc[name] = codecs['Code'].toExtendedJSON(tempVal, options);\n // we need to separately serialize the embedded OID document\n } else if (val._bsontype === 'DBRef' && val.oid) {\n var _tempId = serializeDocument(val.oid, options),\n _tempVal = Object.assign({}, val, { oid: _tempId });\n _doc[name] = codecs['DBRef'].toExtendedJSON(_tempVal, options);\n } else _doc[name] = codecs[val._bsontype].toExtendedJSON(val, options);\n } else if (val instanceof Date) {\n _doc[name] = serializeValue(val, options);\n } else if (val != null && (typeof val === 'undefined' ? 'undefined' : _typeof(val)) === 'object') {\n _doc[name] = serializeDocument(val, options);\n }\n\n _doc[name] = serializeValue(val, options);\n }\n\n return _doc;\n}\n\nmodule.exports = {\n parse: parse,\n stringify: stringify,\n setBSONModule: setBSONModule,\n BSON: BSON\n};\n\n/***/ }),\n/* 58 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\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, 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; i < l; i += 4) {\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/* 59 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar detectBrowser = __webpack_require__(60);\n\nvar agent;\n\nif (typeof navigator !== 'undefined' && navigator) {\n agent = navigator.userAgent;\n}\n\nmodule.exports = detectBrowser(agent);\n\n\n/***/ }),\n/* 60 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar detectOS = __webpack_require__(61);\n\nmodule.exports = function detectBrowser(userAgentString) {\n if (!userAgentString) return null;\n\n var browsers = [\n [ 'edge', /Edge\\/([0-9\\._]+)/ ],\n [ 'yandexbrowser', /YaBrowser\\/([0-9\\._]+)/ ],\n [ 'vivaldi', /Vivaldi\\/([0-9\\.]+)/ ],\n [ 'kakaotalk', /KAKAOTALK\\s([0-9\\.]+)/ ],\n [ 'chrome', /(?!Chrom.*OPR)Chrom(?:e|ium)\\/([0-9\\.]+)(:?\\s|$)/ ],\n [ 'phantomjs', /PhantomJS\\/([0-9\\.]+)(:?\\s|$)/ ],\n [ 'crios', /CriOS\\/([0-9\\.]+)(:?\\s|$)/ ],\n [ 'firefox', /Firefox\\/([0-9\\.]+)(?:\\s|$)/ ],\n [ 'fxios', /FxiOS\\/([0-9\\.]+)/ ],\n [ 'opera', /Opera\\/([0-9\\.]+)(?:\\s|$)/ ],\n [ 'opera', /OPR\\/([0-9\\.]+)(:?\\s|$)$/ ],\n [ 'ie', /Trident\\/7\\.0.*rv\\:([0-9\\.]+).*\\).*Gecko$/ ],\n [ 'ie', /MSIE\\s([0-9\\.]+);.*Trident\\/[4-7].0/ ],\n [ 'ie', /MSIE\\s(7\\.0)/ ],\n [ 'bb10', /BB10;\\sTouch.*Version\\/([0-9\\.]+)/ ],\n [ 'android', /Android\\s([0-9\\.]+)/ ],\n [ 'ios', /Version\\/([0-9\\._]+).*Mobile.*Safari.*/ ],\n [ 'safari', /Version\\/([0-9\\._]+).*Safari/ ]\n ];\n\n return browsers.map(function (rule) {\n if (rule[1].test(userAgentString)) {\n var match = rule[1].exec(userAgentString);\n var version = match && match[1].split(/[._]/).slice(0,3);\n\n if (version && version.length < 3) {\n Array.prototype.push.apply(version, (version.length == 1) ? [0, 0] : [0]);\n }\n\n return {\n name: rule[0],\n version: version.join('.'),\n os: detectOS(userAgentString)\n };\n }\n }).filter(Boolean).shift();\n};\n\n\n/***/ }),\n/* 61 */\n/***/ (function(module, exports) {\n\nmodule.exports = function detectOS(userAgentString) {\n var operatingSystems = [\n {\n name: 'iOS',\n rule: /iP(hone|od|ad)/\n },\n {\n name: 'Android OS',\n rule: /Android/\n },\n {\n name: 'BlackBerry OS',\n rule: /BlackBerry|BB10/\n },\n {\n name: 'Windows Mobile',\n rule: /IEMobile/\n },\n {\n name: 'Amazon OS',\n rule: /Kindle/\n },\n {\n name: 'Windows 3.11',\n rule: /Win16/\n },\n {\n name: 'Windows 95',\n rule: /(Windows 95)|(Win95)|(Windows_95)/\n },\n {\n name: 'Windows 98',\n rule: /(Windows 98)|(Win98)/\n },\n {\n name: 'Windows 2000',\n rule: /(Windows NT 5.0)|(Windows 2000)/\n },\n {\n name: 'Windows XP',\n rule: /(Windows NT 5.1)|(Windows XP)/\n },\n {\n name: 'Windows Server 2003',\n rule: /(Windows NT 5.2)/\n },\n {\n name: 'Windows Vista',\n rule: /(Windows NT 6.0)/\n },\n {\n name: 'Windows 7',\n rule: /(Windows NT 6.1)/\n },\n {\n name: 'Windows 8',\n rule: /(Windows NT 6.2)/\n },\n {\n name: 'Windows 8.1',\n rule: /(Windows NT 6.3)/\n },\n {\n name: 'Windows 10',\n rule: /(Windows NT 10.0)/\n },\n {\n name: 'Windows ME',\n rule: /Windows ME/\n },\n {\n name: 'Open BSD',\n rule: /OpenBSD/\n },\n {\n name: 'Sun OS',\n rule: /SunOS/\n },\n {\n name: 'Linux',\n rule: /(Linux)|(X11)/\n },\n {\n name: 'Mac OS',\n rule: /(Mac_PowerPC)|(Macintosh)/\n },\n {\n name: 'QNX',\n rule: /QNX/\n },\n {\n name: 'BeOS',\n rule: /BeOS/\n },\n {\n name: 'OS/2',\n rule: /OS\\/2/\n },\n {\n name: 'Search Bot',\n rule: /(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves\\/Teoma)|(ia_archiver)/\n }\n ];\n\n var detected = operatingSystems.filter(function (os) {\n if (userAgentString.match(os.rule)) {\n return true;\n }\n });\n\n return detected && detected[0] ? detected[0].name : null;\n};\n\n\n/***/ }),\n/* 62 */\n/***/ (function(module, exports) {\n\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n\n\n/***/ }),\n/* 63 */\n/***/ (function(module, exports) {\n\nif (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n\n\n/***/ }),\n/* 64 */\n/***/ (function(module, exports) {\n\nvar toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n\n\n/***/ }),\n/* 65 */\n/***/ (function(module, exports) {\n\n/**\n * The code was extracted from:\n * https://github.com/davidchambers/Base64.js\n */\n\nvar chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\nfunction InvalidCharacterError(message) {\n this.message = message;\n}\n\nInvalidCharacterError.prototype = new Error();\nInvalidCharacterError.prototype.name = 'InvalidCharacterError';\n\nfunction polyfill (input) {\n var str = String(input).replace(/=+$/, '');\n if (str.length % 4 == 1) {\n throw new InvalidCharacterError(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = '';\n // get next character\n buffer = str.charAt(idx++);\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n return output;\n}\n\n\nmodule.exports = typeof window !== 'undefined' && window.atob && window.atob.bind(window) || polyfill;\n\n\n/***/ }),\n/* 66 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar atob = __webpack_require__(65);\n\nfunction b64DecodeUnicode(str) {\n return decodeURIComponent(atob(str).replace(/(.)/g, function (m, p) {\n var code = p.charCodeAt(0).toString(16).toUpperCase();\n if (code.length < 2) {\n code = '0' + code;\n }\n return '%' + code;\n }));\n}\n\nmodule.exports = function(str) {\n var output = str.replace(/-/g, \"+\").replace(/_/g, \"/\");\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += \"==\";\n break;\n case 3:\n output += \"=\";\n break;\n default:\n throw \"Illegal base64url string!\";\n }\n\n try{\n return b64DecodeUnicode(output);\n } catch (err) {\n return atob(output);\n }\n};\n\n\n/***/ }),\n/* 67 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar base64_url_decode = __webpack_require__(66);\n\nfunction InvalidTokenError(message) {\n this.message = message;\n}\n\nInvalidTokenError.prototype = new Error();\nInvalidTokenError.prototype.name = 'InvalidTokenError';\n\nmodule.exports = function (token,options) {\n if (typeof token !== 'string') {\n throw new InvalidTokenError('Invalid token specified');\n }\n\n options = options || {};\n var pos = options.header === true ? 0 : 1;\n try {\n return JSON.parse(base64_url_decode(token.split('.')[pos]));\n } catch (e) {\n throw new InvalidTokenError('Invalid token specified: ' + e.message);\n }\n};\n\nmodule.exports.InvalidTokenError = InvalidTokenError;\n\n\n/***/ }),\n/* 68 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n\n\n/***/ }),\n/* 69 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar strictUriEncode = __webpack_require__(70);\nvar objectAssign = __webpack_require__(68);\n\nfunction encoderForArrayFormat(opts) {\n\tswitch (opts.arrayFormat) {\n\t\tcase 'index':\n\t\t\treturn function (key, value, index) {\n\t\t\t\treturn value === null ? [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'[',\n\t\t\t\t\tindex,\n\t\t\t\t\t']'\n\t\t\t\t].join('') : [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'[',\n\t\t\t\t\tencode(index, opts),\n\t\t\t\t\t']=',\n\t\t\t\t\tencode(value, opts)\n\t\t\t\t].join('');\n\t\t\t};\n\n\t\tcase 'bracket':\n\t\t\treturn function (key, value) {\n\t\t\t\treturn value === null ? encode(key, opts) : [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'[]=',\n\t\t\t\t\tencode(value, opts)\n\t\t\t\t].join('');\n\t\t\t};\n\n\t\tdefault:\n\t\t\treturn function (key, value) {\n\t\t\t\treturn value === null ? encode(key, opts) : [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'=',\n\t\t\t\t\tencode(value, opts)\n\t\t\t\t].join('');\n\t\t\t};\n\t}\n}\n\nfunction parserForArrayFormat(opts) {\n\tvar result;\n\n\tswitch (opts.arrayFormat) {\n\t\tcase 'index':\n\t\t\treturn function (key, value, accumulator) {\n\t\t\t\tresult = /\\[(\\d*)\\]$/.exec(key);\n\n\t\t\t\tkey = key.replace(/\\[\\d*\\]$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = {};\n\t\t\t\t}\n\n\t\t\t\taccumulator[key][result[1]] = value;\n\t\t\t};\n\n\t\tcase 'bracket':\n\t\t\treturn function (key, value, accumulator) {\n\t\t\t\tresult = /(\\[\\])$/.exec(key);\n\t\t\t\tkey = key.replace(/\\[\\]$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t} else if (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = [value];\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [].concat(accumulator[key], value);\n\t\t\t};\n\n\t\tdefault:\n\t\t\treturn function (key, value, accumulator) {\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [].concat(accumulator[key], value);\n\t\t\t};\n\t}\n}\n\nfunction encode(value, opts) {\n\tif (opts.encode) {\n\t\treturn opts.strict ? strictUriEncode(value) : encodeURIComponent(value);\n\t}\n\n\treturn value;\n}\n\nfunction keysSorter(input) {\n\tif (Array.isArray(input)) {\n\t\treturn input.sort();\n\t} else if (typeof input === 'object') {\n\t\treturn keysSorter(Object.keys(input)).sort(function (a, b) {\n\t\t\treturn Number(a) - Number(b);\n\t\t}).map(function (key) {\n\t\t\treturn input[key];\n\t\t});\n\t}\n\n\treturn input;\n}\n\nexports.extract = function (str) {\n\treturn str.split('?')[1] || '';\n};\n\nexports.parse = function (str, opts) {\n\topts = objectAssign({arrayFormat: 'none'}, opts);\n\n\tvar formatter = parserForArrayFormat(opts);\n\n\t// Create an object with no prototype\n\t// https://github.com/sindresorhus/query-string/issues/47\n\tvar ret = Object.create(null);\n\n\tif (typeof str !== 'string') {\n\t\treturn ret;\n\t}\n\n\tstr = str.trim().replace(/^(\\?|#|&)/, '');\n\n\tif (!str) {\n\t\treturn ret;\n\t}\n\n\tstr.split('&').forEach(function (param) {\n\t\tvar parts = param.replace(/\\+/g, ' ').split('=');\n\t\t// Firefox (pre 40) decodes `%3D` to `=`\n\t\t// https://github.com/sindresorhus/query-string/pull/37\n\t\tvar key = parts.shift();\n\t\tvar val = parts.length > 0 ? parts.join('=') : undefined;\n\n\t\t// missing `=` should be `null`:\n\t\t// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters\n\t\tval = val === undefined ? null : decodeURIComponent(val);\n\n\t\tformatter(decodeURIComponent(key), val, ret);\n\t});\n\n\treturn Object.keys(ret).sort().reduce(function (result, key) {\n\t\tvar val = ret[key];\n\t\tif (Boolean(val) && typeof val === 'object' && !Array.isArray(val)) {\n\t\t\t// Sort object keys, not values\n\t\t\tresult[key] = keysSorter(val);\n\t\t} else {\n\t\t\tresult[key] = val;\n\t\t}\n\n\t\treturn result;\n\t}, Object.create(null));\n};\n\nexports.stringify = function (obj, opts) {\n\tvar defaults = {\n\t\tencode: true,\n\t\tstrict: true,\n\t\tarrayFormat: 'none'\n\t};\n\n\topts = objectAssign(defaults, opts);\n\n\tvar formatter = encoderForArrayFormat(opts);\n\n\treturn obj ? Object.keys(obj).sort().map(function (key) {\n\t\tvar val = obj[key];\n\n\t\tif (val === undefined) {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (val === null) {\n\t\t\treturn encode(key, opts);\n\t\t}\n\n\t\tif (Array.isArray(val)) {\n\t\t\tvar result = [];\n\n\t\t\tval.slice().forEach(function (val2) {\n\t\t\t\tif (val2 === undefined) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tresult.push(formatter(key, val2, result.length));\n\t\t\t});\n\n\t\t\treturn result.join('&');\n\t\t}\n\n\t\treturn encode(key, opts) + '=' + encode(val, opts);\n\t}).filter(function (x) {\n\t\treturn x.length > 0;\n\t}).join('&') : '';\n};\n\n\n/***/ }),\n/* 70 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nmodule.exports = function (str) {\n\treturn encodeURIComponent(str).replace(/[!'()*]/g, function (c) {\n\t\treturn '%' + c.charCodeAt(0).toString(16).toUpperCase();\n\t});\n};\n\n\n/***/ }),\n/* 71 */\n/***/ (function(module, exports) {\n\nmodule.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}\n\n/***/ }),\n/* 72 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexports.debuglog = function(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = __webpack_require__(71);\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = __webpack_require__(63);\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(17), __webpack_require__(25)))\n\n/***/ }),\n/* 73 */\n/***/ (function(module, exports) {\n\n(function(self) {\n 'use strict';\n\n if (self.fetch) {\n return\n }\n\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob: 'FileReader' in self && 'Blob' in self && (function() {\n try {\n new Blob()\n return true\n } catch(e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ]\n\n var isDataView = function(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n var isArrayBufferView = ArrayBuffer.isView || function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n }\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name)\n }\n if (/[^a-z0-9\\-#$%&'*+.\\^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value)\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift()\n return {done: value === undefined, value: value}\n }\n }\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n }\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {}\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value)\n }, this)\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1])\n }, this)\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name])\n }, this)\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name)\n value = normalizeValue(value)\n var oldValue = this.map[name]\n this.map[name] = oldValue ? oldValue+','+value : value\n }\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)]\n }\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name)\n return this.has(name) ? this.map[name] : null\n }\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n }\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value)\n }\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this)\n }\n }\n }\n\n Headers.prototype.keys = function() {\n var items = []\n this.forEach(function(value, name) { items.push(name) })\n return iteratorFor(items)\n }\n\n Headers.prototype.values = function() {\n var items = []\n this.forEach(function(value) { items.push(value) })\n return iteratorFor(items)\n }\n\n Headers.prototype.entries = function() {\n var items = []\n this.forEach(function(value, name) { items.push([name, value]) })\n return iteratorFor(items)\n }\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result)\n }\n reader.onerror = function() {\n reject(reader.error)\n }\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsArrayBuffer(blob)\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsText(blob)\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf)\n var chars = new Array(view.length)\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i])\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength)\n view.set(new Uint8Array(buf))\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false\n\n this._initBody = function(body) {\n this._bodyInit = body\n if (!body) {\n this._bodyText = ''\n } else if (typeof body === 'string') {\n this._bodyText = body\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString()\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer)\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer])\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body)\n } else {\n throw new Error('unsupported BodyInit type')\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8')\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type)\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')\n }\n }\n }\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n }\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n }\n }\n\n this.text = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n }\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n }\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n }\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase()\n return (methods.indexOf(upcased) > -1) ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {}\n var body = options.body\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url\n this.credentials = input.credentials\n if (!options.headers) {\n this.headers = new Headers(input.headers)\n }\n this.method = input.method\n this.mode = input.mode\n if (!body && input._bodyInit != null) {\n body = input._bodyInit\n input.bodyUsed = true\n }\n } else {\n this.url = String(input)\n }\n\n this.credentials = options.credentials || this.credentials || 'omit'\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers)\n }\n this.method = normalizeMethod(options.method || this.method || 'GET')\n this.mode = options.mode || this.mode || null\n this.referrer = null\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body)\n }\n\n Request.prototype.clone = function() {\n return new Request(this, { body: this._bodyInit })\n }\n\n function decode(body) {\n var form = new FormData()\n body.trim().split('&').forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=')\n var name = split.shift().replace(/\\+/g, ' ')\n var value = split.join('=').replace(/\\+/g, ' ')\n form.append(decodeURIComponent(name), decodeURIComponent(value))\n }\n })\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers()\n rawHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':')\n var key = parts.shift().trim()\n if (key) {\n var value = parts.join(':').trim()\n headers.append(key, value)\n }\n })\n return headers\n }\n\n Body.call(Request.prototype)\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {}\n }\n\n this.type = 'default'\n this.status = 'status' in options ? options.status : 200\n this.ok = this.status >= 200 && this.status < 300\n this.statusText = 'statusText' in options ? options.statusText : 'OK'\n this.headers = new Headers(options.headers)\n this.url = options.url || ''\n this._initBody(bodyInit)\n }\n\n Body.call(Response.prototype)\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n }\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''})\n response.type = 'error'\n return response\n }\n\n var redirectStatuses = [301, 302, 303, 307, 308]\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n }\n\n self.Headers = Headers\n self.Request = Request\n self.Response = Response\n\n self.fetch = function(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init)\n var xhr = new XMLHttpRequest()\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n }\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL')\n var body = 'response' in xhr ? xhr.response : xhr.responseText\n resolve(new Response(body, options))\n }\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'))\n }\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'))\n }\n\n xhr.open(request.method, request.url, true)\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob'\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value)\n })\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)\n })\n }\n self.fetch.polyfill = true\n})(typeof self !== 'undefined' ? self : this);\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// stitch.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 \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\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.l = 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// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 34);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 236f48f2d3f9b4334561","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/buffer/index.js\n// module id = 0\n// module chunks = 0","// Copyright (c) 2008, Fair Oaks Labs, Inc.\n// All rights reserved.\n// \n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are met:\n// \n// * Redistributions of source code must retain the above copyright notice,\n// this list of conditions and the following disclaimer.\n// \n// * Redistributions in binary form must reproduce the above copyright notice,\n// this list of conditions and the following disclaimer in the documentation\n// and/or other materials provided with the distribution.\n// \n// * Neither the name of Fair Oaks Labs, Inc. nor the names of its contributors\n// may be used to endorse or promote products derived from this software\n// without specific prior written permission.\n// \n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n// POSSIBILITY OF SUCH DAMAGE.\n//\n//\n// Modifications to writeIEEE754 to support negative zeroes made by Brian White\n\nvar readIEEE754 = function(buffer, offset, endian, mLen, nBytes) {\n var e, m,\n bBE = (endian === 'big'),\n eLen = nBytes * 8 - mLen - 1,\n eMax = (1 << eLen) - 1,\n eBias = eMax >> 1,\n nBits = -7,\n i = bBE ? 0 : (nBytes - 1),\n d = bBE ? 1 : -1,\n s = buffer[offset + i];\n\n i += d;\n\n e = s & ((1 << (-nBits)) - 1);\n s >>= (-nBits);\n nBits += eLen;\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8);\n\n m = e & ((1 << (-nBits)) - 1);\n e >>= (-nBits);\n nBits += mLen;\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8);\n\n if (e === 0) {\n e = 1 - eBias;\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity);\n } else {\n m = m + Math.pow(2, mLen);\n e = e - eBias;\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen);\n};\n\nvar writeIEEE754 = function(buffer, value, offset, endian, mLen, nBytes) {\n var e, m, c,\n bBE = (endian === 'big'),\n eLen = nBytes * 8 - mLen - 1,\n eMax = (1 << eLen) - 1,\n eBias = eMax >> 1,\n rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),\n i = bBE ? (nBytes-1) : 0,\n d = bBE ? -1 : 1,\n s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;\n\n value = Math.abs(value);\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0;\n e = eMax;\n } else {\n e = Math.floor(Math.log(value) / Math.LN2);\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--;\n c *= 2;\n }\n if (e+eBias >= 1) {\n value += rt / c;\n } else {\n value += rt * Math.pow(2, 1 - eBias);\n }\n if (value * c >= 2) {\n e++;\n c /= 2;\n }\n\n if (e + eBias >= eMax) {\n m = 0;\n e = eMax;\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen);\n e = e + eBias;\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);\n e = 0;\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8);\n\n e = (e << mLen) | m;\n eLen += mLen;\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8);\n\n buffer[offset + i - d] |= s * 128;\n};\n\nexports.readIEEE754 = readIEEE754;\nexports.writeIEEE754 = writeIEEE754;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/float_parser.js","import * as base64 from 'Base64';\n\nconst RESULT_METADATA_KEY = '_stitch_metadata';\n\n/** @namespace util */\n\n/**\n * Utility which creates a function that extracts metadata\n * from the server in the response to a pipeline request,\n * and attaches it to the final result after the finalizer has been applied.\n *\n * @memberof util\n * @param {Function} [func] optional finalizer to transform the response data\n */\nexport const collectMetadata = (func) => {\n const attachMetadata = metadata => (res) => {\n if (typeof res === 'object' && !Object.prototype.hasOwnProperty.call(res, RESULT_METADATA_KEY)) {\n Object.defineProperty(\n res,\n RESULT_METADATA_KEY,\n {enumerable: false, configurable: false, writable: false, value: metadata}\n );\n }\n return Promise.resolve(res);\n };\n const captureMetadata = (data) => {\n let metadata = {};\n if (data.warnings) {\n // Metadata is not yet attached to result, grab any data that needs to be added.\n metadata.warnings = data.warnings;\n }\n if (!func) {\n return Promise.resolve(data).then(attachMetadata(metadata));\n }\n return Promise.resolve(data).then(func).then(attachMetadata(metadata));\n };\n return captureMetadata;\n};\n\n/**\n * Utility function for displaying deprecation notices\n *\n * @memberof util\n * @param {Function} fn the function to deprecate\n * @param {String} msg the message to display to the user regarding deprecation\n */\nfunction deprecate(fn, msg) {\n let alreadyWarned = false;\n function deprecated() {\n if (!alreadyWarned) {\n alreadyWarned = true;\n console.warn('DeprecationWarning: ' + msg);\n }\n\n return fn.apply(this, arguments);\n }\n\n deprecated.__proto__ = fn; // eslint-disable-line\n if (fn.prototype) {\n deprecated.prototype = fn.prototype;\n }\n\n return deprecated;\n}\n\n/**\n * Utility method for executing a service action as a function call.\n *\n * @memberof util\n * @param {Object} service the service to execute the action on\n * @param {String} action the service action to execute\n * @param {Array} args the arguments to supply to the service action invocation\n * @returns {Promise} the API response from the executed service action\n */\nfunction serviceResponse(service, { serviceName = service.serviceName, action, args }) {\n const { client } = service;\n\n if (!client) {\n throw new Error('Service has no client');\n }\n\n return client.executeServiceFunction(serviceName, action, args);\n}\n\n/**\n * Utility function to encode a JSON object into a valid string that can be\n * inserted in a URI. The object is first stringified, then encoded in base64,\n * and finally encoded via the builtin encodeURIComponent function.\n *\n * @memberof util\n * @param {Object} obj The object to encode\n * @returns {String} The encoded object\n */\nfunction uriEncodeObject(obj) {\n return encodeURIComponent(base64.btoa(JSON.stringify(obj)));\n}\n\nexport {\n deprecate,\n serviceResponse,\n uriEncodeObject\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/util.js","// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n// Copyright 2009 Google Inc. All Rights Reserved\n\n/**\n * Defines a Long class for representing a 64-bit two's-complement\n * integer value, which faithfully simulates the behavior of a Java \"Long\". This\n * implementation is derived from LongLib in GWT.\n *\n * Constructs a 64-bit two's-complement integer, given its low and high 32-bit\n * values as *signed* integers. See the from* functions below for more\n * convenient ways of constructing Longs.\n *\n * The internal representation of a Long is the two given signed, 32-bit values.\n * We use 32-bit pieces because these are the size of integers on which\n * Javascript performs bit-operations. For operations like addition and\n * multiplication, we split each number into 16-bit pieces, which can easily be\n * multiplied within Javascript's floating-point representation without overflow\n * or change in sign.\n *\n * In the algorithms below, we frequently reduce the negative case to the\n * positive case by negating the input(s) and then post-processing the result.\n * Note that we must ALWAYS check specially whether those values are MIN_VALUE\n * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\n * a positive number, it overflows back into a negative). Not handling this\n * case would often result in infinite recursion.\n *\n * @class\n * @param {number} low the low (signed) 32 bits of the Long.\n * @param {number} high the high (signed) 32 bits of the Long.\n * @return {Long}\n */\nfunction Long(low, high) {\n if(!(this instanceof Long)) return new Long(low, high);\n \n this._bsontype = 'Long';\n /**\n * @type {number}\n * @ignore\n */\n this.low_ = low | 0; // force into 32 signed bits.\n\n /**\n * @type {number}\n * @ignore\n */\n this.high_ = high | 0; // force into 32 signed bits.\n};\n\n/**\n * Return the int value.\n *\n * @method\n * @return {number} the value, assuming it is a 32-bit integer.\n */\nLong.prototype.toInt = function() {\n return this.low_;\n};\n\n/**\n * Return the Number value.\n *\n * @method\n * @return {number} the closest floating-point representation to this value.\n */\nLong.prototype.toNumber = function() {\n return this.high_ * Long.TWO_PWR_32_DBL_ +\n this.getLowBitsUnsigned();\n};\n\n/**\n * Return the JSON value.\n *\n * @method\n * @return {string} the JSON representation.\n */\nLong.prototype.toJSON = function() {\n return this.toString();\n}\n\n/**\n * Return the String value.\n *\n * @method\n * @param {number} [opt_radix] the radix in which the text should be written.\n * @return {string} the textual representation of this value.\n */\nLong.prototype.toString = function(opt_radix) {\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (this.isZero()) {\n return '0';\n }\n\n if (this.isNegative()) {\n if (this.equals(Long.MIN_VALUE)) {\n // We need to change the Long value before it can be negated, so we remove\n // the bottom-most digit in this base and then recurse to do the rest.\n var radixLong = Long.fromNumber(radix);\n var div = this.div(radixLong);\n var rem = div.multiply(radixLong).subtract(this);\n return div.toString(radix) + rem.toInt().toString(radix);\n } else {\n return '-' + this.negate().toString(radix);\n }\n }\n\n // Do several (6) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Long.fromNumber(Math.pow(radix, 6));\n\n var rem = this;\n var result = '';\n while (true) {\n var remDiv = rem.div(radixToPower);\n var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt();\n var digits = intval.toString(radix);\n\n rem = remDiv;\n if (rem.isZero()) {\n return digits + result;\n } else {\n while (digits.length < 6) {\n digits = '0' + digits;\n }\n result = '' + digits + result;\n }\n }\n};\n\n/**\n * Return the high 32-bits value.\n *\n * @method\n * @return {number} the high 32-bits as a signed value.\n */\nLong.prototype.getHighBits = function() {\n return this.high_;\n};\n\n/**\n * Return the low 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as a signed value.\n */\nLong.prototype.getLowBits = function() {\n return this.low_;\n};\n\n/**\n * Return the low unsigned 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as an unsigned value.\n */\nLong.prototype.getLowBitsUnsigned = function() {\n return (this.low_ >= 0) ?\n this.low_ : Long.TWO_PWR_32_DBL_ + this.low_;\n};\n\n/**\n * Returns the number of bits needed to represent the absolute value of this Long.\n *\n * @method\n * @return {number} Returns the number of bits needed to represent the absolute value of this Long.\n */\nLong.prototype.getNumBitsAbs = function() {\n if (this.isNegative()) {\n if (this.equals(Long.MIN_VALUE)) {\n return 64;\n } else {\n return this.negate().getNumBitsAbs();\n }\n } else {\n var val = this.high_ != 0 ? this.high_ : this.low_;\n for (var bit = 31; bit > 0; bit--) {\n if ((val & (1 << bit)) != 0) {\n break;\n }\n }\n return this.high_ != 0 ? bit + 33 : bit + 1;\n }\n};\n\n/**\n * Return whether this value is zero.\n *\n * @method\n * @return {boolean} whether this value is zero.\n */\nLong.prototype.isZero = function() {\n return this.high_ == 0 && this.low_ == 0;\n};\n\n/**\n * Return whether this value is negative.\n *\n * @method\n * @return {boolean} whether this value is negative.\n */\nLong.prototype.isNegative = function() {\n return this.high_ < 0;\n};\n\n/**\n * Return whether this value is odd.\n *\n * @method\n * @return {boolean} whether this value is odd.\n */\nLong.prototype.isOdd = function() {\n return (this.low_ & 1) == 1;\n};\n\n/**\n * Return whether this Long equals the other\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long equals the other\n */\nLong.prototype.equals = function(other) {\n return (this.high_ == other.high_) && (this.low_ == other.low_);\n};\n\n/**\n * Return whether this Long does not equal the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long does not equal the other.\n */\nLong.prototype.notEquals = function(other) {\n return (this.high_ != other.high_) || (this.low_ != other.low_);\n};\n\n/**\n * Return whether this Long is less than the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is less than the other.\n */\nLong.prototype.lessThan = function(other) {\n return this.compare(other) < 0;\n};\n\n/**\n * Return whether this Long is less than or equal to the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is less than or equal to the other.\n */\nLong.prototype.lessThanOrEqual = function(other) {\n return this.compare(other) <= 0;\n};\n\n/**\n * Return whether this Long is greater than the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is greater than the other.\n */\nLong.prototype.greaterThan = function(other) {\n return this.compare(other) > 0;\n};\n\n/**\n * Return whether this Long is greater than or equal to the other.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} whether this Long is greater than or equal to the other.\n */\nLong.prototype.greaterThanOrEqual = function(other) {\n return this.compare(other) >= 0;\n};\n\n/**\n * Compares this Long with the given one.\n *\n * @method\n * @param {Long} other Long to compare against.\n * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater.\n */\nLong.prototype.compare = function(other) {\n if (this.equals(other)) {\n return 0;\n }\n\n var thisNeg = this.isNegative();\n var otherNeg = other.isNegative();\n if (thisNeg && !otherNeg) {\n return -1;\n }\n if (!thisNeg && otherNeg) {\n return 1;\n }\n\n // at this point, the signs are the same, so subtraction will not overflow\n if (this.subtract(other).isNegative()) {\n return -1;\n } else {\n return 1;\n }\n};\n\n/**\n * The negation of this value.\n *\n * @method\n * @return {Long} the negation of this value.\n */\nLong.prototype.negate = function() {\n if (this.equals(Long.MIN_VALUE)) {\n return Long.MIN_VALUE;\n } else {\n return this.not().add(Long.ONE);\n }\n};\n\n/**\n * Returns the sum of this and the given Long.\n *\n * @method\n * @param {Long} other Long to add to this one.\n * @return {Long} the sum of this and the given Long.\n */\nLong.prototype.add = function(other) {\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 + b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 + b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 + b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 + b48;\n c48 &= 0xFFFF;\n return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32);\n};\n\n/**\n * Returns the difference of this and the given Long.\n *\n * @method\n * @param {Long} other Long to subtract from this.\n * @return {Long} the difference of this and the given Long.\n */\nLong.prototype.subtract = function(other) {\n return this.add(other.negate());\n};\n\n/**\n * Returns the product of this and the given Long.\n *\n * @method\n * @param {Long} other Long to multiply with this.\n * @return {Long} the product of this and the other.\n */\nLong.prototype.multiply = function(other) {\n if (this.isZero()) {\n return Long.ZERO;\n } else if (other.isZero()) {\n return Long.ZERO;\n }\n\n if (this.equals(Long.MIN_VALUE)) {\n return other.isOdd() ? Long.MIN_VALUE : Long.ZERO;\n } else if (other.equals(Long.MIN_VALUE)) {\n return this.isOdd() ? Long.MIN_VALUE : Long.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().multiply(other.negate());\n } else {\n return this.negate().multiply(other).negate();\n }\n } else if (other.isNegative()) {\n return this.multiply(other.negate()).negate();\n }\n\n // If both Longs are small, use float multiplication\n if (this.lessThan(Long.TWO_PWR_24_) &&\n other.lessThan(Long.TWO_PWR_24_)) {\n return Long.fromNumber(this.toNumber() * other.toNumber());\n }\n\n // Divide each Long into 4 chunks of 16 bits, and then add up 4x4 products.\n // We can skip products that would overflow.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 * b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 * b00;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c16 += a00 * b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 * b00;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a16 * b16;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a00 * b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\n c48 &= 0xFFFF;\n return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32);\n};\n\n/**\n * Returns this Long divided by the given one.\n *\n * @method\n * @param {Long} other Long by which to divide.\n * @return {Long} this Long divided by the given one.\n */\nLong.prototype.div = function(other) {\n if (other.isZero()) {\n throw Error('division by zero');\n } else if (this.isZero()) {\n return Long.ZERO;\n }\n\n if (this.equals(Long.MIN_VALUE)) {\n if (other.equals(Long.ONE) ||\n other.equals(Long.NEG_ONE)) {\n return Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\n } else if (other.equals(Long.MIN_VALUE)) {\n return Long.ONE;\n } else {\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\n var halfThis = this.shiftRight(1);\n var approx = halfThis.div(other).shiftLeft(1);\n if (approx.equals(Long.ZERO)) {\n return other.isNegative() ? Long.ONE : Long.NEG_ONE;\n } else {\n var rem = this.subtract(other.multiply(approx));\n var result = approx.add(rem.div(other));\n return result;\n }\n }\n } else if (other.equals(Long.MIN_VALUE)) {\n return Long.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().div(other.negate());\n } else {\n return this.negate().div(other).negate();\n }\n } else if (other.isNegative()) {\n return this.div(other.negate()).negate();\n }\n\n // Repeat the following until the remainder is less than other: find a\n // floating-point that approximates remainder / other *from below*, add this\n // into the result, and subtract it from the remainder. It is critical that\n // the approximate value is less than or equal to the real value so that the\n // remainder never becomes negative.\n var res = Long.ZERO;\n var rem = this;\n while (rem.greaterThanOrEqual(other)) {\n // Approximate the result of division. This may be a little greater or\n // smaller than the actual value.\n var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber()));\n\n // We will tweak the approximate result by changing it in the 48-th digit or\n // the smallest non-fractional digit, whichever is larger.\n var log2 = Math.ceil(Math.log(approx) / Math.LN2);\n var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48);\n\n // Decrease the approximation until it is smaller than the remainder. Note\n // that if it is too large, the product overflows and is negative.\n var approxRes = Long.fromNumber(approx);\n var approxRem = approxRes.multiply(other);\n while (approxRem.isNegative() || approxRem.greaterThan(rem)) {\n approx -= delta;\n approxRes = Long.fromNumber(approx);\n approxRem = approxRes.multiply(other);\n }\n\n // We know the answer can't be zero... and actually, zero would cause\n // infinite recursion since we would make no progress.\n if (approxRes.isZero()) {\n approxRes = Long.ONE;\n }\n\n res = res.add(approxRes);\n rem = rem.subtract(approxRem);\n }\n return res;\n};\n\n/**\n * Returns this Long modulo the given one.\n *\n * @method\n * @param {Long} other Long by which to mod.\n * @return {Long} this Long modulo the given one.\n */\nLong.prototype.modulo = function(other) {\n return this.subtract(this.div(other).multiply(other));\n};\n\n/**\n * The bitwise-NOT of this value.\n *\n * @method\n * @return {Long} the bitwise-NOT of this value.\n */\nLong.prototype.not = function() {\n return Long.fromBits(~this.low_, ~this.high_);\n};\n\n/**\n * Returns the bitwise-AND of this Long and the given one.\n *\n * @method\n * @param {Long} other the Long with which to AND.\n * @return {Long} the bitwise-AND of this and the other.\n */\nLong.prototype.and = function(other) {\n return Long.fromBits(this.low_ & other.low_, this.high_ & other.high_);\n};\n\n/**\n * Returns the bitwise-OR of this Long and the given one.\n *\n * @method\n * @param {Long} other the Long with which to OR.\n * @return {Long} the bitwise-OR of this and the other.\n */\nLong.prototype.or = function(other) {\n return Long.fromBits(this.low_ | other.low_, this.high_ | other.high_);\n};\n\n/**\n * Returns the bitwise-XOR of this Long and the given one.\n *\n * @method\n * @param {Long} other the Long with which to XOR.\n * @return {Long} the bitwise-XOR of this and the other.\n */\nLong.prototype.xor = function(other) {\n return Long.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_);\n};\n\n/**\n * Returns this Long with bits shifted to the left by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Long} this shifted to the left by the given amount.\n */\nLong.prototype.shiftLeft = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var low = this.low_;\n if (numBits < 32) {\n var high = this.high_;\n return Long.fromBits(\n low << numBits,\n (high << numBits) | (low >>> (32 - numBits)));\n } else {\n return Long.fromBits(0, low << (numBits - 32));\n }\n }\n};\n\n/**\n * Returns this Long with bits shifted to the right by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Long} this shifted to the right by the given amount.\n */\nLong.prototype.shiftRight = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Long.fromBits(\n (low >>> numBits) | (high << (32 - numBits)),\n high >> numBits);\n } else {\n return Long.fromBits(\n high >> (numBits - 32),\n high >= 0 ? 0 : -1);\n }\n }\n};\n\n/**\n * Returns this Long with bits shifted to the right by the given amount, with the new top bits matching the current sign bit.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Long} this shifted to the right by the given amount, with zeros placed into the new leading bits.\n */\nLong.prototype.shiftRightUnsigned = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Long.fromBits(\n (low >>> numBits) | (high << (32 - numBits)),\n high >>> numBits);\n } else if (numBits == 32) {\n return Long.fromBits(high, 0);\n } else {\n return Long.fromBits(high >>> (numBits - 32), 0);\n }\n }\n};\n\n/**\n * Returns a Long representing the given (32-bit) integer value.\n *\n * @method\n * @param {number} value the 32-bit integer in question.\n * @return {Long} the corresponding Long value.\n */\nLong.fromInt = function(value) {\n if (-128 <= value && value < 128) {\n var cachedObj = Long.INT_CACHE_[value];\n if (cachedObj) {\n return cachedObj;\n }\n }\n\n var obj = new Long(value | 0, value < 0 ? -1 : 0);\n if (-128 <= value && value < 128) {\n Long.INT_CACHE_[value] = obj;\n }\n return obj;\n};\n\n/**\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n *\n * @method\n * @param {number} value the number in question.\n * @return {Long} the corresponding Long value.\n */\nLong.fromNumber = function(value) {\n if (isNaN(value) || !isFinite(value)) {\n return Long.ZERO;\n } else if (value <= -Long.TWO_PWR_63_DBL_) {\n return Long.MIN_VALUE;\n } else if (value + 1 >= Long.TWO_PWR_63_DBL_) {\n return Long.MAX_VALUE;\n } else if (value < 0) {\n return Long.fromNumber(-value).negate();\n } else {\n return new Long(\n (value % Long.TWO_PWR_32_DBL_) | 0,\n (value / Long.TWO_PWR_32_DBL_) | 0);\n }\n};\n\n/**\n * Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits.\n *\n * @method\n * @param {number} lowBits the low 32-bits.\n * @param {number} highBits the high 32-bits.\n * @return {Long} the corresponding Long value.\n */\nLong.fromBits = function(lowBits, highBits) {\n return new Long(lowBits, highBits);\n};\n\n/**\n * Returns a Long representation of the given string, written using the given radix.\n *\n * @method\n * @param {string} str the textual representation of the Long.\n * @param {number} opt_radix the radix in which the text is written.\n * @return {Long} the corresponding Long value.\n */\nLong.fromString = function(str, opt_radix) {\n if (str.length == 0) {\n throw Error('number format error: empty string');\n }\n\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (str.charAt(0) == '-') {\n return Long.fromString(str.substring(1), radix).negate();\n } else if (str.indexOf('-') >= 0) {\n throw Error('number format error: interior \"-\" character: ' + str);\n }\n\n // Do several (8) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Long.fromNumber(Math.pow(radix, 8));\n\n var result = Long.ZERO;\n for (var i = 0; i < str.length; i += 8) {\n var size = Math.min(8, str.length - i);\n var value = parseInt(str.substring(i, i + size), radix);\n if (size < 8) {\n var power = Long.fromNumber(Math.pow(radix, size));\n result = result.multiply(power).add(Long.fromNumber(value));\n } else {\n result = result.multiply(radixToPower);\n result = result.add(Long.fromNumber(value));\n }\n }\n return result;\n};\n\n// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the\n// from* methods on which they depend.\n\n\n/**\n * A cache of the Long representations of small integer values.\n * @type {Object}\n * @ignore\n */\nLong.INT_CACHE_ = {};\n\n// NOTE: the compiler should inline these constant values below and then remove\n// these variables, so there should be no runtime penalty for these.\n\n/**\n * Number used repeated below in calculations. This must appear before the\n * first call to any from* function below.\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_16_DBL_ = 1 << 16;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_24_DBL_ = 1 << 24;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_32_DBL_ = Long.TWO_PWR_16_DBL_ * Long.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_31_DBL_ = Long.TWO_PWR_32_DBL_ / 2;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_48_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_64_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_32_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nLong.TWO_PWR_63_DBL_ = Long.TWO_PWR_64_DBL_ / 2;\n\n/** @type {Long} */\nLong.ZERO = Long.fromInt(0);\n\n/** @type {Long} */\nLong.ONE = Long.fromInt(1);\n\n/** @type {Long} */\nLong.NEG_ONE = Long.fromInt(-1);\n\n/** @type {Long} */\nLong.MAX_VALUE =\n Long.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0);\n\n/** @type {Long} */\nLong.MIN_VALUE = Long.fromBits(0, 0x80000000 | 0);\n\n/**\n * @type {Long}\n * @ignore\n */\nLong.TWO_PWR_24_ = Long.fromInt(1 << 24);\n\n/**\n * Expose.\n */\nmodule.exports = Long;\nmodule.exports.Long = Long;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/long.js","export const USER_AUTH_KEY = '_stitch_ua';\nexport const REFRESH_TOKEN_KEY = '_stitch_rt';\nexport const DEVICE_ID_KEY = '_stitch_did';\nexport const STATE_KEY = '_stitch_state';\nexport const USER_AUTH_COOKIE_NAME = 'stitch_ua';\nexport const STITCH_ERROR_KEY = '_stitch_error';\nexport const STITCH_LINK_KEY = '_stitch_link';\nexport const USER_LOGGED_IN_PT_KEY = '_stitch_pt';\nexport const STITCH_REDIRECT_PROVIDER = '_stitch_rp';\n\nexport const DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS = 10;\n\nexport const APP_CLIENT_CODEC = {\n 'accessToken': 'access_token',\n 'refreshToken': 'refresh_token',\n 'deviceId': 'device_id',\n 'userId': 'user_id'\n};\n\nexport const ADMIN_CLIENT_CODEC = {\n 'accessToken': 'access_token',\n 'refreshToken': 'refresh_token',\n 'deviceId': 'device_id',\n 'userId': 'user_id'\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/auth/common.js","/**\n * Module dependencies.\n * @ignore\n */\n\n// Test if we're in Node via presence of \"global\" not absence of \"window\"\n// to support hybrid environments like Electron\nif(typeof global !== 'undefined') {\n var Buffer = require('buffer').Buffer; // TODO just use global Buffer\n}\n\n/**\n * A class representation of the BSON Binary type.\n *\n * Sub types\n * - **BSON.BSON_BINARY_SUBTYPE_DEFAULT**, default BSON type.\n * - **BSON.BSON_BINARY_SUBTYPE_FUNCTION**, BSON function type.\n * - **BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY**, BSON byte array type.\n * - **BSON.BSON_BINARY_SUBTYPE_UUID**, BSON uuid type.\n * - **BSON.BSON_BINARY_SUBTYPE_MD5**, BSON md5 type.\n * - **BSON.BSON_BINARY_SUBTYPE_USER_DEFINED**, BSON user defined type.\n *\n * @class\n * @param {Buffer} buffer a buffer object containing the binary data.\n * @param {Number} [subType] the option binary type.\n * @return {Binary}\n */\nfunction Binary(buffer, subType) {\n if(!(this instanceof Binary)) return new Binary(buffer, subType);\n\n this._bsontype = 'Binary';\n\n if(buffer instanceof Number) {\n this.sub_type = buffer;\n this.position = 0;\n } else {\n this.sub_type = subType == null ? BSON_BINARY_SUBTYPE_DEFAULT : subType;\n this.position = 0;\n }\n\n if(buffer != null && !(buffer instanceof Number)) {\n // Only accept Buffer, Uint8Array or Arrays\n if(typeof buffer == 'string') {\n // Different ways of writing the length of the string for the different types\n if(typeof Buffer != 'undefined') {\n this.buffer = new Buffer(buffer);\n } else if(typeof Uint8Array != 'undefined' || (Object.prototype.toString.call(buffer) == '[object Array]')) {\n this.buffer = writeStringToArray(buffer);\n } else {\n throw new Error(\"only String, Buffer, Uint8Array or Array accepted\");\n }\n } else {\n this.buffer = buffer;\n }\n this.position = buffer.length;\n } else {\n if(typeof Buffer != 'undefined') {\n this.buffer = new Buffer(Binary.BUFFER_SIZE);\n } else if(typeof Uint8Array != 'undefined'){\n this.buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE));\n } else {\n this.buffer = new Array(Binary.BUFFER_SIZE);\n }\n // Set position to start of buffer\n this.position = 0;\n }\n};\n\n/**\n * Updates this binary with byte_value.\n *\n * @method\n * @param {string} byte_value a single byte we wish to write.\n */\nBinary.prototype.put = function put(byte_value) {\n // If it's a string and a has more than one character throw an error\n if(byte_value['length'] != null && typeof byte_value != 'number' && byte_value.length != 1) throw new Error(\"only accepts single character String, Uint8Array or Array\");\n if(typeof byte_value != 'number' && byte_value < 0 || byte_value > 255) throw new Error(\"only accepts number in a valid unsigned byte range 0-255\");\n\n // Decode the byte value once\n var decoded_byte = null;\n if(typeof byte_value == 'string') {\n decoded_byte = byte_value.charCodeAt(0);\n } else if(byte_value['length'] != null) {\n decoded_byte = byte_value[0];\n } else {\n decoded_byte = byte_value;\n }\n\n if(this.buffer.length > this.position) {\n this.buffer[this.position++] = decoded_byte;\n } else {\n if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) {\n // Create additional overflow buffer\n var buffer = new Buffer(Binary.BUFFER_SIZE + this.buffer.length);\n // Combine the two buffers together\n this.buffer.copy(buffer, 0, 0, this.buffer.length);\n this.buffer = buffer;\n this.buffer[this.position++] = decoded_byte;\n } else {\n var buffer = null;\n // Create a new buffer (typed or normal array)\n if(Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') {\n buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE + this.buffer.length));\n } else {\n buffer = new Array(Binary.BUFFER_SIZE + this.buffer.length);\n }\n\n // We need to copy all the content to the new array\n for(var i = 0; i < this.buffer.length; i++) {\n buffer[i] = this.buffer[i];\n }\n\n // Reassign the buffer\n this.buffer = buffer;\n // Write the byte\n this.buffer[this.position++] = decoded_byte;\n }\n }\n};\n\n/**\n * Writes a buffer or string to the binary.\n *\n * @method\n * @param {(Buffer|string)} string a string or buffer to be written to the Binary BSON object.\n * @param {number} offset specify the binary of where to write the content.\n * @return {null}\n */\nBinary.prototype.write = function write(string, offset) {\n offset = typeof offset == 'number' ? offset : this.position;\n\n // If the buffer is to small let's extend the buffer\n if(this.buffer.length < offset + string.length) {\n var buffer = null;\n // If we are in node.js\n if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) {\n buffer = new Buffer(this.buffer.length + string.length);\n this.buffer.copy(buffer, 0, 0, this.buffer.length);\n } else if(Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') {\n // Create a new buffer\n buffer = new Uint8Array(new ArrayBuffer(this.buffer.length + string.length))\n // Copy the content\n for(var i = 0; i < this.position; i++) {\n buffer[i] = this.buffer[i];\n }\n }\n\n // Assign the new buffer\n this.buffer = buffer;\n }\n\n if(typeof Buffer != 'undefined' && Buffer.isBuffer(string) && Buffer.isBuffer(this.buffer)) {\n string.copy(this.buffer, offset, 0, string.length);\n this.position = (offset + string.length) > this.position ? (offset + string.length) : this.position;\n // offset = string.length\n } else if(typeof Buffer != 'undefined' && typeof string == 'string' && Buffer.isBuffer(this.buffer)) {\n this.buffer.write(string, offset, 'binary');\n this.position = (offset + string.length) > this.position ? (offset + string.length) : this.position;\n // offset = string.length;\n } else if(Object.prototype.toString.call(string) == '[object Uint8Array]'\n || Object.prototype.toString.call(string) == '[object Array]' && typeof string != 'string') {\n for(var i = 0; i < string.length; i++) {\n this.buffer[offset++] = string[i];\n }\n\n this.position = offset > this.position ? offset : this.position;\n } else if(typeof string == 'string') {\n for(var i = 0; i < string.length; i++) {\n this.buffer[offset++] = string.charCodeAt(i);\n }\n\n this.position = offset > this.position ? offset : this.position;\n }\n};\n\n/**\n * Reads **length** bytes starting at **position**.\n *\n * @method\n * @param {number} position read from the given position in the Binary.\n * @param {number} length the number of bytes to read.\n * @return {Buffer}\n */\nBinary.prototype.read = function read(position, length) {\n length = length && length > 0\n ? length\n : this.position;\n\n // Let's return the data based on the type we have\n if(this.buffer['slice']) {\n return this.buffer.slice(position, position + length);\n } else {\n // Create a buffer to keep the result\n var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(length)) : new Array(length);\n for(var i = 0; i < length; i++) {\n buffer[i] = this.buffer[position++];\n }\n }\n // Return the buffer\n return buffer;\n};\n\n/**\n * Returns the value of this binary as a string.\n *\n * @method\n * @return {string}\n */\nBinary.prototype.value = function value(asRaw) {\n asRaw = asRaw == null ? false : asRaw;\n\n // Optimize to serialize for the situation where the data == size of buffer\n if(asRaw && typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer) && this.buffer.length == this.position)\n return this.buffer;\n\n // If it's a node.js buffer object\n if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) {\n return asRaw ? this.buffer.slice(0, this.position) : this.buffer.toString('binary', 0, this.position);\n } else {\n if(asRaw) {\n // we support the slice command use it\n if(this.buffer['slice'] != null) {\n return this.buffer.slice(0, this.position);\n } else {\n // Create a new buffer to copy content to\n var newBuffer = Object.prototype.toString.call(this.buffer) == '[object Uint8Array]' ? new Uint8Array(new ArrayBuffer(this.position)) : new Array(this.position);\n // Copy content\n for(var i = 0; i < this.position; i++) {\n newBuffer[i] = this.buffer[i];\n }\n // Return the buffer\n return newBuffer;\n }\n } else {\n return convertArraytoUtf8BinaryString(this.buffer, 0, this.position);\n }\n }\n};\n\n/**\n * Length.\n *\n * @method\n * @return {number} the length of the binary.\n */\nBinary.prototype.length = function length() {\n return this.position;\n};\n\n/**\n * @ignore\n */\nBinary.prototype.toJSON = function() {\n return this.buffer != null ? this.buffer.toString('base64') : '';\n}\n\n/**\n * @ignore\n */\nBinary.prototype.toString = function(format) {\n return this.buffer != null ? this.buffer.slice(0, this.position).toString(format) : '';\n}\n\n/**\n * Binary default subtype\n * @ignore\n */\nvar BSON_BINARY_SUBTYPE_DEFAULT = 0;\n\n/**\n * @ignore\n */\nvar writeStringToArray = function(data) {\n // Create a buffer\n var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(data.length)) : new Array(data.length);\n // Write the content to the buffer\n for(var i = 0; i < data.length; i++) {\n buffer[i] = data.charCodeAt(i);\n }\n // Write the string to the buffer\n return buffer;\n}\n\n/**\n * Convert Array ot Uint8Array to Binary String\n *\n * @ignore\n */\nvar convertArraytoUtf8BinaryString = function(byteArray, startIndex, endIndex) {\n var result = \"\";\n for(var i = startIndex; i < endIndex; i++) {\n result = result + String.fromCharCode(byteArray[i]);\n }\n return result;\n};\n\nBinary.BUFFER_SIZE = 256;\n\n/**\n * Default BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_DEFAULT = 0;\n/**\n * Function BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_FUNCTION = 1;\n/**\n * Byte Array BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_BYTE_ARRAY = 2;\n/**\n * OLD UUID BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_UUID_OLD = 3;\n/**\n * UUID BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_UUID = 4;\n/**\n * MD5 BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_MD5 = 5;\n/**\n * User BSON type\n *\n * @classconstant SUBTYPE_DEFAULT\n **/\nBinary.SUBTYPE_USER_DEFINED = 128;\n\n/**\n * Expose.\n */\nmodule.exports = Binary;\nmodule.exports.Binary = Binary;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/binary.js","/**\n * A class representation of the BSON Code type.\n *\n * @class\n * @param {(string|function)} code a string or function.\n * @param {Object} [scope] an optional scope for the function.\n * @return {Code}\n */\nvar Code = function Code(code, scope) {\n if(!(this instanceof Code)) return new Code(code, scope);\n this._bsontype = 'Code';\n this.code = code;\n this.scope = scope;\n};\n\n/**\n * @ignore\n */\nCode.prototype.toJSON = function() {\n return {scope:this.scope, code:this.code};\n}\n\nmodule.exports = Code;\nmodule.exports.Code = Code;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/code.js","/**\n * A class representation of the BSON DBRef type.\n *\n * @class\n * @param {string} namespace the collection name.\n * @param {ObjectID} oid the reference ObjectID.\n * @param {string} [db] optional db name, if omitted the reference is local to the current db.\n * @return {DBRef}\n */\nfunction DBRef(namespace, oid, db) {\n if(!(this instanceof DBRef)) return new DBRef(namespace, oid, db);\n \n this._bsontype = 'DBRef';\n this.namespace = namespace;\n this.oid = oid;\n this.db = db;\n};\n\n/**\n * @ignore\n * @api private\n */\nDBRef.prototype.toJSON = function() {\n return {\n '$ref':this.namespace,\n '$id':this.oid,\n '$db':this.db == null ? '' : this.db\n };\n}\n\nmodule.exports = DBRef;\nmodule.exports.DBRef = DBRef;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/db_ref.js","\"use strict\"\n\nvar Long = require('./long');\n\nvar PARSE_STRING_REGEXP = /^(\\+|\\-)?(\\d+|(\\d*\\.\\d*))?(E|e)?([\\-\\+])?(\\d+)?$/;\nvar PARSE_INF_REGEXP = /^(\\+|\\-)?(Infinity|inf)$/i;\nvar PARSE_NAN_REGEXP = /^(\\+|\\-)?NaN$/i;\n\nvar EXPONENT_MAX = 6111;\nvar EXPONENT_MIN = -6176;\nvar EXPONENT_BIAS = 6176;\nvar MAX_DIGITS = 34;\n\n// Nan value bits as 32 bit values (due to lack of longs)\nvar NAN_BUFFER = [0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].reverse();\n// Infinity value bits 32 bit values (due to lack of longs)\nvar INF_NEGATIVE_BUFFER = [0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].reverse();\nvar INF_POSITIVE_BUFFER = [0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].reverse();\n\nvar EXPONENT_REGEX = /^([\\-\\+])?(\\d+)?$/;\n\n\n// Detect if the value is a digit\nvar isDigit = function(value) {\n return !isNaN(parseInt(value, 10));\n}\n\n// Divide two uint128 values\nvar divideu128 = function(value) {\n var DIVISOR = Long.fromNumber(1000 * 1000 * 1000);\n var _rem = Long.fromNumber(0);\n var i = 0;\n\n if(!value.parts[0] && !value.parts[1] &&\n !value.parts[2] && !value.parts[3]) {\n return { quotient: value, rem: _rem };\n }\n\n for(var i = 0; i <= 3; i++) {\n // Adjust remainder to match value of next dividend\n _rem = _rem.shiftLeft(32);\n // Add the divided to _rem\n _rem = _rem.add(new Long(value.parts[i], 0));\n value.parts[i] = _rem.div(DIVISOR).low_;\n _rem = _rem.modulo(DIVISOR);\n }\n\n return { quotient: value, rem: _rem };\n}\n\n// Multiply two Long values and return the 128 bit value\nvar multiply64x2 = function(left, right) {\n if(!left && !right) {\n return {high: Long.fromNumber(0), low: Long.fromNumber(0)};\n }\n\n var leftHigh = left.shiftRightUnsigned(32);\n var leftLow = new Long(left.getLowBits(), 0);\n var rightHigh = right.shiftRightUnsigned(32);\n var rightLow = new Long(right.getLowBits(), 0);\n\n var productHigh = leftHigh.multiply(rightHigh);\n var productMid = leftHigh.multiply(rightLow);\n var productMid2 = leftLow.multiply(rightHigh);\n var productLow = leftLow.multiply(rightLow);\n\n productHigh = productHigh.add(productMid.shiftRightUnsigned(32));\n productMid = new Long(productMid.getLowBits(), 0)\n .add(productMid2)\n .add(productLow.shiftRightUnsigned(32));\n\n productHigh = productHigh.add(productMid.shiftRightUnsigned(32));\n productLow = productMid.shiftLeft(32).add(new Long(productLow.getLowBits(), 0));\n\n // Return the 128 bit result\n return {high: productHigh, low: productLow};\n}\n\nvar lessThan = function(left, right) {\n // Make values unsigned\n var uhleft = left.high_ >>> 0;\n var uhright = right.high_ >>> 0;\n\n // Compare high bits first\n if(uhleft < uhright) {\n return true\n } else if(uhleft == uhright) {\n var ulleft = left.low_ >>> 0;\n var ulright = right.low_ >>> 0;\n if(ulleft < ulright) return true;\n }\n\n return false;\n}\n\nvar longtoHex = function(value) {\n var buffer = new Buffer(8);\n var index = 0;\n // Encode the low 64 bits of the decimal\n // Encode low bits\n buffer[index++] = value.low_ & 0xff;\n buffer[index++] = (value.low_ >> 8) & 0xff;\n buffer[index++] = (value.low_ >> 16) & 0xff;\n buffer[index++] = (value.low_ >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = value.high_ & 0xff;\n buffer[index++] = (value.high_ >> 8) & 0xff;\n buffer[index++] = (value.high_ >> 16) & 0xff;\n buffer[index++] = (value.high_ >> 24) & 0xff;\n return buffer.reverse().toString('hex');\n}\n\nvar int32toHex = function(value) {\n var buffer = new Buffer(4);\n var index = 0;\n // Encode the low 64 bits of the decimal\n // Encode low bits\n buffer[index++] = value & 0xff;\n buffer[index++] = (value >> 8) & 0xff;\n buffer[index++] = (value >> 16) & 0xff;\n buffer[index++] = (value >> 24) & 0xff;\n return buffer.reverse().toString('hex');\n}\n\nvar Decimal128 = function(bytes) {\n this._bsontype = 'Decimal128';\n this.bytes = bytes;\n}\n\nDecimal128.fromString = function(string) {\n // Parse state tracking\n var isNegative = false;\n var sawRadix = false;\n var foundNonZero = false;\n\n // Total number of significant digits (no leading or trailing zero)\n var significantDigits = 0;\n // Total number of significand digits read\n var nDigitsRead = 0;\n // Total number of digits (no leading zeros)\n var nDigits = 0;\n // The number of the digits after radix\n var radixPosition = 0;\n // The index of the first non-zero in *str*\n var firstNonZero = 0;\n\n // Digits Array\n var digits = [0];\n // The number of digits in digits\n var nDigitsStored = 0;\n // Insertion pointer for digits\n var digitsInsert = 0;\n // The index of the first non-zero digit\n var firstDigit = 0;\n // The index of the last digit\n var lastDigit = 0;\n\n // Exponent\n var exponent = 0;\n // loop index over array\n var i = 0;\n // The high 17 digits of the significand\n var significandHigh = [0, 0];\n // The low 17 digits of the significand\n var significandLow = [0, 0];\n // The biased exponent\n var biasedExponent = 0;\n\n // Read index\n var index = 0;\n\n // Trim the string\n string = string.trim();\n\n // Results\n var stringMatch = string.match(PARSE_STRING_REGEXP);\n var infMatch = string.match(PARSE_INF_REGEXP);\n var nanMatch = string.match(PARSE_NAN_REGEXP);\n\n // Validate the string\n if(!stringMatch\n && ! infMatch\n && ! nanMatch || string.length == 0) {\n throw new Error(\"\" + string + \" not a valid Decimal128 string\");\n }\n\n // Check if we have an illegal exponent format\n if(stringMatch && stringMatch[4] && stringMatch[2] === undefined) {\n throw new Error(\"\" + string + \" not a valid Decimal128 string\");\n }\n\n // Get the negative or positive sign\n if(string[index] == '+' || string[index] == '-') {\n isNegative = string[index++] == '-';\n }\n\n // Check if user passed Infinity or NaN\n if(!isDigit(string[index]) && string[index] != '.') {\n if(string[index] == 'i' || string[index] == 'I') {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER));\n } else if(string[index] == 'N') {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n }\n\n // Read all the digits\n while(isDigit(string[index]) || string[index] == '.') {\n if(string[index] == '.') {\n if(sawRadix) {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n\n sawRadix = true;\n index = index + 1;\n continue;\n }\n\n if(nDigitsStored < 34) {\n if(string[index] != '0' || foundNonZero) {\n if(!foundNonZero) {\n firstNonZero = nDigitsRead;\n }\n\n foundNonZero = true;\n\n // Only store 34 digits\n digits[digitsInsert++] = parseInt(string[index], 10);\n nDigitsStored = nDigitsStored + 1;\n }\n }\n\n if(foundNonZero) {\n nDigits = nDigits + 1;\n }\n\n if(sawRadix) {\n radixPosition = radixPosition + 1;\n }\n\n nDigitsRead = nDigitsRead + 1;\n index = index + 1;\n }\n\n if(sawRadix && !nDigitsRead) {\n throw new Error(\"\" + string + \" not a valid Decimal128 string\");\n }\n\n // Read exponent if exists\n if(string[index] == 'e' || string[index] == 'E') {\n // Read exponent digits\n var match = string.substr(++index).match(EXPONENT_REGEX);\n\n // No digits read\n if(!match || !match[2]) {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n\n // Get exponent\n exponent = parseInt(match[0], 10);\n\n // Adjust the index\n index = index + match[0].length;\n }\n\n // Return not a number\n if(string[index]) {\n return new Decimal128(new Buffer(NAN_BUFFER));\n }\n\n // Done reading input\n // Find first non-zero digit in digits\n firstDigit = 0;\n\n if(!nDigitsStored) {\n firstDigit = 0;\n lastDigit = 0;\n digits[0] = 0;\n nDigits = 1;\n nDigitsStored = 1;\n significantDigits = 0;\n } else {\n lastDigit = nDigitsStored - 1;\n significantDigits = nDigits;\n\n if(exponent != 0 && significantDigits != 1) {\n while(string[firstNonZero + significantDigits - 1] == '0') {\n significantDigits = significantDigits - 1;\n }\n }\n }\n\n // Normalization of exponent\n // Correct exponent based on radix position, and shift significand as needed\n // to represent user input\n\n // Overflow prevention\n if(exponent <= radixPosition && radixPosition - exponent > (1 << 14)) {\n exponent = EXPONENT_MIN;\n } else {\n exponent = exponent - radixPosition;\n }\n\n // Attempt to normalize the exponent\n while(exponent > EXPONENT_MAX) {\n // Shift exponent to significand and decrease\n lastDigit = lastDigit + 1;\n\n if(lastDigit - firstDigit > MAX_DIGITS) {\n // Check if we have a zero then just hard clamp, otherwise fail\n var digitsString = digits.join('');\n if(digitsString.match(/^0+$/)) {\n exponent = EXPONENT_MAX;\n break;\n } else {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER));\n }\n }\n\n exponent = exponent - 1;\n }\n\n while(exponent < EXPONENT_MIN || nDigitsStored < nDigits) {\n // Shift last digit\n if(lastDigit == 0) {\n exponent = EXPONENT_MIN;\n significantDigits = 0;\n break;\n }\n\n if(nDigitsStored < nDigits) {\n // adjust to match digits not stored\n nDigits = nDigits - 1;\n } else {\n // adjust to round\n lastDigit = lastDigit - 1;\n }\n\n if(exponent < EXPONENT_MAX) {\n exponent = exponent + 1;\n } else {\n // Check if we have a zero then just hard clamp, otherwise fail\n var digitsString = digits.join('');\n if(digitsString.match(/^0+$/)) {\n exponent = EXPONENT_MAX;\n break;\n } else {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER))\n }\n }\n }\n\n\n // Round\n // We've normalized the exponent, but might still need to round.\n if((lastDigit - firstDigit + 1 < significantDigits) && string[significantDigits] != '0') {\n var endOfString = nDigitsRead;\n\n // If we have seen a radix point, 'string' is 1 longer than we have\n // documented with ndigits_read, so inc the position of the first nonzero\n // digit and the position that digits are read to.\n if(sawRadix && exponent == EXPONENT_MIN) {\n firstNonZero = firstNonZero + 1;\n endOfString = endOfString + 1;\n }\n\n var roundDigit = parseInt(string[firstNonZero + lastDigit + 1], 10);\n var roundBit = 0;\n\n if(roundDigit >= 5) {\n roundBit = 1;\n\n if(roundDigit == 5) {\n roundBit = digits[lastDigit] % 2 == 1;\n\n for(var i = firstNonZero + lastDigit + 2; i < endOfString; i++) {\n if(parseInt(string[i], 10)) {\n roundBit = 1;\n break;\n }\n }\n }\n }\n\n if(roundBit) {\n var dIdx = lastDigit;\n\n for(; dIdx >= 0; dIdx--) {\n if(++digits[dIdx] > 9) {\n digits[dIdx] = 0;\n\n // overflowed most significant digit\n if(dIdx == 0) {\n if(exponent < EXPONENT_MAX) {\n exponent = exponent + 1;\n digits[dIdx] = 1;\n } else {\n return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER))\n }\n }\n } else {\n break;\n }\n }\n }\n }\n\n // Encode significand\n // The high 17 digits of the significand\n significandHigh = Long.fromNumber(0);\n // The low 17 digits of the significand\n significandLow = Long.fromNumber(0);\n\n // read a zero\n if(significantDigits == 0) {\n significandHigh = Long.fromNumber(0);\n significandLow = Long.fromNumber(0);\n } else if(lastDigit - firstDigit < 17) {\n var dIdx = firstDigit;\n significandLow = Long.fromNumber(digits[dIdx++]);\n significandHigh = new Long(0, 0);\n\n for(; dIdx <= lastDigit; dIdx++) {\n significandLow = significandLow.multiply(Long.fromNumber(10));\n significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));\n }\n } else {\n var dIdx = firstDigit;\n significandHigh = Long.fromNumber(digits[dIdx++]);\n\n for(; dIdx <= lastDigit - 17; dIdx++) {\n significandHigh = significandHigh.multiply(Long.fromNumber(10));\n significandHigh = significandHigh.add(Long.fromNumber(digits[dIdx]));\n }\n\n significandLow = Long.fromNumber(digits[dIdx++]);\n\n for(; dIdx <= lastDigit; dIdx++) {\n significandLow = significandLow.multiply(Long.fromNumber(10));\n significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));\n }\n }\n\n var significand = multiply64x2(significandHigh, Long.fromString(\"100000000000000000\"));\n\n significand.low = significand.low.add(significandLow);\n\n if(lessThan(significand.low, significandLow)) {\n significand.high = significand.high.add(Long.fromNumber(1));\n }\n\n // Biased exponent\n var biasedExponent = (exponent + EXPONENT_BIAS);\n var dec = { low: Long.fromNumber(0), high: Long.fromNumber(0) };\n\n // Encode combination, exponent, and significand.\n if(significand.high.shiftRightUnsigned(49).and(Long.fromNumber(1)).equals(Long.fromNumber)) {\n // Encode '11' into bits 1 to 3\n dec.high = dec.high.or(Long.fromNumber(0x3).shiftLeft(61));\n dec.high = dec.high.or(Long.fromNumber(biasedExponent).and(Long.fromNumber(0x3fff).shiftLeft(47)));\n dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x7fffffffffff)));\n } else {\n dec.high = dec.high.or(Long.fromNumber(biasedExponent & 0x3fff).shiftLeft(49));\n dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x1ffffffffffff)));\n }\n\n dec.low = significand.low;\n\n // Encode sign\n if(isNegative) {\n dec.high = dec.high.or(Long.fromString('9223372036854775808'));\n }\n\n // Encode into a buffer\n var buffer = new Buffer(16);\n var index = 0;\n\n // Encode the low 64 bits of the decimal\n // Encode low bits\n buffer[index++] = dec.low.low_ & 0xff;\n buffer[index++] = (dec.low.low_ >> 8) & 0xff;\n buffer[index++] = (dec.low.low_ >> 16) & 0xff;\n buffer[index++] = (dec.low.low_ >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = dec.low.high_ & 0xff;\n buffer[index++] = (dec.low.high_ >> 8) & 0xff;\n buffer[index++] = (dec.low.high_ >> 16) & 0xff;\n buffer[index++] = (dec.low.high_ >> 24) & 0xff;\n\n // Encode the high 64 bits of the decimal\n // Encode low bits\n buffer[index++] = dec.high.low_ & 0xff;\n buffer[index++] = (dec.high.low_ >> 8) & 0xff;\n buffer[index++] = (dec.high.low_ >> 16) & 0xff;\n buffer[index++] = (dec.high.low_ >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = dec.high.high_ & 0xff;\n buffer[index++] = (dec.high.high_ >> 8) & 0xff;\n buffer[index++] = (dec.high.high_ >> 16) & 0xff;\n buffer[index++] = (dec.high.high_ >> 24) & 0xff;\n\n // Return the new Decimal128\n return new Decimal128(buffer);\n}\n\n// Extract least significant 5 bits\nvar COMBINATION_MASK = 0x1f;\n// Extract least significant 14 bits\nvar EXPONENT_MASK = 0x3fff;\n// Value of combination field for Inf\nvar COMBINATION_INFINITY = 30;\n// Value of combination field for NaN\nvar COMBINATION_NAN = 31;\n// Value of combination field for NaN\nvar COMBINATION_SNAN = 32;\n// decimal128 exponent bias\nvar EXPONENT_BIAS = 6176;\n\nDecimal128.prototype.toString = function() {\n // Note: bits in this routine are referred to starting at 0,\n // from the sign bit, towards the coefficient.\n\n // bits 0 - 31\n var high;\n // bits 32 - 63\n var midh;\n // bits 64 - 95\n var midl;\n // bits 96 - 127\n var low;\n // bits 1 - 5\n var combination;\n // decoded biased exponent (14 bits)\n var biased_exponent;\n // the number of significand digits\n var significand_digits = 0;\n // the base-10 digits in the significand\n var significand = new Array(36);\n for(var i = 0; i < significand.length; i++) significand[i] = 0;\n // read pointer into significand\n var index = 0;\n\n // unbiased exponent\n var exponent;\n // the exponent if scientific notation is used\n var scientific_exponent;\n\n // true if the number is zero\n var is_zero = false;\n\n // the most signifcant significand bits (50-46)\n var significand_msb;\n // temporary storage for significand decoding\n var significand128 = {parts: new Array(4)};\n // indexing variables\n var i;\n var j, k;\n\n // Output string\n var string = [];\n\n // Unpack index\n var index = 0;\n\n // Buffer reference\n var buffer = this.bytes;\n\n // Unpack the low 64bits into a long\n low = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n midl = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n // Unpack the high 64bits into a long\n midh = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n high = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n // Unpack index\n var index = 0;\n\n // Create the state of the decimal\n var dec = {\n low: new Long(low, midl),\n high: new Long(midh, high) };\n\n if(dec.high.lessThan(Long.ZERO)) {\n string.push('-');\n }\n\n // Decode combination field and exponent\n combination = (high >> 26) & COMBINATION_MASK;\n\n if((combination >> 3) == 3) {\n // Check for 'special' values\n if(combination == COMBINATION_INFINITY) {\n return string.join('') + \"Infinity\";\n } else if(combination == COMBINATION_NAN) {\n return \"NaN\";\n } else {\n biased_exponent = (high >> 15) & EXPONENT_MASK;\n significand_msb = 0x08 + ((high >> 14) & 0x01);\n }\n } else {\n significand_msb = (high >> 14) & 0x07;\n biased_exponent = (high >> 17) & EXPONENT_MASK;\n }\n\n exponent = biased_exponent - EXPONENT_BIAS;\n\n // Create string of significand digits\n\n // Convert the 114-bit binary number represented by\n // (significand_high, significand_low) to at most 34 decimal\n // digits through modulo and division.\n significand128.parts[0] = (high & 0x3fff) + ((significand_msb & 0xf) << 14);\n significand128.parts[1] = midh;\n significand128.parts[2] = midl;\n significand128.parts[3] = low;\n\n if(significand128.parts[0] == 0 && significand128.parts[1] == 0\n && significand128.parts[2] == 0 && significand128.parts[3] == 0) {\n is_zero = true;\n } else {\n for(var k = 3; k >= 0; k--) {\n var least_digits = 0;\n // Peform the divide\n var result = divideu128(significand128);\n significand128 = result.quotient;\n least_digits = result.rem.low_;\n\n // We now have the 9 least significant digits (in base 2).\n // Convert and output to string.\n if(!least_digits) continue;\n\n for(var j = 8; j >= 0; j--) {\n // significand[k * 9 + j] = Math.round(least_digits % 10);\n significand[k * 9 + j] = least_digits % 10;\n // least_digits = Math.round(least_digits / 10);\n least_digits = Math.floor(least_digits / 10);\n }\n }\n }\n\n // Output format options:\n // Scientific - [-]d.dddE(+/-)dd or [-]dE(+/-)dd\n // Regular - ddd.ddd\n\n if(is_zero) {\n significand_digits = 1;\n significand[index] = 0;\n } else {\n significand_digits = 36;\n var i = 0;\n\n while(!significand[index]) {\n i++;\n significand_digits = significand_digits - 1;\n index = index + 1;\n }\n }\n\n scientific_exponent = significand_digits - 1 + exponent;\n\n // The scientific exponent checks are dictated by the string conversion\n // specification and are somewhat arbitrary cutoffs.\n //\n // We must check exponent > 0, because if this is the case, the number\n // has trailing zeros. However, we *cannot* output these trailing zeros,\n // because doing so would change the precision of the value, and would\n // change stored data if the string converted number is round tripped.\n\n if(scientific_exponent >= 34 || scientific_exponent <= -7 ||\n exponent > 0) {\n // Scientific format\n string.push(significand[index++]);\n significand_digits = significand_digits - 1;\n\n if(significand_digits) {\n string.push('.');\n }\n\n for(var i = 0; i < significand_digits; i++) {\n string.push(significand[index++]);\n }\n\n // Exponent\n string.push('E');\n if(scientific_exponent > 0) {\n string.push('+' + scientific_exponent);\n } else {\n string.push(scientific_exponent);\n }\n } else {\n // Regular format with no decimal place\n if(exponent >= 0) {\n for(var i = 0; i < significand_digits; i++) {\n string.push(significand[index++]);\n }\n } else {\n var radix_position = significand_digits + exponent;\n\n // non-zero digits before radix\n if(radix_position > 0) {\n for(var i = 0; i < radix_position; i++) {\n string.push(significand[index++]);\n }\n } else {\n string.push('0');\n }\n\n string.push('.');\n // add leading zeros after radix\n while(radix_position++ < 0) {\n string.push('0');\n }\n\n for(var i = 0; i < significand_digits - Math.max(radix_position - 1, 0); i++) {\n string.push(significand[index++]);\n }\n }\n }\n\n return string.join('');\n}\n\nDecimal128.prototype.toJSON = function() {\n return { \"$numberDecimal\": this.toString() };\n}\n\nmodule.exports = Decimal128;\nmodule.exports.Decimal128 = Decimal128;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/decimal128.js","/**\n * A class representation of the BSON Double type.\n *\n * @class\n * @param {number} value the number we want to represent as a double.\n * @return {Double}\n */\nfunction Double(value) {\n if(!(this instanceof Double)) return new Double(value);\n\n this._bsontype = 'Double';\n this.value = value;\n}\n\n/**\n * Access the number value.\n *\n * @method\n * @return {number} returns the wrapped double number.\n */\nDouble.prototype.valueOf = function() {\n return this.value;\n};\n\n/**\n * @ignore\n */\nDouble.prototype.toJSON = function() {\n return this.value;\n}\n\nmodule.exports = Double;\nmodule.exports.Double = Double;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/double.js","/**\n * A class representation of the BSON MaxKey type.\n *\n * @class\n * @return {MaxKey} A MaxKey instance\n */\nfunction MaxKey() {\n if(!(this instanceof MaxKey)) return new MaxKey();\n \n this._bsontype = 'MaxKey'; \n}\n\nmodule.exports = MaxKey;\nmodule.exports.MaxKey = MaxKey;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/max_key.js","/**\n * A class representation of the BSON MinKey type.\n *\n * @class\n * @return {MinKey} A MinKey instance\n */\nfunction MinKey() {\n if(!(this instanceof MinKey)) return new MinKey();\n \n this._bsontype = 'MinKey';\n}\n\nmodule.exports = MinKey;\nmodule.exports.MinKey = MinKey;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/min_key.js","/**\n * Machine id.\n *\n * Create a random 3-byte value (i.e. unique for this\n * process). Other drivers use a md5 of the machine id here, but\n * that would mean an asyc call to gethostname, so we don't bother.\n * @ignore\n */\nvar MACHINE_ID = parseInt(Math.random() * 0xFFFFFF, 10);\n\n// Regular expression that checks for hex value\nvar checkForHexRegExp = new RegExp(\"^[0-9a-fA-F]{24}$\");\nvar hasBufferType = false;\n\n// Check if buffer exists\ntry {\n if(Buffer && Buffer.from) hasBufferType = true;\n} catch(err) {};\n\n/**\n* Create a new ObjectID instance\n*\n* @class\n* @param {(string|number)} id Can be a 24 byte hex string, 12 byte binary string or a Number.\n* @property {number} generationTime The generation time of this ObjectId instance\n* @return {ObjectID} instance of ObjectID.\n*/\nvar ObjectID = function ObjectID(id) {\n // Duck-typing to support ObjectId from different npm packages\n if(id instanceof ObjectID) return id;\n if(!(this instanceof ObjectID)) return new ObjectID(id);\n\n this._bsontype = 'ObjectID';\n\n // The most common usecase (blank id, new objectId instance)\n if(id == null || typeof id == 'number') {\n // Generate a new id\n this.id = this.generate(id);\n // If we are caching the hex string\n if(ObjectID.cacheHexString) this.__id = this.toString('hex');\n // Return the object\n return;\n }\n\n // Check if the passed in id is valid\n var valid = ObjectID.isValid(id);\n\n // Throw an error if it's not a valid setup\n if(!valid && id != null){\n throw new Error(\"Argument passed in must be a single String of 12 bytes or a string of 24 hex characters\");\n } else if(valid && typeof id == 'string' && id.length == 24 && hasBufferType) {\n return new ObjectID(new Buffer(id, 'hex'));\n } else if(valid && typeof id == 'string' && id.length == 24) {\n return ObjectID.createFromHexString(id);\n } else if(id != null && id.length === 12) {\n // assume 12 byte string\n this.id = id;\n } else if(id != null && id.toHexString) {\n // Duck-typing to support ObjectId from different npm packages\n return id;\n } else {\n throw new Error(\"Argument passed in must be a single String of 12 bytes or a string of 24 hex characters\");\n }\n\n if(ObjectID.cacheHexString) this.__id = this.toString('hex');\n};\n\n// Allow usage of ObjectId as well as ObjectID\nvar ObjectId = ObjectID;\n\n// Precomputed hex table enables speedy hex string conversion\nvar hexTable = [];\nfor (var i = 0; i < 256; i++) {\n hexTable[i] = (i <= 15 ? '0' : '') + i.toString(16);\n}\n\n/**\n* Return the ObjectID id as a 24 byte hex string representation\n*\n* @method\n* @return {string} return the 24 byte hex string representation.\n*/\nObjectID.prototype.toHexString = function() {\n if(ObjectID.cacheHexString && this.__id) return this.__id;\n\n var hexString = '';\n if(!this.id || !this.id.length) {\n throw new Error('invalid ObjectId, ObjectId.id must be either a string or a Buffer, but is [' + JSON.stringify(this.id) + ']');\n }\n\n if(this.id instanceof _Buffer) {\n hexString = convertToHex(this.id);\n if(ObjectID.cacheHexString) this.__id = hexString;\n return hexString;\n }\n\n for (var i = 0; i < this.id.length; i++) {\n hexString += hexTable[this.id.charCodeAt(i)];\n }\n\n if(ObjectID.cacheHexString) this.__id = hexString;\n return hexString;\n};\n\n/**\n* Update the ObjectID index used in generating new ObjectID's on the driver\n*\n* @method\n* @return {number} returns next index value.\n* @ignore\n*/\nObjectID.prototype.get_inc = function() {\n return ObjectID.index = (ObjectID.index + 1) % 0xFFFFFF;\n};\n\n/**\n* Update the ObjectID index used in generating new ObjectID's on the driver\n*\n* @method\n* @return {number} returns next index value.\n* @ignore\n*/\nObjectID.prototype.getInc = function() {\n return this.get_inc();\n};\n\n/**\n* Generate a 12 byte id buffer used in ObjectID's\n*\n* @method\n* @param {number} [time] optional parameter allowing to pass in a second based timestamp.\n* @return {Buffer} return the 12 byte id buffer string.\n*/\nObjectID.prototype.generate = function(time) {\n if ('number' != typeof time) {\n time = ~~(Date.now()/1000);\n }\n\n // Use pid\n var pid = (typeof process === 'undefined' ? Math.floor(Math.random() * 100000) : process.pid) % 0xFFFF;\n var inc = this.get_inc();\n // Buffer used\n var buffer = new Buffer(12);\n // Encode time\n buffer[3] = time & 0xff;\n buffer[2] = (time >> 8) & 0xff;\n buffer[1] = (time >> 16) & 0xff;\n buffer[0] = (time >> 24) & 0xff;\n // Encode machine\n buffer[6] = MACHINE_ID & 0xff;\n buffer[5] = (MACHINE_ID >> 8) & 0xff;\n buffer[4] = (MACHINE_ID >> 16) & 0xff;\n // Encode pid\n buffer[8] = pid & 0xff;\n buffer[7] = (pid >> 8) & 0xff;\n // Encode index\n buffer[11] = inc & 0xff;\n buffer[10] = (inc >> 8) & 0xff;\n buffer[9] = (inc >> 16) & 0xff;\n // Return the buffer\n return buffer;\n};\n\n/**\n* Converts the id into a 24 byte hex string for printing\n*\n* @param {String} format The Buffer toString format parameter.\n* @return {String} return the 24 byte hex string representation.\n* @ignore\n*/\nObjectID.prototype.toString = function(format) {\n // Is the id a buffer then use the buffer toString method to return the format\n if(this.id && this.id.copy) {\n return this.id.toString(typeof format === 'string' ? format : 'hex');\n }\n\n // if(this.buffer )\n return this.toHexString();\n};\n\n/**\n* Converts to a string representation of this Id.\n*\n* @return {String} return the 24 byte hex string representation.\n* @ignore\n*/\nObjectID.prototype.inspect = ObjectID.prototype.toString;\n\n/**\n* Converts to its JSON representation.\n*\n* @return {String} return the 24 byte hex string representation.\n* @ignore\n*/\nObjectID.prototype.toJSON = function() {\n return this.toHexString();\n};\n\n/**\n* Compares the equality of this ObjectID with `otherID`.\n*\n* @method\n* @param {object} otherID ObjectID instance to compare against.\n* @return {boolean} the result of comparing two ObjectID's\n*/\nObjectID.prototype.equals = function equals (otherId) {\n var id;\n\n if(otherId instanceof ObjectID) {\n return this.toString() == otherId.toString();\n } else if(typeof otherId == 'string' && ObjectID.isValid(otherId) && otherId.length == 12 && this.id instanceof _Buffer) {\n return otherId === this.id.toString('binary');\n } else if(typeof otherId == 'string' && ObjectID.isValid(otherId) && otherId.length == 24) {\n return otherId.toLowerCase() === this.toHexString();\n } else if(typeof otherId == 'string' && ObjectID.isValid(otherId) && otherId.length == 12) {\n return otherId === this.id;\n } else if(otherId != null && (otherId instanceof ObjectID || otherId.toHexString)) {\n return otherId.toHexString() === this.toHexString();\n } else {\n return false;\n }\n}\n\n/**\n* Returns the generation date (accurate up to the second) that this ID was generated.\n*\n* @method\n* @return {date} the generation date\n*/\nObjectID.prototype.getTimestamp = function() {\n var timestamp = new Date();\n var time = this.id[3] | this.id[2] << 8 | this.id[1] << 16 | this.id[0] << 24;\n timestamp.setTime(Math.floor(time) * 1000);\n return timestamp;\n}\n\n/**\n* @ignore\n*/\nObjectID.index = ~~(Math.random() * 0xFFFFFF);\n\n/**\n* @ignore\n*/\nObjectID.createPk = function createPk () {\n return new ObjectID();\n};\n\n/**\n* Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID.\n*\n* @method\n* @param {number} time an integer number representing a number of seconds.\n* @return {ObjectID} return the created ObjectID\n*/\nObjectID.createFromTime = function createFromTime (time) {\n var buffer = new Buffer([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);\n // Encode time into first 4 bytes\n buffer[3] = time & 0xff;\n buffer[2] = (time >> 8) & 0xff;\n buffer[1] = (time >> 16) & 0xff;\n buffer[0] = (time >> 24) & 0xff;\n // Return the new objectId\n return new ObjectID(buffer);\n};\n\n// Lookup tables\nvar encodeLookup = '0123456789abcdef'.split('')\nvar decodeLookup = []\nvar i = 0\nwhile (i < 10) decodeLookup[0x30 + i] = i++\nwhile (i < 16) decodeLookup[0x41 - 10 + i] = decodeLookup[0x61 - 10 + i] = i++\n\nvar _Buffer = Buffer;\nvar convertToHex = function(bytes) {\n return bytes.toString('hex');\n}\n\n/**\n* Creates an ObjectID from a hex string representation of an ObjectID.\n*\n* @method\n* @param {string} hexString create a ObjectID from a passed in 24 byte hexstring.\n* @return {ObjectID} return the created ObjectID\n*/\nObjectID.createFromHexString = function createFromHexString (string) {\n // Throw an error if it's not a valid setup\n if(typeof string === 'undefined' || string != null && string.length != 24) {\n throw new Error(\"Argument passed in must be a single String of 12 bytes or a string of 24 hex characters\");\n }\n\n // Use Buffer.from method if available\n if(hasBufferType) return new ObjectID(new Buffer(string, 'hex'));\n\n // Calculate lengths\n var array = new _Buffer(12);\n var n = 0;\n var i = 0;\n\n while (i < 24) {\n array[n++] = decodeLookup[string.charCodeAt(i++)] << 4 | decodeLookup[string.charCodeAt(i++)]\n }\n\n return new ObjectID(array);\n};\n\n/**\n* Checks if a value is a valid bson ObjectId\n*\n* @method\n* @return {boolean} return true if the value is a valid bson ObjectId, return false otherwise.\n*/\nObjectID.isValid = function isValid(id) {\n if(id == null) return false;\n\n if(typeof id == 'number') {\n return true;\n }\n\n if(typeof id == 'string') {\n return id.length == 12 || (id.length == 24 && checkForHexRegExp.test(id));\n }\n\n if(id instanceof ObjectID) {\n return true;\n }\n\n if(id instanceof _Buffer) {\n return true;\n }\n\n // Duck-Typing detection of ObjectId like objects\n if(id.toHexString) {\n return id.id.length == 12 || (id.id.length == 24 && checkForHexRegExp.test(id.id));\n }\n\n return false;\n};\n\n/**\n* @ignore\n*/\nObject.defineProperty(ObjectID.prototype, \"generationTime\", {\n enumerable: true\n , get: function () {\n return this.id[3] | this.id[2] << 8 | this.id[1] << 16 | this.id[0] << 24;\n }\n , set: function (value) {\n // Encode time into first 4 bytes\n this.id[3] = value & 0xff;\n this.id[2] = (value >> 8) & 0xff;\n this.id[1] = (value >> 16) & 0xff;\n this.id[0] = (value >> 24) & 0xff;\n }\n});\n\n/**\n * Expose.\n */\nmodule.exports = ObjectID;\nmodule.exports.ObjectID = ObjectID;\nmodule.exports.ObjectId = ObjectID;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/objectid.js","/**\n * A class representation of the BSON RegExp type.\n *\n * @class\n * @return {BSONRegExp} A MinKey instance\n */\nfunction BSONRegExp(pattern, options) {\n if(!(this instanceof BSONRegExp)) return new BSONRegExp();\n\n // Execute\n this._bsontype = 'BSONRegExp';\n this.pattern = pattern || '';\n this.options = options || '';\n\n // Validate options\n for(var i = 0; i < this.options.length; i++) {\n if(!(this.options[i] == 'i'\n || this.options[i] == 'm'\n || this.options[i] == 'x'\n || this.options[i] == 'l'\n || this.options[i] == 's'\n || this.options[i] == 'u'\n )) {\n throw new Error('the regular expression options [' + this.options[i] + \"] is not supported\");\n }\n }\n}\n\nmodule.exports = BSONRegExp;\nmodule.exports.BSONRegExp = BSONRegExp;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/regexp.js","/**\n * A class representation of the BSON Symbol type.\n *\n * @class\n * @deprecated\n * @param {string} value the string representing the symbol.\n * @return {Symbol}\n */\nfunction Symbol(value) {\n if(!(this instanceof Symbol)) return new Symbol(value);\n this._bsontype = 'Symbol';\n this.value = value;\n}\n\n/**\n * Access the wrapped string value.\n *\n * @method\n * @return {String} returns the wrapped string.\n */\nSymbol.prototype.valueOf = function() {\n return this.value;\n};\n\n/**\n * @ignore\n */\nSymbol.prototype.toString = function() {\n return this.value;\n}\n\n/**\n * @ignore\n */\nSymbol.prototype.inspect = function() {\n return this.value;\n}\n\n/**\n * @ignore\n */\nSymbol.prototype.toJSON = function() {\n return this.value;\n}\n\nmodule.exports = Symbol;\nmodule.exports.Symbol = Symbol;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/symbol.js","// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n// Copyright 2009 Google Inc. All Rights Reserved\n\n/**\n * This type is for INTERNAL use in MongoDB only and should not be used in applications.\n * The appropriate corresponding type is the JavaScript Date type.\n * \n * Defines a Timestamp class for representing a 64-bit two's-complement\n * integer value, which faithfully simulates the behavior of a Java \"Timestamp\". This\n * implementation is derived from TimestampLib in GWT.\n *\n * Constructs a 64-bit two's-complement integer, given its low and high 32-bit\n * values as *signed* integers. See the from* functions below for more\n * convenient ways of constructing Timestamps.\n *\n * The internal representation of a Timestamp is the two given signed, 32-bit values.\n * We use 32-bit pieces because these are the size of integers on which\n * Javascript performs bit-operations. For operations like addition and\n * multiplication, we split each number into 16-bit pieces, which can easily be\n * multiplied within Javascript's floating-point representation without overflow\n * or change in sign.\n *\n * In the algorithms below, we frequently reduce the negative case to the\n * positive case by negating the input(s) and then post-processing the result.\n * Note that we must ALWAYS check specially whether those values are MIN_VALUE\n * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\n * a positive number, it overflows back into a negative). Not handling this\n * case would often result in infinite recursion.\n *\n * @class\n * @param {number} low the low (signed) 32 bits of the Timestamp.\n * @param {number} high the high (signed) 32 bits of the Timestamp.\n */\nfunction Timestamp(low, high) {\n if(!(this instanceof Timestamp)) return new Timestamp(low, high);\n this._bsontype = 'Timestamp';\n /**\n * @type {number}\n * @ignore\n */\n this.low_ = low | 0; // force into 32 signed bits.\n\n /**\n * @type {number}\n * @ignore\n */\n this.high_ = high | 0; // force into 32 signed bits.\n};\n\n/**\n * Return the int value.\n *\n * @return {number} the value, assuming it is a 32-bit integer.\n */\nTimestamp.prototype.toInt = function() {\n return this.low_;\n};\n\n/**\n * Return the Number value.\n *\n * @method\n * @return {number} the closest floating-point representation to this value.\n */\nTimestamp.prototype.toNumber = function() {\n return this.high_ * Timestamp.TWO_PWR_32_DBL_ +\n this.getLowBitsUnsigned();\n};\n\n/**\n * Return the JSON value.\n *\n * @method\n * @return {string} the JSON representation.\n */\nTimestamp.prototype.toJSON = function() {\n return this.toString();\n}\n\n/**\n * Return the String value.\n *\n * @method\n * @param {number} [opt_radix] the radix in which the text should be written.\n * @return {string} the textual representation of this value.\n */\nTimestamp.prototype.toString = function(opt_radix) {\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (this.isZero()) {\n return '0';\n }\n\n if (this.isNegative()) {\n if (this.equals(Timestamp.MIN_VALUE)) {\n // We need to change the Timestamp value before it can be negated, so we remove\n // the bottom-most digit in this base and then recurse to do the rest.\n var radixTimestamp = Timestamp.fromNumber(radix);\n var div = this.div(radixTimestamp);\n var rem = div.multiply(radixTimestamp).subtract(this);\n return div.toString(radix) + rem.toInt().toString(radix);\n } else {\n return '-' + this.negate().toString(radix);\n }\n }\n\n // Do several (6) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Timestamp.fromNumber(Math.pow(radix, 6));\n\n var rem = this;\n var result = '';\n while (true) {\n var remDiv = rem.div(radixToPower);\n var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt();\n var digits = intval.toString(radix);\n\n rem = remDiv;\n if (rem.isZero()) {\n return digits + result;\n } else {\n while (digits.length < 6) {\n digits = '0' + digits;\n }\n result = '' + digits + result;\n }\n }\n};\n\n/**\n * Return the high 32-bits value.\n *\n * @method\n * @return {number} the high 32-bits as a signed value.\n */\nTimestamp.prototype.getHighBits = function() {\n return this.high_;\n};\n\n/**\n * Return the low 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as a signed value.\n */\nTimestamp.prototype.getLowBits = function() {\n return this.low_;\n};\n\n/**\n * Return the low unsigned 32-bits value.\n *\n * @method\n * @return {number} the low 32-bits as an unsigned value.\n */\nTimestamp.prototype.getLowBitsUnsigned = function() {\n return (this.low_ >= 0) ?\n this.low_ : Timestamp.TWO_PWR_32_DBL_ + this.low_;\n};\n\n/**\n * Returns the number of bits needed to represent the absolute value of this Timestamp.\n *\n * @method\n * @return {number} Returns the number of bits needed to represent the absolute value of this Timestamp.\n */\nTimestamp.prototype.getNumBitsAbs = function() {\n if (this.isNegative()) {\n if (this.equals(Timestamp.MIN_VALUE)) {\n return 64;\n } else {\n return this.negate().getNumBitsAbs();\n }\n } else {\n var val = this.high_ != 0 ? this.high_ : this.low_;\n for (var bit = 31; bit > 0; bit--) {\n if ((val & (1 << bit)) != 0) {\n break;\n }\n }\n return this.high_ != 0 ? bit + 33 : bit + 1;\n }\n};\n\n/**\n * Return whether this value is zero.\n *\n * @method\n * @return {boolean} whether this value is zero.\n */\nTimestamp.prototype.isZero = function() {\n return this.high_ == 0 && this.low_ == 0;\n};\n\n/**\n * Return whether this value is negative.\n *\n * @method\n * @return {boolean} whether this value is negative.\n */\nTimestamp.prototype.isNegative = function() {\n return this.high_ < 0;\n};\n\n/**\n * Return whether this value is odd.\n *\n * @method\n * @return {boolean} whether this value is odd.\n */\nTimestamp.prototype.isOdd = function() {\n return (this.low_ & 1) == 1;\n};\n\n/**\n * Return whether this Timestamp equals the other\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp equals the other\n */\nTimestamp.prototype.equals = function(other) {\n return (this.high_ == other.high_) && (this.low_ == other.low_);\n};\n\n/**\n * Return whether this Timestamp does not equal the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp does not equal the other.\n */\nTimestamp.prototype.notEquals = function(other) {\n return (this.high_ != other.high_) || (this.low_ != other.low_);\n};\n\n/**\n * Return whether this Timestamp is less than the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is less than the other.\n */\nTimestamp.prototype.lessThan = function(other) {\n return this.compare(other) < 0;\n};\n\n/**\n * Return whether this Timestamp is less than or equal to the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is less than or equal to the other.\n */\nTimestamp.prototype.lessThanOrEqual = function(other) {\n return this.compare(other) <= 0;\n};\n\n/**\n * Return whether this Timestamp is greater than the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is greater than the other.\n */\nTimestamp.prototype.greaterThan = function(other) {\n return this.compare(other) > 0;\n};\n\n/**\n * Return whether this Timestamp is greater than or equal to the other.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} whether this Timestamp is greater than or equal to the other.\n */\nTimestamp.prototype.greaterThanOrEqual = function(other) {\n return this.compare(other) >= 0;\n};\n\n/**\n * Compares this Timestamp with the given one.\n *\n * @method\n * @param {Timestamp} other Timestamp to compare against.\n * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater.\n */\nTimestamp.prototype.compare = function(other) {\n if (this.equals(other)) {\n return 0;\n }\n\n var thisNeg = this.isNegative();\n var otherNeg = other.isNegative();\n if (thisNeg && !otherNeg) {\n return -1;\n }\n if (!thisNeg && otherNeg) {\n return 1;\n }\n\n // at this point, the signs are the same, so subtraction will not overflow\n if (this.subtract(other).isNegative()) {\n return -1;\n } else {\n return 1;\n }\n};\n\n/**\n * The negation of this value.\n *\n * @method\n * @return {Timestamp} the negation of this value.\n */\nTimestamp.prototype.negate = function() {\n if (this.equals(Timestamp.MIN_VALUE)) {\n return Timestamp.MIN_VALUE;\n } else {\n return this.not().add(Timestamp.ONE);\n }\n};\n\n/**\n * Returns the sum of this and the given Timestamp.\n *\n * @method\n * @param {Timestamp} other Timestamp to add to this one.\n * @return {Timestamp} the sum of this and the given Timestamp.\n */\nTimestamp.prototype.add = function(other) {\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 + b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 + b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 + b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 + b48;\n c48 &= 0xFFFF;\n return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32);\n};\n\n/**\n * Returns the difference of this and the given Timestamp.\n *\n * @method\n * @param {Timestamp} other Timestamp to subtract from this.\n * @return {Timestamp} the difference of this and the given Timestamp.\n */\nTimestamp.prototype.subtract = function(other) {\n return this.add(other.negate());\n};\n\n/**\n * Returns the product of this and the given Timestamp.\n *\n * @method\n * @param {Timestamp} other Timestamp to multiply with this.\n * @return {Timestamp} the product of this and the other.\n */\nTimestamp.prototype.multiply = function(other) {\n if (this.isZero()) {\n return Timestamp.ZERO;\n } else if (other.isZero()) {\n return Timestamp.ZERO;\n }\n\n if (this.equals(Timestamp.MIN_VALUE)) {\n return other.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO;\n } else if (other.equals(Timestamp.MIN_VALUE)) {\n return this.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().multiply(other.negate());\n } else {\n return this.negate().multiply(other).negate();\n }\n } else if (other.isNegative()) {\n return this.multiply(other.negate()).negate();\n }\n\n // If both Timestamps are small, use float multiplication\n if (this.lessThan(Timestamp.TWO_PWR_24_) &&\n other.lessThan(Timestamp.TWO_PWR_24_)) {\n return Timestamp.fromNumber(this.toNumber() * other.toNumber());\n }\n\n // Divide each Timestamp into 4 chunks of 16 bits, and then add up 4x4 products.\n // We can skip products that would overflow.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 * b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 * b00;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c16 += a00 * b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 * b00;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a16 * b16;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a00 * b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\n c48 &= 0xFFFF;\n return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32);\n};\n\n/**\n * Returns this Timestamp divided by the given one.\n *\n * @method\n * @param {Timestamp} other Timestamp by which to divide.\n * @return {Timestamp} this Timestamp divided by the given one.\n */\nTimestamp.prototype.div = function(other) {\n if (other.isZero()) {\n throw Error('division by zero');\n } else if (this.isZero()) {\n return Timestamp.ZERO;\n }\n\n if (this.equals(Timestamp.MIN_VALUE)) {\n if (other.equals(Timestamp.ONE) ||\n other.equals(Timestamp.NEG_ONE)) {\n return Timestamp.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\n } else if (other.equals(Timestamp.MIN_VALUE)) {\n return Timestamp.ONE;\n } else {\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\n var halfThis = this.shiftRight(1);\n var approx = halfThis.div(other).shiftLeft(1);\n if (approx.equals(Timestamp.ZERO)) {\n return other.isNegative() ? Timestamp.ONE : Timestamp.NEG_ONE;\n } else {\n var rem = this.subtract(other.multiply(approx));\n var result = approx.add(rem.div(other));\n return result;\n }\n }\n } else if (other.equals(Timestamp.MIN_VALUE)) {\n return Timestamp.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().div(other.negate());\n } else {\n return this.negate().div(other).negate();\n }\n } else if (other.isNegative()) {\n return this.div(other.negate()).negate();\n }\n\n // Repeat the following until the remainder is less than other: find a\n // floating-point that approximates remainder / other *from below*, add this\n // into the result, and subtract it from the remainder. It is critical that\n // the approximate value is less than or equal to the real value so that the\n // remainder never becomes negative.\n var res = Timestamp.ZERO;\n var rem = this;\n while (rem.greaterThanOrEqual(other)) {\n // Approximate the result of division. This may be a little greater or\n // smaller than the actual value.\n var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber()));\n\n // We will tweak the approximate result by changing it in the 48-th digit or\n // the smallest non-fractional digit, whichever is larger.\n var log2 = Math.ceil(Math.log(approx) / Math.LN2);\n var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48);\n\n // Decrease the approximation until it is smaller than the remainder. Note\n // that if it is too large, the product overflows and is negative.\n var approxRes = Timestamp.fromNumber(approx);\n var approxRem = approxRes.multiply(other);\n while (approxRem.isNegative() || approxRem.greaterThan(rem)) {\n approx -= delta;\n approxRes = Timestamp.fromNumber(approx);\n approxRem = approxRes.multiply(other);\n }\n\n // We know the answer can't be zero... and actually, zero would cause\n // infinite recursion since we would make no progress.\n if (approxRes.isZero()) {\n approxRes = Timestamp.ONE;\n }\n\n res = res.add(approxRes);\n rem = rem.subtract(approxRem);\n }\n return res;\n};\n\n/**\n * Returns this Timestamp modulo the given one.\n *\n * @method\n * @param {Timestamp} other Timestamp by which to mod.\n * @return {Timestamp} this Timestamp modulo the given one.\n */\nTimestamp.prototype.modulo = function(other) {\n return this.subtract(this.div(other).multiply(other));\n};\n\n/**\n * The bitwise-NOT of this value.\n *\n * @method\n * @return {Timestamp} the bitwise-NOT of this value.\n */\nTimestamp.prototype.not = function() {\n return Timestamp.fromBits(~this.low_, ~this.high_);\n};\n\n/**\n * Returns the bitwise-AND of this Timestamp and the given one.\n *\n * @method\n * @param {Timestamp} other the Timestamp with which to AND.\n * @return {Timestamp} the bitwise-AND of this and the other.\n */\nTimestamp.prototype.and = function(other) {\n return Timestamp.fromBits(this.low_ & other.low_, this.high_ & other.high_);\n};\n\n/**\n * Returns the bitwise-OR of this Timestamp and the given one.\n *\n * @method\n * @param {Timestamp} other the Timestamp with which to OR.\n * @return {Timestamp} the bitwise-OR of this and the other.\n */\nTimestamp.prototype.or = function(other) {\n return Timestamp.fromBits(this.low_ | other.low_, this.high_ | other.high_);\n};\n\n/**\n * Returns the bitwise-XOR of this Timestamp and the given one.\n *\n * @method\n * @param {Timestamp} other the Timestamp with which to XOR.\n * @return {Timestamp} the bitwise-XOR of this and the other.\n */\nTimestamp.prototype.xor = function(other) {\n return Timestamp.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_);\n};\n\n/**\n * Returns this Timestamp with bits shifted to the left by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Timestamp} this shifted to the left by the given amount.\n */\nTimestamp.prototype.shiftLeft = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var low = this.low_;\n if (numBits < 32) {\n var high = this.high_;\n return Timestamp.fromBits(\n low << numBits,\n (high << numBits) | (low >>> (32 - numBits)));\n } else {\n return Timestamp.fromBits(0, low << (numBits - 32));\n }\n }\n};\n\n/**\n * Returns this Timestamp with bits shifted to the right by the given amount.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Timestamp} this shifted to the right by the given amount.\n */\nTimestamp.prototype.shiftRight = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Timestamp.fromBits(\n (low >>> numBits) | (high << (32 - numBits)),\n high >> numBits);\n } else {\n return Timestamp.fromBits(\n high >> (numBits - 32),\n high >= 0 ? 0 : -1);\n }\n }\n};\n\n/**\n * Returns this Timestamp with bits shifted to the right by the given amount, with the new top bits matching the current sign bit.\n *\n * @method\n * @param {number} numBits the number of bits by which to shift.\n * @return {Timestamp} this shifted to the right by the given amount, with zeros placed into the new leading bits.\n */\nTimestamp.prototype.shiftRightUnsigned = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Timestamp.fromBits(\n (low >>> numBits) | (high << (32 - numBits)),\n high >>> numBits);\n } else if (numBits == 32) {\n return Timestamp.fromBits(high, 0);\n } else {\n return Timestamp.fromBits(high >>> (numBits - 32), 0);\n }\n }\n};\n\n/**\n * Returns a Timestamp representing the given (32-bit) integer value.\n *\n * @method\n * @param {number} value the 32-bit integer in question.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromInt = function(value) {\n if (-128 <= value && value < 128) {\n var cachedObj = Timestamp.INT_CACHE_[value];\n if (cachedObj) {\n return cachedObj;\n }\n }\n\n var obj = new Timestamp(value | 0, value < 0 ? -1 : 0);\n if (-128 <= value && value < 128) {\n Timestamp.INT_CACHE_[value] = obj;\n }\n return obj;\n};\n\n/**\n * Returns a Timestamp representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n *\n * @method\n * @param {number} value the number in question.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromNumber = function(value) {\n if (isNaN(value) || !isFinite(value)) {\n return Timestamp.ZERO;\n } else if (value <= -Timestamp.TWO_PWR_63_DBL_) {\n return Timestamp.MIN_VALUE;\n } else if (value + 1 >= Timestamp.TWO_PWR_63_DBL_) {\n return Timestamp.MAX_VALUE;\n } else if (value < 0) {\n return Timestamp.fromNumber(-value).negate();\n } else {\n return new Timestamp(\n (value % Timestamp.TWO_PWR_32_DBL_) | 0,\n (value / Timestamp.TWO_PWR_32_DBL_) | 0);\n }\n};\n\n/**\n * Returns a Timestamp representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits.\n *\n * @method\n * @param {number} lowBits the low 32-bits.\n * @param {number} highBits the high 32-bits.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromBits = function(lowBits, highBits) {\n return new Timestamp(lowBits, highBits);\n};\n\n/**\n * Returns a Timestamp representation of the given string, written using the given radix.\n *\n * @method\n * @param {string} str the textual representation of the Timestamp.\n * @param {number} opt_radix the radix in which the text is written.\n * @return {Timestamp} the corresponding Timestamp value.\n */\nTimestamp.fromString = function(str, opt_radix) {\n if (str.length == 0) {\n throw Error('number format error: empty string');\n }\n\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (str.charAt(0) == '-') {\n return Timestamp.fromString(str.substring(1), radix).negate();\n } else if (str.indexOf('-') >= 0) {\n throw Error('number format error: interior \"-\" character: ' + str);\n }\n\n // Do several (8) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Timestamp.fromNumber(Math.pow(radix, 8));\n\n var result = Timestamp.ZERO;\n for (var i = 0; i < str.length; i += 8) {\n var size = Math.min(8, str.length - i);\n var value = parseInt(str.substring(i, i + size), radix);\n if (size < 8) {\n var power = Timestamp.fromNumber(Math.pow(radix, size));\n result = result.multiply(power).add(Timestamp.fromNumber(value));\n } else {\n result = result.multiply(radixToPower);\n result = result.add(Timestamp.fromNumber(value));\n }\n }\n return result;\n};\n\n// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the\n// from* methods on which they depend.\n\n\n/**\n * A cache of the Timestamp representations of small integer values.\n * @type {Object}\n * @ignore\n */\nTimestamp.INT_CACHE_ = {};\n\n// NOTE: the compiler should inline these constant values below and then remove\n// these variables, so there should be no runtime penalty for these.\n\n/**\n * Number used repeated below in calculations. This must appear before the\n * first call to any from* function below.\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_16_DBL_ = 1 << 16;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_24_DBL_ = 1 << 24;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_32_DBL_ = Timestamp.TWO_PWR_16_DBL_ * Timestamp.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_31_DBL_ = Timestamp.TWO_PWR_32_DBL_ / 2;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_48_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_16_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_64_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_32_DBL_;\n\n/**\n * @type {number}\n * @ignore\n */\nTimestamp.TWO_PWR_63_DBL_ = Timestamp.TWO_PWR_64_DBL_ / 2;\n\n/** @type {Timestamp} */\nTimestamp.ZERO = Timestamp.fromInt(0);\n\n/** @type {Timestamp} */\nTimestamp.ONE = Timestamp.fromInt(1);\n\n/** @type {Timestamp} */\nTimestamp.NEG_ONE = Timestamp.fromInt(-1);\n\n/** @type {Timestamp} */\nTimestamp.MAX_VALUE =\n Timestamp.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0);\n\n/** @type {Timestamp} */\nTimestamp.MIN_VALUE = Timestamp.fromBits(0, 0x80000000 | 0);\n\n/**\n * @type {Timestamp}\n * @ignore\n */\nTimestamp.TWO_PWR_24_ = Timestamp.fromInt(1 << 24);\n\n/**\n * Expose.\n */\nmodule.exports = Timestamp;\nmodule.exports.Timestamp = Timestamp;\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/timestamp.js","import { StitchError } from './errors';\n\nexport const JSONTYPE = 'application/json';\nexport const APP_CLIENT_TYPE = 'app';\nexport const ADMIN_CLIENT_TYPE = 'admin';\nexport const DEFAULT_STITCH_SERVER_URL = 'https://stitch.mongodb.com';\n\n// VERSION is substituted with the package.json version number at build time\nlet version = 'unknown';\nif (typeof VERSION !== 'undefined') {\n version = VERSION;\n}\nexport const SDK_VERSION = version;\n\nexport const checkStatus = (response) => {\n if (response.status >= 200 && response.status < 300) {\n return response;\n }\n\n if (response.headers.get('Content-Type') === JSONTYPE) {\n return response.json()\n .then(json => {\n const error = new StitchError(json.error, json.error_code);\n error.response = response;\n error.json = json;\n return Promise.reject(error);\n });\n }\n\n const error = new Error(response.statusText);\n error.response = response;\n return Promise.reject(error);\n};\n\nexport const makeFetchArgs = (method, body) => {\n const init = {\n method: method,\n headers: { 'Accept': JSONTYPE, 'Content-Type': JSONTYPE }\n };\n\n if (body) {\n init.body = body;\n }\n\n init.cors = true;\n return init;\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/common.js","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 17\n// module chunks = 0","var Int32 = function(value) {\n if(!(this instanceof Int32)) return new Int32(value);\n\n this._bsontype = 'Int32';\n this.value = value;\n}\n\n/**\n * Access the number value.\n *\n * @method\n * @return {number} returns the wrapped int32 number.\n */\nInt32.prototype.valueOf = function() {\n return this.value;\n};\n\n/**\n * @ignore\n */\nInt32.prototype.toJSON = function() {\n return this.value;\n}\n\nmodule.exports = Int32;\nmodule.exports.Int32 = Int32;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/int_32.js","/**\n * Creates a new StitchError\n *\n * @class\n * @augments Error\n * @param {String} message The error message.\n * @param {Object} code The error code.\n * @return {StitchError} A StitchError instance.\n */\nclass StitchError extends Error {\n constructor(message, code) {\n super(message);\n this.name = 'StitchError';\n this.message = message;\n if (code !== undefined) {\n this.code = code;\n }\n\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(this, this.constructor);\n } else {\n this.stack = (new Error(message)).stack;\n }\n }\n}\n\nconst ErrAuthProviderNotFound = 'AuthProviderNotFound';\nconst ErrInvalidSession = 'InvalidSession';\nconst ErrUnauthorized = 'Unauthorized';\n\n\nexport {\n StitchError,\n ErrAuthProviderNotFound,\n ErrInvalidSession,\n ErrUnauthorized\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/errors.js","/* global window, fetch */\n/* eslint no-labels: ['error', { 'allowLoop': true }] */\nimport 'fetch-everywhere';\nimport { AuthFactory } from './auth';\nimport { PROVIDER_TYPE_ANON } from './auth/providers';\nimport { APP_CLIENT_CODEC } from './auth/common';\nimport ServiceRegistry from './services';\nimport * as common from './common';\nimport ExtJSON from 'mongodb-extjson';\nimport queryString from 'query-string';\nimport {\n StitchError,\n ErrInvalidSession,\n ErrUnauthorized\n} from './errors';\n\nconst v1 = 1;\nconst v2 = 2;\nconst v3 = 3;\nconst API_TYPE_PUBLIC = 'public';\nconst API_TYPE_PRIVATE = 'private';\nconst API_TYPE_CLIENT = 'client';\nconst API_TYPE_APP = 'app';\n\n/**\n * Factory class to create a new StitchClient asynchronously.\n */\nexport class StitchClientFactory {\n constructor() {\n throw new StitchError('StitchClient can only be made from the StitchClientFactory.create function');\n }\n\n static create(clientAppID, options = {}) {\n return newStitchClient(StitchClient.prototype, clientAppID, options);\n }\n}\n\nexport function newStitchClient(prototype, clientAppID, options = {}) {\n let stitchClient = Object.create(prototype);\n let baseUrl = common.DEFAULT_STITCH_SERVER_URL;\n if (options.baseUrl) {\n baseUrl = options.baseUrl;\n }\n\n stitchClient.clientAppID = clientAppID;\n\n stitchClient.authUrl = (\n clientAppID ?\n `${baseUrl}/api/client/v2.0/app/${clientAppID}/auth` :\n `${baseUrl}/api/admin/v3.0/auth`\n );\n\n stitchClient.rootURLsByAPIVersion = {\n [v1]: {\n [API_TYPE_PUBLIC]: `${baseUrl}/api/public/v1.0`,\n [API_TYPE_CLIENT]: `${baseUrl}/api/client/v1.0`,\n [API_TYPE_PRIVATE]: `${baseUrl}/api/private/v1.0`,\n [API_TYPE_APP]: (clientAppID ?\n `${baseUrl}/api/client/v1.0/app/${clientAppID}` :\n `${baseUrl}/api/public/v1.0`)\n },\n [v2]: {\n [API_TYPE_PUBLIC]: `${baseUrl}/api/public/v2.0`,\n [API_TYPE_CLIENT]: `${baseUrl}/api/client/v2.0`,\n [API_TYPE_PRIVATE]: `${baseUrl}/api/private/v2.0`,\n [API_TYPE_APP]: (clientAppID ?\n `${baseUrl}/api/client/v2.0/app/${clientAppID}` :\n `${baseUrl}/api/public/v2.0`)\n },\n [v3]: {\n [API_TYPE_PUBLIC]: `${baseUrl}/api/public/v3.0`,\n [API_TYPE_CLIENT]: `${baseUrl}/api/client/v3.0`,\n [API_TYPE_APP]: (clientAppID ?\n `${baseUrl}/api/client/v3.0/app/${clientAppID}` :\n `${baseUrl}/api/admin/v3.0`)\n }\n };\n\n const authOptions = {\n codec: APP_CLIENT_CODEC,\n storage: options.storage\n };\n\n if (options.storageType) {\n authOptions.storageType = options.storageType;\n }\n if (options.platform) {\n authOptions.platform = options.platform;\n }\n if (options.authCodec) {\n authOptions.codec = options.authCodec;\n }\n\n const authPromise = AuthFactory.create(stitchClient, stitchClient.authUrl, authOptions);\n return authPromise.then(auth => {\n stitchClient.auth = auth;\n return Promise.all([\n stitchClient.auth.handleRedirect(),\n stitchClient.auth.handleCookie()\n ]);\n }).then(() => stitchClient);\n}\n/**\n * Prototype for StitchClient class.\n * This is the internal implementation for StitchClient and should not\n * be exposed.\n *\n * @class\n */\nexport class StitchClient {\n constructor() {\n throw new StitchError('StitchClient can only be made from the StitchClientFactory.create function');\n }\n\n get type() {\n return common.APP_CLIENT_TYPE;\n }\n\n /**\n * Login to stitch instance, optionally providing a username and password. In\n * the event that these are omitted, anonymous authentication is used.\n *\n * @param {String} [email] the email address used for login\n * @param {String} [password] the password for the provided email address\n * @param {Object} [options] additional authentication options\n * @returns {Promise}\n */\n login(email, password, options = {}) {\n if (email === undefined || password === undefined) {\n return this.authenticate(PROVIDER_TYPE_ANON, options);\n }\n\n return this.authenticate('userpass', Object.assign({ username: email, password }, options));\n }\n\n /**\n * Send a request to the server indicating the provided email would like\n * to sign up for an account. This will trigger a confirmation email containing\n * a token which must be used with the `emailConfirm` method of the `userpass`\n * auth provider in order to complete registration. The user will not be able\n * to log in until that flow has been completed.\n *\n * @param {String} email the email used to sign up for the app\n * @param {String} password the password used to sign up for the app\n * @param {Object} [options] additional authentication options\n * @returns {Promise}\n */\n register(email, password, options = {}) {\n return this.auth.provider('userpass').register(email, password, options);\n }\n\n /**\n * Submits an authentication request to the specified provider providing any\n * included options (read: user data). If auth data already exists and the\n * existing auth data has an access token, then these credentials are returned.\n *\n * @param {String} providerType the provider used for authentication (e.g. 'userpass', 'facebook', 'google')\n * @param {Object} [options] additional authentication options\n * @returns {Promise} which resolves to a String value: the authed userId\n */\n authenticate(providerType, options = {}) {\n // reuse existing auth if present\n const authenticateFn = () =>\n this.auth.provider(providerType).authenticate(options).then(() => this.authedId());\n\n if (this.isAuthenticated()) {\n if (providerType === PROVIDER_TYPE_ANON && this.auth.getLoggedInProviderType() === PROVIDER_TYPE_ANON) {\n return Promise.resolve(this.auth.authedId); // is authenticated, skip log in\n }\n\n return this.logout().then(() => authenticateFn()); // will not be authenticated, continue log in\n }\n\n // is not authenticated, continue log in\n return authenticateFn();\n }\n\n /**\n * Ends the session for the current user.\n *\n * @returns {Promise}\n */\n logout() {\n return this._do(\n '/auth/session',\n 'DELETE',\n {\n refreshOnFailure: false,\n useRefreshToken: true,\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT]\n }\n ).then(() => this.auth.clear(), () => this.auth.clear());\n }\n\n /**\n * @return {*} Returns any error from the Stitch authentication system.\n */\n authError() {\n return this.auth.error();\n }\n\n /**\n * Returns profile information for the currently logged in user\n *\n * @returns {Promise}\n */\n userProfile() {\n return this._do(\n '/auth/profile',\n 'GET',\n {rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT]},\n ).then(response => response.json());\n }\n\n /**\n * @return {Boolean} whether or not the current client is authenticated\n */\n isAuthenticated() {\n return !!this.authedId();\n }\n\n /**\n * @return {String} Returns a string of the currently authed user's ID.\n */\n authedId() {\n return this.auth.authedId;\n }\n\n /**\n * Factory method for accessing Stitch services.\n *\n * @method\n * @param {String} type The service type [mongodb, {String}]\n * @param {String} name The service name.\n * @return {Object} returns a named service.\n */\n service(type, name) {\n if (this.constructor !== StitchClient) {\n throw new StitchError('`service` is a factory method, do not use `new`');\n }\n\n if (!ServiceRegistry.hasOwnProperty(type)) {\n throw new StitchError('Invalid service type specified: ' + type);\n }\n\n const ServiceType = ServiceRegistry[type];\n return new ServiceType(this, name);\n }\n\n /**\n * Executes a function.\n *\n * @param {String} name The name of the function.\n * @param {...*} args Arguments to pass to the function.\n */\n executeFunction(name, ...args) {\n return this._doFunctionCall({\n name,\n arguments: args\n });\n }\n\n /**\n * Executes a service function.\n *\n * @param {String} service The name of the service.\n * @param {String} action The name of the service action.\n * @param {...*} args Arguments to pass to the service action.\n */\n executeServiceFunction(service, action, ...args) {\n return this._doFunctionCall({\n service,\n name: action,\n arguments: args\n });\n }\n\n _doFunctionCall(request) {\n let responseDecoder = (d) => ExtJSON.parse(d, { strict: false });\n let responseEncoder = (d) => ExtJSON.stringify(d);\n\n return this._do('/functions/call', 'POST', { body: responseEncoder(request) })\n .then(response => response.text())\n .then(body => responseDecoder(body));\n }\n\n /**\n * Returns an access token for the user\n *\n * @returns {Promise}\n */\n doSessionPost() {\n return this._do(\n '/auth/session',\n 'POST',\n {\n refreshOnFailure: false,\n useRefreshToken: true,\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT]\n }\n )\n .then(response => response.json());\n }\n\n /**\n * Returns an array of api keys\n *\n * @returns {Promise}\n */\n getApiKeys() {\n return this._do(\n '/auth/api_keys',\n 'GET',\n {\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT],\n useRefreshToken: true\n },\n )\n .then((response) => response.json());\n }\n\n /**\n * Creates a user api key\n *\n * @param {String} userApiKeyName the user defined name of the userApiKey\n * @returns {Promise}\n */\n createApiKey(userApiKeyName) {\n return this._do(\n '/auth/api_keys',\n 'POST',\n { rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT],\n useRefreshToken: true,\n body: JSON.stringify({'name': userApiKeyName})\n },\n )\n .then((response) => response.json());\n }\n\n /**\n * Returns a user api key\n *\n * @param {String} keyID the ID of the key\n * @returns {Promise}\n */\n getApiKeyByID(keyID) {\n return this._do(\n `/auth/api_keys/${keyID}`,\n 'GET',\n {\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT],\n useRefreshToken: true\n },\n )\n .then((response) => response.json());\n }\n\n /**\n * Deletes a user api key\n *\n * @param {String} keyID the ID of the key\n * @returns {Promise}\n */\n deleteApiKeyByID(keyID) {\n return this._do(\n `/auth/api_keys/${keyID}`,\n 'DELETE',\n {\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT],\n useRefreshToken: true\n },\n );\n }\n\n /**\n * Enable a user api key\n *\n * @param {String} keyID the ID of the key\n * @returns {Promise}\n */\n enableApiKeyByID(keyID) {\n return this._do(\n `/auth/api_keys/${keyID}/enable`,\n 'PUT',\n {\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT],\n useRefreshToken: true\n },\n );\n }\n\n /**\n * Disable a user api key\n *\n * @param {String} keyID the ID of the key\n * @returns {Promise}\n */\n disableApiKeyByID(keyID) {\n return this._do(\n `/auth/api_keys/${keyID}/disable`,\n 'PUT',\n {\n rootURL: this.rootURLsByAPIVersion[v2][API_TYPE_CLIENT],\n useRefreshToken: true\n },\n );\n }\n\n _fetch(url, fetchArgs, resource, method, options) {\n return fetch(url, fetchArgs)\n .then(response => {\n // Okay: passthrough\n if (response.status >= 200 && response.status < 300) {\n return Promise.resolve(response);\n }\n\n if (response.headers.get('Content-Type') === common.JSONTYPE) {\n return response.json()\n .then(json => {\n // Only want to try refreshing token when there's an invalid session\n if ('error_code' in json && json.error_code === ErrInvalidSession) {\n if (!options.refreshOnFailure) {\n return this.auth.clear().then(() => {\n const error = new StitchError(json.error, json.error_code);\n error.response = response;\n error.json = json;\n throw error;\n });\n }\n\n return this.auth.refreshToken()\n .then(() => {\n options.refreshOnFailure = false;\n return this._do(resource, method, options);\n });\n }\n\n const error = new StitchError(json.error, json.error_code);\n error.response = response;\n error.json = json;\n return Promise.reject(error);\n });\n }\n\n const error = new Error(response.statusText);\n error.response = response;\n return Promise.reject(error);\n });\n }\n\n _fetchArgs(resource, method, options) {\n const appURL = this.rootURLsByAPIVersion[options.apiVersion][options.apiType];\n let url = `${appURL}${resource}`;\n if (options.rootURL) {\n url = `${options.rootURL}${resource}`;\n }\n let fetchArgs = common.makeFetchArgs(method, options.body);\n\n if (!!options.headers) {\n Object.assign(fetchArgs.headers, options.headers);\n }\n\n if (options.queryParams) {\n url = `${url}?${queryString.stringify(options.queryParams)}`;\n }\n\n return { url, fetchArgs };\n }\n\n _do(resource, method, options) {\n options = Object.assign({}, {\n refreshOnFailure: true,\n useRefreshToken: false,\n apiVersion: v2,\n apiType: API_TYPE_APP,\n rootURL: undefined\n }, options);\n\n let { url, fetchArgs } = this._fetchArgs(resource, method, options);\n if (options.noAuth) {\n return this._fetch(url, fetchArgs, resource, method, options);\n }\n\n if (!this.isAuthenticated()) {\n return Promise.reject(new StitchError('Must auth first', ErrUnauthorized));\n }\n const token =\n options.useRefreshToken ? this.auth.getRefreshToken() : this.auth.getAccessToken();\n\n // If access token is expired, proactively get a new one\n if (!options.useRefreshToken) {\n if (this.auth.isAccessTokenExpired()) {\n return this.auth.refreshToken().then(() => {\n options.refreshOnFailure = false;\n return this._do(resource, method, options);\n });\n }\n\n fetchArgs.headers.Authorization = `Bearer ${token}`;\n return this._fetch(url, fetchArgs, resource, method, options);\n }\n\n fetchArgs.headers.Authorization = `Bearer ${token}`;\n return this._fetch(url, fetchArgs, resource, method, options);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/client.js","var ExtJSON = require('./lib/ext_json');\n\nmodule.exports = ExtJSON;\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/index.js","\"use strict\"\n\n// We have an ES6 Map available, return the native instance\nif(typeof global.Map !== 'undefined') {\n module.exports = global.Map;\n module.exports.Map = global.Map;\n} else {\n // We will return a polyfill\n var Map = function(array) {\n this._keys = [];\n this._values = {};\n\n for(var i = 0; i < array.length; i++) {\n if(array[i] == null) continue; // skip null and undefined\n var entry = array[i];\n var key = entry[0];\n var value = entry[1];\n // Add the key to the list of keys in order\n this._keys.push(key);\n // Add the key and value to the values dictionary with a point\n // to the location in the ordered keys list\n this._values[key] = {v: value, i: this._keys.length - 1};\n }\n }\n\n Map.prototype.clear = function() {\n this._keys = [];\n this._values = {};\n }\n\n Map.prototype.delete = function(key) {\n var value = this._values[key];\n if(value == null) return false;\n // Delete entry\n delete this._values[key];\n // Remove the key from the ordered keys list\n this._keys.splice(value.i, 1);\n return true;\n }\n\n Map.prototype.entries = function() {\n var self = this;\n var index = 0;\n\n return {\n next: function() {\n var key = self._keys[index++];\n return {\n value: key !== undefined ? [key, self._values[key].v] : undefined,\n done: key !== undefined ? false : true\n }\n }\n };\n }\n\n Map.prototype.forEach = function(callback, self) {\n self = self || this;\n\n for(var i = 0; i < this._keys.length; i++) {\n var key = this._keys[i];\n // Call the forEach callback\n callback.call(self, this._values[key].v, key, self);\n }\n }\n\n Map.prototype.get = function(key) {\n return this._values[key] ? this._values[key].v : undefined;\n }\n\n Map.prototype.has = function(key) {\n return this._values[key] != null;\n }\n\n Map.prototype.keys = function(key) {\n var self = this;\n var index = 0;\n\n return {\n next: function() {\n var key = self._keys[index++];\n return {\n value: key !== undefined ? key : undefined,\n done: key !== undefined ? false : true\n }\n }\n };\n }\n\n Map.prototype.set = function(key, value) {\n if(this._values[key]) {\n this._values[key].v = value;\n return this;\n }\n\n // Add the key to the list of keys in order\n this._keys.push(key);\n // Add the key and value to the values dictionary with a point\n // to the location in the ordered keys list\n this._values[key] = {v: value, i: this._keys.length - 1};\n return this;\n }\n\n Map.prototype.values = function(key, value) {\n var self = this;\n var index = 0;\n\n return {\n next: function() {\n var key = self._keys[index++];\n return {\n value: key !== undefined ? self._values[key].v : undefined,\n done: key !== undefined ? false : true\n }\n }\n };\n }\n\n // Last ismaster\n Object.defineProperty(Map.prototype, 'size', {\n enumerable:true,\n get: function() { return this._keys.length; }\n });\n\n module.exports = Map;\n module.exports.Map = Map;\n}\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/map.js","/** @module auth */\nimport * as common from '../common';\nimport * as authCommon from './common';\nimport { uriEncodeObject } from '../util';\n\nexport const PROVIDER_TYPE_ANON = 'anon';\nexport const PROVIDER_TYPE_CUSTOM = 'custom';\nexport const PROVIDER_TYPE_USERPASS = 'userpass';\nexport const PROVIDER_TYPE_APIKEY = 'apiKey';\nexport const PROVIDER_TYPE_GOOGLE = 'google';\nexport const PROVIDER_TYPE_FACEBOOK = 'facebook';\nexport const PROVIDER_TYPE_MONGODB_CLOUD = 'mongodbCloud';\n\n/**\n * @namespace\n */\nfunction anonProvider(auth) {\n return {\n /**\n * Login to a stitch application using anonymous authentication\n *\n * @memberof anonProvider\n * @instance\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: () => {\n const deviceId = auth.getDeviceId();\n const device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n const fetchArgs = common.makeFetchArgs('GET');\n fetchArgs.cors = true;\n\n return fetch(\n `${auth.rootUrl}/providers/anon-user/login?device=${uriEncodeObject(device)}`,\n fetchArgs\n ).then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json, PROVIDER_TYPE_ANON));\n }\n };\n}\n\n/**\n * @namespace\n */\nfunction customProvider(auth) {\n const providerRoute = 'providers/custom-token';\n const loginRoute = `${providerRoute}/login`;\n\n return {\n /**\n * Login to a stitch application using custom authentication\n *\n * @memberof customProvider\n * @instance\n * @param {String} JWT token to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: (token) => {\n const deviceId = auth.getDeviceId();\n const device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n\n const fetchArgs = common.makeFetchArgs(\n 'POST',\n JSON.stringify({ token, options: { device } })\n );\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${loginRoute}`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json, PROVIDER_TYPE_CUSTOM));\n }\n };\n}\n\n/** @namespace */\nfunction userPassProvider(auth) {\n // The ternary expression here is redundant but is just preserving previous behavior based on whether or not\n // the client is for the admin or client API.\n const providerRoute = auth.isAppClient() ? 'providers/local-userpass' : 'providers/local-userpass';\n const loginRoute = auth.isAppClient() ? `${providerRoute}/login` : `${providerRoute}/login`;\n\n return {\n /**\n * Login to a stitch application using username and password authentication\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} username the username to use for authentication\n * @param {String} password the password to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: ({ username, password }) => {\n const deviceId = auth.getDeviceId();\n const device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n\n const fetchArgs = common.makeFetchArgs(\n 'POST',\n JSON.stringify({ username, password, options: { device } })\n );\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${loginRoute}`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json, PROVIDER_TYPE_USERPASS));\n },\n\n /**\n * Completes the confirmation workflow from the stitch server\n * @memberof userPassProvider\n * @instance\n * @param {String} tokenId the tokenId provided by the stitch server\n * @param {String} token the token provided by the stitch server\n * @returns {Promise}\n */\n emailConfirm: (tokenId, token) => {\n const fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ tokenId, token }));\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${providerRoute}/confirm`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json());\n },\n\n /**\n * Request that the stitch server send another email confirmation\n * for account creation.\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} email the email to send a confirmation email for\n * @returns {Promise}\n */\n sendEmailConfirm: (email) => {\n const fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email }));\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${providerRoute}/confirm/send`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json());\n },\n\n /**\n * Sends a password reset request to the stitch server\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} email the email of the account to reset the password for\n * @returns {Promise}\n */\n sendPasswordReset: (email) => {\n const fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email }));\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${providerRoute}/reset/send`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json());\n },\n\n /**\n * Use information returned from the stitch server to complete the password\n * reset flow for a given email account, providing a new password for the account.\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} tokenId the tokenId provided by the stitch server\n * @param {String} token the token provided by the stitch server\n * @param {String} password the new password requested for this account\n * @returns {Promise}\n */\n passwordReset: (tokenId, token, password) => {\n const fetchArgs =\n common.makeFetchArgs('POST', JSON.stringify({ tokenId, token, password }));\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${providerRoute}/reset`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json());\n },\n\n\n /**\n * Will trigger an email to the requested account containing a link with the\n * token and tokenId that must be returned to the server using emailConfirm()\n * to activate the account.\n *\n * @memberof userPassProvider\n * @instance\n * @param {String} email the requested email for the account\n * @param {String} password the requested password for the account\n * @returns {Promise}\n */\n register: (email, password) => {\n const fetchArgs = common.makeFetchArgs('POST', JSON.stringify({ email, password }));\n fetchArgs.cors = true;\n\n return fetch(`${auth.rootUrl}/${providerRoute}/register`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json());\n }\n };\n}\n\n/** @namespace */\nfunction apiKeyProvider(auth) {\n // The ternary expression here is redundant but is just preserving previous behavior based on whether or not\n // the client is for the admin or client API.\n const loginRoute = auth.isAppClient() ? 'providers/api-key/login' : 'providers/api-key/login';\n\n return {\n /**\n * Login to a stitch application using an api key\n *\n * @memberof apiKeyProvider\n * @instance\n * @param {String} key the key for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: key => {\n const deviceId = auth.getDeviceId();\n const device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n const fetchArgs = common.makeFetchArgs(\n 'POST',\n JSON.stringify({ 'key': key, 'options': { device } })\n );\n fetchArgs.cors = true;\n return fetch(`${auth.rootUrl}/${loginRoute}`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json, PROVIDER_TYPE_APIKEY));\n }\n };\n}\n\n// The state we generate is to be used for any kind of request where we will\n// complete an authentication flow via a redirect. We store the generate in\n// a local storage bound to the app's origin. This ensures that any time we\n// receive a redirect, there must be a state parameter and it must match\n// what we ourselves have generated. This state MUST only be sent to\n// a trusted Stitch endpoint in order to preserve its integrity. Stitch will\n// store it in some way on its origin (currently a cookie stored on this client)\n// and use that state at the end of an auth flow as a parameter in the redirect URI.\nconst alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\nfunction generateState() {\n let state = '';\n for (let i = 0; i < 64; ++i) {\n state += alpha.charAt(Math.floor(Math.random() * alpha.length));\n }\n\n return state;\n}\n\nfunction getOAuthLoginURL(auth, providerName, redirectUrl) {\n if (redirectUrl === undefined) {\n redirectUrl = auth.pageRootUrl();\n }\n\n const state = generateState();\n return auth.storage.set(authCommon.STATE_KEY, state)\n .then(() => auth.getDeviceId())\n .then(deviceId => {\n const device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n\n const result = `${auth.rootUrl}/providers/oauth2-${providerName}/login?redirect=${encodeURI(redirectUrl)}&state=${state}&device=${uriEncodeObject(device)}`;\n return result;\n });\n}\n\n/** @namespace */\nfunction googleProvider(auth) {\n const loginRoute = auth.isAppClient() ? 'providers/oauth2-google/login' : 'providers/oauth2-google/login';\n\n return {\n /**\n * Login to a stitch application using google authentication\n *\n * @memberof googleProvider\n * @instance\n * @param {Object} data the redirectUrl data to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: data => {\n let { authCode } = data;\n if (authCode) {\n const deviceId = auth.getDeviceId();\n const device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n\n const fetchArgs = common.makeFetchArgs(\n 'POST',\n JSON.stringify({ authCode, options: { device } })\n );\n\n return fetch(`${auth.rootUrl}/${loginRoute}`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json, PROVIDER_TYPE_GOOGLE));\n }\n\n const redirectUrl = (data && data.redirectUrl) ? data.redirectUrl : undefined;\n return auth.storage.set(authCommon.STITCH_REDIRECT_PROVIDER, PROVIDER_TYPE_GOOGLE)\n .then(() => getOAuthLoginURL(auth, PROVIDER_TYPE_GOOGLE, redirectUrl))\n .then((res) => window.location.replace(res));\n }\n };\n}\n\n/** @namespace */\nfunction facebookProvider(auth) {\n const loginRoute = auth.isAppClient() ? 'providers/oauth2-facebook/login' : 'providers/oauth2-facebook/login';\n\n return {\n /**\n * Login to a stitch application using facebook authentication\n *\n * @memberof facebookProvider\n * @instance\n * @param {Object} data the redirectUrl data to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: data => {\n let { accessToken } = data;\n\n if (accessToken) {\n const deviceId = auth.getDeviceId();\n const device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n\n const fetchArgs = common.makeFetchArgs(\n 'POST',\n JSON.stringify({ accessToken, options: { device } })\n );\n\n return fetch(`${auth.rootUrl}/${loginRoute}`, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json, PROVIDER_TYPE_FACEBOOK));\n }\n\n const redirectUrl = (data && data.redirectUrl) ? data.redirectUrl : undefined;\n return auth.storage.set(authCommon.STITCH_REDIRECT_PROVIDER, PROVIDER_TYPE_FACEBOOK)\n .then(() => getOAuthLoginURL(auth, PROVIDER_TYPE_FACEBOOK, redirectUrl))\n .then((res) => window.location.replace(res));\n }\n };\n}\n\n/** @namespace */\nfunction mongodbCloudProvider(auth) {\n // The ternary expression here is redundant but is just preserving previous behavior based on whether or not\n // the client is for the admin or client API.\n const loginRoute = auth.isAppClient() ? 'providers/mongodb-cloud/login' : 'providers/mongodb-cloud/login';\n\n return {\n /**\n * Login to a stitch application using mongodb cloud authentication\n *\n * @memberof mongodbCloudProvider\n * @instance\n * @param {Object} data the username, apiKey, cors, and cookie data to use for authentication\n * @returns {Promise} a promise that resolves when authentication succeeds.\n */\n authenticate: data => {\n const { username, apiKey, cors, cookie } = data;\n const options = Object.assign({}, { cors: true, cookie: false }, { cors: cors, cookie: cookie });\n const deviceId = auth.getDeviceId();\n const device = auth.getDeviceInfo(deviceId, !!auth.client && auth.client.clientAppID);\n const fetchArgs = common.makeFetchArgs(\n 'POST',\n JSON.stringify({ username, apiKey, options: { device } })\n );\n fetchArgs.cors = true; // TODO: shouldn't this use the passed in `cors` value?\n fetchArgs.credentials = 'include';\n\n let url = `${auth.rootUrl}/${loginRoute}`;\n if (options.cookie) {\n return fetch(url + '?cookie=true', fetchArgs)\n .then(common.checkStatus);\n }\n\n return fetch(url, fetchArgs)\n .then(common.checkStatus)\n .then(response => response.json())\n .then(json => auth.set(json, PROVIDER_TYPE_MONGODB_CLOUD));\n }\n };\n}\n\n// TODO: support auth-specific options\nfunction createProviders(auth, options = {}) {\n return {\n [PROVIDER_TYPE_ANON]: anonProvider(auth),\n [PROVIDER_TYPE_APIKEY]: apiKeyProvider(auth),\n [PROVIDER_TYPE_GOOGLE]: googleProvider(auth),\n [PROVIDER_TYPE_FACEBOOK]: facebookProvider(auth),\n [PROVIDER_TYPE_MONGODB_CLOUD]: mongodbCloudProvider(auth),\n [PROVIDER_TYPE_USERPASS]: userPassProvider(auth),\n [PROVIDER_TYPE_CUSTOM]: customProvider(auth)\n };\n}\n\nexport { createProviders };\n\n\n\n// WEBPACK FOOTER //\n// ./src/auth/providers.js","// the whatwg-fetch polyfill installs the fetch() function\n// on the global object (window or self)\n//\n// Return that as the export for use in Webpack, Browserify etc.\nrequire('whatwg-fetch');\nvar globalObj = typeof self !== 'undefined' && self || this;\nmodule.exports = globalObj.fetch.bind(globalObj);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/fetch-everywhere/fetch-npm-browserify.js\n// module id = 24\n// module chunks = 0","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/process/browser.js\n// module id = 25\n// module chunks = 0","/* global window, fetch */\n/* eslint no-labels: ['error', { 'allowLoop': true }] */\nimport 'fetch-everywhere';\nimport { newStitchClient, StitchClient } from './client';\nimport ADMIN_CLIENT_TYPE from './common';\nimport { ADMIN_CLIENT_CODEC } from './auth/common';\n\nconst v2 = 2;\nconst v3 = 3;\n\nexport class StitchAdminClientFactory {\n constructor() {\n throw new StitchError('StitchAdminClient can only be made from the StitchAdminClientFactory.create function');\n }\n\n static create(baseUrl) {\n return newStitchClient(StitchAdminClient.prototype, '', {baseUrl, authCodec: ADMIN_CLIENT_CODEC});\n }\n}\n\nexport class StitchAdminClient extends StitchClient {\n constructor() {\n super();\n throw new StitchError('StitchAdminClient can only be made from the StitchAdminClientFactory.create function');\n }\n\n get type() {\n return ADMIN_CLIENT_TYPE;\n }\n\n get _v3() {\n const v3do = (url, method, options) =>\n super._do(\n url,\n method,\n Object.assign({}, { apiVersion: v3 }, options)\n ).then(response => {\n const contentHeader = response.headers.get('content-type') || '';\n if (contentHeader.split(',').indexOf('application/json') >= 0) {\n return response.json();\n }\n return response;\n });\n\n return {\n _get: (url, queryParams) => v3do(url, 'GET', {queryParams}),\n _put: (url, data) =>\n (data ?\n v3do(url, 'PUT', {body: JSON.stringify(data)}) :\n v3do(url, 'PUT')),\n _patch: (url, data) =>\n (data ?\n v3do(url, 'PATCH', {body: JSON.stringify(data)}) :\n v3do(url, 'PATCH')),\n _delete: (url) => v3do(url, 'DELETE'),\n _post: (url, body, queryParams) =>\n (queryParams ?\n v3do(url, 'POST', { body: JSON.stringify(body), queryParams }) :\n v3do(url, 'POST', { body: JSON.stringify(body) }))\n };\n }\n\n get _v2() {\n const v2do = (url, method, options) =>\n super._do(\n url,\n method,\n Object.assign({}, { apiVersion: v2 }, options)\n ).then(response => {\n const contentHeader = response.headers.get('content-type') || '';\n if (contentHeader.split(',').indexOf('application/json') >= 0) {\n return response.json();\n }\n return response;\n });\n\n return {\n _get: (url, queryParams) => v2do(url, 'GET', {queryParams}),\n _put: (url, data) =>\n (data ?\n v2do(url, 'PUT', {body: JSON.stringify(data)}) :\n v2do(url, 'PUT')),\n _patch: (url, data) =>\n (data ?\n v2do(url, 'PATCH', {body: JSON.stringify(data)}) :\n v2do(url, 'PATCH')),\n _delete: (url) => v2do(url, 'DELETE'),\n _post: (url, body, queryParams) =>\n (queryParams ?\n v2do(url, 'POST', { body: JSON.stringify(body), queryParams }) :\n v2do(url, 'POST', { body: JSON.stringify(body) }))\n };\n }\n\n /**\n * Ends the session for the current user.\n *\n * @returns {Promise}\n */\n logout() {\n return super._do('/auth/session', 'DELETE', { refreshOnFailure: false, useRefreshToken: true, apiVersion: v3 })\n .then(() => this.auth.clear());\n }\n\n /**\n * Returns profile information for the currently logged in user\n *\n * @returns {Promise}\n */\n userProfile() {\n return this._v3._get('/auth/profile');\n }\n\n /**\n * Returns available providers for the currently logged in admin\n *\n * @returns {Promise}\n */\n getAuthProviders() {\n return super._do('/auth/providers', 'GET', { noAuth: true, apiVersion: v3 })\n .then(response => response.json());\n }\n\n /**\n * Returns an access token for the user\n *\n * @returns {Promise}\n */\n doSessionPost() {\n return super._do('/auth/session', 'POST', { refreshOnFailure: false, useRefreshToken: true, apiVersion: v3 })\n .then(response => response.json());\n }\n\n /* Examples of how to access admin API with this client:\n *\n * List all apps\n * a.apps('580e6d055b199c221fcb821c').list()\n *\n * Fetch app under name 'planner'\n * a.apps('580e6d055b199c221fcb821c').app('planner').get()\n *\n * List services under the app 'planner'\n * a.apps('580e6d055b199c221fcb821c').app('planner').services().list()\n *\n * Delete a rule by ID\n * a.apps('580e6d055b199c221fcb821c').app('planner').services().service('mdb1').rules().rule('580e6d055b199c221fcb821d').remove()\n *\n */\n apps(groupId) {\n const api = this._v3;\n const groupUrl = `/groups/${groupId}/apps`;\n return {\n list: () => api._get(groupUrl),\n create: (data, options) => {\n let query = (options && options.defaults) ? '?defaults=true' : '';\n return api._post(groupUrl + query, data);\n },\n\n app: (appId) => {\n const appUrl = `${groupUrl}/${appId}`;\n return {\n get: () => api._get(appUrl),\n remove: () => api._delete(appUrl),\n\n values: () => ({\n list: () => api._get(`${appUrl}/values`),\n create: (data) => api._post( `${appUrl}/values`, data),\n value: (valueId) => {\n const valueUrl = `${appUrl}/values/${valueId}`;\n return {\n get: ()=> api._get(valueUrl),\n remove: ()=> api._delete(valueUrl),\n update: (data) => api._put(valueUrl, data)\n };\n }\n }),\n\n services: () => ({\n list: () => api._get(`${appUrl}/services`),\n create: (data) => api._post(`${appUrl}/services`, data),\n service: (serviceId) => ({\n get: () => api._get(`${appUrl}/services/${serviceId}`),\n remove: () => api._delete(`${appUrl}/services/${serviceId}`),\n runCommand: (commandName, data) => api._post(`${appUrl}/services/${serviceId}/commands/${commandName}`, data),\n config: ()=> ({\n get: () => api._get(`${appUrl}/services/${serviceId}/config`),\n update: (data) => api._patch(`${appUrl}/services/${serviceId}/config`, data)\n }),\n\n rules: () => ({\n list: () => api._get(`${appUrl}/services/${serviceId}/rules`),\n create: (data) => api._post(`${appUrl}/services/${serviceId}/rules`, data),\n rule: (ruleId) => {\n const ruleUrl = `${appUrl}/services/${serviceId}/rules/${ruleId}`;\n return {\n get: () => api._get(ruleUrl),\n update: (data) => api._put(ruleUrl, data),\n remove: () => api._delete(ruleUrl)\n };\n }\n }),\n\n incomingWebhooks: () => ({\n list: () => api._get(`${appUrl}/services/${serviceId}/incoming_webhooks`),\n create: (data) => api._post(`${appUrl}/services/${serviceId}/incoming_webhooks`, data),\n incomingWebhook: (incomingWebhookId) => {\n const webhookUrl = `${appUrl}/services/${serviceId}/incoming_webhooks/${incomingWebhookId}`;\n return {\n get: () => api._get(webhookUrl),\n update: (data) => api._put(webhookUrl, data),\n remove: () => api._delete(webhookUrl)\n };\n }\n })\n })\n }),\n\n pushNotifications: () => ({\n list: (filter) => api._get(`${appUrl}/push/notifications`, filter),\n create: (data) => api._post(`${appUrl}/push/notifications`, data),\n pushNotification: (messageId) => ({\n get: () => api._get(`${appUrl}/push/notifications/${messageId}`),\n update: (data) => api._put(`${appUrl}/push/notifications/${messageId}`, data),\n remove: () => api._delete(`${appUrl}/push/notifications/${messageId}`),\n send: () => api._post(`${appUrl}/push/notifications/${messageId}/send`)\n })\n }),\n\n users: () => ({\n list: (filter) => api._get(`${appUrl}/users`, filter),\n create: (user) => api._post(`${appUrl}/users`, user),\n user: (uid) => ({\n get: () => api._get(`${appUrl}/users/${uid}`),\n devices: () => ({\n get: () => api._get(`${appUrl}/users/${uid}/devices`)\n }),\n logout: () => api._put(`${appUrl}/users/${uid}/logout`),\n enable: () => api._put(`${appUrl}/users/${uid}/enable`),\n disable: () => api._put(`${appUrl}/users/${uid}/disable`),\n remove: () => api._delete(`${appUrl}/users/${uid}`)\n })\n }),\n\n debug: () => ({\n executeFunction: (userId, name = '', ...args) => {\n return api._post(\n `${appUrl}/debug/execute_function`,\n {name, 'arguments': args},\n { user_id: userId });\n },\n executeFunctionSource: (userId, source = '', evalSource = '') => {\n return api._post(\n `${appUrl}/debug/execute_function_source`,\n {source, 'eval_source': evalSource},\n { user_id: userId });\n }\n }),\n\n authProviders: () => ({\n list: () => api._get(`${appUrl}/auth_providers`),\n create: (data) => api._post(`${appUrl}/auth_providers`, data),\n authProvider: (providerId) => ({\n get: () => api._get(`${appUrl}/auth_providers/${providerId}`),\n update: (data) => api._patch(`${appUrl}/auth_providers/${providerId}`, data),\n enable: () => api._put(`${appUrl}/auth_providers/${providerId}/enable`),\n disable: () => api._put(`${appUrl}/auth_providers/${providerId}/disable`),\n remove: () => api._delete(`${appUrl}/auth_providers/${providerId}`)\n })\n }),\n\n security: () => ({\n allowedRequestOrigins: () => ({\n get: () => api._get(`${appUrl}/security/allowed_request_origins`),\n update: (data) => api._post(`${appUrl}/security/allowed_request_origins`, data)\n })\n }),\n\n logs: () => ({\n list: (filter) => api._get(`${appUrl}/logs`, filter)\n }),\n\n apiKeys: () => ({\n list: () => api._get(`${appUrl}/api_keys`),\n create: (data) => api._post(`${appUrl}/api_keys`, data),\n apiKey: (apiKeyId) => ({\n get: () => api._get(`${appUrl}/api_keys/${apiKeyId}`),\n remove: () => api._delete(`${appUrl}/api_keys/${apiKeyId}`),\n enable: () => api._put(`${appUrl}/api_keys/${apiKeyId}/enable`),\n disable: () => api._put(`${appUrl}/api_keys/${apiKeyId}/disable`)\n })\n }),\n\n functions: () => ({\n list: () => api._get(`${appUrl}/functions`),\n create: (data) => api._post(`${appUrl}/functions`, data),\n function: (functionId) => ({\n get: () => api._get(`${appUrl}/functions/${functionId}`),\n update: (data) => api._put(`${appUrl}/functions/${functionId}`, data),\n remove: () => api._delete(`${appUrl}/functions/${functionId}`)\n })\n })\n };\n }\n };\n }\n\n v2() {\n const api = this._v2;\n return {\n\n apps: (groupId) => {\n const groupUrl = `/groups/${groupId}/apps`;\n return {\n list: () => api._get(groupUrl),\n create: (data, options) => {\n let query = (options && options.defaults) ? '?defaults=true' : '';\n return api._post(groupUrl + query, data);\n },\n\n app: (appId) => {\n const appUrl = `${groupUrl}/${appId}`;\n return {\n get: () => api._get(appUrl),\n remove: () => api._delete(appUrl),\n\n pipelines: () => ({\n list: () => api._get(`${appUrl}/pipelines`),\n create: (data) => api._post( `${appUrl}/pipelines`, data),\n pipeline: (pipelineId) => {\n const pipelineUrl = `${appUrl}/pipelines/${pipelineId}`;\n return {\n get: ()=> api._get(pipelineUrl),\n remove: ()=> api._delete(pipelineUrl),\n update: (data) => api._put(pipelineUrl, data)\n };\n }\n }),\n\n values: () => ({\n list: () => api._get(`${appUrl}/values`),\n create: (data) => api._post( `${appUrl}/values`, data),\n value: (valueId) => {\n const valueUrl = `${appUrl}/values/${valueId}`;\n return {\n get: ()=> api._get(valueUrl),\n remove: ()=> api._delete(valueUrl),\n update: (data) => api._put(valueUrl, data)\n };\n }\n }),\n\n services: () => ({\n list: () => api._get(`${appUrl}/services`),\n create: (data) => api._post(`${appUrl}/services`, data),\n service: (serviceId) => ({\n get: () => api._get(`${appUrl}/services/${serviceId}`),\n remove: () => api._delete(`${appUrl}/services/${serviceId}`),\n runCommand: (commandName, data) => api._post(`${appUrl}/services/${serviceId}/commands/${commandName}`, data),\n config: ()=> ({\n get: () => api._get(`${appUrl}/services/${serviceId}/config`),\n update: (data) => api._patch(`${appUrl}/services/${serviceId}/config`, data)\n }),\n\n rules: () => ({\n list: () => api._get(`${appUrl}/services/${serviceId}/rules`),\n create: (data) => api._post(`${appUrl}/services/${serviceId}/rules`, data),\n rule: (ruleId) => {\n const ruleUrl = `${appUrl}/services/${serviceId}/rules/${ruleId}`;\n return {\n get: () => api._get(ruleUrl),\n update: (data) => api._put(ruleUrl, data),\n remove: () => api._delete(ruleUrl)\n };\n }\n }),\n\n incomingWebhooks: () => ({\n list: () => api._get(`${appUrl}/services/${serviceId}/incoming_webhooks`),\n create: (data) => api._post(`${appUrl}/services/${serviceId}/incoming_webhooks`, data),\n incomingWebhook: (incomingWebhookId) => {\n const webhookUrl = `${appUrl}/services/${serviceId}/incoming_webhooks/${incomingWebhookId}`;\n return {\n get: () => api._get(webhookUrl),\n update: (data) => api._put(webhookUrl, data),\n remove: () => api._delete(webhookUrl)\n };\n }\n })\n\n })\n }),\n\n pushNotifications: () => ({\n list: (filter) => api._get(`${appUrl}/push/notifications`, filter),\n create: (data) => api._post(`${appUrl}/push/notifications`, data),\n pushNotification: (messageId) => ({\n get: () => api._get(`${appUrl}/push/notifications/${messageId}`),\n update: (data) => api._put(`${appUrl}/push/notifications/${messageId}`, data),\n setType: (type) => api._put(`${appUrl}/push/notifications/${messageId}/type`, { type }),\n remove: () => api._delete(`${appUrl}/push/notifications/${messageId}`)\n })\n }),\n\n users: () => ({\n list: (filter) => api._get(`${appUrl}/users`, filter),\n create: (user) => api._post(`${appUrl}/users`, user),\n user: (uid) => ({\n get: () => api._get(`${appUrl}/users/${uid}`),\n logout: () => api._put(`${appUrl}/users/${uid}/logout`),\n remove: () => api._delete(`${appUrl}/users/${uid}`)\n })\n }),\n\n dev: () => ({\n executePipeline: (body, userId, options) => {\n return api._post(\n `${appUrl}/dev/pipeline`,\n body,\n Object.assign({}, options, { user_id: userId }));\n }\n }),\n\n authProviders: () => ({\n list: () => api._get(`${appUrl}/auth_providers`),\n create: (data) => api._post(`${appUrl}/auth_providers`, data),\n authProvider: (providerId) => ({\n get: () => api._get(`${appUrl}/auth_providers/${providerId}`),\n update: (data) => api._patch(`${appUrl}/auth_providers/${providerId}`, data),\n enable: () => api._put(`${appUrl}/auth_providers/${providerId}/enable`),\n disable: () => api._put(`${appUrl}/auth_providers/${providerId}/disable`),\n remove: () => api._delete(`${appUrl}/auth_providers/${providerId}`)\n })\n }),\n\n security: () => ({\n allowedRequestOrigins: () => ({\n get: () => api._get(`${appUrl}/security/allowed_request_origins`),\n update: (data) => api._post(`${appUrl}/security/allowed_request_origins`, data)\n })\n }),\n\n logs: () => ({\n list: (filter) => api._get(`${appUrl}/logs`, filter)\n }),\n\n apiKeys: () => ({\n list: () => api._get(`${appUrl}/api_keys`),\n create: (data) => api._post(`${appUrl}/api_keys`, data),\n apiKey: (apiKeyId) => ({\n get: () => api._get(`${appUrl}/api_keys/${apiKeyId}`),\n remove: () => api._delete(`${appUrl}/api_keys/${apiKeyId}`),\n enable: () => api._put(`${appUrl}/api_keys/${apiKeyId}/enable`),\n disable: () => api._put(`${appUrl}/api_keys/${apiKeyId}/disable`)\n })\n })\n };\n }\n };\n }\n };\n }\n\n _admin() {\n return {\n logs: () => ({\n get: (filter) => super._do('/admin/logs', 'GET', { useRefreshToken: true, queryParams: filter })\n }),\n users: () => ({\n list: (filter) => super._do('/admin/users', 'GET', { useRefreshToken: true, queryParams: filter }),\n user: (uid) => ({\n logout: () => super._do(`/admin/users/${uid}/logout`, 'PUT', { useRefreshToken: true })\n })\n })\n };\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/admin.js",";(function () {\n\n var object =\n typeof exports != 'undefined' ? exports :\n typeof self != 'undefined' ? self : // #8: web workers\n $.global; // #31: ExtendScript\n\n var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n function InvalidCharacterError(message) {\n this.message = message;\n }\n InvalidCharacterError.prototype = new Error;\n InvalidCharacterError.prototype.name = 'InvalidCharacterError';\n\n // encoder\n // [https://gist.github.com/999166] by [https://github.com/nignag]\n object.btoa || (\n object.btoa = function (input) {\n var str = String(input);\n for (\n // initialize result and counter\n var block, charCode, idx = 0, map = chars, output = '';\n // if the next str index does not exist:\n // change the mapping table to \"=\"\n // check if d has no fractional digits\n str.charAt(idx | 0) || (map = '=', idx % 1);\n // \"8 - idx % 1 * 8\" generates the sequence 2, 4, 6, 8\n output += map.charAt(63 & block >> 8 - idx % 1 * 8)\n ) {\n charCode = str.charCodeAt(idx += 3/4);\n if (charCode > 0xFF) {\n throw new InvalidCharacterError(\"'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.\");\n }\n block = block << 8 | charCode;\n }\n return output;\n });\n\n // decoder\n // [https://gist.github.com/1020396] by [https://github.com/atk]\n object.atob || (\n object.atob = function (input) {\n var str = String(input).replace(/[=]+$/, ''); // #31: ExtendScript bad parse of /=\n if (str.length % 4 == 1) {\n throw new InvalidCharacterError(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = '';\n // get next character\n buffer = str.charAt(idx++);\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n return output;\n });\n\n}());\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/Base64/base64.js\n// module id = 27\n// module chunks = 0","\"use strict\"\n\nvar writeIEEE754 = require('./float_parser').writeIEEE754,\n\treadIEEE754 = require('./float_parser').readIEEE754,\n Map = require('./map'),\n\tLong = require('./long'),\n Double = require('./double'),\n Timestamp = require('./timestamp'),\n ObjectID = require('./objectid'),\n BSONRegExp = require('./regexp'),\n Symbol = require('./symbol'),\n\tInt32 = require('./int_32'),\n Code = require('./code'),\n\tDecimal128 = require('./decimal128'),\n MinKey = require('./min_key'),\n MaxKey = require('./max_key'),\n DBRef = require('./db_ref'),\n Binary = require('./binary');\n\n// Parts of the parser\nvar deserialize = require('./parser/deserializer'),\n\tserializer = require('./parser/serializer'),\n\tcalculateObjectSize = require('./parser/calculate_size');\n\n/**\n * @ignore\n * @api private\n */\n// Max Size\nvar MAXSIZE = (1024*1024*17);\n// Max Document Buffer size\nvar buffer = new Buffer(MAXSIZE);\n\nvar BSON = function() {\n}\n\n/**\n * Serialize a Javascript object.\n *\n * @param {Object} object the Javascript object to serialize.\n * @param {Boolean} [options.checkKeys] the serializer will check if keys are valid.\n * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**.\n * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**.\n * @return {Buffer} returns the Buffer object containing the serialized object.\n * @api public\n */\nBSON.prototype.serialize = function serialize(object, options) {\n\toptions = options || {};\n\t// Unpack the options\n\tvar checkKeys = typeof options.checkKeys == 'boolean'\n\t\t? options.checkKeys : false;\n\tvar serializeFunctions = typeof options.serializeFunctions == 'boolean'\n\t\t? options.serializeFunctions : false;\n\tvar ignoreUndefined = typeof options.ignoreUndefined == 'boolean'\n\t\t? options.ignoreUndefined : true;\n\n\t// Attempt to serialize\n\tvar serializationIndex = serializer(buffer, object, checkKeys, 0, 0, serializeFunctions, ignoreUndefined, []);\n\t// Create the final buffer\n\tvar finishedBuffer = new Buffer(serializationIndex);\n\t// Copy into the finished buffer\n\tbuffer.copy(finishedBuffer, 0, 0, finishedBuffer.length);\n\t// Return the buffer\n\treturn finishedBuffer;\n}\n\n/**\n * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization.\n *\n * @param {Object} object the Javascript object to serialize.\n * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object.\n * @param {Boolean} [options.checkKeys] the serializer will check if keys are valid.\n * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**.\n * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**.\n * @param {Number} [options.index] the index in the buffer where we wish to start serializing into.\n * @return {Number} returns the index pointing to the last written byte in the buffer.\n * @api public\n */\nBSON.prototype.serializeWithBufferAndIndex = function(object, finalBuffer, options) {\n\toptions = options || {};\n\t// Unpack the options\n\tvar checkKeys = typeof options.checkKeys == 'boolean'\n\t\t? options.checkKeys : false;\n\tvar serializeFunctions = typeof options.serializeFunctions == 'boolean'\n\t\t? options.serializeFunctions : false;\n\tvar ignoreUndefined = typeof options.ignoreUndefined == 'boolean'\n\t\t? options.ignoreUndefined : true;\n\tvar startIndex = typeof options.index == 'number'\n\t\t? options.index : 0;\n\n\t// Attempt to serialize\n\tvar serializationIndex = serializer(buffer, object, checkKeys, startIndex || 0, 0, serializeFunctions, ignoreUndefined);\n\tbuffer.copy(finalBuffer, startIndex, 0, serializationIndex);\n\n\t// Return the index\n\treturn serializationIndex - 1;\n}\n\n/**\n * Deserialize data as BSON.\n *\n * @param {Buffer} buffer the buffer containing the serialized set of BSON documents.\n * @param {Object} [options.evalFunctions=false] evaluate functions in the BSON document scoped to the object deserialized.\n * @param {Object} [options.cacheFunctions=false] cache evaluated functions for reuse.\n * @param {Object} [options.cacheFunctionsCrc32=false] use a crc32 code for caching, otherwise use the string of the function.\n * @param {Object} [options.promoteLongs=true] when deserializing a Long will fit it into a Number if it's smaller than 53 bits\n * @param {Object} [options.promoteBuffers=false] when deserializing a Binary will return it as a node.js Buffer instance.\n * @param {Object} [options.promoteValues=false] when deserializing will promote BSON values to their Node.js closest equivalent types.\n * @param {Object} [options.fieldsAsRaw=null] allow to specify if there what fields we wish to return as unserialized raw buffer.\n * @param {Object} [options.bsonRegExp=false] return BSON regular expressions as BSONRegExp instances.\n * @return {Object} returns the deserialized Javascript Object.\n * @api public\n */\nBSON.prototype.deserialize = function(buffer, options) {\n return deserialize(buffer, options);\n}\n\n/**\n * Calculate the bson size for a passed in Javascript object.\n *\n * @param {Object} object the Javascript object to calculate the BSON byte size for.\n * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**.\n * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**.\n * @return {Number} returns the number of bytes the BSON object will take up.\n * @api public\n */\nBSON.prototype.calculateObjectSize = function(object, options) {\n\toptions = options || {};\n\n\tvar serializeFunctions = typeof options.serializeFunctions == 'boolean'\n\t\t? options.serializeFunctions : false;\n\tvar ignoreUndefined = typeof options.ignoreUndefined == 'boolean'\n\t\t? options.ignoreUndefined : true;\n\n return calculateObjectSize(object, serializeFunctions, ignoreUndefined);\n}\n\n/**\n * Deserialize stream data as BSON documents.\n *\n * @param {Buffer} data the buffer containing the serialized set of BSON documents.\n * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start.\n * @param {Number} numberOfDocuments number of documents to deserialize.\n * @param {Array} documents an array where to store the deserialized documents.\n * @param {Number} docStartIndex the index in the documents array from where to start inserting documents.\n * @param {Object} [options] additional options used for the deserialization.\n * @param {Object} [options.evalFunctions=false] evaluate functions in the BSON document scoped to the object deserialized.\n * @param {Object} [options.cacheFunctions=false] cache evaluated functions for reuse.\n * @param {Object} [options.cacheFunctionsCrc32=false] use a crc32 code for caching, otherwise use the string of the function.\n * @param {Object} [options.promoteLongs=true] when deserializing a Long will fit it into a Number if it's smaller than 53 bits\n * @param {Object} [options.promoteBuffers=false] when deserializing a Binary will return it as a node.js Buffer instance.\n * @param {Object} [options.promoteValues=false] when deserializing will promote BSON values to their Node.js closest equivalent types.\n * @param {Object} [options.fieldsAsRaw=null] allow to specify if there what fields we wish to return as unserialized raw buffer.\n * @param {Object} [options.bsonRegExp=false] return BSON regular expressions as BSONRegExp instances.\n * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents.\n * @api public\n */\nBSON.prototype.deserializeStream = function(data, startIndex, numberOfDocuments, documents, docStartIndex, options) {\n options = options != null ? options : {};\n var index = startIndex;\n // Loop over all documents\n for(var i = 0; i < numberOfDocuments; i++) {\n // Find size of the document\n var size = data[index] | data[index + 1] << 8 | data[index + 2] << 16 | data[index + 3] << 24;\n // Update options with index\n options['index'] = index;\n // Parse the document at this point\n documents[docStartIndex + i] = this.deserialize(data, options);\n // Adjust index by the document size\n index = index + size;\n }\n\n // Return object containing end index of parsing and list of documents\n return index;\n}\n\n/**\n * @ignore\n * @api private\n */\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\nBSON.BSON_INT64_MAX = Math.pow(2, 63) - 1;\nBSON.BSON_INT64_MIN = -Math.pow(2, 63);\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\n// Internal long versions\nvar JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double.\nvar JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double.\n\n/**\n * Number BSON Type\n *\n * @classconstant BSON_DATA_NUMBER\n **/\nBSON.BSON_DATA_NUMBER = 1;\n/**\n * String BSON Type\n *\n * @classconstant BSON_DATA_STRING\n **/\nBSON.BSON_DATA_STRING = 2;\n/**\n * Object BSON Type\n *\n * @classconstant BSON_DATA_OBJECT\n **/\nBSON.BSON_DATA_OBJECT = 3;\n/**\n * Array BSON Type\n *\n * @classconstant BSON_DATA_ARRAY\n **/\nBSON.BSON_DATA_ARRAY = 4;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_BINARY\n **/\nBSON.BSON_DATA_BINARY = 5;\n/**\n * ObjectID BSON Type\n *\n * @classconstant BSON_DATA_OID\n **/\nBSON.BSON_DATA_OID = 7;\n/**\n * Boolean BSON Type\n *\n * @classconstant BSON_DATA_BOOLEAN\n **/\nBSON.BSON_DATA_BOOLEAN = 8;\n/**\n * Date BSON Type\n *\n * @classconstant BSON_DATA_DATE\n **/\nBSON.BSON_DATA_DATE = 9;\n/**\n * null BSON Type\n *\n * @classconstant BSON_DATA_NULL\n **/\nBSON.BSON_DATA_NULL = 10;\n/**\n * RegExp BSON Type\n *\n * @classconstant BSON_DATA_REGEXP\n **/\nBSON.BSON_DATA_REGEXP = 11;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_CODE\n **/\nBSON.BSON_DATA_CODE = 13;\n/**\n * Symbol BSON Type\n *\n * @classconstant BSON_DATA_SYMBOL\n **/\nBSON.BSON_DATA_SYMBOL = 14;\n/**\n * Code with Scope BSON Type\n *\n * @classconstant BSON_DATA_CODE_W_SCOPE\n **/\nBSON.BSON_DATA_CODE_W_SCOPE = 15;\n/**\n * 32 bit Integer BSON Type\n *\n * @classconstant BSON_DATA_INT\n **/\nBSON.BSON_DATA_INT = 16;\n/**\n * Timestamp BSON Type\n *\n * @classconstant BSON_DATA_TIMESTAMP\n **/\nBSON.BSON_DATA_TIMESTAMP = 17;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_LONG\n **/\nBSON.BSON_DATA_LONG = 18;\n/**\n * MinKey BSON Type\n *\n * @classconstant BSON_DATA_MIN_KEY\n **/\nBSON.BSON_DATA_MIN_KEY = 0xff;\n/**\n * MaxKey BSON Type\n *\n * @classconstant BSON_DATA_MAX_KEY\n **/\nBSON.BSON_DATA_MAX_KEY = 0x7f;\n\n/**\n * Binary Default Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_DEFAULT\n **/\nBSON.BSON_BINARY_SUBTYPE_DEFAULT = 0;\n/**\n * Binary Function Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_FUNCTION\n **/\nBSON.BSON_BINARY_SUBTYPE_FUNCTION = 1;\n/**\n * Binary Byte Array Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY\n **/\nBSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;\n/**\n * Binary UUID Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_UUID\n **/\nBSON.BSON_BINARY_SUBTYPE_UUID = 3;\n/**\n * Binary MD5 Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_MD5\n **/\nBSON.BSON_BINARY_SUBTYPE_MD5 = 4;\n/**\n * Binary User Defined Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED\n **/\nBSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128;\n\n// Return BSON\nmodule.exports = BSON;\nmodule.exports.Code = Code;\nmodule.exports.Map = Map;\nmodule.exports.Symbol = Symbol;\nmodule.exports.BSON = BSON;\nmodule.exports.DBRef = DBRef;\nmodule.exports.Binary = Binary;\nmodule.exports.ObjectID = ObjectID;\nmodule.exports.Long = Long;\nmodule.exports.Timestamp = Timestamp;\nmodule.exports.Double = Double;\nmodule.exports.Int32 = Int32;\nmodule.exports.MinKey = MinKey;\nmodule.exports.MaxKey = MaxKey;\nmodule.exports.BSONRegExp = BSONRegExp;\nmodule.exports.Decimal128 = Decimal128;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/bson.js","\"use strict\"\n\nvar writeIEEE754 = require('../float_parser').writeIEEE754\n\t, readIEEE754 = require('../float_parser').readIEEE754\n\t, Long = require('../long').Long\n , Double = require('../double').Double\n , Timestamp = require('../timestamp').Timestamp\n , ObjectID = require('../objectid').ObjectID\n , Symbol = require('../symbol').Symbol\n , BSONRegExp = require('../regexp').BSONRegExp\n , Code = require('../code').Code\n\t, Decimal128 = require('../decimal128')\n , MinKey = require('../min_key').MinKey\n , MaxKey = require('../max_key').MaxKey\n , DBRef = require('../db_ref').DBRef\n , Binary = require('../binary').Binary;\n\n// To ensure that 0.4 of node works correctly\nvar isDate = function isDate(d) {\n return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]';\n}\n\nvar calculateObjectSize = function calculateObjectSize(object, serializeFunctions, ignoreUndefined) {\n var totalLength = (4 + 1);\n\n if(Array.isArray(object)) {\n for(var i = 0; i < object.length; i++) {\n totalLength += calculateElement(i.toString(), object[i], serializeFunctions, true, ignoreUndefined)\n }\n } else {\n\t\t// If we have toBSON defined, override the current object\n\t\tif(object.toBSON) {\n\t\t\tobject = object.toBSON();\n\t\t}\n\n\t\t// Calculate size\n for(var key in object) {\n totalLength += calculateElement(key, object[key], serializeFunctions, false, ignoreUndefined)\n }\n }\n\n return totalLength;\n}\n\n/**\n * @ignore\n * @api private\n */\nfunction calculateElement(name, value, serializeFunctions, isArray, ignoreUndefined) {\n\t// If we have toBSON defined, override the current object\n if(value && value.toBSON){\n value = value.toBSON();\n }\n\n switch(typeof value) {\n case 'string':\n return 1 + Buffer.byteLength(name, 'utf8') + 1 + 4 + Buffer.byteLength(value, 'utf8') + 1;\n case 'number':\n if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) {\n if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { // 32 bit\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (4 + 1);\n } else {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1);\n }\n } else { // 64 bit\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1);\n }\n case 'undefined':\n if(isArray || !ignoreUndefined) return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1);\n return 0;\n case 'boolean':\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1 + 1);\n case 'object':\n if(value == null || value instanceof MinKey || value instanceof MaxKey || value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1);\n } else if(value instanceof ObjectID || value['_bsontype'] == 'ObjectID') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (12 + 1);\n } else if(value instanceof Date || isDate(value)) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1);\n } else if(typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1 + 4 + 1) + value.length;\n } else if(value instanceof Long || value instanceof Double || value instanceof Timestamp\n || value['_bsontype'] == 'Long' || value['_bsontype'] == 'Double' || value['_bsontype'] == 'Timestamp') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1);\n\t\t\t} else if(value instanceof Decimal128 || value['_bsontype'] == 'Decimal128') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (16 + 1);\n } else if(value instanceof Code || value['_bsontype'] == 'Code') {\n // Calculate size depending on the availability of a scope\n if(value.scope != null && Object.keys(value.scope).length > 0) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + 4 + Buffer.byteLength(value.code.toString(), 'utf8') + 1 + calculateObjectSize(value.scope, serializeFunctions, ignoreUndefined);\n } else {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + Buffer.byteLength(value.code.toString(), 'utf8') + 1;\n }\n } else if(value instanceof Binary || value['_bsontype'] == 'Binary') {\n // Check what kind of subtype we have\n if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (value.position + 1 + 4 + 1 + 4);\n } else {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (value.position + 1 + 4 + 1);\n }\n } else if(value instanceof Symbol || value['_bsontype'] == 'Symbol') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + Buffer.byteLength(value.value, 'utf8') + 4 + 1 + 1;\n } else if(value instanceof DBRef || value['_bsontype'] == 'DBRef') {\n // Set up correct object for serialization\n var ordered_values = {\n '$ref': value.namespace\n , '$id' : value.oid\n };\n\n // Add db reference if it exists\n if(null != value.db) {\n ordered_values['$db'] = value.db;\n }\n\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + calculateObjectSize(ordered_values, serializeFunctions, ignoreUndefined);\n } else if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + Buffer.byteLength(value.source, 'utf8') + 1\n + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1\n } else if(value instanceof BSONRegExp || value['_bsontype'] == 'BSONRegExp') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + Buffer.byteLength(value.pattern, 'utf8') + 1\n + Buffer.byteLength(value.options, 'utf8') + 1\n } else {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + calculateObjectSize(value, serializeFunctions, ignoreUndefined) + 1;\n }\n case 'function':\n // WTF for 0.4.X where typeof /someregexp/ === 'function'\n if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]' || String.call(value) == '[object RegExp]') {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + Buffer.byteLength(value.source, 'utf8') + 1\n + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1\n } else {\n if(serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + 4 + Buffer.byteLength(value.toString(), 'utf8') + 1 + calculateObjectSize(value.scope, serializeFunctions, ignoreUndefined);\n } else if(serializeFunctions) {\n return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + Buffer.byteLength(value.toString(), 'utf8') + 1;\n }\n }\n }\n\n return 0;\n}\n\nvar BSON = {};\n\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\nmodule.exports = calculateObjectSize;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/parser/calculate_size.js","\"use strict\"\n\nvar readIEEE754 = require('../float_parser').readIEEE754,\n\tf = require('util').format,\n\tLong = require('../long').Long,\n Double = require('../double').Double,\n Timestamp = require('../timestamp').Timestamp,\n ObjectID = require('../objectid').ObjectID,\n Symbol = require('../symbol').Symbol,\n Code = require('../code').Code,\n MinKey = require('../min_key').MinKey,\n MaxKey = require('../max_key').MaxKey,\n\tDecimal128 = require('../decimal128'),\n\tInt32 = require('../int_32'),\n DBRef = require('../db_ref').DBRef,\n BSONRegExp = require('../regexp').BSONRegExp,\n Binary = require('../binary').Binary;\n\nvar deserialize = function(buffer, options, isArray) {\n\toptions = options == null ? {} : options;\n\tvar index = options && options.index ? options.index : 0;\n\t// Read the document size\n var size = buffer[index] | buffer[index+1] << 8 | buffer[index+2] << 16 | buffer[index+3] << 24;\n\n\t// Ensure buffer is valid size\n if(size < 5 || buffer.length < size || (size + index) > buffer.length) {\n\t\tthrow new Error(\"corrupt bson message\");\n\t}\n\n\t// Illegal end value\n\tif(buffer[index + size - 1] != 0) {\n\t\tthrow new Error(\"One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00\");\n\t}\n\n\t// Start deserializtion\n\treturn deserializeObject(buffer, index, options, isArray);\n}\n\nvar deserializeObject = function(buffer, index, options, isArray) {\n\tvar evalFunctions = options['evalFunctions'] == null ? false : options['evalFunctions'];\n var cacheFunctions = options['cacheFunctions'] == null ? false : options['cacheFunctions'];\n var cacheFunctionsCrc32 = options['cacheFunctionsCrc32'] == null ? false : options['cacheFunctionsCrc32'];\n\tvar fieldsAsRaw = options['fieldsAsRaw'] == null ? null : options['fieldsAsRaw'];\n\n\t// Return raw bson buffer instead of parsing it\n\tvar raw = options['raw'] == null ? false : options['raw'];\n\n\t// Return BSONRegExp objects instead of native regular expressions\n var bsonRegExp = typeof options['bsonRegExp'] == 'boolean' ? options['bsonRegExp'] : false;\n\n\t// Controls the promotion of values vs wrapper classes\n\tvar promoteBuffers = options['promoteBuffers'] == null ? false : options['promoteBuffers'];\n\tvar promoteLongs = options['promoteLongs'] == null ? true : options['promoteLongs'];\n\tvar promoteValues = options['promoteValues'] == null ? true : options['promoteValues'];\n\n\t// Set the start index\n\tvar startIndex = index;\n\n // Validate that we have at least 4 bytes of buffer\n if(buffer.length < 5) throw new Error(\"corrupt bson message < 5 bytes long\");\n\n\t// Read the document size\n var size = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n\t// Ensure buffer is valid size\n if(size < 5 || size > buffer.length) throw new Error(\"corrupt bson message\");\n\n // Create holding object\n var object = isArray ? [] : {};\n\t// Used for arrays to skip having to perform utf8 decoding\n\tvar arrayIndex = 0;\n\n // While we have more left data left keep parsing\n while(true) {\n // Read the type\n var elementType = buffer[index++];\n // If we get a zero it's the last byte, exit\n if(elementType == 0) {\n\t\t\tbreak;\n\t\t}\n\n\t\t// Get the start search index\n\t\tvar i = index;\n\t\t// Locate the end of the c string\n\t\twhile(buffer[i] !== 0x00 && i < buffer.length) {\n\t\t\ti++\n\t\t}\n\n\t\t// If are at the end of the buffer there is a problem with the document\n\t\tif(i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\")\n\t\tvar name = isArray ? arrayIndex++ : buffer.toString('utf8', index, i);\n\n\t\tindex = i + 1;\n\n\t\tif(elementType == BSON.BSON_DATA_STRING) {\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\tif(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n object[name] = buffer.toString('utf8', index, index + stringSize - 1);\n index = index + stringSize;\n\t\t} else if(elementType == BSON.BSON_DATA_OID) {\n\t\t\tvar oid = new Buffer(12);\n\t\t\tbuffer.copy(oid, 0, index, index + 12);\n object[name] = new ObjectID(oid);\n index = index + 12;\n\t\t} else if(elementType == BSON.BSON_DATA_INT && promoteValues == false) {\n\t\t\tobject[name] = new Int32(buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24);\n\t\t} else if(elementType == BSON.BSON_DATA_INT) {\n object[name] = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t} else if(elementType == BSON.BSON_DATA_NUMBER && promoteValues == false) {\n\t\t\tobject[name] = new Double(buffer.readDoubleLE(index));\n\t\t\tindex = index + 8;\n\t\t} else if(elementType == BSON.BSON_DATA_NUMBER) {\n\t\t\tobject[name] = buffer.readDoubleLE(index);\n index = index + 8;\n\t\t} else if(elementType == BSON.BSON_DATA_DATE) {\n var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n object[name] = new Date(new Long(lowBits, highBits).toNumber());\n\t\t} else if(elementType == BSON.BSON_DATA_BOOLEAN) {\n\t\t\tif(buffer[index] != 0 && buffer[index] != 1) throw new Error('illegal boolean type value');\n object[name] = buffer[index++] == 1;\n\t\t} else if(elementType == BSON.BSON_DATA_OBJECT) {\n\t\t\tvar _index = index;\n var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;\n\t\t\tif(objectSize <= 0 || objectSize > (buffer.length - index)) throw new Error(\"bad embedded document length in bson\");\n\n\t\t\t// We have a raw value\n\t\t\tif(raw) {\n\t object[name] = buffer.slice(index, index + objectSize);\n\t\t\t} else {\n\t object[name] = deserializeObject(buffer, _index, options, false);\n\t\t\t}\n\n index = index + objectSize;\n\t\t} else if(elementType == BSON.BSON_DATA_ARRAY) {\n\t\t\tvar _index = index;\n var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;\n\t\t\tvar arrayOptions = options;\n\n\t\t\t// Stop index\n\t\t\tvar stopIndex = index + objectSize;\n\n\t\t\t// All elements of array to be returned as raw bson\n\t\t\tif(fieldsAsRaw && fieldsAsRaw[name]) {\n\t\t\t\tarrayOptions = {};\n\t\t\t\tfor(var n in options) arrayOptions[n] = options[n];\n\t\t\t\tarrayOptions['raw'] = true;\n\t\t\t}\n\n object[name] = deserializeObject(buffer, _index, arrayOptions, true);\n index = index + objectSize;\n\n\t\t\tif(buffer[index - 1] != 0) throw new Error('invalid array terminator byte');\n\t\t\tif(index != stopIndex) throw new Error('corrupted array bson');\n\t\t} else if(elementType == BSON.BSON_DATA_UNDEFINED) {\n object[name] = undefined;\n\t\t} else if(elementType == BSON.BSON_DATA_NULL) {\n\t\t\tobject[name] = null;\n\t\t} else if(elementType == BSON.BSON_DATA_LONG) {\n // Unpack the low and high bits\n var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var long = new Long(lowBits, highBits);\n // Promote the long if possible\n if(promoteLongs && promoteValues == true) {\n object[name] = long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG) ? long.toNumber() : long;\n } else {\n object[name] = long;\n }\n\t\t} else if(elementType == BSON.BSON_DATA_DECIMAL128) {\n\t\t\t// Buffer to contain the decimal bytes\n\t\t\tvar bytes = new Buffer(16);\n\t\t\t// Copy the next 16 bytes into the bytes buffer\n\t\t\tbuffer.copy(bytes, 0, index, index + 16);\n\t\t\t// Update index\n\t\t\tindex = index + 16;\n\t\t\t// Assign the new Decimal128 value\n\t\t\tvar decimal128 = new Decimal128(bytes);\n\t\t\t// If we have an alternative mapper use that\n\t\t\tobject[name] = decimal128.toObject ? decimal128.toObject() : decimal128;\n\t\t} else if(elementType == BSON.BSON_DATA_BINARY) {\n var binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\tvar totalBinarySize = binarySize;\n var subType = buffer[index++];\n\n\t\t\t// Did we have a negative binary size, throw\n\t\t\tif(binarySize < 0) throw new Error('Negative binary type element size found');\n\n\t\t\t// Is the length longer than the document\n\t\t\tif(binarySize > buffer.length) throw new Error('Binary type size larger than document size');\n\n\t\t\t// Decode as raw Buffer object if options specifies it\n if(buffer['slice'] != null) {\n // If we have subtype 2 skip the 4 bytes for the size\n if(subType == Binary.SUBTYPE_BYTE_ARRAY) {\n binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\t\t\tif(binarySize < 0) throw new Error('Negative binary type element size found for subtype 0x02');\n\t\t\t\t\tif(binarySize > (totalBinarySize - 4)) throw new Error('Binary type with subtype 0x02 contains to long binary size');\n\t\t\t\t\tif(binarySize < (totalBinarySize - 4)) throw new Error('Binary type with subtype 0x02 contains to short binary size');\n }\n\n if(promoteBuffers && promoteValues) {\n object[name] = buffer.slice(index, index + binarySize);\n } else {\n object[name] = new Binary(buffer.slice(index, index + binarySize), subType);\n }\n } else {\n var _buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(binarySize)) : new Array(binarySize);\n // If we have subtype 2 skip the 4 bytes for the size\n if(subType == Binary.SUBTYPE_BYTE_ARRAY) {\n binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\t\t\tif(binarySize < 0) throw new Error('Negative binary type element size found for subtype 0x02');\n\t\t\t\t\tif(binarySize > (totalBinarySize - 4)) throw new Error('Binary type with subtype 0x02 contains to long binary size');\n\t\t\t\t\tif(binarySize < (totalBinarySize - 4)) throw new Error('Binary type with subtype 0x02 contains to short binary size');\n }\n\n // Copy the data\n for(var i = 0; i < binarySize; i++) {\n _buffer[i] = buffer[index + i];\n }\n\n if(promoteBuffers && promoteValues) {\n object[name] = _buffer;\n } else {\n object[name] = new Binary(_buffer, subType);\n }\n }\n\n // Update the index\n index = index + binarySize;\n\t\t} else if(elementType == BSON.BSON_DATA_REGEXP && bsonRegExp == false) {\n\t\t\t// Get the start search index\n\t\t\tvar i = index;\n\t\t\t// Locate the end of the c string\n\t\t\twhile(buffer[i] !== 0x00 && i < buffer.length) {\n\t\t\t\ti++\n\t\t\t}\n\t\t\t// If are at the end of the buffer there is a problem with the document\n\t\t\tif(i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\")\n\t\t\t// Return the C string\n\t\t\tvar source = buffer.toString('utf8', index, i);\n // Create the regexp\n\t\t\tindex = i + 1;\n\n\t\t\t// Get the start search index\n\t\t\tvar i = index;\n\t\t\t// Locate the end of the c string\n\t\t\twhile(buffer[i] !== 0x00 && i < buffer.length) {\n\t\t\t\ti++\n\t\t\t}\n\t\t\t// If are at the end of the buffer there is a problem with the document\n\t\t\tif(i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\")\n\t\t\t// Return the C string\n\t\t\tvar regExpOptions = buffer.toString('utf8', index, i);\n\t\t\tindex = i + 1;\n\n // For each option add the corresponding one for javascript\n var optionsArray = new Array(regExpOptions.length);\n\n // Parse options\n for(var i = 0; i < regExpOptions.length; i++) {\n switch(regExpOptions[i]) {\n case 'm':\n optionsArray[i] = 'm';\n break;\n case 's':\n optionsArray[i] = 'g';\n break;\n case 'i':\n optionsArray[i] = 'i';\n break;\n }\n }\n\n object[name] = new RegExp(source, optionsArray.join(''));\n } else if(elementType == BSON.BSON_DATA_REGEXP && bsonRegExp == true) {\n\t\t\t// Get the start search index\n\t\t\tvar i = index;\n\t\t\t// Locate the end of the c string\n\t\t\twhile(buffer[i] !== 0x00 && i < buffer.length) {\n\t\t\t\ti++\n\t\t\t}\n\t\t\t// If are at the end of the buffer there is a problem with the document\n\t\t\tif(i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\")\n\t\t\t// Return the C string\n\t\t\tvar source = buffer.toString('utf8', index, i);\n index = i + 1;\n\n\t\t\t// Get the start search index\n\t\t\tvar i = index;\n\t\t\t// Locate the end of the c string\n\t\t\twhile(buffer[i] !== 0x00 && i < buffer.length) {\n\t\t\t\ti++\n\t\t\t}\n\t\t\t// If are at the end of the buffer there is a problem with the document\n\t\t\tif(i >= buffer.length) throw new Error(\"Bad BSON Document: illegal CString\")\n\t\t\t// Return the C string\n\t\t\tvar regExpOptions = buffer.toString('utf8', index, i);\n index = i + 1;\n\n // Set the object\n object[name] = new BSONRegExp(source, regExpOptions);\n\t\t} else if(elementType == BSON.BSON_DATA_SYMBOL) {\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\tif(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n object[name] = new Symbol(buffer.toString('utf8', index, index + stringSize - 1));\n index = index + stringSize;\n\t\t} else if(elementType == BSON.BSON_DATA_TIMESTAMP) {\n var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n object[name] = new Timestamp(lowBits, highBits);\n\t\t} else if(elementType == BSON.BSON_DATA_MIN_KEY) {\n object[name] = new MinKey();\n\t\t} else if(elementType == BSON.BSON_DATA_MAX_KEY) {\n object[name] = new MaxKey();\n\t\t} else if(elementType == BSON.BSON_DATA_CODE) {\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\tif(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n var functionString = buffer.toString('utf8', index, index + stringSize - 1);\n\n // If we are evaluating the functions\n if(evalFunctions) {\n var value = null;\n // If we have cache enabled let's look for the md5 of the function in the cache\n if(cacheFunctions) {\n var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString;\n // Got to do this to avoid V8 deoptimizing the call due to finding eval\n object[name] = isolateEvalWithHash(functionCache, hash, functionString, object);\n } else {\n object[name] = isolateEval(functionString);\n }\n } else {\n object[name] = new Code(functionString);\n }\n\n // Update parse index position\n index = index + stringSize;\n\t\t} else if(elementType == BSON.BSON_DATA_CODE_W_SCOPE) {\n var totalSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\n\t\t\t// Element cannot be shorter than totalSize + stringSize + documentSize + terminator\n\t\t\tif(totalSize < (4 + 4 + 4 + 1)) {\n\t\t\t\tthrow new Error(\"code_w_scope total size shorter minimum expected length\");\n\t\t\t}\n\n\t\t\t// Get the code string size\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\t// Check if we have a valid string\n\t\t\tif(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n\n // Javascript function\n var functionString = buffer.toString('utf8', index, index + stringSize - 1);\n // Update parse index position\n index = index + stringSize;\n // Parse the element\n\t\t\tvar _index = index;\n // Decode the size of the object document\n var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;\n // Decode the scope object\n var scopeObject = deserializeObject(buffer, _index, options, false);\n // Adjust the index\n index = index + objectSize;\n\n\t\t\t// Check if field length is to short\n\t\t\tif(totalSize < (4 + 4 + objectSize + stringSize)) {\n\t\t\t\tthrow new Error('code_w_scope total size is to short, truncating scope');\n\t\t\t}\n\n\t\t\t// Check if totalSize field is to long\n\t\t\tif(totalSize > (4 + 4 + objectSize + stringSize)) {\n\t\t\t\tthrow new Error('code_w_scope total size is to long, clips outer document');\n\t\t\t}\n\n // If we are evaluating the functions\n if(evalFunctions) {\n // Contains the value we are going to set\n var value = null;\n // If we have cache enabled let's look for the md5 of the function in the cache\n if(cacheFunctions) {\n var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString;\n // Got to do this to avoid V8 deoptimizing the call due to finding eval\n object[name] = isolateEvalWithHash(functionCache, hash, functionString, object);\n } else {\n object[name] = isolateEval(functionString);\n }\n\n object[name].scope = scopeObject;\n } else {\n object[name] = new Code(functionString, scopeObject);\n }\n\t\t} else if(elementType == BSON.BSON_DATA_DBPOINTER) {\n\t\t\t// Get the code string size\n var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;\n\t\t\t// Check if we have a valid string\n\t\t\tif(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error(\"bad string length in bson\");\n\t\t\t// Namespace\n var namespace = buffer.toString('utf8', index, index + stringSize - 1);\n\t\t\t// Update parse index position\n index = index + stringSize;\n\n\t\t\t// Read the oid\n\t\t\tvar oidBuffer = new Buffer(12);\n\t\t\tbuffer.copy(oidBuffer, 0, index, index + 12);\n var oid = new ObjectID(oidBuffer);\n\n\t\t\t// Update the index\n\t\t\tindex = index + 12;\n\n\t\t\t// Split the namespace\n\t\t\tvar parts = namespace.split('.');\n\t\t\tvar db = parts.shift();\n\t\t\tvar collection = parts.join('.');\n\t\t\t// Upgrade to DBRef type\n\t\t\tobject[name] = new DBRef(collection, oid, db);\n } else {\n\t\t\tthrow new Error(\"Detected unknown BSON type \" + elementType.toString(16) + \" for fieldname \\\"\" + name + \"\\\", are you using the latest BSON parser\");\n\t\t}\n }\n\n\t// Check if the deserialization was against a valid array/object\n\tif(size != (index - startIndex)) {\n\t\tif(isArray) throw new Error('corrupt array bson');\n\t\tthrow new Error('corrupt object bson');\n\t}\n\n // Check if we have a db ref object\n if(object['$id'] != null) object = new DBRef(object['$ref'], object['$id'], object['$db']);\n return object;\n}\n\n/**\n * Ensure eval is isolated.\n *\n * @ignore\n * @api private\n */\nvar isolateEvalWithHash = function(functionCache, hash, functionString, object) {\n // Contains the value we are going to set\n var value = null;\n\n // Check for cache hit, eval if missing and return cached function\n if(functionCache[hash] == null) {\n eval(\"value = \" + functionString);\n functionCache[hash] = value;\n }\n // Set the object\n return functionCache[hash].bind(object);\n}\n\n/**\n * Ensure eval is isolated.\n *\n * @ignore\n * @api private\n */\nvar isolateEval = function(functionString) {\n // Contains the value we are going to set\n var value = null;\n // Eval the function\n eval(\"value = \" + functionString);\n return value;\n}\n\nvar BSON = {};\n\n/**\n * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5\n *\n * @ignore\n * @api private\n */\nvar functionCache = BSON.functionCache = {};\n\n/**\n * Number BSON Type\n *\n * @classconstant BSON_DATA_NUMBER\n **/\nBSON.BSON_DATA_NUMBER = 1;\n/**\n * String BSON Type\n *\n * @classconstant BSON_DATA_STRING\n **/\nBSON.BSON_DATA_STRING = 2;\n/**\n * Object BSON Type\n *\n * @classconstant BSON_DATA_OBJECT\n **/\nBSON.BSON_DATA_OBJECT = 3;\n/**\n * Array BSON Type\n *\n * @classconstant BSON_DATA_ARRAY\n **/\nBSON.BSON_DATA_ARRAY = 4;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_BINARY\n **/\nBSON.BSON_DATA_BINARY = 5;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_UNDEFINED\n **/\nBSON.BSON_DATA_UNDEFINED = 6;\n/**\n * ObjectID BSON Type\n *\n * @classconstant BSON_DATA_OID\n **/\nBSON.BSON_DATA_OID = 7;\n/**\n * Boolean BSON Type\n *\n * @classconstant BSON_DATA_BOOLEAN\n **/\nBSON.BSON_DATA_BOOLEAN = 8;\n/**\n * Date BSON Type\n *\n * @classconstant BSON_DATA_DATE\n **/\nBSON.BSON_DATA_DATE = 9;\n/**\n * null BSON Type\n *\n * @classconstant BSON_DATA_NULL\n **/\nBSON.BSON_DATA_NULL = 10;\n/**\n * RegExp BSON Type\n *\n * @classconstant BSON_DATA_REGEXP\n **/\nBSON.BSON_DATA_REGEXP = 11;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_DBPOINTER\n **/\nBSON.BSON_DATA_DBPOINTER = 12;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_CODE\n **/\nBSON.BSON_DATA_CODE = 13;\n/**\n * Symbol BSON Type\n *\n * @classconstant BSON_DATA_SYMBOL\n **/\nBSON.BSON_DATA_SYMBOL = 14;\n/**\n * Code with Scope BSON Type\n *\n * @classconstant BSON_DATA_CODE_W_SCOPE\n **/\nBSON.BSON_DATA_CODE_W_SCOPE = 15;\n/**\n * 32 bit Integer BSON Type\n *\n * @classconstant BSON_DATA_INT\n **/\nBSON.BSON_DATA_INT = 16;\n/**\n * Timestamp BSON Type\n *\n * @classconstant BSON_DATA_TIMESTAMP\n **/\nBSON.BSON_DATA_TIMESTAMP = 17;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_LONG\n **/\nBSON.BSON_DATA_LONG = 18;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_DECIMAL128\n **/\nBSON.BSON_DATA_DECIMAL128 = 19;\n/**\n * MinKey BSON Type\n *\n * @classconstant BSON_DATA_MIN_KEY\n **/\nBSON.BSON_DATA_MIN_KEY = 0xff;\n/**\n * MaxKey BSON Type\n *\n * @classconstant BSON_DATA_MAX_KEY\n **/\nBSON.BSON_DATA_MAX_KEY = 0x7f;\n\n/**\n * Binary Default Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_DEFAULT\n **/\nBSON.BSON_BINARY_SUBTYPE_DEFAULT = 0;\n/**\n * Binary Function Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_FUNCTION\n **/\nBSON.BSON_BINARY_SUBTYPE_FUNCTION = 1;\n/**\n * Binary Byte Array Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY\n **/\nBSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;\n/**\n * Binary UUID Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_UUID\n **/\nBSON.BSON_BINARY_SUBTYPE_UUID = 3;\n/**\n * Binary MD5 Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_MD5\n **/\nBSON.BSON_BINARY_SUBTYPE_MD5 = 4;\n/**\n * Binary User Defined Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED\n **/\nBSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128;\n\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\nBSON.BSON_INT64_MAX = Math.pow(2, 63) - 1;\nBSON.BSON_INT64_MIN = -Math.pow(2, 63);\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\n// Internal long versions\nvar JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double.\nvar JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double.\n\nmodule.exports = deserialize\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/parser/deserializer.js","\"use strict\"\n\nvar writeIEEE754 = require('../float_parser').writeIEEE754,\n readIEEE754 = require('../float_parser').readIEEE754,\n Long = require('../long').Long,\n Map = require('../map'),\n Double = require('../double').Double,\n Timestamp = require('../timestamp').Timestamp,\n ObjectID = require('../objectid').ObjectID,\n Symbol = require('../symbol').Symbol,\n Code = require('../code').Code,\n BSONRegExp = require('../regexp').BSONRegExp,\n Int32 = require('../int_32').Int32,\n MinKey = require('../min_key').MinKey,\n MaxKey = require('../max_key').MaxKey,\n Decimal128 = require('../decimal128'),\n DBRef = require('../db_ref').DBRef,\n Binary = require('../binary').Binary;\n\ntry {\n var _Buffer = Uint8Array;\n} catch(e) {\n var _Buffer = Buffer;\n}\n\nvar regexp = /\\x00/\n\n// To ensure that 0.4 of node works correctly\nvar isDate = function isDate(d) {\n return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]';\n}\n\nvar isRegExp = function isRegExp(d) {\n return Object.prototype.toString.call(d) === '[object RegExp]';\n}\n\nvar serializeString = function(buffer, key, value, index, isArray) {\n // Encode String type\n buffer[index++] = BSON.BSON_DATA_STRING;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes + 1;\n buffer[index - 1] = 0;\n // Write the string\n var size = buffer.write(value, index + 4, 'utf8');\n // Write the size of the string to buffer\n buffer[index + 3] = (size + 1 >> 24) & 0xff;\n buffer[index + 2] = (size + 1 >> 16) & 0xff;\n buffer[index + 1] = (size + 1 >> 8) & 0xff;\n buffer[index] = size + 1 & 0xff;\n // Update index\n index = index + 4 + size;\n // Write zero\n buffer[index++] = 0;\n return index;\n}\n\nvar serializeNumber = function(buffer, key, value, index, isArray) {\n // We have an integer value\n if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) {\n // If the value fits in 32 bits encode as int, if it fits in a double\n // encode it as a double, otherwise long\n if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) {\n // Set int type 32 bits or less\n buffer[index++] = BSON.BSON_DATA_INT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the int value\n buffer[index++] = value & 0xff;\n buffer[index++] = (value >> 8) & 0xff;\n buffer[index++] = (value >> 16) & 0xff;\n buffer[index++] = (value >> 24) & 0xff;\n } else if(value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) {\n // Encode as double\n buffer[index++] = BSON.BSON_DATA_NUMBER;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write float\n writeIEEE754(buffer, value, index, 'little', 52, 8);\n // Ajust index\n index = index + 8;\n } else {\n // Set long type\n buffer[index++] = BSON.BSON_DATA_LONG;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n var longVal = Long.fromNumber(value);\n var lowBits = longVal.getLowBits();\n var highBits = longVal.getHighBits();\n // Encode low bits\n buffer[index++] = lowBits & 0xff;\n buffer[index++] = (lowBits >> 8) & 0xff;\n buffer[index++] = (lowBits >> 16) & 0xff;\n buffer[index++] = (lowBits >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = highBits & 0xff;\n buffer[index++] = (highBits >> 8) & 0xff;\n buffer[index++] = (highBits >> 16) & 0xff;\n buffer[index++] = (highBits >> 24) & 0xff;\n }\n } else {\n // Encode as double\n buffer[index++] = BSON.BSON_DATA_NUMBER;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write float\n writeIEEE754(buffer, value, index, 'little', 52, 8);\n // Ajust index\n index = index + 8;\n }\n\n return index;\n}\n\nvar serializeNull = function(buffer, key, value, index, isArray) {\n // Set long type\n buffer[index++] = BSON.BSON_DATA_NULL;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n return index;\n}\n\nvar serializeBoolean = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_BOOLEAN;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Encode the boolean value\n buffer[index++] = value ? 1 : 0;\n return index;\n}\n\nvar serializeDate = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_DATE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Write the date\n var dateInMilis = Long.fromNumber(value.getTime());\n var lowBits = dateInMilis.getLowBits();\n var highBits = dateInMilis.getHighBits();\n // Encode low bits\n buffer[index++] = lowBits & 0xff;\n buffer[index++] = (lowBits >> 8) & 0xff;\n buffer[index++] = (lowBits >> 16) & 0xff;\n buffer[index++] = (lowBits >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = highBits & 0xff;\n buffer[index++] = (highBits >> 8) & 0xff;\n buffer[index++] = (highBits >> 16) & 0xff;\n buffer[index++] = (highBits >> 24) & 0xff;\n return index;\n}\n\nvar serializeRegExp = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_REGEXP;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n if (value.source && value.source.match(regexp) != null) {\n throw Error(\"value \" + value.source + \" must not contain null bytes\");\n }\n // Adjust the index\n index = index + buffer.write(value.source, index, 'utf8');\n // Write zero\n buffer[index++] = 0x00;\n // Write the parameters\n if(value.global) buffer[index++] = 0x73; // s\n if(value.ignoreCase) buffer[index++] = 0x69; // i\n if(value.multiline) buffer[index++] = 0x6d; // m\n // Add ending zero\n buffer[index++] = 0x00;\n return index;\n}\n\nvar serializeBSONRegExp = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_REGEXP;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Check the pattern for 0 bytes\n if (value.pattern.match(regexp) != null) {\n // The BSON spec doesn't allow keys with null bytes because keys are\n // null-terminated.\n throw Error(\"pattern \" + value.pattern + \" must not contain null bytes\");\n }\n\n // Adjust the index\n index = index + buffer.write(value.pattern, index, 'utf8');\n // Write zero\n buffer[index++] = 0x00;\n // Write the options\n index = index + buffer.write(value.options.split('').sort().join(''), index, 'utf8');\n // Add ending zero\n buffer[index++] = 0x00;\n return index;\n}\n\nvar serializeMinMax = function(buffer, key, value, index, isArray) {\n // Write the type of either min or max key\n if(value === null) {\n buffer[index++] = BSON.BSON_DATA_NULL;\n } else if(value instanceof MinKey) {\n buffer[index++] = BSON.BSON_DATA_MIN_KEY;\n } else {\n buffer[index++] = BSON.BSON_DATA_MAX_KEY;\n }\n\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n return index;\n}\n\nvar serializeObjectId = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_OID;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Write the objectId into the shared buffer\n if(typeof value.id == 'string') {\n buffer.write(value.id, index, 'binary')\n } else if(value.id && value.id.copy){\n value.id.copy(buffer, index, 0, 12);\n } else {\n throw new Error('object [' + JSON.stringify(value) + \"] is not a valid ObjectId\");\n }\n\n // Ajust index\n return index + 12;\n}\n\nvar serializeBuffer = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_BINARY;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Get size of the buffer (current write point)\n var size = value.length;\n // Write the size of the string to buffer\n buffer[index++] = size & 0xff;\n buffer[index++] = (size >> 8) & 0xff;\n buffer[index++] = (size >> 16) & 0xff;\n buffer[index++] = (size >> 24) & 0xff;\n // Write the default subtype\n buffer[index++] = BSON.BSON_BINARY_SUBTYPE_DEFAULT;\n // Copy the content form the binary field to the buffer\n value.copy(buffer, index, 0, size);\n // Adjust the index\n index = index + size;\n return index;\n}\n\nvar serializeObject = function(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, isArray, path) {\n for(var i = 0; i < path.length; i++) {\n if(path[i] === value) throw new Error('cyclic dependency detected');\n }\n\n // Push value to stack\n path.push(value);\n // Write the type\n buffer[index++] = Array.isArray(value) ? BSON.BSON_DATA_ARRAY : BSON.BSON_DATA_OBJECT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n var endIndex = serializeInto(buffer, value, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined, path);\n // Pop stack\n path.pop();\n // Write size\n var size = endIndex - index;\n return endIndex;\n}\n\nvar serializeDecimal128 = function(buffer, key, value, index, isArray) {\n buffer[index++] = BSON.BSON_DATA_DECIMAL128;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the data from the value\n value.bytes.copy(buffer, index, 0, 16);\n return index + 16;\n}\n\nvar serializeLong = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = value._bsontype == 'Long' ? BSON.BSON_DATA_LONG : BSON.BSON_DATA_TIMESTAMP;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the date\n var lowBits = value.getLowBits();\n var highBits = value.getHighBits();\n // Encode low bits\n buffer[index++] = lowBits & 0xff;\n buffer[index++] = (lowBits >> 8) & 0xff;\n buffer[index++] = (lowBits >> 16) & 0xff;\n buffer[index++] = (lowBits >> 24) & 0xff;\n // Encode high bits\n buffer[index++] = highBits & 0xff;\n buffer[index++] = (highBits >> 8) & 0xff;\n buffer[index++] = (highBits >> 16) & 0xff;\n buffer[index++] = (highBits >> 24) & 0xff;\n return index;\n}\n\nvar serializeInt32 = function(buffer, key, value, index, isArray) {\n // Set int type 32 bits or less\n buffer[index++] = BSON.BSON_DATA_INT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the int value\n buffer[index++] = value & 0xff;\n buffer[index++] = (value >> 8) & 0xff;\n buffer[index++] = (value >> 16) & 0xff;\n buffer[index++] = (value >> 24) & 0xff;\n return index;\n}\n\nvar serializeDouble = function(buffer, key, value, index, isArray) {\n // Encode as double\n buffer[index++] = BSON.BSON_DATA_NUMBER;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write float\n writeIEEE754(buffer, value, index, 'little', 52, 8);\n // Ajust index\n index = index + 8;\n return index;\n}\n\nvar serializeFunction = function(buffer, key, value, index, checkKeys, depth, isArray) {\n buffer[index++] = BSON.BSON_DATA_CODE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Function string\n var functionString = value.toString();\n // Write the string\n var size = buffer.write(functionString, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = size & 0xff;\n buffer[index + 1] = (size >> 8) & 0xff;\n buffer[index + 2] = (size >> 16) & 0xff;\n buffer[index + 3] = (size >> 24) & 0xff;\n // Update index\n index = index + 4 + size - 1;\n // Write zero\n buffer[index++] = 0;\n return index;\n}\n\nvar serializeCode = function(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, isArray) {\n if(value.scope && typeof value.scope == 'object') {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n // Starting index\n var startIndex = index;\n\n // Serialize the function\n // Get the function string\n var functionString = typeof value.code == 'string' ? value.code : value.code.toString();\n // Index adjustment\n index = index + 4;\n // Write string into buffer\n var codeSize = buffer.write(functionString, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = codeSize & 0xff;\n buffer[index + 1] = (codeSize >> 8) & 0xff;\n buffer[index + 2] = (codeSize >> 16) & 0xff;\n buffer[index + 3] = (codeSize >> 24) & 0xff;\n // Write end 0\n buffer[index + 4 + codeSize - 1] = 0;\n // Write the\n index = index + codeSize + 4;\n\n //\n // Serialize the scope value\n var endIndex = serializeInto(buffer, value.scope, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined)\n index = endIndex - 1;\n\n // Writ the total\n var totalSize = endIndex - startIndex;\n\n // Write the total size of the object\n buffer[startIndex++] = totalSize & 0xff;\n buffer[startIndex++] = (totalSize >> 8) & 0xff;\n buffer[startIndex++] = (totalSize >> 16) & 0xff;\n buffer[startIndex++] = (totalSize >> 24) & 0xff;\n // Write trailing zero\n buffer[index++] = 0;\n } else {\n buffer[index++] = BSON.BSON_DATA_CODE;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Function string\n var functionString = value.code.toString();\n // Write the string\n var size = buffer.write(functionString, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = size & 0xff;\n buffer[index + 1] = (size >> 8) & 0xff;\n buffer[index + 2] = (size >> 16) & 0xff;\n buffer[index + 3] = (size >> 24) & 0xff;\n // Update index\n index = index + 4 + size - 1;\n // Write zero\n buffer[index++] = 0;\n }\n\n return index;\n}\n\nvar serializeBinary = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_BINARY;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Extract the buffer\n var data = value.value(true);\n // Calculate size\n var size = value.position;\n // Add the deprecated 02 type 4 bytes of size to total\n if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) size = size + 4;\n // Write the size of the string to buffer\n buffer[index++] = size & 0xff;\n buffer[index++] = (size >> 8) & 0xff;\n buffer[index++] = (size >> 16) & 0xff;\n buffer[index++] = (size >> 24) & 0xff;\n // Write the subtype to the buffer\n buffer[index++] = value.sub_type;\n\n // If we have binary type 2 the 4 first bytes are the size\n if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) {\n size = size - 4;\n buffer[index++] = size & 0xff;\n buffer[index++] = (size >> 8) & 0xff;\n buffer[index++] = (size >> 16) & 0xff;\n buffer[index++] = (size >> 24) & 0xff;\n }\n\n // Write the data to the object\n data.copy(buffer, index, 0, value.position);\n // Adjust the index\n index = index + value.position;\n return index;\n}\n\nvar serializeSymbol = function(buffer, key, value, index, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_SYMBOL;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n // Write the string\n var size = buffer.write(value.value, index + 4, 'utf8') + 1;\n // Write the size of the string to buffer\n buffer[index] = size & 0xff;\n buffer[index + 1] = (size >> 8) & 0xff;\n buffer[index + 2] = (size >> 16) & 0xff;\n buffer[index + 3] = (size >> 24) & 0xff;\n // Update index\n index = index + 4 + size - 1;\n // Write zero\n buffer[index++] = 0x00;\n return index;\n}\n\nvar serializeDBRef = function(buffer, key, value, index, depth, serializeFunctions, isArray) {\n // Write the type\n buffer[index++] = BSON.BSON_DATA_OBJECT;\n // Number of written bytes\n var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');\n\n // Encode the name\n index = index + numberOfWrittenBytes;\n buffer[index++] = 0;\n\n var startIndex = index;\n var endIndex;\n\n // Serialize object\n if(null != value.db) {\n endIndex = serializeInto(buffer, {\n '$ref': value.namespace\n , '$id' : value.oid\n , '$db' : value.db\n }, false, index, depth + 1, serializeFunctions);\n } else {\n endIndex = serializeInto(buffer, {\n '$ref': value.namespace\n , '$id' : value.oid\n }, false, index, depth + 1, serializeFunctions);\n }\n\n // Calculate object size\n var size = endIndex - startIndex;\n // Write the size\n buffer[startIndex++] = size & 0xff;\n buffer[startIndex++] = (size >> 8) & 0xff;\n buffer[startIndex++] = (size >> 16) & 0xff;\n buffer[startIndex++] = (size >> 24) & 0xff;\n // Set index\n return endIndex;\n}\n\nvar serializeInto = function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializeFunctions, ignoreUndefined, path) {\n startingIndex = startingIndex || 0;\n path = path || [];\n\n // Push the object to the path\n path.push(object);\n\n // Start place to serialize into\n var index = startingIndex + 4;\n var self = this;\n\n // Special case isArray\n if(Array.isArray(object)) {\n // Get object keys\n for(var i = 0; i < object.length; i++) {\n var key = \"\" + i;\n var value = object[i];\n\n // Is there an override value\n if(value && value.toBSON) {\n if(typeof value.toBSON != 'function') throw new Error(\"toBSON is not a function\");\n value = value.toBSON();\n }\n\n var type = typeof value;\n if(type == 'string') {\n index = serializeString(buffer, key, value, index, true);\n } else if(type == 'number') {\n index = serializeNumber(buffer, key, value, index, true);\n } else if(type == 'boolean') {\n index = serializeBoolean(buffer, key, value, index, true);\n } else if(value instanceof Date || isDate(value)) {\n index = serializeDate(buffer, key, value, index, true);\n } else if(value === undefined) {\n index = serializeNull(buffer, key, value, index, true);\n } else if(value === null) {\n index = serializeNull(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'ObjectID') {\n index = serializeObjectId(buffer, key, value, index, true);\n } else if(Buffer.isBuffer(value)) {\n index = serializeBuffer(buffer, key, value, index, true);\n } else if(value instanceof RegExp || isRegExp(value)) {\n index = serializeRegExp(buffer, key, value, index, true);\n } else if(type == 'object' && value['_bsontype'] == null) {\n index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, true, path);\n } else if(type == 'object' && value['_bsontype'] == 'Decimal128') {\n index = serializeDecimal128(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {\n index = serializeLong(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'Double') {\n index = serializeDouble(buffer, key, value, index, true);\n } else if(typeof value == 'function' && serializeFunctions) {\n index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions, true);\n } else if(value['_bsontype'] == 'Code') {\n index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, true);\n } else if(value['_bsontype'] == 'Binary') {\n index = serializeBinary(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'Symbol') {\n index = serializeSymbol(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'DBRef') {\n index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, true);\n } else if(value['_bsontype'] == 'BSONRegExp') {\n index = serializeBSONRegExp(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'Int32') {\n index = serializeInt32(buffer, key, value, index, true);\n } else if(value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n index = serializeMinMax(buffer, key, value, index, true);\n }\n }\n } else if(object instanceof Map) {\n var iterator = object.entries();\n var done = false;\n\n while(!done) {\n // Unpack the next entry\n var entry = iterator.next();\n done = entry.done;\n // Are we done, then skip and terminate\n if(done) continue;\n\n // Get the entry values\n var key = entry.value[0];\n var value = entry.value[1];\n\n // Check the type of the value\n var type = typeof value;\n\n // Check the key and throw error if it's illegal\n if(key != '$db' && key != '$ref' && key != '$id') {\n if (key.match(regexp) != null) {\n // The BSON spec doesn't allow keys with null bytes because keys are\n // null-terminated.\n throw Error(\"key \" + key + \" must not contain null bytes\");\n }\n\n if (checkKeys) {\n if('$' == key[0]) {\n throw Error(\"key \" + key + \" must not start with '$'\");\n } else if (!!~key.indexOf('.')) {\n throw Error(\"key \" + key + \" must not contain '.'\");\n }\n }\n }\n\n if(type == 'string') {\n index = serializeString(buffer, key, value, index);\n } else if(type == 'number') {\n index = serializeNumber(buffer, key, value, index);\n } else if(type == 'boolean') {\n index = serializeBoolean(buffer, key, value, index);\n } else if(value instanceof Date || isDate(value)) {\n index = serializeDate(buffer, key, value, index);\n } else if(value === undefined && ignoreUndefined == true) {\n } else if(value === null || value === undefined) {\n index = serializeNull(buffer, key, value, index);\n } else if(value['_bsontype'] == 'ObjectID') {\n index = serializeObjectId(buffer, key, value, index);\n } else if(Buffer.isBuffer(value)) {\n index = serializeBuffer(buffer, key, value, index);\n } else if(value instanceof RegExp || isRegExp(value)) {\n index = serializeRegExp(buffer, key, value, index);\n } else if(type == 'object' && value['_bsontype'] == null) {\n index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, false, path);\n } else if(type == 'object' && value['_bsontype'] == 'Decimal128') {\n index = serializeDecimal128(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {\n index = serializeLong(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Double') {\n index = serializeDouble(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Code') {\n index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined);\n } else if(typeof value == 'function' && serializeFunctions) {\n index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions);\n } else if(value['_bsontype'] == 'Binary') {\n index = serializeBinary(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Symbol') {\n index = serializeSymbol(buffer, key, value, index);\n } else if(value['_bsontype'] == 'DBRef') {\n index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions);\n } else if(value['_bsontype'] == 'BSONRegExp') {\n index = serializeBSONRegExp(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Int32') {\n index = serializeInt32(buffer, key, value, index);\n } else if(value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n index = serializeMinMax(buffer, key, value, index);\n }\n }\n } else {\n // Did we provide a custom serialization method\n if(object.toBSON) {\n if(typeof object.toBSON != 'function') throw new Error(\"toBSON is not a function\");\n object = object.toBSON();\n if(object != null && typeof object != 'object') throw new Error(\"toBSON function did not return an object\");\n }\n\n // Iterate over all the keys\n for(var key in object) {\n var value = object[key];\n // Is there an override value\n if(value && value.toBSON) {\n if(typeof value.toBSON != 'function') throw new Error(\"toBSON is not a function\");\n value = value.toBSON();\n }\n\n // Check the type of the value\n var type = typeof value;\n\n // Check the key and throw error if it's illegal\n if(key != '$db' && key != '$ref' && key != '$id') {\n if (key.match(regexp) != null) {\n // The BSON spec doesn't allow keys with null bytes because keys are\n // null-terminated.\n throw Error(\"key \" + key + \" must not contain null bytes\");\n }\n\n if (checkKeys) {\n if('$' == key[0]) {\n throw Error(\"key \" + key + \" must not start with '$'\");\n } else if (!!~key.indexOf('.')) {\n throw Error(\"key \" + key + \" must not contain '.'\");\n }\n }\n }\n\n if(type == 'string') {\n index = serializeString(buffer, key, value, index);\n } else if(type == 'number') {\n index = serializeNumber(buffer, key, value, index);\n } else if(type == 'boolean') {\n index = serializeBoolean(buffer, key, value, index);\n } else if(value instanceof Date || isDate(value)) {\n index = serializeDate(buffer, key, value, index);\n } else if(value === undefined && ignoreUndefined == true) {\n } else if(value === null || value === undefined) {\n index = serializeNull(buffer, key, value, index);\n } else if(value['_bsontype'] == 'ObjectID') {\n index = serializeObjectId(buffer, key, value, index);\n } else if(Buffer.isBuffer(value)) {\n index = serializeBuffer(buffer, key, value, index);\n } else if(value instanceof RegExp || isRegExp(value)) {\n index = serializeRegExp(buffer, key, value, index);\n } else if(type == 'object' && value['_bsontype'] == null) {\n index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, false, path);\n } else if(type == 'object' && value['_bsontype'] == 'Decimal128') {\n index = serializeDecimal128(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {\n index = serializeLong(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Double') {\n index = serializeDouble(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Code') {\n index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined);\n } else if(typeof value == 'function' && serializeFunctions) {\n index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions);\n } else if(value['_bsontype'] == 'Binary') {\n index = serializeBinary(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Symbol') {\n index = serializeSymbol(buffer, key, value, index);\n } else if(value['_bsontype'] == 'DBRef') {\n index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions);\n } else if(value['_bsontype'] == 'BSONRegExp') {\n index = serializeBSONRegExp(buffer, key, value, index);\n } else if(value['_bsontype'] == 'Int32') {\n index = serializeInt32(buffer, key, value, index);\n } else if(value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {\n index = serializeMinMax(buffer, key, value, index);\n }\n }\n }\n\n // Remove the path\n path.pop();\n\n // Final padding byte for object\n buffer[index++] = 0x00;\n\n // Final size\n var size = index - startingIndex;\n // Write the size of the object\n buffer[startingIndex++] = size & 0xff;\n buffer[startingIndex++] = (size >> 8) & 0xff;\n buffer[startingIndex++] = (size >> 16) & 0xff;\n buffer[startingIndex++] = (size >> 24) & 0xff;\n return index;\n}\n\nvar BSON = {};\n\n/**\n * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5\n *\n * @ignore\n * @api private\n */\nvar functionCache = BSON.functionCache = {};\n\n/**\n * Number BSON Type\n *\n * @classconstant BSON_DATA_NUMBER\n **/\nBSON.BSON_DATA_NUMBER = 1;\n/**\n * String BSON Type\n *\n * @classconstant BSON_DATA_STRING\n **/\nBSON.BSON_DATA_STRING = 2;\n/**\n * Object BSON Type\n *\n * @classconstant BSON_DATA_OBJECT\n **/\nBSON.BSON_DATA_OBJECT = 3;\n/**\n * Array BSON Type\n *\n * @classconstant BSON_DATA_ARRAY\n **/\nBSON.BSON_DATA_ARRAY = 4;\n/**\n * Binary BSON Type\n *\n * @classconstant BSON_DATA_BINARY\n **/\nBSON.BSON_DATA_BINARY = 5;\n/**\n * ObjectID BSON Type, deprecated\n *\n * @classconstant BSON_DATA_UNDEFINED\n **/\nBSON.BSON_DATA_UNDEFINED = 6;\n/**\n * ObjectID BSON Type\n *\n * @classconstant BSON_DATA_OID\n **/\nBSON.BSON_DATA_OID = 7;\n/**\n * Boolean BSON Type\n *\n * @classconstant BSON_DATA_BOOLEAN\n **/\nBSON.BSON_DATA_BOOLEAN = 8;\n/**\n * Date BSON Type\n *\n * @classconstant BSON_DATA_DATE\n **/\nBSON.BSON_DATA_DATE = 9;\n/**\n * null BSON Type\n *\n * @classconstant BSON_DATA_NULL\n **/\nBSON.BSON_DATA_NULL = 10;\n/**\n * RegExp BSON Type\n *\n * @classconstant BSON_DATA_REGEXP\n **/\nBSON.BSON_DATA_REGEXP = 11;\n/**\n * Code BSON Type\n *\n * @classconstant BSON_DATA_CODE\n **/\nBSON.BSON_DATA_CODE = 13;\n/**\n * Symbol BSON Type\n *\n * @classconstant BSON_DATA_SYMBOL\n **/\nBSON.BSON_DATA_SYMBOL = 14;\n/**\n * Code with Scope BSON Type\n *\n * @classconstant BSON_DATA_CODE_W_SCOPE\n **/\nBSON.BSON_DATA_CODE_W_SCOPE = 15;\n/**\n * 32 bit Integer BSON Type\n *\n * @classconstant BSON_DATA_INT\n **/\nBSON.BSON_DATA_INT = 16;\n/**\n * Timestamp BSON Type\n *\n * @classconstant BSON_DATA_TIMESTAMP\n **/\nBSON.BSON_DATA_TIMESTAMP = 17;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_LONG\n **/\nBSON.BSON_DATA_LONG = 18;\n/**\n * Long BSON Type\n *\n * @classconstant BSON_DATA_DECIMAL128\n **/\nBSON.BSON_DATA_DECIMAL128 = 19;\n/**\n * MinKey BSON Type\n *\n * @classconstant BSON_DATA_MIN_KEY\n **/\nBSON.BSON_DATA_MIN_KEY = 0xff;\n/**\n * MaxKey BSON Type\n *\n * @classconstant BSON_DATA_MAX_KEY\n **/\nBSON.BSON_DATA_MAX_KEY = 0x7f;\n/**\n * Binary Default Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_DEFAULT\n **/\nBSON.BSON_BINARY_SUBTYPE_DEFAULT = 0;\n/**\n * Binary Function Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_FUNCTION\n **/\nBSON.BSON_BINARY_SUBTYPE_FUNCTION = 1;\n/**\n * Binary Byte Array Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY\n **/\nBSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;\n/**\n * Binary UUID Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_UUID\n **/\nBSON.BSON_BINARY_SUBTYPE_UUID = 3;\n/**\n * Binary MD5 Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_MD5\n **/\nBSON.BSON_BINARY_SUBTYPE_MD5 = 4;\n/**\n * Binary User Defined Type\n *\n * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED\n **/\nBSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128;\n\n// BSON MAX VALUES\nBSON.BSON_INT32_MAX = 0x7FFFFFFF;\nBSON.BSON_INT32_MIN = -0x80000000;\n\nBSON.BSON_INT64_MAX = Math.pow(2, 63) - 1;\nBSON.BSON_INT64_MIN = -Math.pow(2, 63);\n\n// JS MAX PRECISE VALUES\nBSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.\nBSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.\n\n// Internal long versions\nvar JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double.\nvar JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double.\n\nmodule.exports = serializeInto;\n\n\n\n// WEBPACK FOOTER //\n// ./~/bson/lib/bson/parser/serializer.js","/* global window, document, fetch */\n\nimport { createStorage } from './storage';\nimport { createProviders, PROVIDER_TYPE_MONGODB_CLOUD } from './providers';\nimport { StitchError } from '../errors';\nimport * as authCommon from './common';\nimport * as common from '../common';\nimport * as _platform from 'detect-browser';\n\nconst jwtDecode = require('jwt-decode');\n\nconst EMBEDDED_USER_AUTH_DATA_PARTS = 4;\n\nexport class AuthFactory {\n constructor() {\n throw new StitchError('Auth can only be made from the AuthFactory.create function');\n }\n\n static create(client, rootUrl, options) {\n return newAuth(client, rootUrl, options);\n }\n}\n\nexport function newAuth(client, rootUrl, options) {\n let auth = Object.create(Auth.prototype);\n let namespace;\n if (!client || client.clientAppID === '') {\n namespace = 'admin';\n } else {\n namespace = `client.${client.clientAppID}`;\n }\n\n options = Object.assign({\n codec: authCommon.APP_CLIENT_CODEC,\n namespace: namespace,\n storageType: 'localStorage'\n }, options);\n\n auth.client = client;\n auth.rootUrl = rootUrl;\n auth.codec = options.codec;\n auth.platform = options.platform || _platform;\n auth.storage = createStorage(options);\n auth.providers = createProviders(auth, options);\n\n return Promise.all([\n auth._get(),\n auth.storage.get(authCommon.REFRESH_TOKEN_KEY),\n auth.storage.get(authCommon.USER_LOGGED_IN_PT_KEY),\n auth.storage.get(authCommon.DEVICE_ID_KEY)\n ]).then(([authObj, rt, loggedInProviderType, deviceId]) => {\n auth.auth = authObj;\n auth.authedId = authObj.userId;\n auth.rt = rt;\n auth.loggedInProviderType = loggedInProviderType;\n auth.deviceId = deviceId;\n\n return auth;\n });\n}\n\nexport class Auth {\n constructor(client, rootUrl, options) {\n throw new StitchError('Auth can only be made from the AuthFactory.create function');\n }\n\n /**\n * Create the device info for this client.\n *\n * @memberof module:auth\n * @method getDeviceInfo\n * @param {String} appId The app ID for this client\n * @param {String} appVersion The version of the app\n * @returns {Object} The device info object\n */\n getDeviceInfo(deviceId, appId, appVersion = '') {\n const deviceInfo = { appId, appVersion, sdkVersion: common.SDK_VERSION };\n\n if (deviceId) {\n deviceInfo.deviceId = deviceId;\n }\n\n if (this.platform) {\n deviceInfo.platform = this.platform.name;\n deviceInfo.platformVersion = this.platform.version;\n }\n\n return deviceInfo;\n }\n\n provider(name) {\n if (!this.providers.hasOwnProperty(name)) {\n throw new Error('Invalid auth provider specified: ' + name);\n }\n\n return this.providers[name];\n }\n\n refreshToken() {\n return this.client.doSessionPost()\n .then((json) => this.set(json));\n }\n\n pageRootUrl() {\n return [window.location.protocol, '//', window.location.host, window.location.pathname].join('');\n }\n\n error() {\n return this._error;\n }\n\n isAppClient() {\n if (!this.client) {\n return true; // Handle the case where Auth is constructed with null\n }\n return this.client.type === common.APP_CLIENT_TYPE;\n }\n\n handleRedirect() {\n if (typeof (window) === 'undefined') {\n // This means we're running in some environment other\n // than a browser - so handling a redirect makes no sense here.\n return;\n }\n if (!window.location || !window.location.hash) {\n return;\n }\n\n let redirectProvider;\n return Promise.all([\n this.storage.get(authCommon.STATE_KEY),\n this.storage.get(authCommon.STITCH_REDIRECT_PROVIDER)\n ]).then(([ourState, _redirectProvider]) => {\n let redirectFragment = window.location.hash.substring(1);\n redirectProvider = _redirectProvider;\n const redirectState = this.parseRedirectFragment(redirectFragment, ourState);\n if (redirectState.lastError || !redirectProvider) {\n console.error(`StitchClient: error from redirect: ${redirectState.lastError ?\n redirectState.lastError : 'provider type not set'}`);\n this._error = redirectState.lastError;\n window.history.replaceState(null, '', this.pageRootUrl());\n return;\n }\n\n if (!redirectState.found) {\n return;\n }\n\n return Promise.all(\n [\n this.storage.remove(authCommon.STATE_KEY),\n this.storage.remove(authCommon.STITCH_REDIRECT_PROVIDER)\n ]\n ).then(() => redirectState);\n }).then((redirectState) => {\n if (!redirectState.stateValid) {\n console.error('StitchClient: state values did not match!');\n window.history.replaceState(null, '', this.pageRootUrl());\n return;\n }\n\n if (!redirectState.ua) {\n console.error('StitchClient: no UA value was returned from redirect!');\n return;\n }\n\n // If we get here, the state is valid - set auth appropriately.\n return this.set(redirectState.ua, redirectProvider);\n }).then(() => window.history.replaceState(null, '', this.pageRootUrl()));\n }\n\n getCookie(name) {\n let splitCookies = document.cookie.split(' ');\n for (let i = 0; i < splitCookies.length; i++) {\n let cookie = splitCookies[i];\n let sepIdx = cookie.indexOf('=');\n let cookieName = cookie.substring(0, sepIdx);\n if (cookieName === name) {\n let cookieVal = cookie.substring(sepIdx + 1, cookie.length);\n if (cookieVal[cookieVal.length - 1] === ';') {\n return cookieVal.substring(0, cookie.length - 1);\n }\n return cookieVal;\n }\n }\n }\n\n handleCookie() {\n if (typeof (window) === 'undefined' || typeof (document) === 'undefined') {\n // This means we're running in some environment other\n // than a browser - so handling a cookie makes no sense here.\n return;\n }\n if (!document.cookie) {\n return;\n }\n\n let uaCookie = this.getCookie(authCommon.USER_AUTH_COOKIE_NAME);\n if (!uaCookie) {\n return;\n }\n\n document.cookie = `${authCommon.USER_AUTH_COOKIE_NAME}=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT;`;\n const userAuth = this.unmarshallUserAuth(uaCookie);\n return this.set(userAuth, PROVIDER_TYPE_MONGODB_CLOUD).then(() =>\n window.history.replaceState(null, '', this.pageRootUrl())\n );\n }\n\n clear() {\n this.auth = null;\n this.authedId = null;\n this.rt = null;\n this.loggedInProviderType = null;\n\n return Promise.all(\n [\n this.storage.remove(authCommon.USER_AUTH_KEY),\n this.storage.remove(authCommon.REFRESH_TOKEN_KEY),\n this.storage.remove(authCommon.USER_LOGGED_IN_PT_KEY),\n this.storage.remove(authCommon.STITCH_REDIRECT_PROVIDER)\n ]\n );\n }\n\n getDeviceId() {\n return this.deviceId;\n }\n\n // Returns whether or not the access token is expired or is going to expire within 'withinSeconds'\n // seconds, according to current system time. Returns false if the token is malformed in any way.\n isAccessTokenExpired(withinSeconds = authCommon.DEFAULT_ACCESS_TOKEN_EXPIRE_WITHIN_SECS) {\n const token = this.getAccessToken();\n if (!token) {\n return false;\n }\n\n let decodedToken;\n try {\n decodedToken = jwtDecode(token);\n } catch (e) {\n return false;\n }\n\n if (!decodedToken) {\n return false;\n }\n\n return decodedToken.exp && Math.floor(Date.now() / 1000) >= decodedToken.exp - withinSeconds;\n }\n\n getAccessToken() {\n return this.auth.accessToken;\n }\n\n getRefreshToken() {\n return this.rt;\n }\n\n set(json, authType = '') {\n if (!json) {\n return;\n }\n\n let newUserAuth = {};\n let setters = [];\n\n if (authType) {\n this.loggedInProviderType = authType;\n setters.push(this.storage.set(authCommon.USER_LOGGED_IN_PT_KEY, authType));\n }\n\n if (json[this.codec.refreshToken]) {\n this.rt = json[this.codec.refreshToken];\n delete json[this.codec.refreshToken];\n setters.push(this.storage.set(authCommon.REFRESH_TOKEN_KEY, this.rt));\n }\n\n if (json[this.codec.deviceId]) {\n this.deviceId = json[this.codec.deviceId];\n delete json[this.codec.deviceId];\n setters.push(this.storage.set(authCommon.DEVICE_ID_KEY, this.deviceId));\n }\n\n // Merge in new fields with old fields. Typically the first json value\n // is complete with every field inside a user auth, but subsequent requests\n // do not include everything. This merging behavior is safe so long as json\n // value responses with absent fields do not indicate that the field should\n // be unset.\n if (json[this.codec.accessToken]) {\n newUserAuth.accessToken = json[this.codec.accessToken];\n }\n if (json[this.codec.userId]) {\n newUserAuth.userId = json[this.codec.userId];\n }\n\n this.auth = Object.assign(this.auth ? this.auth : {}, newUserAuth);\n this.authedId = this.auth.userId;\n setters.push(this.storage.set(authCommon.USER_AUTH_KEY, JSON.stringify(this.auth)));\n return Promise.all(setters).then(() => this.auth);\n }\n\n _get() {\n return this.storage.get(authCommon.USER_AUTH_KEY).then((data) => {\n if (!data) {\n return {};\n }\n\n try {\n return JSON.parse(data);\n } catch (e) {\n // Need to back out and clear auth otherwise we will never\n // be able to do anything useful.\n return this.clear().then(() => {\n throw new StitchError('Failure retrieving stored auth');\n });\n }\n });\n }\n\n getLoggedInProviderType() {\n return this.loggedInProviderType;\n }\n\n parseRedirectFragment(fragment, ourState) {\n // After being redirected from oauth, the URL will look like:\n // https://todo.examples.stitch.mongodb.com/#_stitch_state=...&_stitch_ua=...\n // This function parses out stitch-specific tokens from the fragment and\n // builds an object describing the result.\n const vars = fragment.split('&');\n const result = { ua: null, found: false, stateValid: false, lastError: null };\n let shouldBreak = false;\n for (let i = 0; i < vars.length && !shouldBreak; ++i) {\n const pairParts = vars[i].split('=');\n const pairKey = decodeURIComponent(pairParts[0]);\n switch (pairKey) {\n case authCommon.STITCH_ERROR_KEY:\n result.lastError = decodeURIComponent(pairParts[1]);\n result.found = true;\n shouldBreak = true;\n break;\n case authCommon.USER_AUTH_KEY:\n try {\n result.ua = this.unmarshallUserAuth(decodeURIComponent(pairParts[1]));\n result.found = true;\n } catch (e) {\n result.lastError = e;\n }\n continue;\n case authCommon.STITCH_LINK_KEY:\n result.found = true;\n continue;\n case authCommon.STATE_KEY:\n result.found = true;\n let theirState = decodeURIComponent(pairParts[1]);\n if (ourState && ourState === theirState) {\n result.stateValid = true;\n }\n continue;\n default: continue;\n }\n }\n\n return result;\n }\n\n unmarshallUserAuth(data) {\n let parts = data.split('$');\n if (parts.length !== EMBEDDED_USER_AUTH_DATA_PARTS) {\n throw new RangeError('invalid user auth data provided: ' + data);\n }\n\n return {\n [this.codec.accessToken]: parts[0],\n [this.codec.refreshToken]: parts[1],\n [this.codec.userId]: parts[2],\n [this.codec.deviceId]: parts[3]\n };\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/auth/index.js","import { USER_AUTH_KEY, REFRESH_TOKEN_KEY, DEVICE_ID_KEY, STATE_KEY } from './common';\n\nexport class MemoryStorage {\n constructor() {\n this._data = {};\n this._orderedKeys = [];\n this.length = 0;\n }\n\n getItem(key) {\n return (key in this._data) ? this._data[key] : null;\n }\n\n setItem(key, value) {\n this._orderedKeys.push(key);\n this._data[key] = value;\n this.length++;\n return this._data[key];\n }\n\n removeItem(key) {\n this._orderedKeys.pop(key);\n delete this._data[key];\n this.length--;\n return undefined;\n }\n\n key(index) {\n return this._orderedKeys[index];\n }\n}\n\nconst _VERSION = 1;\nconst _VERSION_KEY = '__stitch_storage_version__';\n\n/**\n * Run a migration on the currently used storage\n * that checks to see if the current version is up to date.\n * If the version has not been set, this method will migrate\n * to the latest version.\n * @param {Integer} version version number of storage\n * @param {Object} storage storage class being checked\n * @returns {Promise} nullable promise containing migration logic\n */\nfunction _runMigration(version, storage) {\n switch (version) {\n case null:\n case undefined:\n // return a promise,\n // mapping each of the store's keys to a Promise\n // that fetches the each value for each key,\n // sets the old value to the new \"namespaced\" key\n // remove the old key value pair,\n // and set the version number\n let migrations = [\n USER_AUTH_KEY,\n REFRESH_TOKEN_KEY,\n DEVICE_ID_KEY,\n STATE_KEY\n ].map(key =>\n Promise.resolve(storage.store.getItem(key))\n .then(item => !!item && storage.store.setItem(storage._generateKey(key), item))\n .then(() => storage.store.removeItem(key))\n );\n return Promise.all(migrations)\n .then(() => storage.store.setItem(_VERSION_KEY, _VERSION));\n // in future versions, `case 1:`, `case 2:` and so on\n // could be added to perform similar migrations\n default: break;\n }\n}\n\nclass Storage {\n /**\n * @param {Storage} store implementer of Storage interface\n * @param {String} namespace clientAppID to be used for namespacing\n * @param\n */\n constructor(store, namespace) {\n this.store = store;\n this.namespace = `_stitch.${namespace}`;\n\n this._migration = Promise.resolve(this.store.getItem(_VERSION_KEY))\n .then(version => _runMigration(version, this));\n }\n\n _generateKey(key) {\n return `${this.namespace}.${key}`;\n }\n\n get(key) {\n return Promise.resolve(this._migration)\n .then(() => this.store.getItem(this._generateKey(key)));\n }\n\n set(key, value) {\n return Promise.resolve(this._migration)\n .then(() => this.store.setItem(this._generateKey(key), value))\n .then(() => value);\n }\n\n remove(key) {\n return Promise.resolve(this._migration)\n .then(() => this.store.removeItem(this._generateKey(key)));\n }\n}\n\nexport function createStorage(options) {\n let { storageType, storage, namespace } = options;\n\n if (storageType === 'localStorage') {\n if ((typeof window !== 'undefined') && 'localStorage' in window && window.localStorage !== null) {\n return new Storage(window.localStorage, namespace);\n }\n } else if (storageType === 'sessionStorage') {\n if ((typeof window !== 'undefined') && 'sessionStorage' in window && window.sessionStorage !== null) {\n return new Storage(window.sessionStorage, namespace);\n }\n } else if (storageType == 'customStorage') { //eslint-disable-line eqeqeq\n return new Storage(storage, namespace);\n }\n\n // default to memory storage\n return new Storage(new MemoryStorage(), namespace);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/auth/storage.js","import { StitchClientFactory } from './client';\nimport { StitchAdminClientFactory } from './admin';\nimport { BSON } from 'mongodb-extjson';\n\nexport {\n StitchClientFactory,\n StitchAdminClientFactory,\n BSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js","import { serviceResponse } from '../../util';\n\n/**\n * Convenience wrapper around AWS S3 service (not meant to be instantiated directly).\n *\n * @class\n * @return {S3Service} a S3Service instance.\n */\nclass S3Service {\n constructor(stitchClient, serviceName) {\n this.client = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Put an object to S3 via Stitch. For small uploads\n *\n * NOTE: body must be a pipeline stream\n *\n * @param {String} bucket which S3 bucket to use\n * @param {String} key which key (filename) to use\n * @param {String} acl which policy to apply\n * @param {String} contentType content type of uploaded data\n * @return {Promise}\n */\n put(bucket, key, acl, contentType) {\n return serviceResponse(this, {\n action: 'put',\n args: { bucket, key, acl, contentType }\n });\n }\n\n /**\n * Sign a policy for putting via Stitch. For large uploads\n *\n * @param {String} bucket which S3 bucket to use\n * @param {String} key which key (filename) to use\n * @param {String} acl which policy to apply\n * @param {String} contentType content type of uploaded data\n * @return {Promise}\n */\n signPolicy(bucket, key, acl, contentType) {\n return serviceResponse(this, {\n action: 'signPolicy',\n args: { bucket, key, acl, contentType }\n });\n }\n}\n\nexport default S3Service;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/aws/s3_service.js","import { serviceResponse } from '../../util';\n\n/**\n * Convenience wrapper around AWS SES service (not meant to be instantiated directly).\n *\n * @class\n * @return {SESService} a SESService instance.\n */\nclass SESService {\n constructor(stitchClient, serviceName) {\n this.client = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Send an email\n *\n * @method\n * @param {String} from the email to send from\n * @param {String} to the email to send to\n * @param {String} subject the subject of the email\n * @param {String} body the body of the email\n * @return {Promise}\n */\n send(from, to, subject, body) {\n return serviceResponse(this, {\n action: 'send',\n args: { from, to, subject, body }\n });\n }\n}\n\nexport default SESService;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/aws/ses_service.js","import { serviceResponse } from '../../util';\n\n/**\n * Convenience wrapper for HTTP service (not meant to be instantiated directly).\n *\n * @class\n * @return {HTTPService} a HTTPService instance.\n */\nclass HTTPService {\n constructor(client, serviceName) {\n this.client = client;\n this.serviceName = serviceName;\n }\n\n /**\n * Send a GET request to a resource (result must be application/json)\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of GET args\n * @param {Object} [options] optional settings for the GET operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n get(urlOrOptions, options = {}) {\n return buildResponse('get', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a POST request to a resource with payload\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of POST args\n * @param {Object} [options] optional settings for the POST operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n post(urlOrOptions, options = {}) {\n return buildResponse('post', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a PUT request to a resource with payload\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of PUT args\n * @param {Object} [options] optional settings for the PUT operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n put(urlOrOptions, options = {}) {\n return buildResponse('put', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a PATCH request to a resource with payload\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of PATCH args\n * @param {Object} [options] optional settings for the PATCH operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n patch(urlOrOptions, options = {}) {\n return buildResponse('patch', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a DELETE request to a resource\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of DELETE args\n * @param {Object} [options] optional settings for the DELETE operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n delete(urlOrOptions, options = {}) {\n return buildResponse('delete', this, buildArgs(urlOrOptions, options));\n }\n\n /**\n * Send a HEAD request to a resource\n *\n * @param {String|Object} urlOrOptions the url to request, or an object of HEAD args\n * @param {Object} [options] optional settings for the HEAD operation\n * @param {String} [options.authUrl] url that grants a cookie\n * @return {Promise}\n */\n head(urlOrOptions, options = {}) {\n return buildResponse('head', this, buildArgs(urlOrOptions, options));\n }\n}\n\nfunction buildArgs(urlOrOptions, options) {\n let args;\n if (typeof urlOrOptions !== 'string') {\n args = urlOrOptions;\n } else {\n args = { url: urlOrOptions };\n if (!!options.authUrl) args.authUrl = options.authUrl;\n }\n\n return args;\n}\n\nfunction buildResponse(action, service, args) {\n return serviceResponse(service, {\n action,\n args\n });\n}\n\nexport default HTTPService;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/http/http_service.js","import S3Service from './aws/s3_service';\nimport SESService from './aws/ses_service';\nimport HTTPService from './http/http_service';\nimport MongoDBService from './mongodb/mongodb_service';\nimport TwilioService from './twilio/twilio_service';\n\nexport default {\n 'aws/s3': S3Service,\n 'aws/ses': SESService,\n 'http': HTTPService,\n 'mongodb': MongoDBService,\n 'twilio': TwilioService\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/index.js","import { serviceResponse } from '../../util';\n\n/**\n * Create a new Collection instance (not meant to be instantiated directly).\n *\n * @class\n * @return {Collection} a Collection instance.\n */\nclass Collection {\n constructor(db, name) {\n this.db = db;\n this.name = name;\n }\n\n /**\n * Inserts a single document.\n *\n * @method\n * @param {Object} doc The document to insert.\n * @return {Promise} a Promise for the operation.\n */\n insertOne(doc) {\n const args = { document: doc };\n return buildResponse('insertOne', this, buildArgs(this, args));\n }\n\n /**\n * Inserts multiple documents.\n *\n * @method\n * @param {Array} docs The documents to insert.\n * @return {Promise} Returns a Promise for the operation.\n */\n insertMany(docs) {\n const args = { documents: Array.isArray(docs) ? docs : [ docs ] };\n return buildResponse('insertMany', this, buildArgs(this, args));\n }\n\n /**\n * Deletes a single document.\n *\n * @method\n * @param {Object} query The query used to match a single document.\n * @return {Promise} Returns a Promise for the operation.\n */\n deleteOne(query) {\n return buildResponse('deleteOne', this, buildArgs(this, { query }));\n }\n\n /**\n * Deletes all documents matching query.\n *\n * @method\n * @param {Object} query The query used to match the documents to delete.\n * @return {Promise} Returns a Promise for the operation.\n */\n deleteMany(query) {\n return buildResponse('deleteMany', this, buildArgs(this, { query }));\n }\n\n /**\n * Updates a single document.\n *\n * @method\n * @param {Object} query The query used to match a single document.\n * @param {Object} update The update operations to perform on the matching document.\n * @param {Object} [options] Additional options object.\n * @param {Boolean} [options.upsert=false] Perform an upsert operation.\n * @return {Promise} A Promise for the operation.\n */\n updateOne(query, update, options = {}) {\n return updateOp(this, false, query, update, options);\n }\n\n /**\n * Updates multiple documents.\n *\n * @method\n * @param {Object} query The query used to match the documents.\n * @param {Object} update The update operations to perform on the matching documents.\n * @param {Object} [options] Additional options object.\n * @param {Boolean} [options.upsert=false] Perform an upsert operation.\n * @return {Promise} Returns a Promise for the operation.\n */\n updateMany(query, update) {\n return updateOp(this, true, query, update);\n }\n\n /**\n * Finds documents.\n *\n * @method\n * @param {Object} query The query used to match documents.\n * @param {Object} [project] The query document projection.\n * @return {MongoQuery} An object which allows for `limit` and `sort` parameters to be set.\n * `execute` will return a {Promise} for the operation.\n */\n find(query, project) {\n return new MongoQuery(this, query, project);\n }\n\n /**\n * Finds one document.\n *\n * @method\n * @param {Object} query The query used to match documents.\n * @param {Object} [project] The query document projection.\n * @return {Promise} Returns a Promise for the operation\n */\n findOne(query, project) {\n return buildResponse('findOne', this, buildArgs(this, { query, project }));\n }\n\n /**\n * Executes an aggregation pipeline.\n *\n * @param {Array} pipeline The aggregation pipeline.\n * @returns {Array} The results of the aggregation.\n */\n aggregate(pipeline) {\n return aggregateOp(this, pipeline);\n }\n\n /**\n * Gets the number of documents matching the filter.\n *\n * @param {Object} query The query used to match documents.\n * @param {Object} options Additional count options.\n * @param {Number} [options.limit=null] The maximum number of documents to return.\n * @return {Number} The results of the count operation.\n */\n count(query, options = {}) {\n let outgoingOptions;\n if (options.limit) {\n outgoingOptions = { limit: options.limit };\n }\n\n return buildResponse('count', this, buildArgs(this, { count: true, query }, outgoingOptions));\n }\n}\n\n// private\n\nfunction updateOp(service, isMulti, query, update, options = {}) {\n const action = isMulti ? 'updateMany' : 'updateOne';\n\n let outgoingOptions;\n if (!isMulti && options.upsert) {\n outgoingOptions = { upsert: true };\n }\n\n return buildResponse(action, service, buildArgs(service, { query, update }, outgoingOptions));\n}\n\nfunction findOp({ service, query, project, limit, sort }) {\n return buildResponse('find', service, buildArgs(service, { query, project, limit, sort }));\n}\n\nfunction aggregateOp(service, pipeline) {\n return buildResponse('aggregate', service, buildArgs(service, { pipeline }));\n}\n\nfunction buildArgs({ db: { name: database }, name: collection }, args, options = {}) {\n return Object.assign(\n { database, collection },\n args,\n options\n );\n}\n\nfunction buildResponse(action, service, args) {\n return serviceResponse(service.db, {\n serviceName: service.db.service,\n action,\n args\n });\n}\n\n// mongo query (find) support\n\nfunction MongoQuery(service, query, project) {\n if (this instanceof MongoQuery) {\n this.service = service;\n this.query = query;\n this.project = project;\n return this;\n }\n return new MongoQuery(service, query, project);\n}\n\nMongoQuery.prototype.limit = function(limit) {\n this.limit = limit;\n return this;\n};\n\nMongoQuery.prototype.sort = function(sort) {\n this.sort = sort;\n return this;\n};\n\nMongoQuery.prototype.execute = function(resolve) {\n return findOp(this);\n};\n\nexport default Collection;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/mongodb/collection.js","import Collection from './collection';\n\n/**\n * Create a new DB instance (not meant to be instantiated directly).\n * @class\n * @return {DB} a DB instance.\n */\nclass DB {\n constructor(client, service, name) {\n this.client = client;\n this.service = service;\n this.name = name;\n }\n\n /**\n * Returns a Collection instance representing a MongoDB Collection object.\n *\n * @method\n * @param {String} name The collection name.\n * @param {Object} [options] Additional options.\n * @return {Collection} returns a Collection instance representing a MongoDb collection.\n */\n collection(name, options = {}) {\n return new Collection(this, name, options);\n }\n}\n\nexport default DB;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/mongodb/db.js","import DB from './db';\n\n/**\n * Create a new MongoDBService instance (not meant to be instantiated directly).\n *\n * @class\n * @return {MongoDBService} a MongoDBService instance.\n */\nclass MongoDBService {\n constructor(stitchClient, serviceName) {\n this.stitchClient = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Get a DB instance\n *\n * @method\n * @param {String} databaseName The MongoDB database name\n * @param {Object} [options] Additional options.\n * @return {DB} returns a DB instance representing a MongoDB database.\n */\n db(databaseName, options = {}) {\n return new DB(this.stitchClient, this.serviceName, databaseName);\n }\n}\n\n\nexport default MongoDBService;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/mongodb/mongodb_service.js","import { serviceResponse } from '../../util';\n\n/**\n * Create a new TwilioService instance (not meant to be instantiated directly).\n *\n * @class\n * @return {TwilioService} a TwilioService instance.\n */\nclass TwilioService {\n constructor(stitchClient, serviceName) {\n this.client = stitchClient;\n this.serviceName = serviceName;\n }\n\n /**\n * Send a text message to a number\n *\n * @method\n * @param {String} from number to send from\n * @param {String} to number to send to\n * @param {String} body SMS body content\n * @return {Promise}\n */\n send(from, to, body) {\n return serviceResponse(this, {\n action: 'send',\n args: { from, to, body }\n });\n }\n}\n\nexport default TwilioService;\n\n\n\n// WEBPACK FOOTER //\n// ./src/services/twilio/twilio_service.js","'use strict';\n\n/**\n * Module dependencies.\n * @ignore\n */\nfunction convert(integer) {\n var str = Number(integer).toString(16);\n return str.length === 1 ? '0' + str : str;\n}\n\nfunction toExtendedJSON(obj) {\n var base64String = obj.buffer.toString('base64');\n\n return {\n $binary: {\n base64: base64String,\n subType: convert(obj.sub_type)\n }\n };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n var type = doc.$binary.subType ? parseInt(doc.$binary.subType, 16) : 0;\n\n var data = new Buffer(doc.$binary.base64, 'base64');\n\n return new BSON.Binary(data, type);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/binary.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n if (obj.scope) {\n return { $code: obj.code, $scope: obj.scope };\n }\n\n return { $code: obj.code };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Code(doc.$code, doc.$scope);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/code.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n var o = {\n $ref: obj.collection,\n $id: obj.oid\n };\n if (obj.db) o.$db = obj.db;\n o = Object.assign(o, obj.fields);\n return o;\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n var copy = Object.assign({}, doc);\n ['$ref', '$id', '$db'].forEach(k => delete copy[k]);\n return new BSON.DBRef(doc.$ref, doc.$id, doc.$db, copy);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/db_ref.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n return { $numberDecimal: obj.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Decimal128.fromString(doc.$numberDecimal);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/decimal128.js","'use strict';\n\nfunction toExtendedJSON(obj, options) {\n if (options.relaxed && isFinite(obj.value)) return obj.value;\n return { $numberDouble: obj.value.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Double(parseFloat(doc.$numberDouble));\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/double.js","'use strict';\n\nvar Binary = require('./binary');\nvar Code = require('./code');\nvar DBRef = require('./db_ref');\nvar Decimal128 = require('./decimal128');\nvar Double = require('./double');\nvar Int32 = require('./int_32');\nvar Long = require('./long');\nvar MaxKey = require('./max_key');\nvar MinKey = require('./min_key');\nvar ObjectID = require('./objectid');\nvar BSONRegExp = require('./regexp');\nvar Symbol = require('./symbol');\nvar Timestamp = require('./timestamp');\n\nmodule.exports = {\n Binary: Binary,\n Code: Code,\n DBRef: DBRef,\n Decimal128: Decimal128,\n Double: Double,\n Int32: Int32,\n Long: Long,\n MaxKey: MaxKey,\n MinKey: MinKey,\n ObjectID: ObjectID,\n BSONRegExp: BSONRegExp,\n Symbol: Symbol,\n Timestamp: Timestamp\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/index.js","'use strict';\n\nfunction toExtendedJSON(obj, options) {\n if (options && options.relaxed) return obj.value;\n return { $numberInt: obj.value.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Int32(doc.$numberInt);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/int_32.js","'use strict';\n\nfunction toExtendedJSON(obj, options) {\n if (options && options.relaxed) return obj.toNumber();\n return { $numberLong: obj.toString() };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return BSON.Long.fromString(doc.$numberLong);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/long.js","'use strict';\n\nfunction toExtendedJSON() {\n return { $maxKey: 1 };\n}\n\nfunction fromExtendedJSON(BSON) {\n return new BSON.MaxKey();\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/max_key.js","'use strict';\n\nfunction toExtendedJSON() {\n return { $minKey: 1 };\n}\n\nfunction fromExtendedJSON(BSON) {\n return new BSON.MinKey();\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/min_key.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n if (obj.toHexString) return { $oid: obj.toHexString() };\n return { $oid: obj.toString('hex') };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.ObjectID(doc.$oid);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/objectid.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n return { $regularExpression: { pattern: obj.pattern, options: obj.options } };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.BSONRegExp(\n doc.$regularExpression.pattern,\n doc.$regularExpression.options\n .split('')\n .sort()\n .join('')\n );\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/regexp.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n return { $symbol: obj.value };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Symbol(doc.$symbol);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/symbol.js","'use strict';\n\nfunction toExtendedJSON(obj) {\n return {\n $timestamp: {\n t: obj.high_,\n i: obj.low_\n }\n };\n}\n\nfunction fromExtendedJSON(BSON, doc) {\n return new BSON.Timestamp(doc.$timestamp.i, doc.$timestamp.t);\n}\n\nmodule.exports = {\n toExtendedJSON: toExtendedJSON,\n fromExtendedJSON: fromExtendedJSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/bson/timestamp.js","'use strict';\n\nlet codecs = require('./bson'),\n BSON = require('bson');\n\nvar BSONTypes = [\n 'Binary',\n 'Code',\n 'DBRef',\n 'Decimal128',\n 'Double',\n 'Int32',\n 'Long',\n 'MaxKey',\n 'MinKey',\n 'ObjectID',\n 'BSONRegExp',\n 'Symbol',\n 'Timestamp'\n];\n\nsetBSONModule(BSON);\n\n// all the types where we don't need to do any special processing and can just pass the EJSON\n//straight to type.fromExtendedJSON\nvar keysToCodecs = {\n $oid: codecs.ObjectID,\n $binary: codecs.Binary,\n $symbol: codecs.Symbol,\n $numberDecimal: codecs.Decimal128,\n $numberLong: codecs.Long,\n $minKey: codecs.MinKey,\n $maxKey: codecs.MaxKey,\n $regularExpression: codecs.BSONRegExp,\n $timestamp: codecs.Timestamp\n};\n\nfunction setBSONModule(module) {\n BSONTypes.forEach(t => {\n if (!module[t]) throw new Error('passed in module does not contain all BSON types required');\n });\n BSON = module;\n}\n\nfunction deserializeValue(self, key, value, options) {\n if (typeof value === 'number') {\n // if it's an integer, should interpret as smallest BSON integer\n // that can represent it exactly. (if out of range, interpret as double.)\n if (Math.floor(value) === value) {\n let int32Range = value >= BSON_INT32_MIN && value <= BSON_INT32_MAX,\n int64Range = value >= BSON_INT64_MIN && value <= BSON_INT64_MAX;\n\n if (int32Range) return options.strict ? new BSON.Int32(value) : value;\n if (int64Range) return options.strict ? new BSON.Long.fromNumber(value) : value;\n }\n // If the number is a non-integer or out of integer range, should interpret as BSON Double.\n return new BSON.Double(value);\n }\n\n // from here on out we're looking for bson types, so bail if its not an object\n if (value == null || typeof value !== 'object') return value;\n\n // upgrade deprecated undefined to null\n if (value.$undefined) return null;\n\n var keys = Object.keys(value).filter(k => k.startsWith('$') && value[k] != null);\n for (let i = 0; i < keys.length; i++) {\n let c = keysToCodecs[keys[i]];\n if (c) return c.fromExtendedJSON(BSON, value);\n }\n\n if (value.$date != null) {\n let d = value.$date,\n date = new Date();\n\n if (typeof d === 'string') date.setTime(Date.parse(d));\n else if (d instanceof BSON.Long) date.setTime(d.toNumber());\n return date;\n }\n\n if (value.$code != null) {\n if (value.$scope) var scope = deserializeValue(self, null, value.$scope);\n let copy = Object.assign({}, value);\n copy.$scope = scope;\n return codecs.Code.fromExtendedJSON(BSON, value);\n }\n\n if (value.$numberDouble != null) {\n return options.strict\n ? codecs.Double.fromExtendedJSON(BSON, value)\n : parseFloat(value.$numberDouble);\n }\n\n if (value.$numberInt != null) {\n return options.strict\n ? codecs.Int32.fromExtendedJSON(BSON, value)\n : parseInt(value.$numberInt, 10);\n }\n\n if (value.$ref != null || value.$dbPointer != null) {\n let v = value.$ref ? value : value.$dbPointer;\n\n // we run into this in a \"degenerate EJSON\" case (with $id and $ref order flipped)\n // because of the order JSON.parse goes through the document\n if (v instanceof BSON.DBRef) return v;\n\n let dollarKeys = Object.keys(v).filter(k => k.startsWith('$')),\n valid = true;\n dollarKeys.forEach(k => {\n if (['$ref', '$id', '$db'].indexOf(k) === -1) valid = false;\n });\n\n // only make DBRef if $ keys are all valid\n if (valid) return codecs.DBRef.fromExtendedJSON(BSON, v);\n }\n\n return value;\n}\n\nconst parse = function(text, options) {\n var self = this;\n options = options || { strict: true };\n\n return JSON.parse(text, function(key, value) {\n return deserializeValue(self, key, value, options);\n });\n};\n\n//\n// Serializer\n//\n\n// MAX INT32 boundaries\nconst BSON_INT32_MAX = 0x7fffffff,\n BSON_INT32_MIN = -0x80000000,\n BSON_INT64_MAX = 0x7fffffffffffffff,\n BSON_INT64_MIN = -0x8000000000000000;\n\nconst stringify = function(value, reducer, indents, options) {\n var opts = {};\n if (options != null && typeof options === 'object') opts = options;\n else if (indents != null && typeof indents === 'object') {\n opts = indents;\n indents = 0;\n } else if (reducer != null && typeof reducer === 'object') {\n opts = reducer;\n reducer = null;\n }\n\n var doc = Array.isArray(value) ? serializeArray(value, opts) : serializeDocument(value, opts);\n return JSON.stringify(doc, reducer, indents);\n};\n\nfunction serializeArray(array, options) {\n return array.map(v => serializeValue(v, options));\n}\n\nfunction getISOString(date) {\n var isoStr = date.toISOString();\n // we should only show milliseconds in timestamp if they're non-zero\n return date.getUTCMilliseconds() !== 0 ? isoStr : isoStr.slice(0, -5) + 'Z';\n}\n\nfunction serializeValue(value, options) {\n if (Array.isArray(value)) return serializeArray(value, options);\n\n if (value === undefined) return null;\n\n if (value instanceof Date) {\n let dateNum = value.getTime(),\n // is it in year range 1970-9999?\n inRange = dateNum > -1 && dateNum < 253402318800000;\n\n return options.relaxed && inRange\n ? { $date: getISOString(value) }\n : { $date: { $numberLong: value.getTime().toString() } };\n }\n\n if (typeof value === 'number' && !options.relaxed) {\n // it's an integer\n if (Math.floor(value) === value) {\n let int32Range = value >= BSON_INT32_MIN && value <= BSON_INT32_MAX,\n int64Range = value >= BSON_INT64_MIN && value <= BSON_INT64_MAX;\n\n // interpret as being of the smallest BSON integer type that can represent the number exactly\n if (int32Range) return { $numberInt: value.toString() };\n if (int64Range) return { $numberLong: value.toString() };\n }\n return { $numberDouble: value.toString() };\n }\n\n if (value != null && typeof value === 'object') return serializeDocument(value, options);\n return value;\n}\n\nfunction serializeDocument(doc, options) {\n if (doc == null || typeof doc !== 'object') throw new Error('not an object instance');\n\n // the document itself is a BSON type\n if (doc._bsontype && BSONTypes.indexOf(doc._bsontype) !== -1) {\n // we need to separately serialize the embedded scope document\n if (doc._bsontype === 'Code' && doc.scope) {\n let tempScope = serializeDocument(doc.scope, options),\n tempDoc = Object.assign({}, doc, { scope: tempScope });\n return codecs['Code'].toExtendedJSON(tempDoc, options);\n // we need to separately serialize the embedded OID document\n } else if (doc._bsontype === 'DBRef' && doc.oid) {\n let tempId = serializeDocument(doc.oid, options),\n tempDoc = Object.assign({}, doc, { oid: tempId });\n return codecs['DBRef'].toExtendedJSON(tempDoc, options);\n }\n return codecs[doc._bsontype].toExtendedJSON(doc, options);\n }\n\n // the document is an object with nested BSON types\n var _doc = {};\n for (var name in doc) {\n let val = doc[name];\n if (Array.isArray(val)) {\n _doc[name] = serializeArray(val, options);\n } else if (val != null && val._bsontype && BSONTypes.indexOf(val._bsontype) !== -1) {\n // we need to separately serialize the embedded scope document\n if (val._bsontype === 'Code' && val.scope) {\n let tempScope = serializeDocument(val.scope, options),\n tempVal = Object.assign({}, val, { scope: tempScope });\n _doc[name] = codecs['Code'].toExtendedJSON(tempVal, options);\n // we need to separately serialize the embedded OID document\n } else if (val._bsontype === 'DBRef' && val.oid) {\n let tempId = serializeDocument(val.oid, options),\n tempVal = Object.assign({}, val, { oid: tempId });\n _doc[name] = codecs['DBRef'].toExtendedJSON(tempVal, options);\n } else _doc[name] = codecs[val._bsontype].toExtendedJSON(val, options);\n } else if (val instanceof Date) {\n _doc[name] = serializeValue(val, options);\n } else if (val != null && typeof val === 'object') {\n _doc[name] = serializeDocument(val, options);\n }\n\n _doc[name] = serializeValue(val, options);\n }\n\n return _doc;\n}\n\nmodule.exports = {\n parse: parse,\n stringify: stringify,\n setBSONModule: setBSONModule,\n BSON: BSON\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/mongodb-extjson/lib/ext_json.js","'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, 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; i < l; i += 4) {\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 = 58\n// module chunks = 0","var detectBrowser = require('./lib/detectBrowser');\n\nvar agent;\n\nif (typeof navigator !== 'undefined' && navigator) {\n agent = navigator.userAgent;\n}\n\nmodule.exports = detectBrowser(agent);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/detect-browser/browser.js\n// module id = 59\n// module chunks = 0","var detectOS = require('./detectOS.js');\n\nmodule.exports = function detectBrowser(userAgentString) {\n if (!userAgentString) return null;\n\n var browsers = [\n [ 'edge', /Edge\\/([0-9\\._]+)/ ],\n [ 'yandexbrowser', /YaBrowser\\/([0-9\\._]+)/ ],\n [ 'vivaldi', /Vivaldi\\/([0-9\\.]+)/ ],\n [ 'kakaotalk', /KAKAOTALK\\s([0-9\\.]+)/ ],\n [ 'chrome', /(?!Chrom.*OPR)Chrom(?:e|ium)\\/([0-9\\.]+)(:?\\s|$)/ ],\n [ 'phantomjs', /PhantomJS\\/([0-9\\.]+)(:?\\s|$)/ ],\n [ 'crios', /CriOS\\/([0-9\\.]+)(:?\\s|$)/ ],\n [ 'firefox', /Firefox\\/([0-9\\.]+)(?:\\s|$)/ ],\n [ 'fxios', /FxiOS\\/([0-9\\.]+)/ ],\n [ 'opera', /Opera\\/([0-9\\.]+)(?:\\s|$)/ ],\n [ 'opera', /OPR\\/([0-9\\.]+)(:?\\s|$)$/ ],\n [ 'ie', /Trident\\/7\\.0.*rv\\:([0-9\\.]+).*\\).*Gecko$/ ],\n [ 'ie', /MSIE\\s([0-9\\.]+);.*Trident\\/[4-7].0/ ],\n [ 'ie', /MSIE\\s(7\\.0)/ ],\n [ 'bb10', /BB10;\\sTouch.*Version\\/([0-9\\.]+)/ ],\n [ 'android', /Android\\s([0-9\\.]+)/ ],\n [ 'ios', /Version\\/([0-9\\._]+).*Mobile.*Safari.*/ ],\n [ 'safari', /Version\\/([0-9\\._]+).*Safari/ ]\n ];\n\n return browsers.map(function (rule) {\n if (rule[1].test(userAgentString)) {\n var match = rule[1].exec(userAgentString);\n var version = match && match[1].split(/[._]/).slice(0,3);\n\n if (version && version.length < 3) {\n Array.prototype.push.apply(version, (version.length == 1) ? [0, 0] : [0]);\n }\n\n return {\n name: rule[0],\n version: version.join('.'),\n os: detectOS(userAgentString)\n };\n }\n }).filter(Boolean).shift();\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/detect-browser/lib/detectBrowser.js\n// module id = 60\n// module chunks = 0","module.exports = function detectOS(userAgentString) {\n var operatingSystems = [\n {\n name: 'iOS',\n rule: /iP(hone|od|ad)/\n },\n {\n name: 'Android OS',\n rule: /Android/\n },\n {\n name: 'BlackBerry OS',\n rule: /BlackBerry|BB10/\n },\n {\n name: 'Windows Mobile',\n rule: /IEMobile/\n },\n {\n name: 'Amazon OS',\n rule: /Kindle/\n },\n {\n name: 'Windows 3.11',\n rule: /Win16/\n },\n {\n name: 'Windows 95',\n rule: /(Windows 95)|(Win95)|(Windows_95)/\n },\n {\n name: 'Windows 98',\n rule: /(Windows 98)|(Win98)/\n },\n {\n name: 'Windows 2000',\n rule: /(Windows NT 5.0)|(Windows 2000)/\n },\n {\n name: 'Windows XP',\n rule: /(Windows NT 5.1)|(Windows XP)/\n },\n {\n name: 'Windows Server 2003',\n rule: /(Windows NT 5.2)/\n },\n {\n name: 'Windows Vista',\n rule: /(Windows NT 6.0)/\n },\n {\n name: 'Windows 7',\n rule: /(Windows NT 6.1)/\n },\n {\n name: 'Windows 8',\n rule: /(Windows NT 6.2)/\n },\n {\n name: 'Windows 8.1',\n rule: /(Windows NT 6.3)/\n },\n {\n name: 'Windows 10',\n rule: /(Windows NT 10.0)/\n },\n {\n name: 'Windows ME',\n rule: /Windows ME/\n },\n {\n name: 'Open BSD',\n rule: /OpenBSD/\n },\n {\n name: 'Sun OS',\n rule: /SunOS/\n },\n {\n name: 'Linux',\n rule: /(Linux)|(X11)/\n },\n {\n name: 'Mac OS',\n rule: /(Mac_PowerPC)|(Macintosh)/\n },\n {\n name: 'QNX',\n rule: /QNX/\n },\n {\n name: 'BeOS',\n rule: /BeOS/\n },\n {\n name: 'OS/2',\n rule: /OS\\/2/\n },\n {\n name: 'Search Bot',\n rule: /(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves\\/Teoma)|(ia_archiver)/\n }\n ];\n\n var detected = operatingSystems.filter(function (os) {\n if (userAgentString.match(os.rule)) {\n return true;\n }\n });\n\n return detected && detected[0] ? detected[0].name : null;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/detect-browser/lib/detectOS.js\n// module id = 61\n// module chunks = 0","exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/ieee754/index.js\n// module id = 62\n// module chunks = 0","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/inherits/inherits_browser.js\n// module id = 63\n// module chunks = 0","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/isarray/index.js\n// module id = 64\n// module chunks = 0","/**\n * The code was extracted from:\n * https://github.com/davidchambers/Base64.js\n */\n\nvar chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\nfunction InvalidCharacterError(message) {\n this.message = message;\n}\n\nInvalidCharacterError.prototype = new Error();\nInvalidCharacterError.prototype.name = 'InvalidCharacterError';\n\nfunction polyfill (input) {\n var str = String(input).replace(/=+$/, '');\n if (str.length % 4 == 1) {\n throw new InvalidCharacterError(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = '';\n // get next character\n buffer = str.charAt(idx++);\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n return output;\n}\n\n\nmodule.exports = typeof window !== 'undefined' && window.atob && window.atob.bind(window) || polyfill;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/jwt-decode/lib/atob.js\n// module id = 65\n// module chunks = 0","var atob = require('./atob');\n\nfunction b64DecodeUnicode(str) {\n return decodeURIComponent(atob(str).replace(/(.)/g, function (m, p) {\n var code = p.charCodeAt(0).toString(16).toUpperCase();\n if (code.length < 2) {\n code = '0' + code;\n }\n return '%' + code;\n }));\n}\n\nmodule.exports = function(str) {\n var output = str.replace(/-/g, \"+\").replace(/_/g, \"/\");\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += \"==\";\n break;\n case 3:\n output += \"=\";\n break;\n default:\n throw \"Illegal base64url string!\";\n }\n\n try{\n return b64DecodeUnicode(output);\n } catch (err) {\n return atob(output);\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/jwt-decode/lib/base64_url_decode.js\n// module id = 66\n// module chunks = 0","'use strict';\n\nvar base64_url_decode = require('./base64_url_decode');\n\nfunction InvalidTokenError(message) {\n this.message = message;\n}\n\nInvalidTokenError.prototype = new Error();\nInvalidTokenError.prototype.name = 'InvalidTokenError';\n\nmodule.exports = function (token,options) {\n if (typeof token !== 'string') {\n throw new InvalidTokenError('Invalid token specified');\n }\n\n options = options || {};\n var pos = options.header === true ? 0 : 1;\n try {\n return JSON.parse(base64_url_decode(token.split('.')[pos]));\n } catch (e) {\n throw new InvalidTokenError('Invalid token specified: ' + e.message);\n }\n};\n\nmodule.exports.InvalidTokenError = InvalidTokenError;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/jwt-decode/lib/index.js\n// module id = 67\n// module chunks = 0","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/object-assign/index.js\n// module id = 68\n// module chunks = 0","'use strict';\nvar strictUriEncode = require('strict-uri-encode');\nvar objectAssign = require('object-assign');\n\nfunction encoderForArrayFormat(opts) {\n\tswitch (opts.arrayFormat) {\n\t\tcase 'index':\n\t\t\treturn function (key, value, index) {\n\t\t\t\treturn value === null ? [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'[',\n\t\t\t\t\tindex,\n\t\t\t\t\t']'\n\t\t\t\t].join('') : [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'[',\n\t\t\t\t\tencode(index, opts),\n\t\t\t\t\t']=',\n\t\t\t\t\tencode(value, opts)\n\t\t\t\t].join('');\n\t\t\t};\n\n\t\tcase 'bracket':\n\t\t\treturn function (key, value) {\n\t\t\t\treturn value === null ? encode(key, opts) : [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'[]=',\n\t\t\t\t\tencode(value, opts)\n\t\t\t\t].join('');\n\t\t\t};\n\n\t\tdefault:\n\t\t\treturn function (key, value) {\n\t\t\t\treturn value === null ? encode(key, opts) : [\n\t\t\t\t\tencode(key, opts),\n\t\t\t\t\t'=',\n\t\t\t\t\tencode(value, opts)\n\t\t\t\t].join('');\n\t\t\t};\n\t}\n}\n\nfunction parserForArrayFormat(opts) {\n\tvar result;\n\n\tswitch (opts.arrayFormat) {\n\t\tcase 'index':\n\t\t\treturn function (key, value, accumulator) {\n\t\t\t\tresult = /\\[(\\d*)\\]$/.exec(key);\n\n\t\t\t\tkey = key.replace(/\\[\\d*\\]$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = {};\n\t\t\t\t}\n\n\t\t\t\taccumulator[key][result[1]] = value;\n\t\t\t};\n\n\t\tcase 'bracket':\n\t\t\treturn function (key, value, accumulator) {\n\t\t\t\tresult = /(\\[\\])$/.exec(key);\n\t\t\t\tkey = key.replace(/\\[\\]$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t} else if (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = [value];\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [].concat(accumulator[key], value);\n\t\t\t};\n\n\t\tdefault:\n\t\t\treturn function (key, value, accumulator) {\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [].concat(accumulator[key], value);\n\t\t\t};\n\t}\n}\n\nfunction encode(value, opts) {\n\tif (opts.encode) {\n\t\treturn opts.strict ? strictUriEncode(value) : encodeURIComponent(value);\n\t}\n\n\treturn value;\n}\n\nfunction keysSorter(input) {\n\tif (Array.isArray(input)) {\n\t\treturn input.sort();\n\t} else if (typeof input === 'object') {\n\t\treturn keysSorter(Object.keys(input)).sort(function (a, b) {\n\t\t\treturn Number(a) - Number(b);\n\t\t}).map(function (key) {\n\t\t\treturn input[key];\n\t\t});\n\t}\n\n\treturn input;\n}\n\nexports.extract = function (str) {\n\treturn str.split('?')[1] || '';\n};\n\nexports.parse = function (str, opts) {\n\topts = objectAssign({arrayFormat: 'none'}, opts);\n\n\tvar formatter = parserForArrayFormat(opts);\n\n\t// Create an object with no prototype\n\t// https://github.com/sindresorhus/query-string/issues/47\n\tvar ret = Object.create(null);\n\n\tif (typeof str !== 'string') {\n\t\treturn ret;\n\t}\n\n\tstr = str.trim().replace(/^(\\?|#|&)/, '');\n\n\tif (!str) {\n\t\treturn ret;\n\t}\n\n\tstr.split('&').forEach(function (param) {\n\t\tvar parts = param.replace(/\\+/g, ' ').split('=');\n\t\t// Firefox (pre 40) decodes `%3D` to `=`\n\t\t// https://github.com/sindresorhus/query-string/pull/37\n\t\tvar key = parts.shift();\n\t\tvar val = parts.length > 0 ? parts.join('=') : undefined;\n\n\t\t// missing `=` should be `null`:\n\t\t// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters\n\t\tval = val === undefined ? null : decodeURIComponent(val);\n\n\t\tformatter(decodeURIComponent(key), val, ret);\n\t});\n\n\treturn Object.keys(ret).sort().reduce(function (result, key) {\n\t\tvar val = ret[key];\n\t\tif (Boolean(val) && typeof val === 'object' && !Array.isArray(val)) {\n\t\t\t// Sort object keys, not values\n\t\t\tresult[key] = keysSorter(val);\n\t\t} else {\n\t\t\tresult[key] = val;\n\t\t}\n\n\t\treturn result;\n\t}, Object.create(null));\n};\n\nexports.stringify = function (obj, opts) {\n\tvar defaults = {\n\t\tencode: true,\n\t\tstrict: true,\n\t\tarrayFormat: 'none'\n\t};\n\n\topts = objectAssign(defaults, opts);\n\n\tvar formatter = encoderForArrayFormat(opts);\n\n\treturn obj ? Object.keys(obj).sort().map(function (key) {\n\t\tvar val = obj[key];\n\n\t\tif (val === undefined) {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (val === null) {\n\t\t\treturn encode(key, opts);\n\t\t}\n\n\t\tif (Array.isArray(val)) {\n\t\t\tvar result = [];\n\n\t\t\tval.slice().forEach(function (val2) {\n\t\t\t\tif (val2 === undefined) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tresult.push(formatter(key, val2, result.length));\n\t\t\t});\n\n\t\t\treturn result.join('&');\n\t\t}\n\n\t\treturn encode(key, opts) + '=' + encode(val, opts);\n\t}).filter(function (x) {\n\t\treturn x.length > 0;\n\t}).join('&') : '';\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/query-string/index.js\n// module id = 69\n// module chunks = 0","'use strict';\nmodule.exports = function (str) {\n\treturn encodeURIComponent(str).replace(/[!'()*]/g, function (c) {\n\t\treturn '%' + c.charCodeAt(0).toString(16).toUpperCase();\n\t});\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/strict-uri-encode/index.js\n// module id = 70\n// module chunks = 0","module.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/util/support/isBufferBrowser.js\n// module id = 71\n// module chunks = 0","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexports.debuglog = function(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/util/util.js\n// module id = 72\n// module chunks = 0","(function(self) {\n 'use strict';\n\n if (self.fetch) {\n return\n }\n\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob: 'FileReader' in self && 'Blob' in self && (function() {\n try {\n new Blob()\n return true\n } catch(e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ]\n\n var isDataView = function(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n var isArrayBufferView = ArrayBuffer.isView || function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n }\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name)\n }\n if (/[^a-z0-9\\-#$%&'*+.\\^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value)\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift()\n return {done: value === undefined, value: value}\n }\n }\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n }\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {}\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value)\n }, this)\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1])\n }, this)\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name])\n }, this)\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name)\n value = normalizeValue(value)\n var oldValue = this.map[name]\n this.map[name] = oldValue ? oldValue+','+value : value\n }\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)]\n }\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name)\n return this.has(name) ? this.map[name] : null\n }\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n }\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value)\n }\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this)\n }\n }\n }\n\n Headers.prototype.keys = function() {\n var items = []\n this.forEach(function(value, name) { items.push(name) })\n return iteratorFor(items)\n }\n\n Headers.prototype.values = function() {\n var items = []\n this.forEach(function(value) { items.push(value) })\n return iteratorFor(items)\n }\n\n Headers.prototype.entries = function() {\n var items = []\n this.forEach(function(value, name) { items.push([name, value]) })\n return iteratorFor(items)\n }\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result)\n }\n reader.onerror = function() {\n reject(reader.error)\n }\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsArrayBuffer(blob)\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsText(blob)\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf)\n var chars = new Array(view.length)\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i])\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength)\n view.set(new Uint8Array(buf))\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false\n\n this._initBody = function(body) {\n this._bodyInit = body\n if (!body) {\n this._bodyText = ''\n } else if (typeof body === 'string') {\n this._bodyText = body\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString()\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer)\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer])\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body)\n } else {\n throw new Error('unsupported BodyInit type')\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8')\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type)\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')\n }\n }\n }\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n }\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n }\n }\n\n this.text = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n }\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n }\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n }\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase()\n return (methods.indexOf(upcased) > -1) ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {}\n var body = options.body\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url\n this.credentials = input.credentials\n if (!options.headers) {\n this.headers = new Headers(input.headers)\n }\n this.method = input.method\n this.mode = input.mode\n if (!body && input._bodyInit != null) {\n body = input._bodyInit\n input.bodyUsed = true\n }\n } else {\n this.url = String(input)\n }\n\n this.credentials = options.credentials || this.credentials || 'omit'\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers)\n }\n this.method = normalizeMethod(options.method || this.method || 'GET')\n this.mode = options.mode || this.mode || null\n this.referrer = null\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body)\n }\n\n Request.prototype.clone = function() {\n return new Request(this, { body: this._bodyInit })\n }\n\n function decode(body) {\n var form = new FormData()\n body.trim().split('&').forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=')\n var name = split.shift().replace(/\\+/g, ' ')\n var value = split.join('=').replace(/\\+/g, ' ')\n form.append(decodeURIComponent(name), decodeURIComponent(value))\n }\n })\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers()\n rawHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':')\n var key = parts.shift().trim()\n if (key) {\n var value = parts.join(':').trim()\n headers.append(key, value)\n }\n })\n return headers\n }\n\n Body.call(Request.prototype)\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {}\n }\n\n this.type = 'default'\n this.status = 'status' in options ? options.status : 200\n this.ok = this.status >= 200 && this.status < 300\n this.statusText = 'statusText' in options ? options.statusText : 'OK'\n this.headers = new Headers(options.headers)\n this.url = options.url || ''\n this._initBody(bodyInit)\n }\n\n Body.call(Response.prototype)\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n }\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''})\n response.type = 'error'\n return response\n }\n\n var redirectStatuses = [301, 302, 303, 307, 308]\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n }\n\n self.Headers = Headers\n self.Request = Request\n self.Response = Response\n\n self.fetch = function(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init)\n var xhr = new XMLHttpRequest()\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n }\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL')\n var body = 'response' in xhr ? xhr.response : xhr.responseText\n resolve(new Response(body, options))\n }\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'))\n }\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'))\n }\n\n xhr.open(request.method, request.url, true)\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob'\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value)\n })\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)\n })\n }\n self.fetch.polyfill = true\n})(typeof self !== 'undefined' ? self : this);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/whatwg-fetch/fetch.js\n// module id = 73\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/package.json b/package.json index d41b6c887..408bf5b6f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mongodb-stitch", - "version": "2.3.1", + "version": "3.0.0", "description": "", "author": "", "license": "Apache-2.0",