diff --git a/packages/cubejs-api-gateway/LocalSubscriptionStore.js b/packages/cubejs-api-gateway/LocalSubscriptionStore.js new file mode 100644 index 0000000000000..0cbf506089c11 --- /dev/null +++ b/packages/cubejs-api-gateway/LocalSubscriptionStore.js @@ -0,0 +1,62 @@ +class LocalSubscriptionStore { + constructor(options) { + options = options || {}; + this.connections = {}; + this.hearBeatInterval = options.heartBeatInterval || 60; + } + + async getSubscription(connectionId, subscriptionId) { + const connection = this.getConnection(connectionId); + return connection.subscriptions[subscriptionId]; + } + + async subscribe(connectionId, subscriptionId, subscription) { + const connection = this.getConnection(connectionId); + connection.subscriptions[subscriptionId] = { + ...subscription, + timestamp: new Date() + }; + } + + async unsubscribe(connectionId, subscriptionId) { + const connection = this.getConnection(connectionId); + delete connection.subscriptions[subscriptionId]; + } + + async getAllSubscriptions() { + return Object.keys(this.connections).map(connectionId => { + Object.keys(this.connections[connectionId].subscriptions).filter( + subscriptionId => new Date().getTime() - + this.connections[connectionId].subscriptions[subscriptionId].timestamp.getTime() > + this.hearBeatInterval * 4 * 1000 + ).forEach(subscriptionId => { delete this.connections[connectionId].subscriptions[subscriptionId]; }); + + return Object.keys(this.connections[connectionId].subscriptions) + .map(subscriptionId => ({ + connectionId, + ...this.connections[connectionId].subscriptions[subscriptionId] + })); + }).reduce((a, b) => a.concat(b), []); + } + + async cleanupSubscriptions(connectionId) { + delete this.connections[connectionId]; + } + + async getAuthContext(connectionId) { + return this.getConnection(connectionId).authContext; + } + + async setAuthContext(connectionId, authContext) { + this.getConnection(connectionId).authContext = authContext; + } + + getConnection(connectionId) { + if (!this.connections[connectionId]) { + this.connections[connectionId] = { subscriptions: {} }; + } + return this.connections[connectionId]; + } +} + +module.exports = LocalSubscriptionStore; diff --git a/packages/cubejs-api-gateway/SubscriptionServer.js b/packages/cubejs-api-gateway/SubscriptionServer.js new file mode 100644 index 0000000000000..b78bdcaaffd14 --- /dev/null +++ b/packages/cubejs-api-gateway/SubscriptionServer.js @@ -0,0 +1,104 @@ +const UserError = require('./UserError'); + +const methodParams = { + load: ['query'], + sql: ['query'], + meta: [], + subscribe: ['query'], + unsubscribe: [] +}; + +class SubscriptionServer { + constructor(apiGateway, sendMessage, subscriptionStore) { + this.apiGateway = apiGateway; + this.sendMessage = sendMessage; + this.subscriptionStore = subscriptionStore; + } + + resultFn(connectionId, messageId) { + return (message, { status } = {}) => this.sendMessage(connectionId, { messageId, message, status: status || 200 }); + } + + async processMessage(connectionId, message, isSubscription) { + let context = {}; + try { + if (typeof message === 'string') { + message = JSON.parse(message); + } + if (message.authorization) { + const newContext = {}; + await this.apiGateway.checkAuthFn(newContext, message.authorization); + await this.subscriptionStore.setAuthContext(connectionId, newContext); + this.sendMessage(connectionId, { handshake: true }); + return; + } + + if (message.unsubscribe) { + await this.subscriptionStore.unsubscribe(connectionId, message.unsubscribe); + return; + } + + if (!message.messageId) { + throw new UserError(`messageId is required`); + } + + context = await this.subscriptionStore.getAuthContext(connectionId); + + if (!context) { + await this.sendMessage( + connectionId, + { + messageId: message.messageId, + message: { error: 'Not authorized' }, + status: 403 + } + ); + return; + } + + if (!methodParams[message.method]) { + throw new UserError(`Unsupported method: ${message.method}`); + } + + const allowedParams = methodParams[message.method]; + const params = allowedParams.map(k => ({ [k]: (message.params || {})[k] })) + .reduce((a, b) => ({ ...a, ...b }), {}); + await this.apiGateway[message.method]({ + ...params, + context, + isSubscription, + res: this.resultFn(connectionId, message.messageId), + subscriptionState: async () => { + const subscription = await this.subscriptionStore.getSubscription(connectionId, message.messageId); + return subscription && subscription.state; + }, + subscribe: async (state) => this.subscriptionStore.subscribe(connectionId, message.messageId, { + message, + state + }), + unsubscribe: async () => this.subscriptionStore.unsubscribe(connectionId, message.messageId) + }); + await this.sendMessage(connectionId, { messageProcessedId: message.messageId }); + } catch (e) { + this.apiGateway.handleError({ + e, + query: message.query, + res: this.resultFn(connectionId, message.messageId), + context + }); + } + } + + async processSubscriptions() { + const allSubscriptions = await this.subscriptionStore.getAllSubscriptions(); + await Promise.all(allSubscriptions.map(async subscription => { + await this.processMessage(subscription.connectionId, subscription.message, true); + })); + } + + async disconnect(connectionId) { + await this.subscriptionStore.cleanupSubscriptions(connectionId); + } +} + +module.exports = SubscriptionServer; diff --git a/packages/cubejs-api-gateway/dateParser.js b/packages/cubejs-api-gateway/dateParser.js index 3c81171eb0d1b..be98a173c08a2 100644 --- a/packages/cubejs-api-gateway/dateParser.js +++ b/packages/cubejs-api-gateway/dateParser.js @@ -5,8 +5,8 @@ const UserError = require('./UserError'); module.exports = (dateString) => { let momentRange; dateString = dateString.toLowerCase(); - if (dateString.match(/(this|last)\s+(day|week|month|year|quarter)/)) { - const match = dateString.match(/(this|last)\s+(day|week|month|year|quarter)/); + if (dateString.match(/(this|last)\s+(day|week|month|year|quarter|hour|minute|second)/)) { + const match = dateString.match(/(this|last)\s+(day|week|month|year|quarter|hour|minute|second)/); let start = moment(); let end = moment(); if (match[1] === 'last') { @@ -15,18 +15,18 @@ module.exports = (dateString) => { } const span = match[2] === 'week' ? 'isoWeek' : match[2]; momentRange = [start.startOf(span), end.endOf(span)]; - } else if (dateString.match(/last\s+(\d+)\s+(day|week|month|year|quarter)/)) { - const match = dateString.match(/last\s+(\d+)\s+(day|week|month|year|quarter)/); + } else if (dateString.match(/last\s+(\d+)\s+(day|week|month|year|quarter|hour|minute|second)/)) { + const match = dateString.match(/last\s+(\d+)\s+(day|week|month|year|quarter|hour|minute|second)/); const span = match[2] === 'week' ? 'isoWeek' : match[2]; momentRange = [ moment().add(-parseInt(match[1], 10) - 1, match[2]).startOf(span), moment().add(-1, match[2]).endOf(span) ]; } else if (dateString.match(/today/)) { - momentRange = [moment(), moment()]; + momentRange = [moment().startOf('day'), moment().endOf('day')]; } else if (dateString.match(/yesterday/)) { const yesterday = moment().add(-1, 'day'); - momentRange = [yesterday, yesterday]; + momentRange = [yesterday.startOf('day'), yesterday.endOf('day')]; } else { const results = chrono.parse(dateString); if (!results) { @@ -40,5 +40,5 @@ module.exports = (dateString) => { results[0].start.moment() ]; } - return momentRange.map(d => d.format(moment.HTML5_FMT.DATE)); + return momentRange.map(d => d.format(moment.HTML5_FMT.DATETIME_LOCAL_MS)); }; diff --git a/packages/cubejs-api-gateway/index.js b/packages/cubejs-api-gateway/index.js index 0ef4708dac754..bcdee8702e085 100644 --- a/packages/cubejs-api-gateway/index.js +++ b/packages/cubejs-api-gateway/index.js @@ -5,6 +5,8 @@ const moment = require('moment'); const dateParser = require('./dateParser'); const UserError = require('./UserError'); +const SubscriptionServer = require('./SubscriptionServer'); +const LocalSubscriptionStore = require('./LocalSubscriptionStore'); const toConfigMap = (metaConfig) => ( R.pipe( @@ -216,12 +218,12 @@ const normalizeQuery = (query) => { }; }; -const coerceForSqlQuery = (query, req) => ({ +const coerceForSqlQuery = (query, context) => ({ ...query, timeDimensions: (query.timeDimensions || []) .map(td => (td.granularity === 'day' ? { ...td, granularity: 'date' } : td)), contextSymbols: { - userContext: req.authInfo && req.authInfo.u || {} + userContext: context.authInfo && context.authInfo.u || {} } }); @@ -233,95 +235,188 @@ class ApiGateway { this.adapterApi = adapterApi; this.logger = logger; this.checkAuthMiddleware = options.checkAuthMiddleware || this.checkAuth.bind(this); + this.checkAuthFn = options.checkAuth || this.defaultCheckAuth.bind(this); this.basePath = options.basePath || '/cubejs-api'; // eslint-disable-next-line no-unused-vars this.queryTransformer = options.queryTransformer || (async (query, context) => query); + this.subscriptionStore = options.subscriptionStore || new LocalSubscriptionStore(); } initApp(app) { app.get(`${this.basePath}/v1/load`, this.checkAuthMiddleware, (async (req, res) => { - try { - if (!req.query.query || req.query.query === 'undefined') { - throw new UserError(`query param is required`); - } - const query = JSON.parse(req.query.query); - this.log(req, { - type: 'Load Request', - query: req.query.query - }); - const normalizedQuery = await this.queryTransformer(normalizeQuery(query), this.contextByReq(req)); - const [compilerSqlResult, metaConfigResult] = await Promise.all([ - this.getCompilerApi(req).getSql(coerceForSqlQuery(normalizedQuery, req)), - this.getCompilerApi(req).metaConfig() - ]); - const sqlQuery = compilerSqlResult; - const metaConfig = metaConfigResult; - const annotation = prepareAnnotation(metaConfig, normalizedQuery); - const aliasToMemberNameMap = prepareAliasToMemberNameMap(metaConfig, sqlQuery, normalizedQuery); - const toExecute = { - ...sqlQuery, - query: sqlQuery.sql[0], - values: sqlQuery.sql[1], - continueWait: true, - renewQuery: normalizedQuery.renewQuery - }; - const response = await this.getAdapterApi(req).executeQuery(toExecute); - this.log(req, { - type: 'Load Request Success', - query: req.query.query, - }); - const flattenAnnotation = { - ...annotation.measures, - ...annotation.dimensions, - ...annotation.timeDimensions - }; - res.json({ - query: normalizedQuery, - data: transformData(aliasToMemberNameMap, flattenAnnotation, response.data), - annotation - }); - } catch (e) { - this.handleError(e, req, res); - } + await this.load({ + query: req.query.query, + context: this.contextByReq(req), + res: this.resToResultFn(res) + }); + })); + + app.get(`${this.basePath}/v1/subscribe`, this.checkAuthMiddleware, (async (req, res) => { + await this.load({ + query: req.query.query, + context: this.contextByReq(req), + res: this.resToResultFn(res) + }); })); app.get(`${this.basePath}/v1/sql`, this.checkAuthMiddleware, (async (req, res) => { - try { - if (!req.query.query || req.query.query === 'undefined') { - throw new UserError(`query param is required`); - } - const query = JSON.parse(req.query.query); - const normalizedQuery = await this.queryTransformer(normalizeQuery(query), this.contextByReq(req)); - const sqlQuery = await this.getCompilerApi(req).getSql(coerceForSqlQuery(normalizedQuery, req)); - res.json({ - sql: sqlQuery - }); - } catch (e) { - this.handleError(e, req, res); - } + await this.sql({ + query: req.query.query, + context: this.contextByReq(req), + res: this.resToResultFn(res) + }); })); app.get(`${this.basePath}/v1/meta`, this.checkAuthMiddleware, (async (req, res) => { - try { - const metaConfig = await this.getCompilerApi(req).metaConfig(); - const cubes = metaConfig.map(c => c.config); - res.json({ cubes }); - } catch (e) { - this.handleError(e, req, res); - } + await this.meta({ + context: this.contextByReq(req), + res: this.resToResultFn(res) + }); })); } - getCompilerApi(req) { + initSubscriptionServer(sendMessage) { + return new SubscriptionServer(this, sendMessage, this.subscriptionStore); + } + + async meta({ context, res }) { + try { + const metaConfig = await this.getCompilerApi(context).metaConfig(); + const cubes = metaConfig.map(c => c.config); + res({ cubes }); + } catch (e) { + this.handleError({ + e, context, res + }); + } + } + + async sql({ query, context, res }) { + try { + query = this.parseQueryParam(query); + const normalizedQuery = await this.queryTransformer(normalizeQuery(query), context); + const sqlQuery = await this.getCompilerApi(context).getSql(coerceForSqlQuery(normalizedQuery, context)); + res.json({ + sql: sqlQuery + }); + } catch (e) { + this.handleError({ + e, context, query, res + }); + } + } + + async load({ query, context, res }) { + try { + query = this.parseQueryParam(query); + this.log(context, { + type: 'Load Request', + query + }); + const normalizedQuery = await this.queryTransformer(normalizeQuery(query), context); + const [compilerSqlResult, metaConfigResult] = await Promise.all([ + this.getCompilerApi(context).getSql(coerceForSqlQuery(normalizedQuery, context)), + this.getCompilerApi(context).metaConfig() + ]); + const sqlQuery = compilerSqlResult; + const metaConfig = metaConfigResult; + const annotation = prepareAnnotation(metaConfig, normalizedQuery); + const aliasToMemberNameMap = prepareAliasToMemberNameMap(metaConfig, sqlQuery, normalizedQuery); + const toExecute = { + ...sqlQuery, + query: sqlQuery.sql[0], + values: sqlQuery.sql[1], + continueWait: true, + renewQuery: normalizedQuery.renewQuery + }; + const response = await this.getAdapterApi(context).executeQuery(toExecute); + this.log(context, { + type: 'Load Request Success', + query, + }); + const flattenAnnotation = { + ...annotation.measures, + ...annotation.dimensions, + ...annotation.timeDimensions + }; + res({ + query: normalizedQuery, + data: transformData(aliasToMemberNameMap, flattenAnnotation, response.data), + annotation + }); + } catch (e) { + this.handleError({ + e, context, query, res + }); + } + } + + async subscribe({ + query, context, res, subscribe, subscriptionState + }) { + try { + this.log(context, { + type: 'Subscribe', + query + }); + let result = null; + let error = null; + + if (!subscribe) { + await this.load({ query, context, res }); + return; + } + + // TODO subscribe to refreshKeys instead of constantly firing load + await this.load({ + query, + context, + res: (message) => { + if (message.error) { + error = message; + } else { + result = message; + } + } + }); + const state = await subscriptionState(); + if (result && (!state || JSON.stringify(state.result) !== JSON.stringify(result))) { + res(result); + } else if (error) { + res(error); + } + await subscribe({ error, result }); + } catch (e) { + this.handleError({ + e, context, query, res + }); + } + } + + resToResultFn(res) { + return (message, { status } = {}) => (status ? res.status(status).json(message) : res.json(message)); + } + + parseQueryParam(query) { + if (!query || query === 'undefined') { + throw new UserError(`query param is required`); + } + if (typeof query === 'string') { + query = JSON.parse(query); + } + return query; + } + + getCompilerApi(context) { if (typeof this.compilerApi === 'function') { - return this.compilerApi(this.contextByReq(req)); + return this.compilerApi(context); } return this.compilerApi; } - getAdapterApi(req) { + getAdapterApi(context) { if (typeof this.adapterApi === 'function') { - return this.adapterApi(this.contextByReq(req)); + return this.adapterApi(context); } return this.adapterApi; } @@ -330,69 +425,86 @@ class ApiGateway { return { authInfo: req.authInfo }; } - handleError(e, req, res) { + handleError({ + e, context, query, res + }) { if (e instanceof UserError) { - this.log(req, { + this.log(context, { type: 'User Error', - query: req.query && req.query.query, + query, error: e.message }); - res.status(400).json({ error: e.message }); + res({ error: e.message }, { status: 400 }); } else if (e.error === 'Continue wait') { - this.log(req, { + this.log(context, { type: 'Continue wait', - query: req.query && req.query.query, + query, error: e.message }); - res.status(200).json(e); + res(e, { status: 200 }); } else if (e.error) { - this.log(req, { + this.log(context, { type: 'Orchestrator error', - query: req.query && req.query.query, + query, error: e.error }); - res.status(400).json(e); + res(e, { status: 400 }); } else { - this.log(req, { + this.log(context, { type: 'Internal Server Error', - query: req.query && req.query.query, + query, error: e.stack || e.toString() }); - res.status(500).json({ error: e.toString() }); + res({ error: e.toString() }, { status: 500 }); } } - async checkAuth(req, res, next) { - const auth = req.headers.authorization; - + async defaultCheckAuth(req, auth) { if (auth) { const secret = this.apiSecret; try { req.authInfo = jwt.verify(auth, secret); - return next && next(); } catch (e) { if (process.env.NODE_ENV === 'production') { - res.status(403).json({ error: 'Invalid token' }); + throw new UserError('Invalid token'); } else { this.log(req, { type: 'Invalid Token', token: auth, error: e.stack || e.toString() }); - return next && next(); } } } else if (process.env.NODE_ENV === 'production') { - res.status(403).send({ error: "Authorization header isn't set" }); - } else { - return next && next(); + throw new UserError("Authorization header isn't set"); + } + } + + async checkAuth(req, res, next) { + const auth = req.headers.authorization; + + try { + this.checkAuthFn(req, auth); + } catch (e) { + if (e instanceof UserError) { + res.status(403).json({ error: e.message }); + } else { + this.log(req, { + type: 'Auth Error', + token: auth, + error: e.stack || e.toString() + }); + res.status(500).json({ error: e.toString() }); + } + } + if (next) { + next(); } - return null; } - log(req, event) { + log(context, event) { const { type, ...restParams } = event; - this.logger(type, { ...restParams, authInfo: req.authInfo }); + this.logger(type, { ...restParams, authInfo: context.authInfo }); } } diff --git a/packages/cubejs-client-core/dist/cubejs-client-core.esm.js b/packages/cubejs-client-core/dist/cubejs-client-core.esm.js index cfdfe7fa375ac..e51543354322f 100644 --- a/packages/cubejs-client-core/dist/cubejs-client-core.esm.js +++ b/packages/cubejs-client-core/dist/cubejs-client-core.esm.js @@ -1,18 +1,18 @@ +import _objectSpread from '@babel/runtime/helpers/objectSpread'; import _regeneratorRuntime from '@babel/runtime/regenerator'; import 'regenerator-runtime/runtime'; import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator'; -import 'core-js/modules/es6.object.assign'; +import _typeof from '@babel/runtime/helpers/typeof'; import _classCallCheck from '@babel/runtime/helpers/classCallCheck'; import _createClass from '@babel/runtime/helpers/createClass'; import 'core-js/modules/es6.promise'; -import fetch from 'cross-fetch'; import 'core-js/modules/es6.number.constructor'; import 'core-js/modules/es6.number.parse-float'; -import _objectSpread from '@babel/runtime/helpers/objectSpread'; import 'core-js/modules/web.dom.iterable'; import 'core-js/modules/es6.array.iterator'; import 'core-js/modules/es6.object.keys'; import _slicedToArray from '@babel/runtime/helpers/slicedToArray'; +import 'core-js/modules/es6.object.assign'; import _defineProperty from '@babel/runtime/helpers/defineProperty'; import 'core-js/modules/es6.array.reduce'; import 'core-js/modules/es6.array.index-of'; @@ -28,6 +28,8 @@ import momentRange from 'moment-range'; import 'core-js/modules/es6.array.is-array'; import 'core-js/modules/es6.regexp.split'; import 'core-js/modules/es6.function.name'; +import fetch from 'cross-fetch'; +import 'url-search-params-polyfill'; var moment = momentRange.extendMoment(Moment); var TIME_SERIES = { @@ -731,6 +733,79 @@ function () { return ProgressResult; }(); +var HttpTransport = +/*#__PURE__*/ +function () { + function HttpTransport(_ref) { + var authorization = _ref.authorization, + apiUrl = _ref.apiUrl; + + _classCallCheck(this, HttpTransport); + + this.authorization = authorization; + this.apiUrl = apiUrl; + } + + _createClass(HttpTransport, [{ + key: "request", + value: function request(method, params) { + var _this = this; + + var searchParams = new URLSearchParams(params && Object.keys(params).map(function (k) { + return _defineProperty({}, k, _typeof(params[k]) === 'object' ? JSON.stringify(params[k]) : params[k]); + }).reduce(function (a, b) { + return _objectSpread({}, a, b); + }, {})); + + var runRequest = function runRequest() { + return fetch("".concat(_this.apiUrl).concat(method, "?").concat(searchParams), { + headers: { + Authorization: _this.authorization, + 'Content-Type': 'application/json' + } + }); + }; + + return { + subscribe: function () { + var _subscribe = _asyncToGenerator( + /*#__PURE__*/ + _regeneratorRuntime.mark(function _callee(callback) { + var _this2 = this; + + var result; + return _regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return runRequest(); + + case 2: + result = _context.sent; + return _context.abrupt("return", callback(result, function () { + return _this2.subscribe(callback); + })); + + case 4: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + return function subscribe(_x) { + return _subscribe.apply(this, arguments); + }; + }() + }; + } + }]); + + return HttpTransport; +}(); + var API_URL = "https://statsbot.co/cubejs-api/v1"; var mutexCounter = 0; var MUTEX_ERROR = 'Mutex has been changed'; @@ -756,24 +831,31 @@ function () { function CubejsApi(apiToken, options) { _classCallCheck(this, CubejsApi); + if (_typeof(apiToken) === 'object') { + options = apiToken; + apiToken = undefined; + } + options = options || {}; this.apiToken = apiToken; this.apiUrl = options.apiUrl || API_URL; + this.transport = options.transport || new HttpTransport({ + authorization: apiToken, + apiUrl: this.apiUrl + }); + this.pollInterval = options.pollInterval || 5; } _createClass(CubejsApi, [{ key: "request", - value: function request(url, config) { - return fetch("".concat(this.apiUrl).concat(url), Object.assign({ - headers: { - Authorization: this.apiToken, - 'Content-Type': 'application/json' - } - }, config || {})); + value: function request(method, params) { + return this.transport.request(method, params); } }, { key: "loadMethod", value: function loadMethod(request, toResult, options, callback) { + var _this = this; + var mutexValue = ++mutexCounter; if (typeof options === 'function' && !callback) { @@ -788,91 +870,308 @@ function () { options.mutexObj[mutexKey] = mutexValue; } - var checkMutex = function checkMutex() { - if (options.mutexObj && options.mutexObj[mutexKey] !== mutexValue) { - throw MUTEX_ERROR; - } - }; + var requestInstance = request(); + var unsubscribed = false; - var loadImpl = + var checkMutex = /*#__PURE__*/ function () { var _ref = _asyncToGenerator( /*#__PURE__*/ _regeneratorRuntime.mark(function _callee() { - var response, body; return _regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: - _context.next = 2; - return request(); + if (!(options.mutexObj && options.mutexObj[mutexKey] !== mutexValue)) { + _context.next = 6; + break; + } + + unsubscribed = true; + + if (!requestInstance.unsubscribe) { + _context.next = 5; + break; + } - case 2: - response = _context.sent; + _context.next = 5; + return requestInstance.unsubscribe(); + + case 5: + throw MUTEX_ERROR; + + case 6: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + return function checkMutex() { + return _ref.apply(this, arguments); + }; + }(); + + var loadImpl = + /*#__PURE__*/ + function () { + var _ref2 = _asyncToGenerator( + /*#__PURE__*/ + _regeneratorRuntime.mark(function _callee4(response, next) { + var subscribeNext, continueWait, body, error, result; + return _regeneratorRuntime.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + subscribeNext = + /*#__PURE__*/ + function () { + var _ref3 = _asyncToGenerator( + /*#__PURE__*/ + _regeneratorRuntime.mark(function _callee2() { + return _regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + if (!(options.subscribe && !unsubscribed)) { + _context2.next = 8; + break; + } + + if (!requestInstance.unsubscribe) { + _context2.next = 5; + break; + } + + return _context2.abrupt("return", next()); + + case 5: + _context2.next = 7; + return new Promise(function (resolve) { + return setTimeout(function () { + return resolve(); + }, _this.pollInterval * 1000); + }); + + case 7: + return _context2.abrupt("return", next()); + + case 8: + return _context2.abrupt("return", null); + + case 9: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + + return function subscribeNext() { + return _ref3.apply(this, arguments); + }; + }(); + + continueWait = + /*#__PURE__*/ + function () { + var _ref4 = _asyncToGenerator( + /*#__PURE__*/ + _regeneratorRuntime.mark(function _callee3(wait) { + return _regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + if (unsubscribed) { + _context3.next = 5; + break; + } + + if (!wait) { + _context3.next = 4; + break; + } + + _context3.next = 4; + return new Promise(function (resolve) { + return setTimeout(function () { + return resolve(); + }, _this.pollInterval * 1000); + }); + + case 4: + return _context3.abrupt("return", next()); + + case 5: + return _context3.abrupt("return", null); + + case 6: + case "end": + return _context3.stop(); + } + } + }, _callee3, this); + })); + + return function continueWait(_x3) { + return _ref4.apply(this, arguments); + }; + }(); if (!(response.status === 502)) { - _context.next = 6; + _context4.next = 6; break; } - checkMutex(); - return _context.abrupt("return", loadImpl()); + _context4.next = 5; + return checkMutex(); + + case 5: + return _context4.abrupt("return", continueWait(true)); case 6: - _context.next = 8; + _context4.next = 8; return response.json(); case 8: - body = _context.sent; + body = _context4.sent; if (!(body.error === 'Continue wait')) { - _context.next = 13; + _context4.next = 14; break; } - checkMutex(); + _context4.next = 12; + return checkMutex(); + case 12: if (options.progressCallback) { options.progressCallback(new ProgressResult(body)); } - return _context.abrupt("return", loadImpl()); + return _context4.abrupt("return", continueWait()); - case 13: + case 14: if (!(response.status !== 200)) { - _context.next = 16; + _context4.next = 27; + break; + } + + _context4.next = 17; + return checkMutex(); + + case 17: + if (!(!options.subscribe && requestInstance.unsubscribe)) { + _context4.next = 20; + break; + } + + _context4.next = 20; + return requestInstance.unsubscribe(); + + case 20: + error = new Error(body.error); // TODO error class + + if (!callback) { + _context4.next = 25; + break; + } + + callback(error); + _context4.next = 26; + break; + + case 25: + throw error; + + case 26: + return _context4.abrupt("return", subscribeNext()); + + case 27: + _context4.next = 29; + return checkMutex(); + + case 29: + if (!(!options.subscribe && requestInstance.unsubscribe)) { + _context4.next = 32; + break; + } + + _context4.next = 32; + return requestInstance.unsubscribe(); + + case 32: + result = toResult(body); + + if (!callback) { + _context4.next = 37; break; } - checkMutex(); - throw new Error(body.error); + callback(null, result); + _context4.next = 38; + break; + + case 37: + return _context4.abrupt("return", result); - case 16: - checkMutex(); - return _context.abrupt("return", toResult(body)); + case 38: + return _context4.abrupt("return", subscribeNext()); - case 18: + case 39: case "end": - return _context.stop(); + return _context4.stop(); } } - }, _callee, this); + }, _callee4, this); })); - return function loadImpl() { - return _ref.apply(this, arguments); + return function loadImpl(_x, _x2) { + return _ref2.apply(this, arguments); }; }(); + var promise = mutexPromise(requestInstance.subscribe(loadImpl)); + if (callback) { - mutexPromise(loadImpl()).then(function (r) { - return callback(null, r); - }, function (e) { - return callback(e); - }); + return { + unsubscribe: function () { + var _unsubscribe = _asyncToGenerator( + /*#__PURE__*/ + _regeneratorRuntime.mark(function _callee5() { + return _regeneratorRuntime.wrap(function _callee5$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + unsubscribed = true; + + if (!requestInstance.unsubscribe) { + _context5.next = 3; + break; + } + + return _context5.abrupt("return", requestInstance.unsubscribe()); + + case 3: + return _context5.abrupt("return", null); + + case 4: + case "end": + return _context5.stop(); + } + } + }, _callee5, this); + })); + + return function unsubscribe() { + return _unsubscribe.apply(this, arguments); + }; + }() + }; } else { - return mutexPromise(loadImpl()); + return promise; } } /** @@ -906,10 +1205,12 @@ function () { }, { key: "load", value: function load(query, options, callback) { - var _this = this; + var _this2 = this; return this.loadMethod(function () { - return _this.request("/load?query=".concat(encodeURIComponent(JSON.stringify(query)))); + return _this2.request("load", { + query: query + }); }, function (body) { return new ResultSet(body); }, options, callback); @@ -925,10 +1226,12 @@ function () { }, { key: "sql", value: function sql(query, options, callback) { - var _this2 = this; + var _this3 = this; return this.loadMethod(function () { - return _this2.request("/sql?query=".concat(JSON.stringify(query))); + return _this3.request("sql", { + query: query + }); }, function (body) { return new SqlQuery(body); }, options, callback); @@ -943,14 +1246,29 @@ function () { }, { key: "meta", value: function meta(options, callback) { - var _this3 = this; + var _this4 = this; return this.loadMethod(function () { - return _this3.request("/meta"); + return _this4.request("meta"); }, function (body) { return new Meta(body); }, options, callback); } + }, { + key: "subscribe", + value: function subscribe(query, options, callback) { + var _this5 = this; + + return this.loadMethod(function () { + return _this5.request("subscribe", { + query: query + }); + }, function (body) { + return new ResultSet(body); + }, _objectSpread({}, options, { + subscribe: true + }), callback); + } }]); return CubejsApi; @@ -983,3 +1301,4 @@ var index = (function (apiToken, options) { }); export default index; +export { HttpTransport }; diff --git a/packages/cubejs-client-core/dist/cubejs-client-core.js b/packages/cubejs-client-core/dist/cubejs-client-core.js index e9bc018cc11dc..1d5ff7b83364e 100644 --- a/packages/cubejs-client-core/dist/cubejs-client-core.js +++ b/packages/cubejs-client-core/dist/cubejs-client-core.js @@ -1,22 +1,24 @@ 'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); + function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } +var _objectSpread = _interopDefault(require('@babel/runtime/helpers/objectSpread')); var _regeneratorRuntime = _interopDefault(require('@babel/runtime/regenerator')); require('regenerator-runtime/runtime'); var _asyncToGenerator = _interopDefault(require('@babel/runtime/helpers/asyncToGenerator')); -require('core-js/modules/es6.object.assign'); +var _typeof = _interopDefault(require('@babel/runtime/helpers/typeof')); var _classCallCheck = _interopDefault(require('@babel/runtime/helpers/classCallCheck')); var _createClass = _interopDefault(require('@babel/runtime/helpers/createClass')); require('core-js/modules/es6.promise'); -var fetch = _interopDefault(require('cross-fetch')); require('core-js/modules/es6.number.constructor'); require('core-js/modules/es6.number.parse-float'); -var _objectSpread = _interopDefault(require('@babel/runtime/helpers/objectSpread')); require('core-js/modules/web.dom.iterable'); require('core-js/modules/es6.array.iterator'); require('core-js/modules/es6.object.keys'); var _slicedToArray = _interopDefault(require('@babel/runtime/helpers/slicedToArray')); +require('core-js/modules/es6.object.assign'); var _defineProperty = _interopDefault(require('@babel/runtime/helpers/defineProperty')); require('core-js/modules/es6.array.reduce'); require('core-js/modules/es6.array.index-of'); @@ -32,6 +34,8 @@ var momentRange = _interopDefault(require('moment-range')); require('core-js/modules/es6.array.is-array'); require('core-js/modules/es6.regexp.split'); require('core-js/modules/es6.function.name'); +var fetch = _interopDefault(require('cross-fetch')); +require('url-search-params-polyfill'); var moment = momentRange.extendMoment(Moment); var TIME_SERIES = { @@ -735,6 +739,79 @@ function () { return ProgressResult; }(); +var HttpTransport = +/*#__PURE__*/ +function () { + function HttpTransport(_ref) { + var authorization = _ref.authorization, + apiUrl = _ref.apiUrl; + + _classCallCheck(this, HttpTransport); + + this.authorization = authorization; + this.apiUrl = apiUrl; + } + + _createClass(HttpTransport, [{ + key: "request", + value: function request(method, params) { + var _this = this; + + var searchParams = new URLSearchParams(params && Object.keys(params).map(function (k) { + return _defineProperty({}, k, _typeof(params[k]) === 'object' ? JSON.stringify(params[k]) : params[k]); + }).reduce(function (a, b) { + return _objectSpread({}, a, b); + }, {})); + + var runRequest = function runRequest() { + return fetch("".concat(_this.apiUrl).concat(method, "?").concat(searchParams), { + headers: { + Authorization: _this.authorization, + 'Content-Type': 'application/json' + } + }); + }; + + return { + subscribe: function () { + var _subscribe = _asyncToGenerator( + /*#__PURE__*/ + _regeneratorRuntime.mark(function _callee(callback) { + var _this2 = this; + + var result; + return _regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return runRequest(); + + case 2: + result = _context.sent; + return _context.abrupt("return", callback(result, function () { + return _this2.subscribe(callback); + })); + + case 4: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + return function subscribe(_x) { + return _subscribe.apply(this, arguments); + }; + }() + }; + } + }]); + + return HttpTransport; +}(); + var API_URL = "https://statsbot.co/cubejs-api/v1"; var mutexCounter = 0; var MUTEX_ERROR = 'Mutex has been changed'; @@ -760,24 +837,31 @@ function () { function CubejsApi(apiToken, options) { _classCallCheck(this, CubejsApi); + if (_typeof(apiToken) === 'object') { + options = apiToken; + apiToken = undefined; + } + options = options || {}; this.apiToken = apiToken; this.apiUrl = options.apiUrl || API_URL; + this.transport = options.transport || new HttpTransport({ + authorization: apiToken, + apiUrl: this.apiUrl + }); + this.pollInterval = options.pollInterval || 5; } _createClass(CubejsApi, [{ key: "request", - value: function request(url, config) { - return fetch("".concat(this.apiUrl).concat(url), Object.assign({ - headers: { - Authorization: this.apiToken, - 'Content-Type': 'application/json' - } - }, config || {})); + value: function request(method, params) { + return this.transport.request(method, params); } }, { key: "loadMethod", value: function loadMethod(request, toResult, options, callback) { + var _this = this; + var mutexValue = ++mutexCounter; if (typeof options === 'function' && !callback) { @@ -792,91 +876,308 @@ function () { options.mutexObj[mutexKey] = mutexValue; } - var checkMutex = function checkMutex() { - if (options.mutexObj && options.mutexObj[mutexKey] !== mutexValue) { - throw MUTEX_ERROR; - } - }; + var requestInstance = request(); + var unsubscribed = false; - var loadImpl = + var checkMutex = /*#__PURE__*/ function () { var _ref = _asyncToGenerator( /*#__PURE__*/ _regeneratorRuntime.mark(function _callee() { - var response, body; return _regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: - _context.next = 2; - return request(); + if (!(options.mutexObj && options.mutexObj[mutexKey] !== mutexValue)) { + _context.next = 6; + break; + } + + unsubscribed = true; + + if (!requestInstance.unsubscribe) { + _context.next = 5; + break; + } + + _context.next = 5; + return requestInstance.unsubscribe(); + + case 5: + throw MUTEX_ERROR; + + case 6: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + return function checkMutex() { + return _ref.apply(this, arguments); + }; + }(); - case 2: - response = _context.sent; + var loadImpl = + /*#__PURE__*/ + function () { + var _ref2 = _asyncToGenerator( + /*#__PURE__*/ + _regeneratorRuntime.mark(function _callee4(response, next) { + var subscribeNext, continueWait, body, error, result; + return _regeneratorRuntime.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + subscribeNext = + /*#__PURE__*/ + function () { + var _ref3 = _asyncToGenerator( + /*#__PURE__*/ + _regeneratorRuntime.mark(function _callee2() { + return _regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + if (!(options.subscribe && !unsubscribed)) { + _context2.next = 8; + break; + } + + if (!requestInstance.unsubscribe) { + _context2.next = 5; + break; + } + + return _context2.abrupt("return", next()); + + case 5: + _context2.next = 7; + return new Promise(function (resolve) { + return setTimeout(function () { + return resolve(); + }, _this.pollInterval * 1000); + }); + + case 7: + return _context2.abrupt("return", next()); + + case 8: + return _context2.abrupt("return", null); + + case 9: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + + return function subscribeNext() { + return _ref3.apply(this, arguments); + }; + }(); + + continueWait = + /*#__PURE__*/ + function () { + var _ref4 = _asyncToGenerator( + /*#__PURE__*/ + _regeneratorRuntime.mark(function _callee3(wait) { + return _regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + if (unsubscribed) { + _context3.next = 5; + break; + } + + if (!wait) { + _context3.next = 4; + break; + } + + _context3.next = 4; + return new Promise(function (resolve) { + return setTimeout(function () { + return resolve(); + }, _this.pollInterval * 1000); + }); + + case 4: + return _context3.abrupt("return", next()); + + case 5: + return _context3.abrupt("return", null); + + case 6: + case "end": + return _context3.stop(); + } + } + }, _callee3, this); + })); + + return function continueWait(_x3) { + return _ref4.apply(this, arguments); + }; + }(); if (!(response.status === 502)) { - _context.next = 6; + _context4.next = 6; break; } - checkMutex(); - return _context.abrupt("return", loadImpl()); + _context4.next = 5; + return checkMutex(); + + case 5: + return _context4.abrupt("return", continueWait(true)); case 6: - _context.next = 8; + _context4.next = 8; return response.json(); case 8: - body = _context.sent; + body = _context4.sent; if (!(body.error === 'Continue wait')) { - _context.next = 13; + _context4.next = 14; break; } - checkMutex(); + _context4.next = 12; + return checkMutex(); + case 12: if (options.progressCallback) { options.progressCallback(new ProgressResult(body)); } - return _context.abrupt("return", loadImpl()); + return _context4.abrupt("return", continueWait()); - case 13: + case 14: if (!(response.status !== 200)) { - _context.next = 16; + _context4.next = 27; break; } - checkMutex(); - throw new Error(body.error); + _context4.next = 17; + return checkMutex(); + + case 17: + if (!(!options.subscribe && requestInstance.unsubscribe)) { + _context4.next = 20; + break; + } + + _context4.next = 20; + return requestInstance.unsubscribe(); + + case 20: + error = new Error(body.error); // TODO error class + + if (!callback) { + _context4.next = 25; + break; + } + + callback(error); + _context4.next = 26; + break; + + case 25: + throw error; + + case 26: + return _context4.abrupt("return", subscribeNext()); + + case 27: + _context4.next = 29; + return checkMutex(); + + case 29: + if (!(!options.subscribe && requestInstance.unsubscribe)) { + _context4.next = 32; + break; + } + + _context4.next = 32; + return requestInstance.unsubscribe(); + + case 32: + result = toResult(body); + + if (!callback) { + _context4.next = 37; + break; + } - case 16: - checkMutex(); - return _context.abrupt("return", toResult(body)); + callback(null, result); + _context4.next = 38; + break; - case 18: + case 37: + return _context4.abrupt("return", result); + + case 38: + return _context4.abrupt("return", subscribeNext()); + + case 39: case "end": - return _context.stop(); + return _context4.stop(); } } - }, _callee, this); + }, _callee4, this); })); - return function loadImpl() { - return _ref.apply(this, arguments); + return function loadImpl(_x, _x2) { + return _ref2.apply(this, arguments); }; }(); + var promise = mutexPromise(requestInstance.subscribe(loadImpl)); + if (callback) { - mutexPromise(loadImpl()).then(function (r) { - return callback(null, r); - }, function (e) { - return callback(e); - }); + return { + unsubscribe: function () { + var _unsubscribe = _asyncToGenerator( + /*#__PURE__*/ + _regeneratorRuntime.mark(function _callee5() { + return _regeneratorRuntime.wrap(function _callee5$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + unsubscribed = true; + + if (!requestInstance.unsubscribe) { + _context5.next = 3; + break; + } + + return _context5.abrupt("return", requestInstance.unsubscribe()); + + case 3: + return _context5.abrupt("return", null); + + case 4: + case "end": + return _context5.stop(); + } + } + }, _callee5, this); + })); + + return function unsubscribe() { + return _unsubscribe.apply(this, arguments); + }; + }() + }; } else { - return mutexPromise(loadImpl()); + return promise; } } /** @@ -910,10 +1211,12 @@ function () { }, { key: "load", value: function load(query, options, callback) { - var _this = this; + var _this2 = this; return this.loadMethod(function () { - return _this.request("/load?query=".concat(encodeURIComponent(JSON.stringify(query)))); + return _this2.request("load", { + query: query + }); }, function (body) { return new ResultSet(body); }, options, callback); @@ -929,10 +1232,12 @@ function () { }, { key: "sql", value: function sql(query, options, callback) { - var _this2 = this; + var _this3 = this; return this.loadMethod(function () { - return _this2.request("/sql?query=".concat(JSON.stringify(query))); + return _this3.request("sql", { + query: query + }); }, function (body) { return new SqlQuery(body); }, options, callback); @@ -947,14 +1252,29 @@ function () { }, { key: "meta", value: function meta(options, callback) { - var _this3 = this; + var _this4 = this; return this.loadMethod(function () { - return _this3.request("/meta"); + return _this4.request("meta"); }, function (body) { return new Meta(body); }, options, callback); } + }, { + key: "subscribe", + value: function subscribe(query, options, callback) { + var _this5 = this; + + return this.loadMethod(function () { + return _this5.request("subscribe", { + query: query + }); + }, function (body) { + return new ResultSet(body); + }, _objectSpread({}, options, { + subscribe: true + }), callback); + } }]); return CubejsApi; @@ -986,4 +1306,5 @@ var index = (function (apiToken, options) { return new CubejsApi(apiToken, options); }); -module.exports = index; +exports.default = index; +exports.HttpTransport = HttpTransport; diff --git a/packages/cubejs-client-core/dist/cubejs-client-core.umd.js b/packages/cubejs-client-core/dist/cubejs-client-core.umd.js index 0696224b37d9c..0efd698d92295 100644 --- a/packages/cubejs-client-core/dist/cubejs-client-core.umd.js +++ b/packages/cubejs-client-core/dist/cubejs-client-core.umd.js @@ -1,15317 +1,15636 @@ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = global || self, global.cubejs = factory()); -}(this, function () { 'use strict'; - - var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; - - function commonjsRequire () { - throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs'); - } - - function unwrapExports (x) { - return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; - } - - function createCommonjsModule(fn, module) { - return module = { exports: {} }, fn(module, module.exports), module.exports; - } - - var _core = createCommonjsModule(function (module) { - var core = module.exports = { version: '2.6.5' }; - if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef - }); - var _core_1 = _core.version; - - var _global = createCommonjsModule(function (module) { - // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 - var global = module.exports = typeof window != 'undefined' && window.Math == Math - ? window : typeof self != 'undefined' && self.Math == Math ? self - // eslint-disable-next-line no-new-func - : Function('return this')(); - if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef - }); - - var _library = false; - - var _shared = createCommonjsModule(function (module) { - var SHARED = '__core-js_shared__'; - var store = _global[SHARED] || (_global[SHARED] = {}); - - (module.exports = function (key, value) { - return store[key] || (store[key] = value !== undefined ? value : {}); - })('versions', []).push({ - version: _core.version, - mode: 'global', - copyright: '© 2019 Denis Pushkarev (zloirock.ru)' - }); - }); - - var id = 0; - var px = Math.random(); - var _uid = function (key) { - return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); - }; - - var _wks = createCommonjsModule(function (module) { - var store = _shared('wks'); - - var Symbol = _global.Symbol; - var USE_SYMBOL = typeof Symbol == 'function'; - - var $exports = module.exports = function (name) { - return store[name] || (store[name] = - USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid)('Symbol.' + name)); - }; - - $exports.store = store; - }); - - var _isObject = function (it) { - return typeof it === 'object' ? it !== null : typeof it === 'function'; - }; - - var _anObject = function (it) { - if (!_isObject(it)) throw TypeError(it + ' is not an object!'); - return it; - }; - - var _fails = function (exec) { - try { - return !!exec(); - } catch (e) { - return true; - } - }; - - // Thank's IE8 for his funny defineProperty - var _descriptors = !_fails(function () { - return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; - }); - - var document$1 = _global.document; - // typeof document.createElement is 'object' in old IE - var is = _isObject(document$1) && _isObject(document$1.createElement); - var _domCreate = function (it) { - return is ? document$1.createElement(it) : {}; - }; - - var _ie8DomDefine = !_descriptors && !_fails(function () { - return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7; - }); - - // 7.1.1 ToPrimitive(input [, PreferredType]) - - // instead of the ES6 spec version, we didn't implement @@toPrimitive case - // and the second argument - flag - preferred type is a string - var _toPrimitive = function (it, S) { - if (!_isObject(it)) return it; - var fn, val; - if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val; - if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val; - if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val; - throw TypeError("Can't convert object to primitive value"); - }; - - var dP = Object.defineProperty; - - var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) { - _anObject(O); - P = _toPrimitive(P, true); - _anObject(Attributes); - if (_ie8DomDefine) try { - return dP(O, P, Attributes); - } catch (e) { /* empty */ } - if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); - if ('value' in Attributes) O[P] = Attributes.value; - return O; - }; - - var _objectDp = { - f: f - }; - - var _propertyDesc = function (bitmap, value) { - return { - enumerable: !(bitmap & 1), - configurable: !(bitmap & 2), - writable: !(bitmap & 4), - value: value - }; - }; - - var _hide = _descriptors ? function (object, key, value) { - return _objectDp.f(object, key, _propertyDesc(1, value)); - } : function (object, key, value) { - object[key] = value; - return object; - }; - - // 22.1.3.31 Array.prototype[@@unscopables] - var UNSCOPABLES = _wks('unscopables'); - var ArrayProto = Array.prototype; - if (ArrayProto[UNSCOPABLES] == undefined) _hide(ArrayProto, UNSCOPABLES, {}); - var _addToUnscopables = function (key) { - ArrayProto[UNSCOPABLES][key] = true; - }; - - var _iterStep = function (done, value) { - return { value: value, done: !!done }; - }; - - var _iterators = {}; - - var toString = {}.toString; - - var _cof = function (it) { - return toString.call(it).slice(8, -1); - }; - - // fallback for non-array-like ES3 and non-enumerable old V8 strings - - // eslint-disable-next-line no-prototype-builtins - var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) { - return _cof(it) == 'String' ? it.split('') : Object(it); - }; - - // 7.2.1 RequireObjectCoercible(argument) - var _defined = function (it) { - if (it == undefined) throw TypeError("Can't call method on " + it); - return it; - }; - - // to indexed object, toObject with fallback for non-array-like ES3 strings - - - var _toIobject = function (it) { - return _iobject(_defined(it)); - }; - - var hasOwnProperty = {}.hasOwnProperty; - var _has = function (it, key) { - return hasOwnProperty.call(it, key); - }; - - var _functionToString = _shared('native-function-to-string', Function.toString); - - var _redefine = createCommonjsModule(function (module) { - var SRC = _uid('src'); - - var TO_STRING = 'toString'; - var TPL = ('' + _functionToString).split(TO_STRING); - - _core.inspectSource = function (it) { - return _functionToString.call(it); - }; - - (module.exports = function (O, key, val, safe) { - var isFunction = typeof val == 'function'; - if (isFunction) _has(val, 'name') || _hide(val, 'name', key); - if (O[key] === val) return; - if (isFunction) _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); - if (O === _global) { - O[key] = val; - } else if (!safe) { - delete O[key]; - _hide(O, key, val); - } else if (O[key]) { - O[key] = val; - } else { - _hide(O, key, val); - } - // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative - })(Function.prototype, TO_STRING, function toString() { - return typeof this == 'function' && this[SRC] || _functionToString.call(this); - }); - }); - - var _aFunction = function (it) { - if (typeof it != 'function') throw TypeError(it + ' is not a function!'); - return it; - }; - - // optional / simple context binding - - var _ctx = function (fn, that, length) { - _aFunction(fn); - if (that === undefined) return fn; - switch (length) { - case 1: return function (a) { - return fn.call(that, a); - }; - case 2: return function (a, b) { - return fn.call(that, a, b); - }; - case 3: return function (a, b, c) { - return fn.call(that, a, b, c); - }; - } - return function (/* ...args */) { - return fn.apply(that, arguments); - }; - }; - - var PROTOTYPE = 'prototype'; - - var $export = function (type, name, source) { - var IS_FORCED = type & $export.F; - var IS_GLOBAL = type & $export.G; - var IS_STATIC = type & $export.S; - var IS_PROTO = type & $export.P; - var IS_BIND = type & $export.B; - var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE]; - var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {}); - var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); - var key, own, out, exp; - if (IS_GLOBAL) source = name; - for (key in source) { - // contains in native - own = !IS_FORCED && target && target[key] !== undefined; - // export native or passed - out = (own ? target : source)[key]; - // bind timers to global for call from export context - exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out; - // extend global - if (target) _redefine(target, key, out, type & $export.U); - // export - if (exports[key] != out) _hide(exports, key, exp); - if (IS_PROTO && expProto[key] != out) expProto[key] = out; - } - }; - _global.core = _core; - // type bitmap - $export.F = 1; // forced - $export.G = 2; // global - $export.S = 4; // static - $export.P = 8; // proto - $export.B = 16; // bind - $export.W = 32; // wrap - $export.U = 64; // safe - $export.R = 128; // real proto method for `library` - var _export = $export; - - // 7.1.4 ToInteger - var ceil = Math.ceil; - var floor = Math.floor; - var _toInteger = function (it) { - return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); - }; - - // 7.1.15 ToLength - - var min = Math.min; - var _toLength = function (it) { - return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 - }; - - var max = Math.max; - var min$1 = Math.min; - var _toAbsoluteIndex = function (index, length) { - index = _toInteger(index); - return index < 0 ? max(index + length, 0) : min$1(index, length); - }; - - // false -> Array#indexOf - // true -> Array#includes - - - - var _arrayIncludes = function (IS_INCLUDES) { - return function ($this, el, fromIndex) { - var O = _toIobject($this); - var length = _toLength(O.length); - var index = _toAbsoluteIndex(fromIndex, length); - var value; - // Array#includes uses SameValueZero equality algorithm - // eslint-disable-next-line no-self-compare - if (IS_INCLUDES && el != el) while (length > index) { - value = O[index++]; - // eslint-disable-next-line no-self-compare - if (value != value) return true; - // Array#indexOf ignores holes, Array#includes - not - } else for (;length > index; index++) if (IS_INCLUDES || index in O) { - if (O[index] === el) return IS_INCLUDES || index || 0; - } return !IS_INCLUDES && -1; - }; - }; - - var shared = _shared('keys'); - - var _sharedKey = function (key) { - return shared[key] || (shared[key] = _uid(key)); - }; - - var arrayIndexOf = _arrayIncludes(false); - var IE_PROTO = _sharedKey('IE_PROTO'); - - var _objectKeysInternal = function (object, names) { - var O = _toIobject(object); - var i = 0; - var result = []; - var key; - for (key in O) if (key != IE_PROTO) _has(O, key) && result.push(key); - // Don't enum bug & hidden keys - while (names.length > i) if (_has(O, key = names[i++])) { - ~arrayIndexOf(result, key) || result.push(key); - } - return result; - }; - - // IE 8- don't enum bug keys - var _enumBugKeys = ( - 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' - ).split(','); - - // 19.1.2.14 / 15.2.3.14 Object.keys(O) - - - - var _objectKeys = Object.keys || function keys(O) { - return _objectKeysInternal(O, _enumBugKeys); - }; - - var _objectDps = _descriptors ? Object.defineProperties : function defineProperties(O, Properties) { - _anObject(O); - var keys = _objectKeys(Properties); - var length = keys.length; - var i = 0; - var P; - while (length > i) _objectDp.f(O, P = keys[i++], Properties[P]); - return O; - }; - - var document$2 = _global.document; - var _html = document$2 && document$2.documentElement; - - // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) - - - - var IE_PROTO$1 = _sharedKey('IE_PROTO'); - var Empty = function () { /* empty */ }; - var PROTOTYPE$1 = 'prototype'; - - // Create object with fake `null` prototype: use iframe Object with cleared prototype - var createDict = function () { - // Thrash, waste and sodomy: IE GC bug - var iframe = _domCreate('iframe'); - var i = _enumBugKeys.length; - var lt = '<'; - var gt = '>'; - var iframeDocument; - iframe.style.display = 'none'; - _html.appendChild(iframe); - iframe.src = 'javascript:'; // eslint-disable-line no-script-url - // createDict = iframe.contentWindow.Object; - // html.removeChild(iframe); - iframeDocument = iframe.contentWindow.document; - iframeDocument.open(); - iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); - iframeDocument.close(); - createDict = iframeDocument.F; - while (i--) delete createDict[PROTOTYPE$1][_enumBugKeys[i]]; - return createDict(); - }; - - var _objectCreate = Object.create || function create(O, Properties) { - var result; - if (O !== null) { - Empty[PROTOTYPE$1] = _anObject(O); - result = new Empty(); - Empty[PROTOTYPE$1] = null; - // add "__proto__" for Object.getPrototypeOf polyfill - result[IE_PROTO$1] = O; - } else result = createDict(); - return Properties === undefined ? result : _objectDps(result, Properties); - }; - - var def = _objectDp.f; - - var TAG = _wks('toStringTag'); - - var _setToStringTag = function (it, tag, stat) { - if (it && !_has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); - }; - - var IteratorPrototype = {}; - - // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() - _hide(IteratorPrototype, _wks('iterator'), function () { return this; }); - - var _iterCreate = function (Constructor, NAME, next) { - Constructor.prototype = _objectCreate(IteratorPrototype, { next: _propertyDesc(1, next) }); - _setToStringTag(Constructor, NAME + ' Iterator'); - }; - - // 7.1.13 ToObject(argument) - - var _toObject = function (it) { - return Object(_defined(it)); - }; - - // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) - - - var IE_PROTO$2 = _sharedKey('IE_PROTO'); - var ObjectProto = Object.prototype; - - var _objectGpo = Object.getPrototypeOf || function (O) { - O = _toObject(O); - if (_has(O, IE_PROTO$2)) return O[IE_PROTO$2]; - if (typeof O.constructor == 'function' && O instanceof O.constructor) { - return O.constructor.prototype; - } return O instanceof Object ? ObjectProto : null; - }; - - var ITERATOR = _wks('iterator'); - var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` - var FF_ITERATOR = '@@iterator'; - var KEYS = 'keys'; - var VALUES = 'values'; - - var returnThis = function () { return this; }; - - var _iterDefine = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { - _iterCreate(Constructor, NAME, next); - var getMethod = function (kind) { - if (!BUGGY && kind in proto) return proto[kind]; - switch (kind) { - case KEYS: return function keys() { return new Constructor(this, kind); }; - case VALUES: return function values() { return new Constructor(this, kind); }; - } return function entries() { return new Constructor(this, kind); }; - }; - var TAG = NAME + ' Iterator'; - var DEF_VALUES = DEFAULT == VALUES; - var VALUES_BUG = false; - var proto = Base.prototype; - var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; - var $default = $native || getMethod(DEFAULT); - var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; - var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; - var methods, key, IteratorPrototype; - // Fix native - if ($anyNative) { - IteratorPrototype = _objectGpo($anyNative.call(new Base())); - if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { - // Set @@toStringTag to native iterators - _setToStringTag(IteratorPrototype, TAG, true); - // fix for some old engines - if (typeof IteratorPrototype[ITERATOR] != 'function') _hide(IteratorPrototype, ITERATOR, returnThis); - } - } - // fix Array#{values, @@iterator}.name in V8 / FF - if (DEF_VALUES && $native && $native.name !== VALUES) { - VALUES_BUG = true; - $default = function values() { return $native.call(this); }; - } - // Define iterator - if (BUGGY || VALUES_BUG || !proto[ITERATOR]) { - _hide(proto, ITERATOR, $default); - } - // Plug for library - _iterators[NAME] = $default; - _iterators[TAG] = returnThis; - if (DEFAULT) { - methods = { - values: DEF_VALUES ? $default : getMethod(VALUES), - keys: IS_SET ? $default : getMethod(KEYS), - entries: $entries - }; - if (FORCED) for (key in methods) { - if (!(key in proto)) _redefine(proto, key, methods[key]); - } else _export(_export.P + _export.F * (BUGGY || VALUES_BUG), NAME, methods); - } - return methods; - }; - - // 22.1.3.4 Array.prototype.entries() - // 22.1.3.13 Array.prototype.keys() - // 22.1.3.29 Array.prototype.values() - // 22.1.3.30 Array.prototype[@@iterator]() - var es6_array_iterator = _iterDefine(Array, 'Array', function (iterated, kind) { - this._t = _toIobject(iterated); // target - this._i = 0; // next index - this._k = kind; // kind - // 22.1.5.2.1 %ArrayIteratorPrototype%.next() - }, function () { - var O = this._t; - var kind = this._k; - var index = this._i++; - if (!O || index >= O.length) { - this._t = undefined; - return _iterStep(1); - } - if (kind == 'keys') return _iterStep(0, index); - if (kind == 'values') return _iterStep(0, O[index]); - return _iterStep(0, [index, O[index]]); - }, 'values'); - - // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) - _iterators.Arguments = _iterators.Array; - - _addToUnscopables('keys'); - _addToUnscopables('values'); - _addToUnscopables('entries'); - - var ITERATOR$1 = _wks('iterator'); - var TO_STRING_TAG = _wks('toStringTag'); - var ArrayValues = _iterators.Array; - - var DOMIterables = { - CSSRuleList: true, // TODO: Not spec compliant, should be false. - CSSStyleDeclaration: false, - CSSValueList: false, - ClientRectList: false, - DOMRectList: false, - DOMStringList: false, - DOMTokenList: true, - DataTransferItemList: false, - FileList: false, - HTMLAllCollection: false, - HTMLCollection: false, - HTMLFormElement: false, - HTMLSelectElement: false, - MediaList: true, // TODO: Not spec compliant, should be false. - MimeTypeArray: false, - NamedNodeMap: false, - NodeList: true, - PaintRequestList: false, - Plugin: false, - PluginArray: false, - SVGLengthList: false, - SVGNumberList: false, - SVGPathSegList: false, - SVGPointList: false, - SVGStringList: false, - SVGTransformList: false, - SourceBufferList: false, - StyleSheetList: true, // TODO: Not spec compliant, should be false. - TextTrackCueList: false, - TextTrackList: false, - TouchList: false - }; - - for (var collections = _objectKeys(DOMIterables), i = 0; i < collections.length; i++) { - var NAME = collections[i]; - var explicit = DOMIterables[NAME]; - var Collection = _global[NAME]; - var proto = Collection && Collection.prototype; - var key; - if (proto) { - if (!proto[ITERATOR$1]) _hide(proto, ITERATOR$1, ArrayValues); - if (!proto[TO_STRING_TAG]) _hide(proto, TO_STRING_TAG, NAME); - _iterators[NAME] = ArrayValues; - if (explicit) for (key in es6_array_iterator) if (!proto[key]) _redefine(proto, key, es6_array_iterator[key], true); - } - } - - // getting tag from 19.1.3.6 Object.prototype.toString() - - var TAG$1 = _wks('toStringTag'); - // ES3 wrong here - var ARG = _cof(function () { return arguments; }()) == 'Arguments'; - - // fallback for IE11 Script Access Denied error - var tryGet = function (it, key) { - try { - return it[key]; - } catch (e) { /* empty */ } - }; - - var _classof = function (it) { - var O, T, B; - return it === undefined ? 'Undefined' : it === null ? 'Null' - // @@toStringTag case - : typeof (T = tryGet(O = Object(it), TAG$1)) == 'string' ? T - // builtinTag case - : ARG ? _cof(O) - // ES3 arguments fallback - : (B = _cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; - }; - - var _anInstance = function (it, Constructor, name, forbiddenField) { - if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) { - throw TypeError(name + ': incorrect invocation!'); - } return it; - }; - - // call something on iterator step with safe closing on error - - var _iterCall = function (iterator, fn, value, entries) { - try { - return entries ? fn(_anObject(value)[0], value[1]) : fn(value); - // 7.4.6 IteratorClose(iterator, completion) - } catch (e) { - var ret = iterator['return']; - if (ret !== undefined) _anObject(ret.call(iterator)); - throw e; - } - }; - - // check on default Array iterator - - var ITERATOR$2 = _wks('iterator'); - var ArrayProto$1 = Array.prototype; - - var _isArrayIter = function (it) { - return it !== undefined && (_iterators.Array === it || ArrayProto$1[ITERATOR$2] === it); - }; - - var ITERATOR$3 = _wks('iterator'); - - var core_getIteratorMethod = _core.getIteratorMethod = function (it) { - if (it != undefined) return it[ITERATOR$3] - || it['@@iterator'] - || _iterators[_classof(it)]; - }; - - var _forOf = createCommonjsModule(function (module) { - var BREAK = {}; - var RETURN = {}; - var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) { - var iterFn = ITERATOR ? function () { return iterable; } : core_getIteratorMethod(iterable); - var f = _ctx(fn, that, entries ? 2 : 1); - var index = 0; - var length, step, iterator, result; - if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!'); - // fast case for arrays with default iterator - if (_isArrayIter(iterFn)) for (length = _toLength(iterable.length); length > index; index++) { - result = entries ? f(_anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); - if (result === BREAK || result === RETURN) return result; - } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) { - result = _iterCall(iterator, f, step.value, entries); - if (result === BREAK || result === RETURN) return result; - } - }; - exports.BREAK = BREAK; - exports.RETURN = RETURN; - }); - - // 7.3.20 SpeciesConstructor(O, defaultConstructor) - - - var SPECIES = _wks('species'); - var _speciesConstructor = function (O, D) { - var C = _anObject(O).constructor; - var S; - return C === undefined || (S = _anObject(C)[SPECIES]) == undefined ? D : _aFunction(S); - }; - - // fast apply, http://jsperf.lnkit.com/fast-apply/5 - var _invoke = function (fn, args, that) { - var un = that === undefined; - switch (args.length) { - case 0: return un ? fn() - : fn.call(that); - case 1: return un ? fn(args[0]) - : fn.call(that, args[0]); - case 2: return un ? fn(args[0], args[1]) - : fn.call(that, args[0], args[1]); - case 3: return un ? fn(args[0], args[1], args[2]) - : fn.call(that, args[0], args[1], args[2]); - case 4: return un ? fn(args[0], args[1], args[2], args[3]) - : fn.call(that, args[0], args[1], args[2], args[3]); - } return fn.apply(that, args); - }; - - var process = _global.process; - var setTask = _global.setImmediate; - var clearTask = _global.clearImmediate; - var MessageChannel = _global.MessageChannel; - var Dispatch = _global.Dispatch; - var counter = 0; - var queue = {}; - var ONREADYSTATECHANGE = 'onreadystatechange'; - var defer, channel, port; - var run = function () { - var id = +this; - // eslint-disable-next-line no-prototype-builtins - if (queue.hasOwnProperty(id)) { - var fn = queue[id]; - delete queue[id]; - fn(); - } - }; - var listener = function (event) { - run.call(event.data); - }; - // Node.js 0.9+ & IE10+ has setImmediate, otherwise: - if (!setTask || !clearTask) { - setTask = function setImmediate(fn) { - var args = []; - var i = 1; - while (arguments.length > i) args.push(arguments[i++]); - queue[++counter] = function () { - // eslint-disable-next-line no-new-func - _invoke(typeof fn == 'function' ? fn : Function(fn), args); - }; - defer(counter); - return counter; - }; - clearTask = function clearImmediate(id) { - delete queue[id]; - }; - // Node.js 0.8- - if (_cof(process) == 'process') { - defer = function (id) { - process.nextTick(_ctx(run, id, 1)); - }; - // Sphere (JS game engine) Dispatch API - } else if (Dispatch && Dispatch.now) { - defer = function (id) { - Dispatch.now(_ctx(run, id, 1)); - }; - // Browsers with MessageChannel, includes WebWorkers - } else if (MessageChannel) { - channel = new MessageChannel(); - port = channel.port2; - channel.port1.onmessage = listener; - defer = _ctx(port.postMessage, port, 1); - // Browsers with postMessage, skip WebWorkers - // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' - } else if (_global.addEventListener && typeof postMessage == 'function' && !_global.importScripts) { - defer = function (id) { - _global.postMessage(id + '', '*'); - }; - _global.addEventListener('message', listener, false); - // IE8- - } else if (ONREADYSTATECHANGE in _domCreate('script')) { - defer = function (id) { - _html.appendChild(_domCreate('script'))[ONREADYSTATECHANGE] = function () { - _html.removeChild(this); - run.call(id); - }; - }; - // Rest old browsers - } else { - defer = function (id) { - setTimeout(_ctx(run, id, 1), 0); - }; - } - } - var _task = { - set: setTask, - clear: clearTask - }; - - var macrotask = _task.set; - var Observer = _global.MutationObserver || _global.WebKitMutationObserver; - var process$1 = _global.process; - var Promise$1 = _global.Promise; - var isNode = _cof(process$1) == 'process'; - - var _microtask = function () { - var head, last, notify; - - var flush = function () { - var parent, fn; - if (isNode && (parent = process$1.domain)) parent.exit(); - while (head) { - fn = head.fn; - head = head.next; - try { - fn(); - } catch (e) { - if (head) notify(); - else last = undefined; - throw e; - } - } last = undefined; - if (parent) parent.enter(); - }; - - // Node.js - if (isNode) { - notify = function () { - process$1.nextTick(flush); - }; - // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339 - } else if (Observer && !(_global.navigator && _global.navigator.standalone)) { - var toggle = true; - var node = document.createTextNode(''); - new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new - notify = function () { - node.data = toggle = !toggle; - }; - // environments with maybe non-completely correct, but existent Promise - } else if (Promise$1 && Promise$1.resolve) { - // Promise.resolve without an argument throws an error in LG WebOS 2 - var promise = Promise$1.resolve(undefined); - notify = function () { - promise.then(flush); - }; - // for other environments - macrotask based on: - // - setImmediate - // - MessageChannel - // - window.postMessag - // - onreadystatechange - // - setTimeout - } else { - notify = function () { - // strange IE + webpack dev server bug - use .call(global) - macrotask.call(_global, flush); - }; - } - - return function (fn) { - var task = { fn: fn, next: undefined }; - if (last) last.next = task; - if (!head) { - head = task; - notify(); - } last = task; - }; - }; - - // 25.4.1.5 NewPromiseCapability(C) - - - function PromiseCapability(C) { - var resolve, reject; - this.promise = new C(function ($$resolve, $$reject) { - if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor'); - resolve = $$resolve; - reject = $$reject; - }); - this.resolve = _aFunction(resolve); - this.reject = _aFunction(reject); - } - - var f$1 = function (C) { - return new PromiseCapability(C); - }; - - var _newPromiseCapability = { - f: f$1 - }; - - var _perform = function (exec) { - try { - return { e: false, v: exec() }; - } catch (e) { - return { e: true, v: e }; - } - }; - - var navigator = _global.navigator; - - var _userAgent = navigator && navigator.userAgent || ''; - - var _promiseResolve = function (C, x) { - _anObject(C); - if (_isObject(x) && x.constructor === C) return x; - var promiseCapability = _newPromiseCapability.f(C); - var resolve = promiseCapability.resolve; - resolve(x); - return promiseCapability.promise; - }; - - var _redefineAll = function (target, src, safe) { - for (var key in src) _redefine(target, key, src[key], safe); - return target; - }; - - var SPECIES$1 = _wks('species'); - - var _setSpecies = function (KEY) { - var C = _global[KEY]; - if (_descriptors && C && !C[SPECIES$1]) _objectDp.f(C, SPECIES$1, { - configurable: true, - get: function () { return this; } - }); - }; - - var ITERATOR$4 = _wks('iterator'); - var SAFE_CLOSING = false; - - try { - var riter = [7][ITERATOR$4](); - riter['return'] = function () { SAFE_CLOSING = true; }; - } catch (e) { /* empty */ } - - var _iterDetect = function (exec, skipClosing) { - if (!skipClosing && !SAFE_CLOSING) return false; - var safe = false; - try { - var arr = [7]; - var iter = arr[ITERATOR$4](); - iter.next = function () { return { done: safe = true }; }; - arr[ITERATOR$4] = function () { return iter; }; - exec(arr); - } catch (e) { /* empty */ } - return safe; - }; - - var task = _task.set; - var microtask = _microtask(); - - - - - var PROMISE = 'Promise'; - var TypeError$1 = _global.TypeError; - var process$2 = _global.process; - var versions = process$2 && process$2.versions; - var v8 = versions && versions.v8 || ''; - var $Promise = _global[PROMISE]; - var isNode$1 = _classof(process$2) == 'process'; - var empty = function () { /* empty */ }; - var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper; - var newPromiseCapability = newGenericPromiseCapability = _newPromiseCapability.f; - - var USE_NATIVE = !!function () { - try { - // correct subclassing with @@species support - var promise = $Promise.resolve(1); - var FakePromise = (promise.constructor = {})[_wks('species')] = function (exec) { - exec(empty, empty); - }; - // unhandled rejections tracking support, NodeJS Promise without it fails @@species test - return (isNode$1 || typeof PromiseRejectionEvent == 'function') - && promise.then(empty) instanceof FakePromise - // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables - // https://bugs.chromium.org/p/chromium/issues/detail?id=830565 - // we can't detect it synchronously, so just check versions - && v8.indexOf('6.6') !== 0 - && _userAgent.indexOf('Chrome/66') === -1; - } catch (e) { /* empty */ } - }(); - - // helpers - var isThenable = function (it) { - var then; - return _isObject(it) && typeof (then = it.then) == 'function' ? then : false; - }; - var notify = function (promise, isReject) { - if (promise._n) return; - promise._n = true; - var chain = promise._c; - microtask(function () { - var value = promise._v; - var ok = promise._s == 1; - var i = 0; - var run = function (reaction) { - var handler = ok ? reaction.ok : reaction.fail; - var resolve = reaction.resolve; - var reject = reaction.reject; - var domain = reaction.domain; - var result, then, exited; - try { - if (handler) { - if (!ok) { - if (promise._h == 2) onHandleUnhandled(promise); - promise._h = 1; - } - if (handler === true) result = value; - else { - if (domain) domain.enter(); - result = handler(value); // may throw - if (domain) { - domain.exit(); - exited = true; - } - } - if (result === reaction.promise) { - reject(TypeError$1('Promise-chain cycle')); - } else if (then = isThenable(result)) { - then.call(result, resolve, reject); - } else resolve(result); - } else reject(value); - } catch (e) { - if (domain && !exited) domain.exit(); - reject(e); - } - }; - while (chain.length > i) run(chain[i++]); // variable length - can't use forEach - promise._c = []; - promise._n = false; - if (isReject && !promise._h) onUnhandled(promise); - }); - }; - var onUnhandled = function (promise) { - task.call(_global, function () { - var value = promise._v; - var unhandled = isUnhandled(promise); - var result, handler, console; - if (unhandled) { - result = _perform(function () { - if (isNode$1) { - process$2.emit('unhandledRejection', value, promise); - } else if (handler = _global.onunhandledrejection) { - handler({ promise: promise, reason: value }); - } else if ((console = _global.console) && console.error) { - console.error('Unhandled promise rejection', value); - } - }); - // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should - promise._h = isNode$1 || isUnhandled(promise) ? 2 : 1; - } promise._a = undefined; - if (unhandled && result.e) throw result.v; - }); - }; - var isUnhandled = function (promise) { - return promise._h !== 1 && (promise._a || promise._c).length === 0; - }; - var onHandleUnhandled = function (promise) { - task.call(_global, function () { - var handler; - if (isNode$1) { - process$2.emit('rejectionHandled', promise); - } else if (handler = _global.onrejectionhandled) { - handler({ promise: promise, reason: promise._v }); - } - }); - }; - var $reject = function (value) { - var promise = this; - if (promise._d) return; - promise._d = true; - promise = promise._w || promise; // unwrap - promise._v = value; - promise._s = 2; - if (!promise._a) promise._a = promise._c.slice(); - notify(promise, true); - }; - var $resolve = function (value) { - var promise = this; - var then; - if (promise._d) return; - promise._d = true; - promise = promise._w || promise; // unwrap - try { - if (promise === value) throw TypeError$1("Promise can't be resolved itself"); - if (then = isThenable(value)) { - microtask(function () { - var wrapper = { _w: promise, _d: false }; // wrap - try { - then.call(value, _ctx($resolve, wrapper, 1), _ctx($reject, wrapper, 1)); - } catch (e) { - $reject.call(wrapper, e); - } - }); - } else { - promise._v = value; - promise._s = 1; - notify(promise, false); - } - } catch (e) { - $reject.call({ _w: promise, _d: false }, e); // wrap - } - }; - - // constructor polyfill - if (!USE_NATIVE) { - // 25.4.3.1 Promise(executor) - $Promise = function Promise(executor) { - _anInstance(this, $Promise, PROMISE, '_h'); - _aFunction(executor); - Internal.call(this); - try { - executor(_ctx($resolve, this, 1), _ctx($reject, this, 1)); - } catch (err) { - $reject.call(this, err); - } - }; - // eslint-disable-next-line no-unused-vars - Internal = function Promise(executor) { - this._c = []; // <- awaiting reactions - this._a = undefined; // <- checked in isUnhandled reactions - this._s = 0; // <- state - this._d = false; // <- done - this._v = undefined; // <- value - this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled - this._n = false; // <- notify - }; - Internal.prototype = _redefineAll($Promise.prototype, { - // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) - then: function then(onFulfilled, onRejected) { - var reaction = newPromiseCapability(_speciesConstructor(this, $Promise)); - reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; - reaction.fail = typeof onRejected == 'function' && onRejected; - reaction.domain = isNode$1 ? process$2.domain : undefined; - this._c.push(reaction); - if (this._a) this._a.push(reaction); - if (this._s) notify(this, false); - return reaction.promise; - }, - // 25.4.5.1 Promise.prototype.catch(onRejected) - 'catch': function (onRejected) { - return this.then(undefined, onRejected); - } - }); - OwnPromiseCapability = function () { - var promise = new Internal(); - this.promise = promise; - this.resolve = _ctx($resolve, promise, 1); - this.reject = _ctx($reject, promise, 1); - }; - _newPromiseCapability.f = newPromiseCapability = function (C) { - return C === $Promise || C === Wrapper - ? new OwnPromiseCapability(C) - : newGenericPromiseCapability(C); - }; - } - - _export(_export.G + _export.W + _export.F * !USE_NATIVE, { Promise: $Promise }); - _setToStringTag($Promise, PROMISE); - _setSpecies(PROMISE); - Wrapper = _core[PROMISE]; - - // statics - _export(_export.S + _export.F * !USE_NATIVE, PROMISE, { - // 25.4.4.5 Promise.reject(r) - reject: function reject(r) { - var capability = newPromiseCapability(this); - var $$reject = capability.reject; - $$reject(r); - return capability.promise; - } - }); - _export(_export.S + _export.F * (_library || !USE_NATIVE), PROMISE, { - // 25.4.4.6 Promise.resolve(x) - resolve: function resolve(x) { - return _promiseResolve(_library && this === Wrapper ? $Promise : this, x); - } - }); - _export(_export.S + _export.F * !(USE_NATIVE && _iterDetect(function (iter) { - $Promise.all(iter)['catch'](empty); - })), PROMISE, { - // 25.4.4.1 Promise.all(iterable) - all: function all(iterable) { - var C = this; - var capability = newPromiseCapability(C); - var resolve = capability.resolve; - var reject = capability.reject; - var result = _perform(function () { - var values = []; - var index = 0; - var remaining = 1; - _forOf(iterable, false, function (promise) { - var $index = index++; - var alreadyCalled = false; - values.push(undefined); - remaining++; - C.resolve(promise).then(function (value) { - if (alreadyCalled) return; - alreadyCalled = true; - values[$index] = value; - --remaining || resolve(values); - }, reject); - }); - --remaining || resolve(values); - }); - if (result.e) reject(result.v); - return capability.promise; - }, - // 25.4.4.4 Promise.race(iterable) - race: function race(iterable) { - var C = this; - var capability = newPromiseCapability(C); - var reject = capability.reject; - var result = _perform(function () { - _forOf(iterable, false, function (promise) { - C.resolve(promise).then(capability.resolve, reject); - }); - }); - if (result.e) reject(result.v); - return capability.promise; - } - }); - - function _typeof(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof = function (obj) { - return typeof obj; - }; - } else { - _typeof = function (obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; - } - - return _typeof(obj); - } - - function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { - try { - var info = gen[key](arg); - var value = info.value; - } catch (error) { - reject(error); - return; - } - - if (info.done) { - resolve(value); - } else { - Promise.resolve(value).then(_next, _throw); - } - } - - function _asyncToGenerator(fn) { - return function () { - var self = this, - args = arguments; - return new Promise(function (resolve, reject) { - var gen = fn.apply(self, args); - - function _next(value) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); - } - - function _throw(err) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); - } - - _next(undefined); - }); - }; - } - - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a 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); - } - } - - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; - } - - 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 _objectSpread(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - var ownKeys = Object.keys(source); - - if (typeof Object.getOwnPropertySymbols === 'function') { - ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { - return Object.getOwnPropertyDescriptor(source, sym).enumerable; - })); - } - - ownKeys.forEach(function (key) { - _defineProperty(target, key, source[key]); - }); - } - - return target; - } - - function _objectWithoutPropertiesLoose(source, excluded) { - if (source == null) return {}; - var target = {}; - var sourceKeys = Object.keys(source); - var key, i; - - for (i = 0; i < sourceKeys.length; i++) { - key = sourceKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - target[key] = source[key]; - } - - return target; - } - - function _objectWithoutProperties(source, excluded) { - if (source == null) return {}; - - var target = _objectWithoutPropertiesLoose(source, excluded); - - var key, i; - - if (Object.getOwnPropertySymbols) { - var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - - for (i = 0; i < sourceSymbolKeys.length; i++) { - key = sourceSymbolKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; - target[key] = source[key]; - } - } - - return target; - } - - function _slicedToArray(arr, i) { - return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); - } - - function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; - } - - function _iterableToArrayLimit(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"] != null) _i["return"](); - } finally { - if (_d) throw _e; - } - } - - return _arr; - } - - function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); - } - - var f$2 = {}.propertyIsEnumerable; - - var _objectPie = { - f: f$2 - }; - - var gOPD = Object.getOwnPropertyDescriptor; - - var f$3 = _descriptors ? gOPD : function getOwnPropertyDescriptor(O, P) { - O = _toIobject(O); - P = _toPrimitive(P, true); - if (_ie8DomDefine) try { - return gOPD(O, P); - } catch (e) { /* empty */ } - if (_has(O, P)) return _propertyDesc(!_objectPie.f.call(O, P), O[P]); - }; - - var _objectGopd = { - f: f$3 - }; - - // Works with __proto__ only. Old v8 can't work with null proto objects. - /* eslint-disable no-proto */ - - - var check = function (O, proto) { - _anObject(O); - if (!_isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!"); - }; - var _setProto = { - set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line - function (test, buggy, set) { - try { - set = _ctx(Function.call, _objectGopd.f(Object.prototype, '__proto__').set, 2); - set(test, []); - buggy = !(test instanceof Array); - } catch (e) { buggy = true; } - return function setPrototypeOf(O, proto) { - check(O, proto); - if (buggy) O.__proto__ = proto; - else set(O, proto); - return O; - }; - }({}, false) : undefined), - check: check - }; - - // 19.1.3.19 Object.setPrototypeOf(O, proto) - - _export(_export.S, 'Object', { setPrototypeOf: _setProto.set }); - - var dP$1 = _objectDp.f; - var FProto = Function.prototype; - var nameRE = /^\s*function ([^ (]*)/; - var NAME$1 = 'name'; - - // 19.2.4.2 name - NAME$1 in FProto || _descriptors && dP$1(FProto, NAME$1, { - configurable: true, - get: function () { - try { - return ('' + this).match(nameRE)[1]; - } catch (e) { - return ''; - } - } - }); - - // 7.2.2 IsArray(argument) - - var _isArray = Array.isArray || function isArray(arg) { - return _cof(arg) == 'Array'; - }; - - var SPECIES$2 = _wks('species'); - - var _arraySpeciesConstructor = function (original) { - var C; - if (_isArray(original)) { - C = original.constructor; - // cross-realm fallback - if (typeof C == 'function' && (C === Array || _isArray(C.prototype))) C = undefined; - if (_isObject(C)) { - C = C[SPECIES$2]; - if (C === null) C = undefined; - } - } return C === undefined ? Array : C; - }; - - // 9.4.2.3 ArraySpeciesCreate(originalArray, length) - - - var _arraySpeciesCreate = function (original, length) { - return new (_arraySpeciesConstructor(original))(length); - }; - - // 0 -> Array#forEach - // 1 -> Array#map - // 2 -> Array#filter - // 3 -> Array#some - // 4 -> Array#every - // 5 -> Array#find - // 6 -> Array#findIndex - - - - - - var _arrayMethods = function (TYPE, $create) { - var IS_MAP = TYPE == 1; - var IS_FILTER = TYPE == 2; - var IS_SOME = TYPE == 3; - var IS_EVERY = TYPE == 4; - var IS_FIND_INDEX = TYPE == 6; - var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; - var create = $create || _arraySpeciesCreate; - return function ($this, callbackfn, that) { - var O = _toObject($this); - var self = _iobject(O); - var f = _ctx(callbackfn, that, 3); - var length = _toLength(self.length); - var index = 0; - var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; - var val, res; - for (;length > index; index++) if (NO_HOLES || index in self) { - val = self[index]; - res = f(val, index, O); - if (TYPE) { - if (IS_MAP) result[index] = res; // map - else if (res) switch (TYPE) { - case 3: return true; // some - case 5: return val; // find - case 6: return index; // findIndex - case 2: result.push(val); // filter - } else if (IS_EVERY) return false; // every - } - } - return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; - }; - }; - - var _strictMethod = function (method, arg) { - return !!method && _fails(function () { - // eslint-disable-next-line no-useless-call - arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null); - }); - }; - - var $forEach = _arrayMethods(0); - var STRICT = _strictMethod([].forEach, true); - - _export(_export.P + _export.F * !STRICT, 'Array', { - // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg]) - forEach: function forEach(callbackfn /* , thisArg */) { - return $forEach(this, callbackfn, arguments[1]); - } - }); - - // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) - _export(_export.S, 'Object', { create: _objectCreate }); - - var f$4 = _wks; - - var _wksExt = { - f: f$4 - }; - - var defineProperty = _objectDp.f; - var _wksDefine = function (name) { - var $Symbol = _core.Symbol || (_core.Symbol = _global.Symbol || {}); - if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: _wksExt.f(name) }); - }; - - _wksDefine('asyncIterator'); - - var _meta = createCommonjsModule(function (module) { - var META = _uid('meta'); - - - var setDesc = _objectDp.f; - var id = 0; - var isExtensible = Object.isExtensible || function () { - return true; - }; - var FREEZE = !_fails(function () { - return isExtensible(Object.preventExtensions({})); - }); - var setMeta = function (it) { - setDesc(it, META, { value: { - i: 'O' + ++id, // object ID - w: {} // weak collections IDs - } }); - }; - var fastKey = function (it, create) { - // return primitive with prefix - if (!_isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; - if (!_has(it, META)) { - // can't set metadata to uncaught frozen object - if (!isExtensible(it)) return 'F'; - // not necessary to add metadata - if (!create) return 'E'; - // add missing metadata - setMeta(it); - // return object ID - } return it[META].i; - }; - var getWeak = function (it, create) { - if (!_has(it, META)) { - // can't set metadata to uncaught frozen object - if (!isExtensible(it)) return true; - // not necessary to add metadata - if (!create) return false; - // add missing metadata - setMeta(it); - // return hash weak collections IDs - } return it[META].w; - }; - // add metadata on freeze-family methods calling - var onFreeze = function (it) { - if (FREEZE && meta.NEED && isExtensible(it) && !_has(it, META)) setMeta(it); - return it; - }; - var meta = module.exports = { - KEY: META, - NEED: false, - fastKey: fastKey, - getWeak: getWeak, - onFreeze: onFreeze - }; - }); - var _meta_1 = _meta.KEY; - var _meta_2 = _meta.NEED; - var _meta_3 = _meta.fastKey; - var _meta_4 = _meta.getWeak; - var _meta_5 = _meta.onFreeze; + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = global || self, factory(global.cubejs = {})); +}(this, function (exports) { 'use strict'; + + function _typeof(obj) { + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); + } + + function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { + try { + var info = gen[key](arg); + var value = info.value; + } catch (error) { + reject(error); + return; + } + + if (info.done) { + resolve(value); + } else { + Promise.resolve(value).then(_next, _throw); + } + } + + function _asyncToGenerator(fn) { + return function () { + var self = this, + args = arguments; + return new Promise(function (resolve, reject) { + var gen = fn.apply(self, args); + + function _next(value) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); + } + + function _throw(err) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); + } + + _next(undefined); + }); + }; + } + + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a 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); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + 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 _objectSpread(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + var ownKeys = Object.keys(source); + + if (typeof Object.getOwnPropertySymbols === 'function') { + ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { + return Object.getOwnPropertyDescriptor(source, sym).enumerable; + })); + } + + ownKeys.forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } + + return target; + } + + function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + + return target; + } + + function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + + var target = _objectWithoutPropertiesLoose(source, excluded); + + var key, i; + + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + + for (i = 0; i < sourceSymbolKeys.length; i++) { + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + + return target; + } + + function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); + } + + function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; + } + + function _iterableToArrayLimit(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"] != null) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; + } + + function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance"); + } + + var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function commonjsRequire () { + throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs'); + } + + function unwrapExports (x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; + } + + function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; + } + + var _core = createCommonjsModule(function (module) { + var core = module.exports = { version: '2.5.7' }; + if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef + }); + var _core_1 = _core.version; + + var _global = createCommonjsModule(function (module) { + // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 + var global = module.exports = typeof window != 'undefined' && window.Math == Math + ? window : typeof self != 'undefined' && self.Math == Math ? self + // eslint-disable-next-line no-new-func + : Function('return this')(); + if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef + }); + + var _library = false; + + var _shared = createCommonjsModule(function (module) { + var SHARED = '__core-js_shared__'; + var store = _global[SHARED] || (_global[SHARED] = {}); + + (module.exports = function (key, value) { + return store[key] || (store[key] = value !== undefined ? value : {}); + })('versions', []).push({ + version: _core.version, + mode: 'global', + copyright: '© 2018 Denis Pushkarev (zloirock.ru)' + }); + }); + + var id$1 = 0; + var px = Math.random(); + var _uid = function (key) { + return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id$1 + px).toString(36)); + }; + + var _wks = createCommonjsModule(function (module) { + var store = _shared('wks'); + + var Symbol = _global.Symbol; + var USE_SYMBOL = typeof Symbol == 'function'; + + var $exports = module.exports = function (name) { + return store[name] || (store[name] = + USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid)('Symbol.' + name)); + }; + + $exports.store = store; + }); + + var _isObject = function (it) { + return typeof it === 'object' ? it !== null : typeof it === 'function'; + }; + + var _anObject = function (it) { + if (!_isObject(it)) throw TypeError(it + ' is not an object!'); + return it; + }; + + var _fails = function (exec) { + try { + return !!exec(); + } catch (e) { + return true; + } + }; + + // Thank's IE8 for his funny defineProperty + var _descriptors = !_fails(function () { + return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; + }); + + var document$1 = _global.document; + // typeof document.createElement is 'object' in old IE + var is = _isObject(document$1) && _isObject(document$1.createElement); + var _domCreate = function (it) { + return is ? document$1.createElement(it) : {}; + }; + + var _ie8DomDefine = !_descriptors && !_fails(function () { + return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7; + }); + + // 7.1.1 ToPrimitive(input [, PreferredType]) + + // instead of the ES6 spec version, we didn't implement @@toPrimitive case + // and the second argument - flag - preferred type is a string + var _toPrimitive = function (it, S) { + if (!_isObject(it)) return it; + var fn, val; + if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val; + if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val; + if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val; + throw TypeError("Can't convert object to primitive value"); + }; + + var dP = Object.defineProperty; + + var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) { + _anObject(O); + P = _toPrimitive(P, true); + _anObject(Attributes); + if (_ie8DomDefine) try { + return dP(O, P, Attributes); + } catch (e) { /* empty */ } + if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); + if ('value' in Attributes) O[P] = Attributes.value; + return O; + }; + + var _objectDp = { + f: f + }; + + var _propertyDesc = function (bitmap, value) { + return { + enumerable: !(bitmap & 1), + configurable: !(bitmap & 2), + writable: !(bitmap & 4), + value: value + }; + }; + + var _hide = _descriptors ? function (object, key, value) { + return _objectDp.f(object, key, _propertyDesc(1, value)); + } : function (object, key, value) { + object[key] = value; + return object; + }; + + // 22.1.3.31 Array.prototype[@@unscopables] + var UNSCOPABLES = _wks('unscopables'); + var ArrayProto = Array.prototype; + if (ArrayProto[UNSCOPABLES] == undefined) _hide(ArrayProto, UNSCOPABLES, {}); + var _addToUnscopables = function (key) { + ArrayProto[UNSCOPABLES][key] = true; + }; + + var _iterStep = function (done, value) { + return { value: value, done: !!done }; + }; + + var _iterators = {}; + + var toString = {}.toString; + + var _cof = function (it) { + return toString.call(it).slice(8, -1); + }; + + // fallback for non-array-like ES3 and non-enumerable old V8 strings + + // eslint-disable-next-line no-prototype-builtins + var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) { + return _cof(it) == 'String' ? it.split('') : Object(it); + }; + + // 7.2.1 RequireObjectCoercible(argument) + var _defined = function (it) { + if (it == undefined) throw TypeError("Can't call method on " + it); + return it; + }; + + // to indexed object, toObject with fallback for non-array-like ES3 strings + + + var _toIobject = function (it) { + return _iobject(_defined(it)); + }; + + var hasOwnProperty = {}.hasOwnProperty; + var _has = function (it, key) { + return hasOwnProperty.call(it, key); + }; + + var _redefine = createCommonjsModule(function (module) { + var SRC = _uid('src'); + var TO_STRING = 'toString'; + var $toString = Function[TO_STRING]; + var TPL = ('' + $toString).split(TO_STRING); + + _core.inspectSource = function (it) { + return $toString.call(it); + }; + + (module.exports = function (O, key, val, safe) { + var isFunction = typeof val == 'function'; + if (isFunction) _has(val, 'name') || _hide(val, 'name', key); + if (O[key] === val) return; + if (isFunction) _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); + if (O === _global) { + O[key] = val; + } else if (!safe) { + delete O[key]; + _hide(O, key, val); + } else if (O[key]) { + O[key] = val; + } else { + _hide(O, key, val); + } + // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative + })(Function.prototype, TO_STRING, function toString() { + return typeof this == 'function' && this[SRC] || $toString.call(this); + }); + }); + + var _aFunction = function (it) { + if (typeof it != 'function') throw TypeError(it + ' is not a function!'); + return it; + }; + + // optional / simple context binding + + var _ctx = function (fn, that, length) { + _aFunction(fn); + if (that === undefined) return fn; + switch (length) { + case 1: return function (a) { + return fn.call(that, a); + }; + case 2: return function (a, b) { + return fn.call(that, a, b); + }; + case 3: return function (a, b, c) { + return fn.call(that, a, b, c); + }; + } + return function (/* ...args */) { + return fn.apply(that, arguments); + }; + }; + + var PROTOTYPE = 'prototype'; + + var $export = function (type, name, source) { + var IS_FORCED = type & $export.F; + var IS_GLOBAL = type & $export.G; + var IS_STATIC = type & $export.S; + var IS_PROTO = type & $export.P; + var IS_BIND = type & $export.B; + var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE]; + var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {}); + var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); + var key, own, out, exp; + if (IS_GLOBAL) source = name; + for (key in source) { + // contains in native + own = !IS_FORCED && target && target[key] !== undefined; + // export native or passed + out = (own ? target : source)[key]; + // bind timers to global for call from export context + exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out; + // extend global + if (target) _redefine(target, key, out, type & $export.U); + // export + if (exports[key] != out) _hide(exports, key, exp); + if (IS_PROTO && expProto[key] != out) expProto[key] = out; + } + }; + _global.core = _core; + // type bitmap + $export.F = 1; // forced + $export.G = 2; // global + $export.S = 4; // static + $export.P = 8; // proto + $export.B = 16; // bind + $export.W = 32; // wrap + $export.U = 64; // safe + $export.R = 128; // real proto method for `library` + var _export = $export; + + // 7.1.4 ToInteger + var ceil = Math.ceil; + var floor = Math.floor; + var _toInteger = function (it) { + return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); + }; + + // 7.1.15 ToLength + + var min = Math.min; + var _toLength = function (it) { + return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 + }; + + var max = Math.max; + var min$1 = Math.min; + var _toAbsoluteIndex = function (index, length) { + index = _toInteger(index); + return index < 0 ? max(index + length, 0) : min$1(index, length); + }; + + // false -> Array#indexOf + // true -> Array#includes + + + + var _arrayIncludes = function (IS_INCLUDES) { + return function ($this, el, fromIndex) { + var O = _toIobject($this); + var length = _toLength(O.length); + var index = _toAbsoluteIndex(fromIndex, length); + var value; + // Array#includes uses SameValueZero equality algorithm + // eslint-disable-next-line no-self-compare + if (IS_INCLUDES && el != el) while (length > index) { + value = O[index++]; + // eslint-disable-next-line no-self-compare + if (value != value) return true; + // Array#indexOf ignores holes, Array#includes - not + } else for (;length > index; index++) if (IS_INCLUDES || index in O) { + if (O[index] === el) return IS_INCLUDES || index || 0; + } return !IS_INCLUDES && -1; + }; + }; + + var shared = _shared('keys'); + + var _sharedKey = function (key) { + return shared[key] || (shared[key] = _uid(key)); + }; + + var arrayIndexOf = _arrayIncludes(false); + var IE_PROTO = _sharedKey('IE_PROTO'); + + var _objectKeysInternal = function (object, names) { + var O = _toIobject(object); + var i = 0; + var result = []; + var key; + for (key in O) if (key != IE_PROTO) _has(O, key) && result.push(key); + // Don't enum bug & hidden keys + while (names.length > i) if (_has(O, key = names[i++])) { + ~arrayIndexOf(result, key) || result.push(key); + } + return result; + }; + + // IE 8- don't enum bug keys + var _enumBugKeys = ( + 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' + ).split(','); + + // 19.1.2.14 / 15.2.3.14 Object.keys(O) + + + + var _objectKeys = Object.keys || function keys(O) { + return _objectKeysInternal(O, _enumBugKeys); + }; + + var _objectDps = _descriptors ? Object.defineProperties : function defineProperties(O, Properties) { + _anObject(O); + var keys = _objectKeys(Properties); + var length = keys.length; + var i = 0; + var P; + while (length > i) _objectDp.f(O, P = keys[i++], Properties[P]); + return O; + }; + + var document$2 = _global.document; + var _html = document$2 && document$2.documentElement; + + // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) + + + + var IE_PROTO$1 = _sharedKey('IE_PROTO'); + var Empty = function () { /* empty */ }; + var PROTOTYPE$1 = 'prototype'; + + // Create object with fake `null` prototype: use iframe Object with cleared prototype + var createDict = function () { + // Thrash, waste and sodomy: IE GC bug + var iframe = _domCreate('iframe'); + var i = _enumBugKeys.length; + var lt = '<'; + var gt = '>'; + var iframeDocument; + iframe.style.display = 'none'; + _html.appendChild(iframe); + iframe.src = 'javascript:'; // eslint-disable-line no-script-url + // createDict = iframe.contentWindow.Object; + // html.removeChild(iframe); + iframeDocument = iframe.contentWindow.document; + iframeDocument.open(); + iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); + iframeDocument.close(); + createDict = iframeDocument.F; + while (i--) delete createDict[PROTOTYPE$1][_enumBugKeys[i]]; + return createDict(); + }; + + var _objectCreate = Object.create || function create(O, Properties) { + var result; + if (O !== null) { + Empty[PROTOTYPE$1] = _anObject(O); + result = new Empty(); + Empty[PROTOTYPE$1] = null; + // add "__proto__" for Object.getPrototypeOf polyfill + result[IE_PROTO$1] = O; + } else result = createDict(); + return Properties === undefined ? result : _objectDps(result, Properties); + }; + + var def = _objectDp.f; + + var TAG = _wks('toStringTag'); + + var _setToStringTag = function (it, tag, stat) { + if (it && !_has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); + }; + + var IteratorPrototype = {}; + + // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() + _hide(IteratorPrototype, _wks('iterator'), function () { return this; }); + + var _iterCreate = function (Constructor, NAME, next) { + Constructor.prototype = _objectCreate(IteratorPrototype, { next: _propertyDesc(1, next) }); + _setToStringTag(Constructor, NAME + ' Iterator'); + }; + + // 7.1.13 ToObject(argument) + + var _toObject = function (it) { + return Object(_defined(it)); + }; + + // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) + + + var IE_PROTO$2 = _sharedKey('IE_PROTO'); + var ObjectProto = Object.prototype; + + var _objectGpo = Object.getPrototypeOf || function (O) { + O = _toObject(O); + if (_has(O, IE_PROTO$2)) return O[IE_PROTO$2]; + if (typeof O.constructor == 'function' && O instanceof O.constructor) { + return O.constructor.prototype; + } return O instanceof Object ? ObjectProto : null; + }; + + var ITERATOR = _wks('iterator'); + var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` + var FF_ITERATOR = '@@iterator'; + var KEYS = 'keys'; + var VALUES = 'values'; + + var returnThis = function () { return this; }; + + var _iterDefine = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { + _iterCreate(Constructor, NAME, next); + var getMethod = function (kind) { + if (!BUGGY && kind in proto) return proto[kind]; + switch (kind) { + case KEYS: return function keys() { return new Constructor(this, kind); }; + case VALUES: return function values() { return new Constructor(this, kind); }; + } return function entries() { return new Constructor(this, kind); }; + }; + var TAG = NAME + ' Iterator'; + var DEF_VALUES = DEFAULT == VALUES; + var VALUES_BUG = false; + var proto = Base.prototype; + var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; + var $default = $native || getMethod(DEFAULT); + var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; + var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; + var methods, key, IteratorPrototype; + // Fix native + if ($anyNative) { + IteratorPrototype = _objectGpo($anyNative.call(new Base())); + if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { + // Set @@toStringTag to native iterators + _setToStringTag(IteratorPrototype, TAG, true); + // fix for some old engines + if (typeof IteratorPrototype[ITERATOR] != 'function') _hide(IteratorPrototype, ITERATOR, returnThis); + } + } + // fix Array#{values, @@iterator}.name in V8 / FF + if (DEF_VALUES && $native && $native.name !== VALUES) { + VALUES_BUG = true; + $default = function values() { return $native.call(this); }; + } + // Define iterator + if (BUGGY || VALUES_BUG || !proto[ITERATOR]) { + _hide(proto, ITERATOR, $default); + } + // Plug for library + _iterators[NAME] = $default; + _iterators[TAG] = returnThis; + if (DEFAULT) { + methods = { + values: DEF_VALUES ? $default : getMethod(VALUES), + keys: IS_SET ? $default : getMethod(KEYS), + entries: $entries + }; + if (FORCED) for (key in methods) { + if (!(key in proto)) _redefine(proto, key, methods[key]); + } else _export(_export.P + _export.F * (BUGGY || VALUES_BUG), NAME, methods); + } + return methods; + }; + + // 22.1.3.4 Array.prototype.entries() + // 22.1.3.13 Array.prototype.keys() + // 22.1.3.29 Array.prototype.values() + // 22.1.3.30 Array.prototype[@@iterator]() + var es6_array_iterator = _iterDefine(Array, 'Array', function (iterated, kind) { + this._t = _toIobject(iterated); // target + this._i = 0; // next index + this._k = kind; // kind + // 22.1.5.2.1 %ArrayIteratorPrototype%.next() + }, function () { + var O = this._t; + var kind = this._k; + var index = this._i++; + if (!O || index >= O.length) { + this._t = undefined; + return _iterStep(1); + } + if (kind == 'keys') return _iterStep(0, index); + if (kind == 'values') return _iterStep(0, O[index]); + return _iterStep(0, [index, O[index]]); + }, 'values'); + + // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) + _iterators.Arguments = _iterators.Array; + + _addToUnscopables('keys'); + _addToUnscopables('values'); + _addToUnscopables('entries'); + + var ITERATOR$1 = _wks('iterator'); + var TO_STRING_TAG = _wks('toStringTag'); + var ArrayValues = _iterators.Array; + + var DOMIterables = { + CSSRuleList: true, // TODO: Not spec compliant, should be false. + CSSStyleDeclaration: false, + CSSValueList: false, + ClientRectList: false, + DOMRectList: false, + DOMStringList: false, + DOMTokenList: true, + DataTransferItemList: false, + FileList: false, + HTMLAllCollection: false, + HTMLCollection: false, + HTMLFormElement: false, + HTMLSelectElement: false, + MediaList: true, // TODO: Not spec compliant, should be false. + MimeTypeArray: false, + NamedNodeMap: false, + NodeList: true, + PaintRequestList: false, + Plugin: false, + PluginArray: false, + SVGLengthList: false, + SVGNumberList: false, + SVGPathSegList: false, + SVGPointList: false, + SVGStringList: false, + SVGTransformList: false, + SourceBufferList: false, + StyleSheetList: true, // TODO: Not spec compliant, should be false. + TextTrackCueList: false, + TextTrackList: false, + TouchList: false + }; + + for (var collections = _objectKeys(DOMIterables), i = 0; i < collections.length; i++) { + var NAME = collections[i]; + var explicit = DOMIterables[NAME]; + var Collection = _global[NAME]; + var proto = Collection && Collection.prototype; + var key; + if (proto) { + if (!proto[ITERATOR$1]) _hide(proto, ITERATOR$1, ArrayValues); + if (!proto[TO_STRING_TAG]) _hide(proto, TO_STRING_TAG, NAME); + _iterators[NAME] = ArrayValues; + if (explicit) for (key in es6_array_iterator) if (!proto[key]) _redefine(proto, key, es6_array_iterator[key], true); + } + } + + // getting tag from 19.1.3.6 Object.prototype.toString() + + var TAG$1 = _wks('toStringTag'); + // ES3 wrong here + var ARG = _cof(function () { return arguments; }()) == 'Arguments'; + + // fallback for IE11 Script Access Denied error + var tryGet = function (it, key) { + try { + return it[key]; + } catch (e) { /* empty */ } + }; + + var _classof = function (it) { + var O, T, B; + return it === undefined ? 'Undefined' : it === null ? 'Null' + // @@toStringTag case + : typeof (T = tryGet(O = Object(it), TAG$1)) == 'string' ? T + // builtinTag case + : ARG ? _cof(O) + // ES3 arguments fallback + : (B = _cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; + }; + + var _anInstance = function (it, Constructor, name, forbiddenField) { + if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) { + throw TypeError(name + ': incorrect invocation!'); + } return it; + }; + + // call something on iterator step with safe closing on error + + var _iterCall = function (iterator, fn, value, entries) { + try { + return entries ? fn(_anObject(value)[0], value[1]) : fn(value); + // 7.4.6 IteratorClose(iterator, completion) + } catch (e) { + var ret = iterator['return']; + if (ret !== undefined) _anObject(ret.call(iterator)); + throw e; + } + }; + + // check on default Array iterator + + var ITERATOR$2 = _wks('iterator'); + var ArrayProto$1 = Array.prototype; + + var _isArrayIter = function (it) { + return it !== undefined && (_iterators.Array === it || ArrayProto$1[ITERATOR$2] === it); + }; + + var ITERATOR$3 = _wks('iterator'); + + var core_getIteratorMethod = _core.getIteratorMethod = function (it) { + if (it != undefined) return it[ITERATOR$3] + || it['@@iterator'] + || _iterators[_classof(it)]; + }; + + var _forOf = createCommonjsModule(function (module) { + var BREAK = {}; + var RETURN = {}; + var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) { + var iterFn = ITERATOR ? function () { return iterable; } : core_getIteratorMethod(iterable); + var f = _ctx(fn, that, entries ? 2 : 1); + var index = 0; + var length, step, iterator, result; + if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!'); + // fast case for arrays with default iterator + if (_isArrayIter(iterFn)) for (length = _toLength(iterable.length); length > index; index++) { + result = entries ? f(_anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); + if (result === BREAK || result === RETURN) return result; + } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) { + result = _iterCall(iterator, f, step.value, entries); + if (result === BREAK || result === RETURN) return result; + } + }; + exports.BREAK = BREAK; + exports.RETURN = RETURN; + }); + + // 7.3.20 SpeciesConstructor(O, defaultConstructor) + + + var SPECIES = _wks('species'); + var _speciesConstructor = function (O, D) { + var C = _anObject(O).constructor; + var S; + return C === undefined || (S = _anObject(C)[SPECIES]) == undefined ? D : _aFunction(S); + }; + + // fast apply, http://jsperf.lnkit.com/fast-apply/5 + var _invoke = function (fn, args, that) { + var un = that === undefined; + switch (args.length) { + case 0: return un ? fn() + : fn.call(that); + case 1: return un ? fn(args[0]) + : fn.call(that, args[0]); + case 2: return un ? fn(args[0], args[1]) + : fn.call(that, args[0], args[1]); + case 3: return un ? fn(args[0], args[1], args[2]) + : fn.call(that, args[0], args[1], args[2]); + case 4: return un ? fn(args[0], args[1], args[2], args[3]) + : fn.call(that, args[0], args[1], args[2], args[3]); + } return fn.apply(that, args); + }; + + var process = _global.process; + var setTask = _global.setImmediate; + var clearTask = _global.clearImmediate; + var MessageChannel = _global.MessageChannel; + var Dispatch = _global.Dispatch; + var counter = 0; + var queue = {}; + var ONREADYSTATECHANGE = 'onreadystatechange'; + var defer, channel, port; + var run = function () { + var id = +this; + // eslint-disable-next-line no-prototype-builtins + if (queue.hasOwnProperty(id)) { + var fn = queue[id]; + delete queue[id]; + fn(); + } + }; + var listener = function (event) { + run.call(event.data); + }; + // Node.js 0.9+ & IE10+ has setImmediate, otherwise: + if (!setTask || !clearTask) { + setTask = function setImmediate(fn) { + var args = []; + var i = 1; + while (arguments.length > i) args.push(arguments[i++]); + queue[++counter] = function () { + // eslint-disable-next-line no-new-func + _invoke(typeof fn == 'function' ? fn : Function(fn), args); + }; + defer(counter); + return counter; + }; + clearTask = function clearImmediate(id) { + delete queue[id]; + }; + // Node.js 0.8- + if (_cof(process) == 'process') { + defer = function (id) { + process.nextTick(_ctx(run, id, 1)); + }; + // Sphere (JS game engine) Dispatch API + } else if (Dispatch && Dispatch.now) { + defer = function (id) { + Dispatch.now(_ctx(run, id, 1)); + }; + // Browsers with MessageChannel, includes WebWorkers + } else if (MessageChannel) { + channel = new MessageChannel(); + port = channel.port2; + channel.port1.onmessage = listener; + defer = _ctx(port.postMessage, port, 1); + // Browsers with postMessage, skip WebWorkers + // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' + } else if (_global.addEventListener && typeof postMessage == 'function' && !_global.importScripts) { + defer = function (id) { + _global.postMessage(id + '', '*'); + }; + _global.addEventListener('message', listener, false); + // IE8- + } else if (ONREADYSTATECHANGE in _domCreate('script')) { + defer = function (id) { + _html.appendChild(_domCreate('script'))[ONREADYSTATECHANGE] = function () { + _html.removeChild(this); + run.call(id); + }; + }; + // Rest old browsers + } else { + defer = function (id) { + setTimeout(_ctx(run, id, 1), 0); + }; + } + } + var _task = { + set: setTask, + clear: clearTask + }; + + var macrotask = _task.set; + var Observer = _global.MutationObserver || _global.WebKitMutationObserver; + var process$1 = _global.process; + var Promise$1 = _global.Promise; + var isNode = _cof(process$1) == 'process'; + + var _microtask = function () { + var head, last, notify; + + var flush = function () { + var parent, fn; + if (isNode && (parent = process$1.domain)) parent.exit(); + while (head) { + fn = head.fn; + head = head.next; + try { + fn(); + } catch (e) { + if (head) notify(); + else last = undefined; + throw e; + } + } last = undefined; + if (parent) parent.enter(); + }; + + // Node.js + if (isNode) { + notify = function () { + process$1.nextTick(flush); + }; + // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339 + } else if (Observer && !(_global.navigator && _global.navigator.standalone)) { + var toggle = true; + var node = document.createTextNode(''); + new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new + notify = function () { + node.data = toggle = !toggle; + }; + // environments with maybe non-completely correct, but existent Promise + } else if (Promise$1 && Promise$1.resolve) { + // Promise.resolve without an argument throws an error in LG WebOS 2 + var promise = Promise$1.resolve(undefined); + notify = function () { + promise.then(flush); + }; + // for other environments - macrotask based on: + // - setImmediate + // - MessageChannel + // - window.postMessag + // - onreadystatechange + // - setTimeout + } else { + notify = function () { + // strange IE + webpack dev server bug - use .call(global) + macrotask.call(_global, flush); + }; + } + + return function (fn) { + var task = { fn: fn, next: undefined }; + if (last) last.next = task; + if (!head) { + head = task; + notify(); + } last = task; + }; + }; + + // 25.4.1.5 NewPromiseCapability(C) + + + function PromiseCapability(C) { + var resolve, reject; + this.promise = new C(function ($$resolve, $$reject) { + if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor'); + resolve = $$resolve; + reject = $$reject; + }); + this.resolve = _aFunction(resolve); + this.reject = _aFunction(reject); + } + + var f$1 = function (C) { + return new PromiseCapability(C); + }; + + var _newPromiseCapability = { + f: f$1 + }; + + var _perform = function (exec) { + try { + return { e: false, v: exec() }; + } catch (e) { + return { e: true, v: e }; + } + }; + + var navigator = _global.navigator; + + var _userAgent = navigator && navigator.userAgent || ''; + + var _promiseResolve = function (C, x) { + _anObject(C); + if (_isObject(x) && x.constructor === C) return x; + var promiseCapability = _newPromiseCapability.f(C); + var resolve = promiseCapability.resolve; + resolve(x); + return promiseCapability.promise; + }; + + var _redefineAll = function (target, src, safe) { + for (var key in src) _redefine(target, key, src[key], safe); + return target; + }; + + var SPECIES$1 = _wks('species'); + + var _setSpecies = function (KEY) { + var C = _global[KEY]; + if (_descriptors && C && !C[SPECIES$1]) _objectDp.f(C, SPECIES$1, { + configurable: true, + get: function () { return this; } + }); + }; + + var ITERATOR$4 = _wks('iterator'); + var SAFE_CLOSING = false; + + try { + var riter = [7][ITERATOR$4](); + riter['return'] = function () { SAFE_CLOSING = true; }; + } catch (e) { /* empty */ } + + var _iterDetect = function (exec, skipClosing) { + if (!skipClosing && !SAFE_CLOSING) return false; + var safe = false; + try { + var arr = [7]; + var iter = arr[ITERATOR$4](); + iter.next = function () { return { done: safe = true }; }; + arr[ITERATOR$4] = function () { return iter; }; + exec(arr); + } catch (e) { /* empty */ } + return safe; + }; + + var task = _task.set; + var microtask = _microtask(); + + + + + var PROMISE = 'Promise'; + var TypeError$1 = _global.TypeError; + var process$2 = _global.process; + var versions = process$2 && process$2.versions; + var v8 = versions && versions.v8 || ''; + var $Promise = _global[PROMISE]; + var isNode$1 = _classof(process$2) == 'process'; + var empty = function () { /* empty */ }; + var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper; + var newPromiseCapability = newGenericPromiseCapability = _newPromiseCapability.f; + + var USE_NATIVE = !!function () { + try { + // correct subclassing with @@species support + var promise = $Promise.resolve(1); + var FakePromise = (promise.constructor = {})[_wks('species')] = function (exec) { + exec(empty, empty); + }; + // unhandled rejections tracking support, NodeJS Promise without it fails @@species test + return (isNode$1 || typeof PromiseRejectionEvent == 'function') + && promise.then(empty) instanceof FakePromise + // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables + // https://bugs.chromium.org/p/chromium/issues/detail?id=830565 + // we can't detect it synchronously, so just check versions + && v8.indexOf('6.6') !== 0 + && _userAgent.indexOf('Chrome/66') === -1; + } catch (e) { /* empty */ } + }(); + + // helpers + var isThenable = function (it) { + var then; + return _isObject(it) && typeof (then = it.then) == 'function' ? then : false; + }; + var notify = function (promise, isReject) { + if (promise._n) return; + promise._n = true; + var chain = promise._c; + microtask(function () { + var value = promise._v; + var ok = promise._s == 1; + var i = 0; + var run = function (reaction) { + var handler = ok ? reaction.ok : reaction.fail; + var resolve = reaction.resolve; + var reject = reaction.reject; + var domain = reaction.domain; + var result, then, exited; + try { + if (handler) { + if (!ok) { + if (promise._h == 2) onHandleUnhandled(promise); + promise._h = 1; + } + if (handler === true) result = value; + else { + if (domain) domain.enter(); + result = handler(value); // may throw + if (domain) { + domain.exit(); + exited = true; + } + } + if (result === reaction.promise) { + reject(TypeError$1('Promise-chain cycle')); + } else if (then = isThenable(result)) { + then.call(result, resolve, reject); + } else resolve(result); + } else reject(value); + } catch (e) { + if (domain && !exited) domain.exit(); + reject(e); + } + }; + while (chain.length > i) run(chain[i++]); // variable length - can't use forEach + promise._c = []; + promise._n = false; + if (isReject && !promise._h) onUnhandled(promise); + }); + }; + var onUnhandled = function (promise) { + task.call(_global, function () { + var value = promise._v; + var unhandled = isUnhandled(promise); + var result, handler, console; + if (unhandled) { + result = _perform(function () { + if (isNode$1) { + process$2.emit('unhandledRejection', value, promise); + } else if (handler = _global.onunhandledrejection) { + handler({ promise: promise, reason: value }); + } else if ((console = _global.console) && console.error) { + console.error('Unhandled promise rejection', value); + } + }); + // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should + promise._h = isNode$1 || isUnhandled(promise) ? 2 : 1; + } promise._a = undefined; + if (unhandled && result.e) throw result.v; + }); + }; + var isUnhandled = function (promise) { + return promise._h !== 1 && (promise._a || promise._c).length === 0; + }; + var onHandleUnhandled = function (promise) { + task.call(_global, function () { + var handler; + if (isNode$1) { + process$2.emit('rejectionHandled', promise); + } else if (handler = _global.onrejectionhandled) { + handler({ promise: promise, reason: promise._v }); + } + }); + }; + var $reject = function (value) { + var promise = this; + if (promise._d) return; + promise._d = true; + promise = promise._w || promise; // unwrap + promise._v = value; + promise._s = 2; + if (!promise._a) promise._a = promise._c.slice(); + notify(promise, true); + }; + var $resolve = function (value) { + var promise = this; + var then; + if (promise._d) return; + promise._d = true; + promise = promise._w || promise; // unwrap + try { + if (promise === value) throw TypeError$1("Promise can't be resolved itself"); + if (then = isThenable(value)) { + microtask(function () { + var wrapper = { _w: promise, _d: false }; // wrap + try { + then.call(value, _ctx($resolve, wrapper, 1), _ctx($reject, wrapper, 1)); + } catch (e) { + $reject.call(wrapper, e); + } + }); + } else { + promise._v = value; + promise._s = 1; + notify(promise, false); + } + } catch (e) { + $reject.call({ _w: promise, _d: false }, e); // wrap + } + }; + + // constructor polyfill + if (!USE_NATIVE) { + // 25.4.3.1 Promise(executor) + $Promise = function Promise(executor) { + _anInstance(this, $Promise, PROMISE, '_h'); + _aFunction(executor); + Internal.call(this); + try { + executor(_ctx($resolve, this, 1), _ctx($reject, this, 1)); + } catch (err) { + $reject.call(this, err); + } + }; + // eslint-disable-next-line no-unused-vars + Internal = function Promise(executor) { + this._c = []; // <- awaiting reactions + this._a = undefined; // <- checked in isUnhandled reactions + this._s = 0; // <- state + this._d = false; // <- done + this._v = undefined; // <- value + this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled + this._n = false; // <- notify + }; + Internal.prototype = _redefineAll($Promise.prototype, { + // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) + then: function then(onFulfilled, onRejected) { + var reaction = newPromiseCapability(_speciesConstructor(this, $Promise)); + reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; + reaction.fail = typeof onRejected == 'function' && onRejected; + reaction.domain = isNode$1 ? process$2.domain : undefined; + this._c.push(reaction); + if (this._a) this._a.push(reaction); + if (this._s) notify(this, false); + return reaction.promise; + }, + // 25.4.5.1 Promise.prototype.catch(onRejected) + 'catch': function (onRejected) { + return this.then(undefined, onRejected); + } + }); + OwnPromiseCapability = function () { + var promise = new Internal(); + this.promise = promise; + this.resolve = _ctx($resolve, promise, 1); + this.reject = _ctx($reject, promise, 1); + }; + _newPromiseCapability.f = newPromiseCapability = function (C) { + return C === $Promise || C === Wrapper + ? new OwnPromiseCapability(C) + : newGenericPromiseCapability(C); + }; + } + + _export(_export.G + _export.W + _export.F * !USE_NATIVE, { Promise: $Promise }); + _setToStringTag($Promise, PROMISE); + _setSpecies(PROMISE); + Wrapper = _core[PROMISE]; + + // statics + _export(_export.S + _export.F * !USE_NATIVE, PROMISE, { + // 25.4.4.5 Promise.reject(r) + reject: function reject(r) { + var capability = newPromiseCapability(this); + var $$reject = capability.reject; + $$reject(r); + return capability.promise; + } + }); + _export(_export.S + _export.F * (_library || !USE_NATIVE), PROMISE, { + // 25.4.4.6 Promise.resolve(x) + resolve: function resolve(x) { + return _promiseResolve(_library && this === Wrapper ? $Promise : this, x); + } + }); + _export(_export.S + _export.F * !(USE_NATIVE && _iterDetect(function (iter) { + $Promise.all(iter)['catch'](empty); + })), PROMISE, { + // 25.4.4.1 Promise.all(iterable) + all: function all(iterable) { + var C = this; + var capability = newPromiseCapability(C); + var resolve = capability.resolve; + var reject = capability.reject; + var result = _perform(function () { + var values = []; + var index = 0; + var remaining = 1; + _forOf(iterable, false, function (promise) { + var $index = index++; + var alreadyCalled = false; + values.push(undefined); + remaining++; + C.resolve(promise).then(function (value) { + if (alreadyCalled) return; + alreadyCalled = true; + values[$index] = value; + --remaining || resolve(values); + }, reject); + }); + --remaining || resolve(values); + }); + if (result.e) reject(result.v); + return capability.promise; + }, + // 25.4.4.4 Promise.race(iterable) + race: function race(iterable) { + var C = this; + var capability = newPromiseCapability(C); + var reject = capability.reject; + var result = _perform(function () { + _forOf(iterable, false, function (promise) { + C.resolve(promise).then(capability.resolve, reject); + }); + }); + if (result.e) reject(result.v); + return capability.promise; + } + }); + + var f$2 = {}.propertyIsEnumerable; + + var _objectPie = { + f: f$2 + }; + + var gOPD = Object.getOwnPropertyDescriptor; + + var f$3 = _descriptors ? gOPD : function getOwnPropertyDescriptor(O, P) { + O = _toIobject(O); + P = _toPrimitive(P, true); + if (_ie8DomDefine) try { + return gOPD(O, P); + } catch (e) { /* empty */ } + if (_has(O, P)) return _propertyDesc(!_objectPie.f.call(O, P), O[P]); + }; + + var _objectGopd = { + f: f$3 + }; + + // Works with __proto__ only. Old v8 can't work with null proto objects. + /* eslint-disable no-proto */ + + + var check = function (O, proto) { + _anObject(O); + if (!_isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!"); + }; + var _setProto = { + set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line + function (test, buggy, set) { + try { + set = _ctx(Function.call, _objectGopd.f(Object.prototype, '__proto__').set, 2); + set(test, []); + buggy = !(test instanceof Array); + } catch (e) { buggy = true; } + return function setPrototypeOf(O, proto) { + check(O, proto); + if (buggy) O.__proto__ = proto; + else set(O, proto); + return O; + }; + }({}, false) : undefined), + check: check + }; + + // 19.1.3.19 Object.setPrototypeOf(O, proto) + + _export(_export.S, 'Object', { setPrototypeOf: _setProto.set }); + + var dP$1 = _objectDp.f; + var FProto = Function.prototype; + var nameRE = /^\s*function ([^ (]*)/; + var NAME$1 = 'name'; + + // 19.2.4.2 name + NAME$1 in FProto || _descriptors && dP$1(FProto, NAME$1, { + configurable: true, + get: function () { + try { + return ('' + this).match(nameRE)[1]; + } catch (e) { + return ''; + } + } + }); + + // 7.2.2 IsArray(argument) + + var _isArray = Array.isArray || function isArray(arg) { + return _cof(arg) == 'Array'; + }; + + var SPECIES$2 = _wks('species'); + + var _arraySpeciesConstructor = function (original) { + var C; + if (_isArray(original)) { + C = original.constructor; + // cross-realm fallback + if (typeof C == 'function' && (C === Array || _isArray(C.prototype))) C = undefined; + if (_isObject(C)) { + C = C[SPECIES$2]; + if (C === null) C = undefined; + } + } return C === undefined ? Array : C; + }; + + // 9.4.2.3 ArraySpeciesCreate(originalArray, length) + + + var _arraySpeciesCreate = function (original, length) { + return new (_arraySpeciesConstructor(original))(length); + }; + + // 0 -> Array#forEach + // 1 -> Array#map + // 2 -> Array#filter + // 3 -> Array#some + // 4 -> Array#every + // 5 -> Array#find + // 6 -> Array#findIndex + + + + + + var _arrayMethods = function (TYPE, $create) { + var IS_MAP = TYPE == 1; + var IS_FILTER = TYPE == 2; + var IS_SOME = TYPE == 3; + var IS_EVERY = TYPE == 4; + var IS_FIND_INDEX = TYPE == 6; + var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; + var create = $create || _arraySpeciesCreate; + return function ($this, callbackfn, that) { + var O = _toObject($this); + var self = _iobject(O); + var f = _ctx(callbackfn, that, 3); + var length = _toLength(self.length); + var index = 0; + var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; + var val, res; + for (;length > index; index++) if (NO_HOLES || index in self) { + val = self[index]; + res = f(val, index, O); + if (TYPE) { + if (IS_MAP) result[index] = res; // map + else if (res) switch (TYPE) { + case 3: return true; // some + case 5: return val; // find + case 6: return index; // findIndex + case 2: result.push(val); // filter + } else if (IS_EVERY) return false; // every + } + } + return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; + }; + }; + + var _strictMethod = function (method, arg) { + return !!method && _fails(function () { + // eslint-disable-next-line no-useless-call + arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null); + }); + }; + + var $forEach = _arrayMethods(0); + var STRICT = _strictMethod([].forEach, true); + + _export(_export.P + _export.F * !STRICT, 'Array', { + // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg]) + forEach: function forEach(callbackfn /* , thisArg */) { + return $forEach(this, callbackfn, arguments[1]); + } + }); + + // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) + _export(_export.S, 'Object', { create: _objectCreate }); + + var f$4 = _wks; + + var _wksExt = { + f: f$4 + }; + + var defineProperty = _objectDp.f; + var _wksDefine = function (name) { + var $Symbol = _core.Symbol || (_core.Symbol = _global.Symbol || {}); + if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: _wksExt.f(name) }); + }; + + _wksDefine('asyncIterator'); + + var _meta = createCommonjsModule(function (module) { + var META = _uid('meta'); + + + var setDesc = _objectDp.f; + var id = 0; + var isExtensible = Object.isExtensible || function () { + return true; + }; + var FREEZE = !_fails(function () { + return isExtensible(Object.preventExtensions({})); + }); + var setMeta = function (it) { + setDesc(it, META, { value: { + i: 'O' + ++id, // object ID + w: {} // weak collections IDs + } }); + }; + var fastKey = function (it, create) { + // return primitive with prefix + if (!_isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; + if (!_has(it, META)) { + // can't set metadata to uncaught frozen object + if (!isExtensible(it)) return 'F'; + // not necessary to add metadata + if (!create) return 'E'; + // add missing metadata + setMeta(it); + // return object ID + } return it[META].i; + }; + var getWeak = function (it, create) { + if (!_has(it, META)) { + // can't set metadata to uncaught frozen object + if (!isExtensible(it)) return true; + // not necessary to add metadata + if (!create) return false; + // add missing metadata + setMeta(it); + // return hash weak collections IDs + } return it[META].w; + }; + // add metadata on freeze-family methods calling + var onFreeze = function (it) { + if (FREEZE && meta.NEED && isExtensible(it) && !_has(it, META)) setMeta(it); + return it; + }; + var meta = module.exports = { + KEY: META, + NEED: false, + fastKey: fastKey, + getWeak: getWeak, + onFreeze: onFreeze + }; + }); + var _meta_1 = _meta.KEY; + var _meta_2 = _meta.NEED; + var _meta_3 = _meta.fastKey; + var _meta_4 = _meta.getWeak; + var _meta_5 = _meta.onFreeze; - var f$5 = Object.getOwnPropertySymbols; + var f$5 = Object.getOwnPropertySymbols; - var _objectGops = { - f: f$5 - }; + var _objectGops = { + f: f$5 + }; - // all enumerable object keys, includes symbols + // all enumerable object keys, includes symbols - var _enumKeys = function (it) { - var result = _objectKeys(it); - var getSymbols = _objectGops.f; - if (getSymbols) { - var symbols = getSymbols(it); - var isEnum = _objectPie.f; - var i = 0; - var key; - while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key); - } return result; - }; + var _enumKeys = function (it) { + var result = _objectKeys(it); + var getSymbols = _objectGops.f; + if (getSymbols) { + var symbols = getSymbols(it); + var isEnum = _objectPie.f; + var i = 0; + var key; + while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key); + } return result; + }; - // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) + // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) - var hiddenKeys = _enumBugKeys.concat('length', 'prototype'); + var hiddenKeys = _enumBugKeys.concat('length', 'prototype'); - var f$6 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { - return _objectKeysInternal(O, hiddenKeys); - }; + var f$6 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { + return _objectKeysInternal(O, hiddenKeys); + }; - var _objectGopn = { - f: f$6 - }; - - // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window - - var gOPN = _objectGopn.f; - var toString$1 = {}.toString; - - var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames - ? Object.getOwnPropertyNames(window) : []; - - var getWindowNames = function (it) { - try { - return gOPN(it); - } catch (e) { - return windowNames.slice(); - } - }; - - var f$7 = function getOwnPropertyNames(it) { - return windowNames && toString$1.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(_toIobject(it)); - }; - - var _objectGopnExt = { - f: f$7 - }; - - // ECMAScript 6 symbols shim - - - - - - var META = _meta.KEY; - - - - - - - - - - - - - - - - - - - - var gOPD$1 = _objectGopd.f; - var dP$2 = _objectDp.f; - var gOPN$1 = _objectGopnExt.f; - var $Symbol = _global.Symbol; - var $JSON = _global.JSON; - var _stringify = $JSON && $JSON.stringify; - var PROTOTYPE$2 = 'prototype'; - var HIDDEN = _wks('_hidden'); - var TO_PRIMITIVE = _wks('toPrimitive'); - var isEnum = {}.propertyIsEnumerable; - var SymbolRegistry = _shared('symbol-registry'); - var AllSymbols = _shared('symbols'); - var OPSymbols = _shared('op-symbols'); - var ObjectProto$1 = Object[PROTOTYPE$2]; - var USE_NATIVE$1 = typeof $Symbol == 'function'; - var QObject = _global.QObject; - // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 - var setter = !QObject || !QObject[PROTOTYPE$2] || !QObject[PROTOTYPE$2].findChild; - - // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 - var setSymbolDesc = _descriptors && _fails(function () { - return _objectCreate(dP$2({}, 'a', { - get: function () { return dP$2(this, 'a', { value: 7 }).a; } - })).a != 7; - }) ? function (it, key, D) { - var protoDesc = gOPD$1(ObjectProto$1, key); - if (protoDesc) delete ObjectProto$1[key]; - dP$2(it, key, D); - if (protoDesc && it !== ObjectProto$1) dP$2(ObjectProto$1, key, protoDesc); - } : dP$2; - - var wrap = function (tag) { - var sym = AllSymbols[tag] = _objectCreate($Symbol[PROTOTYPE$2]); - sym._k = tag; - return sym; - }; - - var isSymbol = USE_NATIVE$1 && typeof $Symbol.iterator == 'symbol' ? function (it) { - return typeof it == 'symbol'; - } : function (it) { - return it instanceof $Symbol; - }; - - var $defineProperty = function defineProperty(it, key, D) { - if (it === ObjectProto$1) $defineProperty(OPSymbols, key, D); - _anObject(it); - key = _toPrimitive(key, true); - _anObject(D); - if (_has(AllSymbols, key)) { - if (!D.enumerable) { - if (!_has(it, HIDDEN)) dP$2(it, HIDDEN, _propertyDesc(1, {})); - it[HIDDEN][key] = true; - } else { - if (_has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false; - D = _objectCreate(D, { enumerable: _propertyDesc(0, false) }); - } return setSymbolDesc(it, key, D); - } return dP$2(it, key, D); - }; - var $defineProperties = function defineProperties(it, P) { - _anObject(it); - var keys = _enumKeys(P = _toIobject(P)); - var i = 0; - var l = keys.length; - var key; - while (l > i) $defineProperty(it, key = keys[i++], P[key]); - return it; - }; - var $create = function create(it, P) { - return P === undefined ? _objectCreate(it) : $defineProperties(_objectCreate(it), P); - }; - var $propertyIsEnumerable = function propertyIsEnumerable(key) { - var E = isEnum.call(this, key = _toPrimitive(key, true)); - if (this === ObjectProto$1 && _has(AllSymbols, key) && !_has(OPSymbols, key)) return false; - return E || !_has(this, key) || !_has(AllSymbols, key) || _has(this, HIDDEN) && this[HIDDEN][key] ? E : true; - }; - var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) { - it = _toIobject(it); - key = _toPrimitive(key, true); - if (it === ObjectProto$1 && _has(AllSymbols, key) && !_has(OPSymbols, key)) return; - var D = gOPD$1(it, key); - if (D && _has(AllSymbols, key) && !(_has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true; - return D; - }; - var $getOwnPropertyNames = function getOwnPropertyNames(it) { - var names = gOPN$1(_toIobject(it)); - var result = []; - var i = 0; - var key; - while (names.length > i) { - if (!_has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key); - } return result; - }; - var $getOwnPropertySymbols = function getOwnPropertySymbols(it) { - var IS_OP = it === ObjectProto$1; - var names = gOPN$1(IS_OP ? OPSymbols : _toIobject(it)); - var result = []; - var i = 0; - var key; - while (names.length > i) { - if (_has(AllSymbols, key = names[i++]) && (IS_OP ? _has(ObjectProto$1, key) : true)) result.push(AllSymbols[key]); - } return result; - }; - - // 19.4.1.1 Symbol([description]) - if (!USE_NATIVE$1) { - $Symbol = function Symbol() { - if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!'); - var tag = _uid(arguments.length > 0 ? arguments[0] : undefined); - var $set = function (value) { - if (this === ObjectProto$1) $set.call(OPSymbols, value); - if (_has(this, HIDDEN) && _has(this[HIDDEN], tag)) this[HIDDEN][tag] = false; - setSymbolDesc(this, tag, _propertyDesc(1, value)); - }; - if (_descriptors && setter) setSymbolDesc(ObjectProto$1, tag, { configurable: true, set: $set }); - return wrap(tag); - }; - _redefine($Symbol[PROTOTYPE$2], 'toString', function toString() { - return this._k; - }); - - _objectGopd.f = $getOwnPropertyDescriptor; - _objectDp.f = $defineProperty; - _objectGopn.f = _objectGopnExt.f = $getOwnPropertyNames; - _objectPie.f = $propertyIsEnumerable; - _objectGops.f = $getOwnPropertySymbols; - - if (_descriptors && !_library) { - _redefine(ObjectProto$1, 'propertyIsEnumerable', $propertyIsEnumerable, true); - } - - _wksExt.f = function (name) { - return wrap(_wks(name)); - }; - } - - _export(_export.G + _export.W + _export.F * !USE_NATIVE$1, { Symbol: $Symbol }); - - for (var es6Symbols = ( - // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 - 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' - ).split(','), j = 0; es6Symbols.length > j;)_wks(es6Symbols[j++]); - - for (var wellKnownSymbols = _objectKeys(_wks.store), k = 0; wellKnownSymbols.length > k;) _wksDefine(wellKnownSymbols[k++]); - - _export(_export.S + _export.F * !USE_NATIVE$1, 'Symbol', { - // 19.4.2.1 Symbol.for(key) - 'for': function (key) { - return _has(SymbolRegistry, key += '') - ? SymbolRegistry[key] - : SymbolRegistry[key] = $Symbol(key); - }, - // 19.4.2.5 Symbol.keyFor(sym) - keyFor: function keyFor(sym) { - if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!'); - for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key; - }, - useSetter: function () { setter = true; }, - useSimple: function () { setter = false; } - }); - - _export(_export.S + _export.F * !USE_NATIVE$1, 'Object', { - // 19.1.2.2 Object.create(O [, Properties]) - create: $create, - // 19.1.2.4 Object.defineProperty(O, P, Attributes) - defineProperty: $defineProperty, - // 19.1.2.3 Object.defineProperties(O, Properties) - defineProperties: $defineProperties, - // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) - getOwnPropertyDescriptor: $getOwnPropertyDescriptor, - // 19.1.2.7 Object.getOwnPropertyNames(O) - getOwnPropertyNames: $getOwnPropertyNames, - // 19.1.2.8 Object.getOwnPropertySymbols(O) - getOwnPropertySymbols: $getOwnPropertySymbols - }); - - // 24.3.2 JSON.stringify(value [, replacer [, space]]) - $JSON && _export(_export.S + _export.F * (!USE_NATIVE$1 || _fails(function () { - var S = $Symbol(); - // MS Edge converts symbol values to JSON as {} - // WebKit converts symbol values to JSON as null - // V8 throws on boxed symbols - return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}'; - })), 'JSON', { - stringify: function stringify(it) { - var args = [it]; - var i = 1; - var replacer, $replacer; - while (arguments.length > i) args.push(arguments[i++]); - $replacer = replacer = args[1]; - if (!_isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined - if (!_isArray(replacer)) replacer = function (key, value) { - if (typeof $replacer == 'function') value = $replacer.call(this, key, value); - if (!isSymbol(value)) return value; - }; - args[1] = replacer; - return _stringify.apply($JSON, args); - } - }); - - // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) - $Symbol[PROTOTYPE$2][TO_PRIMITIVE] || _hide($Symbol[PROTOTYPE$2], TO_PRIMITIVE, $Symbol[PROTOTYPE$2].valueOf); - // 19.4.3.5 Symbol.prototype[@@toStringTag] - _setToStringTag($Symbol, 'Symbol'); - // 20.2.1.9 Math[@@toStringTag] - _setToStringTag(Math, 'Math', true); - // 24.3.3 JSON[@@toStringTag] - _setToStringTag(_global.JSON, 'JSON', true); - - var runtime = createCommonjsModule(function (module) { - /** - * Copyright (c) 2014-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - !function (global) { - - var Op = Object.prototype; - var hasOwn = Op.hasOwnProperty; - var undefined; // More compressible than void 0. - - var $Symbol = typeof Symbol === "function" ? Symbol : {}; - var iteratorSymbol = $Symbol.iterator || "@@iterator"; - var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; - var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; - var runtime = global.regeneratorRuntime; - - if (runtime) { - { - // If regeneratorRuntime is defined globally and we're in a module, - // make the exports object identical to regeneratorRuntime. - module.exports = runtime; - } // Don't bother evaluating the rest of this file if the runtime was - // already defined globally. - - - return; - } // Define the runtime globally (as expected by generated code) as either - // module.exports (if we're in a module) or a new, empty object. - - - runtime = global.regeneratorRuntime = module.exports; - - function wrap(innerFn, outerFn, self, tryLocsList) { - // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. - var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; - var generator = Object.create(protoGenerator.prototype); - var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next, - // .throw, and .return methods. - - generator._invoke = makeInvokeMethod(innerFn, self, context); - return generator; - } - - runtime.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion - // record like context.tryEntries[i].completion. This interface could - // have been (and was previously) designed to take a closure to be - // invoked without arguments, but in all the cases we care about we - // already have an existing method we want to call, so there's no need - // to create a new function object. We can even get away with assuming - // the method takes exactly one argument, since that happens to be true - // in every case, so we don't have to touch the arguments object. The - // only additional allocation required is the completion record, which - // has a stable shape and so hopefully should be cheap to allocate. - - function tryCatch(fn, obj, arg) { - try { - return { - type: "normal", - arg: fn.call(obj, arg) - }; - } catch (err) { - return { - type: "throw", - arg: err - }; - } - } - - var GenStateSuspendedStart = "suspendedStart"; - var GenStateSuspendedYield = "suspendedYield"; - var GenStateExecuting = "executing"; - var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as - // breaking out of the dispatch switch statement. - - var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and - // .constructor.prototype properties for functions that return Generator - // objects. For full spec compliance, you may wish to configure your - // minifier not to mangle the names of these two functions. - - function Generator() {} - - function GeneratorFunction() {} - - function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that - // don't natively support it. - - - var IteratorPrototype = {}; - - IteratorPrototype[iteratorSymbol] = function () { - return this; - }; - - var getProto = Object.getPrototypeOf; - var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); - - if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { - // This environment has a native %IteratorPrototype%; use it instead - // of the polyfill. - IteratorPrototype = NativeIteratorPrototype; - } - - var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); - GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; - GeneratorFunctionPrototype.constructor = GeneratorFunction; - GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction"; // Helper for defining the .next, .throw, and .return methods of the - // Iterator interface in terms of a single ._invoke method. - - function defineIteratorMethods(prototype) { - ["next", "throw", "return"].forEach(function (method) { - prototype[method] = function (arg) { - return this._invoke(method, arg); - }; - }); - } - - runtime.isGeneratorFunction = function (genFun) { - var ctor = typeof genFun === "function" && genFun.constructor; - return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can - // do is to check its .name property. - (ctor.displayName || ctor.name) === "GeneratorFunction" : false; - }; - - runtime.mark = function (genFun) { - if (Object.setPrototypeOf) { - Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); - } else { - genFun.__proto__ = GeneratorFunctionPrototype; - - if (!(toStringTagSymbol in genFun)) { - genFun[toStringTagSymbol] = "GeneratorFunction"; - } - } - - genFun.prototype = Object.create(Gp); - return genFun; - }; // Within the body of any async function, `await x` is transformed to - // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test - // `hasOwn.call(value, "__await")` to determine if the yielded value is - // meant to be awaited. - - - runtime.awrap = function (arg) { - return { - __await: arg - }; - }; - - function AsyncIterator(generator) { - function invoke(method, arg, resolve, reject) { - var record = tryCatch(generator[method], generator, arg); - - if (record.type === "throw") { - reject(record.arg); - } else { - var result = record.arg; - var value = result.value; - - if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) { - return Promise.resolve(value.__await).then(function (value) { - invoke("next", value, resolve, reject); - }, function (err) { - invoke("throw", err, resolve, reject); - }); - } - - return Promise.resolve(value).then(function (unwrapped) { - // When a yielded Promise is resolved, its final value becomes - // the .value of the Promise<{value,done}> result for the - // current iteration. - result.value = unwrapped; - resolve(result); - }, function (error) { - // If a rejected Promise was yielded, throw the rejection back - // into the async generator function so it can be handled there. - return invoke("throw", error, resolve, reject); - }); - } - } - - var previousPromise; - - function enqueue(method, arg) { - function callInvokeWithMethodAndArg() { - return new Promise(function (resolve, reject) { - invoke(method, arg, resolve, reject); - }); - } - - return previousPromise = // If enqueue has been called before, then we want to wait until - // all previous Promises have been resolved before calling invoke, - // so that results are always delivered in the correct order. If - // enqueue has not been called before, then it is important to - // call invoke immediately, without waiting on a callback to fire, - // so that the async generator function has the opportunity to do - // any necessary setup in a predictable way. This predictability - // is why the Promise constructor synchronously invokes its - // executor callback, and why async functions synchronously - // execute code before the first await. Since we implement simple - // async functions in terms of async generators, it is especially - // important to get this right, even though it requires care. - previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later - // invocations of the iterator. - callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); - } // Define the unified helper method that is used to implement .next, - // .throw, and .return (see defineIteratorMethods). - - - this._invoke = enqueue; - } - - defineIteratorMethods(AsyncIterator.prototype); - - AsyncIterator.prototype[asyncIteratorSymbol] = function () { - return this; - }; - - runtime.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of - // AsyncIterator objects; they just return a Promise for the value of - // the final result produced by the iterator. - - runtime.async = function (innerFn, outerFn, self, tryLocsList) { - var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList)); - return runtime.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator. - : iter.next().then(function (result) { - return result.done ? result.value : iter.next(); - }); - }; - - function makeInvokeMethod(innerFn, self, context) { - var state = GenStateSuspendedStart; - return function invoke(method, arg) { - if (state === GenStateExecuting) { - throw new Error("Generator is already running"); - } - - if (state === GenStateCompleted) { - if (method === "throw") { - throw arg; - } // Be forgiving, per 25.3.3.3.3 of the spec: - // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume - - - return doneResult(); - } - - context.method = method; - context.arg = arg; - - while (true) { - var delegate = context.delegate; - - if (delegate) { - var delegateResult = maybeInvokeDelegate(delegate, context); - - if (delegateResult) { - if (delegateResult === ContinueSentinel) continue; - return delegateResult; - } - } - - if (context.method === "next") { - // Setting context._sent for legacy support of Babel's - // function.sent implementation. - context.sent = context._sent = context.arg; - } else if (context.method === "throw") { - if (state === GenStateSuspendedStart) { - state = GenStateCompleted; - throw context.arg; - } - - context.dispatchException(context.arg); - } else if (context.method === "return") { - context.abrupt("return", context.arg); - } - - state = GenStateExecuting; - var record = tryCatch(innerFn, self, context); - - if (record.type === "normal") { - // If an exception is thrown from innerFn, we leave state === - // GenStateExecuting and loop back for another invocation. - state = context.done ? GenStateCompleted : GenStateSuspendedYield; - - if (record.arg === ContinueSentinel) { - continue; - } - - return { - value: record.arg, - done: context.done - }; - } else if (record.type === "throw") { - state = GenStateCompleted; // Dispatch the exception by looping back around to the - // context.dispatchException(context.arg) call above. - - context.method = "throw"; - context.arg = record.arg; - } - } - }; - } // Call delegate.iterator[context.method](context.arg) and handle the - // result, either by returning a { value, done } result from the - // delegate iterator, or by modifying context.method and context.arg, - // setting context.delegate to null, and returning the ContinueSentinel. - - - function maybeInvokeDelegate(delegate, context) { - var method = delegate.iterator[context.method]; - - if (method === undefined) { - // A .throw or .return when the delegate iterator has no .throw - // method always terminates the yield* loop. - context.delegate = null; - - if (context.method === "throw") { - if (delegate.iterator.return) { - // If the delegate iterator has a return method, give it a - // chance to clean up. - context.method = "return"; - context.arg = undefined; - maybeInvokeDelegate(delegate, context); - - if (context.method === "throw") { - // If maybeInvokeDelegate(context) changed context.method from - // "return" to "throw", let that override the TypeError below. - return ContinueSentinel; - } - } - - context.method = "throw"; - context.arg = new TypeError("The iterator does not provide a 'throw' method"); - } - - return ContinueSentinel; - } - - var record = tryCatch(method, delegate.iterator, context.arg); - - if (record.type === "throw") { - context.method = "throw"; - context.arg = record.arg; - context.delegate = null; - return ContinueSentinel; - } - - var info = record.arg; - - if (!info) { - context.method = "throw"; - context.arg = new TypeError("iterator result is not an object"); - context.delegate = null; - return ContinueSentinel; - } - - if (info.done) { - // Assign the result of the finished delegate to the temporary - // variable specified by delegate.resultName (see delegateYield). - context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield). - - context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the - // exception, let the outer generator proceed normally. If - // context.method was "next", forget context.arg since it has been - // "consumed" by the delegate iterator. If context.method was - // "return", allow the original .return call to continue in the - // outer generator. - - if (context.method !== "return") { - context.method = "next"; - context.arg = undefined; - } - } else { - // Re-yield the result returned by the delegate method. - return info; - } // The delegate iterator is finished, so forget it and continue with - // the outer generator. - - - context.delegate = null; - return ContinueSentinel; - } // Define Generator.prototype.{next,throw,return} in terms of the - // unified ._invoke helper method. - - - defineIteratorMethods(Gp); - Gp[toStringTagSymbol] = "Generator"; // A Generator should always return itself as the iterator object when the - // @@iterator function is called on it. Some browsers' implementations of the - // iterator prototype chain incorrectly implement this, causing the Generator - // object to not be returned from this call. This ensures that doesn't happen. - // See https://github.com/facebook/regenerator/issues/274 for more details. - - Gp[iteratorSymbol] = function () { - return this; - }; - - Gp.toString = function () { - return "[object Generator]"; - }; - - function pushTryEntry(locs) { - var entry = { - tryLoc: locs[0] - }; - - if (1 in locs) { - entry.catchLoc = locs[1]; - } - - if (2 in locs) { - entry.finallyLoc = locs[2]; - entry.afterLoc = locs[3]; - } - - this.tryEntries.push(entry); - } - - function resetTryEntry(entry) { - var record = entry.completion || {}; - record.type = "normal"; - delete record.arg; - entry.completion = record; - } - - function Context(tryLocsList) { - // The root entry object (effectively a try statement without a catch - // or a finally block) gives us a place to store values thrown from - // locations where there is no enclosing try statement. - this.tryEntries = [{ - tryLoc: "root" - }]; - tryLocsList.forEach(pushTryEntry, this); - this.reset(true); - } - - runtime.keys = function (object) { - var keys = []; - - for (var key in object) { - keys.push(key); - } - - keys.reverse(); // Rather than returning an object with a next method, we keep - // things simple and return the next function itself. - - return function next() { - while (keys.length) { - var key = keys.pop(); - - if (key in object) { - next.value = key; - next.done = false; - return next; - } - } // To avoid creating an additional object, we just hang the .value - // and .done properties off the next function object itself. This - // also ensures that the minifier will not anonymize the function. - - - next.done = true; - return next; - }; - }; - - function values(iterable) { - if (iterable) { - var iteratorMethod = iterable[iteratorSymbol]; - - if (iteratorMethod) { - return iteratorMethod.call(iterable); - } - - if (typeof iterable.next === "function") { - return iterable; - } - - if (!isNaN(iterable.length)) { - var i = -1, - next = function next() { - while (++i < iterable.length) { - if (hasOwn.call(iterable, i)) { - next.value = iterable[i]; - next.done = false; - return next; - } - } - - next.value = undefined; - next.done = true; - return next; - }; - - return next.next = next; - } - } // Return an iterator with no values. - - - return { - next: doneResult - }; - } - - runtime.values = values; - - function doneResult() { - return { - value: undefined, - done: true - }; - } - - Context.prototype = { - constructor: Context, - reset: function reset(skipTempReset) { - this.prev = 0; - this.next = 0; // Resetting context._sent for legacy support of Babel's - // function.sent implementation. - - this.sent = this._sent = undefined; - this.done = false; - this.delegate = null; - this.method = "next"; - this.arg = undefined; - this.tryEntries.forEach(resetTryEntry); - - if (!skipTempReset) { - for (var name in this) { - // Not sure about the optimal order of these conditions: - if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) { - this[name] = undefined; - } - } - } - }, - stop: function stop() { - this.done = true; - var rootEntry = this.tryEntries[0]; - var rootRecord = rootEntry.completion; - - if (rootRecord.type === "throw") { - throw rootRecord.arg; - } - - return this.rval; - }, - dispatchException: function dispatchException(exception) { - if (this.done) { - throw exception; - } - - var context = this; - - function handle(loc, caught) { - record.type = "throw"; - record.arg = exception; - context.next = loc; - - if (caught) { - // If the dispatched exception was caught by a catch block, - // then let that catch block handle the exception normally. - context.method = "next"; - context.arg = undefined; - } - - return !!caught; - } - - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - var record = entry.completion; - - if (entry.tryLoc === "root") { - // Exception thrown outside of any try block that could handle - // it, so set the completion value of the entire function to - // throw the exception. - return handle("end"); - } - - if (entry.tryLoc <= this.prev) { - var hasCatch = hasOwn.call(entry, "catchLoc"); - var hasFinally = hasOwn.call(entry, "finallyLoc"); - - if (hasCatch && hasFinally) { - if (this.prev < entry.catchLoc) { - return handle(entry.catchLoc, true); - } else if (this.prev < entry.finallyLoc) { - return handle(entry.finallyLoc); - } - } else if (hasCatch) { - if (this.prev < entry.catchLoc) { - return handle(entry.catchLoc, true); - } - } else if (hasFinally) { - if (this.prev < entry.finallyLoc) { - return handle(entry.finallyLoc); - } - } else { - throw new Error("try statement without catch or finally"); - } - } - } - }, - abrupt: function abrupt(type, arg) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - - if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { - var finallyEntry = entry; - break; - } - } - - if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) { - // Ignore the finally entry if control is not jumping to a - // location outside the try/catch block. - finallyEntry = null; - } - - var record = finallyEntry ? finallyEntry.completion : {}; - record.type = type; - record.arg = arg; - - if (finallyEntry) { - this.method = "next"; - this.next = finallyEntry.finallyLoc; - return ContinueSentinel; - } - - return this.complete(record); - }, - complete: function complete(record, afterLoc) { - if (record.type === "throw") { - throw record.arg; - } - - if (record.type === "break" || record.type === "continue") { - this.next = record.arg; - } else if (record.type === "return") { - this.rval = this.arg = record.arg; - this.method = "return"; - this.next = "end"; - } else if (record.type === "normal" && afterLoc) { - this.next = afterLoc; - } - - return ContinueSentinel; - }, - finish: function finish(finallyLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - - if (entry.finallyLoc === finallyLoc) { - this.complete(entry.completion, entry.afterLoc); - resetTryEntry(entry); - return ContinueSentinel; - } - } - }, - "catch": function _catch(tryLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - - if (entry.tryLoc === tryLoc) { - var record = entry.completion; - - if (record.type === "throw") { - var thrown = record.arg; - resetTryEntry(entry); - } - - return thrown; - } - } // The context.catch method must only be called with a location - // argument that corresponds to a known catch block. - - - throw new Error("illegal catch attempt"); - }, - delegateYield: function delegateYield(iterable, resultName, nextLoc) { - this.delegate = { - iterator: values(iterable), - resultName: resultName, - nextLoc: nextLoc - }; - - if (this.method === "next") { - // Deliberately forget the last sent value so that we don't - // accidentally pass it on to the delegate. - this.arg = undefined; - } - - return ContinueSentinel; - } - }; - }( // In sloppy mode, unbound `this` refers to the global object, fallback to - // Function constructor if we're in global strict mode. That is sadly a form - // of indirect eval which violates Content Security Policy. - function () { - return this || (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" && self; - }() || Function("return this")()); - }); - - // 19.1.2.1 Object.assign(target, source, ...) - - - - - - var $assign = Object.assign; - - // should work with symbols and should have deterministic property order (V8 bug) - var _objectAssign = !$assign || _fails(function () { - var A = {}; - var B = {}; - // eslint-disable-next-line no-undef - var S = Symbol(); - var K = 'abcdefghijklmnopqrst'; - A[S] = 7; - K.split('').forEach(function (k) { B[k] = k; }); - return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; - }) ? function assign(target, source) { // eslint-disable-line no-unused-vars - var T = _toObject(target); - var aLen = arguments.length; - var index = 1; - var getSymbols = _objectGops.f; - var isEnum = _objectPie.f; - while (aLen > index) { - var S = _iobject(arguments[index++]); - var keys = getSymbols ? _objectKeys(S).concat(getSymbols(S)) : _objectKeys(S); - var length = keys.length; - var j = 0; - var key; - while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key]; - } return T; - } : $assign; - - // 19.1.3.1 Object.assign(target, source) - - - _export(_export.S + _export.F, 'Object', { assign: _objectAssign }); - - // true -> String#at - // false -> String#codePointAt - var _stringAt = function (TO_STRING) { - return function (that, pos) { - var s = String(_defined(that)); - var i = _toInteger(pos); - var l = s.length; - var a, b; - if (i < 0 || i >= l) return TO_STRING ? '' : undefined; - a = s.charCodeAt(i); - return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff - ? TO_STRING ? s.charAt(i) : a - : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; - }; - }; - - var at = _stringAt(true); - - // `AdvanceStringIndex` abstract operation - // https://tc39.github.io/ecma262/#sec-advancestringindex - var _advanceStringIndex = function (S, index, unicode) { - return index + (unicode ? at(S, index).length : 1); - }; - - var builtinExec = RegExp.prototype.exec; - - // `RegExpExec` abstract operation - // https://tc39.github.io/ecma262/#sec-regexpexec - var _regexpExecAbstract = function (R, S) { - var exec = R.exec; - if (typeof exec === 'function') { - var result = exec.call(R, S); - if (typeof result !== 'object') { - throw new TypeError('RegExp exec method returned something other than an Object or null'); - } - return result; - } - if (_classof(R) !== 'RegExp') { - throw new TypeError('RegExp#exec called on incompatible receiver'); - } - return builtinExec.call(R, S); - }; - - // 21.2.5.3 get RegExp.prototype.flags - - var _flags = function () { - var that = _anObject(this); - var result = ''; - if (that.global) result += 'g'; - if (that.ignoreCase) result += 'i'; - if (that.multiline) result += 'm'; - if (that.unicode) result += 'u'; - if (that.sticky) result += 'y'; - return result; - }; - - var nativeExec = RegExp.prototype.exec; - // This always refers to the native implementation, because the - // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js, - // which loads this file before patching the method. - var nativeReplace = String.prototype.replace; - - var patchedExec = nativeExec; - - var LAST_INDEX = 'lastIndex'; - - var UPDATES_LAST_INDEX_WRONG = (function () { - var re1 = /a/, - re2 = /b*/g; - nativeExec.call(re1, 'a'); - nativeExec.call(re2, 'a'); - return re1[LAST_INDEX] !== 0 || re2[LAST_INDEX] !== 0; - })(); - - // nonparticipating capturing group, copied from es5-shim's String#split patch. - var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; - - var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED; - - if (PATCH) { - patchedExec = function exec(str) { - var re = this; - var lastIndex, reCopy, match, i; - - if (NPCG_INCLUDED) { - reCopy = new RegExp('^' + re.source + '$(?!\\s)', _flags.call(re)); - } - if (UPDATES_LAST_INDEX_WRONG) lastIndex = re[LAST_INDEX]; - - match = nativeExec.call(re, str); - - if (UPDATES_LAST_INDEX_WRONG && match) { - re[LAST_INDEX] = re.global ? match.index + match[0].length : lastIndex; - } - if (NPCG_INCLUDED && match && match.length > 1) { - // Fix browsers whose `exec` methods don't consistently return `undefined` - // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/ - // eslint-disable-next-line no-loop-func - nativeReplace.call(match[0], reCopy, function () { - for (i = 1; i < arguments.length - 2; i++) { - if (arguments[i] === undefined) match[i] = undefined; - } - }); - } - - return match; - }; - } - - var _regexpExec = patchedExec; - - _export({ - target: 'RegExp', - proto: true, - forced: _regexpExec !== /./.exec - }, { - exec: _regexpExec - }); - - var SPECIES$3 = _wks('species'); - - var REPLACE_SUPPORTS_NAMED_GROUPS = !_fails(function () { - // #replace needs built-in support for named groups. - // #match works fine because it just return the exec results, even if it has - // a "grops" property. - var re = /./; - re.exec = function () { - var result = []; - result.groups = { a: '7' }; - return result; - }; - return ''.replace(re, '$') !== '7'; - }); - - var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = (function () { - // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec - var re = /(?:)/; - var originalExec = re.exec; - re.exec = function () { return originalExec.apply(this, arguments); }; - var result = 'ab'.split(re); - return result.length === 2 && result[0] === 'a' && result[1] === 'b'; - })(); - - var _fixReWks = function (KEY, length, exec) { - var SYMBOL = _wks(KEY); - - var DELEGATES_TO_SYMBOL = !_fails(function () { - // String methods call symbol-named RegEp methods - var O = {}; - O[SYMBOL] = function () { return 7; }; - return ''[KEY](O) != 7; - }); - - var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL ? !_fails(function () { - // Symbol-named RegExp methods call .exec - var execCalled = false; - var re = /a/; - re.exec = function () { execCalled = true; return null; }; - if (KEY === 'split') { - // RegExp[@@split] doesn't call the regex's exec method, but first creates - // a new one. We need to return the patched regex when creating the new one. - re.constructor = {}; - re.constructor[SPECIES$3] = function () { return re; }; - } - re[SYMBOL](''); - return !execCalled; - }) : undefined; - - if ( - !DELEGATES_TO_SYMBOL || - !DELEGATES_TO_EXEC || - (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) || - (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC) - ) { - var nativeRegExpMethod = /./[SYMBOL]; - var fns = exec( - _defined, - SYMBOL, - ''[KEY], - function maybeCallNative(nativeMethod, regexp, str, arg2, forceStringMethod) { - if (regexp.exec === _regexpExec) { - if (DELEGATES_TO_SYMBOL && !forceStringMethod) { - // The native String method already delegates to @@method (this - // polyfilled function), leasing to infinite recursion. - // We avoid it by directly calling the native @@method method. - return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) }; - } - return { done: true, value: nativeMethod.call(str, regexp, arg2) }; - } - return { done: false }; - } - ); - var strfn = fns[0]; - var rxfn = fns[1]; - - _redefine(String.prototype, KEY, strfn); - _hide(RegExp.prototype, SYMBOL, length == 2 - // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) - // 21.2.5.11 RegExp.prototype[@@split](string, limit) - ? function (string, arg) { return rxfn.call(string, this, arg); } - // 21.2.5.6 RegExp.prototype[@@match](string) - // 21.2.5.9 RegExp.prototype[@@search](string) - : function (string) { return rxfn.call(string, this); } - ); - } - }; - - var max$1 = Math.max; - var min$2 = Math.min; - var floor$1 = Math.floor; - var SUBSTITUTION_SYMBOLS = /\$([$&`']|\d\d?|<[^>]*>)/g; - var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&`']|\d\d?)/g; - - var maybeToString = function (it) { - return it === undefined ? it : String(it); - }; - - // @@replace logic - _fixReWks('replace', 2, function (defined, REPLACE, $replace, maybeCallNative) { - return [ - // `String.prototype.replace` method - // https://tc39.github.io/ecma262/#sec-string.prototype.replace - function replace(searchValue, replaceValue) { - var O = defined(this); - var fn = searchValue == undefined ? undefined : searchValue[REPLACE]; - return fn !== undefined - ? fn.call(searchValue, O, replaceValue) - : $replace.call(String(O), searchValue, replaceValue); - }, - // `RegExp.prototype[@@replace]` method - // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace - function (regexp, replaceValue) { - var res = maybeCallNative($replace, regexp, this, replaceValue); - if (res.done) return res.value; - - var rx = _anObject(regexp); - var S = String(this); - var functionalReplace = typeof replaceValue === 'function'; - if (!functionalReplace) replaceValue = String(replaceValue); - var global = rx.global; - if (global) { - var fullUnicode = rx.unicode; - rx.lastIndex = 0; - } - var results = []; - while (true) { - var result = _regexpExecAbstract(rx, S); - if (result === null) break; - results.push(result); - if (!global) break; - var matchStr = String(result[0]); - if (matchStr === '') rx.lastIndex = _advanceStringIndex(S, _toLength(rx.lastIndex), fullUnicode); - } - var accumulatedResult = ''; - var nextSourcePosition = 0; - for (var i = 0; i < results.length; i++) { - result = results[i]; - var matched = String(result[0]); - var position = max$1(min$2(_toInteger(result.index), S.length), 0); - var captures = []; - // NOTE: This is equivalent to - // captures = result.slice(1).map(maybeToString) - // but for some reason `nativeSlice.call(result, 1, result.length)` (called in - // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and - // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it. - for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j])); - var namedCaptures = result.groups; - if (functionalReplace) { - var replacerArgs = [matched].concat(captures, position, S); - if (namedCaptures !== undefined) replacerArgs.push(namedCaptures); - var replacement = String(replaceValue.apply(undefined, replacerArgs)); - } else { - replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue); - } - if (position >= nextSourcePosition) { - accumulatedResult += S.slice(nextSourcePosition, position) + replacement; - nextSourcePosition = position + matched.length; - } - } - return accumulatedResult + S.slice(nextSourcePosition); - } - ]; - - // https://tc39.github.io/ecma262/#sec-getsubstitution - function getSubstitution(matched, str, position, captures, namedCaptures, replacement) { - var tailPos = position + matched.length; - var m = captures.length; - var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED; - if (namedCaptures !== undefined) { - namedCaptures = _toObject(namedCaptures); - symbols = SUBSTITUTION_SYMBOLS; - } - return $replace.call(replacement, symbols, function (match, ch) { - var capture; - switch (ch.charAt(0)) { - case '$': return '$'; - case '&': return matched; - case '`': return str.slice(0, position); - case "'": return str.slice(tailPos); - case '<': - capture = namedCaptures[ch.slice(1, -1)]; - break; - default: // \d\d? - var n = +ch; - if (n === 0) return match; - if (n > m) { - var f = floor$1(n / 10); - if (f === 0) return match; - if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1); - return match; - } - capture = captures[n - 1]; - } - return capture === undefined ? '' : capture; - }); - } - }); - - var _stringWs = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + - '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; - - var space = '[' + _stringWs + ']'; - var non = '\u200b\u0085'; - var ltrim = RegExp('^' + space + space + '*'); - var rtrim = RegExp(space + space + '*$'); - - var exporter = function (KEY, exec, ALIAS) { - var exp = {}; - var FORCE = _fails(function () { - return !!_stringWs[KEY]() || non[KEY]() != non; - }); - var fn = exp[KEY] = FORCE ? exec(trim) : _stringWs[KEY]; - if (ALIAS) exp[ALIAS] = fn; - _export(_export.P + _export.F * FORCE, 'String', exp); - }; - - // 1 -> String#trimLeft - // 2 -> String#trimRight - // 3 -> String#trim - var trim = exporter.trim = function (string, TYPE) { - string = String(_defined(string)); - if (TYPE & 1) string = string.replace(ltrim, ''); - if (TYPE & 2) string = string.replace(rtrim, ''); - return string; - }; - - var _stringTrim = exporter; - - // 21.1.3.25 String.prototype.trim() - _stringTrim('trim', function ($trim) { - return function trim() { - return $trim(this, 3); - }; - }); - - // 7.2.8 IsRegExp(argument) - - - var MATCH = _wks('match'); - var _isRegexp = function (it) { - var isRegExp; - return _isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : _cof(it) == 'RegExp'); - }; - - var $min = Math.min; - var $push = [].push; - var $SPLIT = 'split'; - var LENGTH = 'length'; - var LAST_INDEX$1 = 'lastIndex'; - var MAX_UINT32 = 0xffffffff; - - // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError - var SUPPORTS_Y = !_fails(function () { }); - - // @@split logic - _fixReWks('split', 2, function (defined, SPLIT, $split, maybeCallNative) { - var internalSplit; - if ( - 'abbc'[$SPLIT](/(b)*/)[1] == 'c' || - 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 || - 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 || - '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 || - '.'[$SPLIT](/()()/)[LENGTH] > 1 || - ''[$SPLIT](/.?/)[LENGTH] - ) { - // based on es5-shim implementation, need to rework it - internalSplit = function (separator, limit) { - var string = String(this); - if (separator === undefined && limit === 0) return []; - // If `separator` is not a regex, use native split - if (!_isRegexp(separator)) return $split.call(string, separator, limit); - var output = []; - var flags = (separator.ignoreCase ? 'i' : '') + - (separator.multiline ? 'm' : '') + - (separator.unicode ? 'u' : '') + - (separator.sticky ? 'y' : ''); - var lastLastIndex = 0; - var splitLimit = limit === undefined ? MAX_UINT32 : limit >>> 0; - // Make `global` and avoid `lastIndex` issues by working with a copy - var separatorCopy = new RegExp(separator.source, flags + 'g'); - var match, lastIndex, lastLength; - while (match = _regexpExec.call(separatorCopy, string)) { - lastIndex = separatorCopy[LAST_INDEX$1]; - if (lastIndex > lastLastIndex) { - output.push(string.slice(lastLastIndex, match.index)); - if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1)); - lastLength = match[0][LENGTH]; - lastLastIndex = lastIndex; - if (output[LENGTH] >= splitLimit) break; - } - if (separatorCopy[LAST_INDEX$1] === match.index) separatorCopy[LAST_INDEX$1]++; // Avoid an infinite loop - } - if (lastLastIndex === string[LENGTH]) { - if (lastLength || !separatorCopy.test('')) output.push(''); - } else output.push(string.slice(lastLastIndex)); - return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output; - }; - // Chakra, V8 - } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) { - internalSplit = function (separator, limit) { - return separator === undefined && limit === 0 ? [] : $split.call(this, separator, limit); - }; - } else { - internalSplit = $split; - } - - return [ - // `String.prototype.split` method - // https://tc39.github.io/ecma262/#sec-string.prototype.split - function split(separator, limit) { - var O = defined(this); - var splitter = separator == undefined ? undefined : separator[SPLIT]; - return splitter !== undefined - ? splitter.call(separator, O, limit) - : internalSplit.call(String(O), separator, limit); - }, - // `RegExp.prototype[@@split]` method - // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split - // - // NOTE: This cannot be properly polyfilled in engines that don't support - // the 'y' flag. - function (regexp, limit) { - var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== $split); - if (res.done) return res.value; - - var rx = _anObject(regexp); - var S = String(this); - var C = _speciesConstructor(rx, RegExp); - - var unicodeMatching = rx.unicode; - var flags = (rx.ignoreCase ? 'i' : '') + - (rx.multiline ? 'm' : '') + - (rx.unicode ? 'u' : '') + - (SUPPORTS_Y ? 'y' : 'g'); - - // ^(? + rx + ) is needed, in combination with some S slicing, to - // simulate the 'y' flag. - var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags); - var lim = limit === undefined ? MAX_UINT32 : limit >>> 0; - if (lim === 0) return []; - if (S.length === 0) return _regexpExecAbstract(splitter, S) === null ? [S] : []; - var p = 0; - var q = 0; - var A = []; - while (q < S.length) { - splitter.lastIndex = SUPPORTS_Y ? q : 0; - var z = _regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q)); - var e; - if ( - z === null || - (e = $min(_toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p - ) { - q = _advanceStringIndex(S, q, unicodeMatching); - } else { - A.push(S.slice(p, q)); - if (A.length === lim) return A; - for (var i = 1; i <= z.length - 1; i++) { - A.push(z[i]); - if (A.length === lim) return A; - } - q = p = e; - } - } - A.push(S.slice(p)); - return A; - } - ]; - }); - - var TYPED = _uid('typed_array'); - var VIEW = _uid('view'); - var ABV = !!(_global.ArrayBuffer && _global.DataView); - var CONSTR = ABV; - var i$1 = 0; - var l = 9; - var Typed; - - var TypedArrayConstructors = ( - 'Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array' - ).split(','); - - while (i$1 < l) { - if (Typed = _global[TypedArrayConstructors[i$1++]]) { - _hide(Typed.prototype, TYPED, true); - _hide(Typed.prototype, VIEW, true); - } else CONSTR = false; - } - - var _typed = { - ABV: ABV, - CONSTR: CONSTR, - TYPED: TYPED, - VIEW: VIEW - }; - - // https://tc39.github.io/ecma262/#sec-toindex - - - var _toIndex = function (it) { - if (it === undefined) return 0; - var number = _toInteger(it); - var length = _toLength(number); - if (number !== length) throw RangeError('Wrong length!'); - return length; - }; - - var _arrayFill = function fill(value /* , start = 0, end = @length */) { - var O = _toObject(this); - var length = _toLength(O.length); - var aLen = arguments.length; - var index = _toAbsoluteIndex(aLen > 1 ? arguments[1] : undefined, length); - var end = aLen > 2 ? arguments[2] : undefined; - var endPos = end === undefined ? length : _toAbsoluteIndex(end, length); - while (endPos > index) O[index++] = value; - return O; - }; - - var _typedBuffer = createCommonjsModule(function (module, exports) { - - - - - - - - - - - - var gOPN = _objectGopn.f; - var dP = _objectDp.f; - - - var ARRAY_BUFFER = 'ArrayBuffer'; - var DATA_VIEW = 'DataView'; - var PROTOTYPE = 'prototype'; - var WRONG_LENGTH = 'Wrong length!'; - var WRONG_INDEX = 'Wrong index!'; - var $ArrayBuffer = _global[ARRAY_BUFFER]; - var $DataView = _global[DATA_VIEW]; - var Math = _global.Math; - var RangeError = _global.RangeError; - // eslint-disable-next-line no-shadow-restricted-names - var Infinity = _global.Infinity; - var BaseBuffer = $ArrayBuffer; - var abs = Math.abs; - var pow = Math.pow; - var floor = Math.floor; - var log = Math.log; - var LN2 = Math.LN2; - var BUFFER = 'buffer'; - var BYTE_LENGTH = 'byteLength'; - var BYTE_OFFSET = 'byteOffset'; - var $BUFFER = _descriptors ? '_b' : BUFFER; - var $LENGTH = _descriptors ? '_l' : BYTE_LENGTH; - var $OFFSET = _descriptors ? '_o' : BYTE_OFFSET; - - // IEEE754 conversions based on https://github.com/feross/ieee754 - function packIEEE754(value, mLen, nBytes) { - var buffer = new Array(nBytes); - var eLen = nBytes * 8 - mLen - 1; - var eMax = (1 << eLen) - 1; - var eBias = eMax >> 1; - var rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0; - var i = 0; - var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; - var e, m, c; - value = abs(value); - // eslint-disable-next-line no-self-compare - if (value != value || value === Infinity) { - // eslint-disable-next-line no-self-compare - m = value != value ? 1 : 0; - e = eMax; - } else { - e = floor(log(value) / LN2); - if (value * (c = pow(2, -e)) < 1) { - e--; - c *= 2; - } - if (e + eBias >= 1) { - value += rt / c; - } else { - value += rt * pow(2, 1 - eBias); - } - if (value * c >= 2) { - e++; - c /= 2; - } - if (e + eBias >= eMax) { - m = 0; - e = eMax; - } else if (e + eBias >= 1) { - m = (value * c - 1) * pow(2, mLen); - e = e + eBias; - } else { - m = value * pow(2, eBias - 1) * pow(2, mLen); - e = 0; - } - } - for (; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8); - e = e << mLen | m; - eLen += mLen; - for (; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8); - buffer[--i] |= s * 128; - return buffer; - } - function unpackIEEE754(buffer, mLen, nBytes) { - var eLen = nBytes * 8 - mLen - 1; - var eMax = (1 << eLen) - 1; - var eBias = eMax >> 1; - var nBits = eLen - 7; - var i = nBytes - 1; - var s = buffer[i--]; - var e = s & 127; - var m; - s >>= 7; - for (; nBits > 0; e = e * 256 + buffer[i], i--, nBits -= 8); - m = e & (1 << -nBits) - 1; - e >>= -nBits; - nBits += mLen; - for (; nBits > 0; m = m * 256 + buffer[i], i--, nBits -= 8); - if (e === 0) { - e = 1 - eBias; - } else if (e === eMax) { - return m ? NaN : s ? -Infinity : Infinity; - } else { - m = m + pow(2, mLen); - e = e - eBias; - } return (s ? -1 : 1) * m * pow(2, e - mLen); - } - - function unpackI32(bytes) { - return bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0]; - } - function packI8(it) { - return [it & 0xff]; - } - function packI16(it) { - return [it & 0xff, it >> 8 & 0xff]; - } - function packI32(it) { - return [it & 0xff, it >> 8 & 0xff, it >> 16 & 0xff, it >> 24 & 0xff]; - } - function packF64(it) { - return packIEEE754(it, 52, 8); - } - function packF32(it) { - return packIEEE754(it, 23, 4); - } - - function addGetter(C, key, internal) { - dP(C[PROTOTYPE], key, { get: function () { return this[internal]; } }); - } - - function get(view, bytes, index, isLittleEndian) { - var numIndex = +index; - var intIndex = _toIndex(numIndex); - if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX); - var store = view[$BUFFER]._b; - var start = intIndex + view[$OFFSET]; - var pack = store.slice(start, start + bytes); - return isLittleEndian ? pack : pack.reverse(); - } - function set(view, bytes, index, conversion, value, isLittleEndian) { - var numIndex = +index; - var intIndex = _toIndex(numIndex); - if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX); - var store = view[$BUFFER]._b; - var start = intIndex + view[$OFFSET]; - var pack = conversion(+value); - for (var i = 0; i < bytes; i++) store[start + i] = pack[isLittleEndian ? i : bytes - i - 1]; - } - - if (!_typed.ABV) { - $ArrayBuffer = function ArrayBuffer(length) { - _anInstance(this, $ArrayBuffer, ARRAY_BUFFER); - var byteLength = _toIndex(length); - this._b = _arrayFill.call(new Array(byteLength), 0); - this[$LENGTH] = byteLength; - }; - - $DataView = function DataView(buffer, byteOffset, byteLength) { - _anInstance(this, $DataView, DATA_VIEW); - _anInstance(buffer, $ArrayBuffer, DATA_VIEW); - var bufferLength = buffer[$LENGTH]; - var offset = _toInteger(byteOffset); - if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset!'); - byteLength = byteLength === undefined ? bufferLength - offset : _toLength(byteLength); - if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH); - this[$BUFFER] = buffer; - this[$OFFSET] = offset; - this[$LENGTH] = byteLength; - }; - - if (_descriptors) { - addGetter($ArrayBuffer, BYTE_LENGTH, '_l'); - addGetter($DataView, BUFFER, '_b'); - addGetter($DataView, BYTE_LENGTH, '_l'); - addGetter($DataView, BYTE_OFFSET, '_o'); - } - - _redefineAll($DataView[PROTOTYPE], { - getInt8: function getInt8(byteOffset) { - return get(this, 1, byteOffset)[0] << 24 >> 24; - }, - getUint8: function getUint8(byteOffset) { - return get(this, 1, byteOffset)[0]; - }, - getInt16: function getInt16(byteOffset /* , littleEndian */) { - var bytes = get(this, 2, byteOffset, arguments[1]); - return (bytes[1] << 8 | bytes[0]) << 16 >> 16; - }, - getUint16: function getUint16(byteOffset /* , littleEndian */) { - var bytes = get(this, 2, byteOffset, arguments[1]); - return bytes[1] << 8 | bytes[0]; - }, - getInt32: function getInt32(byteOffset /* , littleEndian */) { - return unpackI32(get(this, 4, byteOffset, arguments[1])); - }, - getUint32: function getUint32(byteOffset /* , littleEndian */) { - return unpackI32(get(this, 4, byteOffset, arguments[1])) >>> 0; - }, - getFloat32: function getFloat32(byteOffset /* , littleEndian */) { - return unpackIEEE754(get(this, 4, byteOffset, arguments[1]), 23, 4); - }, - getFloat64: function getFloat64(byteOffset /* , littleEndian */) { - return unpackIEEE754(get(this, 8, byteOffset, arguments[1]), 52, 8); - }, - setInt8: function setInt8(byteOffset, value) { - set(this, 1, byteOffset, packI8, value); - }, - setUint8: function setUint8(byteOffset, value) { - set(this, 1, byteOffset, packI8, value); - }, - setInt16: function setInt16(byteOffset, value /* , littleEndian */) { - set(this, 2, byteOffset, packI16, value, arguments[2]); - }, - setUint16: function setUint16(byteOffset, value /* , littleEndian */) { - set(this, 2, byteOffset, packI16, value, arguments[2]); - }, - setInt32: function setInt32(byteOffset, value /* , littleEndian */) { - set(this, 4, byteOffset, packI32, value, arguments[2]); - }, - setUint32: function setUint32(byteOffset, value /* , littleEndian */) { - set(this, 4, byteOffset, packI32, value, arguments[2]); - }, - setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) { - set(this, 4, byteOffset, packF32, value, arguments[2]); - }, - setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) { - set(this, 8, byteOffset, packF64, value, arguments[2]); - } - }); - } else { - if (!_fails(function () { - $ArrayBuffer(1); - }) || !_fails(function () { - new $ArrayBuffer(-1); // eslint-disable-line no-new - }) || _fails(function () { - new $ArrayBuffer(); // eslint-disable-line no-new - new $ArrayBuffer(1.5); // eslint-disable-line no-new - new $ArrayBuffer(NaN); // eslint-disable-line no-new - return $ArrayBuffer.name != ARRAY_BUFFER; - })) { - $ArrayBuffer = function ArrayBuffer(length) { - _anInstance(this, $ArrayBuffer); - return new BaseBuffer(_toIndex(length)); - }; - var ArrayBufferProto = $ArrayBuffer[PROTOTYPE] = BaseBuffer[PROTOTYPE]; - for (var keys = gOPN(BaseBuffer), j = 0, key; keys.length > j;) { - if (!((key = keys[j++]) in $ArrayBuffer)) _hide($ArrayBuffer, key, BaseBuffer[key]); - } - ArrayBufferProto.constructor = $ArrayBuffer; - } - // iOS Safari 7.x bug - var view = new $DataView(new $ArrayBuffer(2)); - var $setInt8 = $DataView[PROTOTYPE].setInt8; - view.setInt8(0, 2147483648); - view.setInt8(1, 2147483649); - if (view.getInt8(0) || !view.getInt8(1)) _redefineAll($DataView[PROTOTYPE], { - setInt8: function setInt8(byteOffset, value) { - $setInt8.call(this, byteOffset, value << 24 >> 24); - }, - setUint8: function setUint8(byteOffset, value) { - $setInt8.call(this, byteOffset, value << 24 >> 24); - } - }, true); - } - _setToStringTag($ArrayBuffer, ARRAY_BUFFER); - _setToStringTag($DataView, DATA_VIEW); - _hide($DataView[PROTOTYPE], _typed.VIEW, true); - exports[ARRAY_BUFFER] = $ArrayBuffer; - exports[DATA_VIEW] = $DataView; - }); - - var _arrayCopyWithin = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) { - var O = _toObject(this); - var len = _toLength(O.length); - var to = _toAbsoluteIndex(target, len); - var from = _toAbsoluteIndex(start, len); - var end = arguments.length > 2 ? arguments[2] : undefined; - var count = Math.min((end === undefined ? len : _toAbsoluteIndex(end, len)) - from, len - to); - var inc = 1; - if (from < to && to < from + count) { - inc = -1; - from += count - 1; - to += count - 1; - } - while (count-- > 0) { - if (from in O) O[to] = O[from]; - else delete O[to]; - to += inc; - from += inc; - } return O; - }; - - var _typedArray = createCommonjsModule(function (module) { - if (_descriptors) { - var LIBRARY = _library; - var global = _global; - var fails = _fails; - var $export = _export; - var $typed = _typed; - var $buffer = _typedBuffer; - var ctx = _ctx; - var anInstance = _anInstance; - var propertyDesc = _propertyDesc; - var hide = _hide; - var redefineAll = _redefineAll; - var toInteger = _toInteger; - var toLength = _toLength; - var toIndex = _toIndex; - var toAbsoluteIndex = _toAbsoluteIndex; - var toPrimitive = _toPrimitive; - var has = _has; - var classof = _classof; - var isObject = _isObject; - var toObject = _toObject; - var isArrayIter = _isArrayIter; - var create = _objectCreate; - var getPrototypeOf = _objectGpo; - var gOPN = _objectGopn.f; - var getIterFn = core_getIteratorMethod; - var uid = _uid; - var wks = _wks; - var createArrayMethod = _arrayMethods; - var createArrayIncludes = _arrayIncludes; - var speciesConstructor = _speciesConstructor; - var ArrayIterators = es6_array_iterator; - var Iterators = _iterators; - var $iterDetect = _iterDetect; - var setSpecies = _setSpecies; - var arrayFill = _arrayFill; - var arrayCopyWithin = _arrayCopyWithin; - var $DP = _objectDp; - var $GOPD = _objectGopd; - var dP = $DP.f; - var gOPD = $GOPD.f; - var RangeError = global.RangeError; - var TypeError = global.TypeError; - var Uint8Array = global.Uint8Array; - var ARRAY_BUFFER = 'ArrayBuffer'; - var SHARED_BUFFER = 'Shared' + ARRAY_BUFFER; - var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT'; - var PROTOTYPE = 'prototype'; - var ArrayProto = Array[PROTOTYPE]; - var $ArrayBuffer = $buffer.ArrayBuffer; - var $DataView = $buffer.DataView; - var arrayForEach = createArrayMethod(0); - var arrayFilter = createArrayMethod(2); - var arraySome = createArrayMethod(3); - var arrayEvery = createArrayMethod(4); - var arrayFind = createArrayMethod(5); - var arrayFindIndex = createArrayMethod(6); - var arrayIncludes = createArrayIncludes(true); - var arrayIndexOf = createArrayIncludes(false); - var arrayValues = ArrayIterators.values; - var arrayKeys = ArrayIterators.keys; - var arrayEntries = ArrayIterators.entries; - var arrayLastIndexOf = ArrayProto.lastIndexOf; - var arrayReduce = ArrayProto.reduce; - var arrayReduceRight = ArrayProto.reduceRight; - var arrayJoin = ArrayProto.join; - var arraySort = ArrayProto.sort; - var arraySlice = ArrayProto.slice; - var arrayToString = ArrayProto.toString; - var arrayToLocaleString = ArrayProto.toLocaleString; - var ITERATOR = wks('iterator'); - var TAG = wks('toStringTag'); - var TYPED_CONSTRUCTOR = uid('typed_constructor'); - var DEF_CONSTRUCTOR = uid('def_constructor'); - var ALL_CONSTRUCTORS = $typed.CONSTR; - var TYPED_ARRAY = $typed.TYPED; - var VIEW = $typed.VIEW; - var WRONG_LENGTH = 'Wrong length!'; - - var $map = createArrayMethod(1, function (O, length) { - return allocate(speciesConstructor(O, O[DEF_CONSTRUCTOR]), length); - }); - - var LITTLE_ENDIAN = fails(function () { - // eslint-disable-next-line no-undef - return new Uint8Array(new Uint16Array([1]).buffer)[0] === 1; - }); - - var FORCED_SET = !!Uint8Array && !!Uint8Array[PROTOTYPE].set && fails(function () { - new Uint8Array(1).set({}); - }); - - var toOffset = function (it, BYTES) { - var offset = toInteger(it); - if (offset < 0 || offset % BYTES) throw RangeError('Wrong offset!'); - return offset; - }; - - var validate = function (it) { - if (isObject(it) && TYPED_ARRAY in it) return it; - throw TypeError(it + ' is not a typed array!'); - }; - - var allocate = function (C, length) { - if (!(isObject(C) && TYPED_CONSTRUCTOR in C)) { - throw TypeError('It is not a typed array constructor!'); - } return new C(length); - }; - - var speciesFromList = function (O, list) { - return fromList(speciesConstructor(O, O[DEF_CONSTRUCTOR]), list); - }; - - var fromList = function (C, list) { - var index = 0; - var length = list.length; - var result = allocate(C, length); - while (length > index) result[index] = list[index++]; - return result; - }; - - var addGetter = function (it, key, internal) { - dP(it, key, { get: function () { return this._d[internal]; } }); - }; - - var $from = function from(source /* , mapfn, thisArg */) { - var O = toObject(source); - var aLen = arguments.length; - var mapfn = aLen > 1 ? arguments[1] : undefined; - var mapping = mapfn !== undefined; - var iterFn = getIterFn(O); - var i, length, values, result, step, iterator; - if (iterFn != undefined && !isArrayIter(iterFn)) { - for (iterator = iterFn.call(O), values = [], i = 0; !(step = iterator.next()).done; i++) { - values.push(step.value); - } O = values; - } - if (mapping && aLen > 2) mapfn = ctx(mapfn, arguments[2], 2); - for (i = 0, length = toLength(O.length), result = allocate(this, length); length > i; i++) { - result[i] = mapping ? mapfn(O[i], i) : O[i]; - } - return result; - }; - - var $of = function of(/* ...items */) { - var index = 0; - var length = arguments.length; - var result = allocate(this, length); - while (length > index) result[index] = arguments[index++]; - return result; - }; - - // iOS Safari 6.x fails here - var TO_LOCALE_BUG = !!Uint8Array && fails(function () { arrayToLocaleString.call(new Uint8Array(1)); }); - - var $toLocaleString = function toLocaleString() { - return arrayToLocaleString.apply(TO_LOCALE_BUG ? arraySlice.call(validate(this)) : validate(this), arguments); - }; - - var proto = { - copyWithin: function copyWithin(target, start /* , end */) { - return arrayCopyWithin.call(validate(this), target, start, arguments.length > 2 ? arguments[2] : undefined); - }, - every: function every(callbackfn /* , thisArg */) { - return arrayEvery(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); - }, - fill: function fill(value /* , start, end */) { // eslint-disable-line no-unused-vars - return arrayFill.apply(validate(this), arguments); - }, - filter: function filter(callbackfn /* , thisArg */) { - return speciesFromList(this, arrayFilter(validate(this), callbackfn, - arguments.length > 1 ? arguments[1] : undefined)); - }, - find: function find(predicate /* , thisArg */) { - return arrayFind(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined); - }, - findIndex: function findIndex(predicate /* , thisArg */) { - return arrayFindIndex(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined); - }, - forEach: function forEach(callbackfn /* , thisArg */) { - arrayForEach(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); - }, - indexOf: function indexOf(searchElement /* , fromIndex */) { - return arrayIndexOf(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); - }, - includes: function includes(searchElement /* , fromIndex */) { - return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); - }, - join: function join(separator) { // eslint-disable-line no-unused-vars - return arrayJoin.apply(validate(this), arguments); - }, - lastIndexOf: function lastIndexOf(searchElement /* , fromIndex */) { // eslint-disable-line no-unused-vars - return arrayLastIndexOf.apply(validate(this), arguments); - }, - map: function map(mapfn /* , thisArg */) { - return $map(validate(this), mapfn, arguments.length > 1 ? arguments[1] : undefined); - }, - reduce: function reduce(callbackfn /* , initialValue */) { // eslint-disable-line no-unused-vars - return arrayReduce.apply(validate(this), arguments); - }, - reduceRight: function reduceRight(callbackfn /* , initialValue */) { // eslint-disable-line no-unused-vars - return arrayReduceRight.apply(validate(this), arguments); - }, - reverse: function reverse() { - var that = this; - var length = validate(that).length; - var middle = Math.floor(length / 2); - var index = 0; - var value; - while (index < middle) { - value = that[index]; - that[index++] = that[--length]; - that[length] = value; - } return that; - }, - some: function some(callbackfn /* , thisArg */) { - return arraySome(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); - }, - sort: function sort(comparefn) { - return arraySort.call(validate(this), comparefn); - }, - subarray: function subarray(begin, end) { - var O = validate(this); - var length = O.length; - var $begin = toAbsoluteIndex(begin, length); - return new (speciesConstructor(O, O[DEF_CONSTRUCTOR]))( - O.buffer, - O.byteOffset + $begin * O.BYTES_PER_ELEMENT, - toLength((end === undefined ? length : toAbsoluteIndex(end, length)) - $begin) - ); - } - }; - - var $slice = function slice(start, end) { - return speciesFromList(this, arraySlice.call(validate(this), start, end)); - }; - - var $set = function set(arrayLike /* , offset */) { - validate(this); - var offset = toOffset(arguments[1], 1); - var length = this.length; - var src = toObject(arrayLike); - var len = toLength(src.length); - var index = 0; - if (len + offset > length) throw RangeError(WRONG_LENGTH); - while (index < len) this[offset + index] = src[index++]; - }; - - var $iterators = { - entries: function entries() { - return arrayEntries.call(validate(this)); - }, - keys: function keys() { - return arrayKeys.call(validate(this)); - }, - values: function values() { - return arrayValues.call(validate(this)); - } - }; - - var isTAIndex = function (target, key) { - return isObject(target) - && target[TYPED_ARRAY] - && typeof key != 'symbol' - && key in target - && String(+key) == String(key); - }; - var $getDesc = function getOwnPropertyDescriptor(target, key) { - return isTAIndex(target, key = toPrimitive(key, true)) - ? propertyDesc(2, target[key]) - : gOPD(target, key); - }; - var $setDesc = function defineProperty(target, key, desc) { - if (isTAIndex(target, key = toPrimitive(key, true)) - && isObject(desc) - && has(desc, 'value') - && !has(desc, 'get') - && !has(desc, 'set') - // TODO: add validation descriptor w/o calling accessors - && !desc.configurable - && (!has(desc, 'writable') || desc.writable) - && (!has(desc, 'enumerable') || desc.enumerable) - ) { - target[key] = desc.value; - return target; - } return dP(target, key, desc); - }; - - if (!ALL_CONSTRUCTORS) { - $GOPD.f = $getDesc; - $DP.f = $setDesc; - } - - $export($export.S + $export.F * !ALL_CONSTRUCTORS, 'Object', { - getOwnPropertyDescriptor: $getDesc, - defineProperty: $setDesc - }); - - if (fails(function () { arrayToString.call({}); })) { - arrayToString = arrayToLocaleString = function toString() { - return arrayJoin.call(this); - }; - } - - var $TypedArrayPrototype$ = redefineAll({}, proto); - redefineAll($TypedArrayPrototype$, $iterators); - hide($TypedArrayPrototype$, ITERATOR, $iterators.values); - redefineAll($TypedArrayPrototype$, { - slice: $slice, - set: $set, - constructor: function () { /* noop */ }, - toString: arrayToString, - toLocaleString: $toLocaleString - }); - addGetter($TypedArrayPrototype$, 'buffer', 'b'); - addGetter($TypedArrayPrototype$, 'byteOffset', 'o'); - addGetter($TypedArrayPrototype$, 'byteLength', 'l'); - addGetter($TypedArrayPrototype$, 'length', 'e'); - dP($TypedArrayPrototype$, TAG, { - get: function () { return this[TYPED_ARRAY]; } - }); - - // eslint-disable-next-line max-statements - module.exports = function (KEY, BYTES, wrapper, CLAMPED) { - CLAMPED = !!CLAMPED; - var NAME = KEY + (CLAMPED ? 'Clamped' : '') + 'Array'; - var GETTER = 'get' + KEY; - var SETTER = 'set' + KEY; - var TypedArray = global[NAME]; - var Base = TypedArray || {}; - var TAC = TypedArray && getPrototypeOf(TypedArray); - var FORCED = !TypedArray || !$typed.ABV; - var O = {}; - var TypedArrayPrototype = TypedArray && TypedArray[PROTOTYPE]; - var getter = function (that, index) { - var data = that._d; - return data.v[GETTER](index * BYTES + data.o, LITTLE_ENDIAN); - }; - var setter = function (that, index, value) { - var data = that._d; - if (CLAMPED) value = (value = Math.round(value)) < 0 ? 0 : value > 0xff ? 0xff : value & 0xff; - data.v[SETTER](index * BYTES + data.o, value, LITTLE_ENDIAN); - }; - var addElement = function (that, index) { - dP(that, index, { - get: function () { - return getter(this, index); - }, - set: function (value) { - return setter(this, index, value); - }, - enumerable: true - }); - }; - if (FORCED) { - TypedArray = wrapper(function (that, data, $offset, $length) { - anInstance(that, TypedArray, NAME, '_d'); - var index = 0; - var offset = 0; - var buffer, byteLength, length, klass; - if (!isObject(data)) { - length = toIndex(data); - byteLength = length * BYTES; - buffer = new $ArrayBuffer(byteLength); - } else if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) { - buffer = data; - offset = toOffset($offset, BYTES); - var $len = data.byteLength; - if ($length === undefined) { - if ($len % BYTES) throw RangeError(WRONG_LENGTH); - byteLength = $len - offset; - if (byteLength < 0) throw RangeError(WRONG_LENGTH); - } else { - byteLength = toLength($length) * BYTES; - if (byteLength + offset > $len) throw RangeError(WRONG_LENGTH); - } - length = byteLength / BYTES; - } else if (TYPED_ARRAY in data) { - return fromList(TypedArray, data); - } else { - return $from.call(TypedArray, data); - } - hide(that, '_d', { - b: buffer, - o: offset, - l: byteLength, - e: length, - v: new $DataView(buffer) - }); - while (index < length) addElement(that, index++); - }); - TypedArrayPrototype = TypedArray[PROTOTYPE] = create($TypedArrayPrototype$); - hide(TypedArrayPrototype, 'constructor', TypedArray); - } else if (!fails(function () { - TypedArray(1); - }) || !fails(function () { - new TypedArray(-1); // eslint-disable-line no-new - }) || !$iterDetect(function (iter) { - new TypedArray(); // eslint-disable-line no-new - new TypedArray(null); // eslint-disable-line no-new - new TypedArray(1.5); // eslint-disable-line no-new - new TypedArray(iter); // eslint-disable-line no-new - }, true)) { - TypedArray = wrapper(function (that, data, $offset, $length) { - anInstance(that, TypedArray, NAME); - var klass; - // `ws` module bug, temporarily remove validation length for Uint8Array - // https://github.com/websockets/ws/pull/645 - if (!isObject(data)) return new Base(toIndex(data)); - if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) { - return $length !== undefined - ? new Base(data, toOffset($offset, BYTES), $length) - : $offset !== undefined - ? new Base(data, toOffset($offset, BYTES)) - : new Base(data); - } - if (TYPED_ARRAY in data) return fromList(TypedArray, data); - return $from.call(TypedArray, data); - }); - arrayForEach(TAC !== Function.prototype ? gOPN(Base).concat(gOPN(TAC)) : gOPN(Base), function (key) { - if (!(key in TypedArray)) hide(TypedArray, key, Base[key]); - }); - TypedArray[PROTOTYPE] = TypedArrayPrototype; - if (!LIBRARY) TypedArrayPrototype.constructor = TypedArray; - } - var $nativeIterator = TypedArrayPrototype[ITERATOR]; - var CORRECT_ITER_NAME = !!$nativeIterator - && ($nativeIterator.name == 'values' || $nativeIterator.name == undefined); - var $iterator = $iterators.values; - hide(TypedArray, TYPED_CONSTRUCTOR, true); - hide(TypedArrayPrototype, TYPED_ARRAY, NAME); - hide(TypedArrayPrototype, VIEW, true); - hide(TypedArrayPrototype, DEF_CONSTRUCTOR, TypedArray); - - if (CLAMPED ? new TypedArray(1)[TAG] != NAME : !(TAG in TypedArrayPrototype)) { - dP(TypedArrayPrototype, TAG, { - get: function () { return NAME; } - }); - } - - O[NAME] = TypedArray; - - $export($export.G + $export.W + $export.F * (TypedArray != Base), O); - - $export($export.S, NAME, { - BYTES_PER_ELEMENT: BYTES - }); - - $export($export.S + $export.F * fails(function () { Base.of.call(TypedArray, 1); }), NAME, { - from: $from, - of: $of - }); - - if (!(BYTES_PER_ELEMENT in TypedArrayPrototype)) hide(TypedArrayPrototype, BYTES_PER_ELEMENT, BYTES); - - $export($export.P, NAME, proto); - - setSpecies(NAME); - - $export($export.P + $export.F * FORCED_SET, NAME, { set: $set }); - - $export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators); - - if (!LIBRARY && TypedArrayPrototype.toString != arrayToString) TypedArrayPrototype.toString = arrayToString; - - $export($export.P + $export.F * fails(function () { - new TypedArray(1).slice(); - }), NAME, { slice: $slice }); - - $export($export.P + $export.F * (fails(function () { - return [1, 2].toLocaleString() != new TypedArray([1, 2]).toLocaleString(); - }) || !fails(function () { - TypedArrayPrototype.toLocaleString.call([1, 2]); - })), NAME, { toLocaleString: $toLocaleString }); - - Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator; - if (!LIBRARY && !CORRECT_ITER_NAME) hide(TypedArrayPrototype, ITERATOR, $iterator); - }; - } else module.exports = function () { /* empty */ }; - }); - - _typedArray('Uint8', 1, function (init) { - return function Uint8Array(data, byteOffset, length) { - return init(this, data, byteOffset, length); - }; - }); - - var $map = _arrayMethods(1); - - _export(_export.P + _export.F * !_strictMethod([].map, true), 'Array', { - // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg]) - map: function map(callbackfn /* , thisArg */) { - return $map(this, callbackfn, arguments[1]); - } - }); - - // 22.1.2.2 / 15.4.3.2 Array.isArray(arg) - - - _export(_export.S, 'Array', { isArray: _isArray }); - - // 21.2.5.3 get RegExp.prototype.flags() - if (_descriptors && /./g.flags != 'g') _objectDp.f(RegExp.prototype, 'flags', { - configurable: true, - get: _flags - }); - - var TO_STRING = 'toString'; - var $toString = /./[TO_STRING]; - - var define = function (fn) { - _redefine(RegExp.prototype, TO_STRING, fn, true); - }; - - // 21.2.5.14 RegExp.prototype.toString() - if (_fails(function () { return $toString.call({ source: 'a', flags: 'b' }) != '/a/b'; })) { - define(function toString() { - var R = _anObject(this); - return '/'.concat(R.source, '/', - 'flags' in R ? R.flags : !_descriptors && R instanceof RegExp ? _flags.call(R) : undefined); - }); - // FF44- RegExp#toString has a wrong name - } else if ($toString.name != TO_STRING) { - define(function toString() { - return $toString.call(this); - }); - } - - var DateProto = Date.prototype; - var INVALID_DATE = 'Invalid Date'; - var TO_STRING$1 = 'toString'; - var $toString$1 = DateProto[TO_STRING$1]; - var getTime = DateProto.getTime; - if (new Date(NaN) + '' != INVALID_DATE) { - _redefine(DateProto, TO_STRING$1, function toString() { - var value = getTime.call(this); - // eslint-disable-next-line no-self-compare - return value === value ? $toString$1.call(this) : INVALID_DATE; - }); - } - - var $indexOf = _arrayIncludes(false); - var $native = [].indexOf; - var NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0; - - _export(_export.P + _export.F * (NEGATIVE_ZERO || !_strictMethod($native)), 'Array', { - // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex]) - indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { - return NEGATIVE_ZERO - // convert -0 to +0 - ? $native.apply(this, arguments) || 0 - : $indexOf(this, searchElement, arguments[1]); - } - }); - - _export(_export.G + _export.W + _export.F * !_typed.ABV, { - DataView: _typedBuffer.DataView - }); - - var browserPonyfill = createCommonjsModule(function (module, exports) { - var __self__ = function (root) { - function F() { - this.fetch = false; - } - - F.prototype = root; - return new F(); - }(typeof self !== 'undefined' ? self : commonjsGlobal); - - (function (self) { - var irrelevant = function (exports) { - var support = { - searchParams: 'URLSearchParams' in self, - iterable: 'Symbol' in self && 'iterator' in Symbol, - blob: 'FileReader' in self && 'Blob' in self && function () { - try { - new Blob(); - return true; - } catch (e) { - return false; - } - }(), - formData: 'FormData' in self, - arrayBuffer: 'ArrayBuffer' in self - }; - - function isDataView(obj) { - return obj && DataView.prototype.isPrototypeOf(obj); - } - - if (support.arrayBuffer) { - var viewClasses = ['[object Int8Array]', '[object Uint8Array]', '[object Uint8ClampedArray]', '[object Int16Array]', '[object Uint16Array]', '[object Int32Array]', '[object Uint32Array]', '[object Float32Array]', '[object Float64Array]']; - - var isArrayBufferView = ArrayBuffer.isView || function (obj) { - return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1; - }; - } - - function normalizeName(name) { - if (typeof name !== 'string') { - name = String(name); - } - - if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) { - throw new TypeError('Invalid character in header field name'); - } - - return name.toLowerCase(); - } - - function normalizeValue(value) { - if (typeof value !== 'string') { - value = String(value); - } - - return value; - } // Build a destructive iterator for the value list - - - function iteratorFor(items) { - var iterator = { - next: function next() { - var value = items.shift(); - return { - done: value === undefined, - value: value - }; - } - }; - - if (support.iterable) { - iterator[Symbol.iterator] = function () { - return iterator; - }; - } - - return iterator; - } - - function Headers(headers) { - this.map = {}; - - if (headers instanceof Headers) { - headers.forEach(function (value, name) { - this.append(name, value); - }, this); - } else if (Array.isArray(headers)) { - headers.forEach(function (header) { - this.append(header[0], header[1]); - }, this); - } else if (headers) { - Object.getOwnPropertyNames(headers).forEach(function (name) { - this.append(name, headers[name]); - }, this); - } - } - - Headers.prototype.append = function (name, value) { - name = normalizeName(name); - value = normalizeValue(value); - var oldValue = this.map[name]; - this.map[name] = oldValue ? oldValue + ', ' + value : value; - }; - - Headers.prototype['delete'] = function (name) { - delete this.map[normalizeName(name)]; - }; - - Headers.prototype.get = function (name) { - name = normalizeName(name); - return this.has(name) ? this.map[name] : null; - }; - - Headers.prototype.has = function (name) { - return this.map.hasOwnProperty(normalizeName(name)); - }; - - Headers.prototype.set = function (name, value) { - this.map[normalizeName(name)] = normalizeValue(value); - }; - - Headers.prototype.forEach = function (callback, thisArg) { - for (var name in this.map) { - if (this.map.hasOwnProperty(name)) { - callback.call(thisArg, this.map[name], name, this); - } - } - }; - - Headers.prototype.keys = function () { - var items = []; - this.forEach(function (value, name) { - items.push(name); - }); - return iteratorFor(items); - }; - - Headers.prototype.values = function () { - var items = []; - this.forEach(function (value) { - items.push(value); - }); - return iteratorFor(items); - }; - - Headers.prototype.entries = function () { - var items = []; - this.forEach(function (value, name) { - items.push([name, value]); - }); - return iteratorFor(items); - }; - - if (support.iterable) { - Headers.prototype[Symbol.iterator] = Headers.prototype.entries; - } - - function consumed(body) { - if (body.bodyUsed) { - return Promise.reject(new TypeError('Already read')); - } - - body.bodyUsed = true; - } - - function fileReaderReady(reader) { - return new Promise(function (resolve, reject) { - reader.onload = function () { - resolve(reader.result); - }; - - reader.onerror = function () { - reject(reader.error); - }; - }); - } - - function readBlobAsArrayBuffer(blob) { - var reader = new FileReader(); - var promise = fileReaderReady(reader); - reader.readAsArrayBuffer(blob); - return promise; - } - - function readBlobAsText(blob) { - var reader = new FileReader(); - var promise = fileReaderReady(reader); - reader.readAsText(blob); - return promise; - } - - function readArrayBufferAsText(buf) { - var view = new Uint8Array(buf); - var chars = new Array(view.length); - - for (var i = 0; i < view.length; i++) { - chars[i] = String.fromCharCode(view[i]); - } - - return chars.join(''); - } - - function bufferClone(buf) { - if (buf.slice) { - return buf.slice(0); - } else { - var view = new Uint8Array(buf.byteLength); - view.set(new Uint8Array(buf)); - return view.buffer; - } - } - - function Body() { - this.bodyUsed = false; - - this._initBody = function (body) { - this._bodyInit = body; - - if (!body) { - this._bodyText = ''; - } else if (typeof body === 'string') { - this._bodyText = body; - } else if (support.blob && Blob.prototype.isPrototypeOf(body)) { - this._bodyBlob = body; - } else if (support.formData && FormData.prototype.isPrototypeOf(body)) { - this._bodyFormData = body; - } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { - this._bodyText = body.toString(); - } else if (support.arrayBuffer && support.blob && isDataView(body)) { - this._bodyArrayBuffer = bufferClone(body.buffer); // IE 10-11 can't handle a DataView body. - - this._bodyInit = new Blob([this._bodyArrayBuffer]); - } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { - this._bodyArrayBuffer = bufferClone(body); - } else { - this._bodyText = body = Object.prototype.toString.call(body); - } - - if (!this.headers.get('content-type')) { - if (typeof body === 'string') { - this.headers.set('content-type', 'text/plain;charset=UTF-8'); - } else if (this._bodyBlob && this._bodyBlob.type) { - this.headers.set('content-type', this._bodyBlob.type); - } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { - this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8'); - } - } - }; - - if (support.blob) { - this.blob = function () { - var rejected = consumed(this); - - if (rejected) { - return rejected; - } - - if (this._bodyBlob) { - return Promise.resolve(this._bodyBlob); - } else if (this._bodyArrayBuffer) { - return Promise.resolve(new Blob([this._bodyArrayBuffer])); - } else if (this._bodyFormData) { - throw new Error('could not read FormData body as blob'); - } else { - return Promise.resolve(new Blob([this._bodyText])); - } - }; - - this.arrayBuffer = function () { - if (this._bodyArrayBuffer) { - return consumed(this) || Promise.resolve(this._bodyArrayBuffer); - } else { - return this.blob().then(readBlobAsArrayBuffer); - } - }; - } - - this.text = function () { - var rejected = consumed(this); - - if (rejected) { - return rejected; - } - - if (this._bodyBlob) { - return readBlobAsText(this._bodyBlob); - } else if (this._bodyArrayBuffer) { - return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer)); - } else if (this._bodyFormData) { - throw new Error('could not read FormData body as text'); - } else { - return Promise.resolve(this._bodyText); - } - }; - - if (support.formData) { - this.formData = function () { - return this.text().then(decode); - }; - } - - this.json = function () { - return this.text().then(JSON.parse); - }; - - return this; - } // HTTP methods whose capitalization should be normalized - - - var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']; - - function normalizeMethod(method) { - var upcased = method.toUpperCase(); - return methods.indexOf(upcased) > -1 ? upcased : method; - } - - function Request(input, options) { - options = options || {}; - var body = options.body; - - if (input instanceof Request) { - if (input.bodyUsed) { - throw new TypeError('Already read'); - } - - this.url = input.url; - this.credentials = input.credentials; - - if (!options.headers) { - this.headers = new Headers(input.headers); - } - - this.method = input.method; - this.mode = input.mode; - this.signal = input.signal; - - if (!body && input._bodyInit != null) { - body = input._bodyInit; - input.bodyUsed = true; - } - } else { - this.url = String(input); - } - - this.credentials = options.credentials || this.credentials || 'same-origin'; - - if (options.headers || !this.headers) { - this.headers = new Headers(options.headers); - } - - this.method = normalizeMethod(options.method || this.method || 'GET'); - this.mode = options.mode || this.mode || null; - this.signal = options.signal || this.signal; - this.referrer = null; - - if ((this.method === 'GET' || this.method === 'HEAD') && body) { - throw new TypeError('Body not allowed for GET or HEAD requests'); - } - - this._initBody(body); - } - - Request.prototype.clone = function () { - return new Request(this, { - body: this._bodyInit - }); - }; - - function decode(body) { - var form = new FormData(); - body.trim().split('&').forEach(function (bytes) { - if (bytes) { - var split = bytes.split('='); - var name = split.shift().replace(/\+/g, ' '); - var value = split.join('=').replace(/\+/g, ' '); - form.append(decodeURIComponent(name), decodeURIComponent(value)); - } - }); - return form; - } - - function parseHeaders(rawHeaders) { - var headers = new Headers(); // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space - // https://tools.ietf.org/html/rfc7230#section-3.2 - - var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' '); - preProcessedHeaders.split(/\r?\n/).forEach(function (line) { - var parts = line.split(':'); - var key = parts.shift().trim(); - - if (key) { - var value = parts.join(':').trim(); - headers.append(key, value); - } - }); - return headers; - } - - Body.call(Request.prototype); - - function Response(bodyInit, options) { - if (!options) { - options = {}; - } - - this.type = 'default'; - this.status = options.status === undefined ? 200 : options.status; - this.ok = this.status >= 200 && this.status < 300; - this.statusText = 'statusText' in options ? options.statusText : 'OK'; - this.headers = new Headers(options.headers); - this.url = options.url || ''; - - this._initBody(bodyInit); - } - - Body.call(Response.prototype); - - Response.prototype.clone = function () { - return new Response(this._bodyInit, { - status: this.status, - statusText: this.statusText, - headers: new Headers(this.headers), - url: this.url - }); - }; - - Response.error = function () { - var response = new Response(null, { - status: 0, - statusText: '' - }); - response.type = 'error'; - return response; - }; - - var redirectStatuses = [301, 302, 303, 307, 308]; - - Response.redirect = function (url, status) { - if (redirectStatuses.indexOf(status) === -1) { - throw new RangeError('Invalid status code'); - } - - return new Response(null, { - status: status, - headers: { - location: url - } - }); - }; - - exports.DOMException = self.DOMException; - - try { - new exports.DOMException(); - } catch (err) { - exports.DOMException = function (message, name) { - this.message = message; - this.name = name; - var error = Error(message); - this.stack = error.stack; - }; - - exports.DOMException.prototype = Object.create(Error.prototype); - exports.DOMException.prototype.constructor = exports.DOMException; - } - - function fetch(input, init) { - return new Promise(function (resolve, reject) { - var request = new Request(input, init); - - if (request.signal && request.signal.aborted) { - return reject(new exports.DOMException('Aborted', 'AbortError')); - } - - var xhr = new XMLHttpRequest(); - - function abortXhr() { - xhr.abort(); - } - - xhr.onload = function () { - var options = { - status: xhr.status, - statusText: xhr.statusText, - headers: parseHeaders(xhr.getAllResponseHeaders() || '') - }; - options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL'); - var body = 'response' in xhr ? xhr.response : xhr.responseText; - resolve(new Response(body, options)); - }; - - xhr.onerror = function () { - reject(new TypeError('Network request failed')); - }; - - xhr.ontimeout = function () { - reject(new TypeError('Network request failed')); - }; - - xhr.onabort = function () { - reject(new exports.DOMException('Aborted', 'AbortError')); - }; - - xhr.open(request.method, request.url, true); - - if (request.credentials === 'include') { - xhr.withCredentials = true; - } else if (request.credentials === 'omit') { - xhr.withCredentials = false; - } - - if ('responseType' in xhr && support.blob) { - xhr.responseType = 'blob'; - } - - request.headers.forEach(function (value, name) { - xhr.setRequestHeader(name, value); - }); - - if (request.signal) { - request.signal.addEventListener('abort', abortXhr); - - xhr.onreadystatechange = function () { - // DONE (success or failure) - if (xhr.readyState === 4) { - request.signal.removeEventListener('abort', abortXhr); - } - }; - } - - xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit); - }); - } - - fetch.polyfill = true; - - if (!self.fetch) { - self.fetch = fetch; - self.Headers = Headers; - self.Request = Request; - self.Response = Response; - } - - exports.Headers = Headers; - exports.Request = Request; - exports.Response = Response; - exports.fetch = fetch; - return exports; - }({}); - })(__self__); - - delete __self__.fetch.polyfill; - exports = __self__.fetch; // To enable: import fetch from 'cross-fetch' - - exports.default = __self__.fetch; // For TypeScript consumers without esModuleInterop. - - exports.fetch = __self__.fetch; // To enable: import {fetch} from 'cross-fetch' - - exports.Headers = __self__.Headers; - exports.Request = __self__.Request; - exports.Response = __self__.Response; - module.exports = exports; - }); - var browserPonyfill_1 = browserPonyfill.fetch; - var browserPonyfill_2 = browserPonyfill.Headers; - var browserPonyfill_3 = browserPonyfill.Request; - var browserPonyfill_4 = browserPonyfill.Response; - - var setPrototypeOf = _setProto.set; - var _inheritIfRequired = function (that, target, C) { - var S = target.constructor; - var P; - if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && _isObject(P) && setPrototypeOf) { - setPrototypeOf(that, P); - } return that; - }; - - var gOPN$2 = _objectGopn.f; - var gOPD$2 = _objectGopd.f; - var dP$3 = _objectDp.f; - var $trim = _stringTrim.trim; - var NUMBER = 'Number'; - var $Number = _global[NUMBER]; - var Base = $Number; - var proto$1 = $Number.prototype; - // Opera ~12 has broken Object#toString - var BROKEN_COF = _cof(_objectCreate(proto$1)) == NUMBER; - var TRIM = 'trim' in String.prototype; - - // 7.1.3 ToNumber(argument) - var toNumber = function (argument) { - var it = _toPrimitive(argument, false); - if (typeof it == 'string' && it.length > 2) { - it = TRIM ? it.trim() : $trim(it, 3); - var first = it.charCodeAt(0); - var third, radix, maxCode; - if (first === 43 || first === 45) { - third = it.charCodeAt(2); - if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix - } else if (first === 48) { - switch (it.charCodeAt(1)) { - case 66: case 98: radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i - case 79: case 111: radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i - default: return +it; - } - for (var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++) { - code = digits.charCodeAt(i); - // parseInt parses a string to a first unavailable symbol - // but ToNumber should return NaN if a string contains unavailable symbols - if (code < 48 || code > maxCode) return NaN; - } return parseInt(digits, radix); - } - } return +it; - }; - - if (!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')) { - $Number = function Number(value) { - var it = arguments.length < 1 ? 0 : value; - var that = this; - return that instanceof $Number - // check on 1..constructor(foo) case - && (BROKEN_COF ? _fails(function () { proto$1.valueOf.call(that); }) : _cof(that) != NUMBER) - ? _inheritIfRequired(new Base(toNumber(it)), that, $Number) : toNumber(it); - }; - for (var keys = _descriptors ? gOPN$2(Base) : ( - // ES3: - 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + - // ES6 (in case, if modules with ES6 Number statics required before): - 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + - 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger' - ).split(','), j$1 = 0, key$1; keys.length > j$1; j$1++) { - if (_has(Base, key$1 = keys[j$1]) && !_has($Number, key$1)) { - dP$3($Number, key$1, gOPD$2(Base, key$1)); - } - } - $Number.prototype = proto$1; - proto$1.constructor = $Number; - _redefine(_global, NUMBER, $Number); - } - - var $parseFloat = _global.parseFloat; - var $trim$1 = _stringTrim.trim; - - var _parseFloat = 1 / $parseFloat(_stringWs + '-0') !== -Infinity ? function parseFloat(str) { - var string = $trim$1(String(str), 3); - var result = $parseFloat(string); - return result === 0 && string.charAt(0) == '-' ? -0 : result; - } : $parseFloat; - - // 20.1.2.12 Number.parseFloat(string) - _export(_export.S + _export.F * (Number.parseFloat != _parseFloat), 'Number', { parseFloat: _parseFloat }); - - // most Object methods by ES6 should accept primitives - - - - var _objectSap = function (KEY, exec) { - var fn = (_core.Object || {})[KEY] || Object[KEY]; - var exp = {}; - exp[KEY] = exec(fn); - _export(_export.S + _export.F * _fails(function () { fn(1); }), 'Object', exp); - }; - - // 19.1.2.14 Object.keys(O) - - - - _objectSap('keys', function () { - return function keys(it) { - return _objectKeys(_toObject(it)); - }; - }); - - var _arrayReduce = function (that, callbackfn, aLen, memo, isRight) { - _aFunction(callbackfn); - var O = _toObject(that); - var self = _iobject(O); - var length = _toLength(O.length); - var index = isRight ? length - 1 : 0; - var i = isRight ? -1 : 1; - if (aLen < 2) for (;;) { - if (index in self) { - memo = self[index]; - index += i; - break; - } - index += i; - if (isRight ? index < 0 : length <= index) { - throw TypeError('Reduce of empty array with no initial value'); - } - } - for (;isRight ? index >= 0 : length > index; index += i) if (index in self) { - memo = callbackfn(memo, self[index], index, O); - } - return memo; - }; - - _export(_export.P + _export.F * !_strictMethod([].reduce, true), 'Array', { - // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue]) - reduce: function reduce(callbackfn /* , initialValue */) { - return _arrayReduce(this, callbackfn, arguments.length, arguments[1], false); - } - }); - - // 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined) - - var $find = _arrayMethods(5); - var KEY = 'find'; - var forced = true; - // Shouldn't skip holes - if (KEY in []) Array(1)[KEY](function () { forced = false; }); - _export(_export.P + _export.F * forced, 'Array', { - find: function find(callbackfn /* , that = undefined */) { - return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - } - }); - _addToUnscopables(KEY); - - var $filter = _arrayMethods(2); - - _export(_export.P + _export.F * !_strictMethod([].filter, true), 'Array', { - // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg]) - filter: function filter(callbackfn /* , thisArg */) { - return $filter(this, callbackfn, arguments[1]); - } - }); - - var $at = _stringAt(true); - - // 21.1.3.27 String.prototype[@@iterator]() - _iterDefine(String, 'String', function (iterated) { - this._t = String(iterated); // target - this._i = 0; // next index - // 21.1.5.2.1 %StringIteratorPrototype%.next() - }, function () { - var O = this._t; - var index = this._i; - var point; - if (index >= O.length) return { value: undefined, done: true }; - point = $at(O, index); - this._i += point.length; - return { value: point, done: false }; - }); - - var _createProperty = function (object, index, value) { - if (index in object) _objectDp.f(object, index, _propertyDesc(0, value)); - else object[index] = value; - }; - - _export(_export.S + _export.F * !_iterDetect(function (iter) { }), 'Array', { - // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) - from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { - var O = _toObject(arrayLike); - var C = typeof this == 'function' ? this : Array; - var aLen = arguments.length; - var mapfn = aLen > 1 ? arguments[1] : undefined; - var mapping = mapfn !== undefined; - var index = 0; - var iterFn = core_getIteratorMethod(O); - var length, result, step, iterator; - if (mapping) mapfn = _ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); - // if object isn't iterable or it's array with default iterator - use simple case - if (iterFn != undefined && !(C == Array && _isArrayIter(iterFn))) { - for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) { - _createProperty(result, index, mapping ? _iterCall(iterator, mapfn, [step.value, index], true) : step.value); - } - } else { - length = _toLength(O.length); - for (result = new C(length); length > index; index++) { - _createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); - } - } - result.length = index; - return result; - } - }); - - function _isPlaceholder(a) { - return a != null && _typeof(a) === 'object' && a['@@functional/placeholder'] === true; - } - - /** - * Optimized internal one-arity curry function. - * - * @private - * @category Function - * @param {Function} fn The function to curry. - * @return {Function} The curried function. - */ - - function _curry1(fn) { - return function f1(a) { - if (arguments.length === 0 || _isPlaceholder(a)) { - return f1; - } else { - return fn.apply(this, arguments); - } - }; - } - - /** - * Returns a function that always returns the given value. Note that for - * non-primitives the value returned is a reference to the original value. - * - * This function is known as `const`, `constant`, or `K` (for K combinator) in - * other languages and libraries. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Function - * @sig a -> (* -> a) - * @param {*} val The value to wrap in a function - * @return {Function} A Function :: * -> val. - * @example - * - * var t = R.always('Tee'); - * t(); //=> 'Tee' - */ - - var always = - /*#__PURE__*/ - _curry1(function always(val) { - return function () { - return val; - }; - }); - - /** - * A function that always returns `false`. Any passed in parameters are ignored. - * - * @func - * @memberOf R - * @since v0.9.0 - * @category Function - * @sig * -> Boolean - * @param {*} - * @return {Boolean} - * @see R.always, R.T - * @example - * - * R.F(); //=> false - */ - - var F = - /*#__PURE__*/ - always(false); - - /** - * A function that always returns `true`. Any passed in parameters are ignored. - * - * @func - * @memberOf R - * @since v0.9.0 - * @category Function - * @sig * -> Boolean - * @param {*} - * @return {Boolean} - * @see R.always, R.F - * @example - * - * R.T(); //=> true - */ - - var T = - /*#__PURE__*/ - always(true); - - /** - * A special placeholder value used to specify "gaps" within curried functions, - * allowing partial application of any combination of arguments, regardless of - * their positions. - * - * If `g` is a curried ternary function and `_` is `R.__`, the following are - * equivalent: - * - * - `g(1, 2, 3)` - * - `g(_, 2, 3)(1)` - * - `g(_, _, 3)(1)(2)` - * - `g(_, _, 3)(1, 2)` - * - `g(_, 2, _)(1, 3)` - * - `g(_, 2)(1)(3)` - * - `g(_, 2)(1, 3)` - * - `g(_, 2)(_, 3)(1)` - * - * @constant - * @memberOf R - * @since v0.6.0 - * @category Function - * @example - * - * var greet = R.replace('{name}', R.__, 'Hello, {name}!'); - * greet('Alice'); //=> 'Hello, Alice!' - */ - - /** - * Optimized internal two-arity curry function. - * - * @private - * @category Function - * @param {Function} fn The function to curry. - * @return {Function} The curried function. - */ - - function _curry2(fn) { - return function f2(a, b) { - switch (arguments.length) { - case 0: - return f2; - - case 1: - return _isPlaceholder(a) ? f2 : _curry1(function (_b) { - return fn(a, _b); - }); - - default: - return _isPlaceholder(a) && _isPlaceholder(b) ? f2 : _isPlaceholder(a) ? _curry1(function (_a) { - return fn(_a, b); - }) : _isPlaceholder(b) ? _curry1(function (_b) { - return fn(a, _b); - }) : fn(a, b); - } - }; - } - - /** - * Adds two values. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Math - * @sig Number -> Number -> Number - * @param {Number} a - * @param {Number} b - * @return {Number} - * @see R.subtract - * @example - * - * R.add(2, 3); //=> 5 - * R.add(7)(10); //=> 17 - */ - - var add = - /*#__PURE__*/ - _curry2(function add(a, b) { - return Number(a) + Number(b); - }); - - /** - * Private `concat` function to merge two array-like objects. - * - * @private - * @param {Array|Arguments} [set1=[]] An array-like object. - * @param {Array|Arguments} [set2=[]] An array-like object. - * @return {Array} A new, merged array. - * @example - * - * _concat([4, 5, 6], [1, 2, 3]); //=> [4, 5, 6, 1, 2, 3] - */ - function _concat(set1, set2) { - set1 = set1 || []; - set2 = set2 || []; - var idx; - var len1 = set1.length; - var len2 = set2.length; - var result = []; - idx = 0; - - while (idx < len1) { - result[result.length] = set1[idx]; - idx += 1; - } - - idx = 0; - - while (idx < len2) { - result[result.length] = set2[idx]; - idx += 1; - } - - return result; - } - - function _arity(n, fn) { - /* eslint-disable no-unused-vars */ - switch (n) { - case 0: - return function () { - return fn.apply(this, arguments); - }; - - case 1: - return function (a0) { - return fn.apply(this, arguments); - }; - - case 2: - return function (a0, a1) { - return fn.apply(this, arguments); - }; - - case 3: - return function (a0, a1, a2) { - return fn.apply(this, arguments); - }; - - case 4: - return function (a0, a1, a2, a3) { - return fn.apply(this, arguments); - }; - - case 5: - return function (a0, a1, a2, a3, a4) { - return fn.apply(this, arguments); - }; - - case 6: - return function (a0, a1, a2, a3, a4, a5) { - return fn.apply(this, arguments); - }; - - case 7: - return function (a0, a1, a2, a3, a4, a5, a6) { - return fn.apply(this, arguments); - }; - - case 8: - return function (a0, a1, a2, a3, a4, a5, a6, a7) { - return fn.apply(this, arguments); - }; - - case 9: - return function (a0, a1, a2, a3, a4, a5, a6, a7, a8) { - return fn.apply(this, arguments); - }; - - case 10: - return function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) { - return fn.apply(this, arguments); - }; - - default: - throw new Error('First argument to _arity must be a non-negative integer no greater than ten'); - } - } - - /** - * Internal curryN function. - * - * @private - * @category Function - * @param {Number} length The arity of the curried function. - * @param {Array} received An array of arguments received thus far. - * @param {Function} fn The function to curry. - * @return {Function} The curried function. - */ - - function _curryN(length, received, fn) { - return function () { - var combined = []; - var argsIdx = 0; - var left = length; - var combinedIdx = 0; - - while (combinedIdx < received.length || argsIdx < arguments.length) { - var result; - - if (combinedIdx < received.length && (!_isPlaceholder(received[combinedIdx]) || argsIdx >= arguments.length)) { - result = received[combinedIdx]; - } else { - result = arguments[argsIdx]; - argsIdx += 1; - } - - combined[combinedIdx] = result; - - if (!_isPlaceholder(result)) { - left -= 1; - } - - combinedIdx += 1; - } - - return left <= 0 ? fn.apply(this, combined) : _arity(left, _curryN(length, combined, fn)); - }; - } - - /** - * Returns a curried equivalent of the provided function, with the specified - * arity. The curried function has two unusual capabilities. First, its - * arguments needn't be provided one at a time. If `g` is `R.curryN(3, f)`, the - * following are equivalent: - * - * - `g(1)(2)(3)` - * - `g(1)(2, 3)` - * - `g(1, 2)(3)` - * - `g(1, 2, 3)` - * - * Secondly, the special placeholder value [`R.__`](#__) may be used to specify - * "gaps", allowing partial application of any combination of arguments, - * regardless of their positions. If `g` is as above and `_` is [`R.__`](#__), - * the following are equivalent: - * - * - `g(1, 2, 3)` - * - `g(_, 2, 3)(1)` - * - `g(_, _, 3)(1)(2)` - * - `g(_, _, 3)(1, 2)` - * - `g(_, 2)(1)(3)` - * - `g(_, 2)(1, 3)` - * - `g(_, 2)(_, 3)(1)` - * - * @func - * @memberOf R - * @since v0.5.0 - * @category Function - * @sig Number -> (* -> a) -> (* -> a) - * @param {Number} length The arity for the returned function. - * @param {Function} fn The function to curry. - * @return {Function} A new, curried function. - * @see R.curry - * @example - * - * var sumArgs = (...args) => R.sum(args); - * - * var curriedAddFourNumbers = R.curryN(4, sumArgs); - * var f = curriedAddFourNumbers(1, 2); - * var g = f(3); - * g(4); //=> 10 - */ - - var curryN = - /*#__PURE__*/ - _curry2(function curryN(length, fn) { - if (length === 1) { - return _curry1(fn); - } - - return _arity(length, _curryN(length, [], fn)); - }); - - /** - * Optimized internal three-arity curry function. - * - * @private - * @category Function - * @param {Function} fn The function to curry. - * @return {Function} The curried function. - */ - - function _curry3(fn) { - return function f3(a, b, c) { - switch (arguments.length) { - case 0: - return f3; - - case 1: - return _isPlaceholder(a) ? f3 : _curry2(function (_b, _c) { - return fn(a, _b, _c); - }); - - case 2: - return _isPlaceholder(a) && _isPlaceholder(b) ? f3 : _isPlaceholder(a) ? _curry2(function (_a, _c) { - return fn(_a, b, _c); - }) : _isPlaceholder(b) ? _curry2(function (_b, _c) { - return fn(a, _b, _c); - }) : _curry1(function (_c) { - return fn(a, b, _c); - }); - - default: - return _isPlaceholder(a) && _isPlaceholder(b) && _isPlaceholder(c) ? f3 : _isPlaceholder(a) && _isPlaceholder(b) ? _curry2(function (_a, _b) { - return fn(_a, _b, c); - }) : _isPlaceholder(a) && _isPlaceholder(c) ? _curry2(function (_a, _c) { - return fn(_a, b, _c); - }) : _isPlaceholder(b) && _isPlaceholder(c) ? _curry2(function (_b, _c) { - return fn(a, _b, _c); - }) : _isPlaceholder(a) ? _curry1(function (_a) { - return fn(_a, b, c); - }) : _isPlaceholder(b) ? _curry1(function (_b) { - return fn(a, _b, c); - }) : _isPlaceholder(c) ? _curry1(function (_c) { - return fn(a, b, _c); - }) : fn(a, b, c); - } - }; - } - - /** - * Tests whether or not an object is an array. - * - * @private - * @param {*} val The object to test. - * @return {Boolean} `true` if `val` is an array, `false` otherwise. - * @example - * - * _isArray([]); //=> true - * _isArray(null); //=> false - * _isArray({}); //=> false - */ - var _isArray$1 = Array.isArray || function _isArray(val) { - return val != null && val.length >= 0 && Object.prototype.toString.call(val) === '[object Array]'; - }; - - function _isTransformer(obj) { - return typeof obj['@@transducer/step'] === 'function'; - } - - /** - * Returns a function that dispatches with different strategies based on the - * object in list position (last argument). If it is an array, executes [fn]. - * Otherwise, if it has a function with one of the given method names, it will - * execute that function (functor case). Otherwise, if it is a transformer, - * uses transducer [xf] to return a new transformer (transducer case). - * Otherwise, it will default to executing [fn]. - * - * @private - * @param {Array} methodNames properties to check for a custom implementation - * @param {Function} xf transducer to initialize if object is transformer - * @param {Function} fn default ramda implementation - * @return {Function} A function that dispatches on object in list position - */ - - function _dispatchable(methodNames, xf, fn) { - return function () { - if (arguments.length === 0) { - return fn(); - } - - var args = Array.prototype.slice.call(arguments, 0); - var obj = args.pop(); - - if (!_isArray$1(obj)) { - var idx = 0; - - while (idx < methodNames.length) { - if (typeof obj[methodNames[idx]] === 'function') { - return obj[methodNames[idx]].apply(obj, args); - } - - idx += 1; - } - - if (_isTransformer(obj)) { - var transducer = xf.apply(null, args); - return transducer(obj); - } - } - - return fn.apply(this, arguments); - }; - } - - function _reduced(x) { - return x && x['@@transducer/reduced'] ? x : { - '@@transducer/value': x, - '@@transducer/reduced': true - }; - } - - var _xfBase = { - init: function init() { - return this.xf['@@transducer/init'](); - }, - result: function result(_result) { - return this.xf['@@transducer/result'](_result); - } - }; - - /** - * Returns the larger of its two arguments. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Relation - * @sig Ord a => a -> a -> a - * @param {*} a - * @param {*} b - * @return {*} - * @see R.maxBy, R.min - * @example - * - * R.max(789, 123); //=> 789 - * R.max('a', 'b'); //=> 'b' - */ - - var max$2 = - /*#__PURE__*/ - _curry2(function max(a, b) { - return b > a ? b : a; - }); - - function _map(fn, functor) { - var idx = 0; - var len = functor.length; - var result = Array(len); - - while (idx < len) { - result[idx] = fn(functor[idx]); - idx += 1; - } - - return result; - } - - function _isString(x) { - return Object.prototype.toString.call(x) === '[object String]'; - } - - /** - * Tests whether or not an object is similar to an array. - * - * @private - * @category Type - * @category List - * @sig * -> Boolean - * @param {*} x The object to test. - * @return {Boolean} `true` if `x` has a numeric length property and extreme indices defined; `false` otherwise. - * @example - * - * _isArrayLike([]); //=> true - * _isArrayLike(true); //=> false - * _isArrayLike({}); //=> false - * _isArrayLike({length: 10}); //=> false - * _isArrayLike({0: 'zero', 9: 'nine', length: 10}); //=> true - */ - - var _isArrayLike = - /*#__PURE__*/ - _curry1(function isArrayLike(x) { - if (_isArray$1(x)) { - return true; - } - - if (!x) { - return false; - } - - if (_typeof(x) !== 'object') { - return false; - } - - if (_isString(x)) { - return false; - } - - if (x.nodeType === 1) { - return !!x.length; - } - - if (x.length === 0) { - return true; - } - - if (x.length > 0) { - return x.hasOwnProperty(0) && x.hasOwnProperty(x.length - 1); - } - - return false; - }); - - var XWrap = - /*#__PURE__*/ - function () { - function XWrap(fn) { - this.f = fn; - } - - XWrap.prototype['@@transducer/init'] = function () { - throw new Error('init not implemented on XWrap'); - }; - - XWrap.prototype['@@transducer/result'] = function (acc) { - return acc; - }; - - XWrap.prototype['@@transducer/step'] = function (acc, x) { - return this.f(acc, x); - }; - - return XWrap; - }(); - - function _xwrap(fn) { - return new XWrap(fn); - } - - /** - * Creates a function that is bound to a context. - * Note: `R.bind` does not provide the additional argument-binding capabilities of - * [Function.prototype.bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind). - * - * @func - * @memberOf R - * @since v0.6.0 - * @category Function - * @category Object - * @sig (* -> *) -> {*} -> (* -> *) - * @param {Function} fn The function to bind to context - * @param {Object} thisObj The context to bind `fn` to - * @return {Function} A function that will execute in the context of `thisObj`. - * @see R.partial - * @example - * - * var log = R.bind(console.log, console); - * R.pipe(R.assoc('a', 2), R.tap(log), R.assoc('a', 3))({a: 1}); //=> {a: 3} - * // logs {a: 2} - * @symb R.bind(f, o)(a, b) = f.call(o, a, b) - */ - - var bind = - /*#__PURE__*/ - _curry2(function bind(fn, thisObj) { - return _arity(fn.length, function () { - return fn.apply(thisObj, arguments); - }); - }); - - function _arrayReduce$1(xf, acc, list) { - var idx = 0; - var len = list.length; - - while (idx < len) { - acc = xf['@@transducer/step'](acc, list[idx]); - - if (acc && acc['@@transducer/reduced']) { - acc = acc['@@transducer/value']; - break; - } - - idx += 1; - } - - return xf['@@transducer/result'](acc); - } - - function _iterableReduce(xf, acc, iter) { - var step = iter.next(); - - while (!step.done) { - acc = xf['@@transducer/step'](acc, step.value); - - if (acc && acc['@@transducer/reduced']) { - acc = acc['@@transducer/value']; - break; - } - - step = iter.next(); - } - - return xf['@@transducer/result'](acc); - } - - function _methodReduce(xf, acc, obj, methodName) { - return xf['@@transducer/result'](obj[methodName](bind(xf['@@transducer/step'], xf), acc)); - } - - var symIterator = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator'; - function _reduce(fn, acc, list) { - if (typeof fn === 'function') { - fn = _xwrap(fn); - } - - if (_isArrayLike(list)) { - return _arrayReduce$1(fn, acc, list); - } - - if (typeof list['fantasy-land/reduce'] === 'function') { - return _methodReduce(fn, acc, list, 'fantasy-land/reduce'); - } - - if (list[symIterator] != null) { - return _iterableReduce(fn, acc, list[symIterator]()); - } - - if (typeof list.next === 'function') { - return _iterableReduce(fn, acc, list); - } - - if (typeof list.reduce === 'function') { - return _methodReduce(fn, acc, list, 'reduce'); - } - - throw new TypeError('reduce: list must be array or iterable'); - } - - var XMap = - /*#__PURE__*/ - function () { - function XMap(f, xf) { - this.xf = xf; - this.f = f; - } - - XMap.prototype['@@transducer/init'] = _xfBase.init; - XMap.prototype['@@transducer/result'] = _xfBase.result; - - XMap.prototype['@@transducer/step'] = function (result, input) { - return this.xf['@@transducer/step'](result, this.f(input)); - }; - - return XMap; - }(); - - var _xmap = - /*#__PURE__*/ - _curry2(function _xmap(f, xf) { - return new XMap(f, xf); - }); - - function _has$1(prop, obj) { - return Object.prototype.hasOwnProperty.call(obj, prop); - } - - var toString$2 = Object.prototype.toString; - - var _isArguments = function _isArguments() { - return toString$2.call(arguments) === '[object Arguments]' ? function _isArguments(x) { - return toString$2.call(x) === '[object Arguments]'; - } : function _isArguments(x) { - return _has$1('callee', x); - }; - }; - - var hasEnumBug = ! - /*#__PURE__*/ - { - toString: null - }.propertyIsEnumerable('toString'); - var nonEnumerableProps = ['constructor', 'valueOf', 'isPrototypeOf', 'toString', 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; // Safari bug - - var hasArgsEnumBug = - /*#__PURE__*/ - function () { - - return arguments.propertyIsEnumerable('length'); - }(); - - var contains = function contains(list, item) { - var idx = 0; - - while (idx < list.length) { - if (list[idx] === item) { - return true; - } - - idx += 1; - } - - return false; - }; - /** - * Returns a list containing the names of all the enumerable own properties of - * the supplied object. - * Note that the order of the output array is not guaranteed to be consistent - * across different JS platforms. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Object - * @sig {k: v} -> [k] - * @param {Object} obj The object to extract properties from - * @return {Array} An array of the object's own properties. - * @see R.keysIn, R.values - * @example - * - * R.keys({a: 1, b: 2, c: 3}); //=> ['a', 'b', 'c'] - */ - - - var _keys = typeof Object.keys === 'function' && !hasArgsEnumBug ? function keys(obj) { - return Object(obj) !== obj ? [] : Object.keys(obj); - } : function keys(obj) { - if (Object(obj) !== obj) { - return []; - } - - var prop, nIdx; - var ks = []; - - var checkArgsLength = hasArgsEnumBug && _isArguments(obj); - - for (prop in obj) { - if (_has$1(prop, obj) && (!checkArgsLength || prop !== 'length')) { - ks[ks.length] = prop; - } - } - - if (hasEnumBug) { - nIdx = nonEnumerableProps.length - 1; - - while (nIdx >= 0) { - prop = nonEnumerableProps[nIdx]; - - if (_has$1(prop, obj) && !contains(ks, prop)) { - ks[ks.length] = prop; - } - - nIdx -= 1; - } - } - - return ks; - }; - - var keys$1 = - /*#__PURE__*/ - _curry1(_keys); - - /** - * Takes a function and - * a [functor](https://github.com/fantasyland/fantasy-land#functor), - * applies the function to each of the functor's values, and returns - * a functor of the same shape. - * - * Ramda provides suitable `map` implementations for `Array` and `Object`, - * so this function may be applied to `[1, 2, 3]` or `{x: 1, y: 2, z: 3}`. - * - * Dispatches to the `map` method of the second argument, if present. - * - * Acts as a transducer if a transformer is given in list position. - * - * Also treats functions as functors and will compose them together. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category List - * @sig Functor f => (a -> b) -> f a -> f b - * @param {Function} fn The function to be called on every element of the input `list`. - * @param {Array} list The list to be iterated over. - * @return {Array} The new list. - * @see R.transduce, R.addIndex - * @example - * - * var double = x => x * 2; - * - * R.map(double, [1, 2, 3]); //=> [2, 4, 6] - * - * R.map(double, {x: 1, y: 2, z: 3}); //=> {x: 2, y: 4, z: 6} - * @symb R.map(f, [a, b]) = [f(a), f(b)] - * @symb R.map(f, { x: a, y: b }) = { x: f(a), y: f(b) } - * @symb R.map(f, functor_o) = functor_o.map(f) - */ - - var map = - /*#__PURE__*/ - _curry2( - /*#__PURE__*/ - _dispatchable(['fantasy-land/map', 'map'], _xmap, function map(fn, functor) { - switch (Object.prototype.toString.call(functor)) { - case '[object Function]': - return curryN(functor.length, function () { - return fn.call(this, functor.apply(this, arguments)); - }); - - case '[object Object]': - return _reduce(function (acc, key) { - acc[key] = fn(functor[key]); - return acc; - }, {}, keys$1(functor)); - - default: - return _map(fn, functor); - } - })); - - /** - * Retrieve the value at a given path. - * - * @func - * @memberOf R - * @since v0.2.0 - * @category Object - * @typedefn Idx = String | Int - * @sig [Idx] -> {a} -> a | Undefined - * @param {Array} path The path to use. - * @param {Object} obj The object to retrieve the nested property from. - * @return {*} The data at `path`. - * @see R.prop - * @example - * - * R.path(['a', 'b'], {a: {b: 2}}); //=> 2 - * R.path(['a', 'b'], {c: {b: 2}}); //=> undefined - */ - - var path = - /*#__PURE__*/ - _curry2(function path(paths, obj) { - var val = obj; - var idx = 0; - - while (idx < paths.length) { - if (val == null) { - return; - } - - val = val[paths[idx]]; - idx += 1; - } - - return val; - }); - - /** - * Returns a function that when supplied an object returns the indicated - * property of that object, if it exists. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Object - * @sig s -> {s: a} -> a | Undefined - * @param {String} p The property name - * @param {Object} obj The object to query - * @return {*} The value at `obj.p`. - * @see R.path - * @example - * - * R.prop('x', {x: 100}); //=> 100 - * R.prop('x', {}); //=> undefined - */ - - var prop = - /*#__PURE__*/ - _curry2(function prop(p, obj) { - return path([p], obj); - }); - - /** - * Returns a new list by plucking the same named property off all objects in - * the list supplied. - * - * `pluck` will work on - * any [functor](https://github.com/fantasyland/fantasy-land#functor) in - * addition to arrays, as it is equivalent to `R.map(R.prop(k), f)`. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category List - * @sig Functor f => k -> f {k: v} -> f v - * @param {Number|String} key The key name to pluck off of each object. - * @param {Array} f The array or functor to consider. - * @return {Array} The list of values for the given key. - * @see R.props - * @example - * - * R.pluck('a')([{a: 1}, {a: 2}]); //=> [1, 2] - * R.pluck(0)([[1, 2], [3, 4]]); //=> [1, 3] - * R.pluck('val', {a: {val: 3}, b: {val: 5}}); //=> {a: 3, b: 5} - * @symb R.pluck('x', [{x: 1, y: 2}, {x: 3, y: 4}, {x: 5, y: 6}]) = [1, 3, 5] - * @symb R.pluck(0, [[1, 2], [3, 4], [5, 6]]) = [1, 3, 5] - */ - - var pluck = - /*#__PURE__*/ - _curry2(function pluck(p, list) { - return map(prop(p), list); - }); - - /** - * Returns a single item by iterating through the list, successively calling - * the iterator function and passing it an accumulator value and the current - * value from the array, and then passing the result to the next call. - * - * The iterator function receives two values: *(acc, value)*. It may use - * [`R.reduced`](#reduced) to shortcut the iteration. - * - * The arguments' order of [`reduceRight`](#reduceRight)'s iterator function - * is *(value, acc)*. - * - * Note: `R.reduce` does not skip deleted or unassigned indices (sparse - * arrays), unlike the native `Array.prototype.reduce` method. For more details - * on this behavior, see: - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce#Description - * - * Dispatches to the `reduce` method of the third argument, if present. When - * doing so, it is up to the user to handle the [`R.reduced`](#reduced) - * shortcuting, as this is not implemented by `reduce`. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category List - * @sig ((a, b) -> a) -> a -> [b] -> a - * @param {Function} fn The iterator function. Receives two values, the accumulator and the - * current element from the array. - * @param {*} acc The accumulator value. - * @param {Array} list The list to iterate over. - * @return {*} The final, accumulated value. - * @see R.reduced, R.addIndex, R.reduceRight - * @example - * - * R.reduce(R.subtract, 0, [1, 2, 3, 4]) // => ((((0 - 1) - 2) - 3) - 4) = -10 - * // - -10 - * // / \ / \ - * // - 4 -6 4 - * // / \ / \ - * // - 3 ==> -3 3 - * // / \ / \ - * // - 2 -1 2 - * // / \ / \ - * // 0 1 0 1 - * - * @symb R.reduce(f, a, [b, c, d]) = f(f(f(a, b), c), d) - */ - - var reduce = - /*#__PURE__*/ - _curry3(_reduce); - - /** - * ap applies a list of functions to a list of values. - * - * Dispatches to the `ap` method of the second argument, if present. Also - * treats curried functions as applicatives. - * - * @func - * @memberOf R - * @since v0.3.0 - * @category Function - * @sig [a -> b] -> [a] -> [b] - * @sig Apply f => f (a -> b) -> f a -> f b - * @sig (a -> b -> c) -> (a -> b) -> (a -> c) - * @param {*} applyF - * @param {*} applyX - * @return {*} - * @example - * - * R.ap([R.multiply(2), R.add(3)], [1,2,3]); //=> [2, 4, 6, 4, 5, 6] - * R.ap([R.concat('tasty '), R.toUpper], ['pizza', 'salad']); //=> ["tasty pizza", "tasty salad", "PIZZA", "SALAD"] - * - * // R.ap can also be used as S combinator - * // when only two functions are passed - * R.ap(R.concat, R.toUpper)('Ramda') //=> 'RamdaRAMDA' - * @symb R.ap([f, g], [a, b]) = [f(a), f(b), g(a), g(b)] - */ - - var ap = - /*#__PURE__*/ - _curry2(function ap(applyF, applyX) { - return typeof applyX['fantasy-land/ap'] === 'function' ? applyX['fantasy-land/ap'](applyF) : typeof applyF.ap === 'function' ? applyF.ap(applyX) : typeof applyF === 'function' ? function (x) { - return applyF(x)(applyX(x)); - } : // else - _reduce(function (acc, f) { - return _concat(acc, map(f, applyX)); - }, [], applyF); - }); - - // 20.1.2.3 Number.isInteger(number) - - var floor$2 = Math.floor; - var _isInteger = function isInteger(it) { - return !_isObject(it) && isFinite(it) && floor$2(it) === it; - }; - - // 20.1.2.3 Number.isInteger(number) - - - _export(_export.S, 'Number', { isInteger: _isInteger }); - - function _isFunction(x) { - return Object.prototype.toString.call(x) === '[object Function]'; - } - - /** - * "lifts" a function to be the specified arity, so that it may "map over" that - * many lists, Functions or other objects that satisfy the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply). - * - * @func - * @memberOf R - * @since v0.7.0 - * @category Function - * @sig Number -> (*... -> *) -> ([*]... -> [*]) - * @param {Function} fn The function to lift into higher context - * @return {Function} The lifted function. - * @see R.lift, R.ap - * @example - * - * var madd3 = R.liftN(3, (...args) => R.sum(args)); - * madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7] - */ - - var liftN = - /*#__PURE__*/ - _curry2(function liftN(arity, fn) { - var lifted = curryN(arity, fn); - return curryN(arity, function () { - return _reduce(ap, map(lifted, arguments[0]), Array.prototype.slice.call(arguments, 1)); - }); - }); - - /** - * "lifts" a function of arity > 1 so that it may "map over" a list, Function or other - * object that satisfies the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply). - * - * @func - * @memberOf R - * @since v0.7.0 - * @category Function - * @sig (*... -> *) -> ([*]... -> [*]) - * @param {Function} fn The function to lift into higher context - * @return {Function} The lifted function. - * @see R.liftN - * @example - * - * var madd3 = R.lift((a, b, c) => a + b + c); - * - * madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7] - * - * var madd5 = R.lift((a, b, c, d, e) => a + b + c + d + e); - * - * madd5([1,2], [3], [4, 5], [6], [7, 8]); //=> [21, 22, 22, 23, 22, 23, 23, 24] - */ - - var lift = - /*#__PURE__*/ - _curry1(function lift(fn) { - return liftN(fn.length, fn); - }); - - /** - * Returns a curried equivalent of the provided function. The curried function - * has two unusual capabilities. First, its arguments needn't be provided one - * at a time. If `f` is a ternary function and `g` is `R.curry(f)`, the - * following are equivalent: - * - * - `g(1)(2)(3)` - * - `g(1)(2, 3)` - * - `g(1, 2)(3)` - * - `g(1, 2, 3)` - * - * Secondly, the special placeholder value [`R.__`](#__) may be used to specify - * "gaps", allowing partial application of any combination of arguments, - * regardless of their positions. If `g` is as above and `_` is [`R.__`](#__), - * the following are equivalent: - * - * - `g(1, 2, 3)` - * - `g(_, 2, 3)(1)` - * - `g(_, _, 3)(1)(2)` - * - `g(_, _, 3)(1, 2)` - * - `g(_, 2)(1)(3)` - * - `g(_, 2)(1, 3)` - * - `g(_, 2)(_, 3)(1)` - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Function - * @sig (* -> a) -> (* -> a) - * @param {Function} fn The function to curry. - * @return {Function} A new, curried function. - * @see R.curryN - * @example - * - * var addFourNumbers = (a, b, c, d) => a + b + c + d; - * - * var curriedAddFourNumbers = R.curry(addFourNumbers); - * var f = curriedAddFourNumbers(1, 2); - * var g = f(3); - * g(4); //=> 10 - */ - - var curry = - /*#__PURE__*/ - _curry1(function curry(fn) { - return curryN(fn.length, fn); - }); - - /** - * Returns the result of calling its first argument with the remaining - * arguments. This is occasionally useful as a converging function for - * [`R.converge`](#converge): the first branch can produce a function while the - * remaining branches produce values to be passed to that function as its - * arguments. - * - * @func - * @memberOf R - * @since v0.9.0 - * @category Function - * @sig (*... -> a),*... -> a - * @param {Function} fn The function to apply to the remaining arguments. - * @param {...*} args Any number of positional arguments. - * @return {*} - * @see R.apply - * @example - * - * R.call(R.add, 1, 2); //=> 3 - * - * var indentN = R.pipe(R.repeat(' '), - * R.join(''), - * R.replace(/^(?!$)/gm)); - * - * var format = R.converge(R.call, [ - * R.pipe(R.prop('indent'), indentN), - * R.prop('value') - * ]); - * - * format({indent: 2, value: 'foo\nbar\nbaz\n'}); //=> ' foo\n bar\n baz\n' - * @symb R.call(f, a, b) = f(a, b) - */ - - var call = - /*#__PURE__*/ - curry(function call(fn) { - return fn.apply(this, Array.prototype.slice.call(arguments, 1)); - }); - - /** - * `_makeFlat` is a helper function that returns a one-level or fully recursive - * function based on the flag passed in. - * - * @private - */ - - function _makeFlat(recursive) { - return function flatt(list) { - var value, jlen, j; - var result = []; - var idx = 0; - var ilen = list.length; - - while (idx < ilen) { - if (_isArrayLike(list[idx])) { - value = recursive ? flatt(list[idx]) : list[idx]; - j = 0; - jlen = value.length; - - while (j < jlen) { - result[result.length] = value[j]; - j += 1; - } - } else { - result[result.length] = list[idx]; - } - - idx += 1; - } - - return result; - }; - } - - function _forceReduced(x) { - return { - '@@transducer/value': x, - '@@transducer/reduced': true - }; - } - - var preservingReduced = function preservingReduced(xf) { - return { - '@@transducer/init': _xfBase.init, - '@@transducer/result': function transducerResult(result) { - return xf['@@transducer/result'](result); - }, - '@@transducer/step': function transducerStep(result, input) { - var ret = xf['@@transducer/step'](result, input); - return ret['@@transducer/reduced'] ? _forceReduced(ret) : ret; - } - }; - }; - - var _flatCat = function _xcat(xf) { - var rxf = preservingReduced(xf); - return { - '@@transducer/init': _xfBase.init, - '@@transducer/result': function transducerResult(result) { - return rxf['@@transducer/result'](result); - }, - '@@transducer/step': function transducerStep(result, input) { - return !_isArrayLike(input) ? _reduce(rxf, result, [input]) : _reduce(rxf, result, input); - } - }; - }; - - var _xchain = - /*#__PURE__*/ - _curry2(function _xchain(f, xf) { - return map(f, _flatCat(xf)); - }); - - /** - * `chain` maps a function over a list and concatenates the results. `chain` - * is also known as `flatMap` in some libraries - * - * Dispatches to the `chain` method of the second argument, if present, - * according to the [FantasyLand Chain spec](https://github.com/fantasyland/fantasy-land#chain). - * - * @func - * @memberOf R - * @since v0.3.0 - * @category List - * @sig Chain m => (a -> m b) -> m a -> m b - * @param {Function} fn The function to map with - * @param {Array} list The list to map over - * @return {Array} The result of flat-mapping `list` with `fn` - * @example - * - * var duplicate = n => [n, n]; - * R.chain(duplicate, [1, 2, 3]); //=> [1, 1, 2, 2, 3, 3] - * - * R.chain(R.append, R.head)([1, 2, 3]); //=> [1, 2, 3, 1] - */ - - var chain = - /*#__PURE__*/ - _curry2( - /*#__PURE__*/ - _dispatchable(['fantasy-land/chain', 'chain'], _xchain, function chain(fn, monad) { - if (typeof monad === 'function') { - return function (x) { - return fn(monad(x))(x); - }; - } - - return _makeFlat(false)(map(fn, monad)); - })); - - var dP$4 = _objectDp.f; - var gOPN$3 = _objectGopn.f; - - - var $RegExp = _global.RegExp; - var Base$1 = $RegExp; - var proto$2 = $RegExp.prototype; - var re1 = /a/g; - var re2 = /a/g; - // "new" creates a new object, old webkit buggy here - var CORRECT_NEW = new $RegExp(re1) !== re1; - - if (_descriptors && (!CORRECT_NEW || _fails(function () { - re2[_wks('match')] = false; - // RegExp constructor can alter flags and IsRegExp works correct with @@match - return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i'; - }))) { - $RegExp = function RegExp(p, f) { - var tiRE = this instanceof $RegExp; - var piRE = _isRegexp(p); - var fiU = f === undefined; - return !tiRE && piRE && p.constructor === $RegExp && fiU ? p - : _inheritIfRequired(CORRECT_NEW - ? new Base$1(piRE && !fiU ? p.source : p, f) - : Base$1((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? _flags.call(p) : f) - , tiRE ? this : proto$2, $RegExp); - }; - var proxy = function (key) { - key in $RegExp || dP$4($RegExp, key, { - configurable: true, - get: function () { return Base$1[key]; }, - set: function (it) { Base$1[key] = it; } - }); - }; - for (var keys$2 = gOPN$3(Base$1), i$2 = 0; keys$2.length > i$2;) proxy(keys$2[i$2++]); - proto$2.constructor = $RegExp; - $RegExp.prototype = proto$2; - _redefine(_global, 'RegExp', $RegExp); - } - - _setSpecies('RegExp'); - - /** - * Gives a single-word string description of the (native) type of a value, - * returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not - * attempt to distinguish user Object types any further, reporting them all as - * 'Object'. - * - * @func - * @memberOf R - * @since v0.8.0 - * @category Type - * @sig (* -> {*}) -> String - * @param {*} val The value to test - * @return {String} - * @example - * - * R.type({}); //=> "Object" - * R.type(1); //=> "Number" - * R.type(false); //=> "Boolean" - * R.type('s'); //=> "String" - * R.type(null); //=> "Null" - * R.type([]); //=> "Array" - * R.type(/[A-z]/); //=> "RegExp" - * R.type(() => {}); //=> "Function" - * R.type(undefined); //=> "Undefined" - */ - - var type = - /*#__PURE__*/ - _curry1(function type(val) { - return val === null ? 'Null' : val === undefined ? 'Undefined' : Object.prototype.toString.call(val).slice(8, -1); - }); - - /** - * A function that returns the `!` of its argument. It will return `true` when - * passed false-y value, and `false` when passed a truth-y one. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Logic - * @sig * -> Boolean - * @param {*} a any value - * @return {Boolean} the logical inverse of passed argument. - * @see R.complement - * @example - * - * R.not(true); //=> false - * R.not(false); //=> true - * R.not(0); //=> true - * R.not(1); //=> false - */ - - var not = - /*#__PURE__*/ - _curry1(function not(a) { - return !a; - }); - - /** - * Takes a function `f` and returns a function `g` such that if called with the same arguments - * when `f` returns a "truthy" value, `g` returns `false` and when `f` returns a "falsy" value `g` returns `true`. - * - * `R.complement` may be applied to any functor - * - * @func - * @memberOf R - * @since v0.12.0 - * @category Logic - * @sig (*... -> *) -> (*... -> Boolean) - * @param {Function} f - * @return {Function} - * @see R.not - * @example - * - * var isNotNil = R.complement(R.isNil); - * isNil(null); //=> true - * isNotNil(null); //=> false - * isNil(7); //=> false - * isNotNil(7); //=> true - */ - - var complement = - /*#__PURE__*/ - lift(not); - - function _pipe(f, g) { - return function () { - return g.call(this, f.apply(this, arguments)); - }; - } - - /** - * This checks whether a function has a [methodname] function. If it isn't an - * array it will execute that function otherwise it will default to the ramda - * implementation. - * - * @private - * @param {Function} fn ramda implemtation - * @param {String} methodname property to check for a custom implementation - * @return {Object} Whatever the return value of the method is. - */ - - function _checkForMethod(methodname, fn) { - return function () { - var length = arguments.length; - - if (length === 0) { - return fn(); - } - - var obj = arguments[length - 1]; - return _isArray$1(obj) || typeof obj[methodname] !== 'function' ? fn.apply(this, arguments) : obj[methodname].apply(obj, Array.prototype.slice.call(arguments, 0, length - 1)); - }; - } - - /** - * Returns the elements of the given list or string (or object with a `slice` - * method) from `fromIndex` (inclusive) to `toIndex` (exclusive). - * - * Dispatches to the `slice` method of the third argument, if present. - * - * @func - * @memberOf R - * @since v0.1.4 - * @category List - * @sig Number -> Number -> [a] -> [a] - * @sig Number -> Number -> String -> String - * @param {Number} fromIndex The start index (inclusive). - * @param {Number} toIndex The end index (exclusive). - * @param {*} list - * @return {*} - * @example - * - * R.slice(1, 3, ['a', 'b', 'c', 'd']); //=> ['b', 'c'] - * R.slice(1, Infinity, ['a', 'b', 'c', 'd']); //=> ['b', 'c', 'd'] - * R.slice(0, -1, ['a', 'b', 'c', 'd']); //=> ['a', 'b', 'c'] - * R.slice(-3, -1, ['a', 'b', 'c', 'd']); //=> ['b', 'c'] - * R.slice(0, 3, 'ramda'); //=> 'ram' - */ - - var slice = - /*#__PURE__*/ - _curry3( - /*#__PURE__*/ - _checkForMethod('slice', function slice(fromIndex, toIndex, list) { - return Array.prototype.slice.call(list, fromIndex, toIndex); - })); - - /** - * Returns all but the first element of the given list or string (or object - * with a `tail` method). - * - * Dispatches to the `slice` method of the first argument, if present. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category List - * @sig [a] -> [a] - * @sig String -> String - * @param {*} list - * @return {*} - * @see R.head, R.init, R.last - * @example - * - * R.tail([1, 2, 3]); //=> [2, 3] - * R.tail([1, 2]); //=> [2] - * R.tail([1]); //=> [] - * R.tail([]); //=> [] - * - * R.tail('abc'); //=> 'bc' - * R.tail('ab'); //=> 'b' - * R.tail('a'); //=> '' - * R.tail(''); //=> '' - */ - - var tail = - /*#__PURE__*/ - _curry1( - /*#__PURE__*/ - _checkForMethod('tail', - /*#__PURE__*/ - slice(1, Infinity))); - - /** - * Performs left-to-right function composition. The leftmost function may have - * any arity; the remaining functions must be unary. - * - * In some libraries this function is named `sequence`. - * - * **Note:** The result of pipe is not automatically curried. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Function - * @sig (((a, b, ..., n) -> o), (o -> p), ..., (x -> y), (y -> z)) -> ((a, b, ..., n) -> z) - * @param {...Function} functions - * @return {Function} - * @see R.compose - * @example - * - * var f = R.pipe(Math.pow, R.negate, R.inc); - * - * f(3, 4); // -(3^4) + 1 - * @symb R.pipe(f, g, h)(a, b) = h(g(f(a, b))) - */ - - function pipe() { - if (arguments.length === 0) { - throw new Error('pipe requires at least one argument'); - } - - return _arity(arguments[0].length, reduce(_pipe, arguments[0], tail(arguments))); - } - - /** - * Returns a new list or string with the elements or characters in reverse - * order. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category List - * @sig [a] -> [a] - * @sig String -> String - * @param {Array|String} list - * @return {Array|String} - * @example - * - * R.reverse([1, 2, 3]); //=> [3, 2, 1] - * R.reverse([1, 2]); //=> [2, 1] - * R.reverse([1]); //=> [1] - * R.reverse([]); //=> [] - * - * R.reverse('abc'); //=> 'cba' - * R.reverse('ab'); //=> 'ba' - * R.reverse('a'); //=> 'a' - * R.reverse(''); //=> '' - */ - - var reverse = - /*#__PURE__*/ - _curry1(function reverse(list) { - return _isString(list) ? list.split('').reverse().join('') : Array.prototype.slice.call(list, 0).reverse(); - }); - - /** - * Performs right-to-left function composition. The rightmost function may have - * any arity; the remaining functions must be unary. - * - * **Note:** The result of compose is not automatically curried. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Function - * @sig ((y -> z), (x -> y), ..., (o -> p), ((a, b, ..., n) -> o)) -> ((a, b, ..., n) -> z) - * @param {...Function} ...functions The functions to compose - * @return {Function} - * @see R.pipe - * @example - * - * var classyGreeting = (firstName, lastName) => "The name's " + lastName + ", " + firstName + " " + lastName - * var yellGreeting = R.compose(R.toUpper, classyGreeting); - * yellGreeting('James', 'Bond'); //=> "THE NAME'S BOND, JAMES BOND" - * - * R.compose(Math.abs, R.add(1), R.multiply(2))(-4) //=> 7 - * - * @symb R.compose(f, g, h)(a, b) = f(g(h(a, b))) - */ - - function compose() { - if (arguments.length === 0) { - throw new Error('compose requires at least one argument'); - } - - return pipe.apply(this, reverse(arguments)); - } - - var $sort = [].sort; - var test = [1, 2, 3]; - - _export(_export.P + _export.F * (_fails(function () { - // IE8- - test.sort(undefined); - }) || !_fails(function () { - // V8 bug - test.sort(null); - // Old WebKit - }) || !_strictMethod($sort)), 'Array', { - // 22.1.3.25 Array.prototype.sort(comparefn) - sort: function sort(comparefn) { - return comparefn === undefined - ? $sort.call(_toObject(this)) - : $sort.call(_toObject(this), _aFunction(comparefn)); - } - }); - - function _arrayFromIterator(iter) { - var list = []; - var next; - - while (!(next = iter.next()).done) { - list.push(next.value); - } - - return list; - } - - function _containsWith(pred, x, list) { - var idx = 0; - var len = list.length; - - while (idx < len) { - if (pred(x, list[idx])) { - return true; - } - - idx += 1; - } - - return false; - } - - // @@match logic - _fixReWks('match', 1, function (defined, MATCH, $match, maybeCallNative) { - return [ - // `String.prototype.match` method - // https://tc39.github.io/ecma262/#sec-string.prototype.match - function match(regexp) { - var O = defined(this); - var fn = regexp == undefined ? undefined : regexp[MATCH]; - return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); - }, - // `RegExp.prototype[@@match]` method - // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match - function (regexp) { - var res = maybeCallNative($match, regexp, this); - if (res.done) return res.value; - var rx = _anObject(regexp); - var S = String(this); - if (!rx.global) return _regexpExecAbstract(rx, S); - var fullUnicode = rx.unicode; - rx.lastIndex = 0; - var A = []; - var n = 0; - var result; - while ((result = _regexpExecAbstract(rx, S)) !== null) { - var matchStr = String(result[0]); - A[n] = matchStr; - if (matchStr === '') rx.lastIndex = _advanceStringIndex(S, _toLength(rx.lastIndex), fullUnicode); - n++; - } - return n === 0 ? null : A; - } - ]; - }); - - function _functionName(f) { - // String(x => x) evaluates to "x => x", so the pattern may not match. - var match = String(f).match(/^function (\w*)/); - return match == null ? '' : match[1]; - } - - /** - * Returns true if its arguments are identical, false otherwise. Values are - * identical if they reference the same memory. `NaN` is identical to `NaN`; - * `0` and `-0` are not identical. - * - * @func - * @memberOf R - * @since v0.15.0 - * @category Relation - * @sig a -> a -> Boolean - * @param {*} a - * @param {*} b - * @return {Boolean} - * @example - * - * var o = {}; - * R.identical(o, o); //=> true - * R.identical(1, 1); //=> true - * R.identical(1, '1'); //=> false - * R.identical([], []); //=> false - * R.identical(0, -0); //=> false - * R.identical(NaN, NaN); //=> true - */ - - var identical = - /*#__PURE__*/ - _curry2(function identical(a, b) { - // SameValue algorithm - if (a === b) { - // Steps 1-5, 7-10 - // Steps 6.b-6.e: +0 != -0 - return a !== 0 || 1 / a === 1 / b; - } else { - // Step 6.a: NaN == NaN - return a !== a && b !== b; - } - }); - - /** - * private _uniqContentEquals function. - * That function is checking equality of 2 iterator contents with 2 assumptions - * - iterators lengths are the same - * - iterators values are unique - * - * false-positive result will be returned for comparision of, e.g. - * - [1,2,3] and [1,2,3,4] - * - [1,1,1] and [1,2,3] - * */ - - function _uniqContentEquals(aIterator, bIterator, stackA, stackB) { - var a = _arrayFromIterator(aIterator); - - var b = _arrayFromIterator(bIterator); - - function eq(_a, _b) { - return _equals(_a, _b, stackA.slice(), stackB.slice()); - } // if *a* array contains any element that is not included in *b* - - - return !_containsWith(function (b, aItem) { - return !_containsWith(eq, aItem, b); - }, b, a); - } - - function _equals(a, b, stackA, stackB) { - if (identical(a, b)) { - return true; - } - - var typeA = type(a); - - if (typeA !== type(b)) { - return false; - } - - if (a == null || b == null) { - return false; - } - - if (typeof a['fantasy-land/equals'] === 'function' || typeof b['fantasy-land/equals'] === 'function') { - return typeof a['fantasy-land/equals'] === 'function' && a['fantasy-land/equals'](b) && typeof b['fantasy-land/equals'] === 'function' && b['fantasy-land/equals'](a); - } - - if (typeof a.equals === 'function' || typeof b.equals === 'function') { - return typeof a.equals === 'function' && a.equals(b) && typeof b.equals === 'function' && b.equals(a); - } - - switch (typeA) { - case 'Arguments': - case 'Array': - case 'Object': - if (typeof a.constructor === 'function' && _functionName(a.constructor) === 'Promise') { - return a === b; - } - - break; - - case 'Boolean': - case 'Number': - case 'String': - if (!(_typeof(a) === _typeof(b) && identical(a.valueOf(), b.valueOf()))) { - return false; - } - - break; - - case 'Date': - if (!identical(a.valueOf(), b.valueOf())) { - return false; - } - - break; - - case 'Error': - return a.name === b.name && a.message === b.message; - - case 'RegExp': - if (!(a.source === b.source && a.global === b.global && a.ignoreCase === b.ignoreCase && a.multiline === b.multiline && a.sticky === b.sticky && a.unicode === b.unicode)) { - return false; - } - - break; - } - - var idx = stackA.length - 1; - - while (idx >= 0) { - if (stackA[idx] === a) { - return stackB[idx] === b; - } - - idx -= 1; - } - - switch (typeA) { - case 'Map': - if (a.size !== b.size) { - return false; - } - - return _uniqContentEquals(a.entries(), b.entries(), stackA.concat([a]), stackB.concat([b])); - - case 'Set': - if (a.size !== b.size) { - return false; - } - - return _uniqContentEquals(a.values(), b.values(), stackA.concat([a]), stackB.concat([b])); - - case 'Arguments': - case 'Array': - case 'Object': - case 'Boolean': - case 'Number': - case 'String': - case 'Date': - case 'Error': - case 'RegExp': - case 'Int8Array': - case 'Uint8Array': - case 'Uint8ClampedArray': - case 'Int16Array': - case 'Uint16Array': - case 'Int32Array': - case 'Uint32Array': - case 'Float32Array': - case 'Float64Array': - case 'ArrayBuffer': - break; - - default: - // Values of other types are only equal if identical. - return false; - } - - var keysA = keys$1(a); - - if (keysA.length !== keys$1(b).length) { - return false; - } - - var extendedStackA = stackA.concat([a]); - var extendedStackB = stackB.concat([b]); - idx = keysA.length - 1; - - while (idx >= 0) { - var key = keysA[idx]; - - if (!(_has$1(key, b) && _equals(b[key], a[key], extendedStackA, extendedStackB))) { - return false; - } - - idx -= 1; - } - - return true; - } - - /** - * Returns `true` if its arguments are equivalent, `false` otherwise. Handles - * cyclical data structures. - * - * Dispatches symmetrically to the `equals` methods of both arguments, if - * present. - * - * @func - * @memberOf R - * @since v0.15.0 - * @category Relation - * @sig a -> b -> Boolean - * @param {*} a - * @param {*} b - * @return {Boolean} - * @example - * - * R.equals(1, 1); //=> true - * R.equals(1, '1'); //=> false - * R.equals([1, 2, 3], [1, 2, 3]); //=> true - * - * var a = {}; a.v = a; - * var b = {}; b.v = b; - * R.equals(a, b); //=> true - */ - - var equals = - /*#__PURE__*/ - _curry2(function equals(a, b) { - return _equals(a, b, [], []); - }); - - function _indexOf(list, a, idx) { - var inf, item; // Array.prototype.indexOf doesn't exist below IE9 - - if (typeof list.indexOf === 'function') { - switch (_typeof(a)) { - case 'number': - if (a === 0) { - // manually crawl the list to distinguish between +0 and -0 - inf = 1 / a; - - while (idx < list.length) { - item = list[idx]; - - if (item === 0 && 1 / item === inf) { - return idx; - } - - idx += 1; - } - - return -1; - } else if (a !== a) { - // NaN - while (idx < list.length) { - item = list[idx]; - - if (typeof item === 'number' && item !== item) { - return idx; - } - - idx += 1; - } - - return -1; - } // non-zero numbers can utilise Set - - - return list.indexOf(a, idx); - // all these types can utilise Set - - case 'string': - case 'boolean': - case 'function': - case 'undefined': - return list.indexOf(a, idx); - - case 'object': - if (a === null) { - // null can utilise Set - return list.indexOf(a, idx); - } - - } - } // anything else not covered above, defer to R.equals - - - while (idx < list.length) { - if (equals(list[idx], a)) { - return idx; - } - - idx += 1; - } - - return -1; - } - - function _contains(a, list) { - return _indexOf(list, a, 0) >= 0; - } - - function _quote(s) { - var escaped = s.replace(/\\/g, '\\\\').replace(/[\b]/g, '\\b') // \b matches word boundary; [\b] matches backspace - .replace(/\f/g, '\\f').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\t/g, '\\t').replace(/\v/g, '\\v').replace(/\0/g, '\\0'); - return '"' + escaped.replace(/"/g, '\\"') + '"'; - } - - // 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() - - var getTime$1 = Date.prototype.getTime; - var $toISOString = Date.prototype.toISOString; - - var lz = function (num) { - return num > 9 ? num : '0' + num; - }; - - // PhantomJS / old WebKit has a broken implementations - var _dateToIsoString = (_fails(function () { - return $toISOString.call(new Date(-5e13 - 1)) != '0385-07-25T07:06:39.999Z'; - }) || !_fails(function () { - $toISOString.call(new Date(NaN)); - })) ? function toISOString() { - if (!isFinite(getTime$1.call(this))) throw RangeError('Invalid time value'); - var d = this; - var y = d.getUTCFullYear(); - var m = d.getUTCMilliseconds(); - var s = y < 0 ? '-' : y > 9999 ? '+' : ''; - return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) + - '-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) + - 'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) + - ':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z'; - } : $toISOString; - - // 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() - - - - // PhantomJS / old WebKit has a broken implementations - _export(_export.P + _export.F * (Date.prototype.toISOString !== _dateToIsoString), 'Date', { - toISOString: _dateToIsoString - }); - - /** - * Polyfill from . - */ - var pad = function pad(n) { - return (n < 10 ? '0' : '') + n; - }; - - var _toISOString = typeof Date.prototype.toISOString === 'function' ? function _toISOString(d) { - return d.toISOString(); - } : function _toISOString(d) { - return d.getUTCFullYear() + '-' + pad(d.getUTCMonth() + 1) + '-' + pad(d.getUTCDate()) + 'T' + pad(d.getUTCHours()) + ':' + pad(d.getUTCMinutes()) + ':' + pad(d.getUTCSeconds()) + '.' + (d.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) + 'Z'; - }; - - function _complement(f) { - return function () { - return !f.apply(this, arguments); - }; - } - - function _filter(fn, list) { - var idx = 0; - var len = list.length; - var result = []; - - while (idx < len) { - if (fn(list[idx])) { - result[result.length] = list[idx]; - } - - idx += 1; - } - - return result; - } - - function _isObject$1(x) { - return Object.prototype.toString.call(x) === '[object Object]'; - } - - var XFilter = - /*#__PURE__*/ - function () { - function XFilter(f, xf) { - this.xf = xf; - this.f = f; - } - - XFilter.prototype['@@transducer/init'] = _xfBase.init; - XFilter.prototype['@@transducer/result'] = _xfBase.result; - - XFilter.prototype['@@transducer/step'] = function (result, input) { - return this.f(input) ? this.xf['@@transducer/step'](result, input) : result; - }; - - return XFilter; - }(); - - var _xfilter = - /*#__PURE__*/ - _curry2(function _xfilter(f, xf) { - return new XFilter(f, xf); - }); - - /** - * Takes a predicate and a `Filterable`, and returns a new filterable of the - * same type containing the members of the given filterable which satisfy the - * given predicate. Filterable objects include plain objects or any object - * that has a filter method such as `Array`. - * - * Dispatches to the `filter` method of the second argument, if present. - * - * Acts as a transducer if a transformer is given in list position. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category List - * @sig Filterable f => (a -> Boolean) -> f a -> f a - * @param {Function} pred - * @param {Array} filterable - * @return {Array} Filterable - * @see R.reject, R.transduce, R.addIndex - * @example - * - * var isEven = n => n % 2 === 0; - * - * R.filter(isEven, [1, 2, 3, 4]); //=> [2, 4] - * - * R.filter(isEven, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4} - */ - - var filter = - /*#__PURE__*/ - _curry2( - /*#__PURE__*/ - _dispatchable(['filter'], _xfilter, function (pred, filterable) { - return _isObject$1(filterable) ? _reduce(function (acc, key) { - if (pred(filterable[key])) { - acc[key] = filterable[key]; - } - - return acc; - }, {}, keys$1(filterable)) : // else - _filter(pred, filterable); - })); - - /** - * The complement of [`filter`](#filter). - * - * Acts as a transducer if a transformer is given in list position. Filterable - * objects include plain objects or any object that has a filter method such - * as `Array`. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category List - * @sig Filterable f => (a -> Boolean) -> f a -> f a - * @param {Function} pred - * @param {Array} filterable - * @return {Array} - * @see R.filter, R.transduce, R.addIndex - * @example - * - * var isOdd = (n) => n % 2 === 1; - * - * R.reject(isOdd, [1, 2, 3, 4]); //=> [2, 4] - * - * R.reject(isOdd, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4} - */ - - var reject = - /*#__PURE__*/ - _curry2(function reject(pred, filterable) { - return filter(_complement(pred), filterable); - }); - - function _toString(x, seen) { - var recur = function recur(y) { - var xs = seen.concat([x]); - return _contains(y, xs) ? '' : _toString(y, xs); - }; // mapPairs :: (Object, [String]) -> [String] - - - var mapPairs = function mapPairs(obj, keys) { - return _map(function (k) { - return _quote(k) + ': ' + recur(obj[k]); - }, keys.slice().sort()); - }; - - switch (Object.prototype.toString.call(x)) { - case '[object Arguments]': - return '(function() { return arguments; }(' + _map(recur, x).join(', ') + '))'; - - case '[object Array]': - return '[' + _map(recur, x).concat(mapPairs(x, reject(function (k) { - return /^\d+$/.test(k); - }, keys$1(x)))).join(', ') + ']'; - - case '[object Boolean]': - return _typeof(x) === 'object' ? 'new Boolean(' + recur(x.valueOf()) + ')' : x.toString(); - - case '[object Date]': - return 'new Date(' + (isNaN(x.valueOf()) ? recur(NaN) : _quote(_toISOString(x))) + ')'; - - case '[object Null]': - return 'null'; - - case '[object Number]': - return _typeof(x) === 'object' ? 'new Number(' + recur(x.valueOf()) + ')' : 1 / x === -Infinity ? '-0' : x.toString(10); - - case '[object String]': - return _typeof(x) === 'object' ? 'new String(' + recur(x.valueOf()) + ')' : _quote(x); - - case '[object Undefined]': - return 'undefined'; - - default: - if (typeof x.toString === 'function') { - var repr = x.toString(); - - if (repr !== '[object Object]') { - return repr; - } - } - - return '{' + mapPairs(x, keys$1(x)).join(', ') + '}'; - } - } - - /** - * Returns the string representation of the given value. `eval`'ing the output - * should result in a value equivalent to the input value. Many of the built-in - * `toString` methods do not satisfy this requirement. - * - * If the given value is an `[object Object]` with a `toString` method other - * than `Object.prototype.toString`, this method is invoked with no arguments - * to produce the return value. This means user-defined constructor functions - * can provide a suitable `toString` method. For example: - * - * function Point(x, y) { - * this.x = x; - * this.y = y; - * } - * - * Point.prototype.toString = function() { - * return 'new Point(' + this.x + ', ' + this.y + ')'; - * }; - * - * R.toString(new Point(1, 2)); //=> 'new Point(1, 2)' - * - * @func - * @memberOf R - * @since v0.14.0 - * @category String - * @sig * -> String - * @param {*} val - * @return {String} - * @example - * - * R.toString(42); //=> '42' - * R.toString('abc'); //=> '"abc"' - * R.toString([1, 2, 3]); //=> '[1, 2, 3]' - * R.toString({foo: 1, bar: 2, baz: 3}); //=> '{"bar": 2, "baz": 3, "foo": 1}' - * R.toString(new Date('2001-02-03T04:05:06Z')); //=> 'new Date("2001-02-03T04:05:06.000Z")' - */ - - var toString$3 = - /*#__PURE__*/ - _curry1(function toString(val) { - return _toString(val, []); - }); - - /** - * Accepts a converging function and a list of branching functions and returns - * a new function. When invoked, this new function is applied to some - * arguments, each branching function is applied to those same arguments. The - * results of each branching function are passed as arguments to the converging - * function to produce the return value. - * - * @func - * @memberOf R - * @since v0.4.2 - * @category Function - * @sig ((x1, x2, ...) -> z) -> [((a, b, ...) -> x1), ((a, b, ...) -> x2), ...] -> (a -> b -> ... -> z) - * @param {Function} after A function. `after` will be invoked with the return values of - * `fn1` and `fn2` as its arguments. - * @param {Array} functions A list of functions. - * @return {Function} A new function. - * @see R.useWith - * @example - * - * var average = R.converge(R.divide, [R.sum, R.length]) - * average([1, 2, 3, 4, 5, 6, 7]) //=> 4 - * - * var strangeConcat = R.converge(R.concat, [R.toUpper, R.toLower]) - * strangeConcat("Yodel") //=> "YODELyodel" - * - * @symb R.converge(f, [g, h])(a, b) = f(g(a, b), h(a, b)) - */ - - var converge = - /*#__PURE__*/ - _curry2(function converge(after, fns) { - return curryN(reduce(max$2, 0, pluck('length', fns)), function () { - var args = arguments; - var context = this; - return after.apply(context, _map(function (fn) { - return fn.apply(context, args); - }, fns)); - }); - }); - - var XReduceBy = - /*#__PURE__*/ - function () { - function XReduceBy(valueFn, valueAcc, keyFn, xf) { - this.valueFn = valueFn; - this.valueAcc = valueAcc; - this.keyFn = keyFn; - this.xf = xf; - this.inputs = {}; - } - - XReduceBy.prototype['@@transducer/init'] = _xfBase.init; - - XReduceBy.prototype['@@transducer/result'] = function (result) { - var key; - - for (key in this.inputs) { - if (_has$1(key, this.inputs)) { - result = this.xf['@@transducer/step'](result, this.inputs[key]); - - if (result['@@transducer/reduced']) { - result = result['@@transducer/value']; - break; - } - } - } - - this.inputs = null; - return this.xf['@@transducer/result'](result); - }; - - XReduceBy.prototype['@@transducer/step'] = function (result, input) { - var key = this.keyFn(input); - this.inputs[key] = this.inputs[key] || [key, this.valueAcc]; - this.inputs[key][1] = this.valueFn(this.inputs[key][1], input); - return result; - }; - - return XReduceBy; - }(); - - var _xreduceBy = - /*#__PURE__*/ - _curryN(4, [], function _xreduceBy(valueFn, valueAcc, keyFn, xf) { - return new XReduceBy(valueFn, valueAcc, keyFn, xf); - }); - - /** - * Groups the elements of the list according to the result of calling - * the String-returning function `keyFn` on each element and reduces the elements - * of each group to a single value via the reducer function `valueFn`. - * - * This function is basically a more general [`groupBy`](#groupBy) function. - * - * Acts as a transducer if a transformer is given in list position. - * - * @func - * @memberOf R - * @since v0.20.0 - * @category List - * @sig ((a, b) -> a) -> a -> (b -> String) -> [b] -> {String: a} - * @param {Function} valueFn The function that reduces the elements of each group to a single - * value. Receives two values, accumulator for a particular group and the current element. - * @param {*} acc The (initial) accumulator value for each group. - * @param {Function} keyFn The function that maps the list's element into a key. - * @param {Array} list The array to group. - * @return {Object} An object with the output of `keyFn` for keys, mapped to the output of - * `valueFn` for elements which produced that key when passed to `keyFn`. - * @see R.groupBy, R.reduce - * @example - * - * var reduceToNamesBy = R.reduceBy((acc, student) => acc.concat(student.name), []); - * var namesByGrade = reduceToNamesBy(function(student) { - * var score = student.score; - * return score < 65 ? 'F' : - * score < 70 ? 'D' : - * score < 80 ? 'C' : - * score < 90 ? 'B' : 'A'; - * }); - * var students = [{name: 'Lucy', score: 92}, - * {name: 'Drew', score: 85}, - * // ... - * {name: 'Bart', score: 62}]; - * namesByGrade(students); - * // { - * // 'A': ['Lucy'], - * // 'B': ['Drew'] - * // // ..., - * // 'F': ['Bart'] - * // } - */ - - var reduceBy = - /*#__PURE__*/ - _curryN(4, [], - /*#__PURE__*/ - _dispatchable([], _xreduceBy, function reduceBy(valueFn, valueAcc, keyFn, list) { - return _reduce(function (acc, elt) { - var key = keyFn(elt); - acc[key] = valueFn(_has$1(key, acc) ? acc[key] : valueAcc, elt); - return acc; - }, {}, list); - })); - - /** - * Counts the elements of a list according to how many match each value of a - * key generated by the supplied function. Returns an object mapping the keys - * produced by `fn` to the number of occurrences in the list. Note that all - * keys are coerced to strings because of how JavaScript objects work. - * - * Acts as a transducer if a transformer is given in list position. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Relation - * @sig (a -> String) -> [a] -> {*} - * @param {Function} fn The function used to map values to keys. - * @param {Array} list The list to count elements from. - * @return {Object} An object mapping keys to number of occurrences in the list. - * @example - * - * var numbers = [1.0, 1.1, 1.2, 2.0, 3.0, 2.2]; - * R.countBy(Math.floor)(numbers); //=> {'1': 3, '2': 2, '3': 1} - * - * var letters = ['a', 'b', 'A', 'a', 'B', 'c']; - * R.countBy(R.toLower)(letters); //=> {'a': 3, 'b': 2, 'c': 1} - */ - - var countBy = - /*#__PURE__*/ - reduceBy(function (acc, elem) { - return acc + 1; - }, 0); - - /** - * Decrements its argument. - * - * @func - * @memberOf R - * @since v0.9.0 - * @category Math - * @sig Number -> Number - * @param {Number} n - * @return {Number} n - 1 - * @see R.inc - * @example - * - * R.dec(42); //=> 41 - */ - - var dec = - /*#__PURE__*/ - add(-1); - - var XTake = - /*#__PURE__*/ - function () { - function XTake(n, xf) { - this.xf = xf; - this.n = n; - this.i = 0; - } - - XTake.prototype['@@transducer/init'] = _xfBase.init; - XTake.prototype['@@transducer/result'] = _xfBase.result; - - XTake.prototype['@@transducer/step'] = function (result, input) { - this.i += 1; - var ret = this.n === 0 ? result : this.xf['@@transducer/step'](result, input); - return this.n >= 0 && this.i >= this.n ? _reduced(ret) : ret; - }; - - return XTake; - }(); - - var _xtake = - /*#__PURE__*/ - _curry2(function _xtake(n, xf) { - return new XTake(n, xf); - }); - - /** - * Returns the first `n` elements of the given list, string, or - * transducer/transformer (or object with a `take` method). - * - * Dispatches to the `take` method of the second argument, if present. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category List - * @sig Number -> [a] -> [a] - * @sig Number -> String -> String - * @param {Number} n - * @param {*} list - * @return {*} - * @see R.drop - * @example - * - * R.take(1, ['foo', 'bar', 'baz']); //=> ['foo'] - * R.take(2, ['foo', 'bar', 'baz']); //=> ['foo', 'bar'] - * R.take(3, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz'] - * R.take(4, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz'] - * R.take(3, 'ramda'); //=> 'ram' - * - * var personnel = [ - * 'Dave Brubeck', - * 'Paul Desmond', - * 'Eugene Wright', - * 'Joe Morello', - * 'Gerry Mulligan', - * 'Bob Bates', - * 'Joe Dodge', - * 'Ron Crotty' - * ]; - * - * var takeFive = R.take(5); - * takeFive(personnel); - * //=> ['Dave Brubeck', 'Paul Desmond', 'Eugene Wright', 'Joe Morello', 'Gerry Mulligan'] - * @symb R.take(-1, [a, b]) = [a, b] - * @symb R.take(0, [a, b]) = [] - * @symb R.take(1, [a, b]) = [a] - * @symb R.take(2, [a, b]) = [a, b] - */ - - var take = - /*#__PURE__*/ - _curry2( - /*#__PURE__*/ - _dispatchable(['take'], _xtake, function take(n, xs) { - return slice(0, n < 0 ? Infinity : n, xs); - })); - - function dropLast(n, xs) { - return take(n < xs.length ? xs.length - n : 0, xs); - } - - var XDropLast = - /*#__PURE__*/ - function () { - function XDropLast(n, xf) { - this.xf = xf; - this.pos = 0; - this.full = false; - this.acc = new Array(n); - } - - XDropLast.prototype['@@transducer/init'] = _xfBase.init; - - XDropLast.prototype['@@transducer/result'] = function (result) { - this.acc = null; - return this.xf['@@transducer/result'](result); - }; - - XDropLast.prototype['@@transducer/step'] = function (result, input) { - if (this.full) { - result = this.xf['@@transducer/step'](result, this.acc[this.pos]); - } - - this.store(input); - return result; - }; - - XDropLast.prototype.store = function (input) { - this.acc[this.pos] = input; - this.pos += 1; - - if (this.pos === this.acc.length) { - this.pos = 0; - this.full = true; - } - }; - - return XDropLast; - }(); - - var _xdropLast = - /*#__PURE__*/ - _curry2(function _xdropLast(n, xf) { - return new XDropLast(n, xf); - }); - - /** - * Returns a list containing all but the last `n` elements of the given `list`. - * - * @func - * @memberOf R - * @since v0.16.0 - * @category List - * @sig Number -> [a] -> [a] - * @sig Number -> String -> String - * @param {Number} n The number of elements of `list` to skip. - * @param {Array} list The list of elements to consider. - * @return {Array} A copy of the list with only the first `list.length - n` elements - * @see R.takeLast, R.drop, R.dropWhile, R.dropLastWhile - * @example - * - * R.dropLast(1, ['foo', 'bar', 'baz']); //=> ['foo', 'bar'] - * R.dropLast(2, ['foo', 'bar', 'baz']); //=> ['foo'] - * R.dropLast(3, ['foo', 'bar', 'baz']); //=> [] - * R.dropLast(4, ['foo', 'bar', 'baz']); //=> [] - * R.dropLast(3, 'ramda'); //=> 'ra' - */ - - var dropLast$1 = - /*#__PURE__*/ - _curry2( - /*#__PURE__*/ - _dispatchable([], _xdropLast, dropLast)); - - var XDropRepeatsWith = - /*#__PURE__*/ - function () { - function XDropRepeatsWith(pred, xf) { - this.xf = xf; - this.pred = pred; - this.lastValue = undefined; - this.seenFirstValue = false; - } - - XDropRepeatsWith.prototype['@@transducer/init'] = _xfBase.init; - XDropRepeatsWith.prototype['@@transducer/result'] = _xfBase.result; - - XDropRepeatsWith.prototype['@@transducer/step'] = function (result, input) { - var sameAsLast = false; - - if (!this.seenFirstValue) { - this.seenFirstValue = true; - } else if (this.pred(this.lastValue, input)) { - sameAsLast = true; - } - - this.lastValue = input; - return sameAsLast ? result : this.xf['@@transducer/step'](result, input); - }; - - return XDropRepeatsWith; - }(); - - var _xdropRepeatsWith = - /*#__PURE__*/ - _curry2(function _xdropRepeatsWith(pred, xf) { - return new XDropRepeatsWith(pred, xf); - }); - - /** - * Returns the nth element of the given list or string. If n is negative the - * element at index length + n is returned. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category List - * @sig Number -> [a] -> a | Undefined - * @sig Number -> String -> String - * @param {Number} offset - * @param {*} list - * @return {*} - * @example - * - * var list = ['foo', 'bar', 'baz', 'quux']; - * R.nth(1, list); //=> 'bar' - * R.nth(-1, list); //=> 'quux' - * R.nth(-99, list); //=> undefined - * - * R.nth(2, 'abc'); //=> 'c' - * R.nth(3, 'abc'); //=> '' - * @symb R.nth(-1, [a, b, c]) = c - * @symb R.nth(0, [a, b, c]) = a - * @symb R.nth(1, [a, b, c]) = b - */ - - var nth = - /*#__PURE__*/ - _curry2(function nth(offset, list) { - var idx = offset < 0 ? list.length + offset : offset; - return _isString(list) ? list.charAt(idx) : list[idx]; - }); - - /** - * Returns the last element of the given list or string. - * - * @func - * @memberOf R - * @since v0.1.4 - * @category List - * @sig [a] -> a | Undefined - * @sig String -> String - * @param {*} list - * @return {*} - * @see R.init, R.head, R.tail - * @example - * - * R.last(['fi', 'fo', 'fum']); //=> 'fum' - * R.last([]); //=> undefined - * - * R.last('abc'); //=> 'c' - * R.last(''); //=> '' - */ - - var last = - /*#__PURE__*/ - nth(-1); - - /** - * Returns a new list without any consecutively repeating elements. Equality is - * determined by applying the supplied predicate to each pair of consecutive elements. The - * first element in a series of equal elements will be preserved. - * - * Acts as a transducer if a transformer is given in list position. - * - * @func - * @memberOf R - * @since v0.14.0 - * @category List - * @sig ((a, a) -> Boolean) -> [a] -> [a] - * @param {Function} pred A predicate used to test whether two items are equal. - * @param {Array} list The array to consider. - * @return {Array} `list` without repeating elements. - * @see R.transduce - * @example - * - * var l = [1, -1, 1, 3, 4, -4, -4, -5, 5, 3, 3]; - * R.dropRepeatsWith(R.eqBy(Math.abs), l); //=> [1, 3, 4, -5, 3] - */ - - var dropRepeatsWith = - /*#__PURE__*/ - _curry2( - /*#__PURE__*/ - _dispatchable([], _xdropRepeatsWith, function dropRepeatsWith(pred, list) { - var result = []; - var idx = 1; - var len = list.length; - - if (len !== 0) { - result[0] = list[0]; - - while (idx < len) { - if (!pred(last(result), list[idx])) { - result[result.length] = list[idx]; - } - - idx += 1; - } - } - - return result; - })); - - /** - * Returns a new list without any consecutively repeating elements. - * [`R.equals`](#equals) is used to determine equality. - * - * Acts as a transducer if a transformer is given in list position. - * - * @func - * @memberOf R - * @since v0.14.0 - * @category List - * @sig [a] -> [a] - * @param {Array} list The array to consider. - * @return {Array} `list` without repeating elements. - * @see R.transduce - * @example - * - * R.dropRepeats([1, 1, 1, 2, 3, 4, 4, 2, 2]); //=> [1, 2, 3, 4, 2] - */ - - var dropRepeats = - /*#__PURE__*/ - _curry1( - /*#__PURE__*/ - _dispatchable([], - /*#__PURE__*/ - _xdropRepeatsWith(equals), - /*#__PURE__*/ - dropRepeatsWith(equals))); - - /** - * Returns a new function much like the supplied one, except that the first two - * arguments' order is reversed. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Function - * @sig ((a, b, c, ...) -> z) -> (b -> a -> c -> ... -> z) - * @param {Function} fn The function to invoke with its first two parameters reversed. - * @return {*} The result of invoking `fn` with its first two parameters' order reversed. - * @example - * - * var mergeThree = (a, b, c) => [].concat(a, b, c); - * - * mergeThree(1, 2, 3); //=> [1, 2, 3] - * - * R.flip(mergeThree)(1, 2, 3); //=> [2, 1, 3] - * @symb R.flip(f)(a, b, c) = f(b, a, c) - */ - - var flip = - /*#__PURE__*/ - _curry1(function flip(fn) { - return curryN(fn.length, function (a, b) { - var args = Array.prototype.slice.call(arguments, 0); - args[0] = b; - args[1] = a; - return fn.apply(this, args); - }); - }); - - /** - * Creates a new object from a list key-value pairs. If a key appears in - * multiple pairs, the rightmost pair is included in the object. - * - * @func - * @memberOf R - * @since v0.3.0 - * @category List - * @sig [[k,v]] -> {k: v} - * @param {Array} pairs An array of two-element arrays that will be the keys and values of the output object. - * @return {Object} The object made by pairing up `keys` and `values`. - * @see R.toPairs, R.pair - * @example - * - * R.fromPairs([['a', 1], ['b', 2], ['c', 3]]); //=> {a: 1, b: 2, c: 3} - */ - - var fromPairs = - /*#__PURE__*/ - _curry1(function fromPairs(pairs) { - var result = {}; - var idx = 0; - - while (idx < pairs.length) { - result[pairs[idx][0]] = pairs[idx][1]; - idx += 1; - } - - return result; - }); - - /** - * Splits a list into sub-lists stored in an object, based on the result of - * calling a String-returning function on each element, and grouping the - * results according to values returned. - * - * Dispatches to the `groupBy` method of the second argument, if present. - * - * Acts as a transducer if a transformer is given in list position. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category List - * @sig (a -> String) -> [a] -> {String: [a]} - * @param {Function} fn Function :: a -> String - * @param {Array} list The array to group - * @return {Object} An object with the output of `fn` for keys, mapped to arrays of elements - * that produced that key when passed to `fn`. - * @see R.transduce - * @example - * - * var byGrade = R.groupBy(function(student) { - * var score = student.score; - * return score < 65 ? 'F' : - * score < 70 ? 'D' : - * score < 80 ? 'C' : - * score < 90 ? 'B' : 'A'; - * }); - * var students = [{name: 'Abby', score: 84}, - * {name: 'Eddy', score: 58}, - * // ... - * {name: 'Jack', score: 69}]; - * byGrade(students); - * // { - * // 'A': [{name: 'Dianne', score: 99}], - * // 'B': [{name: 'Abby', score: 84}] - * // // ..., - * // 'F': [{name: 'Eddy', score: 58}] - * // } - */ - - var groupBy = - /*#__PURE__*/ - _curry2( - /*#__PURE__*/ - _checkForMethod('groupBy', - /*#__PURE__*/ - reduceBy(function (acc, item) { - if (acc == null) { - acc = []; - } - - acc.push(item); - return acc; - }, null))); - - /** - * Returns the first element of the given list or string. In some libraries - * this function is named `first`. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category List - * @sig [a] -> a | Undefined - * @sig String -> String - * @param {Array|String} list - * @return {*} - * @see R.tail, R.init, R.last - * @example - * - * R.head(['fi', 'fo', 'fum']); //=> 'fi' - * R.head([]); //=> undefined - * - * R.head('abc'); //=> 'a' - * R.head(''); //=> '' - */ - - var head = - /*#__PURE__*/ - nth(0); - - function _identity(x) { - return x; - } - - /** - * A function that does nothing but return the parameter supplied to it. Good - * as a default or placeholder function. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Function - * @sig a -> a - * @param {*} x The value to return. - * @return {*} The input value, `x`. - * @example - * - * R.identity(1); //=> 1 - * - * var obj = {}; - * R.identity(obj) === obj; //=> true - * @symb R.identity(a) = a - */ - - var identity = - /*#__PURE__*/ - _curry1(_identity); - - /** - * Increments its argument. - * - * @func - * @memberOf R - * @since v0.9.0 - * @category Math - * @sig Number -> Number - * @param {Number} n - * @return {Number} n + 1 - * @see R.dec - * @example - * - * R.inc(42); //=> 43 - */ - - var inc = - /*#__PURE__*/ - add(1); - - /** - * Given a function that generates a key, turns a list of objects into an - * object indexing the objects by the given key. Note that if multiple - * objects generate the same value for the indexing key only the last value - * will be included in the generated object. - * - * Acts as a transducer if a transformer is given in list position. - * - * @func - * @memberOf R - * @since v0.19.0 - * @category List - * @sig (a -> String) -> [{k: v}] -> {k: {k: v}} - * @param {Function} fn Function :: a -> String - * @param {Array} array The array of objects to index - * @return {Object} An object indexing each array element by the given property. - * @example - * - * var list = [{id: 'xyz', title: 'A'}, {id: 'abc', title: 'B'}]; - * R.indexBy(R.prop('id'), list); - * //=> {abc: {id: 'abc', title: 'B'}, xyz: {id: 'xyz', title: 'A'}} - */ - - var indexBy = - /*#__PURE__*/ - reduceBy(function (acc, elem) { - return elem; - }, null); - - /** - * Returns all but the last element of the given list or string. - * - * @func - * @memberOf R - * @since v0.9.0 - * @category List - * @sig [a] -> [a] - * @sig String -> String - * @param {*} list - * @return {*} - * @see R.last, R.head, R.tail - * @example - * - * R.init([1, 2, 3]); //=> [1, 2] - * R.init([1, 2]); //=> [1] - * R.init([1]); //=> [] - * R.init([]); //=> [] - * - * R.init('abc'); //=> 'ab' - * R.init('ab'); //=> 'a' - * R.init('a'); //=> '' - * R.init(''); //=> '' - */ - - var init = - /*#__PURE__*/ - slice(0, -1); - - var _validateCollection = function (it, TYPE) { - if (!_isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!'); - return it; - }; - - var dP$5 = _objectDp.f; - - - - - - - - - - var fastKey = _meta.fastKey; - - var SIZE = _descriptors ? '_s' : 'size'; - - var getEntry = function (that, key) { - // fast case - var index = fastKey(key); - var entry; - if (index !== 'F') return that._i[index]; - // frozen object case - for (entry = that._f; entry; entry = entry.n) { - if (entry.k == key) return entry; - } - }; - - var _collectionStrong = { - getConstructor: function (wrapper, NAME, IS_MAP, ADDER) { - var C = wrapper(function (that, iterable) { - _anInstance(that, C, NAME, '_i'); - that._t = NAME; // collection type - that._i = _objectCreate(null); // index - that._f = undefined; // first entry - that._l = undefined; // last entry - that[SIZE] = 0; // size - if (iterable != undefined) _forOf(iterable, IS_MAP, that[ADDER], that); - }); - _redefineAll(C.prototype, { - // 23.1.3.1 Map.prototype.clear() - // 23.2.3.2 Set.prototype.clear() - clear: function clear() { - for (var that = _validateCollection(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) { - entry.r = true; - if (entry.p) entry.p = entry.p.n = undefined; - delete data[entry.i]; - } - that._f = that._l = undefined; - that[SIZE] = 0; - }, - // 23.1.3.3 Map.prototype.delete(key) - // 23.2.3.4 Set.prototype.delete(value) - 'delete': function (key) { - var that = _validateCollection(this, NAME); - var entry = getEntry(that, key); - if (entry) { - var next = entry.n; - var prev = entry.p; - delete that._i[entry.i]; - entry.r = true; - if (prev) prev.n = next; - if (next) next.p = prev; - if (that._f == entry) that._f = next; - if (that._l == entry) that._l = prev; - that[SIZE]--; - } return !!entry; - }, - // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined) - // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined) - forEach: function forEach(callbackfn /* , that = undefined */) { - _validateCollection(this, NAME); - var f = _ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); - var entry; - while (entry = entry ? entry.n : this._f) { - f(entry.v, entry.k, this); - // revert to the last existing entry - while (entry && entry.r) entry = entry.p; - } - }, - // 23.1.3.7 Map.prototype.has(key) - // 23.2.3.7 Set.prototype.has(value) - has: function has(key) { - return !!getEntry(_validateCollection(this, NAME), key); - } - }); - if (_descriptors) dP$5(C.prototype, 'size', { - get: function () { - return _validateCollection(this, NAME)[SIZE]; - } - }); - return C; - }, - def: function (that, key, value) { - var entry = getEntry(that, key); - var prev, index; - // change existing entry - if (entry) { - entry.v = value; - // create new entry - } else { - that._l = entry = { - i: index = fastKey(key, true), // <- index - k: key, // <- key - v: value, // <- value - p: prev = that._l, // <- previous entry - n: undefined, // <- next entry - r: false // <- removed - }; - if (!that._f) that._f = entry; - if (prev) prev.n = entry; - that[SIZE]++; - // add to index - if (index !== 'F') that._i[index] = entry; - } return that; - }, - getEntry: getEntry, - setStrong: function (C, NAME, IS_MAP) { - // add .keys, .values, .entries, [@@iterator] - // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11 - _iterDefine(C, NAME, function (iterated, kind) { - this._t = _validateCollection(iterated, NAME); // target - this._k = kind; // kind - this._l = undefined; // previous - }, function () { - var that = this; - var kind = that._k; - var entry = that._l; - // revert to the last existing entry - while (entry && entry.r) entry = entry.p; - // get next entry - if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) { - // or finish the iteration - that._t = undefined; - return _iterStep(1); - } - // return step by kind - if (kind == 'keys') return _iterStep(0, entry.k); - if (kind == 'values') return _iterStep(0, entry.v); - return _iterStep(0, [entry.k, entry.v]); - }, IS_MAP ? 'entries' : 'values', !IS_MAP, true); - - // add [@@species], 23.1.2.2, 23.2.2.2 - _setSpecies(NAME); - } - }; - - var _collection = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) { - var Base = _global[NAME]; - var C = Base; - var ADDER = IS_MAP ? 'set' : 'add'; - var proto = C && C.prototype; - var O = {}; - var fixMethod = function (KEY) { - var fn = proto[KEY]; - _redefine(proto, KEY, - KEY == 'delete' ? function (a) { - return IS_WEAK && !_isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); - } : KEY == 'has' ? function has(a) { - return IS_WEAK && !_isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); - } : KEY == 'get' ? function get(a) { - return IS_WEAK && !_isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a); - } : KEY == 'add' ? function add(a) { fn.call(this, a === 0 ? 0 : a); return this; } - : function set(a, b) { fn.call(this, a === 0 ? 0 : a, b); return this; } - ); - }; - if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !_fails(function () { - new C().entries().next(); - }))) { - // create collection constructor - C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); - _redefineAll(C.prototype, methods); - _meta.NEED = true; - } else { - var instance = new C(); - // early implementations not supports chaining - var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance; - // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false - var THROWS_ON_PRIMITIVES = _fails(function () { instance.has(1); }); - // most early implementations doesn't supports iterables, most modern - not close it correctly - var ACCEPT_ITERABLES = _iterDetect(function (iter) { new C(iter); }); // eslint-disable-line no-new - // for early implementations -0 and +0 not the same - var BUGGY_ZERO = !IS_WEAK && _fails(function () { - // V8 ~ Chromium 42- fails only with 5+ elements - var $instance = new C(); - var index = 5; - while (index--) $instance[ADDER](index, index); - return !$instance.has(-0); - }); - if (!ACCEPT_ITERABLES) { - C = wrapper(function (target, iterable) { - _anInstance(target, C, NAME); - var that = _inheritIfRequired(new Base(), target, C); - if (iterable != undefined) _forOf(iterable, IS_MAP, that[ADDER], that); - return that; - }); - C.prototype = proto; - proto.constructor = C; - } - if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) { - fixMethod('delete'); - fixMethod('has'); - IS_MAP && fixMethod('get'); - } - if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER); - // weak collections should not contains .clear method - if (IS_WEAK && proto.clear) delete proto.clear; - } - - _setToStringTag(C, NAME); - - O[NAME] = C; - _export(_export.G + _export.W + _export.F * (C != Base), O); - - if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP); - - return C; - }; - - var SET = 'Set'; - - // 23.2 Set Objects - var es6_set = _collection(SET, function (get) { - return function Set() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; - }, { - // 23.2.3.1 Set.prototype.add(value) - add: function add(value) { - return _collectionStrong.def(_validateCollection(this, SET), value = value === 0 ? 0 : value, value); - } - }, _collectionStrong); - - var _Set = - /*#__PURE__*/ - function () { - function _Set() { - /* globals Set */ - this._nativeSet = typeof Set === 'function' ? new Set() : null; - this._items = {}; - } // until we figure out why jsdoc chokes on this - // @param item The item to add to the Set - // @returns {boolean} true if the item did not exist prior, otherwise false - // - - - _Set.prototype.add = function (item) { - return !hasOrAdd(item, true, this); - }; // - // @param item The item to check for existence in the Set - // @returns {boolean} true if the item exists in the Set, otherwise false - // - - - _Set.prototype.has = function (item) { - return hasOrAdd(item, false, this); - }; // - // Combines the logic for checking whether an item is a member of the set and - // for adding a new item to the set. - // - // @param item The item to check or add to the Set instance. - // @param shouldAdd If true, the item will be added to the set if it doesn't - // already exist. - // @param set The set instance to check or add to. - // @return {boolean} true if the item already existed, otherwise false. - // - - - return _Set; - }(); - - function hasOrAdd(item, shouldAdd, set) { - var type = _typeof(item); - - var prevSize, newSize; - - switch (type) { - case 'string': - case 'number': - // distinguish between +0 and -0 - if (item === 0 && 1 / item === -Infinity) { - if (set._items['-0']) { - return true; - } else { - if (shouldAdd) { - set._items['-0'] = true; - } - - return false; - } - } // these types can all utilise the native Set - - - if (set._nativeSet !== null) { - if (shouldAdd) { - prevSize = set._nativeSet.size; - - set._nativeSet.add(item); - - newSize = set._nativeSet.size; - return newSize === prevSize; - } else { - return set._nativeSet.has(item); - } - } else { - if (!(type in set._items)) { - if (shouldAdd) { - set._items[type] = {}; - set._items[type][item] = true; - } - - return false; - } else if (item in set._items[type]) { - return true; - } else { - if (shouldAdd) { - set._items[type][item] = true; - } - - return false; - } - } - - case 'boolean': - // set._items['boolean'] holds a two element array - // representing [ falseExists, trueExists ] - if (type in set._items) { - var bIdx = item ? 1 : 0; - - if (set._items[type][bIdx]) { - return true; - } else { - if (shouldAdd) { - set._items[type][bIdx] = true; - } - - return false; - } - } else { - if (shouldAdd) { - set._items[type] = item ? [false, true] : [true, false]; - } - - return false; - } - - case 'function': - // compare functions for reference equality - if (set._nativeSet !== null) { - if (shouldAdd) { - prevSize = set._nativeSet.size; - - set._nativeSet.add(item); - - newSize = set._nativeSet.size; - return newSize === prevSize; - } else { - return set._nativeSet.has(item); - } - } else { - if (!(type in set._items)) { - if (shouldAdd) { - set._items[type] = [item]; - } - - return false; - } - - if (!_contains(item, set._items[type])) { - if (shouldAdd) { - set._items[type].push(item); - } - - return false; - } - - return true; - } - - case 'undefined': - if (set._items[type]) { - return true; - } else { - if (shouldAdd) { - set._items[type] = true; - } - - return false; - } - - case 'object': - if (item === null) { - if (!set._items['null']) { - if (shouldAdd) { - set._items['null'] = true; - } - - return false; - } - - return true; - } - - /* falls through */ - - default: - // reduce the search size of heterogeneous sets by creating buckets - // for each type. - type = Object.prototype.toString.call(item); - - if (!(type in set._items)) { - if (shouldAdd) { - set._items[type] = [item]; - } - - return false; - } // scan through all previously applied items - - - if (!_contains(item, set._items[type])) { - if (shouldAdd) { - set._items[type].push(item); - } - - return false; - } - - return true; - } - } // A simple Set type that honours R.equals semantics - - /** - * Returns a new list containing only one copy of each element in the original - * list, based upon the value returned by applying the supplied function to - * each list element. Prefers the first item if the supplied function produces - * the same value on two items. [`R.equals`](#equals) is used for comparison. - * - * @func - * @memberOf R - * @since v0.16.0 - * @category List - * @sig (a -> b) -> [a] -> [a] - * @param {Function} fn A function used to produce a value to use during comparisons. - * @param {Array} list The array to consider. - * @return {Array} The list of unique items. - * @example - * - * R.uniqBy(Math.abs, [-1, -5, 2, 10, 1, 2]); //=> [-1, -5, 2, 10] - */ - - var uniqBy = - /*#__PURE__*/ - _curry2(function uniqBy(fn, list) { - var set = new _Set(); - var result = []; - var idx = 0; - var appliedItem, item; - - while (idx < list.length) { - item = list[idx]; - appliedItem = fn(item); - - if (set.add(appliedItem)) { - result.push(item); - } - - idx += 1; - } - - return result; - }); - - /** - * Returns a new list containing only one copy of each element in the original - * list. [`R.equals`](#equals) is used to determine equality. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category List - * @sig [a] -> [a] - * @param {Array} list The array to consider. - * @return {Array} The list of unique items. - * @example - * - * R.uniq([1, 1, 2, 1]); //=> [1, 2] - * R.uniq([1, '1']); //=> [1, '1'] - * R.uniq([[42], [42]]); //=> [[42]] - */ - - var uniq = - /*#__PURE__*/ - uniqBy(identity); - - /** - * Turns a named method with a specified arity into a function that can be - * called directly supplied with arguments and a target object. - * - * The returned function is curried and accepts `arity + 1` parameters where - * the final parameter is the target object. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Function - * @sig Number -> String -> (a -> b -> ... -> n -> Object -> *) - * @param {Number} arity Number of arguments the returned function should take - * before the target object. - * @param {String} method Name of the method to call. - * @return {Function} A new curried function. - * @see R.construct - * @example - * - * var sliceFrom = R.invoker(1, 'slice'); - * sliceFrom(6, 'abcdefghijklm'); //=> 'ghijklm' - * var sliceFrom6 = R.invoker(2, 'slice')(6); - * sliceFrom6(8, 'abcdefghijklm'); //=> 'gh' - * @symb R.invoker(0, 'method')(o) = o['method']() - * @symb R.invoker(1, 'method')(a, o) = o['method'](a) - * @symb R.invoker(2, 'method')(a, b, o) = o['method'](a, b) - */ - - var invoker = - /*#__PURE__*/ - _curry2(function invoker(arity, method) { - return curryN(arity + 1, function () { - var target = arguments[arity]; - - if (target != null && _isFunction(target[method])) { - return target[method].apply(target, Array.prototype.slice.call(arguments, 0, arity)); - } - - throw new TypeError(toString$3(target) + ' does not have a method named "' + method + '"'); - }); - }); - - /** - * Returns a string made by inserting the `separator` between each element and - * concatenating all the elements into a single string. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category List - * @sig String -> [a] -> String - * @param {Number|String} separator The string used to separate the elements. - * @param {Array} xs The elements to join into a string. - * @return {String} str The string made by concatenating `xs` with `separator`. - * @see R.split - * @example - * - * var spacer = R.join(' '); - * spacer(['a', 2, 3.4]); //=> 'a 2 3.4' - * R.join('|', [1, 2, 3]); //=> '1|2|3' - */ - - var join = - /*#__PURE__*/ - invoker(1, 'join'); - - /** - * juxt applies a list of functions to a list of values. - * - * @func - * @memberOf R - * @since v0.19.0 - * @category Function - * @sig [(a, b, ..., m) -> n] -> ((a, b, ..., m) -> [n]) - * @param {Array} fns An array of functions - * @return {Function} A function that returns a list of values after applying each of the original `fns` to its parameters. - * @see R.applySpec - * @example - * - * var getRange = R.juxt([Math.min, Math.max]); - * getRange(3, 4, 9, -3); //=> [-3, 9] - * @symb R.juxt([f, g, h])(a, b) = [f(a, b), g(a, b), h(a, b)] - */ - - var juxt = - /*#__PURE__*/ - _curry1(function juxt(fns) { - return converge(function () { - return Array.prototype.slice.call(arguments, 0); - }, fns); - }); - - var $native$1 = [].lastIndexOf; - var NEGATIVE_ZERO$1 = !!$native$1 && 1 / [1].lastIndexOf(1, -0) < 0; - - _export(_export.P + _export.F * (NEGATIVE_ZERO$1 || !_strictMethod($native$1)), 'Array', { - // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex]) - lastIndexOf: function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { - // convert -0 to +0 - if (NEGATIVE_ZERO$1) return $native$1.apply(this, arguments) || 0; - var O = _toIobject(this); - var length = _toLength(O.length); - var index = length - 1; - if (arguments.length > 1) index = Math.min(index, _toInteger(arguments[1])); - if (index < 0) index = length + index; - for (;index >= 0; index--) if (index in O) if (O[index] === searchElement) return index || 0; - return -1; - } - }); - - /** - * Takes a function and two values, and returns whichever value produces the - * larger result when passed to the provided function. - * - * @func - * @memberOf R - * @since v0.8.0 - * @category Relation - * @sig Ord b => (a -> b) -> a -> a -> a - * @param {Function} f - * @param {*} a - * @param {*} b - * @return {*} - * @see R.max, R.minBy - * @example - * - * // square :: Number -> Number - * var square = n => n * n; - * - * R.maxBy(square, -3, 2); //=> -3 - * - * R.reduce(R.maxBy(square), 0, [3, -5, 4, 1, -2]); //=> -5 - * R.reduce(R.maxBy(square), 0, []); //=> 0 - */ - - var maxBy = - /*#__PURE__*/ - _curry3(function maxBy(f, a, b) { - return f(b) > f(a) ? b : a; - }); - - /** - * Adds together all the elements of a list. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Math - * @sig [Number] -> Number - * @param {Array} list An array of numbers - * @return {Number} The sum of all the numbers in the list. - * @see R.reduce - * @example - * - * R.sum([2,4,6,8,100,1]); //=> 121 - */ - - var sum = - /*#__PURE__*/ - reduce(add, 0); - - /** - * A customisable version of [`R.memoize`](#memoize). `memoizeWith` takes an - * additional function that will be applied to a given argument set and used to - * create the cache key under which the results of the function to be memoized - * will be stored. Care must be taken when implementing key generation to avoid - * clashes that may overwrite previous entries erroneously. - * - * - * @func - * @memberOf R - * @since v0.24.0 - * @category Function - * @sig (*... -> String) -> (*... -> a) -> (*... -> a) - * @param {Function} fn The function to generate the cache key. - * @param {Function} fn The function to memoize. - * @return {Function} Memoized version of `fn`. - * @see R.memoize - * @example - * - * let count = 0; - * const factorial = R.memoizeWith(R.identity, n => { - * count += 1; - * return R.product(R.range(1, n + 1)); - * }); - * factorial(5); //=> 120 - * factorial(5); //=> 120 - * factorial(5); //=> 120 - * count; //=> 1 - */ - - var memoizeWith = - /*#__PURE__*/ - _curry2(function memoizeWith(mFn, fn) { - var cache = {}; - return _arity(fn.length, function () { - var key = mFn.apply(this, arguments); - - if (!_has$1(key, cache)) { - cache[key] = fn.apply(this, arguments); - } - - return cache[key]; - }); - }); - - /** - * Creates a new function that, when invoked, caches the result of calling `fn` - * for a given argument set and returns the result. Subsequent calls to the - * memoized `fn` with the same argument set will not result in an additional - * call to `fn`; instead, the cached result for that set of arguments will be - * returned. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Function - * @sig (*... -> a) -> (*... -> a) - * @param {Function} fn The function to memoize. - * @return {Function} Memoized version of `fn`. - * @see R.memoizeWith - * @deprecated since v0.25.0 - * @example - * - * let count = 0; - * const factorial = R.memoize(n => { - * count += 1; - * return R.product(R.range(1, n + 1)); - * }); - * factorial(5); //=> 120 - * factorial(5); //=> 120 - * factorial(5); //=> 120 - * count; //=> 1 - */ - - var memoize = - /*#__PURE__*/ - memoizeWith(function () { - return toString$3(arguments); - }); - - /** - * Takes a function and two values, and returns whichever value produces the - * smaller result when passed to the provided function. - * - * @func - * @memberOf R - * @since v0.8.0 - * @category Relation - * @sig Ord b => (a -> b) -> a -> a -> a - * @param {Function} f - * @param {*} a - * @param {*} b - * @return {*} - * @see R.min, R.maxBy - * @example - * - * // square :: Number -> Number - * var square = n => n * n; - * - * R.minBy(square, -3, 2); //=> 2 - * - * R.reduce(R.minBy(square), Infinity, [3, -5, 4, 1, -2]); //=> 1 - * R.reduce(R.minBy(square), Infinity, []); //=> Infinity - */ - - var minBy = - /*#__PURE__*/ - _curry3(function minBy(f, a, b) { - return f(b) < f(a) ? b : a; - }); - - /** - * Multiplies two numbers. Equivalent to `a * b` but curried. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Math - * @sig Number -> Number -> Number - * @param {Number} a The first value. - * @param {Number} b The second value. - * @return {Number} The result of `a * b`. - * @see R.divide - * @example - * - * var double = R.multiply(2); - * var triple = R.multiply(3); - * double(3); //=> 6 - * triple(4); //=> 12 - * R.multiply(2, 5); //=> 10 - */ - - var multiply = - /*#__PURE__*/ - _curry2(function multiply(a, b) { - return a * b; - }); - - function _createPartialApplicator(concat) { - return _curry2(function (fn, args) { - return _arity(Math.max(0, fn.length - args.length), function () { - return fn.apply(this, concat(args, arguments)); - }); - }); - } - - /** - * Takes a function `f` and a list of arguments, and returns a function `g`. - * When applied, `g` returns the result of applying `f` to the arguments - * provided to `g` followed by the arguments provided initially. - * - * @func - * @memberOf R - * @since v0.10.0 - * @category Function - * @sig ((a, b, c, ..., n) -> x) -> [d, e, f, ..., n] -> ((a, b, c, ...) -> x) - * @param {Function} f - * @param {Array} args - * @return {Function} - * @see R.partial - * @example - * - * var greet = (salutation, title, firstName, lastName) => - * salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!'; - * - * var greetMsJaneJones = R.partialRight(greet, ['Ms.', 'Jane', 'Jones']); - * - * greetMsJaneJones('Hello'); //=> 'Hello, Ms. Jane Jones!' - * @symb R.partialRight(f, [a, b])(c, d) = f(c, d, a, b) - */ - - var partialRight = - /*#__PURE__*/ - _createPartialApplicator( - /*#__PURE__*/ - flip(_concat)); - - /** - * Takes a predicate and a list or other `Filterable` object and returns the - * pair of filterable objects of the same type of elements which do and do not - * satisfy, the predicate, respectively. Filterable objects include plain objects or any object - * that has a filter method such as `Array`. - * - * @func - * @memberOf R - * @since v0.1.4 - * @category List - * @sig Filterable f => (a -> Boolean) -> f a -> [f a, f a] - * @param {Function} pred A predicate to determine which side the element belongs to. - * @param {Array} filterable the list (or other filterable) to partition. - * @return {Array} An array, containing first the subset of elements that satisfy the - * predicate, and second the subset of elements that do not satisfy. - * @see R.filter, R.reject - * @example - * - * R.partition(R.contains('s'), ['sss', 'ttt', 'foo', 'bars']); - * // => [ [ 'sss', 'bars' ], [ 'ttt', 'foo' ] ] - * - * R.partition(R.contains('s'), { a: 'sss', b: 'ttt', foo: 'bars' }); - * // => [ { a: 'sss', foo: 'bars' }, { b: 'ttt' } ] - */ - - var partition = - /*#__PURE__*/ - juxt([filter, reject]); - - /** - * Similar to `pick` except that this one includes a `key: undefined` pair for - * properties that don't exist. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Object - * @sig [k] -> {k: v} -> {k: v} - * @param {Array} names an array of String property names to copy onto a new object - * @param {Object} obj The object to copy from - * @return {Object} A new object with only properties from `names` on it. - * @see R.pick - * @example - * - * R.pickAll(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4} - * R.pickAll(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, e: undefined, f: undefined} - */ - - var pickAll = - /*#__PURE__*/ - _curry2(function pickAll(names, obj) { - var result = {}; - var idx = 0; - var len = names.length; - - while (idx < len) { - var name = names[idx]; - result[name] = obj[name]; - idx += 1; - } - - return result; - }); - - /** - * Multiplies together all the elements of a list. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Math - * @sig [Number] -> Number - * @param {Array} list An array of numbers - * @return {Number} The product of all the numbers in the list. - * @see R.reduce - * @example - * - * R.product([2,4,6,8,100,1]); //=> 38400 - */ - - var product = - /*#__PURE__*/ - reduce(multiply, 1); - - /** - * Accepts a function `fn` and a list of transformer functions and returns a - * new curried function. When the new function is invoked, it calls the - * function `fn` with parameters consisting of the result of calling each - * supplied handler on successive arguments to the new function. - * - * If more arguments are passed to the returned function than transformer - * functions, those arguments are passed directly to `fn` as additional - * parameters. If you expect additional arguments that don't need to be - * transformed, although you can ignore them, it's best to pass an identity - * function so that the new function reports the correct arity. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Function - * @sig ((x1, x2, ...) -> z) -> [(a -> x1), (b -> x2), ...] -> (a -> b -> ... -> z) - * @param {Function} fn The function to wrap. - * @param {Array} transformers A list of transformer functions - * @return {Function} The wrapped function. - * @see R.converge - * @example - * - * R.useWith(Math.pow, [R.identity, R.identity])(3, 4); //=> 81 - * R.useWith(Math.pow, [R.identity, R.identity])(3)(4); //=> 81 - * R.useWith(Math.pow, [R.dec, R.inc])(3, 4); //=> 32 - * R.useWith(Math.pow, [R.dec, R.inc])(3)(4); //=> 32 - * @symb R.useWith(f, [g, h])(a, b) = f(g(a), h(b)) - */ - - var useWith = - /*#__PURE__*/ - _curry2(function useWith(fn, transformers) { - return curryN(transformers.length, function () { - var args = []; - var idx = 0; - - while (idx < transformers.length) { - args.push(transformers[idx].call(this, arguments[idx])); - idx += 1; - } - - return fn.apply(this, args.concat(Array.prototype.slice.call(arguments, transformers.length))); - }); - }); - - /** - * Reasonable analog to SQL `select` statement. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Object - * @category Relation - * @sig [k] -> [{k: v}] -> [{k: v}] - * @param {Array} props The property names to project - * @param {Array} objs The objects to query - * @return {Array} An array of objects with just the `props` properties. - * @example - * - * var abby = {name: 'Abby', age: 7, hair: 'blond', grade: 2}; - * var fred = {name: 'Fred', age: 12, hair: 'brown', grade: 7}; - * var kids = [abby, fred]; - * R.project(['name', 'grade'], kids); //=> [{name: 'Abby', grade: 2}, {name: 'Fred', grade: 7}] - */ - - var project = - /*#__PURE__*/ - useWith(_map, [pickAll, identity]); // passing `identity` gives correct arity - - /** - * Splits a string into an array of strings based on the given - * separator. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category String - * @sig (String | RegExp) -> String -> [String] - * @param {String|RegExp} sep The pattern. - * @param {String} str The string to separate into an array. - * @return {Array} The array of strings from `str` separated by `str`. - * @see R.join - * @example - * - * var pathComponents = R.split('/'); - * R.tail(pathComponents('/usr/local/bin/node')); //=> ['usr', 'local', 'bin', 'node'] - * - * R.split('.', 'a.b.c.xyz.d'); //=> ['a', 'b', 'c', 'xyz', 'd'] - */ - - var split = - /*#__PURE__*/ - invoker(1, 'split'); - - /** - * The lower case version of a string. - * - * @func - * @memberOf R - * @since v0.9.0 - * @category String - * @sig String -> String - * @param {String} str The string to lower case. - * @return {String} The lower case version of `str`. - * @see R.toUpper - * @example - * - * R.toLower('XYZ'); //=> 'xyz' - */ - - var toLower = - /*#__PURE__*/ - invoker(0, 'toLowerCase'); - - /** - * Converts an object into an array of key, value arrays. Only the object's - * own properties are used. - * Note that the order of the output array is not guaranteed to be consistent - * across different JS platforms. - * - * @func - * @memberOf R - * @since v0.4.0 - * @category Object - * @sig {String: *} -> [[String,*]] - * @param {Object} obj The object to extract from - * @return {Array} An array of key, value arrays from the object's own properties. - * @see R.fromPairs - * @example - * - * R.toPairs({a: 1, b: 2, c: 3}); //=> [['a', 1], ['b', 2], ['c', 3]] - */ - - var toPairs = - /*#__PURE__*/ - _curry1(function toPairs(obj) { - var pairs = []; - - for (var prop in obj) { - if (_has$1(prop, obj)) { - pairs[pairs.length] = [prop, obj[prop]]; - } - } - - return pairs; - }); - - /** - * The upper case version of a string. - * - * @func - * @memberOf R - * @since v0.9.0 - * @category String - * @sig String -> String - * @param {String} str The string to upper case. - * @return {String} The upper case version of `str`. - * @see R.toLower - * @example - * - * R.toUpper('abc'); //=> 'ABC' - */ - - var toUpper = - /*#__PURE__*/ - invoker(0, 'toUpperCase'); - - /** - * Initializes a transducer using supplied iterator function. Returns a single - * item by iterating through the list, successively calling the transformed - * iterator function and passing it an accumulator value and the current value - * from the array, and then passing the result to the next call. - * - * The iterator function receives two values: *(acc, value)*. It will be - * wrapped as a transformer to initialize the transducer. A transformer can be - * passed directly in place of an iterator function. In both cases, iteration - * may be stopped early with the [`R.reduced`](#reduced) function. - * - * A transducer is a function that accepts a transformer and returns a - * transformer and can be composed directly. - * - * A transformer is an an object that provides a 2-arity reducing iterator - * function, step, 0-arity initial value function, init, and 1-arity result - * extraction function, result. The step function is used as the iterator - * function in reduce. The result function is used to convert the final - * accumulator into the return type and in most cases is - * [`R.identity`](#identity). The init function can be used to provide an - * initial accumulator, but is ignored by transduce. - * - * The iteration is performed with [`R.reduce`](#reduce) after initializing the transducer. - * - * @func - * @memberOf R - * @since v0.12.0 - * @category List - * @sig (c -> c) -> ((a, b) -> a) -> a -> [b] -> a - * @param {Function} xf The transducer function. Receives a transformer and returns a transformer. - * @param {Function} fn The iterator function. Receives two values, the accumulator and the - * current element from the array. Wrapped as transformer, if necessary, and used to - * initialize the transducer - * @param {*} acc The initial accumulator value. - * @param {Array} list The list to iterate over. - * @return {*} The final, accumulated value. - * @see R.reduce, R.reduced, R.into - * @example - * - * var numbers = [1, 2, 3, 4]; - * var transducer = R.compose(R.map(R.add(1)), R.take(2)); - * R.transduce(transducer, R.flip(R.append), [], numbers); //=> [2, 3] - * - * var isOdd = (x) => x % 2 === 1; - * var firstOddTransducer = R.compose(R.filter(isOdd), R.take(1)); - * R.transduce(firstOddTransducer, R.flip(R.append), [], R.range(0, 100)); //=> [1] - */ - - var transduce = - /*#__PURE__*/ - curryN(4, function transduce(xf, fn, acc, list) { - return _reduce(xf(typeof fn === 'function' ? _xwrap(fn) : fn), acc, list); - }); - - var ws = "\t\n\x0B\f\r \xA0\u1680\u180E\u2000\u2001\u2002\u2003" + "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" + "\u2029\uFEFF"; - var zeroWidth = "\u200B"; - var hasProtoTrim = typeof String.prototype.trim === 'function'; - /** - * Removes (strips) whitespace from both ends of the string. - * - * @func - * @memberOf R - * @since v0.6.0 - * @category String - * @sig String -> String - * @param {String} str The string to trim. - * @return {String} Trimmed version of `str`. - * @example - * - * R.trim(' xyz '); //=> 'xyz' - * R.map(R.trim, R.split(',', 'x, y, z')); //=> ['x', 'y', 'z'] - */ - - var _trim = !hasProtoTrim || - /*#__PURE__*/ - ws.trim() || ! - /*#__PURE__*/ - zeroWidth.trim() ? function trim(str) { - var beginRx = new RegExp('^[' + ws + '][' + ws + ']*'); - var endRx = new RegExp('[' + ws + '][' + ws + ']*$'); - return str.replace(beginRx, '').replace(endRx, ''); - } : function trim(str) { - return str.trim(); - }; - - /** - * Combines two lists into a set (i.e. no duplicates) composed of the elements - * of each list. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Relation - * @sig [*] -> [*] -> [*] - * @param {Array} as The first list. - * @param {Array} bs The second list. - * @return {Array} The first and second lists concatenated, with - * duplicates removed. - * @example - * - * R.union([1, 2, 3], [2, 3, 4]); //=> [1, 2, 3, 4] - */ - - var union = - /*#__PURE__*/ - _curry2( - /*#__PURE__*/ - compose(uniq, _concat)); - - /** - * Shorthand for `R.chain(R.identity)`, which removes one level of nesting from - * any [Chain](https://github.com/fantasyland/fantasy-land#chain). - * - * @func - * @memberOf R - * @since v0.3.0 - * @category List - * @sig Chain c => c (c a) -> c a - * @param {*} list - * @return {*} - * @see R.flatten, R.chain - * @example - * - * R.unnest([1, [2], [[3]]]); //=> [1, 2, [3]] - * R.unnest([[1, 2], [3, 4], [5, 6]]); //=> [1, 2, 3, 4, 5, 6] - */ - - var unnest = - /*#__PURE__*/ - chain(_identity); - - // 20.3.3.1 / 15.9.4.4 Date.now() - - - _export(_export.S, 'Date', { now: function () { return new Date().getTime(); } }); - - // 19.1.2.12 Object.isFrozen(O) - - - _objectSap('isFrozen', function ($isFrozen) { - return function isFrozen(it) { - return _isObject(it) ? $isFrozen ? $isFrozen(it) : false : true; - }; - }); - - var $some = _arrayMethods(3); - - _export(_export.P + _export.F * !_strictMethod([].some, true), 'Array', { - // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg]) - some: function some(callbackfn /* , thisArg */) { - return $some(this, callbackfn, arguments[1]); - } - }); - - var moment = createCommonjsModule(function (module, exports) { - - (function (global, factory) { - module.exports = factory(); - })(commonjsGlobal, function () { - - var hookCallback; - - function hooks() { - return hookCallback.apply(null, arguments); - } // This is done to register the method called with moment() - // without creating circular dependencies. - - - function setHookCallback(callback) { - hookCallback = callback; - } - - function isArray(input) { - return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; - } - - function isObject(input) { - // IE8 will treat undefined and null as object if it wasn't for - // input != null - return input != null && Object.prototype.toString.call(input) === '[object Object]'; - } - - function isObjectEmpty(obj) { - if (Object.getOwnPropertyNames) { - return Object.getOwnPropertyNames(obj).length === 0; - } else { - var k; - - for (k in obj) { - if (obj.hasOwnProperty(k)) { - return false; - } - } - - return true; - } - } - - function isUndefined(input) { - return input === void 0; - } - - function isNumber(input) { - return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]'; - } - - function isDate(input) { - return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; - } - - function map(arr, fn) { - var res = [], - i; - - for (i = 0; i < arr.length; ++i) { - res.push(fn(arr[i], i)); - } - - return res; - } - - function hasOwnProp(a, b) { - return Object.prototype.hasOwnProperty.call(a, b); - } - - function extend(a, b) { - for (var i in b) { - if (hasOwnProp(b, i)) { - a[i] = b[i]; - } - } - - if (hasOwnProp(b, 'toString')) { - a.toString = b.toString; - } - - if (hasOwnProp(b, 'valueOf')) { - a.valueOf = b.valueOf; - } - - return a; - } - - function createUTC(input, format, locale, strict) { - return createLocalOrUTC(input, format, locale, strict, true).utc(); - } - - function defaultParsingFlags() { - // We need to deep clone this object. - return { - empty: false, - unusedTokens: [], - unusedInput: [], - overflow: -2, - charsLeftOver: 0, - nullInput: false, - invalidMonth: null, - invalidFormat: false, - userInvalidated: false, - iso: false, - parsedDateParts: [], - meridiem: null, - rfc2822: false, - weekdayMismatch: false - }; - } - - function getParsingFlags(m) { - if (m._pf == null) { - m._pf = defaultParsingFlags(); - } - - return m._pf; - } - - var some; - - if (Array.prototype.some) { - some = Array.prototype.some; - } else { - some = function some(fun) { - var t = Object(this); - var len = t.length >>> 0; - - for (var i = 0; i < len; i++) { - if (i in t && fun.call(this, t[i], i, t)) { - return true; - } - } - - return false; - }; - } - - function isValid(m) { - if (m._isValid == null) { - var flags = getParsingFlags(m); - var parsedParts = some.call(flags.parsedDateParts, function (i) { - return i != null; - }); - var isNowValid = !isNaN(m._d.getTime()) && flags.overflow < 0 && !flags.empty && !flags.invalidMonth && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || flags.meridiem && parsedParts); - - if (m._strict) { - isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === undefined; - } - - if (Object.isFrozen == null || !Object.isFrozen(m)) { - m._isValid = isNowValid; - } else { - return isNowValid; - } - } - - return m._isValid; - } - - function createInvalid(flags) { - var m = createUTC(NaN); - - if (flags != null) { - extend(getParsingFlags(m), flags); - } else { - getParsingFlags(m).userInvalidated = true; - } - - return m; - } // Plugins that add properties should also add the key here (null value), - // so we can properly clone ourselves. - - - var momentProperties = hooks.momentProperties = []; - - function copyConfig(to, from) { - var i, prop, val; - - if (!isUndefined(from._isAMomentObject)) { - to._isAMomentObject = from._isAMomentObject; - } - - if (!isUndefined(from._i)) { - to._i = from._i; - } - - if (!isUndefined(from._f)) { - to._f = from._f; - } - - if (!isUndefined(from._l)) { - to._l = from._l; - } - - if (!isUndefined(from._strict)) { - to._strict = from._strict; - } - - if (!isUndefined(from._tzm)) { - to._tzm = from._tzm; - } - - if (!isUndefined(from._isUTC)) { - to._isUTC = from._isUTC; - } - - if (!isUndefined(from._offset)) { - to._offset = from._offset; - } - - if (!isUndefined(from._pf)) { - to._pf = getParsingFlags(from); - } - - if (!isUndefined(from._locale)) { - to._locale = from._locale; - } - - if (momentProperties.length > 0) { - for (i = 0; i < momentProperties.length; i++) { - prop = momentProperties[i]; - val = from[prop]; - - if (!isUndefined(val)) { - to[prop] = val; - } - } - } - - return to; - } - - var updateInProgress = false; // Moment prototype object - - function Moment(config) { - copyConfig(this, config); - this._d = new Date(config._d != null ? config._d.getTime() : NaN); - - if (!this.isValid()) { - this._d = new Date(NaN); - } // Prevent infinite loop in case updateOffset creates new moment - // objects. - - - if (updateInProgress === false) { - updateInProgress = true; - hooks.updateOffset(this); - updateInProgress = false; - } - } - - function isMoment(obj) { - return obj instanceof Moment || obj != null && obj._isAMomentObject != null; - } + var _objectGopn = { + f: f$6 + }; + + // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window + + var gOPN = _objectGopn.f; + var toString$1 = {}.toString; + + var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames + ? Object.getOwnPropertyNames(window) : []; + + var getWindowNames = function (it) { + try { + return gOPN(it); + } catch (e) { + return windowNames.slice(); + } + }; + + var f$7 = function getOwnPropertyNames(it) { + return windowNames && toString$1.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(_toIobject(it)); + }; + + var _objectGopnExt = { + f: f$7 + }; + + // ECMAScript 6 symbols shim + + + + + + var META = _meta.KEY; + + + + + + + + + + + + + + + + + + + + var gOPD$1 = _objectGopd.f; + var dP$2 = _objectDp.f; + var gOPN$1 = _objectGopnExt.f; + var $Symbol = _global.Symbol; + var $JSON = _global.JSON; + var _stringify = $JSON && $JSON.stringify; + var PROTOTYPE$2 = 'prototype'; + var HIDDEN = _wks('_hidden'); + var TO_PRIMITIVE = _wks('toPrimitive'); + var isEnum = {}.propertyIsEnumerable; + var SymbolRegistry = _shared('symbol-registry'); + var AllSymbols = _shared('symbols'); + var OPSymbols = _shared('op-symbols'); + var ObjectProto$1 = Object[PROTOTYPE$2]; + var USE_NATIVE$1 = typeof $Symbol == 'function'; + var QObject = _global.QObject; + // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 + var setter = !QObject || !QObject[PROTOTYPE$2] || !QObject[PROTOTYPE$2].findChild; + + // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 + var setSymbolDesc = _descriptors && _fails(function () { + return _objectCreate(dP$2({}, 'a', { + get: function () { return dP$2(this, 'a', { value: 7 }).a; } + })).a != 7; + }) ? function (it, key, D) { + var protoDesc = gOPD$1(ObjectProto$1, key); + if (protoDesc) delete ObjectProto$1[key]; + dP$2(it, key, D); + if (protoDesc && it !== ObjectProto$1) dP$2(ObjectProto$1, key, protoDesc); + } : dP$2; + + var wrap = function (tag) { + var sym = AllSymbols[tag] = _objectCreate($Symbol[PROTOTYPE$2]); + sym._k = tag; + return sym; + }; + + var isSymbol = USE_NATIVE$1 && typeof $Symbol.iterator == 'symbol' ? function (it) { + return typeof it == 'symbol'; + } : function (it) { + return it instanceof $Symbol; + }; + + var $defineProperty = function defineProperty(it, key, D) { + if (it === ObjectProto$1) $defineProperty(OPSymbols, key, D); + _anObject(it); + key = _toPrimitive(key, true); + _anObject(D); + if (_has(AllSymbols, key)) { + if (!D.enumerable) { + if (!_has(it, HIDDEN)) dP$2(it, HIDDEN, _propertyDesc(1, {})); + it[HIDDEN][key] = true; + } else { + if (_has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false; + D = _objectCreate(D, { enumerable: _propertyDesc(0, false) }); + } return setSymbolDesc(it, key, D); + } return dP$2(it, key, D); + }; + var $defineProperties = function defineProperties(it, P) { + _anObject(it); + var keys = _enumKeys(P = _toIobject(P)); + var i = 0; + var l = keys.length; + var key; + while (l > i) $defineProperty(it, key = keys[i++], P[key]); + return it; + }; + var $create = function create(it, P) { + return P === undefined ? _objectCreate(it) : $defineProperties(_objectCreate(it), P); + }; + var $propertyIsEnumerable = function propertyIsEnumerable(key) { + var E = isEnum.call(this, key = _toPrimitive(key, true)); + if (this === ObjectProto$1 && _has(AllSymbols, key) && !_has(OPSymbols, key)) return false; + return E || !_has(this, key) || !_has(AllSymbols, key) || _has(this, HIDDEN) && this[HIDDEN][key] ? E : true; + }; + var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) { + it = _toIobject(it); + key = _toPrimitive(key, true); + if (it === ObjectProto$1 && _has(AllSymbols, key) && !_has(OPSymbols, key)) return; + var D = gOPD$1(it, key); + if (D && _has(AllSymbols, key) && !(_has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true; + return D; + }; + var $getOwnPropertyNames = function getOwnPropertyNames(it) { + var names = gOPN$1(_toIobject(it)); + var result = []; + var i = 0; + var key; + while (names.length > i) { + if (!_has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key); + } return result; + }; + var $getOwnPropertySymbols = function getOwnPropertySymbols(it) { + var IS_OP = it === ObjectProto$1; + var names = gOPN$1(IS_OP ? OPSymbols : _toIobject(it)); + var result = []; + var i = 0; + var key; + while (names.length > i) { + if (_has(AllSymbols, key = names[i++]) && (IS_OP ? _has(ObjectProto$1, key) : true)) result.push(AllSymbols[key]); + } return result; + }; + + // 19.4.1.1 Symbol([description]) + if (!USE_NATIVE$1) { + $Symbol = function Symbol() { + if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!'); + var tag = _uid(arguments.length > 0 ? arguments[0] : undefined); + var $set = function (value) { + if (this === ObjectProto$1) $set.call(OPSymbols, value); + if (_has(this, HIDDEN) && _has(this[HIDDEN], tag)) this[HIDDEN][tag] = false; + setSymbolDesc(this, tag, _propertyDesc(1, value)); + }; + if (_descriptors && setter) setSymbolDesc(ObjectProto$1, tag, { configurable: true, set: $set }); + return wrap(tag); + }; + _redefine($Symbol[PROTOTYPE$2], 'toString', function toString() { + return this._k; + }); + + _objectGopd.f = $getOwnPropertyDescriptor; + _objectDp.f = $defineProperty; + _objectGopn.f = _objectGopnExt.f = $getOwnPropertyNames; + _objectPie.f = $propertyIsEnumerable; + _objectGops.f = $getOwnPropertySymbols; + + if (_descriptors && !_library) { + _redefine(ObjectProto$1, 'propertyIsEnumerable', $propertyIsEnumerable, true); + } + + _wksExt.f = function (name) { + return wrap(_wks(name)); + }; + } + + _export(_export.G + _export.W + _export.F * !USE_NATIVE$1, { Symbol: $Symbol }); + + for (var es6Symbols = ( + // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 + 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' + ).split(','), j = 0; es6Symbols.length > j;)_wks(es6Symbols[j++]); + + for (var wellKnownSymbols = _objectKeys(_wks.store), k = 0; wellKnownSymbols.length > k;) _wksDefine(wellKnownSymbols[k++]); + + _export(_export.S + _export.F * !USE_NATIVE$1, 'Symbol', { + // 19.4.2.1 Symbol.for(key) + 'for': function (key) { + return _has(SymbolRegistry, key += '') + ? SymbolRegistry[key] + : SymbolRegistry[key] = $Symbol(key); + }, + // 19.4.2.5 Symbol.keyFor(sym) + keyFor: function keyFor(sym) { + if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!'); + for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key; + }, + useSetter: function () { setter = true; }, + useSimple: function () { setter = false; } + }); + + _export(_export.S + _export.F * !USE_NATIVE$1, 'Object', { + // 19.1.2.2 Object.create(O [, Properties]) + create: $create, + // 19.1.2.4 Object.defineProperty(O, P, Attributes) + defineProperty: $defineProperty, + // 19.1.2.3 Object.defineProperties(O, Properties) + defineProperties: $defineProperties, + // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) + getOwnPropertyDescriptor: $getOwnPropertyDescriptor, + // 19.1.2.7 Object.getOwnPropertyNames(O) + getOwnPropertyNames: $getOwnPropertyNames, + // 19.1.2.8 Object.getOwnPropertySymbols(O) + getOwnPropertySymbols: $getOwnPropertySymbols + }); + + // 24.3.2 JSON.stringify(value [, replacer [, space]]) + $JSON && _export(_export.S + _export.F * (!USE_NATIVE$1 || _fails(function () { + var S = $Symbol(); + // MS Edge converts symbol values to JSON as {} + // WebKit converts symbol values to JSON as null + // V8 throws on boxed symbols + return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}'; + })), 'JSON', { + stringify: function stringify(it) { + var args = [it]; + var i = 1; + var replacer, $replacer; + while (arguments.length > i) args.push(arguments[i++]); + $replacer = replacer = args[1]; + if (!_isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined + if (!_isArray(replacer)) replacer = function (key, value) { + if (typeof $replacer == 'function') value = $replacer.call(this, key, value); + if (!isSymbol(value)) return value; + }; + args[1] = replacer; + return _stringify.apply($JSON, args); + } + }); + + // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) + $Symbol[PROTOTYPE$2][TO_PRIMITIVE] || _hide($Symbol[PROTOTYPE$2], TO_PRIMITIVE, $Symbol[PROTOTYPE$2].valueOf); + // 19.4.3.5 Symbol.prototype[@@toStringTag] + _setToStringTag($Symbol, 'Symbol'); + // 20.2.1.9 Math[@@toStringTag] + _setToStringTag(Math, 'Math', true); + // 24.3.3 JSON[@@toStringTag] + _setToStringTag(_global.JSON, 'JSON', true); + + var runtime = createCommonjsModule(function (module) { + /** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + !function (global) { + + var Op = Object.prototype; + var hasOwn = Op.hasOwnProperty; + var undefined; // More compressible than void 0. + + var $Symbol = typeof Symbol === "function" ? Symbol : {}; + var iteratorSymbol = $Symbol.iterator || "@@iterator"; + var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; + var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; + var runtime = global.regeneratorRuntime; + + if (runtime) { + { + // If regeneratorRuntime is defined globally and we're in a module, + // make the exports object identical to regeneratorRuntime. + module.exports = runtime; + } // Don't bother evaluating the rest of this file if the runtime was + // already defined globally. + + + return; + } // Define the runtime globally (as expected by generated code) as either + // module.exports (if we're in a module) or a new, empty object. + + + runtime = global.regeneratorRuntime = module.exports; + + function wrap(innerFn, outerFn, self, tryLocsList) { + // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. + var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; + var generator = Object.create(protoGenerator.prototype); + var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next, + // .throw, and .return methods. + + generator._invoke = makeInvokeMethod(innerFn, self, context); + return generator; + } + + runtime.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion + // record like context.tryEntries[i].completion. This interface could + // have been (and was previously) designed to take a closure to be + // invoked without arguments, but in all the cases we care about we + // already have an existing method we want to call, so there's no need + // to create a new function object. We can even get away with assuming + // the method takes exactly one argument, since that happens to be true + // in every case, so we don't have to touch the arguments object. The + // only additional allocation required is the completion record, which + // has a stable shape and so hopefully should be cheap to allocate. + + function tryCatch(fn, obj, arg) { + try { + return { + type: "normal", + arg: fn.call(obj, arg) + }; + } catch (err) { + return { + type: "throw", + arg: err + }; + } + } + + var GenStateSuspendedStart = "suspendedStart"; + var GenStateSuspendedYield = "suspendedYield"; + var GenStateExecuting = "executing"; + var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as + // breaking out of the dispatch switch statement. + + var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and + // .constructor.prototype properties for functions that return Generator + // objects. For full spec compliance, you may wish to configure your + // minifier not to mangle the names of these two functions. + + function Generator() {} + + function GeneratorFunction() {} + + function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that + // don't natively support it. + + + var IteratorPrototype = {}; + + IteratorPrototype[iteratorSymbol] = function () { + return this; + }; + + var getProto = Object.getPrototypeOf; + var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); + + if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { + // This environment has a native %IteratorPrototype%; use it instead + // of the polyfill. + IteratorPrototype = NativeIteratorPrototype; + } + + var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); + GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; + GeneratorFunctionPrototype.constructor = GeneratorFunction; + GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction"; // Helper for defining the .next, .throw, and .return methods of the + // Iterator interface in terms of a single ._invoke method. + + function defineIteratorMethods(prototype) { + ["next", "throw", "return"].forEach(function (method) { + prototype[method] = function (arg) { + return this._invoke(method, arg); + }; + }); + } + + runtime.isGeneratorFunction = function (genFun) { + var ctor = typeof genFun === "function" && genFun.constructor; + return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can + // do is to check its .name property. + (ctor.displayName || ctor.name) === "GeneratorFunction" : false; + }; + + runtime.mark = function (genFun) { + if (Object.setPrototypeOf) { + Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); + } else { + genFun.__proto__ = GeneratorFunctionPrototype; + + if (!(toStringTagSymbol in genFun)) { + genFun[toStringTagSymbol] = "GeneratorFunction"; + } + } + + genFun.prototype = Object.create(Gp); + return genFun; + }; // Within the body of any async function, `await x` is transformed to + // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test + // `hasOwn.call(value, "__await")` to determine if the yielded value is + // meant to be awaited. + + + runtime.awrap = function (arg) { + return { + __await: arg + }; + }; + + function AsyncIterator(generator) { + function invoke(method, arg, resolve, reject) { + var record = tryCatch(generator[method], generator, arg); + + if (record.type === "throw") { + reject(record.arg); + } else { + var result = record.arg; + var value = result.value; + + if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) { + return Promise.resolve(value.__await).then(function (value) { + invoke("next", value, resolve, reject); + }, function (err) { + invoke("throw", err, resolve, reject); + }); + } + + return Promise.resolve(value).then(function (unwrapped) { + // When a yielded Promise is resolved, its final value becomes + // the .value of the Promise<{value,done}> result for the + // current iteration. + result.value = unwrapped; + resolve(result); + }, function (error) { + // If a rejected Promise was yielded, throw the rejection back + // into the async generator function so it can be handled there. + return invoke("throw", error, resolve, reject); + }); + } + } + + var previousPromise; + + function enqueue(method, arg) { + function callInvokeWithMethodAndArg() { + return new Promise(function (resolve, reject) { + invoke(method, arg, resolve, reject); + }); + } + + return previousPromise = // If enqueue has been called before, then we want to wait until + // all previous Promises have been resolved before calling invoke, + // so that results are always delivered in the correct order. If + // enqueue has not been called before, then it is important to + // call invoke immediately, without waiting on a callback to fire, + // so that the async generator function has the opportunity to do + // any necessary setup in a predictable way. This predictability + // is why the Promise constructor synchronously invokes its + // executor callback, and why async functions synchronously + // execute code before the first await. Since we implement simple + // async functions in terms of async generators, it is especially + // important to get this right, even though it requires care. + previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later + // invocations of the iterator. + callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); + } // Define the unified helper method that is used to implement .next, + // .throw, and .return (see defineIteratorMethods). + + + this._invoke = enqueue; + } + + defineIteratorMethods(AsyncIterator.prototype); + + AsyncIterator.prototype[asyncIteratorSymbol] = function () { + return this; + }; + + runtime.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of + // AsyncIterator objects; they just return a Promise for the value of + // the final result produced by the iterator. + + runtime.async = function (innerFn, outerFn, self, tryLocsList) { + var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList)); + return runtime.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator. + : iter.next().then(function (result) { + return result.done ? result.value : iter.next(); + }); + }; + + function makeInvokeMethod(innerFn, self, context) { + var state = GenStateSuspendedStart; + return function invoke(method, arg) { + if (state === GenStateExecuting) { + throw new Error("Generator is already running"); + } + + if (state === GenStateCompleted) { + if (method === "throw") { + throw arg; + } // Be forgiving, per 25.3.3.3.3 of the spec: + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume + + + return doneResult(); + } + + context.method = method; + context.arg = arg; + + while (true) { + var delegate = context.delegate; + + if (delegate) { + var delegateResult = maybeInvokeDelegate(delegate, context); + + if (delegateResult) { + if (delegateResult === ContinueSentinel) continue; + return delegateResult; + } + } + + if (context.method === "next") { + // Setting context._sent for legacy support of Babel's + // function.sent implementation. + context.sent = context._sent = context.arg; + } else if (context.method === "throw") { + if (state === GenStateSuspendedStart) { + state = GenStateCompleted; + throw context.arg; + } + + context.dispatchException(context.arg); + } else if (context.method === "return") { + context.abrupt("return", context.arg); + } + + state = GenStateExecuting; + var record = tryCatch(innerFn, self, context); + + if (record.type === "normal") { + // If an exception is thrown from innerFn, we leave state === + // GenStateExecuting and loop back for another invocation. + state = context.done ? GenStateCompleted : GenStateSuspendedYield; + + if (record.arg === ContinueSentinel) { + continue; + } + + return { + value: record.arg, + done: context.done + }; + } else if (record.type === "throw") { + state = GenStateCompleted; // Dispatch the exception by looping back around to the + // context.dispatchException(context.arg) call above. + + context.method = "throw"; + context.arg = record.arg; + } + } + }; + } // Call delegate.iterator[context.method](context.arg) and handle the + // result, either by returning a { value, done } result from the + // delegate iterator, or by modifying context.method and context.arg, + // setting context.delegate to null, and returning the ContinueSentinel. + + + function maybeInvokeDelegate(delegate, context) { + var method = delegate.iterator[context.method]; + + if (method === undefined) { + // A .throw or .return when the delegate iterator has no .throw + // method always terminates the yield* loop. + context.delegate = null; + + if (context.method === "throw") { + if (delegate.iterator.return) { + // If the delegate iterator has a return method, give it a + // chance to clean up. + context.method = "return"; + context.arg = undefined; + maybeInvokeDelegate(delegate, context); + + if (context.method === "throw") { + // If maybeInvokeDelegate(context) changed context.method from + // "return" to "throw", let that override the TypeError below. + return ContinueSentinel; + } + } + + context.method = "throw"; + context.arg = new TypeError("The iterator does not provide a 'throw' method"); + } + + return ContinueSentinel; + } + + var record = tryCatch(method, delegate.iterator, context.arg); + + if (record.type === "throw") { + context.method = "throw"; + context.arg = record.arg; + context.delegate = null; + return ContinueSentinel; + } + + var info = record.arg; + + if (!info) { + context.method = "throw"; + context.arg = new TypeError("iterator result is not an object"); + context.delegate = null; + return ContinueSentinel; + } + + if (info.done) { + // Assign the result of the finished delegate to the temporary + // variable specified by delegate.resultName (see delegateYield). + context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield). + + context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the + // exception, let the outer generator proceed normally. If + // context.method was "next", forget context.arg since it has been + // "consumed" by the delegate iterator. If context.method was + // "return", allow the original .return call to continue in the + // outer generator. + + if (context.method !== "return") { + context.method = "next"; + context.arg = undefined; + } + } else { + // Re-yield the result returned by the delegate method. + return info; + } // The delegate iterator is finished, so forget it and continue with + // the outer generator. + + + context.delegate = null; + return ContinueSentinel; + } // Define Generator.prototype.{next,throw,return} in terms of the + // unified ._invoke helper method. + + + defineIteratorMethods(Gp); + Gp[toStringTagSymbol] = "Generator"; // A Generator should always return itself as the iterator object when the + // @@iterator function is called on it. Some browsers' implementations of the + // iterator prototype chain incorrectly implement this, causing the Generator + // object to not be returned from this call. This ensures that doesn't happen. + // See https://github.com/facebook/regenerator/issues/274 for more details. + + Gp[iteratorSymbol] = function () { + return this; + }; + + Gp.toString = function () { + return "[object Generator]"; + }; + + function pushTryEntry(locs) { + var entry = { + tryLoc: locs[0] + }; + + if (1 in locs) { + entry.catchLoc = locs[1]; + } + + if (2 in locs) { + entry.finallyLoc = locs[2]; + entry.afterLoc = locs[3]; + } + + this.tryEntries.push(entry); + } + + function resetTryEntry(entry) { + var record = entry.completion || {}; + record.type = "normal"; + delete record.arg; + entry.completion = record; + } + + function Context(tryLocsList) { + // The root entry object (effectively a try statement without a catch + // or a finally block) gives us a place to store values thrown from + // locations where there is no enclosing try statement. + this.tryEntries = [{ + tryLoc: "root" + }]; + tryLocsList.forEach(pushTryEntry, this); + this.reset(true); + } + + runtime.keys = function (object) { + var keys = []; + + for (var key in object) { + keys.push(key); + } + + keys.reverse(); // Rather than returning an object with a next method, we keep + // things simple and return the next function itself. + + return function next() { + while (keys.length) { + var key = keys.pop(); + + if (key in object) { + next.value = key; + next.done = false; + return next; + } + } // To avoid creating an additional object, we just hang the .value + // and .done properties off the next function object itself. This + // also ensures that the minifier will not anonymize the function. + + + next.done = true; + return next; + }; + }; + + function values(iterable) { + if (iterable) { + var iteratorMethod = iterable[iteratorSymbol]; + + if (iteratorMethod) { + return iteratorMethod.call(iterable); + } + + if (typeof iterable.next === "function") { + return iterable; + } + + if (!isNaN(iterable.length)) { + var i = -1, + next = function next() { + while (++i < iterable.length) { + if (hasOwn.call(iterable, i)) { + next.value = iterable[i]; + next.done = false; + return next; + } + } + + next.value = undefined; + next.done = true; + return next; + }; + + return next.next = next; + } + } // Return an iterator with no values. + + + return { + next: doneResult + }; + } + + runtime.values = values; + + function doneResult() { + return { + value: undefined, + done: true + }; + } + + Context.prototype = { + constructor: Context, + reset: function reset(skipTempReset) { + this.prev = 0; + this.next = 0; // Resetting context._sent for legacy support of Babel's + // function.sent implementation. + + this.sent = this._sent = undefined; + this.done = false; + this.delegate = null; + this.method = "next"; + this.arg = undefined; + this.tryEntries.forEach(resetTryEntry); + + if (!skipTempReset) { + for (var name in this) { + // Not sure about the optimal order of these conditions: + if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) { + this[name] = undefined; + } + } + } + }, + stop: function stop() { + this.done = true; + var rootEntry = this.tryEntries[0]; + var rootRecord = rootEntry.completion; + + if (rootRecord.type === "throw") { + throw rootRecord.arg; + } + + return this.rval; + }, + dispatchException: function dispatchException(exception) { + if (this.done) { + throw exception; + } + + var context = this; + + function handle(loc, caught) { + record.type = "throw"; + record.arg = exception; + context.next = loc; + + if (caught) { + // If the dispatched exception was caught by a catch block, + // then let that catch block handle the exception normally. + context.method = "next"; + context.arg = undefined; + } + + return !!caught; + } + + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + var record = entry.completion; + + if (entry.tryLoc === "root") { + // Exception thrown outside of any try block that could handle + // it, so set the completion value of the entire function to + // throw the exception. + return handle("end"); + } + + if (entry.tryLoc <= this.prev) { + var hasCatch = hasOwn.call(entry, "catchLoc"); + var hasFinally = hasOwn.call(entry, "finallyLoc"); + + if (hasCatch && hasFinally) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } else if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + } else if (hasCatch) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } + } else if (hasFinally) { + if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + } else { + throw new Error("try statement without catch or finally"); + } + } + } + }, + abrupt: function abrupt(type, arg) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + + if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { + var finallyEntry = entry; + break; + } + } + + if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) { + // Ignore the finally entry if control is not jumping to a + // location outside the try/catch block. + finallyEntry = null; + } + + var record = finallyEntry ? finallyEntry.completion : {}; + record.type = type; + record.arg = arg; + + if (finallyEntry) { + this.method = "next"; + this.next = finallyEntry.finallyLoc; + return ContinueSentinel; + } + + return this.complete(record); + }, + complete: function complete(record, afterLoc) { + if (record.type === "throw") { + throw record.arg; + } + + if (record.type === "break" || record.type === "continue") { + this.next = record.arg; + } else if (record.type === "return") { + this.rval = this.arg = record.arg; + this.method = "return"; + this.next = "end"; + } else if (record.type === "normal" && afterLoc) { + this.next = afterLoc; + } + + return ContinueSentinel; + }, + finish: function finish(finallyLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + + if (entry.finallyLoc === finallyLoc) { + this.complete(entry.completion, entry.afterLoc); + resetTryEntry(entry); + return ContinueSentinel; + } + } + }, + "catch": function _catch(tryLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + + if (entry.tryLoc === tryLoc) { + var record = entry.completion; + + if (record.type === "throw") { + var thrown = record.arg; + resetTryEntry(entry); + } + + return thrown; + } + } // The context.catch method must only be called with a location + // argument that corresponds to a known catch block. + + + throw new Error("illegal catch attempt"); + }, + delegateYield: function delegateYield(iterable, resultName, nextLoc) { + this.delegate = { + iterator: values(iterable), + resultName: resultName, + nextLoc: nextLoc + }; + + if (this.method === "next") { + // Deliberately forget the last sent value so that we don't + // accidentally pass it on to the delegate. + this.arg = undefined; + } + + return ContinueSentinel; + } + }; + }( // In sloppy mode, unbound `this` refers to the global object, fallback to + // Function constructor if we're in global strict mode. That is sadly a form + // of indirect eval which violates Content Security Policy. + function () { + return this || (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" && self; + }() || Function("return this")()); + }); + + var setPrototypeOf = _setProto.set; + var _inheritIfRequired = function (that, target, C) { + var S = target.constructor; + var P; + if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && _isObject(P) && setPrototypeOf) { + setPrototypeOf(that, P); + } return that; + }; + + var _stringWs = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + + '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; + + var space = '[' + _stringWs + ']'; + var non = '\u200b\u0085'; + var ltrim = RegExp('^' + space + space + '*'); + var rtrim = RegExp(space + space + '*$'); + + var exporter = function (KEY, exec, ALIAS) { + var exp = {}; + var FORCE = _fails(function () { + return !!_stringWs[KEY]() || non[KEY]() != non; + }); + var fn = exp[KEY] = FORCE ? exec(trim) : _stringWs[KEY]; + if (ALIAS) exp[ALIAS] = fn; + _export(_export.P + _export.F * FORCE, 'String', exp); + }; + + // 1 -> String#trimLeft + // 2 -> String#trimRight + // 3 -> String#trim + var trim = exporter.trim = function (string, TYPE) { + string = String(_defined(string)); + if (TYPE & 1) string = string.replace(ltrim, ''); + if (TYPE & 2) string = string.replace(rtrim, ''); + return string; + }; + + var _stringTrim = exporter; + + var gOPN$2 = _objectGopn.f; + var gOPD$2 = _objectGopd.f; + var dP$3 = _objectDp.f; + var $trim = _stringTrim.trim; + var NUMBER = 'Number'; + var $Number = _global[NUMBER]; + var Base = $Number; + var proto$1 = $Number.prototype; + // Opera ~12 has broken Object#toString + var BROKEN_COF = _cof(_objectCreate(proto$1)) == NUMBER; + var TRIM = 'trim' in String.prototype; + + // 7.1.3 ToNumber(argument) + var toNumber = function (argument) { + var it = _toPrimitive(argument, false); + if (typeof it == 'string' && it.length > 2) { + it = TRIM ? it.trim() : $trim(it, 3); + var first = it.charCodeAt(0); + var third, radix, maxCode; + if (first === 43 || first === 45) { + third = it.charCodeAt(2); + if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix + } else if (first === 48) { + switch (it.charCodeAt(1)) { + case 66: case 98: radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i + case 79: case 111: radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i + default: return +it; + } + for (var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++) { + code = digits.charCodeAt(i); + // parseInt parses a string to a first unavailable symbol + // but ToNumber should return NaN if a string contains unavailable symbols + if (code < 48 || code > maxCode) return NaN; + } return parseInt(digits, radix); + } + } return +it; + }; + + if (!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')) { + $Number = function Number(value) { + var it = arguments.length < 1 ? 0 : value; + var that = this; + return that instanceof $Number + // check on 1..constructor(foo) case + && (BROKEN_COF ? _fails(function () { proto$1.valueOf.call(that); }) : _cof(that) != NUMBER) + ? _inheritIfRequired(new Base(toNumber(it)), that, $Number) : toNumber(it); + }; + for (var keys = _descriptors ? gOPN$2(Base) : ( + // ES3: + 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + + // ES6 (in case, if modules with ES6 Number statics required before): + 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + + 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger' + ).split(','), j$1 = 0, key$1; keys.length > j$1; j$1++) { + if (_has(Base, key$1 = keys[j$1]) && !_has($Number, key$1)) { + dP$3($Number, key$1, gOPD$2(Base, key$1)); + } + } + $Number.prototype = proto$1; + proto$1.constructor = $Number; + _redefine(_global, NUMBER, $Number); + } + + var $parseFloat = _global.parseFloat; + var $trim$1 = _stringTrim.trim; + + var _parseFloat = 1 / $parseFloat(_stringWs + '-0') !== -Infinity ? function parseFloat(str) { + var string = $trim$1(String(str), 3); + var result = $parseFloat(string); + return result === 0 && string.charAt(0) == '-' ? -0 : result; + } : $parseFloat; + + // 20.1.2.12 Number.parseFloat(string) + _export(_export.S + _export.F * (Number.parseFloat != _parseFloat), 'Number', { parseFloat: _parseFloat }); + + // most Object methods by ES6 should accept primitives + + + + var _objectSap = function (KEY, exec) { + var fn = (_core.Object || {})[KEY] || Object[KEY]; + var exp = {}; + exp[KEY] = exec(fn); + _export(_export.S + _export.F * _fails(function () { fn(1); }), 'Object', exp); + }; + + // 19.1.2.14 Object.keys(O) + + + + _objectSap('keys', function () { + return function keys(it) { + return _objectKeys(_toObject(it)); + }; + }); + + // 19.1.2.1 Object.assign(target, source, ...) + + + + + + var $assign = Object.assign; + + // should work with symbols and should have deterministic property order (V8 bug) + var _objectAssign = !$assign || _fails(function () { + var A = {}; + var B = {}; + // eslint-disable-next-line no-undef + var S = Symbol(); + var K = 'abcdefghijklmnopqrst'; + A[S] = 7; + K.split('').forEach(function (k) { B[k] = k; }); + return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; + }) ? function assign(target, source) { // eslint-disable-line no-unused-vars + var T = _toObject(target); + var aLen = arguments.length; + var index = 1; + var getSymbols = _objectGops.f; + var isEnum = _objectPie.f; + while (aLen > index) { + var S = _iobject(arguments[index++]); + var keys = getSymbols ? _objectKeys(S).concat(getSymbols(S)) : _objectKeys(S); + var length = keys.length; + var j = 0; + var key; + while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key]; + } return T; + } : $assign; + + // 19.1.3.1 Object.assign(target, source) + + + _export(_export.S + _export.F, 'Object', { assign: _objectAssign }); + + var _arrayReduce = function (that, callbackfn, aLen, memo, isRight) { + _aFunction(callbackfn); + var O = _toObject(that); + var self = _iobject(O); + var length = _toLength(O.length); + var index = isRight ? length - 1 : 0; + var i = isRight ? -1 : 1; + if (aLen < 2) for (;;) { + if (index in self) { + memo = self[index]; + index += i; + break; + } + index += i; + if (isRight ? index < 0 : length <= index) { + throw TypeError('Reduce of empty array with no initial value'); + } + } + for (;isRight ? index >= 0 : length > index; index += i) if (index in self) { + memo = callbackfn(memo, self[index], index, O); + } + return memo; + }; + + _export(_export.P + _export.F * !_strictMethod([].reduce, true), 'Array', { + // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue]) + reduce: function reduce(callbackfn /* , initialValue */) { + return _arrayReduce(this, callbackfn, arguments.length, arguments[1], false); + } + }); + + var $indexOf = _arrayIncludes(false); + var $native = [].indexOf; + var NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0; + + _export(_export.P + _export.F * (NEGATIVE_ZERO || !_strictMethod($native)), 'Array', { + // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex]) + indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { + return NEGATIVE_ZERO + // convert -0 to +0 + ? $native.apply(this, arguments) || 0 + : $indexOf(this, searchElement, arguments[1]); + } + }); + + // 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined) + + var $find = _arrayMethods(5); + var KEY = 'find'; + var forced = true; + // Shouldn't skip holes + if (KEY in []) Array(1)[KEY](function () { forced = false; }); + _export(_export.P + _export.F * forced, 'Array', { + find: function find(callbackfn /* , that = undefined */) { + return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } + }); + _addToUnscopables(KEY); + + var $filter = _arrayMethods(2); + + _export(_export.P + _export.F * !_strictMethod([].filter, true), 'Array', { + // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg]) + filter: function filter(callbackfn /* , thisArg */) { + return $filter(this, callbackfn, arguments[1]); + } + }); + + // true -> String#at + // false -> String#codePointAt + var _stringAt = function (TO_STRING) { + return function (that, pos) { + var s = String(_defined(that)); + var i = _toInteger(pos); + var l = s.length; + var a, b; + if (i < 0 || i >= l) return TO_STRING ? '' : undefined; + a = s.charCodeAt(i); + return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff + ? TO_STRING ? s.charAt(i) : a + : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; + }; + }; + + var $at = _stringAt(true); + + // 21.1.3.27 String.prototype[@@iterator]() + _iterDefine(String, 'String', function (iterated) { + this._t = String(iterated); // target + this._i = 0; // next index + // 21.1.5.2.1 %StringIteratorPrototype%.next() + }, function () { + var O = this._t; + var index = this._i; + var point; + if (index >= O.length) return { value: undefined, done: true }; + point = $at(O, index); + this._i += point.length; + return { value: point, done: false }; + }); + + var _createProperty = function (object, index, value) { + if (index in object) _objectDp.f(object, index, _propertyDesc(0, value)); + else object[index] = value; + }; + + _export(_export.S + _export.F * !_iterDetect(function (iter) { }), 'Array', { + // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) + from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { + var O = _toObject(arrayLike); + var C = typeof this == 'function' ? this : Array; + var aLen = arguments.length; + var mapfn = aLen > 1 ? arguments[1] : undefined; + var mapping = mapfn !== undefined; + var index = 0; + var iterFn = core_getIteratorMethod(O); + var length, result, step, iterator; + if (mapping) mapfn = _ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); + // if object isn't iterable or it's array with default iterator - use simple case + if (iterFn != undefined && !(C == Array && _isArrayIter(iterFn))) { + for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) { + _createProperty(result, index, mapping ? _iterCall(iterator, mapfn, [step.value, index], true) : step.value); + } + } else { + length = _toLength(O.length); + for (result = new C(length); length > index; index++) { + _createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); + } + } + result.length = index; + return result; + } + }); + + var $map = _arrayMethods(1); + + _export(_export.P + _export.F * !_strictMethod([].map, true), 'Array', { + // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg]) + map: function map(callbackfn /* , thisArg */) { + return $map(this, callbackfn, arguments[1]); + } + }); + + function _isPlaceholder(a) { + return a != null && _typeof(a) === 'object' && a['@@functional/placeholder'] === true; + } + + /** + * Optimized internal one-arity curry function. + * + * @private + * @category Function + * @param {Function} fn The function to curry. + * @return {Function} The curried function. + */ + + function _curry1(fn) { + return function f1(a) { + if (arguments.length === 0 || _isPlaceholder(a)) { + return f1; + } else { + return fn.apply(this, arguments); + } + }; + } + + /** + * Returns a function that always returns the given value. Note that for + * non-primitives the value returned is a reference to the original value. + * + * This function is known as `const`, `constant`, or `K` (for K combinator) in + * other languages and libraries. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig a -> (* -> a) + * @param {*} val The value to wrap in a function + * @return {Function} A Function :: * -> val. + * @example + * + * var t = R.always('Tee'); + * t(); //=> 'Tee' + */ + + var always = + /*#__PURE__*/ + _curry1(function always(val) { + return function () { + return val; + }; + }); + + /** + * A function that always returns `false`. Any passed in parameters are ignored. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Function + * @sig * -> Boolean + * @param {*} + * @return {Boolean} + * @see R.always, R.T + * @example + * + * R.F(); //=> false + */ + + var F = + /*#__PURE__*/ + always(false); + + /** + * A function that always returns `true`. Any passed in parameters are ignored. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Function + * @sig * -> Boolean + * @param {*} + * @return {Boolean} + * @see R.always, R.F + * @example + * + * R.T(); //=> true + */ + + var T = + /*#__PURE__*/ + always(true); + + /** + * A special placeholder value used to specify "gaps" within curried functions, + * allowing partial application of any combination of arguments, regardless of + * their positions. + * + * If `g` is a curried ternary function and `_` is `R.__`, the following are + * equivalent: + * + * - `g(1, 2, 3)` + * - `g(_, 2, 3)(1)` + * - `g(_, _, 3)(1)(2)` + * - `g(_, _, 3)(1, 2)` + * - `g(_, 2, _)(1, 3)` + * - `g(_, 2)(1)(3)` + * - `g(_, 2)(1, 3)` + * - `g(_, 2)(_, 3)(1)` + * + * @constant + * @memberOf R + * @since v0.6.0 + * @category Function + * @example + * + * var greet = R.replace('{name}', R.__, 'Hello, {name}!'); + * greet('Alice'); //=> 'Hello, Alice!' + */ + + /** + * Optimized internal two-arity curry function. + * + * @private + * @category Function + * @param {Function} fn The function to curry. + * @return {Function} The curried function. + */ + + function _curry2(fn) { + return function f2(a, b) { + switch (arguments.length) { + case 0: + return f2; + + case 1: + return _isPlaceholder(a) ? f2 : _curry1(function (_b) { + return fn(a, _b); + }); + + default: + return _isPlaceholder(a) && _isPlaceholder(b) ? f2 : _isPlaceholder(a) ? _curry1(function (_a) { + return fn(_a, b); + }) : _isPlaceholder(b) ? _curry1(function (_b) { + return fn(a, _b); + }) : fn(a, b); + } + }; + } + + /** + * Adds two values. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Math + * @sig Number -> Number -> Number + * @param {Number} a + * @param {Number} b + * @return {Number} + * @see R.subtract + * @example + * + * R.add(2, 3); //=> 5 + * R.add(7)(10); //=> 17 + */ + + var add = + /*#__PURE__*/ + _curry2(function add(a, b) { + return Number(a) + Number(b); + }); + + /** + * Private `concat` function to merge two array-like objects. + * + * @private + * @param {Array|Arguments} [set1=[]] An array-like object. + * @param {Array|Arguments} [set2=[]] An array-like object. + * @return {Array} A new, merged array. + * @example + * + * _concat([4, 5, 6], [1, 2, 3]); //=> [4, 5, 6, 1, 2, 3] + */ + function _concat(set1, set2) { + set1 = set1 || []; + set2 = set2 || []; + var idx; + var len1 = set1.length; + var len2 = set2.length; + var result = []; + idx = 0; + + while (idx < len1) { + result[result.length] = set1[idx]; + idx += 1; + } + + idx = 0; + + while (idx < len2) { + result[result.length] = set2[idx]; + idx += 1; + } + + return result; + } + + function _arity(n, fn) { + /* eslint-disable no-unused-vars */ + switch (n) { + case 0: + return function () { + return fn.apply(this, arguments); + }; + + case 1: + return function (a0) { + return fn.apply(this, arguments); + }; + + case 2: + return function (a0, a1) { + return fn.apply(this, arguments); + }; + + case 3: + return function (a0, a1, a2) { + return fn.apply(this, arguments); + }; + + case 4: + return function (a0, a1, a2, a3) { + return fn.apply(this, arguments); + }; + + case 5: + return function (a0, a1, a2, a3, a4) { + return fn.apply(this, arguments); + }; + + case 6: + return function (a0, a1, a2, a3, a4, a5) { + return fn.apply(this, arguments); + }; + + case 7: + return function (a0, a1, a2, a3, a4, a5, a6) { + return fn.apply(this, arguments); + }; + + case 8: + return function (a0, a1, a2, a3, a4, a5, a6, a7) { + return fn.apply(this, arguments); + }; + + case 9: + return function (a0, a1, a2, a3, a4, a5, a6, a7, a8) { + return fn.apply(this, arguments); + }; + + case 10: + return function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return fn.apply(this, arguments); + }; + + default: + throw new Error('First argument to _arity must be a non-negative integer no greater than ten'); + } + } + + /** + * Internal curryN function. + * + * @private + * @category Function + * @param {Number} length The arity of the curried function. + * @param {Array} received An array of arguments received thus far. + * @param {Function} fn The function to curry. + * @return {Function} The curried function. + */ + + function _curryN(length, received, fn) { + return function () { + var combined = []; + var argsIdx = 0; + var left = length; + var combinedIdx = 0; + + while (combinedIdx < received.length || argsIdx < arguments.length) { + var result; + + if (combinedIdx < received.length && (!_isPlaceholder(received[combinedIdx]) || argsIdx >= arguments.length)) { + result = received[combinedIdx]; + } else { + result = arguments[argsIdx]; + argsIdx += 1; + } + + combined[combinedIdx] = result; + + if (!_isPlaceholder(result)) { + left -= 1; + } + + combinedIdx += 1; + } + + return left <= 0 ? fn.apply(this, combined) : _arity(left, _curryN(length, combined, fn)); + }; + } + + /** + * Returns a curried equivalent of the provided function, with the specified + * arity. The curried function has two unusual capabilities. First, its + * arguments needn't be provided one at a time. If `g` is `R.curryN(3, f)`, the + * following are equivalent: + * + * - `g(1)(2)(3)` + * - `g(1)(2, 3)` + * - `g(1, 2)(3)` + * - `g(1, 2, 3)` + * + * Secondly, the special placeholder value [`R.__`](#__) may be used to specify + * "gaps", allowing partial application of any combination of arguments, + * regardless of their positions. If `g` is as above and `_` is [`R.__`](#__), + * the following are equivalent: + * + * - `g(1, 2, 3)` + * - `g(_, 2, 3)(1)` + * - `g(_, _, 3)(1)(2)` + * - `g(_, _, 3)(1, 2)` + * - `g(_, 2)(1)(3)` + * - `g(_, 2)(1, 3)` + * - `g(_, 2)(_, 3)(1)` + * + * @func + * @memberOf R + * @since v0.5.0 + * @category Function + * @sig Number -> (* -> a) -> (* -> a) + * @param {Number} length The arity for the returned function. + * @param {Function} fn The function to curry. + * @return {Function} A new, curried function. + * @see R.curry + * @example + * + * var sumArgs = (...args) => R.sum(args); + * + * var curriedAddFourNumbers = R.curryN(4, sumArgs); + * var f = curriedAddFourNumbers(1, 2); + * var g = f(3); + * g(4); //=> 10 + */ + + var curryN = + /*#__PURE__*/ + _curry2(function curryN(length, fn) { + if (length === 1) { + return _curry1(fn); + } + + return _arity(length, _curryN(length, [], fn)); + }); + + /** + * Optimized internal three-arity curry function. + * + * @private + * @category Function + * @param {Function} fn The function to curry. + * @return {Function} The curried function. + */ + + function _curry3(fn) { + return function f3(a, b, c) { + switch (arguments.length) { + case 0: + return f3; + + case 1: + return _isPlaceholder(a) ? f3 : _curry2(function (_b, _c) { + return fn(a, _b, _c); + }); + + case 2: + return _isPlaceholder(a) && _isPlaceholder(b) ? f3 : _isPlaceholder(a) ? _curry2(function (_a, _c) { + return fn(_a, b, _c); + }) : _isPlaceholder(b) ? _curry2(function (_b, _c) { + return fn(a, _b, _c); + }) : _curry1(function (_c) { + return fn(a, b, _c); + }); + + default: + return _isPlaceholder(a) && _isPlaceholder(b) && _isPlaceholder(c) ? f3 : _isPlaceholder(a) && _isPlaceholder(b) ? _curry2(function (_a, _b) { + return fn(_a, _b, c); + }) : _isPlaceholder(a) && _isPlaceholder(c) ? _curry2(function (_a, _c) { + return fn(_a, b, _c); + }) : _isPlaceholder(b) && _isPlaceholder(c) ? _curry2(function (_b, _c) { + return fn(a, _b, _c); + }) : _isPlaceholder(a) ? _curry1(function (_a) { + return fn(_a, b, c); + }) : _isPlaceholder(b) ? _curry1(function (_b) { + return fn(a, _b, c); + }) : _isPlaceholder(c) ? _curry1(function (_c) { + return fn(a, b, _c); + }) : fn(a, b, c); + } + }; + } + + // 21.2.5.3 get RegExp.prototype.flags + + var _flags = function () { + var that = _anObject(this); + var result = ''; + if (that.global) result += 'g'; + if (that.ignoreCase) result += 'i'; + if (that.multiline) result += 'm'; + if (that.unicode) result += 'u'; + if (that.sticky) result += 'y'; + return result; + }; + + // 21.2.5.3 get RegExp.prototype.flags() + if (_descriptors && /./g.flags != 'g') _objectDp.f(RegExp.prototype, 'flags', { + configurable: true, + get: _flags + }); + + var TO_STRING = 'toString'; + var $toString = /./[TO_STRING]; + + var define = function (fn) { + _redefine(RegExp.prototype, TO_STRING, fn, true); + }; + + // 21.2.5.14 RegExp.prototype.toString() + if (_fails(function () { return $toString.call({ source: 'a', flags: 'b' }) != '/a/b'; })) { + define(function toString() { + var R = _anObject(this); + return '/'.concat(R.source, '/', + 'flags' in R ? R.flags : !_descriptors && R instanceof RegExp ? _flags.call(R) : undefined); + }); + // FF44- RegExp#toString has a wrong name + } else if ($toString.name != TO_STRING) { + define(function toString() { + return $toString.call(this); + }); + } + + var DateProto = Date.prototype; + var INVALID_DATE = 'Invalid Date'; + var TO_STRING$1 = 'toString'; + var $toString$1 = DateProto[TO_STRING$1]; + var getTime = DateProto.getTime; + if (new Date(NaN) + '' != INVALID_DATE) { + _redefine(DateProto, TO_STRING$1, function toString() { + var value = getTime.call(this); + // eslint-disable-next-line no-self-compare + return value === value ? $toString$1.call(this) : INVALID_DATE; + }); + } + + // 22.1.2.2 / 15.4.3.2 Array.isArray(arg) + + + _export(_export.S, 'Array', { isArray: _isArray }); + + /** + * Tests whether or not an object is an array. + * + * @private + * @param {*} val The object to test. + * @return {Boolean} `true` if `val` is an array, `false` otherwise. + * @example + * + * _isArray([]); //=> true + * _isArray(null); //=> false + * _isArray({}); //=> false + */ + var _isArray$1 = Array.isArray || function _isArray(val) { + return val != null && val.length >= 0 && Object.prototype.toString.call(val) === '[object Array]'; + }; + + function _isTransformer(obj) { + return typeof obj['@@transducer/step'] === 'function'; + } + + /** + * Returns a function that dispatches with different strategies based on the + * object in list position (last argument). If it is an array, executes [fn]. + * Otherwise, if it has a function with one of the given method names, it will + * execute that function (functor case). Otherwise, if it is a transformer, + * uses transducer [xf] to return a new transformer (transducer case). + * Otherwise, it will default to executing [fn]. + * + * @private + * @param {Array} methodNames properties to check for a custom implementation + * @param {Function} xf transducer to initialize if object is transformer + * @param {Function} fn default ramda implementation + * @return {Function} A function that dispatches on object in list position + */ + + function _dispatchable(methodNames, xf, fn) { + return function () { + if (arguments.length === 0) { + return fn(); + } + + var args = Array.prototype.slice.call(arguments, 0); + var obj = args.pop(); + + if (!_isArray$1(obj)) { + var idx = 0; + + while (idx < methodNames.length) { + if (typeof obj[methodNames[idx]] === 'function') { + return obj[methodNames[idx]].apply(obj, args); + } + + idx += 1; + } + + if (_isTransformer(obj)) { + var transducer = xf.apply(null, args); + return transducer(obj); + } + } + + return fn.apply(this, arguments); + }; + } + + function _reduced(x) { + return x && x['@@transducer/reduced'] ? x : { + '@@transducer/value': x, + '@@transducer/reduced': true + }; + } + + var _xfBase = { + init: function init() { + return this.xf['@@transducer/init'](); + }, + result: function result(_result) { + return this.xf['@@transducer/result'](_result); + } + }; + + /** + * Returns the larger of its two arguments. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig Ord a => a -> a -> a + * @param {*} a + * @param {*} b + * @return {*} + * @see R.maxBy, R.min + * @example + * + * R.max(789, 123); //=> 789 + * R.max('a', 'b'); //=> 'b' + */ + + var max$1 = + /*#__PURE__*/ + _curry2(function max(a, b) { + return b > a ? b : a; + }); + + function _map(fn, functor) { + var idx = 0; + var len = functor.length; + var result = Array(len); + + while (idx < len) { + result[idx] = fn(functor[idx]); + idx += 1; + } + + return result; + } + + function _isString(x) { + return Object.prototype.toString.call(x) === '[object String]'; + } + + /** + * Tests whether or not an object is similar to an array. + * + * @private + * @category Type + * @category List + * @sig * -> Boolean + * @param {*} x The object to test. + * @return {Boolean} `true` if `x` has a numeric length property and extreme indices defined; `false` otherwise. + * @example + * + * _isArrayLike([]); //=> true + * _isArrayLike(true); //=> false + * _isArrayLike({}); //=> false + * _isArrayLike({length: 10}); //=> false + * _isArrayLike({0: 'zero', 9: 'nine', length: 10}); //=> true + */ + + var _isArrayLike = + /*#__PURE__*/ + _curry1(function isArrayLike(x) { + if (_isArray$1(x)) { + return true; + } + + if (!x) { + return false; + } + + if (_typeof(x) !== 'object') { + return false; + } + + if (_isString(x)) { + return false; + } + + if (x.nodeType === 1) { + return !!x.length; + } + + if (x.length === 0) { + return true; + } + + if (x.length > 0) { + return x.hasOwnProperty(0) && x.hasOwnProperty(x.length - 1); + } + + return false; + }); + + var XWrap = + /*#__PURE__*/ + function () { + function XWrap(fn) { + this.f = fn; + } + + XWrap.prototype['@@transducer/init'] = function () { + throw new Error('init not implemented on XWrap'); + }; + + XWrap.prototype['@@transducer/result'] = function (acc) { + return acc; + }; + + XWrap.prototype['@@transducer/step'] = function (acc, x) { + return this.f(acc, x); + }; + + return XWrap; + }(); + + function _xwrap(fn) { + return new XWrap(fn); + } + + /** + * Creates a function that is bound to a context. + * Note: `R.bind` does not provide the additional argument-binding capabilities of + * [Function.prototype.bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind). + * + * @func + * @memberOf R + * @since v0.6.0 + * @category Function + * @category Object + * @sig (* -> *) -> {*} -> (* -> *) + * @param {Function} fn The function to bind to context + * @param {Object} thisObj The context to bind `fn` to + * @return {Function} A function that will execute in the context of `thisObj`. + * @see R.partial + * @example + * + * var log = R.bind(console.log, console); + * R.pipe(R.assoc('a', 2), R.tap(log), R.assoc('a', 3))({a: 1}); //=> {a: 3} + * // logs {a: 2} + * @symb R.bind(f, o)(a, b) = f.call(o, a, b) + */ + + var bind = + /*#__PURE__*/ + _curry2(function bind(fn, thisObj) { + return _arity(fn.length, function () { + return fn.apply(thisObj, arguments); + }); + }); + + function _arrayReduce$1(xf, acc, list) { + var idx = 0; + var len = list.length; + + while (idx < len) { + acc = xf['@@transducer/step'](acc, list[idx]); + + if (acc && acc['@@transducer/reduced']) { + acc = acc['@@transducer/value']; + break; + } + + idx += 1; + } + + return xf['@@transducer/result'](acc); + } + + function _iterableReduce(xf, acc, iter) { + var step = iter.next(); + + while (!step.done) { + acc = xf['@@transducer/step'](acc, step.value); + + if (acc && acc['@@transducer/reduced']) { + acc = acc['@@transducer/value']; + break; + } + + step = iter.next(); + } + + return xf['@@transducer/result'](acc); + } + + function _methodReduce(xf, acc, obj, methodName) { + return xf['@@transducer/result'](obj[methodName](bind(xf['@@transducer/step'], xf), acc)); + } + + var symIterator = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator'; + function _reduce(fn, acc, list) { + if (typeof fn === 'function') { + fn = _xwrap(fn); + } + + if (_isArrayLike(list)) { + return _arrayReduce$1(fn, acc, list); + } + + if (typeof list['fantasy-land/reduce'] === 'function') { + return _methodReduce(fn, acc, list, 'fantasy-land/reduce'); + } + + if (list[symIterator] != null) { + return _iterableReduce(fn, acc, list[symIterator]()); + } + + if (typeof list.next === 'function') { + return _iterableReduce(fn, acc, list); + } + + if (typeof list.reduce === 'function') { + return _methodReduce(fn, acc, list, 'reduce'); + } + + throw new TypeError('reduce: list must be array or iterable'); + } + + var XMap = + /*#__PURE__*/ + function () { + function XMap(f, xf) { + this.xf = xf; + this.f = f; + } + + XMap.prototype['@@transducer/init'] = _xfBase.init; + XMap.prototype['@@transducer/result'] = _xfBase.result; + + XMap.prototype['@@transducer/step'] = function (result, input) { + return this.xf['@@transducer/step'](result, this.f(input)); + }; + + return XMap; + }(); + + var _xmap = + /*#__PURE__*/ + _curry2(function _xmap(f, xf) { + return new XMap(f, xf); + }); + + function _has$1(prop, obj) { + return Object.prototype.hasOwnProperty.call(obj, prop); + } + + var toString$2 = Object.prototype.toString; + + var _isArguments = function _isArguments() { + return toString$2.call(arguments) === '[object Arguments]' ? function _isArguments(x) { + return toString$2.call(x) === '[object Arguments]'; + } : function _isArguments(x) { + return _has$1('callee', x); + }; + }; + + var hasEnumBug = ! + /*#__PURE__*/ + { + toString: null + }.propertyIsEnumerable('toString'); + var nonEnumerableProps = ['constructor', 'valueOf', 'isPrototypeOf', 'toString', 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; // Safari bug + + var hasArgsEnumBug = + /*#__PURE__*/ + function () { + + return arguments.propertyIsEnumerable('length'); + }(); + + var contains = function contains(list, item) { + var idx = 0; + + while (idx < list.length) { + if (list[idx] === item) { + return true; + } + + idx += 1; + } + + return false; + }; + /** + * Returns a list containing the names of all the enumerable own properties of + * the supplied object. + * Note that the order of the output array is not guaranteed to be consistent + * across different JS platforms. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig {k: v} -> [k] + * @param {Object} obj The object to extract properties from + * @return {Array} An array of the object's own properties. + * @see R.keysIn, R.values + * @example + * + * R.keys({a: 1, b: 2, c: 3}); //=> ['a', 'b', 'c'] + */ + + + var _keys = typeof Object.keys === 'function' && !hasArgsEnumBug ? function keys(obj) { + return Object(obj) !== obj ? [] : Object.keys(obj); + } : function keys(obj) { + if (Object(obj) !== obj) { + return []; + } + + var prop, nIdx; + var ks = []; + + var checkArgsLength = hasArgsEnumBug && _isArguments(obj); + + for (prop in obj) { + if (_has$1(prop, obj) && (!checkArgsLength || prop !== 'length')) { + ks[ks.length] = prop; + } + } + + if (hasEnumBug) { + nIdx = nonEnumerableProps.length - 1; + + while (nIdx >= 0) { + prop = nonEnumerableProps[nIdx]; + + if (_has$1(prop, obj) && !contains(ks, prop)) { + ks[ks.length] = prop; + } + + nIdx -= 1; + } + } + + return ks; + }; + + var keys$1 = + /*#__PURE__*/ + _curry1(_keys); + + /** + * Takes a function and + * a [functor](https://github.com/fantasyland/fantasy-land#functor), + * applies the function to each of the functor's values, and returns + * a functor of the same shape. + * + * Ramda provides suitable `map` implementations for `Array` and `Object`, + * so this function may be applied to `[1, 2, 3]` or `{x: 1, y: 2, z: 3}`. + * + * Dispatches to the `map` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * Also treats functions as functors and will compose them together. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Functor f => (a -> b) -> f a -> f b + * @param {Function} fn The function to be called on every element of the input `list`. + * @param {Array} list The list to be iterated over. + * @return {Array} The new list. + * @see R.transduce, R.addIndex + * @example + * + * var double = x => x * 2; + * + * R.map(double, [1, 2, 3]); //=> [2, 4, 6] + * + * R.map(double, {x: 1, y: 2, z: 3}); //=> {x: 2, y: 4, z: 6} + * @symb R.map(f, [a, b]) = [f(a), f(b)] + * @symb R.map(f, { x: a, y: b }) = { x: f(a), y: f(b) } + * @symb R.map(f, functor_o) = functor_o.map(f) + */ + + var map = + /*#__PURE__*/ + _curry2( + /*#__PURE__*/ + _dispatchable(['fantasy-land/map', 'map'], _xmap, function map(fn, functor) { + switch (Object.prototype.toString.call(functor)) { + case '[object Function]': + return curryN(functor.length, function () { + return fn.call(this, functor.apply(this, arguments)); + }); + + case '[object Object]': + return _reduce(function (acc, key) { + acc[key] = fn(functor[key]); + return acc; + }, {}, keys$1(functor)); + + default: + return _map(fn, functor); + } + })); + + /** + * Retrieve the value at a given path. + * + * @func + * @memberOf R + * @since v0.2.0 + * @category Object + * @typedefn Idx = String | Int + * @sig [Idx] -> {a} -> a | Undefined + * @param {Array} path The path to use. + * @param {Object} obj The object to retrieve the nested property from. + * @return {*} The data at `path`. + * @see R.prop + * @example + * + * R.path(['a', 'b'], {a: {b: 2}}); //=> 2 + * R.path(['a', 'b'], {c: {b: 2}}); //=> undefined + */ + + var path = + /*#__PURE__*/ + _curry2(function path(paths, obj) { + var val = obj; + var idx = 0; + + while (idx < paths.length) { + if (val == null) { + return; + } + + val = val[paths[idx]]; + idx += 1; + } + + return val; + }); + + /** + * Returns a function that when supplied an object returns the indicated + * property of that object, if it exists. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig s -> {s: a} -> a | Undefined + * @param {String} p The property name + * @param {Object} obj The object to query + * @return {*} The value at `obj.p`. + * @see R.path + * @example + * + * R.prop('x', {x: 100}); //=> 100 + * R.prop('x', {}); //=> undefined + */ + + var prop = + /*#__PURE__*/ + _curry2(function prop(p, obj) { + return path([p], obj); + }); + + /** + * Returns a new list by plucking the same named property off all objects in + * the list supplied. + * + * `pluck` will work on + * any [functor](https://github.com/fantasyland/fantasy-land#functor) in + * addition to arrays, as it is equivalent to `R.map(R.prop(k), f)`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Functor f => k -> f {k: v} -> f v + * @param {Number|String} key The key name to pluck off of each object. + * @param {Array} f The array or functor to consider. + * @return {Array} The list of values for the given key. + * @see R.props + * @example + * + * R.pluck('a')([{a: 1}, {a: 2}]); //=> [1, 2] + * R.pluck(0)([[1, 2], [3, 4]]); //=> [1, 3] + * R.pluck('val', {a: {val: 3}, b: {val: 5}}); //=> {a: 3, b: 5} + * @symb R.pluck('x', [{x: 1, y: 2}, {x: 3, y: 4}, {x: 5, y: 6}]) = [1, 3, 5] + * @symb R.pluck(0, [[1, 2], [3, 4], [5, 6]]) = [1, 3, 5] + */ + + var pluck = + /*#__PURE__*/ + _curry2(function pluck(p, list) { + return map(prop(p), list); + }); + + /** + * Returns a single item by iterating through the list, successively calling + * the iterator function and passing it an accumulator value and the current + * value from the array, and then passing the result to the next call. + * + * The iterator function receives two values: *(acc, value)*. It may use + * [`R.reduced`](#reduced) to shortcut the iteration. + * + * The arguments' order of [`reduceRight`](#reduceRight)'s iterator function + * is *(value, acc)*. + * + * Note: `R.reduce` does not skip deleted or unassigned indices (sparse + * arrays), unlike the native `Array.prototype.reduce` method. For more details + * on this behavior, see: + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce#Description + * + * Dispatches to the `reduce` method of the third argument, if present. When + * doing so, it is up to the user to handle the [`R.reduced`](#reduced) + * shortcuting, as this is not implemented by `reduce`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig ((a, b) -> a) -> a -> [b] -> a + * @param {Function} fn The iterator function. Receives two values, the accumulator and the + * current element from the array. + * @param {*} acc The accumulator value. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.reduced, R.addIndex, R.reduceRight + * @example + * + * R.reduce(R.subtract, 0, [1, 2, 3, 4]) // => ((((0 - 1) - 2) - 3) - 4) = -10 + * // - -10 + * // / \ / \ + * // - 4 -6 4 + * // / \ / \ + * // - 3 ==> -3 3 + * // / \ / \ + * // - 2 -1 2 + * // / \ / \ + * // 0 1 0 1 + * + * @symb R.reduce(f, a, [b, c, d]) = f(f(f(a, b), c), d) + */ + + var reduce = + /*#__PURE__*/ + _curry3(_reduce); + + /** + * ap applies a list of functions to a list of values. + * + * Dispatches to the `ap` method of the second argument, if present. Also + * treats curried functions as applicatives. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category Function + * @sig [a -> b] -> [a] -> [b] + * @sig Apply f => f (a -> b) -> f a -> f b + * @sig (a -> b -> c) -> (a -> b) -> (a -> c) + * @param {*} applyF + * @param {*} applyX + * @return {*} + * @example + * + * R.ap([R.multiply(2), R.add(3)], [1,2,3]); //=> [2, 4, 6, 4, 5, 6] + * R.ap([R.concat('tasty '), R.toUpper], ['pizza', 'salad']); //=> ["tasty pizza", "tasty salad", "PIZZA", "SALAD"] + * + * // R.ap can also be used as S combinator + * // when only two functions are passed + * R.ap(R.concat, R.toUpper)('Ramda') //=> 'RamdaRAMDA' + * @symb R.ap([f, g], [a, b]) = [f(a), f(b), g(a), g(b)] + */ + + var ap = + /*#__PURE__*/ + _curry2(function ap(applyF, applyX) { + return typeof applyX['fantasy-land/ap'] === 'function' ? applyX['fantasy-land/ap'](applyF) : typeof applyF.ap === 'function' ? applyF.ap(applyX) : typeof applyF === 'function' ? function (x) { + return applyF(x)(applyX(x)); + } : // else + _reduce(function (acc, f) { + return _concat(acc, map(f, applyX)); + }, [], applyF); + }); + + // 20.1.2.3 Number.isInteger(number) + + var floor$1 = Math.floor; + var _isInteger = function isInteger(it) { + return !_isObject(it) && isFinite(it) && floor$1(it) === it; + }; + + // 20.1.2.3 Number.isInteger(number) + + + _export(_export.S, 'Number', { isInteger: _isInteger }); + + function _isFunction(x) { + return Object.prototype.toString.call(x) === '[object Function]'; + } + + /** + * "lifts" a function to be the specified arity, so that it may "map over" that + * many lists, Functions or other objects that satisfy the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply). + * + * @func + * @memberOf R + * @since v0.7.0 + * @category Function + * @sig Number -> (*... -> *) -> ([*]... -> [*]) + * @param {Function} fn The function to lift into higher context + * @return {Function} The lifted function. + * @see R.lift, R.ap + * @example + * + * var madd3 = R.liftN(3, (...args) => R.sum(args)); + * madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7] + */ + + var liftN = + /*#__PURE__*/ + _curry2(function liftN(arity, fn) { + var lifted = curryN(arity, fn); + return curryN(arity, function () { + return _reduce(ap, map(lifted, arguments[0]), Array.prototype.slice.call(arguments, 1)); + }); + }); + + /** + * "lifts" a function of arity > 1 so that it may "map over" a list, Function or other + * object that satisfies the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply). + * + * @func + * @memberOf R + * @since v0.7.0 + * @category Function + * @sig (*... -> *) -> ([*]... -> [*]) + * @param {Function} fn The function to lift into higher context + * @return {Function} The lifted function. + * @see R.liftN + * @example + * + * var madd3 = R.lift((a, b, c) => a + b + c); + * + * madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7] + * + * var madd5 = R.lift((a, b, c, d, e) => a + b + c + d + e); + * + * madd5([1,2], [3], [4, 5], [6], [7, 8]); //=> [21, 22, 22, 23, 22, 23, 23, 24] + */ + + var lift = + /*#__PURE__*/ + _curry1(function lift(fn) { + return liftN(fn.length, fn); + }); + + /** + * Returns a curried equivalent of the provided function. The curried function + * has two unusual capabilities. First, its arguments needn't be provided one + * at a time. If `f` is a ternary function and `g` is `R.curry(f)`, the + * following are equivalent: + * + * - `g(1)(2)(3)` + * - `g(1)(2, 3)` + * - `g(1, 2)(3)` + * - `g(1, 2, 3)` + * + * Secondly, the special placeholder value [`R.__`](#__) may be used to specify + * "gaps", allowing partial application of any combination of arguments, + * regardless of their positions. If `g` is as above and `_` is [`R.__`](#__), + * the following are equivalent: + * + * - `g(1, 2, 3)` + * - `g(_, 2, 3)(1)` + * - `g(_, _, 3)(1)(2)` + * - `g(_, _, 3)(1, 2)` + * - `g(_, 2)(1)(3)` + * - `g(_, 2)(1, 3)` + * - `g(_, 2)(_, 3)(1)` + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig (* -> a) -> (* -> a) + * @param {Function} fn The function to curry. + * @return {Function} A new, curried function. + * @see R.curryN + * @example + * + * var addFourNumbers = (a, b, c, d) => a + b + c + d; + * + * var curriedAddFourNumbers = R.curry(addFourNumbers); + * var f = curriedAddFourNumbers(1, 2); + * var g = f(3); + * g(4); //=> 10 + */ + + var curry = + /*#__PURE__*/ + _curry1(function curry(fn) { + return curryN(fn.length, fn); + }); + + /** + * Returns the result of calling its first argument with the remaining + * arguments. This is occasionally useful as a converging function for + * [`R.converge`](#converge): the first branch can produce a function while the + * remaining branches produce values to be passed to that function as its + * arguments. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Function + * @sig (*... -> a),*... -> a + * @param {Function} fn The function to apply to the remaining arguments. + * @param {...*} args Any number of positional arguments. + * @return {*} + * @see R.apply + * @example + * + * R.call(R.add, 1, 2); //=> 3 + * + * var indentN = R.pipe(R.repeat(' '), + * R.join(''), + * R.replace(/^(?!$)/gm)); + * + * var format = R.converge(R.call, [ + * R.pipe(R.prop('indent'), indentN), + * R.prop('value') + * ]); + * + * format({indent: 2, value: 'foo\nbar\nbaz\n'}); //=> ' foo\n bar\n baz\n' + * @symb R.call(f, a, b) = f(a, b) + */ + + var call = + /*#__PURE__*/ + curry(function call(fn) { + return fn.apply(this, Array.prototype.slice.call(arguments, 1)); + }); + + /** + * `_makeFlat` is a helper function that returns a one-level or fully recursive + * function based on the flag passed in. + * + * @private + */ + + function _makeFlat(recursive) { + return function flatt(list) { + var value, jlen, j; + var result = []; + var idx = 0; + var ilen = list.length; + + while (idx < ilen) { + if (_isArrayLike(list[idx])) { + value = recursive ? flatt(list[idx]) : list[idx]; + j = 0; + jlen = value.length; + + while (j < jlen) { + result[result.length] = value[j]; + j += 1; + } + } else { + result[result.length] = list[idx]; + } + + idx += 1; + } + + return result; + }; + } + + function _forceReduced(x) { + return { + '@@transducer/value': x, + '@@transducer/reduced': true + }; + } + + var preservingReduced = function preservingReduced(xf) { + return { + '@@transducer/init': _xfBase.init, + '@@transducer/result': function transducerResult(result) { + return xf['@@transducer/result'](result); + }, + '@@transducer/step': function transducerStep(result, input) { + var ret = xf['@@transducer/step'](result, input); + return ret['@@transducer/reduced'] ? _forceReduced(ret) : ret; + } + }; + }; + + var _flatCat = function _xcat(xf) { + var rxf = preservingReduced(xf); + return { + '@@transducer/init': _xfBase.init, + '@@transducer/result': function transducerResult(result) { + return rxf['@@transducer/result'](result); + }, + '@@transducer/step': function transducerStep(result, input) { + return !_isArrayLike(input) ? _reduce(rxf, result, [input]) : _reduce(rxf, result, input); + } + }; + }; + + var _xchain = + /*#__PURE__*/ + _curry2(function _xchain(f, xf) { + return map(f, _flatCat(xf)); + }); + + /** + * `chain` maps a function over a list and concatenates the results. `chain` + * is also known as `flatMap` in some libraries + * + * Dispatches to the `chain` method of the second argument, if present, + * according to the [FantasyLand Chain spec](https://github.com/fantasyland/fantasy-land#chain). + * + * @func + * @memberOf R + * @since v0.3.0 + * @category List + * @sig Chain m => (a -> m b) -> m a -> m b + * @param {Function} fn The function to map with + * @param {Array} list The list to map over + * @return {Array} The result of flat-mapping `list` with `fn` + * @example + * + * var duplicate = n => [n, n]; + * R.chain(duplicate, [1, 2, 3]); //=> [1, 1, 2, 2, 3, 3] + * + * R.chain(R.append, R.head)([1, 2, 3]); //=> [1, 2, 3, 1] + */ + + var chain = + /*#__PURE__*/ + _curry2( + /*#__PURE__*/ + _dispatchable(['fantasy-land/chain', 'chain'], _xchain, function chain(fn, monad) { + if (typeof monad === 'function') { + return function (x) { + return fn(monad(x))(x); + }; + } + + return _makeFlat(false)(map(fn, monad)); + })); + + // 7.2.8 IsRegExp(argument) + + + var MATCH = _wks('match'); + var _isRegexp = function (it) { + var isRegExp; + return _isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : _cof(it) == 'RegExp'); + }; + + var dP$4 = _objectDp.f; + var gOPN$3 = _objectGopn.f; + + + var $RegExp = _global.RegExp; + var Base$1 = $RegExp; + var proto$2 = $RegExp.prototype; + var re1 = /a/g; + var re2 = /a/g; + // "new" creates a new object, old webkit buggy here + var CORRECT_NEW = new $RegExp(re1) !== re1; + + if (_descriptors && (!CORRECT_NEW || _fails(function () { + re2[_wks('match')] = false; + // RegExp constructor can alter flags and IsRegExp works correct with @@match + return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i'; + }))) { + $RegExp = function RegExp(p, f) { + var tiRE = this instanceof $RegExp; + var piRE = _isRegexp(p); + var fiU = f === undefined; + return !tiRE && piRE && p.constructor === $RegExp && fiU ? p + : _inheritIfRequired(CORRECT_NEW + ? new Base$1(piRE && !fiU ? p.source : p, f) + : Base$1((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? _flags.call(p) : f) + , tiRE ? this : proto$2, $RegExp); + }; + var proxy = function (key) { + key in $RegExp || dP$4($RegExp, key, { + configurable: true, + get: function () { return Base$1[key]; }, + set: function (it) { Base$1[key] = it; } + }); + }; + for (var keys$2 = gOPN$3(Base$1), i$1 = 0; keys$2.length > i$1;) proxy(keys$2[i$1++]); + proto$2.constructor = $RegExp; + $RegExp.prototype = proto$2; + _redefine(_global, 'RegExp', $RegExp); + } + + _setSpecies('RegExp'); + + /** + * Gives a single-word string description of the (native) type of a value, + * returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not + * attempt to distinguish user Object types any further, reporting them all as + * 'Object'. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Type + * @sig (* -> {*}) -> String + * @param {*} val The value to test + * @return {String} + * @example + * + * R.type({}); //=> "Object" + * R.type(1); //=> "Number" + * R.type(false); //=> "Boolean" + * R.type('s'); //=> "String" + * R.type(null); //=> "Null" + * R.type([]); //=> "Array" + * R.type(/[A-z]/); //=> "RegExp" + * R.type(() => {}); //=> "Function" + * R.type(undefined); //=> "Undefined" + */ + + var type = + /*#__PURE__*/ + _curry1(function type(val) { + return val === null ? 'Null' : val === undefined ? 'Undefined' : Object.prototype.toString.call(val).slice(8, -1); + }); + + /** + * A function that returns the `!` of its argument. It will return `true` when + * passed false-y value, and `false` when passed a truth-y one. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Logic + * @sig * -> Boolean + * @param {*} a any value + * @return {Boolean} the logical inverse of passed argument. + * @see R.complement + * @example + * + * R.not(true); //=> false + * R.not(false); //=> true + * R.not(0); //=> true + * R.not(1); //=> false + */ + + var not = + /*#__PURE__*/ + _curry1(function not(a) { + return !a; + }); + + /** + * Takes a function `f` and returns a function `g` such that if called with the same arguments + * when `f` returns a "truthy" value, `g` returns `false` and when `f` returns a "falsy" value `g` returns `true`. + * + * `R.complement` may be applied to any functor + * + * @func + * @memberOf R + * @since v0.12.0 + * @category Logic + * @sig (*... -> *) -> (*... -> Boolean) + * @param {Function} f + * @return {Function} + * @see R.not + * @example + * + * var isNotNil = R.complement(R.isNil); + * isNil(null); //=> true + * isNotNil(null); //=> false + * isNil(7); //=> false + * isNotNil(7); //=> true + */ + + var complement = + /*#__PURE__*/ + lift(not); + + function _pipe(f, g) { + return function () { + return g.call(this, f.apply(this, arguments)); + }; + } + + /** + * This checks whether a function has a [methodname] function. If it isn't an + * array it will execute that function otherwise it will default to the ramda + * implementation. + * + * @private + * @param {Function} fn ramda implemtation + * @param {String} methodname property to check for a custom implementation + * @return {Object} Whatever the return value of the method is. + */ + + function _checkForMethod(methodname, fn) { + return function () { + var length = arguments.length; + + if (length === 0) { + return fn(); + } + + var obj = arguments[length - 1]; + return _isArray$1(obj) || typeof obj[methodname] !== 'function' ? fn.apply(this, arguments) : obj[methodname].apply(obj, Array.prototype.slice.call(arguments, 0, length - 1)); + }; + } + + /** + * Returns the elements of the given list or string (or object with a `slice` + * method) from `fromIndex` (inclusive) to `toIndex` (exclusive). + * + * Dispatches to the `slice` method of the third argument, if present. + * + * @func + * @memberOf R + * @since v0.1.4 + * @category List + * @sig Number -> Number -> [a] -> [a] + * @sig Number -> Number -> String -> String + * @param {Number} fromIndex The start index (inclusive). + * @param {Number} toIndex The end index (exclusive). + * @param {*} list + * @return {*} + * @example + * + * R.slice(1, 3, ['a', 'b', 'c', 'd']); //=> ['b', 'c'] + * R.slice(1, Infinity, ['a', 'b', 'c', 'd']); //=> ['b', 'c', 'd'] + * R.slice(0, -1, ['a', 'b', 'c', 'd']); //=> ['a', 'b', 'c'] + * R.slice(-3, -1, ['a', 'b', 'c', 'd']); //=> ['b', 'c'] + * R.slice(0, 3, 'ramda'); //=> 'ram' + */ + + var slice = + /*#__PURE__*/ + _curry3( + /*#__PURE__*/ + _checkForMethod('slice', function slice(fromIndex, toIndex, list) { + return Array.prototype.slice.call(list, fromIndex, toIndex); + })); + + /** + * Returns all but the first element of the given list or string (or object + * with a `tail` method). + * + * Dispatches to the `slice` method of the first argument, if present. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [a] + * @sig String -> String + * @param {*} list + * @return {*} + * @see R.head, R.init, R.last + * @example + * + * R.tail([1, 2, 3]); //=> [2, 3] + * R.tail([1, 2]); //=> [2] + * R.tail([1]); //=> [] + * R.tail([]); //=> [] + * + * R.tail('abc'); //=> 'bc' + * R.tail('ab'); //=> 'b' + * R.tail('a'); //=> '' + * R.tail(''); //=> '' + */ + + var tail = + /*#__PURE__*/ + _curry1( + /*#__PURE__*/ + _checkForMethod('tail', + /*#__PURE__*/ + slice(1, Infinity))); + + /** + * Performs left-to-right function composition. The leftmost function may have + * any arity; the remaining functions must be unary. + * + * In some libraries this function is named `sequence`. + * + * **Note:** The result of pipe is not automatically curried. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig (((a, b, ..., n) -> o), (o -> p), ..., (x -> y), (y -> z)) -> ((a, b, ..., n) -> z) + * @param {...Function} functions + * @return {Function} + * @see R.compose + * @example + * + * var f = R.pipe(Math.pow, R.negate, R.inc); + * + * f(3, 4); // -(3^4) + 1 + * @symb R.pipe(f, g, h)(a, b) = h(g(f(a, b))) + */ + + function pipe() { + if (arguments.length === 0) { + throw new Error('pipe requires at least one argument'); + } + + return _arity(arguments[0].length, reduce(_pipe, arguments[0], tail(arguments))); + } + + var _fixReWks = function (KEY, length, exec) { + var SYMBOL = _wks(KEY); + var fns = exec(_defined, SYMBOL, ''[KEY]); + var strfn = fns[0]; + var rxfn = fns[1]; + if (_fails(function () { + var O = {}; + O[SYMBOL] = function () { return 7; }; + return ''[KEY](O) != 7; + })) { + _redefine(String.prototype, KEY, strfn); + _hide(RegExp.prototype, SYMBOL, length == 2 + // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) + // 21.2.5.11 RegExp.prototype[@@split](string, limit) + ? function (string, arg) { return rxfn.call(string, this, arg); } + // 21.2.5.6 RegExp.prototype[@@match](string) + // 21.2.5.9 RegExp.prototype[@@search](string) + : function (string) { return rxfn.call(string, this); } + ); + } + }; + + // @@split logic + _fixReWks('split', 2, function (defined, SPLIT, $split) { + var isRegExp = _isRegexp; + var _split = $split; + var $push = [].push; + var $SPLIT = 'split'; + var LENGTH = 'length'; + var LAST_INDEX = 'lastIndex'; + if ( + 'abbc'[$SPLIT](/(b)*/)[1] == 'c' || + 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 || + 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 || + '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 || + '.'[$SPLIT](/()()/)[LENGTH] > 1 || + ''[$SPLIT](/.?/)[LENGTH] + ) { + var NPCG = /()??/.exec('')[1] === undefined; // nonparticipating capturing group + // based on es5-shim implementation, need to rework it + $split = function (separator, limit) { + var string = String(this); + if (separator === undefined && limit === 0) return []; + // If `separator` is not a regex, use native split + if (!isRegExp(separator)) return _split.call(string, separator, limit); + var output = []; + var flags = (separator.ignoreCase ? 'i' : '') + + (separator.multiline ? 'm' : '') + + (separator.unicode ? 'u' : '') + + (separator.sticky ? 'y' : ''); + var lastLastIndex = 0; + var splitLimit = limit === undefined ? 4294967295 : limit >>> 0; + // Make `global` and avoid `lastIndex` issues by working with a copy + var separatorCopy = new RegExp(separator.source, flags + 'g'); + var separator2, match, lastIndex, lastLength, i; + // Doesn't need flags gy, but they don't hurt + if (!NPCG) separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags); + while (match = separatorCopy.exec(string)) { + // `separatorCopy.lastIndex` is not reliable cross-browser + lastIndex = match.index + match[0][LENGTH]; + if (lastIndex > lastLastIndex) { + output.push(string.slice(lastLastIndex, match.index)); + // Fix browsers whose `exec` methods don't consistently return `undefined` for NPCG + // eslint-disable-next-line no-loop-func + if (!NPCG && match[LENGTH] > 1) match[0].replace(separator2, function () { + for (i = 1; i < arguments[LENGTH] - 2; i++) if (arguments[i] === undefined) match[i] = undefined; + }); + if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1)); + lastLength = match[0][LENGTH]; + lastLastIndex = lastIndex; + if (output[LENGTH] >= splitLimit) break; + } + if (separatorCopy[LAST_INDEX] === match.index) separatorCopy[LAST_INDEX]++; // Avoid an infinite loop + } + if (lastLastIndex === string[LENGTH]) { + if (lastLength || !separatorCopy.test('')) output.push(''); + } else output.push(string.slice(lastLastIndex)); + return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output; + }; + // Chakra, V8 + } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) { + $split = function (separator, limit) { + return separator === undefined && limit === 0 ? [] : _split.call(this, separator, limit); + }; + } + // 21.1.3.17 String.prototype.split(separator, limit) + return [function split(separator, limit) { + var O = defined(this); + var fn = separator == undefined ? undefined : separator[SPLIT]; + return fn !== undefined ? fn.call(separator, O, limit) : $split.call(String(O), separator, limit); + }, $split]; + }); + + /** + * Returns a new list or string with the elements or characters in reverse + * order. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [a] + * @sig String -> String + * @param {Array|String} list + * @return {Array|String} + * @example + * + * R.reverse([1, 2, 3]); //=> [3, 2, 1] + * R.reverse([1, 2]); //=> [2, 1] + * R.reverse([1]); //=> [1] + * R.reverse([]); //=> [] + * + * R.reverse('abc'); //=> 'cba' + * R.reverse('ab'); //=> 'ba' + * R.reverse('a'); //=> 'a' + * R.reverse(''); //=> '' + */ + + var reverse = + /*#__PURE__*/ + _curry1(function reverse(list) { + return _isString(list) ? list.split('').reverse().join('') : Array.prototype.slice.call(list, 0).reverse(); + }); + + /** + * Performs right-to-left function composition. The rightmost function may have + * any arity; the remaining functions must be unary. + * + * **Note:** The result of compose is not automatically curried. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig ((y -> z), (x -> y), ..., (o -> p), ((a, b, ..., n) -> o)) -> ((a, b, ..., n) -> z) + * @param {...Function} ...functions The functions to compose + * @return {Function} + * @see R.pipe + * @example + * + * var classyGreeting = (firstName, lastName) => "The name's " + lastName + ", " + firstName + " " + lastName + * var yellGreeting = R.compose(R.toUpper, classyGreeting); + * yellGreeting('James', 'Bond'); //=> "THE NAME'S BOND, JAMES BOND" + * + * R.compose(Math.abs, R.add(1), R.multiply(2))(-4) //=> 7 + * + * @symb R.compose(f, g, h)(a, b) = f(g(h(a, b))) + */ + + function compose() { + if (arguments.length === 0) { + throw new Error('compose requires at least one argument'); + } + + return pipe.apply(this, reverse(arguments)); + } + + var $sort = [].sort; + var test = [1, 2, 3]; + + _export(_export.P + _export.F * (_fails(function () { + // IE8- + test.sort(undefined); + }) || !_fails(function () { + // V8 bug + test.sort(null); + // Old WebKit + }) || !_strictMethod($sort)), 'Array', { + // 22.1.3.25 Array.prototype.sort(comparefn) + sort: function sort(comparefn) { + return comparefn === undefined + ? $sort.call(_toObject(this)) + : $sort.call(_toObject(this), _aFunction(comparefn)); + } + }); + + function _arrayFromIterator(iter) { + var list = []; + var next; + + while (!(next = iter.next()).done) { + list.push(next.value); + } + + return list; + } + + function _containsWith(pred, x, list) { + var idx = 0; + var len = list.length; + + while (idx < len) { + if (pred(x, list[idx])) { + return true; + } + + idx += 1; + } + + return false; + } + + // @@match logic + _fixReWks('match', 1, function (defined, MATCH, $match) { + // 21.1.3.11 String.prototype.match(regexp) + return [function match(regexp) { + var O = defined(this); + var fn = regexp == undefined ? undefined : regexp[MATCH]; + return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); + }, $match]; + }); + + function _functionName(f) { + // String(x => x) evaluates to "x => x", so the pattern may not match. + var match = String(f).match(/^function (\w*)/); + return match == null ? '' : match[1]; + } + + /** + * Returns true if its arguments are identical, false otherwise. Values are + * identical if they reference the same memory. `NaN` is identical to `NaN`; + * `0` and `-0` are not identical. + * + * @func + * @memberOf R + * @since v0.15.0 + * @category Relation + * @sig a -> a -> Boolean + * @param {*} a + * @param {*} b + * @return {Boolean} + * @example + * + * var o = {}; + * R.identical(o, o); //=> true + * R.identical(1, 1); //=> true + * R.identical(1, '1'); //=> false + * R.identical([], []); //=> false + * R.identical(0, -0); //=> false + * R.identical(NaN, NaN); //=> true + */ + + var identical = + /*#__PURE__*/ + _curry2(function identical(a, b) { + // SameValue algorithm + if (a === b) { + // Steps 1-5, 7-10 + // Steps 6.b-6.e: +0 != -0 + return a !== 0 || 1 / a === 1 / b; + } else { + // Step 6.a: NaN == NaN + return a !== a && b !== b; + } + }); + + /** + * private _uniqContentEquals function. + * That function is checking equality of 2 iterator contents with 2 assumptions + * - iterators lengths are the same + * - iterators values are unique + * + * false-positive result will be returned for comparision of, e.g. + * - [1,2,3] and [1,2,3,4] + * - [1,1,1] and [1,2,3] + * */ + + function _uniqContentEquals(aIterator, bIterator, stackA, stackB) { + var a = _arrayFromIterator(aIterator); + + var b = _arrayFromIterator(bIterator); + + function eq(_a, _b) { + return _equals(_a, _b, stackA.slice(), stackB.slice()); + } // if *a* array contains any element that is not included in *b* + + + return !_containsWith(function (b, aItem) { + return !_containsWith(eq, aItem, b); + }, b, a); + } + + function _equals(a, b, stackA, stackB) { + if (identical(a, b)) { + return true; + } + + var typeA = type(a); + + if (typeA !== type(b)) { + return false; + } + + if (a == null || b == null) { + return false; + } + + if (typeof a['fantasy-land/equals'] === 'function' || typeof b['fantasy-land/equals'] === 'function') { + return typeof a['fantasy-land/equals'] === 'function' && a['fantasy-land/equals'](b) && typeof b['fantasy-land/equals'] === 'function' && b['fantasy-land/equals'](a); + } + + if (typeof a.equals === 'function' || typeof b.equals === 'function') { + return typeof a.equals === 'function' && a.equals(b) && typeof b.equals === 'function' && b.equals(a); + } + + switch (typeA) { + case 'Arguments': + case 'Array': + case 'Object': + if (typeof a.constructor === 'function' && _functionName(a.constructor) === 'Promise') { + return a === b; + } + + break; + + case 'Boolean': + case 'Number': + case 'String': + if (!(_typeof(a) === _typeof(b) && identical(a.valueOf(), b.valueOf()))) { + return false; + } + + break; + + case 'Date': + if (!identical(a.valueOf(), b.valueOf())) { + return false; + } + + break; + + case 'Error': + return a.name === b.name && a.message === b.message; + + case 'RegExp': + if (!(a.source === b.source && a.global === b.global && a.ignoreCase === b.ignoreCase && a.multiline === b.multiline && a.sticky === b.sticky && a.unicode === b.unicode)) { + return false; + } + + break; + } + + var idx = stackA.length - 1; + + while (idx >= 0) { + if (stackA[idx] === a) { + return stackB[idx] === b; + } + + idx -= 1; + } + + switch (typeA) { + case 'Map': + if (a.size !== b.size) { + return false; + } + + return _uniqContentEquals(a.entries(), b.entries(), stackA.concat([a]), stackB.concat([b])); + + case 'Set': + if (a.size !== b.size) { + return false; + } + + return _uniqContentEquals(a.values(), b.values(), stackA.concat([a]), stackB.concat([b])); + + case 'Arguments': + case 'Array': + case 'Object': + case 'Boolean': + case 'Number': + case 'String': + case 'Date': + case 'Error': + case 'RegExp': + case 'Int8Array': + case 'Uint8Array': + case 'Uint8ClampedArray': + case 'Int16Array': + case 'Uint16Array': + case 'Int32Array': + case 'Uint32Array': + case 'Float32Array': + case 'Float64Array': + case 'ArrayBuffer': + break; + + default: + // Values of other types are only equal if identical. + return false; + } + + var keysA = keys$1(a); + + if (keysA.length !== keys$1(b).length) { + return false; + } + + var extendedStackA = stackA.concat([a]); + var extendedStackB = stackB.concat([b]); + idx = keysA.length - 1; + + while (idx >= 0) { + var key = keysA[idx]; + + if (!(_has$1(key, b) && _equals(b[key], a[key], extendedStackA, extendedStackB))) { + return false; + } + + idx -= 1; + } + + return true; + } + + /** + * Returns `true` if its arguments are equivalent, `false` otherwise. Handles + * cyclical data structures. + * + * Dispatches symmetrically to the `equals` methods of both arguments, if + * present. + * + * @func + * @memberOf R + * @since v0.15.0 + * @category Relation + * @sig a -> b -> Boolean + * @param {*} a + * @param {*} b + * @return {Boolean} + * @example + * + * R.equals(1, 1); //=> true + * R.equals(1, '1'); //=> false + * R.equals([1, 2, 3], [1, 2, 3]); //=> true + * + * var a = {}; a.v = a; + * var b = {}; b.v = b; + * R.equals(a, b); //=> true + */ + + var equals = + /*#__PURE__*/ + _curry2(function equals(a, b) { + return _equals(a, b, [], []); + }); + + function _indexOf(list, a, idx) { + var inf, item; // Array.prototype.indexOf doesn't exist below IE9 + + if (typeof list.indexOf === 'function') { + switch (_typeof(a)) { + case 'number': + if (a === 0) { + // manually crawl the list to distinguish between +0 and -0 + inf = 1 / a; + + while (idx < list.length) { + item = list[idx]; + + if (item === 0 && 1 / item === inf) { + return idx; + } + + idx += 1; + } + + return -1; + } else if (a !== a) { + // NaN + while (idx < list.length) { + item = list[idx]; + + if (typeof item === 'number' && item !== item) { + return idx; + } + + idx += 1; + } + + return -1; + } // non-zero numbers can utilise Set + + + return list.indexOf(a, idx); + // all these types can utilise Set + + case 'string': + case 'boolean': + case 'function': + case 'undefined': + return list.indexOf(a, idx); + + case 'object': + if (a === null) { + // null can utilise Set + return list.indexOf(a, idx); + } + + } + } // anything else not covered above, defer to R.equals + + + while (idx < list.length) { + if (equals(list[idx], a)) { + return idx; + } + + idx += 1; + } + + return -1; + } + + function _contains(a, list) { + return _indexOf(list, a, 0) >= 0; + } + + // @@replace logic + _fixReWks('replace', 2, function (defined, REPLACE, $replace) { + // 21.1.3.14 String.prototype.replace(searchValue, replaceValue) + return [function replace(searchValue, replaceValue) { + var O = defined(this); + var fn = searchValue == undefined ? undefined : searchValue[REPLACE]; + return fn !== undefined + ? fn.call(searchValue, O, replaceValue) + : $replace.call(String(O), searchValue, replaceValue); + }, $replace]; + }); + + function _quote(s) { + var escaped = s.replace(/\\/g, '\\\\').replace(/[\b]/g, '\\b') // \b matches word boundary; [\b] matches backspace + .replace(/\f/g, '\\f').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\t/g, '\\t').replace(/\v/g, '\\v').replace(/\0/g, '\\0'); + return '"' + escaped.replace(/"/g, '\\"') + '"'; + } + + // 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() + + var getTime$1 = Date.prototype.getTime; + var $toISOString = Date.prototype.toISOString; + + var lz = function (num) { + return num > 9 ? num : '0' + num; + }; + + // PhantomJS / old WebKit has a broken implementations + var _dateToIsoString = (_fails(function () { + return $toISOString.call(new Date(-5e13 - 1)) != '0385-07-25T07:06:39.999Z'; + }) || !_fails(function () { + $toISOString.call(new Date(NaN)); + })) ? function toISOString() { + if (!isFinite(getTime$1.call(this))) throw RangeError('Invalid time value'); + var d = this; + var y = d.getUTCFullYear(); + var m = d.getUTCMilliseconds(); + var s = y < 0 ? '-' : y > 9999 ? '+' : ''; + return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) + + '-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) + + 'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) + + ':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z'; + } : $toISOString; + + // 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() + + + + // PhantomJS / old WebKit has a broken implementations + _export(_export.P + _export.F * (Date.prototype.toISOString !== _dateToIsoString), 'Date', { + toISOString: _dateToIsoString + }); + + /** + * Polyfill from . + */ + var pad = function pad(n) { + return (n < 10 ? '0' : '') + n; + }; + + var _toISOString = typeof Date.prototype.toISOString === 'function' ? function _toISOString(d) { + return d.toISOString(); + } : function _toISOString(d) { + return d.getUTCFullYear() + '-' + pad(d.getUTCMonth() + 1) + '-' + pad(d.getUTCDate()) + 'T' + pad(d.getUTCHours()) + ':' + pad(d.getUTCMinutes()) + ':' + pad(d.getUTCSeconds()) + '.' + (d.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) + 'Z'; + }; + + function _complement(f) { + return function () { + return !f.apply(this, arguments); + }; + } + + function _filter(fn, list) { + var idx = 0; + var len = list.length; + var result = []; + + while (idx < len) { + if (fn(list[idx])) { + result[result.length] = list[idx]; + } + + idx += 1; + } + + return result; + } + + function _isObject$1(x) { + return Object.prototype.toString.call(x) === '[object Object]'; + } + + var XFilter = + /*#__PURE__*/ + function () { + function XFilter(f, xf) { + this.xf = xf; + this.f = f; + } + + XFilter.prototype['@@transducer/init'] = _xfBase.init; + XFilter.prototype['@@transducer/result'] = _xfBase.result; + + XFilter.prototype['@@transducer/step'] = function (result, input) { + return this.f(input) ? this.xf['@@transducer/step'](result, input) : result; + }; + + return XFilter; + }(); + + var _xfilter = + /*#__PURE__*/ + _curry2(function _xfilter(f, xf) { + return new XFilter(f, xf); + }); + + /** + * Takes a predicate and a `Filterable`, and returns a new filterable of the + * same type containing the members of the given filterable which satisfy the + * given predicate. Filterable objects include plain objects or any object + * that has a filter method such as `Array`. + * + * Dispatches to the `filter` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Filterable f => (a -> Boolean) -> f a -> f a + * @param {Function} pred + * @param {Array} filterable + * @return {Array} Filterable + * @see R.reject, R.transduce, R.addIndex + * @example + * + * var isEven = n => n % 2 === 0; + * + * R.filter(isEven, [1, 2, 3, 4]); //=> [2, 4] + * + * R.filter(isEven, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4} + */ + + var filter = + /*#__PURE__*/ + _curry2( + /*#__PURE__*/ + _dispatchable(['filter'], _xfilter, function (pred, filterable) { + return _isObject$1(filterable) ? _reduce(function (acc, key) { + if (pred(filterable[key])) { + acc[key] = filterable[key]; + } + + return acc; + }, {}, keys$1(filterable)) : // else + _filter(pred, filterable); + })); + + /** + * The complement of [`filter`](#filter). + * + * Acts as a transducer if a transformer is given in list position. Filterable + * objects include plain objects or any object that has a filter method such + * as `Array`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Filterable f => (a -> Boolean) -> f a -> f a + * @param {Function} pred + * @param {Array} filterable + * @return {Array} + * @see R.filter, R.transduce, R.addIndex + * @example + * + * var isOdd = (n) => n % 2 === 1; + * + * R.reject(isOdd, [1, 2, 3, 4]); //=> [2, 4] + * + * R.reject(isOdd, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4} + */ + + var reject = + /*#__PURE__*/ + _curry2(function reject(pred, filterable) { + return filter(_complement(pred), filterable); + }); + + function _toString(x, seen) { + var recur = function recur(y) { + var xs = seen.concat([x]); + return _contains(y, xs) ? '' : _toString(y, xs); + }; // mapPairs :: (Object, [String]) -> [String] + + + var mapPairs = function mapPairs(obj, keys) { + return _map(function (k) { + return _quote(k) + ': ' + recur(obj[k]); + }, keys.slice().sort()); + }; + + switch (Object.prototype.toString.call(x)) { + case '[object Arguments]': + return '(function() { return arguments; }(' + _map(recur, x).join(', ') + '))'; + + case '[object Array]': + return '[' + _map(recur, x).concat(mapPairs(x, reject(function (k) { + return /^\d+$/.test(k); + }, keys$1(x)))).join(', ') + ']'; + + case '[object Boolean]': + return _typeof(x) === 'object' ? 'new Boolean(' + recur(x.valueOf()) + ')' : x.toString(); + + case '[object Date]': + return 'new Date(' + (isNaN(x.valueOf()) ? recur(NaN) : _quote(_toISOString(x))) + ')'; + + case '[object Null]': + return 'null'; + + case '[object Number]': + return _typeof(x) === 'object' ? 'new Number(' + recur(x.valueOf()) + ')' : 1 / x === -Infinity ? '-0' : x.toString(10); + + case '[object String]': + return _typeof(x) === 'object' ? 'new String(' + recur(x.valueOf()) + ')' : _quote(x); + + case '[object Undefined]': + return 'undefined'; + + default: + if (typeof x.toString === 'function') { + var repr = x.toString(); + + if (repr !== '[object Object]') { + return repr; + } + } + + return '{' + mapPairs(x, keys$1(x)).join(', ') + '}'; + } + } + + /** + * Returns the string representation of the given value. `eval`'ing the output + * should result in a value equivalent to the input value. Many of the built-in + * `toString` methods do not satisfy this requirement. + * + * If the given value is an `[object Object]` with a `toString` method other + * than `Object.prototype.toString`, this method is invoked with no arguments + * to produce the return value. This means user-defined constructor functions + * can provide a suitable `toString` method. For example: + * + * function Point(x, y) { + * this.x = x; + * this.y = y; + * } + * + * Point.prototype.toString = function() { + * return 'new Point(' + this.x + ', ' + this.y + ')'; + * }; + * + * R.toString(new Point(1, 2)); //=> 'new Point(1, 2)' + * + * @func + * @memberOf R + * @since v0.14.0 + * @category String + * @sig * -> String + * @param {*} val + * @return {String} + * @example + * + * R.toString(42); //=> '42' + * R.toString('abc'); //=> '"abc"' + * R.toString([1, 2, 3]); //=> '[1, 2, 3]' + * R.toString({foo: 1, bar: 2, baz: 3}); //=> '{"bar": 2, "baz": 3, "foo": 1}' + * R.toString(new Date('2001-02-03T04:05:06Z')); //=> 'new Date("2001-02-03T04:05:06.000Z")' + */ + + var toString$3 = + /*#__PURE__*/ + _curry1(function toString(val) { + return _toString(val, []); + }); + + /** + * Accepts a converging function and a list of branching functions and returns + * a new function. When invoked, this new function is applied to some + * arguments, each branching function is applied to those same arguments. The + * results of each branching function are passed as arguments to the converging + * function to produce the return value. + * + * @func + * @memberOf R + * @since v0.4.2 + * @category Function + * @sig ((x1, x2, ...) -> z) -> [((a, b, ...) -> x1), ((a, b, ...) -> x2), ...] -> (a -> b -> ... -> z) + * @param {Function} after A function. `after` will be invoked with the return values of + * `fn1` and `fn2` as its arguments. + * @param {Array} functions A list of functions. + * @return {Function} A new function. + * @see R.useWith + * @example + * + * var average = R.converge(R.divide, [R.sum, R.length]) + * average([1, 2, 3, 4, 5, 6, 7]) //=> 4 + * + * var strangeConcat = R.converge(R.concat, [R.toUpper, R.toLower]) + * strangeConcat("Yodel") //=> "YODELyodel" + * + * @symb R.converge(f, [g, h])(a, b) = f(g(a, b), h(a, b)) + */ + + var converge = + /*#__PURE__*/ + _curry2(function converge(after, fns) { + return curryN(reduce(max$1, 0, pluck('length', fns)), function () { + var args = arguments; + var context = this; + return after.apply(context, _map(function (fn) { + return fn.apply(context, args); + }, fns)); + }); + }); + + var XReduceBy = + /*#__PURE__*/ + function () { + function XReduceBy(valueFn, valueAcc, keyFn, xf) { + this.valueFn = valueFn; + this.valueAcc = valueAcc; + this.keyFn = keyFn; + this.xf = xf; + this.inputs = {}; + } + + XReduceBy.prototype['@@transducer/init'] = _xfBase.init; + + XReduceBy.prototype['@@transducer/result'] = function (result) { + var key; + + for (key in this.inputs) { + if (_has$1(key, this.inputs)) { + result = this.xf['@@transducer/step'](result, this.inputs[key]); + + if (result['@@transducer/reduced']) { + result = result['@@transducer/value']; + break; + } + } + } + + this.inputs = null; + return this.xf['@@transducer/result'](result); + }; + + XReduceBy.prototype['@@transducer/step'] = function (result, input) { + var key = this.keyFn(input); + this.inputs[key] = this.inputs[key] || [key, this.valueAcc]; + this.inputs[key][1] = this.valueFn(this.inputs[key][1], input); + return result; + }; + + return XReduceBy; + }(); + + var _xreduceBy = + /*#__PURE__*/ + _curryN(4, [], function _xreduceBy(valueFn, valueAcc, keyFn, xf) { + return new XReduceBy(valueFn, valueAcc, keyFn, xf); + }); + + /** + * Groups the elements of the list according to the result of calling + * the String-returning function `keyFn` on each element and reduces the elements + * of each group to a single value via the reducer function `valueFn`. + * + * This function is basically a more general [`groupBy`](#groupBy) function. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.20.0 + * @category List + * @sig ((a, b) -> a) -> a -> (b -> String) -> [b] -> {String: a} + * @param {Function} valueFn The function that reduces the elements of each group to a single + * value. Receives two values, accumulator for a particular group and the current element. + * @param {*} acc The (initial) accumulator value for each group. + * @param {Function} keyFn The function that maps the list's element into a key. + * @param {Array} list The array to group. + * @return {Object} An object with the output of `keyFn` for keys, mapped to the output of + * `valueFn` for elements which produced that key when passed to `keyFn`. + * @see R.groupBy, R.reduce + * @example + * + * var reduceToNamesBy = R.reduceBy((acc, student) => acc.concat(student.name), []); + * var namesByGrade = reduceToNamesBy(function(student) { + * var score = student.score; + * return score < 65 ? 'F' : + * score < 70 ? 'D' : + * score < 80 ? 'C' : + * score < 90 ? 'B' : 'A'; + * }); + * var students = [{name: 'Lucy', score: 92}, + * {name: 'Drew', score: 85}, + * // ... + * {name: 'Bart', score: 62}]; + * namesByGrade(students); + * // { + * // 'A': ['Lucy'], + * // 'B': ['Drew'] + * // // ..., + * // 'F': ['Bart'] + * // } + */ + + var reduceBy = + /*#__PURE__*/ + _curryN(4, [], + /*#__PURE__*/ + _dispatchable([], _xreduceBy, function reduceBy(valueFn, valueAcc, keyFn, list) { + return _reduce(function (acc, elt) { + var key = keyFn(elt); + acc[key] = valueFn(_has$1(key, acc) ? acc[key] : valueAcc, elt); + return acc; + }, {}, list); + })); + + /** + * Counts the elements of a list according to how many match each value of a + * key generated by the supplied function. Returns an object mapping the keys + * produced by `fn` to the number of occurrences in the list. Note that all + * keys are coerced to strings because of how JavaScript objects work. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig (a -> String) -> [a] -> {*} + * @param {Function} fn The function used to map values to keys. + * @param {Array} list The list to count elements from. + * @return {Object} An object mapping keys to number of occurrences in the list. + * @example + * + * var numbers = [1.0, 1.1, 1.2, 2.0, 3.0, 2.2]; + * R.countBy(Math.floor)(numbers); //=> {'1': 3, '2': 2, '3': 1} + * + * var letters = ['a', 'b', 'A', 'a', 'B', 'c']; + * R.countBy(R.toLower)(letters); //=> {'a': 3, 'b': 2, 'c': 1} + */ + + var countBy = + /*#__PURE__*/ + reduceBy(function (acc, elem) { + return acc + 1; + }, 0); + + /** + * Decrements its argument. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Math + * @sig Number -> Number + * @param {Number} n + * @return {Number} n - 1 + * @see R.inc + * @example + * + * R.dec(42); //=> 41 + */ + + var dec = + /*#__PURE__*/ + add(-1); + + var XTake = + /*#__PURE__*/ + function () { + function XTake(n, xf) { + this.xf = xf; + this.n = n; + this.i = 0; + } + + XTake.prototype['@@transducer/init'] = _xfBase.init; + XTake.prototype['@@transducer/result'] = _xfBase.result; + + XTake.prototype['@@transducer/step'] = function (result, input) { + this.i += 1; + var ret = this.n === 0 ? result : this.xf['@@transducer/step'](result, input); + return this.n >= 0 && this.i >= this.n ? _reduced(ret) : ret; + }; + + return XTake; + }(); + + var _xtake = + /*#__PURE__*/ + _curry2(function _xtake(n, xf) { + return new XTake(n, xf); + }); + + /** + * Returns the first `n` elements of the given list, string, or + * transducer/transformer (or object with a `take` method). + * + * Dispatches to the `take` method of the second argument, if present. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Number -> [a] -> [a] + * @sig Number -> String -> String + * @param {Number} n + * @param {*} list + * @return {*} + * @see R.drop + * @example + * + * R.take(1, ['foo', 'bar', 'baz']); //=> ['foo'] + * R.take(2, ['foo', 'bar', 'baz']); //=> ['foo', 'bar'] + * R.take(3, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz'] + * R.take(4, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz'] + * R.take(3, 'ramda'); //=> 'ram' + * + * var personnel = [ + * 'Dave Brubeck', + * 'Paul Desmond', + * 'Eugene Wright', + * 'Joe Morello', + * 'Gerry Mulligan', + * 'Bob Bates', + * 'Joe Dodge', + * 'Ron Crotty' + * ]; + * + * var takeFive = R.take(5); + * takeFive(personnel); + * //=> ['Dave Brubeck', 'Paul Desmond', 'Eugene Wright', 'Joe Morello', 'Gerry Mulligan'] + * @symb R.take(-1, [a, b]) = [a, b] + * @symb R.take(0, [a, b]) = [] + * @symb R.take(1, [a, b]) = [a] + * @symb R.take(2, [a, b]) = [a, b] + */ + + var take = + /*#__PURE__*/ + _curry2( + /*#__PURE__*/ + _dispatchable(['take'], _xtake, function take(n, xs) { + return slice(0, n < 0 ? Infinity : n, xs); + })); + + function dropLast(n, xs) { + return take(n < xs.length ? xs.length - n : 0, xs); + } + + var XDropLast = + /*#__PURE__*/ + function () { + function XDropLast(n, xf) { + this.xf = xf; + this.pos = 0; + this.full = false; + this.acc = new Array(n); + } + + XDropLast.prototype['@@transducer/init'] = _xfBase.init; + + XDropLast.prototype['@@transducer/result'] = function (result) { + this.acc = null; + return this.xf['@@transducer/result'](result); + }; + + XDropLast.prototype['@@transducer/step'] = function (result, input) { + if (this.full) { + result = this.xf['@@transducer/step'](result, this.acc[this.pos]); + } + + this.store(input); + return result; + }; + + XDropLast.prototype.store = function (input) { + this.acc[this.pos] = input; + this.pos += 1; + + if (this.pos === this.acc.length) { + this.pos = 0; + this.full = true; + } + }; + + return XDropLast; + }(); + + var _xdropLast = + /*#__PURE__*/ + _curry2(function _xdropLast(n, xf) { + return new XDropLast(n, xf); + }); + + /** + * Returns a list containing all but the last `n` elements of the given `list`. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category List + * @sig Number -> [a] -> [a] + * @sig Number -> String -> String + * @param {Number} n The number of elements of `list` to skip. + * @param {Array} list The list of elements to consider. + * @return {Array} A copy of the list with only the first `list.length - n` elements + * @see R.takeLast, R.drop, R.dropWhile, R.dropLastWhile + * @example + * + * R.dropLast(1, ['foo', 'bar', 'baz']); //=> ['foo', 'bar'] + * R.dropLast(2, ['foo', 'bar', 'baz']); //=> ['foo'] + * R.dropLast(3, ['foo', 'bar', 'baz']); //=> [] + * R.dropLast(4, ['foo', 'bar', 'baz']); //=> [] + * R.dropLast(3, 'ramda'); //=> 'ra' + */ + + var dropLast$1 = + /*#__PURE__*/ + _curry2( + /*#__PURE__*/ + _dispatchable([], _xdropLast, dropLast)); + + var XDropRepeatsWith = + /*#__PURE__*/ + function () { + function XDropRepeatsWith(pred, xf) { + this.xf = xf; + this.pred = pred; + this.lastValue = undefined; + this.seenFirstValue = false; + } + + XDropRepeatsWith.prototype['@@transducer/init'] = _xfBase.init; + XDropRepeatsWith.prototype['@@transducer/result'] = _xfBase.result; + + XDropRepeatsWith.prototype['@@transducer/step'] = function (result, input) { + var sameAsLast = false; + + if (!this.seenFirstValue) { + this.seenFirstValue = true; + } else if (this.pred(this.lastValue, input)) { + sameAsLast = true; + } + + this.lastValue = input; + return sameAsLast ? result : this.xf['@@transducer/step'](result, input); + }; + + return XDropRepeatsWith; + }(); + + var _xdropRepeatsWith = + /*#__PURE__*/ + _curry2(function _xdropRepeatsWith(pred, xf) { + return new XDropRepeatsWith(pred, xf); + }); + + /** + * Returns the nth element of the given list or string. If n is negative the + * element at index length + n is returned. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Number -> [a] -> a | Undefined + * @sig Number -> String -> String + * @param {Number} offset + * @param {*} list + * @return {*} + * @example + * + * var list = ['foo', 'bar', 'baz', 'quux']; + * R.nth(1, list); //=> 'bar' + * R.nth(-1, list); //=> 'quux' + * R.nth(-99, list); //=> undefined + * + * R.nth(2, 'abc'); //=> 'c' + * R.nth(3, 'abc'); //=> '' + * @symb R.nth(-1, [a, b, c]) = c + * @symb R.nth(0, [a, b, c]) = a + * @symb R.nth(1, [a, b, c]) = b + */ + + var nth = + /*#__PURE__*/ + _curry2(function nth(offset, list) { + var idx = offset < 0 ? list.length + offset : offset; + return _isString(list) ? list.charAt(idx) : list[idx]; + }); + + /** + * Returns the last element of the given list or string. + * + * @func + * @memberOf R + * @since v0.1.4 + * @category List + * @sig [a] -> a | Undefined + * @sig String -> String + * @param {*} list + * @return {*} + * @see R.init, R.head, R.tail + * @example + * + * R.last(['fi', 'fo', 'fum']); //=> 'fum' + * R.last([]); //=> undefined + * + * R.last('abc'); //=> 'c' + * R.last(''); //=> '' + */ + + var last = + /*#__PURE__*/ + nth(-1); + + /** + * Returns a new list without any consecutively repeating elements. Equality is + * determined by applying the supplied predicate to each pair of consecutive elements. The + * first element in a series of equal elements will be preserved. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category List + * @sig ((a, a) -> Boolean) -> [a] -> [a] + * @param {Function} pred A predicate used to test whether two items are equal. + * @param {Array} list The array to consider. + * @return {Array} `list` without repeating elements. + * @see R.transduce + * @example + * + * var l = [1, -1, 1, 3, 4, -4, -4, -5, 5, 3, 3]; + * R.dropRepeatsWith(R.eqBy(Math.abs), l); //=> [1, 3, 4, -5, 3] + */ + + var dropRepeatsWith = + /*#__PURE__*/ + _curry2( + /*#__PURE__*/ + _dispatchable([], _xdropRepeatsWith, function dropRepeatsWith(pred, list) { + var result = []; + var idx = 1; + var len = list.length; + + if (len !== 0) { + result[0] = list[0]; + + while (idx < len) { + if (!pred(last(result), list[idx])) { + result[result.length] = list[idx]; + } + + idx += 1; + } + } + + return result; + })); + + /** + * Returns a new list without any consecutively repeating elements. + * [`R.equals`](#equals) is used to determine equality. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category List + * @sig [a] -> [a] + * @param {Array} list The array to consider. + * @return {Array} `list` without repeating elements. + * @see R.transduce + * @example + * + * R.dropRepeats([1, 1, 1, 2, 3, 4, 4, 2, 2]); //=> [1, 2, 3, 4, 2] + */ + + var dropRepeats = + /*#__PURE__*/ + _curry1( + /*#__PURE__*/ + _dispatchable([], + /*#__PURE__*/ + _xdropRepeatsWith(equals), + /*#__PURE__*/ + dropRepeatsWith(equals))); + + /** + * Returns a new function much like the supplied one, except that the first two + * arguments' order is reversed. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig ((a, b, c, ...) -> z) -> (b -> a -> c -> ... -> z) + * @param {Function} fn The function to invoke with its first two parameters reversed. + * @return {*} The result of invoking `fn` with its first two parameters' order reversed. + * @example + * + * var mergeThree = (a, b, c) => [].concat(a, b, c); + * + * mergeThree(1, 2, 3); //=> [1, 2, 3] + * + * R.flip(mergeThree)(1, 2, 3); //=> [2, 1, 3] + * @symb R.flip(f)(a, b, c) = f(b, a, c) + */ + + var flip = + /*#__PURE__*/ + _curry1(function flip(fn) { + return curryN(fn.length, function (a, b) { + var args = Array.prototype.slice.call(arguments, 0); + args[0] = b; + args[1] = a; + return fn.apply(this, args); + }); + }); + + /** + * Creates a new object from a list key-value pairs. If a key appears in + * multiple pairs, the rightmost pair is included in the object. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category List + * @sig [[k,v]] -> {k: v} + * @param {Array} pairs An array of two-element arrays that will be the keys and values of the output object. + * @return {Object} The object made by pairing up `keys` and `values`. + * @see R.toPairs, R.pair + * @example + * + * R.fromPairs([['a', 1], ['b', 2], ['c', 3]]); //=> {a: 1, b: 2, c: 3} + */ + + var fromPairs = + /*#__PURE__*/ + _curry1(function fromPairs(pairs) { + var result = {}; + var idx = 0; + + while (idx < pairs.length) { + result[pairs[idx][0]] = pairs[idx][1]; + idx += 1; + } + + return result; + }); + + /** + * Splits a list into sub-lists stored in an object, based on the result of + * calling a String-returning function on each element, and grouping the + * results according to values returned. + * + * Dispatches to the `groupBy` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig (a -> String) -> [a] -> {String: [a]} + * @param {Function} fn Function :: a -> String + * @param {Array} list The array to group + * @return {Object} An object with the output of `fn` for keys, mapped to arrays of elements + * that produced that key when passed to `fn`. + * @see R.transduce + * @example + * + * var byGrade = R.groupBy(function(student) { + * var score = student.score; + * return score < 65 ? 'F' : + * score < 70 ? 'D' : + * score < 80 ? 'C' : + * score < 90 ? 'B' : 'A'; + * }); + * var students = [{name: 'Abby', score: 84}, + * {name: 'Eddy', score: 58}, + * // ... + * {name: 'Jack', score: 69}]; + * byGrade(students); + * // { + * // 'A': [{name: 'Dianne', score: 99}], + * // 'B': [{name: 'Abby', score: 84}] + * // // ..., + * // 'F': [{name: 'Eddy', score: 58}] + * // } + */ + + var groupBy = + /*#__PURE__*/ + _curry2( + /*#__PURE__*/ + _checkForMethod('groupBy', + /*#__PURE__*/ + reduceBy(function (acc, item) { + if (acc == null) { + acc = []; + } + + acc.push(item); + return acc; + }, null))); + + /** + * Returns the first element of the given list or string. In some libraries + * this function is named `first`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> a | Undefined + * @sig String -> String + * @param {Array|String} list + * @return {*} + * @see R.tail, R.init, R.last + * @example + * + * R.head(['fi', 'fo', 'fum']); //=> 'fi' + * R.head([]); //=> undefined + * + * R.head('abc'); //=> 'a' + * R.head(''); //=> '' + */ + + var head = + /*#__PURE__*/ + nth(0); + + function _identity(x) { + return x; + } + + /** + * A function that does nothing but return the parameter supplied to it. Good + * as a default or placeholder function. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig a -> a + * @param {*} x The value to return. + * @return {*} The input value, `x`. + * @example + * + * R.identity(1); //=> 1 + * + * var obj = {}; + * R.identity(obj) === obj; //=> true + * @symb R.identity(a) = a + */ + + var identity = + /*#__PURE__*/ + _curry1(_identity); + + /** + * Increments its argument. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Math + * @sig Number -> Number + * @param {Number} n + * @return {Number} n + 1 + * @see R.dec + * @example + * + * R.inc(42); //=> 43 + */ + + var inc = + /*#__PURE__*/ + add(1); + + /** + * Given a function that generates a key, turns a list of objects into an + * object indexing the objects by the given key. Note that if multiple + * objects generate the same value for the indexing key only the last value + * will be included in the generated object. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category List + * @sig (a -> String) -> [{k: v}] -> {k: {k: v}} + * @param {Function} fn Function :: a -> String + * @param {Array} array The array of objects to index + * @return {Object} An object indexing each array element by the given property. + * @example + * + * var list = [{id: 'xyz', title: 'A'}, {id: 'abc', title: 'B'}]; + * R.indexBy(R.prop('id'), list); + * //=> {abc: {id: 'abc', title: 'B'}, xyz: {id: 'xyz', title: 'A'}} + */ + + var indexBy = + /*#__PURE__*/ + reduceBy(function (acc, elem) { + return elem; + }, null); + + /** + * Returns all but the last element of the given list or string. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category List + * @sig [a] -> [a] + * @sig String -> String + * @param {*} list + * @return {*} + * @see R.last, R.head, R.tail + * @example + * + * R.init([1, 2, 3]); //=> [1, 2] + * R.init([1, 2]); //=> [1] + * R.init([1]); //=> [] + * R.init([]); //=> [] + * + * R.init('abc'); //=> 'ab' + * R.init('ab'); //=> 'a' + * R.init('a'); //=> '' + * R.init(''); //=> '' + */ + + var init = + /*#__PURE__*/ + slice(0, -1); + + var _validateCollection = function (it, TYPE) { + if (!_isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!'); + return it; + }; + + var dP$5 = _objectDp.f; + + + + + + + + + + var fastKey = _meta.fastKey; + + var SIZE = _descriptors ? '_s' : 'size'; + + var getEntry = function (that, key) { + // fast case + var index = fastKey(key); + var entry; + if (index !== 'F') return that._i[index]; + // frozen object case + for (entry = that._f; entry; entry = entry.n) { + if (entry.k == key) return entry; + } + }; + + var _collectionStrong = { + getConstructor: function (wrapper, NAME, IS_MAP, ADDER) { + var C = wrapper(function (that, iterable) { + _anInstance(that, C, NAME, '_i'); + that._t = NAME; // collection type + that._i = _objectCreate(null); // index + that._f = undefined; // first entry + that._l = undefined; // last entry + that[SIZE] = 0; // size + if (iterable != undefined) _forOf(iterable, IS_MAP, that[ADDER], that); + }); + _redefineAll(C.prototype, { + // 23.1.3.1 Map.prototype.clear() + // 23.2.3.2 Set.prototype.clear() + clear: function clear() { + for (var that = _validateCollection(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) { + entry.r = true; + if (entry.p) entry.p = entry.p.n = undefined; + delete data[entry.i]; + } + that._f = that._l = undefined; + that[SIZE] = 0; + }, + // 23.1.3.3 Map.prototype.delete(key) + // 23.2.3.4 Set.prototype.delete(value) + 'delete': function (key) { + var that = _validateCollection(this, NAME); + var entry = getEntry(that, key); + if (entry) { + var next = entry.n; + var prev = entry.p; + delete that._i[entry.i]; + entry.r = true; + if (prev) prev.n = next; + if (next) next.p = prev; + if (that._f == entry) that._f = next; + if (that._l == entry) that._l = prev; + that[SIZE]--; + } return !!entry; + }, + // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined) + // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined) + forEach: function forEach(callbackfn /* , that = undefined */) { + _validateCollection(this, NAME); + var f = _ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); + var entry; + while (entry = entry ? entry.n : this._f) { + f(entry.v, entry.k, this); + // revert to the last existing entry + while (entry && entry.r) entry = entry.p; + } + }, + // 23.1.3.7 Map.prototype.has(key) + // 23.2.3.7 Set.prototype.has(value) + has: function has(key) { + return !!getEntry(_validateCollection(this, NAME), key); + } + }); + if (_descriptors) dP$5(C.prototype, 'size', { + get: function () { + return _validateCollection(this, NAME)[SIZE]; + } + }); + return C; + }, + def: function (that, key, value) { + var entry = getEntry(that, key); + var prev, index; + // change existing entry + if (entry) { + entry.v = value; + // create new entry + } else { + that._l = entry = { + i: index = fastKey(key, true), // <- index + k: key, // <- key + v: value, // <- value + p: prev = that._l, // <- previous entry + n: undefined, // <- next entry + r: false // <- removed + }; + if (!that._f) that._f = entry; + if (prev) prev.n = entry; + that[SIZE]++; + // add to index + if (index !== 'F') that._i[index] = entry; + } return that; + }, + getEntry: getEntry, + setStrong: function (C, NAME, IS_MAP) { + // add .keys, .values, .entries, [@@iterator] + // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11 + _iterDefine(C, NAME, function (iterated, kind) { + this._t = _validateCollection(iterated, NAME); // target + this._k = kind; // kind + this._l = undefined; // previous + }, function () { + var that = this; + var kind = that._k; + var entry = that._l; + // revert to the last existing entry + while (entry && entry.r) entry = entry.p; + // get next entry + if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) { + // or finish the iteration + that._t = undefined; + return _iterStep(1); + } + // return step by kind + if (kind == 'keys') return _iterStep(0, entry.k); + if (kind == 'values') return _iterStep(0, entry.v); + return _iterStep(0, [entry.k, entry.v]); + }, IS_MAP ? 'entries' : 'values', !IS_MAP, true); + + // add [@@species], 23.1.2.2, 23.2.2.2 + _setSpecies(NAME); + } + }; + + var _collection = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) { + var Base = _global[NAME]; + var C = Base; + var ADDER = IS_MAP ? 'set' : 'add'; + var proto = C && C.prototype; + var O = {}; + var fixMethod = function (KEY) { + var fn = proto[KEY]; + _redefine(proto, KEY, + KEY == 'delete' ? function (a) { + return IS_WEAK && !_isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); + } : KEY == 'has' ? function has(a) { + return IS_WEAK && !_isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); + } : KEY == 'get' ? function get(a) { + return IS_WEAK && !_isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a); + } : KEY == 'add' ? function add(a) { fn.call(this, a === 0 ? 0 : a); return this; } + : function set(a, b) { fn.call(this, a === 0 ? 0 : a, b); return this; } + ); + }; + if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !_fails(function () { + new C().entries().next(); + }))) { + // create collection constructor + C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); + _redefineAll(C.prototype, methods); + _meta.NEED = true; + } else { + var instance = new C(); + // early implementations not supports chaining + var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance; + // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false + var THROWS_ON_PRIMITIVES = _fails(function () { instance.has(1); }); + // most early implementations doesn't supports iterables, most modern - not close it correctly + var ACCEPT_ITERABLES = _iterDetect(function (iter) { new C(iter); }); // eslint-disable-line no-new + // for early implementations -0 and +0 not the same + var BUGGY_ZERO = !IS_WEAK && _fails(function () { + // V8 ~ Chromium 42- fails only with 5+ elements + var $instance = new C(); + var index = 5; + while (index--) $instance[ADDER](index, index); + return !$instance.has(-0); + }); + if (!ACCEPT_ITERABLES) { + C = wrapper(function (target, iterable) { + _anInstance(target, C, NAME); + var that = _inheritIfRequired(new Base(), target, C); + if (iterable != undefined) _forOf(iterable, IS_MAP, that[ADDER], that); + return that; + }); + C.prototype = proto; + proto.constructor = C; + } + if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) { + fixMethod('delete'); + fixMethod('has'); + IS_MAP && fixMethod('get'); + } + if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER); + // weak collections should not contains .clear method + if (IS_WEAK && proto.clear) delete proto.clear; + } + + _setToStringTag(C, NAME); + + O[NAME] = C; + _export(_export.G + _export.W + _export.F * (C != Base), O); + + if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP); + + return C; + }; + + var SET = 'Set'; + + // 23.2 Set Objects + var es6_set = _collection(SET, function (get) { + return function Set() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; + }, { + // 23.2.3.1 Set.prototype.add(value) + add: function add(value) { + return _collectionStrong.def(_validateCollection(this, SET), value = value === 0 ? 0 : value, value); + } + }, _collectionStrong); + + var _Set = + /*#__PURE__*/ + function () { + function _Set() { + /* globals Set */ + this._nativeSet = typeof Set === 'function' ? new Set() : null; + this._items = {}; + } // until we figure out why jsdoc chokes on this + // @param item The item to add to the Set + // @returns {boolean} true if the item did not exist prior, otherwise false + // + + + _Set.prototype.add = function (item) { + return !hasOrAdd(item, true, this); + }; // + // @param item The item to check for existence in the Set + // @returns {boolean} true if the item exists in the Set, otherwise false + // + + + _Set.prototype.has = function (item) { + return hasOrAdd(item, false, this); + }; // + // Combines the logic for checking whether an item is a member of the set and + // for adding a new item to the set. + // + // @param item The item to check or add to the Set instance. + // @param shouldAdd If true, the item will be added to the set if it doesn't + // already exist. + // @param set The set instance to check or add to. + // @return {boolean} true if the item already existed, otherwise false. + // + + + return _Set; + }(); + + function hasOrAdd(item, shouldAdd, set) { + var type = _typeof(item); + + var prevSize, newSize; + + switch (type) { + case 'string': + case 'number': + // distinguish between +0 and -0 + if (item === 0 && 1 / item === -Infinity) { + if (set._items['-0']) { + return true; + } else { + if (shouldAdd) { + set._items['-0'] = true; + } + + return false; + } + } // these types can all utilise the native Set + + + if (set._nativeSet !== null) { + if (shouldAdd) { + prevSize = set._nativeSet.size; + + set._nativeSet.add(item); + + newSize = set._nativeSet.size; + return newSize === prevSize; + } else { + return set._nativeSet.has(item); + } + } else { + if (!(type in set._items)) { + if (shouldAdd) { + set._items[type] = {}; + set._items[type][item] = true; + } + + return false; + } else if (item in set._items[type]) { + return true; + } else { + if (shouldAdd) { + set._items[type][item] = true; + } + + return false; + } + } + + case 'boolean': + // set._items['boolean'] holds a two element array + // representing [ falseExists, trueExists ] + if (type in set._items) { + var bIdx = item ? 1 : 0; + + if (set._items[type][bIdx]) { + return true; + } else { + if (shouldAdd) { + set._items[type][bIdx] = true; + } + + return false; + } + } else { + if (shouldAdd) { + set._items[type] = item ? [false, true] : [true, false]; + } + + return false; + } + + case 'function': + // compare functions for reference equality + if (set._nativeSet !== null) { + if (shouldAdd) { + prevSize = set._nativeSet.size; + + set._nativeSet.add(item); + + newSize = set._nativeSet.size; + return newSize === prevSize; + } else { + return set._nativeSet.has(item); + } + } else { + if (!(type in set._items)) { + if (shouldAdd) { + set._items[type] = [item]; + } + + return false; + } + + if (!_contains(item, set._items[type])) { + if (shouldAdd) { + set._items[type].push(item); + } + + return false; + } + + return true; + } + + case 'undefined': + if (set._items[type]) { + return true; + } else { + if (shouldAdd) { + set._items[type] = true; + } + + return false; + } + + case 'object': + if (item === null) { + if (!set._items['null']) { + if (shouldAdd) { + set._items['null'] = true; + } + + return false; + } + + return true; + } + + /* falls through */ + + default: + // reduce the search size of heterogeneous sets by creating buckets + // for each type. + type = Object.prototype.toString.call(item); + + if (!(type in set._items)) { + if (shouldAdd) { + set._items[type] = [item]; + } + + return false; + } // scan through all previously applied items + + + if (!_contains(item, set._items[type])) { + if (shouldAdd) { + set._items[type].push(item); + } + + return false; + } + + return true; + } + } // A simple Set type that honours R.equals semantics + + /** + * Returns a new list containing only one copy of each element in the original + * list, based upon the value returned by applying the supplied function to + * each list element. Prefers the first item if the supplied function produces + * the same value on two items. [`R.equals`](#equals) is used for comparison. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category List + * @sig (a -> b) -> [a] -> [a] + * @param {Function} fn A function used to produce a value to use during comparisons. + * @param {Array} list The array to consider. + * @return {Array} The list of unique items. + * @example + * + * R.uniqBy(Math.abs, [-1, -5, 2, 10, 1, 2]); //=> [-1, -5, 2, 10] + */ + + var uniqBy = + /*#__PURE__*/ + _curry2(function uniqBy(fn, list) { + var set = new _Set(); + var result = []; + var idx = 0; + var appliedItem, item; + + while (idx < list.length) { + item = list[idx]; + appliedItem = fn(item); + + if (set.add(appliedItem)) { + result.push(item); + } + + idx += 1; + } + + return result; + }); + + /** + * Returns a new list containing only one copy of each element in the original + * list. [`R.equals`](#equals) is used to determine equality. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [a] + * @param {Array} list The array to consider. + * @return {Array} The list of unique items. + * @example + * + * R.uniq([1, 1, 2, 1]); //=> [1, 2] + * R.uniq([1, '1']); //=> [1, '1'] + * R.uniq([[42], [42]]); //=> [[42]] + */ + + var uniq = + /*#__PURE__*/ + uniqBy(identity); + + /** + * Turns a named method with a specified arity into a function that can be + * called directly supplied with arguments and a target object. + * + * The returned function is curried and accepts `arity + 1` parameters where + * the final parameter is the target object. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig Number -> String -> (a -> b -> ... -> n -> Object -> *) + * @param {Number} arity Number of arguments the returned function should take + * before the target object. + * @param {String} method Name of the method to call. + * @return {Function} A new curried function. + * @see R.construct + * @example + * + * var sliceFrom = R.invoker(1, 'slice'); + * sliceFrom(6, 'abcdefghijklm'); //=> 'ghijklm' + * var sliceFrom6 = R.invoker(2, 'slice')(6); + * sliceFrom6(8, 'abcdefghijklm'); //=> 'gh' + * @symb R.invoker(0, 'method')(o) = o['method']() + * @symb R.invoker(1, 'method')(a, o) = o['method'](a) + * @symb R.invoker(2, 'method')(a, b, o) = o['method'](a, b) + */ + + var invoker = + /*#__PURE__*/ + _curry2(function invoker(arity, method) { + return curryN(arity + 1, function () { + var target = arguments[arity]; + + if (target != null && _isFunction(target[method])) { + return target[method].apply(target, Array.prototype.slice.call(arguments, 0, arity)); + } + + throw new TypeError(toString$3(target) + ' does not have a method named "' + method + '"'); + }); + }); + + /** + * Returns a string made by inserting the `separator` between each element and + * concatenating all the elements into a single string. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig String -> [a] -> String + * @param {Number|String} separator The string used to separate the elements. + * @param {Array} xs The elements to join into a string. + * @return {String} str The string made by concatenating `xs` with `separator`. + * @see R.split + * @example + * + * var spacer = R.join(' '); + * spacer(['a', 2, 3.4]); //=> 'a 2 3.4' + * R.join('|', [1, 2, 3]); //=> '1|2|3' + */ + + var join = + /*#__PURE__*/ + invoker(1, 'join'); + + /** + * juxt applies a list of functions to a list of values. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category Function + * @sig [(a, b, ..., m) -> n] -> ((a, b, ..., m) -> [n]) + * @param {Array} fns An array of functions + * @return {Function} A function that returns a list of values after applying each of the original `fns` to its parameters. + * @see R.applySpec + * @example + * + * var getRange = R.juxt([Math.min, Math.max]); + * getRange(3, 4, 9, -3); //=> [-3, 9] + * @symb R.juxt([f, g, h])(a, b) = [f(a, b), g(a, b), h(a, b)] + */ + + var juxt = + /*#__PURE__*/ + _curry1(function juxt(fns) { + return converge(function () { + return Array.prototype.slice.call(arguments, 0); + }, fns); + }); + + var $native$1 = [].lastIndexOf; + var NEGATIVE_ZERO$1 = !!$native$1 && 1 / [1].lastIndexOf(1, -0) < 0; + + _export(_export.P + _export.F * (NEGATIVE_ZERO$1 || !_strictMethod($native$1)), 'Array', { + // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex]) + lastIndexOf: function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { + // convert -0 to +0 + if (NEGATIVE_ZERO$1) return $native$1.apply(this, arguments) || 0; + var O = _toIobject(this); + var length = _toLength(O.length); + var index = length - 1; + if (arguments.length > 1) index = Math.min(index, _toInteger(arguments[1])); + if (index < 0) index = length + index; + for (;index >= 0; index--) if (index in O) if (O[index] === searchElement) return index || 0; + return -1; + } + }); + + /** + * Takes a function and two values, and returns whichever value produces the + * larger result when passed to the provided function. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Relation + * @sig Ord b => (a -> b) -> a -> a -> a + * @param {Function} f + * @param {*} a + * @param {*} b + * @return {*} + * @see R.max, R.minBy + * @example + * + * // square :: Number -> Number + * var square = n => n * n; + * + * R.maxBy(square, -3, 2); //=> -3 + * + * R.reduce(R.maxBy(square), 0, [3, -5, 4, 1, -2]); //=> -5 + * R.reduce(R.maxBy(square), 0, []); //=> 0 + */ + + var maxBy = + /*#__PURE__*/ + _curry3(function maxBy(f, a, b) { + return f(b) > f(a) ? b : a; + }); + + /** + * Adds together all the elements of a list. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Math + * @sig [Number] -> Number + * @param {Array} list An array of numbers + * @return {Number} The sum of all the numbers in the list. + * @see R.reduce + * @example + * + * R.sum([2,4,6,8,100,1]); //=> 121 + */ + + var sum = + /*#__PURE__*/ + reduce(add, 0); + + /** + * A customisable version of [`R.memoize`](#memoize). `memoizeWith` takes an + * additional function that will be applied to a given argument set and used to + * create the cache key under which the results of the function to be memoized + * will be stored. Care must be taken when implementing key generation to avoid + * clashes that may overwrite previous entries erroneously. + * + * + * @func + * @memberOf R + * @since v0.24.0 + * @category Function + * @sig (*... -> String) -> (*... -> a) -> (*... -> a) + * @param {Function} fn The function to generate the cache key. + * @param {Function} fn The function to memoize. + * @return {Function} Memoized version of `fn`. + * @see R.memoize + * @example + * + * let count = 0; + * const factorial = R.memoizeWith(R.identity, n => { + * count += 1; + * return R.product(R.range(1, n + 1)); + * }); + * factorial(5); //=> 120 + * factorial(5); //=> 120 + * factorial(5); //=> 120 + * count; //=> 1 + */ + + var memoizeWith = + /*#__PURE__*/ + _curry2(function memoizeWith(mFn, fn) { + var cache = {}; + return _arity(fn.length, function () { + var key = mFn.apply(this, arguments); + + if (!_has$1(key, cache)) { + cache[key] = fn.apply(this, arguments); + } + + return cache[key]; + }); + }); + + /** + * Creates a new function that, when invoked, caches the result of calling `fn` + * for a given argument set and returns the result. Subsequent calls to the + * memoized `fn` with the same argument set will not result in an additional + * call to `fn`; instead, the cached result for that set of arguments will be + * returned. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig (*... -> a) -> (*... -> a) + * @param {Function} fn The function to memoize. + * @return {Function} Memoized version of `fn`. + * @see R.memoizeWith + * @deprecated since v0.25.0 + * @example + * + * let count = 0; + * const factorial = R.memoize(n => { + * count += 1; + * return R.product(R.range(1, n + 1)); + * }); + * factorial(5); //=> 120 + * factorial(5); //=> 120 + * factorial(5); //=> 120 + * count; //=> 1 + */ + + var memoize = + /*#__PURE__*/ + memoizeWith(function () { + return toString$3(arguments); + }); + + /** + * Takes a function and two values, and returns whichever value produces the + * smaller result when passed to the provided function. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Relation + * @sig Ord b => (a -> b) -> a -> a -> a + * @param {Function} f + * @param {*} a + * @param {*} b + * @return {*} + * @see R.min, R.maxBy + * @example + * + * // square :: Number -> Number + * var square = n => n * n; + * + * R.minBy(square, -3, 2); //=> 2 + * + * R.reduce(R.minBy(square), Infinity, [3, -5, 4, 1, -2]); //=> 1 + * R.reduce(R.minBy(square), Infinity, []); //=> Infinity + */ + + var minBy = + /*#__PURE__*/ + _curry3(function minBy(f, a, b) { + return f(b) < f(a) ? b : a; + }); + + /** + * Multiplies two numbers. Equivalent to `a * b` but curried. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Math + * @sig Number -> Number -> Number + * @param {Number} a The first value. + * @param {Number} b The second value. + * @return {Number} The result of `a * b`. + * @see R.divide + * @example + * + * var double = R.multiply(2); + * var triple = R.multiply(3); + * double(3); //=> 6 + * triple(4); //=> 12 + * R.multiply(2, 5); //=> 10 + */ + + var multiply = + /*#__PURE__*/ + _curry2(function multiply(a, b) { + return a * b; + }); + + function _createPartialApplicator(concat) { + return _curry2(function (fn, args) { + return _arity(Math.max(0, fn.length - args.length), function () { + return fn.apply(this, concat(args, arguments)); + }); + }); + } + + /** + * Takes a function `f` and a list of arguments, and returns a function `g`. + * When applied, `g` returns the result of applying `f` to the arguments + * provided to `g` followed by the arguments provided initially. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category Function + * @sig ((a, b, c, ..., n) -> x) -> [d, e, f, ..., n] -> ((a, b, c, ...) -> x) + * @param {Function} f + * @param {Array} args + * @return {Function} + * @see R.partial + * @example + * + * var greet = (salutation, title, firstName, lastName) => + * salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!'; + * + * var greetMsJaneJones = R.partialRight(greet, ['Ms.', 'Jane', 'Jones']); + * + * greetMsJaneJones('Hello'); //=> 'Hello, Ms. Jane Jones!' + * @symb R.partialRight(f, [a, b])(c, d) = f(c, d, a, b) + */ + + var partialRight = + /*#__PURE__*/ + _createPartialApplicator( + /*#__PURE__*/ + flip(_concat)); + + /** + * Takes a predicate and a list or other `Filterable` object and returns the + * pair of filterable objects of the same type of elements which do and do not + * satisfy, the predicate, respectively. Filterable objects include plain objects or any object + * that has a filter method such as `Array`. + * + * @func + * @memberOf R + * @since v0.1.4 + * @category List + * @sig Filterable f => (a -> Boolean) -> f a -> [f a, f a] + * @param {Function} pred A predicate to determine which side the element belongs to. + * @param {Array} filterable the list (or other filterable) to partition. + * @return {Array} An array, containing first the subset of elements that satisfy the + * predicate, and second the subset of elements that do not satisfy. + * @see R.filter, R.reject + * @example + * + * R.partition(R.contains('s'), ['sss', 'ttt', 'foo', 'bars']); + * // => [ [ 'sss', 'bars' ], [ 'ttt', 'foo' ] ] + * + * R.partition(R.contains('s'), { a: 'sss', b: 'ttt', foo: 'bars' }); + * // => [ { a: 'sss', foo: 'bars' }, { b: 'ttt' } ] + */ + + var partition = + /*#__PURE__*/ + juxt([filter, reject]); + + /** + * Similar to `pick` except that this one includes a `key: undefined` pair for + * properties that don't exist. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig [k] -> {k: v} -> {k: v} + * @param {Array} names an array of String property names to copy onto a new object + * @param {Object} obj The object to copy from + * @return {Object} A new object with only properties from `names` on it. + * @see R.pick + * @example + * + * R.pickAll(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4} + * R.pickAll(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, e: undefined, f: undefined} + */ + + var pickAll = + /*#__PURE__*/ + _curry2(function pickAll(names, obj) { + var result = {}; + var idx = 0; + var len = names.length; + + while (idx < len) { + var name = names[idx]; + result[name] = obj[name]; + idx += 1; + } + + return result; + }); + + /** + * Multiplies together all the elements of a list. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Math + * @sig [Number] -> Number + * @param {Array} list An array of numbers + * @return {Number} The product of all the numbers in the list. + * @see R.reduce + * @example + * + * R.product([2,4,6,8,100,1]); //=> 38400 + */ + + var product = + /*#__PURE__*/ + reduce(multiply, 1); + + /** + * Accepts a function `fn` and a list of transformer functions and returns a + * new curried function. When the new function is invoked, it calls the + * function `fn` with parameters consisting of the result of calling each + * supplied handler on successive arguments to the new function. + * + * If more arguments are passed to the returned function than transformer + * functions, those arguments are passed directly to `fn` as additional + * parameters. If you expect additional arguments that don't need to be + * transformed, although you can ignore them, it's best to pass an identity + * function so that the new function reports the correct arity. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig ((x1, x2, ...) -> z) -> [(a -> x1), (b -> x2), ...] -> (a -> b -> ... -> z) + * @param {Function} fn The function to wrap. + * @param {Array} transformers A list of transformer functions + * @return {Function} The wrapped function. + * @see R.converge + * @example + * + * R.useWith(Math.pow, [R.identity, R.identity])(3, 4); //=> 81 + * R.useWith(Math.pow, [R.identity, R.identity])(3)(4); //=> 81 + * R.useWith(Math.pow, [R.dec, R.inc])(3, 4); //=> 32 + * R.useWith(Math.pow, [R.dec, R.inc])(3)(4); //=> 32 + * @symb R.useWith(f, [g, h])(a, b) = f(g(a), h(b)) + */ + + var useWith = + /*#__PURE__*/ + _curry2(function useWith(fn, transformers) { + return curryN(transformers.length, function () { + var args = []; + var idx = 0; + + while (idx < transformers.length) { + args.push(transformers[idx].call(this, arguments[idx])); + idx += 1; + } + + return fn.apply(this, args.concat(Array.prototype.slice.call(arguments, transformers.length))); + }); + }); + + /** + * Reasonable analog to SQL `select` statement. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @category Relation + * @sig [k] -> [{k: v}] -> [{k: v}] + * @param {Array} props The property names to project + * @param {Array} objs The objects to query + * @return {Array} An array of objects with just the `props` properties. + * @example + * + * var abby = {name: 'Abby', age: 7, hair: 'blond', grade: 2}; + * var fred = {name: 'Fred', age: 12, hair: 'brown', grade: 7}; + * var kids = [abby, fred]; + * R.project(['name', 'grade'], kids); //=> [{name: 'Abby', grade: 2}, {name: 'Fred', grade: 7}] + */ + + var project = + /*#__PURE__*/ + useWith(_map, [pickAll, identity]); // passing `identity` gives correct arity + + /** + * Splits a string into an array of strings based on the given + * separator. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category String + * @sig (String | RegExp) -> String -> [String] + * @param {String|RegExp} sep The pattern. + * @param {String} str The string to separate into an array. + * @return {Array} The array of strings from `str` separated by `str`. + * @see R.join + * @example + * + * var pathComponents = R.split('/'); + * R.tail(pathComponents('/usr/local/bin/node')); //=> ['usr', 'local', 'bin', 'node'] + * + * R.split('.', 'a.b.c.xyz.d'); //=> ['a', 'b', 'c', 'xyz', 'd'] + */ + + var split = + /*#__PURE__*/ + invoker(1, 'split'); + + /** + * The lower case version of a string. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category String + * @sig String -> String + * @param {String} str The string to lower case. + * @return {String} The lower case version of `str`. + * @see R.toUpper + * @example + * + * R.toLower('XYZ'); //=> 'xyz' + */ + + var toLower = + /*#__PURE__*/ + invoker(0, 'toLowerCase'); + + /** + * Converts an object into an array of key, value arrays. Only the object's + * own properties are used. + * Note that the order of the output array is not guaranteed to be consistent + * across different JS platforms. + * + * @func + * @memberOf R + * @since v0.4.0 + * @category Object + * @sig {String: *} -> [[String,*]] + * @param {Object} obj The object to extract from + * @return {Array} An array of key, value arrays from the object's own properties. + * @see R.fromPairs + * @example + * + * R.toPairs({a: 1, b: 2, c: 3}); //=> [['a', 1], ['b', 2], ['c', 3]] + */ + + var toPairs = + /*#__PURE__*/ + _curry1(function toPairs(obj) { + var pairs = []; + + for (var prop in obj) { + if (_has$1(prop, obj)) { + pairs[pairs.length] = [prop, obj[prop]]; + } + } + + return pairs; + }); + + /** + * The upper case version of a string. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category String + * @sig String -> String + * @param {String} str The string to upper case. + * @return {String} The upper case version of `str`. + * @see R.toLower + * @example + * + * R.toUpper('abc'); //=> 'ABC' + */ + + var toUpper = + /*#__PURE__*/ + invoker(0, 'toUpperCase'); + + /** + * Initializes a transducer using supplied iterator function. Returns a single + * item by iterating through the list, successively calling the transformed + * iterator function and passing it an accumulator value and the current value + * from the array, and then passing the result to the next call. + * + * The iterator function receives two values: *(acc, value)*. It will be + * wrapped as a transformer to initialize the transducer. A transformer can be + * passed directly in place of an iterator function. In both cases, iteration + * may be stopped early with the [`R.reduced`](#reduced) function. + * + * A transducer is a function that accepts a transformer and returns a + * transformer and can be composed directly. + * + * A transformer is an an object that provides a 2-arity reducing iterator + * function, step, 0-arity initial value function, init, and 1-arity result + * extraction function, result. The step function is used as the iterator + * function in reduce. The result function is used to convert the final + * accumulator into the return type and in most cases is + * [`R.identity`](#identity). The init function can be used to provide an + * initial accumulator, but is ignored by transduce. + * + * The iteration is performed with [`R.reduce`](#reduce) after initializing the transducer. + * + * @func + * @memberOf R + * @since v0.12.0 + * @category List + * @sig (c -> c) -> ((a, b) -> a) -> a -> [b] -> a + * @param {Function} xf The transducer function. Receives a transformer and returns a transformer. + * @param {Function} fn The iterator function. Receives two values, the accumulator and the + * current element from the array. Wrapped as transformer, if necessary, and used to + * initialize the transducer + * @param {*} acc The initial accumulator value. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.reduce, R.reduced, R.into + * @example + * + * var numbers = [1, 2, 3, 4]; + * var transducer = R.compose(R.map(R.add(1)), R.take(2)); + * R.transduce(transducer, R.flip(R.append), [], numbers); //=> [2, 3] + * + * var isOdd = (x) => x % 2 === 1; + * var firstOddTransducer = R.compose(R.filter(isOdd), R.take(1)); + * R.transduce(firstOddTransducer, R.flip(R.append), [], R.range(0, 100)); //=> [1] + */ + + var transduce = + /*#__PURE__*/ + curryN(4, function transduce(xf, fn, acc, list) { + return _reduce(xf(typeof fn === 'function' ? _xwrap(fn) : fn), acc, list); + }); + + // 21.1.3.25 String.prototype.trim() + _stringTrim('trim', function ($trim) { + return function trim() { + return $trim(this, 3); + }; + }); + + var ws = "\t\n\x0B\f\r \xA0\u1680\u180E\u2000\u2001\u2002\u2003" + "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" + "\u2029\uFEFF"; + var zeroWidth = "\u200B"; + var hasProtoTrim = typeof String.prototype.trim === 'function'; + /** + * Removes (strips) whitespace from both ends of the string. + * + * @func + * @memberOf R + * @since v0.6.0 + * @category String + * @sig String -> String + * @param {String} str The string to trim. + * @return {String} Trimmed version of `str`. + * @example + * + * R.trim(' xyz '); //=> 'xyz' + * R.map(R.trim, R.split(',', 'x, y, z')); //=> ['x', 'y', 'z'] + */ + + var _trim = !hasProtoTrim || + /*#__PURE__*/ + ws.trim() || ! + /*#__PURE__*/ + zeroWidth.trim() ? function trim(str) { + var beginRx = new RegExp('^[' + ws + '][' + ws + ']*'); + var endRx = new RegExp('[' + ws + '][' + ws + ']*$'); + return str.replace(beginRx, '').replace(endRx, ''); + } : function trim(str) { + return str.trim(); + }; + + /** + * Combines two lists into a set (i.e. no duplicates) composed of the elements + * of each list. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig [*] -> [*] -> [*] + * @param {Array} as The first list. + * @param {Array} bs The second list. + * @return {Array} The first and second lists concatenated, with + * duplicates removed. + * @example + * + * R.union([1, 2, 3], [2, 3, 4]); //=> [1, 2, 3, 4] + */ + + var union = + /*#__PURE__*/ + _curry2( + /*#__PURE__*/ + compose(uniq, _concat)); + + /** + * Shorthand for `R.chain(R.identity)`, which removes one level of nesting from + * any [Chain](https://github.com/fantasyland/fantasy-land#chain). + * + * @func + * @memberOf R + * @since v0.3.0 + * @category List + * @sig Chain c => c (c a) -> c a + * @param {*} list + * @return {*} + * @see R.flatten, R.chain + * @example + * + * R.unnest([1, [2], [[3]]]); //=> [1, 2, [3]] + * R.unnest([[1, 2], [3, 4], [5, 6]]); //=> [1, 2, 3, 4, 5, 6] + */ + + var unnest = + /*#__PURE__*/ + chain(_identity); + + // 20.3.3.1 / 15.9.4.4 Date.now() + + + _export(_export.S, 'Date', { now: function () { return new Date().getTime(); } }); + + // 19.1.2.12 Object.isFrozen(O) + + + _objectSap('isFrozen', function ($isFrozen) { + return function isFrozen(it) { + return _isObject(it) ? $isFrozen ? $isFrozen(it) : false : true; + }; + }); + + var $some = _arrayMethods(3); + + _export(_export.P + _export.F * !_strictMethod([].some, true), 'Array', { + // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg]) + some: function some(callbackfn /* , thisArg */) { + return $some(this, callbackfn, arguments[1]); + } + }); + + var moment = createCommonjsModule(function (module, exports) { + + (function (global, factory) { + module.exports = factory(); + })(commonjsGlobal, function () { + + var hookCallback; + + function hooks() { + return hookCallback.apply(null, arguments); + } // This is done to register the method called with moment() + // without creating circular dependencies. + + + function setHookCallback(callback) { + hookCallback = callback; + } + + function isArray(input) { + return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; + } + + function isObject(input) { + // IE8 will treat undefined and null as object if it wasn't for + // input != null + return input != null && Object.prototype.toString.call(input) === '[object Object]'; + } + + function isObjectEmpty(obj) { + if (Object.getOwnPropertyNames) { + return Object.getOwnPropertyNames(obj).length === 0; + } else { + var k; + + for (k in obj) { + if (obj.hasOwnProperty(k)) { + return false; + } + } + + return true; + } + } + + function isUndefined(input) { + return input === void 0; + } + + function isNumber(input) { + return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]'; + } + + function isDate(input) { + return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; + } + + function map(arr, fn) { + var res = [], + i; + + for (i = 0; i < arr.length; ++i) { + res.push(fn(arr[i], i)); + } + + return res; + } + + function hasOwnProp(a, b) { + return Object.prototype.hasOwnProperty.call(a, b); + } + + function extend(a, b) { + for (var i in b) { + if (hasOwnProp(b, i)) { + a[i] = b[i]; + } + } + + if (hasOwnProp(b, 'toString')) { + a.toString = b.toString; + } + + if (hasOwnProp(b, 'valueOf')) { + a.valueOf = b.valueOf; + } + + return a; + } + + function createUTC(input, format, locale, strict) { + return createLocalOrUTC(input, format, locale, strict, true).utc(); + } + + function defaultParsingFlags() { + // We need to deep clone this object. + return { + empty: false, + unusedTokens: [], + unusedInput: [], + overflow: -2, + charsLeftOver: 0, + nullInput: false, + invalidMonth: null, + invalidFormat: false, + userInvalidated: false, + iso: false, + parsedDateParts: [], + meridiem: null, + rfc2822: false, + weekdayMismatch: false + }; + } + + function getParsingFlags(m) { + if (m._pf == null) { + m._pf = defaultParsingFlags(); + } + + return m._pf; + } + + var some; + + if (Array.prototype.some) { + some = Array.prototype.some; + } else { + some = function some(fun) { + var t = Object(this); + var len = t.length >>> 0; + + for (var i = 0; i < len; i++) { + if (i in t && fun.call(this, t[i], i, t)) { + return true; + } + } + + return false; + }; + } + + function isValid(m) { + if (m._isValid == null) { + var flags = getParsingFlags(m); + var parsedParts = some.call(flags.parsedDateParts, function (i) { + return i != null; + }); + var isNowValid = !isNaN(m._d.getTime()) && flags.overflow < 0 && !flags.empty && !flags.invalidMonth && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || flags.meridiem && parsedParts); + + if (m._strict) { + isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === undefined; + } + + if (Object.isFrozen == null || !Object.isFrozen(m)) { + m._isValid = isNowValid; + } else { + return isNowValid; + } + } + + return m._isValid; + } + + function createInvalid(flags) { + var m = createUTC(NaN); + + if (flags != null) { + extend(getParsingFlags(m), flags); + } else { + getParsingFlags(m).userInvalidated = true; + } + + return m; + } // Plugins that add properties should also add the key here (null value), + // so we can properly clone ourselves. + + + var momentProperties = hooks.momentProperties = []; + + function copyConfig(to, from) { + var i, prop, val; + + if (!isUndefined(from._isAMomentObject)) { + to._isAMomentObject = from._isAMomentObject; + } + + if (!isUndefined(from._i)) { + to._i = from._i; + } + + if (!isUndefined(from._f)) { + to._f = from._f; + } + + if (!isUndefined(from._l)) { + to._l = from._l; + } + + if (!isUndefined(from._strict)) { + to._strict = from._strict; + } + + if (!isUndefined(from._tzm)) { + to._tzm = from._tzm; + } + + if (!isUndefined(from._isUTC)) { + to._isUTC = from._isUTC; + } + + if (!isUndefined(from._offset)) { + to._offset = from._offset; + } + + if (!isUndefined(from._pf)) { + to._pf = getParsingFlags(from); + } + + if (!isUndefined(from._locale)) { + to._locale = from._locale; + } + + if (momentProperties.length > 0) { + for (i = 0; i < momentProperties.length; i++) { + prop = momentProperties[i]; + val = from[prop]; + + if (!isUndefined(val)) { + to[prop] = val; + } + } + } + + return to; + } + + var updateInProgress = false; // Moment prototype object + + function Moment(config) { + copyConfig(this, config); + this._d = new Date(config._d != null ? config._d.getTime() : NaN); + + if (!this.isValid()) { + this._d = new Date(NaN); + } // Prevent infinite loop in case updateOffset creates new moment + // objects. + + + if (updateInProgress === false) { + updateInProgress = true; + hooks.updateOffset(this); + updateInProgress = false; + } + } + + function isMoment(obj) { + return obj instanceof Moment || obj != null && obj._isAMomentObject != null; + } - function absFloor(number) { - if (number < 0) { - // -0 -> 0 - return Math.ceil(number) || 0; - } else { - return Math.floor(number); - } - } - - function toInt(argumentForCoercion) { - var coercedNumber = +argumentForCoercion, - value = 0; + function absFloor(number) { + if (number < 0) { + // -0 -> 0 + return Math.ceil(number) || 0; + } else { + return Math.floor(number); + } + } + + function toInt(argumentForCoercion) { + var coercedNumber = +argumentForCoercion, + value = 0; - if (coercedNumber !== 0 && isFinite(coercedNumber)) { - value = absFloor(coercedNumber); - } + if (coercedNumber !== 0 && isFinite(coercedNumber)) { + value = absFloor(coercedNumber); + } - return value; - } // compare two arrays, return the number of differences - - - function compareArrays(array1, array2, dontConvert) { - var len = Math.min(array1.length, array2.length), - lengthDiff = Math.abs(array1.length - array2.length), - diffs = 0, - i; - - for (i = 0; i < len; i++) { - if (dontConvert && array1[i] !== array2[i] || !dontConvert && toInt(array1[i]) !== toInt(array2[i])) { - diffs++; - } - } - - return diffs + lengthDiff; - } - - function warn(msg) { - if (hooks.suppressDeprecationWarnings === false && typeof console !== 'undefined' && console.warn) { - console.warn('Deprecation warning: ' + msg); - } - } - - function deprecate(msg, fn) { - var firstTime = true; - return extend(function () { - if (hooks.deprecationHandler != null) { - hooks.deprecationHandler(null, msg); - } - - if (firstTime) { - var args = []; - var arg; - - for (var i = 0; i < arguments.length; i++) { - arg = ''; - - if (_typeof(arguments[i]) === 'object') { - arg += '\n[' + i + '] '; - - for (var key in arguments[0]) { - arg += key + ': ' + arguments[0][key] + ', '; - } - - arg = arg.slice(0, -2); // Remove trailing comma and space - } else { - arg = arguments[i]; - } - - args.push(arg); - } - - warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + new Error().stack); - firstTime = false; - } - - return fn.apply(this, arguments); - }, fn); - } - - var deprecations = {}; - - function deprecateSimple(name, msg) { - if (hooks.deprecationHandler != null) { - hooks.deprecationHandler(name, msg); - } - - if (!deprecations[name]) { - warn(msg); - deprecations[name] = true; - } - } - - hooks.suppressDeprecationWarnings = false; - hooks.deprecationHandler = null; - - function isFunction(input) { - return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; - } - - function set(config) { - var prop, i; - - for (i in config) { - prop = config[i]; - - if (isFunction(prop)) { - this[i] = prop; - } else { - this['_' + i] = prop; - } - } - - this._config = config; // Lenient ordinal parsing accepts just a number in addition to - // number + (possibly) stuff coming from _dayOfMonthOrdinalParse. - // TODO: Remove "ordinalParse" fallback in next major release. - - this._dayOfMonthOrdinalParseLenient = new RegExp((this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + '|' + /\d{1,2}/.source); - } - - function mergeConfigs(parentConfig, childConfig) { - var res = extend({}, parentConfig), - prop; - - for (prop in childConfig) { - if (hasOwnProp(childConfig, prop)) { - if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { - res[prop] = {}; - extend(res[prop], parentConfig[prop]); - extend(res[prop], childConfig[prop]); - } else if (childConfig[prop] != null) { - res[prop] = childConfig[prop]; - } else { - delete res[prop]; - } - } - } - - for (prop in parentConfig) { - if (hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject(parentConfig[prop])) { - // make sure changes to properties don't modify parent config - res[prop] = extend({}, res[prop]); - } - } - - return res; - } - - function Locale(config) { - if (config != null) { - this.set(config); - } - } - - var keys; - - if (Object.keys) { - keys = Object.keys; - } else { - keys = function keys(obj) { - var i, - res = []; - - for (i in obj) { - if (hasOwnProp(obj, i)) { - res.push(i); - } - } - - return res; - }; - } - - var defaultCalendar = { - sameDay: '[Today at] LT', - nextDay: '[Tomorrow at] LT', - nextWeek: 'dddd [at] LT', - lastDay: '[Yesterday at] LT', - lastWeek: '[Last] dddd [at] LT', - sameElse: 'L' - }; - - function calendar(key, mom, now) { - var output = this._calendar[key] || this._calendar['sameElse']; - return isFunction(output) ? output.call(mom, now) : output; - } - - var defaultLongDateFormat = { - LTS: 'h:mm:ss A', - LT: 'h:mm A', - L: 'MM/DD/YYYY', - LL: 'MMMM D, YYYY', - LLL: 'MMMM D, YYYY h:mm A', - LLLL: 'dddd, MMMM D, YYYY h:mm A' - }; - - function longDateFormat(key) { - var format = this._longDateFormat[key], - formatUpper = this._longDateFormat[key.toUpperCase()]; - - if (format || !formatUpper) { - return format; - } - - this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) { - return val.slice(1); - }); - return this._longDateFormat[key]; - } - - var defaultInvalidDate = 'Invalid date'; - - function invalidDate() { - return this._invalidDate; - } - - var defaultOrdinal = '%d'; - var defaultDayOfMonthOrdinalParse = /\d{1,2}/; - - function ordinal(number) { - return this._ordinal.replace('%d', number); - } - - var defaultRelativeTime = { - future: 'in %s', - past: '%s ago', - s: 'a few seconds', - ss: '%d seconds', - m: 'a minute', - mm: '%d minutes', - h: 'an hour', - hh: '%d hours', - d: 'a day', - dd: '%d days', - M: 'a month', - MM: '%d months', - y: 'a year', - yy: '%d years' - }; - - function relativeTime(number, withoutSuffix, string, isFuture) { - var output = this._relativeTime[string]; - return isFunction(output) ? output(number, withoutSuffix, string, isFuture) : output.replace(/%d/i, number); - } - - function pastFuture(diff, output) { - var format = this._relativeTime[diff > 0 ? 'future' : 'past']; - return isFunction(format) ? format(output) : format.replace(/%s/i, output); - } - - var aliases = {}; - - function addUnitAlias(unit, shorthand) { - var lowerCase = unit.toLowerCase(); - aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; - } - - function normalizeUnits(units) { - return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; - } - - function normalizeObjectUnits(inputObject) { - var normalizedInput = {}, - normalizedProp, - prop; - - for (prop in inputObject) { - if (hasOwnProp(inputObject, prop)) { - normalizedProp = normalizeUnits(prop); - - if (normalizedProp) { - normalizedInput[normalizedProp] = inputObject[prop]; - } - } - } - - return normalizedInput; - } - - var priorities = {}; - - function addUnitPriority(unit, priority) { - priorities[unit] = priority; - } - - function getPrioritizedUnits(unitsObj) { - var units = []; - - for (var u in unitsObj) { - units.push({ - unit: u, - priority: priorities[u] - }); - } - - units.sort(function (a, b) { - return a.priority - b.priority; - }); - return units; - } - - function zeroFill(number, targetLength, forceSign) { - var absNumber = '' + Math.abs(number), - zerosToFill = targetLength - absNumber.length, - sign = number >= 0; - return (sign ? forceSign ? '+' : '' : '-') + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; - } - - var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g; - var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g; - var formatFunctions = {}; - var formatTokenFunctions = {}; // token: 'M' - // padded: ['MM', 2] - // ordinal: 'Mo' - // callback: function () { this.month() + 1 } - - function addFormatToken(token, padded, ordinal, callback) { - var func = callback; - - if (typeof callback === 'string') { - func = function func() { - return this[callback](); - }; - } - - if (token) { - formatTokenFunctions[token] = func; - } - - if (padded) { - formatTokenFunctions[padded[0]] = function () { - return zeroFill(func.apply(this, arguments), padded[1], padded[2]); - }; - } + return value; + } // compare two arrays, return the number of differences + + + function compareArrays(array1, array2, dontConvert) { + var len = Math.min(array1.length, array2.length), + lengthDiff = Math.abs(array1.length - array2.length), + diffs = 0, + i; + + for (i = 0; i < len; i++) { + if (dontConvert && array1[i] !== array2[i] || !dontConvert && toInt(array1[i]) !== toInt(array2[i])) { + diffs++; + } + } + + return diffs + lengthDiff; + } + + function warn(msg) { + if (hooks.suppressDeprecationWarnings === false && typeof console !== 'undefined' && console.warn) { + console.warn('Deprecation warning: ' + msg); + } + } + + function deprecate(msg, fn) { + var firstTime = true; + return extend(function () { + if (hooks.deprecationHandler != null) { + hooks.deprecationHandler(null, msg); + } + + if (firstTime) { + var args = []; + var arg; + + for (var i = 0; i < arguments.length; i++) { + arg = ''; + + if (_typeof(arguments[i]) === 'object') { + arg += '\n[' + i + '] '; + + for (var key in arguments[0]) { + arg += key + ': ' + arguments[0][key] + ', '; + } + + arg = arg.slice(0, -2); // Remove trailing comma and space + } else { + arg = arguments[i]; + } + + args.push(arg); + } + + warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + new Error().stack); + firstTime = false; + } + + return fn.apply(this, arguments); + }, fn); + } + + var deprecations = {}; + + function deprecateSimple(name, msg) { + if (hooks.deprecationHandler != null) { + hooks.deprecationHandler(name, msg); + } + + if (!deprecations[name]) { + warn(msg); + deprecations[name] = true; + } + } + + hooks.suppressDeprecationWarnings = false; + hooks.deprecationHandler = null; + + function isFunction(input) { + return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; + } + + function set(config) { + var prop, i; + + for (i in config) { + prop = config[i]; + + if (isFunction(prop)) { + this[i] = prop; + } else { + this['_' + i] = prop; + } + } + + this._config = config; // Lenient ordinal parsing accepts just a number in addition to + // number + (possibly) stuff coming from _dayOfMonthOrdinalParse. + // TODO: Remove "ordinalParse" fallback in next major release. + + this._dayOfMonthOrdinalParseLenient = new RegExp((this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + '|' + /\d{1,2}/.source); + } + + function mergeConfigs(parentConfig, childConfig) { + var res = extend({}, parentConfig), + prop; + + for (prop in childConfig) { + if (hasOwnProp(childConfig, prop)) { + if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { + res[prop] = {}; + extend(res[prop], parentConfig[prop]); + extend(res[prop], childConfig[prop]); + } else if (childConfig[prop] != null) { + res[prop] = childConfig[prop]; + } else { + delete res[prop]; + } + } + } + + for (prop in parentConfig) { + if (hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject(parentConfig[prop])) { + // make sure changes to properties don't modify parent config + res[prop] = extend({}, res[prop]); + } + } + + return res; + } + + function Locale(config) { + if (config != null) { + this.set(config); + } + } + + var keys; + + if (Object.keys) { + keys = Object.keys; + } else { + keys = function keys(obj) { + var i, + res = []; + + for (i in obj) { + if (hasOwnProp(obj, i)) { + res.push(i); + } + } + + return res; + }; + } + + var defaultCalendar = { + sameDay: '[Today at] LT', + nextDay: '[Tomorrow at] LT', + nextWeek: 'dddd [at] LT', + lastDay: '[Yesterday at] LT', + lastWeek: '[Last] dddd [at] LT', + sameElse: 'L' + }; + + function calendar(key, mom, now) { + var output = this._calendar[key] || this._calendar['sameElse']; + return isFunction(output) ? output.call(mom, now) : output; + } + + var defaultLongDateFormat = { + LTS: 'h:mm:ss A', + LT: 'h:mm A', + L: 'MM/DD/YYYY', + LL: 'MMMM D, YYYY', + LLL: 'MMMM D, YYYY h:mm A', + LLLL: 'dddd, MMMM D, YYYY h:mm A' + }; + + function longDateFormat(key) { + var format = this._longDateFormat[key], + formatUpper = this._longDateFormat[key.toUpperCase()]; + + if (format || !formatUpper) { + return format; + } + + this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) { + return val.slice(1); + }); + return this._longDateFormat[key]; + } + + var defaultInvalidDate = 'Invalid date'; + + function invalidDate() { + return this._invalidDate; + } + + var defaultOrdinal = '%d'; + var defaultDayOfMonthOrdinalParse = /\d{1,2}/; + + function ordinal(number) { + return this._ordinal.replace('%d', number); + } + + var defaultRelativeTime = { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + ss: '%d seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years' + }; + + function relativeTime(number, withoutSuffix, string, isFuture) { + var output = this._relativeTime[string]; + return isFunction(output) ? output(number, withoutSuffix, string, isFuture) : output.replace(/%d/i, number); + } + + function pastFuture(diff, output) { + var format = this._relativeTime[diff > 0 ? 'future' : 'past']; + return isFunction(format) ? format(output) : format.replace(/%s/i, output); + } + + var aliases = {}; + + function addUnitAlias(unit, shorthand) { + var lowerCase = unit.toLowerCase(); + aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; + } + + function normalizeUnits(units) { + return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; + } + + function normalizeObjectUnits(inputObject) { + var normalizedInput = {}, + normalizedProp, + prop; + + for (prop in inputObject) { + if (hasOwnProp(inputObject, prop)) { + normalizedProp = normalizeUnits(prop); + + if (normalizedProp) { + normalizedInput[normalizedProp] = inputObject[prop]; + } + } + } + + return normalizedInput; + } + + var priorities = {}; + + function addUnitPriority(unit, priority) { + priorities[unit] = priority; + } + + function getPrioritizedUnits(unitsObj) { + var units = []; + + for (var u in unitsObj) { + units.push({ + unit: u, + priority: priorities[u] + }); + } + + units.sort(function (a, b) { + return a.priority - b.priority; + }); + return units; + } + + function zeroFill(number, targetLength, forceSign) { + var absNumber = '' + Math.abs(number), + zerosToFill = targetLength - absNumber.length, + sign = number >= 0; + return (sign ? forceSign ? '+' : '' : '-') + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; + } + + var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g; + var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g; + var formatFunctions = {}; + var formatTokenFunctions = {}; // token: 'M' + // padded: ['MM', 2] + // ordinal: 'Mo' + // callback: function () { this.month() + 1 } + + function addFormatToken(token, padded, ordinal, callback) { + var func = callback; + + if (typeof callback === 'string') { + func = function func() { + return this[callback](); + }; + } + + if (token) { + formatTokenFunctions[token] = func; + } + + if (padded) { + formatTokenFunctions[padded[0]] = function () { + return zeroFill(func.apply(this, arguments), padded[1], padded[2]); + }; + } - if (ordinal) { - formatTokenFunctions[ordinal] = function () { - return this.localeData().ordinal(func.apply(this, arguments), token); - }; - } - } + if (ordinal) { + formatTokenFunctions[ordinal] = function () { + return this.localeData().ordinal(func.apply(this, arguments), token); + }; + } + } - function removeFormattingTokens(input) { - if (input.match(/\[[\s\S]/)) { - return input.replace(/^\[|\]$/g, ''); - } + function removeFormattingTokens(input) { + if (input.match(/\[[\s\S]/)) { + return input.replace(/^\[|\]$/g, ''); + } - return input.replace(/\\/g, ''); - } + return input.replace(/\\/g, ''); + } - function makeFormatFunction(format) { - var array = format.match(formattingTokens), - i, - length; + function makeFormatFunction(format) { + var array = format.match(formattingTokens), + i, + length; - for (i = 0, length = array.length; i < length; i++) { - if (formatTokenFunctions[array[i]]) { - array[i] = formatTokenFunctions[array[i]]; - } else { - array[i] = removeFormattingTokens(array[i]); - } - } + for (i = 0, length = array.length; i < length; i++) { + if (formatTokenFunctions[array[i]]) { + array[i] = formatTokenFunctions[array[i]]; + } else { + array[i] = removeFormattingTokens(array[i]); + } + } - return function (mom) { - var output = '', - i; + return function (mom) { + var output = '', + i; - for (i = 0; i < length; i++) { - output += isFunction(array[i]) ? array[i].call(mom, format) : array[i]; - } + for (i = 0; i < length; i++) { + output += isFunction(array[i]) ? array[i].call(mom, format) : array[i]; + } - return output; - }; - } // format date using native date object + return output; + }; + } // format date using native date object - function formatMoment(m, format) { - if (!m.isValid()) { - return m.localeData().invalidDate(); - } + function formatMoment(m, format) { + if (!m.isValid()) { + return m.localeData().invalidDate(); + } - format = expandFormat(format, m.localeData()); - formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); - return formatFunctions[format](m); - } + format = expandFormat(format, m.localeData()); + formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); + return formatFunctions[format](m); + } - function expandFormat(format, locale) { - var i = 5; + function expandFormat(format, locale) { + var i = 5; - function replaceLongDateFormatTokens(input) { - return locale.longDateFormat(input) || input; - } + function replaceLongDateFormatTokens(input) { + return locale.longDateFormat(input) || input; + } - localFormattingTokens.lastIndex = 0; + localFormattingTokens.lastIndex = 0; - while (i >= 0 && localFormattingTokens.test(format)) { - format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); - localFormattingTokens.lastIndex = 0; - i -= 1; - } + while (i >= 0 && localFormattingTokens.test(format)) { + format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); + localFormattingTokens.lastIndex = 0; + i -= 1; + } - return format; - } + return format; + } - var match1 = /\d/; // 0 - 9 + var match1 = /\d/; // 0 - 9 - var match2 = /\d\d/; // 00 - 99 + var match2 = /\d\d/; // 00 - 99 - var match3 = /\d{3}/; // 000 - 999 + var match3 = /\d{3}/; // 000 - 999 - var match4 = /\d{4}/; // 0000 - 9999 + var match4 = /\d{4}/; // 0000 - 9999 - var match6 = /[+-]?\d{6}/; // -999999 - 999999 + var match6 = /[+-]?\d{6}/; // -999999 - 999999 - var match1to2 = /\d\d?/; // 0 - 99 + var match1to2 = /\d\d?/; // 0 - 99 - var match3to4 = /\d\d\d\d?/; // 999 - 9999 + var match3to4 = /\d\d\d\d?/; // 999 - 9999 - var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999 + var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999 - var match1to3 = /\d{1,3}/; // 0 - 999 + var match1to3 = /\d{1,3}/; // 0 - 999 - var match1to4 = /\d{1,4}/; // 0 - 9999 + var match1to4 = /\d{1,4}/; // 0 - 9999 - var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999 + var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999 - var matchUnsigned = /\d+/; // 0 - inf + var matchUnsigned = /\d+/; // 0 - inf - var matchSigned = /[+-]?\d+/; // -inf - inf + var matchSigned = /[+-]?\d+/; // -inf - inf - var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z + var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z - var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z + var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z - var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123 - // any word (or two) characters or numbers including two/three word month in arabic. - // includes scottish gaelic two word and hyphenated months + var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123 + // any word (or two) characters or numbers including two/three word month in arabic. + // includes scottish gaelic two word and hyphenated months - var matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i; - var regexes = {}; + var matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i; + var regexes = {}; - function addRegexToken(token, regex, strictRegex) { - regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) { - return isStrict && strictRegex ? strictRegex : regex; - }; - } + function addRegexToken(token, regex, strictRegex) { + regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) { + return isStrict && strictRegex ? strictRegex : regex; + }; + } - function getParseRegexForToken(token, config) { - if (!hasOwnProp(regexes, token)) { - return new RegExp(unescapeFormat(token)); - } + function getParseRegexForToken(token, config) { + if (!hasOwnProp(regexes, token)) { + return new RegExp(unescapeFormat(token)); + } - return regexes[token](config._strict, config._locale); - } // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript + return regexes[token](config._strict, config._locale); + } // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript - function unescapeFormat(s) { - return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { - return p1 || p2 || p3 || p4; - })); - } + function unescapeFormat(s) { + return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { + return p1 || p2 || p3 || p4; + })); + } - function regexEscape(s) { - return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); - } + function regexEscape(s) { + return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); + } - var tokens = {}; + var tokens = {}; - function addParseToken(token, callback) { - var i, - func = callback; + function addParseToken(token, callback) { + var i, + func = callback; - if (typeof token === 'string') { - token = [token]; - } + if (typeof token === 'string') { + token = [token]; + } - if (isNumber(callback)) { - func = function func(input, array) { - array[callback] = toInt(input); - }; - } + if (isNumber(callback)) { + func = function func(input, array) { + array[callback] = toInt(input); + }; + } - for (i = 0; i < token.length; i++) { - tokens[token[i]] = func; - } - } + for (i = 0; i < token.length; i++) { + tokens[token[i]] = func; + } + } - function addWeekParseToken(token, callback) { - addParseToken(token, function (input, array, config, token) { - config._w = config._w || {}; - callback(input, config._w, config, token); - }); - } + function addWeekParseToken(token, callback) { + addParseToken(token, function (input, array, config, token) { + config._w = config._w || {}; + callback(input, config._w, config, token); + }); + } - function addTimeToArrayFromToken(token, input, config) { - if (input != null && hasOwnProp(tokens, token)) { - tokens[token](input, config._a, config, token); - } - } + function addTimeToArrayFromToken(token, input, config) { + if (input != null && hasOwnProp(tokens, token)) { + tokens[token](input, config._a, config, token); + } + } - var YEAR = 0; - var MONTH = 1; - var DATE = 2; - var HOUR = 3; - var MINUTE = 4; - var SECOND = 5; - var MILLISECOND = 6; - var WEEK = 7; - var WEEKDAY = 8; // FORMATTING - - addFormatToken('Y', 0, 0, function () { - var y = this.year(); - return y <= 9999 ? '' + y : '+' + y; - }); - addFormatToken(0, ['YY', 2], 0, function () { - return this.year() % 100; - }); - addFormatToken(0, ['YYYY', 4], 0, 'year'); - addFormatToken(0, ['YYYYY', 5], 0, 'year'); - addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); // ALIASES - - addUnitAlias('year', 'y'); // PRIORITIES - - addUnitPriority('year', 1); // PARSING - - addRegexToken('Y', matchSigned); - addRegexToken('YY', match1to2, match2); - addRegexToken('YYYY', match1to4, match4); - addRegexToken('YYYYY', match1to6, match6); - addRegexToken('YYYYYY', match1to6, match6); - addParseToken(['YYYYY', 'YYYYYY'], YEAR); - addParseToken('YYYY', function (input, array) { - array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); - }); - addParseToken('YY', function (input, array) { - array[YEAR] = hooks.parseTwoDigitYear(input); - }); - addParseToken('Y', function (input, array) { - array[YEAR] = parseInt(input, 10); - }); // HELPERS - - function daysInYear(year) { - return isLeapYear(year) ? 366 : 365; - } - - function isLeapYear(year) { - return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; - } // HOOKS - - - hooks.parseTwoDigitYear = function (input) { - return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); - }; // MOMENTS - - - var getSetYear = makeGetSet('FullYear', true); - - function getIsLeapYear() { - return isLeapYear(this.year()); - } - - function makeGetSet(unit, keepTime) { - return function (value) { - if (value != null) { - set$1(this, unit, value); - hooks.updateOffset(this, keepTime); - return this; - } else { - return get(this, unit); - } - }; - } - - function get(mom, unit) { - return mom.isValid() ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; - } - - function set$1(mom, unit, value) { - if (mom.isValid() && !isNaN(value)) { - if (unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) { - mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month())); - } else { - mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); - } - } - } // MOMENTS - - - function stringGet(units) { - units = normalizeUnits(units); - - if (isFunction(this[units])) { - return this[units](); - } - - return this; - } - - function stringSet(units, value) { - if (_typeof(units) === 'object') { - units = normalizeObjectUnits(units); - var prioritized = getPrioritizedUnits(units); - - for (var i = 0; i < prioritized.length; i++) { - this[prioritized[i].unit](units[prioritized[i].unit]); - } - } else { - units = normalizeUnits(units); - - if (isFunction(this[units])) { - return this[units](value); - } - } - - return this; - } - - function mod(n, x) { - return (n % x + x) % x; - } - - var indexOf; - - if (Array.prototype.indexOf) { - indexOf = Array.prototype.indexOf; - } else { - indexOf = function indexOf(o) { - // I know - var i; - - for (i = 0; i < this.length; ++i) { - if (this[i] === o) { - return i; - } - } - - return -1; - }; - } - - function daysInMonth(year, month) { - if (isNaN(year) || isNaN(month)) { - return NaN; - } - - var modMonth = mod(month, 12); - year += (month - modMonth) / 12; - return modMonth === 1 ? isLeapYear(year) ? 29 : 28 : 31 - modMonth % 7 % 2; - } // FORMATTING - - - addFormatToken('M', ['MM', 2], 'Mo', function () { - return this.month() + 1; - }); - addFormatToken('MMM', 0, 0, function (format) { - return this.localeData().monthsShort(this, format); - }); - addFormatToken('MMMM', 0, 0, function (format) { - return this.localeData().months(this, format); - }); // ALIASES - - addUnitAlias('month', 'M'); // PRIORITY - - addUnitPriority('month', 8); // PARSING - - addRegexToken('M', match1to2); - addRegexToken('MM', match1to2, match2); - addRegexToken('MMM', function (isStrict, locale) { - return locale.monthsShortRegex(isStrict); - }); - addRegexToken('MMMM', function (isStrict, locale) { - return locale.monthsRegex(isStrict); - }); - addParseToken(['M', 'MM'], function (input, array) { - array[MONTH] = toInt(input) - 1; - }); - addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { - var month = config._locale.monthsParse(input, token, config._strict); // if we didn't find a month name, mark the date as invalid. - - - if (month != null) { - array[MONTH] = month; - } else { - getParsingFlags(config).invalidMonth = input; - } - }); // LOCALES - - var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/; - var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'); - - function localeMonths(m, format) { - if (!m) { - return isArray(this._months) ? this._months : this._months['standalone']; - } - - return isArray(this._months) ? this._months[m.month()] : this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()]; - } - - var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'); - - function localeMonthsShort(m, format) { - if (!m) { - return isArray(this._monthsShort) ? this._monthsShort : this._monthsShort['standalone']; - } - - return isArray(this._monthsShort) ? this._monthsShort[m.month()] : this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; - } - - function handleStrictParse(monthName, format, strict) { - var i, - ii, - mom, - llc = monthName.toLocaleLowerCase(); - - if (!this._monthsParse) { - // this is not used - this._monthsParse = []; - this._longMonthsParse = []; - this._shortMonthsParse = []; - - for (i = 0; i < 12; ++i) { - mom = createUTC([2000, i]); - this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase(); - this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); - } - } - - if (strict) { - if (format === 'MMM') { - ii = indexOf.call(this._shortMonthsParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._longMonthsParse, llc); - return ii !== -1 ? ii : null; - } - } else { - if (format === 'MMM') { - ii = indexOf.call(this._shortMonthsParse, llc); - - if (ii !== -1) { - return ii; - } - - ii = indexOf.call(this._longMonthsParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._longMonthsParse, llc); - - if (ii !== -1) { - return ii; - } - - ii = indexOf.call(this._shortMonthsParse, llc); - return ii !== -1 ? ii : null; - } - } - } - - function localeMonthsParse(monthName, format, strict) { - var i, mom, regex; - - if (this._monthsParseExact) { - return handleStrictParse.call(this, monthName, format, strict); - } - - if (!this._monthsParse) { - this._monthsParse = []; - this._longMonthsParse = []; - this._shortMonthsParse = []; - } // TODO: add sorting - // Sorting makes sure if one month (or abbr) is a prefix of another - // see sorting in computeMonthsParse - - - for (i = 0; i < 12; i++) { - // make the regex if we don't have it already - mom = createUTC([2000, i]); - - if (strict && !this._longMonthsParse[i]) { - this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i'); - this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i'); - } - - if (!strict && !this._monthsParse[i]) { - regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); - this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); - } // test the regex - - - if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) { - return i; - } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) { - return i; - } else if (!strict && this._monthsParse[i].test(monthName)) { - return i; - } - } - } // MOMENTS - - - function setMonth(mom, value) { - var dayOfMonth; - - if (!mom.isValid()) { - // No op - return mom; - } - - if (typeof value === 'string') { - if (/^\d+$/.test(value)) { - value = toInt(value); - } else { - value = mom.localeData().monthsParse(value); // TODO: Another silent failure? - - if (!isNumber(value)) { - return mom; - } - } - } - - dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); - - mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); - - return mom; - } - - function getSetMonth(value) { - if (value != null) { - setMonth(this, value); - hooks.updateOffset(this, true); - return this; - } else { - return get(this, 'Month'); - } - } - - function getDaysInMonth() { - return daysInMonth(this.year(), this.month()); - } - - var defaultMonthsShortRegex = matchWord; - - function monthsShortRegex(isStrict) { - if (this._monthsParseExact) { - if (!hasOwnProp(this, '_monthsRegex')) { - computeMonthsParse.call(this); - } - - if (isStrict) { - return this._monthsShortStrictRegex; - } else { - return this._monthsShortRegex; - } - } else { - if (!hasOwnProp(this, '_monthsShortRegex')) { - this._monthsShortRegex = defaultMonthsShortRegex; - } - - return this._monthsShortStrictRegex && isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex; - } - } - - var defaultMonthsRegex = matchWord; - - function monthsRegex(isStrict) { - if (this._monthsParseExact) { - if (!hasOwnProp(this, '_monthsRegex')) { - computeMonthsParse.call(this); - } - - if (isStrict) { - return this._monthsStrictRegex; - } else { - return this._monthsRegex; - } - } else { - if (!hasOwnProp(this, '_monthsRegex')) { - this._monthsRegex = defaultMonthsRegex; - } - - return this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex; - } - } - - function computeMonthsParse() { - function cmpLenRev(a, b) { - return b.length - a.length; - } - - var shortPieces = [], - longPieces = [], - mixedPieces = [], - i, - mom; - - for (i = 0; i < 12; i++) { - // make the regex if we don't have it already - mom = createUTC([2000, i]); - shortPieces.push(this.monthsShort(mom, '')); - longPieces.push(this.months(mom, '')); - mixedPieces.push(this.months(mom, '')); - mixedPieces.push(this.monthsShort(mom, '')); - } // Sorting makes sure if one month (or abbr) is a prefix of another it - // will match the longer piece. - - - shortPieces.sort(cmpLenRev); - longPieces.sort(cmpLenRev); - mixedPieces.sort(cmpLenRev); - - for (i = 0; i < 12; i++) { - shortPieces[i] = regexEscape(shortPieces[i]); - longPieces[i] = regexEscape(longPieces[i]); - } - - for (i = 0; i < 24; i++) { - mixedPieces[i] = regexEscape(mixedPieces[i]); - } - - this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); - this._monthsShortRegex = this._monthsRegex; - this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); - this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); - } - - function createDate(y, m, d, h, M, s, ms) { - // can't just apply() to create a date: - // https://stackoverflow.com/q/181348 - var date = new Date(y, m, d, h, M, s, ms); // the date constructor remaps years 0-99 to 1900-1999 - - if (y < 100 && y >= 0 && isFinite(date.getFullYear())) { - date.setFullYear(y); - } - - return date; - } - - function createUTCDate(y) { - var date = new Date(Date.UTC.apply(null, arguments)); // the Date.UTC function remaps years 0-99 to 1900-1999 - - if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) { - date.setUTCFullYear(y); - } - - return date; - } // start-of-first-week - start-of-year - - - function firstWeekOffset(year, dow, doy) { - var // first-week day -- which january is always in the first week (4 for iso, 1 for other) - fwd = 7 + dow - doy, - // first-week day local weekday -- which local weekday is fwd - fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; - return -fwdlw + fwd - 1; - } // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday - - - function dayOfYearFromWeeks(year, week, weekday, dow, doy) { - var localWeekday = (7 + weekday - dow) % 7, - weekOffset = firstWeekOffset(year, dow, doy), - dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, - resYear, - resDayOfYear; - - if (dayOfYear <= 0) { - resYear = year - 1; - resDayOfYear = daysInYear(resYear) + dayOfYear; - } else if (dayOfYear > daysInYear(year)) { - resYear = year + 1; - resDayOfYear = dayOfYear - daysInYear(year); - } else { - resYear = year; - resDayOfYear = dayOfYear; - } - - return { - year: resYear, - dayOfYear: resDayOfYear - }; - } - - function weekOfYear(mom, dow, doy) { - var weekOffset = firstWeekOffset(mom.year(), dow, doy), - week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, - resWeek, - resYear; - - if (week < 1) { - resYear = mom.year() - 1; - resWeek = week + weeksInYear(resYear, dow, doy); - } else if (week > weeksInYear(mom.year(), dow, doy)) { - resWeek = week - weeksInYear(mom.year(), dow, doy); - resYear = mom.year() + 1; - } else { - resYear = mom.year(); - resWeek = week; - } - - return { - week: resWeek, - year: resYear - }; - } - - function weeksInYear(year, dow, doy) { - var weekOffset = firstWeekOffset(year, dow, doy), - weekOffsetNext = firstWeekOffset(year + 1, dow, doy); - return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; - } // FORMATTING - - - addFormatToken('w', ['ww', 2], 'wo', 'week'); - addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); // ALIASES - - addUnitAlias('week', 'w'); - addUnitAlias('isoWeek', 'W'); // PRIORITIES - - addUnitPriority('week', 5); - addUnitPriority('isoWeek', 5); // PARSING - - addRegexToken('w', match1to2); - addRegexToken('ww', match1to2, match2); - addRegexToken('W', match1to2); - addRegexToken('WW', match1to2, match2); - addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) { - week[token.substr(0, 1)] = toInt(input); - }); // HELPERS - // LOCALES - - function localeWeek(mom) { - return weekOfYear(mom, this._week.dow, this._week.doy).week; - } - - var defaultLocaleWeek = { - dow: 0, - // Sunday is the first day of the week. - doy: 6 // The week that contains Jan 1st is the first week of the year. - - }; - - function localeFirstDayOfWeek() { - return this._week.dow; - } - - function localeFirstDayOfYear() { - return this._week.doy; - } // MOMENTS - - - function getSetWeek(input) { - var week = this.localeData().week(this); - return input == null ? week : this.add((input - week) * 7, 'd'); - } - - function getSetISOWeek(input) { - var week = weekOfYear(this, 1, 4).week; - return input == null ? week : this.add((input - week) * 7, 'd'); - } // FORMATTING - - - addFormatToken('d', 0, 'do', 'day'); - addFormatToken('dd', 0, 0, function (format) { - return this.localeData().weekdaysMin(this, format); - }); - addFormatToken('ddd', 0, 0, function (format) { - return this.localeData().weekdaysShort(this, format); - }); - addFormatToken('dddd', 0, 0, function (format) { - return this.localeData().weekdays(this, format); - }); - addFormatToken('e', 0, 0, 'weekday'); - addFormatToken('E', 0, 0, 'isoWeekday'); // ALIASES - - addUnitAlias('day', 'd'); - addUnitAlias('weekday', 'e'); - addUnitAlias('isoWeekday', 'E'); // PRIORITY - - addUnitPriority('day', 11); - addUnitPriority('weekday', 11); - addUnitPriority('isoWeekday', 11); // PARSING - - addRegexToken('d', match1to2); - addRegexToken('e', match1to2); - addRegexToken('E', match1to2); - addRegexToken('dd', function (isStrict, locale) { - return locale.weekdaysMinRegex(isStrict); - }); - addRegexToken('ddd', function (isStrict, locale) { - return locale.weekdaysShortRegex(isStrict); - }); - addRegexToken('dddd', function (isStrict, locale) { - return locale.weekdaysRegex(isStrict); - }); - addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { - var weekday = config._locale.weekdaysParse(input, token, config._strict); // if we didn't get a weekday name, mark the date as invalid - - - if (weekday != null) { - week.d = weekday; - } else { - getParsingFlags(config).invalidWeekday = input; - } - }); - addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { - week[token] = toInt(input); - }); // HELPERS - - function parseWeekday(input, locale) { - if (typeof input !== 'string') { - return input; - } - - if (!isNaN(input)) { - return parseInt(input, 10); - } - - input = locale.weekdaysParse(input); - - if (typeof input === 'number') { - return input; - } - - return null; - } - - function parseIsoWeekday(input, locale) { - if (typeof input === 'string') { - return locale.weekdaysParse(input) % 7 || 7; - } - - return isNaN(input) ? null : input; - } // LOCALES - - - var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'); - - function localeWeekdays(m, format) { - if (!m) { - return isArray(this._weekdays) ? this._weekdays : this._weekdays['standalone']; - } - - return isArray(this._weekdays) ? this._weekdays[m.day()] : this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()]; - } - - var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'); - - function localeWeekdaysShort(m) { - return m ? this._weekdaysShort[m.day()] : this._weekdaysShort; - } - - var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'); - - function localeWeekdaysMin(m) { - return m ? this._weekdaysMin[m.day()] : this._weekdaysMin; - } - - function handleStrictParse$1(weekdayName, format, strict) { - var i, - ii, - mom, - llc = weekdayName.toLocaleLowerCase(); - - if (!this._weekdaysParse) { - this._weekdaysParse = []; - this._shortWeekdaysParse = []; - this._minWeekdaysParse = []; - - for (i = 0; i < 7; ++i) { - mom = createUTC([2000, 1]).day(i); - this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase(); - this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase(); - this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); - } - } - - if (strict) { - if (format === 'dddd') { - ii = indexOf.call(this._weekdaysParse, llc); - return ii !== -1 ? ii : null; - } else if (format === 'ddd') { - ii = indexOf.call(this._shortWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } - } else { - if (format === 'dddd') { - ii = indexOf.call(this._weekdaysParse, llc); - - if (ii !== -1) { - return ii; - } - - ii = indexOf.call(this._shortWeekdaysParse, llc); - - if (ii !== -1) { - return ii; - } - - ii = indexOf.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else if (format === 'ddd') { - ii = indexOf.call(this._shortWeekdaysParse, llc); - - if (ii !== -1) { - return ii; - } - - ii = indexOf.call(this._weekdaysParse, llc); - - if (ii !== -1) { - return ii; - } - - ii = indexOf.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._minWeekdaysParse, llc); - - if (ii !== -1) { - return ii; - } - - ii = indexOf.call(this._weekdaysParse, llc); - - if (ii !== -1) { - return ii; - } - - ii = indexOf.call(this._shortWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } - } - } - - function localeWeekdaysParse(weekdayName, format, strict) { - var i, mom, regex; - - if (this._weekdaysParseExact) { - return handleStrictParse$1.call(this, weekdayName, format, strict); - } - - if (!this._weekdaysParse) { - this._weekdaysParse = []; - this._minWeekdaysParse = []; - this._shortWeekdaysParse = []; - this._fullWeekdaysParse = []; - } - - for (i = 0; i < 7; i++) { - // make the regex if we don't have it already - mom = createUTC([2000, 1]).day(i); - - if (strict && !this._fullWeekdaysParse[i]) { - this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i'); - this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i'); - this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i'); - } - - if (!this._weekdaysParse[i]) { - regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); - this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); - } // test the regex - - - if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) { - return i; - } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) { - return i; - } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) { - return i; - } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { - return i; - } - } - } // MOMENTS - - - function getSetDayOfWeek(input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } - - var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); - - if (input != null) { - input = parseWeekday(input, this.localeData()); - return this.add(input - day, 'd'); - } else { - return day; - } - } - - function getSetLocaleDayOfWeek(input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } - - var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; - return input == null ? weekday : this.add(input - weekday, 'd'); - } - - function getSetISODayOfWeek(input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } // behaves the same as moment#day except - // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) - // as a setter, sunday should belong to the previous week. - - - if (input != null) { - var weekday = parseIsoWeekday(input, this.localeData()); - return this.day(this.day() % 7 ? weekday : weekday - 7); - } else { - return this.day() || 7; - } - } - - var defaultWeekdaysRegex = matchWord; - - function weekdaysRegex(isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - - if (isStrict) { - return this._weekdaysStrictRegex; - } else { - return this._weekdaysRegex; - } - } else { - if (!hasOwnProp(this, '_weekdaysRegex')) { - this._weekdaysRegex = defaultWeekdaysRegex; - } - - return this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex; - } - } - - var defaultWeekdaysShortRegex = matchWord; - - function weekdaysShortRegex(isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - - if (isStrict) { - return this._weekdaysShortStrictRegex; - } else { - return this._weekdaysShortRegex; - } - } else { - if (!hasOwnProp(this, '_weekdaysShortRegex')) { - this._weekdaysShortRegex = defaultWeekdaysShortRegex; - } - - return this._weekdaysShortStrictRegex && isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex; - } - } - - var defaultWeekdaysMinRegex = matchWord; - - function weekdaysMinRegex(isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - - if (isStrict) { - return this._weekdaysMinStrictRegex; - } else { - return this._weekdaysMinRegex; - } - } else { - if (!hasOwnProp(this, '_weekdaysMinRegex')) { - this._weekdaysMinRegex = defaultWeekdaysMinRegex; - } - - return this._weekdaysMinStrictRegex && isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex; - } - } - - function computeWeekdaysParse() { - function cmpLenRev(a, b) { - return b.length - a.length; - } - - var minPieces = [], - shortPieces = [], - longPieces = [], - mixedPieces = [], - i, - mom, - minp, - shortp, - longp; - - for (i = 0; i < 7; i++) { - // make the regex if we don't have it already - mom = createUTC([2000, 1]).day(i); - minp = this.weekdaysMin(mom, ''); - shortp = this.weekdaysShort(mom, ''); - longp = this.weekdays(mom, ''); - minPieces.push(minp); - shortPieces.push(shortp); - longPieces.push(longp); - mixedPieces.push(minp); - mixedPieces.push(shortp); - mixedPieces.push(longp); - } // Sorting makes sure if one weekday (or abbr) is a prefix of another it - // will match the longer piece. - - - minPieces.sort(cmpLenRev); - shortPieces.sort(cmpLenRev); - longPieces.sort(cmpLenRev); - mixedPieces.sort(cmpLenRev); - - for (i = 0; i < 7; i++) { - shortPieces[i] = regexEscape(shortPieces[i]); - longPieces[i] = regexEscape(longPieces[i]); - mixedPieces[i] = regexEscape(mixedPieces[i]); - } - - this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); - this._weekdaysShortRegex = this._weekdaysRegex; - this._weekdaysMinRegex = this._weekdaysRegex; - this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); - this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); - this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i'); - } // FORMATTING - - - function hFormat() { - return this.hours() % 12 || 12; - } - - function kFormat() { - return this.hours() || 24; - } - - addFormatToken('H', ['HH', 2], 0, 'hour'); - addFormatToken('h', ['hh', 2], 0, hFormat); - addFormatToken('k', ['kk', 2], 0, kFormat); - addFormatToken('hmm', 0, 0, function () { - return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); - }); - addFormatToken('hmmss', 0, 0, function () { - return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2); - }); - addFormatToken('Hmm', 0, 0, function () { - return '' + this.hours() + zeroFill(this.minutes(), 2); - }); - addFormatToken('Hmmss', 0, 0, function () { - return '' + this.hours() + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2); - }); - - function meridiem(token, lowercase) { - addFormatToken(token, 0, 0, function () { - return this.localeData().meridiem(this.hours(), this.minutes(), lowercase); - }); - } - - meridiem('a', true); - meridiem('A', false); // ALIASES - - addUnitAlias('hour', 'h'); // PRIORITY - - addUnitPriority('hour', 13); // PARSING - - function matchMeridiem(isStrict, locale) { - return locale._meridiemParse; - } - - addRegexToken('a', matchMeridiem); - addRegexToken('A', matchMeridiem); - addRegexToken('H', match1to2); - addRegexToken('h', match1to2); - addRegexToken('k', match1to2); - addRegexToken('HH', match1to2, match2); - addRegexToken('hh', match1to2, match2); - addRegexToken('kk', match1to2, match2); - addRegexToken('hmm', match3to4); - addRegexToken('hmmss', match5to6); - addRegexToken('Hmm', match3to4); - addRegexToken('Hmmss', match5to6); - addParseToken(['H', 'HH'], HOUR); - addParseToken(['k', 'kk'], function (input, array, config) { - var kInput = toInt(input); - array[HOUR] = kInput === 24 ? 0 : kInput; - }); - addParseToken(['a', 'A'], function (input, array, config) { - config._isPm = config._locale.isPM(input); - config._meridiem = input; - }); - addParseToken(['h', 'hh'], function (input, array, config) { - array[HOUR] = toInt(input); - getParsingFlags(config).bigHour = true; - }); - addParseToken('hmm', function (input, array, config) { - var pos = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos)); - array[MINUTE] = toInt(input.substr(pos)); - getParsingFlags(config).bigHour = true; - }); - addParseToken('hmmss', function (input, array, config) { - var pos1 = input.length - 4; - var pos2 = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos1)); - array[MINUTE] = toInt(input.substr(pos1, 2)); - array[SECOND] = toInt(input.substr(pos2)); - getParsingFlags(config).bigHour = true; - }); - addParseToken('Hmm', function (input, array, config) { - var pos = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos)); - array[MINUTE] = toInt(input.substr(pos)); - }); - addParseToken('Hmmss', function (input, array, config) { - var pos1 = input.length - 4; - var pos2 = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos1)); - array[MINUTE] = toInt(input.substr(pos1, 2)); - array[SECOND] = toInt(input.substr(pos2)); - }); // LOCALES - - function localeIsPM(input) { - // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays - // Using charAt should be more compatible. - return (input + '').toLowerCase().charAt(0) === 'p'; - } - - var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i; - - function localeMeridiem(hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'pm' : 'PM'; - } else { - return isLower ? 'am' : 'AM'; - } - } // MOMENTS - // Setting the hour should keep the time, because the user explicitly - // specified which hour they want. So trying to maintain the same hour (in - // a new timezone) makes sense. Adding/subtracting hours does not follow - // this rule. - - - var getSetHour = makeGetSet('Hours', true); - var baseConfig = { - calendar: defaultCalendar, - longDateFormat: defaultLongDateFormat, - invalidDate: defaultInvalidDate, - ordinal: defaultOrdinal, - dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, - relativeTime: defaultRelativeTime, - months: defaultLocaleMonths, - monthsShort: defaultLocaleMonthsShort, - week: defaultLocaleWeek, - weekdays: defaultLocaleWeekdays, - weekdaysMin: defaultLocaleWeekdaysMin, - weekdaysShort: defaultLocaleWeekdaysShort, - meridiemParse: defaultLocaleMeridiemParse - }; // internal storage for locale config files - - var locales = {}; - var localeFamilies = {}; - var globalLocale; - - function normalizeLocale(key) { - return key ? key.toLowerCase().replace('_', '-') : key; - } // pick the locale from the array - // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each - // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root - - - function chooseLocale(names) { - var i = 0, - j, - next, - locale, - split; - - while (i < names.length) { - split = normalizeLocale(names[i]).split('-'); - j = split.length; - next = normalizeLocale(names[i + 1]); - next = next ? next.split('-') : null; - - while (j > 0) { - locale = loadLocale(split.slice(0, j).join('-')); - - if (locale) { - return locale; - } - - if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { - //the next array item is better than a shallower substring of this one - break; - } - - j--; - } - - i++; - } - - return globalLocale; - } - - function loadLocale(name) { - var oldLocale = null; // TODO: Find a better way to register and load all the locales in Node - - if (!locales[name] && 'object' !== 'undefined' && module && module.exports) { - try { - oldLocale = globalLocale._abbr; - var aliasedRequire = commonjsRequire; - aliasedRequire('./locale/' + name); - getSetGlobalLocale(oldLocale); - } catch (e) {} - } - - return locales[name]; - } // This function will load locale and then set the global locale. If - // no arguments are passed in, it will simply return the current global - // locale key. - - - function getSetGlobalLocale(key, values) { - var data; - - if (key) { - if (isUndefined(values)) { - data = getLocale(key); - } else { - data = defineLocale(key, values); - } - - if (data) { - // moment.duration._locale = moment._locale = data; - globalLocale = data; - } else { - if (typeof console !== 'undefined' && console.warn) { - //warn user if arguments are passed but the locale could not be set - console.warn('Locale ' + key + ' not found. Did you forget to load it?'); - } - } - } - - return globalLocale._abbr; - } - - function defineLocale(name, config) { - if (config !== null) { - var locale, - parentConfig = baseConfig; - config.abbr = name; - - if (locales[name] != null) { - deprecateSimple('defineLocaleOverride', 'use moment.updateLocale(localeName, config) to change ' + 'an existing locale. moment.defineLocale(localeName, ' + 'config) should only be used for creating a new locale ' + 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'); - parentConfig = locales[name]._config; - } else if (config.parentLocale != null) { - if (locales[config.parentLocale] != null) { - parentConfig = locales[config.parentLocale]._config; - } else { - locale = loadLocale(config.parentLocale); - - if (locale != null) { - parentConfig = locale._config; - } else { - if (!localeFamilies[config.parentLocale]) { - localeFamilies[config.parentLocale] = []; - } - - localeFamilies[config.parentLocale].push({ - name: name, - config: config - }); - return null; - } - } - } - - locales[name] = new Locale(mergeConfigs(parentConfig, config)); - - if (localeFamilies[name]) { - localeFamilies[name].forEach(function (x) { - defineLocale(x.name, x.config); - }); - } // backwards compat for now: also set the locale - // make sure we set the locale AFTER all child locales have been - // created, so we won't end up with the child locale set. - - - getSetGlobalLocale(name); - return locales[name]; - } else { - // useful for testing - delete locales[name]; - return null; - } - } - - function updateLocale(name, config) { - if (config != null) { - var locale, - tmpLocale, - parentConfig = baseConfig; // MERGE - - tmpLocale = loadLocale(name); - - if (tmpLocale != null) { - parentConfig = tmpLocale._config; - } - - config = mergeConfigs(parentConfig, config); - locale = new Locale(config); - locale.parentLocale = locales[name]; - locales[name] = locale; // backwards compat for now: also set the locale - - getSetGlobalLocale(name); - } else { - // pass null for config to unupdate, useful for tests - if (locales[name] != null) { - if (locales[name].parentLocale != null) { - locales[name] = locales[name].parentLocale; - } else if (locales[name] != null) { - delete locales[name]; - } - } - } - - return locales[name]; - } // returns locale data - - - function getLocale(key) { - var locale; - - if (key && key._locale && key._locale._abbr) { - key = key._locale._abbr; - } - - if (!key) { - return globalLocale; - } - - if (!isArray(key)) { - //short-circuit everything else - locale = loadLocale(key); - - if (locale) { - return locale; - } - - key = [key]; - } - - return chooseLocale(key); - } - - function listLocales() { - return keys(locales); - } + var YEAR = 0; + var MONTH = 1; + var DATE = 2; + var HOUR = 3; + var MINUTE = 4; + var SECOND = 5; + var MILLISECOND = 6; + var WEEK = 7; + var WEEKDAY = 8; // FORMATTING + + addFormatToken('Y', 0, 0, function () { + var y = this.year(); + return y <= 9999 ? '' + y : '+' + y; + }); + addFormatToken(0, ['YY', 2], 0, function () { + return this.year() % 100; + }); + addFormatToken(0, ['YYYY', 4], 0, 'year'); + addFormatToken(0, ['YYYYY', 5], 0, 'year'); + addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); // ALIASES + + addUnitAlias('year', 'y'); // PRIORITIES + + addUnitPriority('year', 1); // PARSING + + addRegexToken('Y', matchSigned); + addRegexToken('YY', match1to2, match2); + addRegexToken('YYYY', match1to4, match4); + addRegexToken('YYYYY', match1to6, match6); + addRegexToken('YYYYYY', match1to6, match6); + addParseToken(['YYYYY', 'YYYYYY'], YEAR); + addParseToken('YYYY', function (input, array) { + array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); + }); + addParseToken('YY', function (input, array) { + array[YEAR] = hooks.parseTwoDigitYear(input); + }); + addParseToken('Y', function (input, array) { + array[YEAR] = parseInt(input, 10); + }); // HELPERS + + function daysInYear(year) { + return isLeapYear(year) ? 366 : 365; + } + + function isLeapYear(year) { + return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; + } // HOOKS + + + hooks.parseTwoDigitYear = function (input) { + return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); + }; // MOMENTS + + + var getSetYear = makeGetSet('FullYear', true); + + function getIsLeapYear() { + return isLeapYear(this.year()); + } + + function makeGetSet(unit, keepTime) { + return function (value) { + if (value != null) { + set$1(this, unit, value); + hooks.updateOffset(this, keepTime); + return this; + } else { + return get(this, unit); + } + }; + } + + function get(mom, unit) { + return mom.isValid() ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; + } + + function set$1(mom, unit, value) { + if (mom.isValid() && !isNaN(value)) { + if (unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) { + mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month())); + } else { + mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); + } + } + } // MOMENTS + + + function stringGet(units) { + units = normalizeUnits(units); + + if (isFunction(this[units])) { + return this[units](); + } + + return this; + } + + function stringSet(units, value) { + if (_typeof(units) === 'object') { + units = normalizeObjectUnits(units); + var prioritized = getPrioritizedUnits(units); + + for (var i = 0; i < prioritized.length; i++) { + this[prioritized[i].unit](units[prioritized[i].unit]); + } + } else { + units = normalizeUnits(units); + + if (isFunction(this[units])) { + return this[units](value); + } + } + + return this; + } + + function mod(n, x) { + return (n % x + x) % x; + } + + var indexOf; + + if (Array.prototype.indexOf) { + indexOf = Array.prototype.indexOf; + } else { + indexOf = function indexOf(o) { + // I know + var i; + + for (i = 0; i < this.length; ++i) { + if (this[i] === o) { + return i; + } + } + + return -1; + }; + } + + function daysInMonth(year, month) { + if (isNaN(year) || isNaN(month)) { + return NaN; + } + + var modMonth = mod(month, 12); + year += (month - modMonth) / 12; + return modMonth === 1 ? isLeapYear(year) ? 29 : 28 : 31 - modMonth % 7 % 2; + } // FORMATTING + + + addFormatToken('M', ['MM', 2], 'Mo', function () { + return this.month() + 1; + }); + addFormatToken('MMM', 0, 0, function (format) { + return this.localeData().monthsShort(this, format); + }); + addFormatToken('MMMM', 0, 0, function (format) { + return this.localeData().months(this, format); + }); // ALIASES + + addUnitAlias('month', 'M'); // PRIORITY + + addUnitPriority('month', 8); // PARSING + + addRegexToken('M', match1to2); + addRegexToken('MM', match1to2, match2); + addRegexToken('MMM', function (isStrict, locale) { + return locale.monthsShortRegex(isStrict); + }); + addRegexToken('MMMM', function (isStrict, locale) { + return locale.monthsRegex(isStrict); + }); + addParseToken(['M', 'MM'], function (input, array) { + array[MONTH] = toInt(input) - 1; + }); + addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { + var month = config._locale.monthsParse(input, token, config._strict); // if we didn't find a month name, mark the date as invalid. + + + if (month != null) { + array[MONTH] = month; + } else { + getParsingFlags(config).invalidMonth = input; + } + }); // LOCALES + + var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/; + var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'); + + function localeMonths(m, format) { + if (!m) { + return isArray(this._months) ? this._months : this._months['standalone']; + } + + return isArray(this._months) ? this._months[m.month()] : this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()]; + } + + var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'); + + function localeMonthsShort(m, format) { + if (!m) { + return isArray(this._monthsShort) ? this._monthsShort : this._monthsShort['standalone']; + } + + return isArray(this._monthsShort) ? this._monthsShort[m.month()] : this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; + } + + function handleStrictParse(monthName, format, strict) { + var i, + ii, + mom, + llc = monthName.toLocaleLowerCase(); + + if (!this._monthsParse) { + // this is not used + this._monthsParse = []; + this._longMonthsParse = []; + this._shortMonthsParse = []; + + for (i = 0; i < 12; ++i) { + mom = createUTC([2000, i]); + this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase(); + this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); + } + } + + if (strict) { + if (format === 'MMM') { + ii = indexOf.call(this._shortMonthsParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._longMonthsParse, llc); + return ii !== -1 ? ii : null; + } + } else { + if (format === 'MMM') { + ii = indexOf.call(this._shortMonthsParse, llc); + + if (ii !== -1) { + return ii; + } + + ii = indexOf.call(this._longMonthsParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._longMonthsParse, llc); + + if (ii !== -1) { + return ii; + } + + ii = indexOf.call(this._shortMonthsParse, llc); + return ii !== -1 ? ii : null; + } + } + } + + function localeMonthsParse(monthName, format, strict) { + var i, mom, regex; + + if (this._monthsParseExact) { + return handleStrictParse.call(this, monthName, format, strict); + } + + if (!this._monthsParse) { + this._monthsParse = []; + this._longMonthsParse = []; + this._shortMonthsParse = []; + } // TODO: add sorting + // Sorting makes sure if one month (or abbr) is a prefix of another + // see sorting in computeMonthsParse + + + for (i = 0; i < 12; i++) { + // make the regex if we don't have it already + mom = createUTC([2000, i]); + + if (strict && !this._longMonthsParse[i]) { + this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i'); + this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i'); + } + + if (!strict && !this._monthsParse[i]) { + regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); + this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); + } // test the regex + + + if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) { + return i; + } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) { + return i; + } else if (!strict && this._monthsParse[i].test(monthName)) { + return i; + } + } + } // MOMENTS + + + function setMonth(mom, value) { + var dayOfMonth; + + if (!mom.isValid()) { + // No op + return mom; + } + + if (typeof value === 'string') { + if (/^\d+$/.test(value)) { + value = toInt(value); + } else { + value = mom.localeData().monthsParse(value); // TODO: Another silent failure? + + if (!isNumber(value)) { + return mom; + } + } + } + + dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); + + mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); + + return mom; + } + + function getSetMonth(value) { + if (value != null) { + setMonth(this, value); + hooks.updateOffset(this, true); + return this; + } else { + return get(this, 'Month'); + } + } + + function getDaysInMonth() { + return daysInMonth(this.year(), this.month()); + } + + var defaultMonthsShortRegex = matchWord; + + function monthsShortRegex(isStrict) { + if (this._monthsParseExact) { + if (!hasOwnProp(this, '_monthsRegex')) { + computeMonthsParse.call(this); + } + + if (isStrict) { + return this._monthsShortStrictRegex; + } else { + return this._monthsShortRegex; + } + } else { + if (!hasOwnProp(this, '_monthsShortRegex')) { + this._monthsShortRegex = defaultMonthsShortRegex; + } + + return this._monthsShortStrictRegex && isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex; + } + } + + var defaultMonthsRegex = matchWord; + + function monthsRegex(isStrict) { + if (this._monthsParseExact) { + if (!hasOwnProp(this, '_monthsRegex')) { + computeMonthsParse.call(this); + } + + if (isStrict) { + return this._monthsStrictRegex; + } else { + return this._monthsRegex; + } + } else { + if (!hasOwnProp(this, '_monthsRegex')) { + this._monthsRegex = defaultMonthsRegex; + } + + return this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex; + } + } + + function computeMonthsParse() { + function cmpLenRev(a, b) { + return b.length - a.length; + } + + var shortPieces = [], + longPieces = [], + mixedPieces = [], + i, + mom; + + for (i = 0; i < 12; i++) { + // make the regex if we don't have it already + mom = createUTC([2000, i]); + shortPieces.push(this.monthsShort(mom, '')); + longPieces.push(this.months(mom, '')); + mixedPieces.push(this.months(mom, '')); + mixedPieces.push(this.monthsShort(mom, '')); + } // Sorting makes sure if one month (or abbr) is a prefix of another it + // will match the longer piece. + + + shortPieces.sort(cmpLenRev); + longPieces.sort(cmpLenRev); + mixedPieces.sort(cmpLenRev); + + for (i = 0; i < 12; i++) { + shortPieces[i] = regexEscape(shortPieces[i]); + longPieces[i] = regexEscape(longPieces[i]); + } + + for (i = 0; i < 24; i++) { + mixedPieces[i] = regexEscape(mixedPieces[i]); + } + + this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); + this._monthsShortRegex = this._monthsRegex; + this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); + this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); + } + + function createDate(y, m, d, h, M, s, ms) { + // can't just apply() to create a date: + // https://stackoverflow.com/q/181348 + var date = new Date(y, m, d, h, M, s, ms); // the date constructor remaps years 0-99 to 1900-1999 + + if (y < 100 && y >= 0 && isFinite(date.getFullYear())) { + date.setFullYear(y); + } + + return date; + } + + function createUTCDate(y) { + var date = new Date(Date.UTC.apply(null, arguments)); // the Date.UTC function remaps years 0-99 to 1900-1999 + + if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) { + date.setUTCFullYear(y); + } + + return date; + } // start-of-first-week - start-of-year + + + function firstWeekOffset(year, dow, doy) { + var // first-week day -- which january is always in the first week (4 for iso, 1 for other) + fwd = 7 + dow - doy, + // first-week day local weekday -- which local weekday is fwd + fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; + return -fwdlw + fwd - 1; + } // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday + + + function dayOfYearFromWeeks(year, week, weekday, dow, doy) { + var localWeekday = (7 + weekday - dow) % 7, + weekOffset = firstWeekOffset(year, dow, doy), + dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, + resYear, + resDayOfYear; + + if (dayOfYear <= 0) { + resYear = year - 1; + resDayOfYear = daysInYear(resYear) + dayOfYear; + } else if (dayOfYear > daysInYear(year)) { + resYear = year + 1; + resDayOfYear = dayOfYear - daysInYear(year); + } else { + resYear = year; + resDayOfYear = dayOfYear; + } + + return { + year: resYear, + dayOfYear: resDayOfYear + }; + } + + function weekOfYear(mom, dow, doy) { + var weekOffset = firstWeekOffset(mom.year(), dow, doy), + week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, + resWeek, + resYear; + + if (week < 1) { + resYear = mom.year() - 1; + resWeek = week + weeksInYear(resYear, dow, doy); + } else if (week > weeksInYear(mom.year(), dow, doy)) { + resWeek = week - weeksInYear(mom.year(), dow, doy); + resYear = mom.year() + 1; + } else { + resYear = mom.year(); + resWeek = week; + } + + return { + week: resWeek, + year: resYear + }; + } + + function weeksInYear(year, dow, doy) { + var weekOffset = firstWeekOffset(year, dow, doy), + weekOffsetNext = firstWeekOffset(year + 1, dow, doy); + return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; + } // FORMATTING + + + addFormatToken('w', ['ww', 2], 'wo', 'week'); + addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); // ALIASES + + addUnitAlias('week', 'w'); + addUnitAlias('isoWeek', 'W'); // PRIORITIES + + addUnitPriority('week', 5); + addUnitPriority('isoWeek', 5); // PARSING + + addRegexToken('w', match1to2); + addRegexToken('ww', match1to2, match2); + addRegexToken('W', match1to2); + addRegexToken('WW', match1to2, match2); + addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) { + week[token.substr(0, 1)] = toInt(input); + }); // HELPERS + // LOCALES + + function localeWeek(mom) { + return weekOfYear(mom, this._week.dow, this._week.doy).week; + } + + var defaultLocaleWeek = { + dow: 0, + // Sunday is the first day of the week. + doy: 6 // The week that contains Jan 1st is the first week of the year. + + }; + + function localeFirstDayOfWeek() { + return this._week.dow; + } + + function localeFirstDayOfYear() { + return this._week.doy; + } // MOMENTS + + + function getSetWeek(input) { + var week = this.localeData().week(this); + return input == null ? week : this.add((input - week) * 7, 'd'); + } + + function getSetISOWeek(input) { + var week = weekOfYear(this, 1, 4).week; + return input == null ? week : this.add((input - week) * 7, 'd'); + } // FORMATTING + + + addFormatToken('d', 0, 'do', 'day'); + addFormatToken('dd', 0, 0, function (format) { + return this.localeData().weekdaysMin(this, format); + }); + addFormatToken('ddd', 0, 0, function (format) { + return this.localeData().weekdaysShort(this, format); + }); + addFormatToken('dddd', 0, 0, function (format) { + return this.localeData().weekdays(this, format); + }); + addFormatToken('e', 0, 0, 'weekday'); + addFormatToken('E', 0, 0, 'isoWeekday'); // ALIASES + + addUnitAlias('day', 'd'); + addUnitAlias('weekday', 'e'); + addUnitAlias('isoWeekday', 'E'); // PRIORITY + + addUnitPriority('day', 11); + addUnitPriority('weekday', 11); + addUnitPriority('isoWeekday', 11); // PARSING + + addRegexToken('d', match1to2); + addRegexToken('e', match1to2); + addRegexToken('E', match1to2); + addRegexToken('dd', function (isStrict, locale) { + return locale.weekdaysMinRegex(isStrict); + }); + addRegexToken('ddd', function (isStrict, locale) { + return locale.weekdaysShortRegex(isStrict); + }); + addRegexToken('dddd', function (isStrict, locale) { + return locale.weekdaysRegex(isStrict); + }); + addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { + var weekday = config._locale.weekdaysParse(input, token, config._strict); // if we didn't get a weekday name, mark the date as invalid + + + if (weekday != null) { + week.d = weekday; + } else { + getParsingFlags(config).invalidWeekday = input; + } + }); + addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { + week[token] = toInt(input); + }); // HELPERS + + function parseWeekday(input, locale) { + if (typeof input !== 'string') { + return input; + } + + if (!isNaN(input)) { + return parseInt(input, 10); + } + + input = locale.weekdaysParse(input); + + if (typeof input === 'number') { + return input; + } + + return null; + } + + function parseIsoWeekday(input, locale) { + if (typeof input === 'string') { + return locale.weekdaysParse(input) % 7 || 7; + } + + return isNaN(input) ? null : input; + } // LOCALES + + + var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'); + + function localeWeekdays(m, format) { + if (!m) { + return isArray(this._weekdays) ? this._weekdays : this._weekdays['standalone']; + } + + return isArray(this._weekdays) ? this._weekdays[m.day()] : this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()]; + } + + var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'); + + function localeWeekdaysShort(m) { + return m ? this._weekdaysShort[m.day()] : this._weekdaysShort; + } + + var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'); + + function localeWeekdaysMin(m) { + return m ? this._weekdaysMin[m.day()] : this._weekdaysMin; + } + + function handleStrictParse$1(weekdayName, format, strict) { + var i, + ii, + mom, + llc = weekdayName.toLocaleLowerCase(); + + if (!this._weekdaysParse) { + this._weekdaysParse = []; + this._shortWeekdaysParse = []; + this._minWeekdaysParse = []; + + for (i = 0; i < 7; ++i) { + mom = createUTC([2000, 1]).day(i); + this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase(); + this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase(); + this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); + } + } + + if (strict) { + if (format === 'dddd') { + ii = indexOf.call(this._weekdaysParse, llc); + return ii !== -1 ? ii : null; + } else if (format === 'ddd') { + ii = indexOf.call(this._shortWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._minWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } + } else { + if (format === 'dddd') { + ii = indexOf.call(this._weekdaysParse, llc); + + if (ii !== -1) { + return ii; + } + + ii = indexOf.call(this._shortWeekdaysParse, llc); + + if (ii !== -1) { + return ii; + } + + ii = indexOf.call(this._minWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } else if (format === 'ddd') { + ii = indexOf.call(this._shortWeekdaysParse, llc); + + if (ii !== -1) { + return ii; + } + + ii = indexOf.call(this._weekdaysParse, llc); + + if (ii !== -1) { + return ii; + } + + ii = indexOf.call(this._minWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._minWeekdaysParse, llc); + + if (ii !== -1) { + return ii; + } + + ii = indexOf.call(this._weekdaysParse, llc); + + if (ii !== -1) { + return ii; + } + + ii = indexOf.call(this._shortWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } + } + } + + function localeWeekdaysParse(weekdayName, format, strict) { + var i, mom, regex; + + if (this._weekdaysParseExact) { + return handleStrictParse$1.call(this, weekdayName, format, strict); + } + + if (!this._weekdaysParse) { + this._weekdaysParse = []; + this._minWeekdaysParse = []; + this._shortWeekdaysParse = []; + this._fullWeekdaysParse = []; + } + + for (i = 0; i < 7; i++) { + // make the regex if we don't have it already + mom = createUTC([2000, 1]).day(i); + + if (strict && !this._fullWeekdaysParse[i]) { + this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i'); + this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i'); + this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i'); + } + + if (!this._weekdaysParse[i]) { + regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); + this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); + } // test the regex + + + if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) { + return i; + } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) { + return i; + } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) { + return i; + } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { + return i; + } + } + } // MOMENTS + + + function getSetDayOfWeek(input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } + + var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); + + if (input != null) { + input = parseWeekday(input, this.localeData()); + return this.add(input - day, 'd'); + } else { + return day; + } + } + + function getSetLocaleDayOfWeek(input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } + + var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; + return input == null ? weekday : this.add(input - weekday, 'd'); + } + + function getSetISODayOfWeek(input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } // behaves the same as moment#day except + // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) + // as a setter, sunday should belong to the previous week. + + + if (input != null) { + var weekday = parseIsoWeekday(input, this.localeData()); + return this.day(this.day() % 7 ? weekday : weekday - 7); + } else { + return this.day() || 7; + } + } + + var defaultWeekdaysRegex = matchWord; + + function weekdaysRegex(isStrict) { + if (this._weekdaysParseExact) { + if (!hasOwnProp(this, '_weekdaysRegex')) { + computeWeekdaysParse.call(this); + } + + if (isStrict) { + return this._weekdaysStrictRegex; + } else { + return this._weekdaysRegex; + } + } else { + if (!hasOwnProp(this, '_weekdaysRegex')) { + this._weekdaysRegex = defaultWeekdaysRegex; + } + + return this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex; + } + } + + var defaultWeekdaysShortRegex = matchWord; + + function weekdaysShortRegex(isStrict) { + if (this._weekdaysParseExact) { + if (!hasOwnProp(this, '_weekdaysRegex')) { + computeWeekdaysParse.call(this); + } + + if (isStrict) { + return this._weekdaysShortStrictRegex; + } else { + return this._weekdaysShortRegex; + } + } else { + if (!hasOwnProp(this, '_weekdaysShortRegex')) { + this._weekdaysShortRegex = defaultWeekdaysShortRegex; + } + + return this._weekdaysShortStrictRegex && isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex; + } + } + + var defaultWeekdaysMinRegex = matchWord; + + function weekdaysMinRegex(isStrict) { + if (this._weekdaysParseExact) { + if (!hasOwnProp(this, '_weekdaysRegex')) { + computeWeekdaysParse.call(this); + } + + if (isStrict) { + return this._weekdaysMinStrictRegex; + } else { + return this._weekdaysMinRegex; + } + } else { + if (!hasOwnProp(this, '_weekdaysMinRegex')) { + this._weekdaysMinRegex = defaultWeekdaysMinRegex; + } + + return this._weekdaysMinStrictRegex && isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex; + } + } + + function computeWeekdaysParse() { + function cmpLenRev(a, b) { + return b.length - a.length; + } + + var minPieces = [], + shortPieces = [], + longPieces = [], + mixedPieces = [], + i, + mom, + minp, + shortp, + longp; + + for (i = 0; i < 7; i++) { + // make the regex if we don't have it already + mom = createUTC([2000, 1]).day(i); + minp = this.weekdaysMin(mom, ''); + shortp = this.weekdaysShort(mom, ''); + longp = this.weekdays(mom, ''); + minPieces.push(minp); + shortPieces.push(shortp); + longPieces.push(longp); + mixedPieces.push(minp); + mixedPieces.push(shortp); + mixedPieces.push(longp); + } // Sorting makes sure if one weekday (or abbr) is a prefix of another it + // will match the longer piece. + + + minPieces.sort(cmpLenRev); + shortPieces.sort(cmpLenRev); + longPieces.sort(cmpLenRev); + mixedPieces.sort(cmpLenRev); + + for (i = 0; i < 7; i++) { + shortPieces[i] = regexEscape(shortPieces[i]); + longPieces[i] = regexEscape(longPieces[i]); + mixedPieces[i] = regexEscape(mixedPieces[i]); + } + + this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); + this._weekdaysShortRegex = this._weekdaysRegex; + this._weekdaysMinRegex = this._weekdaysRegex; + this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); + this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); + this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i'); + } // FORMATTING + + + function hFormat() { + return this.hours() % 12 || 12; + } + + function kFormat() { + return this.hours() || 24; + } + + addFormatToken('H', ['HH', 2], 0, 'hour'); + addFormatToken('h', ['hh', 2], 0, hFormat); + addFormatToken('k', ['kk', 2], 0, kFormat); + addFormatToken('hmm', 0, 0, function () { + return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); + }); + addFormatToken('hmmss', 0, 0, function () { + return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2); + }); + addFormatToken('Hmm', 0, 0, function () { + return '' + this.hours() + zeroFill(this.minutes(), 2); + }); + addFormatToken('Hmmss', 0, 0, function () { + return '' + this.hours() + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2); + }); + + function meridiem(token, lowercase) { + addFormatToken(token, 0, 0, function () { + return this.localeData().meridiem(this.hours(), this.minutes(), lowercase); + }); + } + + meridiem('a', true); + meridiem('A', false); // ALIASES + + addUnitAlias('hour', 'h'); // PRIORITY + + addUnitPriority('hour', 13); // PARSING + + function matchMeridiem(isStrict, locale) { + return locale._meridiemParse; + } + + addRegexToken('a', matchMeridiem); + addRegexToken('A', matchMeridiem); + addRegexToken('H', match1to2); + addRegexToken('h', match1to2); + addRegexToken('k', match1to2); + addRegexToken('HH', match1to2, match2); + addRegexToken('hh', match1to2, match2); + addRegexToken('kk', match1to2, match2); + addRegexToken('hmm', match3to4); + addRegexToken('hmmss', match5to6); + addRegexToken('Hmm', match3to4); + addRegexToken('Hmmss', match5to6); + addParseToken(['H', 'HH'], HOUR); + addParseToken(['k', 'kk'], function (input, array, config) { + var kInput = toInt(input); + array[HOUR] = kInput === 24 ? 0 : kInput; + }); + addParseToken(['a', 'A'], function (input, array, config) { + config._isPm = config._locale.isPM(input); + config._meridiem = input; + }); + addParseToken(['h', 'hh'], function (input, array, config) { + array[HOUR] = toInt(input); + getParsingFlags(config).bigHour = true; + }); + addParseToken('hmm', function (input, array, config) { + var pos = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos)); + array[MINUTE] = toInt(input.substr(pos)); + getParsingFlags(config).bigHour = true; + }); + addParseToken('hmmss', function (input, array, config) { + var pos1 = input.length - 4; + var pos2 = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos1)); + array[MINUTE] = toInt(input.substr(pos1, 2)); + array[SECOND] = toInt(input.substr(pos2)); + getParsingFlags(config).bigHour = true; + }); + addParseToken('Hmm', function (input, array, config) { + var pos = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos)); + array[MINUTE] = toInt(input.substr(pos)); + }); + addParseToken('Hmmss', function (input, array, config) { + var pos1 = input.length - 4; + var pos2 = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos1)); + array[MINUTE] = toInt(input.substr(pos1, 2)); + array[SECOND] = toInt(input.substr(pos2)); + }); // LOCALES + + function localeIsPM(input) { + // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays + // Using charAt should be more compatible. + return (input + '').toLowerCase().charAt(0) === 'p'; + } + + var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i; + + function localeMeridiem(hours, minutes, isLower) { + if (hours > 11) { + return isLower ? 'pm' : 'PM'; + } else { + return isLower ? 'am' : 'AM'; + } + } // MOMENTS + // Setting the hour should keep the time, because the user explicitly + // specified which hour they want. So trying to maintain the same hour (in + // a new timezone) makes sense. Adding/subtracting hours does not follow + // this rule. + + + var getSetHour = makeGetSet('Hours', true); + var baseConfig = { + calendar: defaultCalendar, + longDateFormat: defaultLongDateFormat, + invalidDate: defaultInvalidDate, + ordinal: defaultOrdinal, + dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, + relativeTime: defaultRelativeTime, + months: defaultLocaleMonths, + monthsShort: defaultLocaleMonthsShort, + week: defaultLocaleWeek, + weekdays: defaultLocaleWeekdays, + weekdaysMin: defaultLocaleWeekdaysMin, + weekdaysShort: defaultLocaleWeekdaysShort, + meridiemParse: defaultLocaleMeridiemParse + }; // internal storage for locale config files + + var locales = {}; + var localeFamilies = {}; + var globalLocale; + + function normalizeLocale(key) { + return key ? key.toLowerCase().replace('_', '-') : key; + } // pick the locale from the array + // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each + // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root + + + function chooseLocale(names) { + var i = 0, + j, + next, + locale, + split; + + while (i < names.length) { + split = normalizeLocale(names[i]).split('-'); + j = split.length; + next = normalizeLocale(names[i + 1]); + next = next ? next.split('-') : null; + + while (j > 0) { + locale = loadLocale(split.slice(0, j).join('-')); + + if (locale) { + return locale; + } + + if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { + //the next array item is better than a shallower substring of this one + break; + } + + j--; + } + + i++; + } + + return globalLocale; + } + + function loadLocale(name) { + var oldLocale = null; // TODO: Find a better way to register and load all the locales in Node + + if (!locales[name] && 'object' !== 'undefined' && module && module.exports) { + try { + oldLocale = globalLocale._abbr; + var aliasedRequire = commonjsRequire; + aliasedRequire('./locale/' + name); + getSetGlobalLocale(oldLocale); + } catch (e) {} + } + + return locales[name]; + } // This function will load locale and then set the global locale. If + // no arguments are passed in, it will simply return the current global + // locale key. + + + function getSetGlobalLocale(key, values) { + var data; + + if (key) { + if (isUndefined(values)) { + data = getLocale(key); + } else { + data = defineLocale(key, values); + } + + if (data) { + // moment.duration._locale = moment._locale = data; + globalLocale = data; + } else { + if (typeof console !== 'undefined' && console.warn) { + //warn user if arguments are passed but the locale could not be set + console.warn('Locale ' + key + ' not found. Did you forget to load it?'); + } + } + } + + return globalLocale._abbr; + } + + function defineLocale(name, config) { + if (config !== null) { + var locale, + parentConfig = baseConfig; + config.abbr = name; + + if (locales[name] != null) { + deprecateSimple('defineLocaleOverride', 'use moment.updateLocale(localeName, config) to change ' + 'an existing locale. moment.defineLocale(localeName, ' + 'config) should only be used for creating a new locale ' + 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'); + parentConfig = locales[name]._config; + } else if (config.parentLocale != null) { + if (locales[config.parentLocale] != null) { + parentConfig = locales[config.parentLocale]._config; + } else { + locale = loadLocale(config.parentLocale); + + if (locale != null) { + parentConfig = locale._config; + } else { + if (!localeFamilies[config.parentLocale]) { + localeFamilies[config.parentLocale] = []; + } + + localeFamilies[config.parentLocale].push({ + name: name, + config: config + }); + return null; + } + } + } + + locales[name] = new Locale(mergeConfigs(parentConfig, config)); + + if (localeFamilies[name]) { + localeFamilies[name].forEach(function (x) { + defineLocale(x.name, x.config); + }); + } // backwards compat for now: also set the locale + // make sure we set the locale AFTER all child locales have been + // created, so we won't end up with the child locale set. + + + getSetGlobalLocale(name); + return locales[name]; + } else { + // useful for testing + delete locales[name]; + return null; + } + } + + function updateLocale(name, config) { + if (config != null) { + var locale, + tmpLocale, + parentConfig = baseConfig; // MERGE + + tmpLocale = loadLocale(name); + + if (tmpLocale != null) { + parentConfig = tmpLocale._config; + } + + config = mergeConfigs(parentConfig, config); + locale = new Locale(config); + locale.parentLocale = locales[name]; + locales[name] = locale; // backwards compat for now: also set the locale + + getSetGlobalLocale(name); + } else { + // pass null for config to unupdate, useful for tests + if (locales[name] != null) { + if (locales[name].parentLocale != null) { + locales[name] = locales[name].parentLocale; + } else if (locales[name] != null) { + delete locales[name]; + } + } + } + + return locales[name]; + } // returns locale data + + + function getLocale(key) { + var locale; + + if (key && key._locale && key._locale._abbr) { + key = key._locale._abbr; + } + + if (!key) { + return globalLocale; + } + + if (!isArray(key)) { + //short-circuit everything else + locale = loadLocale(key); + + if (locale) { + return locale; + } + + key = [key]; + } + + return chooseLocale(key); + } + + function listLocales() { + return keys(locales); + } - function checkOverflow(m) { - var overflow; - var a = m._a; + function checkOverflow(m) { + var overflow; + var a = m._a; - if (a && getParsingFlags(m).overflow === -2) { - overflow = a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : a[HOUR] < 0 || a[HOUR] > 24 || a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0) ? HOUR : a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : -1; + if (a && getParsingFlags(m).overflow === -2) { + overflow = a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : a[HOUR] < 0 || a[HOUR] > 24 || a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0) ? HOUR : a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : -1; - if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { - overflow = DATE; - } + if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { + overflow = DATE; + } - if (getParsingFlags(m)._overflowWeeks && overflow === -1) { - overflow = WEEK; - } + if (getParsingFlags(m)._overflowWeeks && overflow === -1) { + overflow = WEEK; + } - if (getParsingFlags(m)._overflowWeekday && overflow === -1) { - overflow = WEEKDAY; - } + if (getParsingFlags(m)._overflowWeekday && overflow === -1) { + overflow = WEEKDAY; + } - getParsingFlags(m).overflow = overflow; - } + getParsingFlags(m).overflow = overflow; + } - return m; - } // Pick the first defined of two or three arguments. + return m; + } // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } + function defaults(a, b, c) { + if (a != null) { + return a; + } - if (b != null) { - return b; - } + if (b != null) { + return b; + } - return c; - } + return c; + } - function currentDateArray(config) { - // hooks is actually the exported moment object - var nowValue = new Date(hooks.now()); + function currentDateArray(config) { + // hooks is actually the exported moment object + var nowValue = new Date(hooks.now()); - if (config._useUTC) { - return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()]; - } + if (config._useUTC) { + return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()]; + } - return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; - } // convert an array to a date. - // the array should mirror the parameters below - // note: all values past the year are optional and will default to the lowest possible value. - // [year, month, day , hour, minute, second, millisecond] + return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; + } // convert an array to a date. + // the array should mirror the parameters below + // note: all values past the year are optional and will default to the lowest possible value. + // [year, month, day , hour, minute, second, millisecond] - function configFromArray(config) { - var i, - date, - input = [], - currentDate, - expectedWeekday, - yearToUse; + function configFromArray(config) { + var i, + date, + input = [], + currentDate, + expectedWeekday, + yearToUse; - if (config._d) { - return; - } + if (config._d) { + return; + } - currentDate = currentDateArray(config); //compute day of the year from weeks and weekdays + currentDate = currentDateArray(config); //compute day of the year from weeks and weekdays - if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { - dayOfYearFromWeekInfo(config); - } //if the day of the year is set, figure out what it is + if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { + dayOfYearFromWeekInfo(config); + } //if the day of the year is set, figure out what it is - if (config._dayOfYear != null) { - yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); - - if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) { - getParsingFlags(config)._overflowDayOfYear = true; - } - - date = createUTCDate(yearToUse, 0, config._dayOfYear); - config._a[MONTH] = date.getUTCMonth(); - config._a[DATE] = date.getUTCDate(); - } // Default to current date. - // * if no year, month, day of month are given, default to today - // * if day of month is given, default month and year - // * if month is given, default only year - // * if year is given, don't default anything - - - for (i = 0; i < 3 && config._a[i] == null; ++i) { - config._a[i] = input[i] = currentDate[i]; - } // Zero out whatever was not defaulted, including time - - - for (; i < 7; i++) { - config._a[i] = input[i] = config._a[i] == null ? i === 2 ? 1 : 0 : config._a[i]; - } // Check for 24:00:00.000 - - - if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) { - config._nextDay = true; - config._a[HOUR] = 0; - } - - config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); - expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay(); // Apply timezone offset from input. The actual utcOffset can be changed - // with parseZone. - - if (config._tzm != null) { - config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); - } - - if (config._nextDay) { - config._a[HOUR] = 24; - } // check for mismatching day of week - - - if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) { - getParsingFlags(config).weekdayMismatch = true; - } - } - - function dayOfYearFromWeekInfo(config) { - var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow; - w = config._w; - - if (w.GG != null || w.W != null || w.E != null) { - dow = 1; - doy = 4; // TODO: We need to take the current isoWeekYear, but that depends on - // how we interpret now (local, utc, fixed offset). So create - // a now version of current config (take local/utc/offset flags, and - // create now). - - weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year); - week = defaults(w.W, 1); - weekday = defaults(w.E, 1); - - if (weekday < 1 || weekday > 7) { - weekdayOverflow = true; - } - } else { - dow = config._locale._week.dow; - doy = config._locale._week.doy; - var curWeek = weekOfYear(createLocal(), dow, doy); - weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); // Default to current week. - - week = defaults(w.w, curWeek.week); - - if (w.d != null) { - // weekday -- low day numbers are considered next week - weekday = w.d; - - if (weekday < 0 || weekday > 6) { - weekdayOverflow = true; - } - } else if (w.e != null) { - // local weekday -- counting starts from begining of week - weekday = w.e + dow; - - if (w.e < 0 || w.e > 6) { - weekdayOverflow = true; - } - } else { - // default to begining of week - weekday = dow; - } - } - - if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { - getParsingFlags(config)._overflowWeeks = true; - } else if (weekdayOverflow != null) { - getParsingFlags(config)._overflowWeekday = true; - } else { - temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); - config._a[YEAR] = temp.year; - config._dayOfYear = temp.dayOfYear; - } - } // iso 8601 regex - // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) - - - var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/; - var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/; - var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/; - var isoDates = [['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], ['GGGG-[W]WW', /\d{4}-W\d\d/, false], ['YYYY-DDD', /\d{4}-\d{3}/], ['YYYY-MM', /\d{4}-\d\d/, false], ['YYYYYYMMDD', /[+-]\d{10}/], ['YYYYMMDD', /\d{8}/], // YYYYMM is NOT allowed by the standard - ['GGGG[W]WWE', /\d{4}W\d{3}/], ['GGGG[W]WW', /\d{4}W\d{2}/, false], ['YYYYDDD', /\d{7}/]]; // iso time formats and regexes - - var isoTimes = [['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], ['HH:mm:ss', /\d\d:\d\d:\d\d/], ['HH:mm', /\d\d:\d\d/], ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], ['HHmmss', /\d\d\d\d\d\d/], ['HHmm', /\d\d\d\d/], ['HH', /\d\d/]]; - var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i; // date from iso format - - function configFromISO(config) { - var i, - l, - string = config._i, - match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), - allowTime, - dateFormat, - timeFormat, - tzFormat; - - if (match) { - getParsingFlags(config).iso = true; - - for (i = 0, l = isoDates.length; i < l; i++) { - if (isoDates[i][1].exec(match[1])) { - dateFormat = isoDates[i][0]; - allowTime = isoDates[i][2] !== false; - break; - } - } - - if (dateFormat == null) { - config._isValid = false; - return; - } - - if (match[3]) { - for (i = 0, l = isoTimes.length; i < l; i++) { - if (isoTimes[i][1].exec(match[3])) { - // match[2] should be 'T' or space - timeFormat = (match[2] || ' ') + isoTimes[i][0]; - break; - } - } - - if (timeFormat == null) { - config._isValid = false; - return; - } - } - - if (!allowTime && timeFormat != null) { - config._isValid = false; - return; - } - - if (match[4]) { - if (tzRegex.exec(match[4])) { - tzFormat = 'Z'; - } else { - config._isValid = false; - return; - } - } - - config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); - configFromStringAndFormat(config); - } else { - config._isValid = false; - } - } // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 - - - var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/; - - function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { - var result = [untruncateYear(yearStr), defaultLocaleMonthsShort.indexOf(monthStr), parseInt(dayStr, 10), parseInt(hourStr, 10), parseInt(minuteStr, 10)]; - - if (secondStr) { - result.push(parseInt(secondStr, 10)); - } - - return result; - } - - function untruncateYear(yearStr) { - var year = parseInt(yearStr, 10); - - if (year <= 49) { - return 2000 + year; - } else if (year <= 999) { - return 1900 + year; - } - - return year; - } - - function preprocessRFC2822(s) { - // Remove comments and folding whitespace and replace multiple-spaces with a single space - return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, ''); - } - - function checkWeekday(weekdayStr, parsedInput, config) { - if (weekdayStr) { - // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check. - var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), - weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay(); - - if (weekdayProvided !== weekdayActual) { - getParsingFlags(config).weekdayMismatch = true; - config._isValid = false; - return false; - } - } - - return true; - } - - var obsOffsets = { - UT: 0, - GMT: 0, - EDT: -4 * 60, - EST: -5 * 60, - CDT: -5 * 60, - CST: -6 * 60, - MDT: -6 * 60, - MST: -7 * 60, - PDT: -7 * 60, - PST: -8 * 60 - }; - - function calculateOffset(obsOffset, militaryOffset, numOffset) { - if (obsOffset) { - return obsOffsets[obsOffset]; - } else if (militaryOffset) { - // the only allowed military tz is Z - return 0; - } else { - var hm = parseInt(numOffset, 10); - var m = hm % 100, - h = (hm - m) / 100; - return h * 60 + m; - } - } // date and time from ref 2822 format - - - function configFromRFC2822(config) { - var match = rfc2822.exec(preprocessRFC2822(config._i)); - - if (match) { - var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]); - - if (!checkWeekday(match[1], parsedArray, config)) { - return; - } - - config._a = parsedArray; - config._tzm = calculateOffset(match[8], match[9], match[10]); - config._d = createUTCDate.apply(null, config._a); - - config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); - - getParsingFlags(config).rfc2822 = true; - } else { - config._isValid = false; - } - } // date from iso format or fallback - + if (config._dayOfYear != null) { + yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); + + if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) { + getParsingFlags(config)._overflowDayOfYear = true; + } + + date = createUTCDate(yearToUse, 0, config._dayOfYear); + config._a[MONTH] = date.getUTCMonth(); + config._a[DATE] = date.getUTCDate(); + } // Default to current date. + // * if no year, month, day of month are given, default to today + // * if day of month is given, default month and year + // * if month is given, default only year + // * if year is given, don't default anything + + + for (i = 0; i < 3 && config._a[i] == null; ++i) { + config._a[i] = input[i] = currentDate[i]; + } // Zero out whatever was not defaulted, including time + + + for (; i < 7; i++) { + config._a[i] = input[i] = config._a[i] == null ? i === 2 ? 1 : 0 : config._a[i]; + } // Check for 24:00:00.000 + + + if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) { + config._nextDay = true; + config._a[HOUR] = 0; + } + + config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); + expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay(); // Apply timezone offset from input. The actual utcOffset can be changed + // with parseZone. + + if (config._tzm != null) { + config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); + } + + if (config._nextDay) { + config._a[HOUR] = 24; + } // check for mismatching day of week + + + if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) { + getParsingFlags(config).weekdayMismatch = true; + } + } + + function dayOfYearFromWeekInfo(config) { + var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow; + w = config._w; + + if (w.GG != null || w.W != null || w.E != null) { + dow = 1; + doy = 4; // TODO: We need to take the current isoWeekYear, but that depends on + // how we interpret now (local, utc, fixed offset). So create + // a now version of current config (take local/utc/offset flags, and + // create now). + + weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year); + week = defaults(w.W, 1); + weekday = defaults(w.E, 1); + + if (weekday < 1 || weekday > 7) { + weekdayOverflow = true; + } + } else { + dow = config._locale._week.dow; + doy = config._locale._week.doy; + var curWeek = weekOfYear(createLocal(), dow, doy); + weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); // Default to current week. + + week = defaults(w.w, curWeek.week); + + if (w.d != null) { + // weekday -- low day numbers are considered next week + weekday = w.d; + + if (weekday < 0 || weekday > 6) { + weekdayOverflow = true; + } + } else if (w.e != null) { + // local weekday -- counting starts from begining of week + weekday = w.e + dow; + + if (w.e < 0 || w.e > 6) { + weekdayOverflow = true; + } + } else { + // default to begining of week + weekday = dow; + } + } + + if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { + getParsingFlags(config)._overflowWeeks = true; + } else if (weekdayOverflow != null) { + getParsingFlags(config)._overflowWeekday = true; + } else { + temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); + config._a[YEAR] = temp.year; + config._dayOfYear = temp.dayOfYear; + } + } // iso 8601 regex + // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) + + + var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/; + var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/; + var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/; + var isoDates = [['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], ['GGGG-[W]WW', /\d{4}-W\d\d/, false], ['YYYY-DDD', /\d{4}-\d{3}/], ['YYYY-MM', /\d{4}-\d\d/, false], ['YYYYYYMMDD', /[+-]\d{10}/], ['YYYYMMDD', /\d{8}/], // YYYYMM is NOT allowed by the standard + ['GGGG[W]WWE', /\d{4}W\d{3}/], ['GGGG[W]WW', /\d{4}W\d{2}/, false], ['YYYYDDD', /\d{7}/]]; // iso time formats and regexes + + var isoTimes = [['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], ['HH:mm:ss', /\d\d:\d\d:\d\d/], ['HH:mm', /\d\d:\d\d/], ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], ['HHmmss', /\d\d\d\d\d\d/], ['HHmm', /\d\d\d\d/], ['HH', /\d\d/]]; + var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i; // date from iso format + + function configFromISO(config) { + var i, + l, + string = config._i, + match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), + allowTime, + dateFormat, + timeFormat, + tzFormat; + + if (match) { + getParsingFlags(config).iso = true; + + for (i = 0, l = isoDates.length; i < l; i++) { + if (isoDates[i][1].exec(match[1])) { + dateFormat = isoDates[i][0]; + allowTime = isoDates[i][2] !== false; + break; + } + } + + if (dateFormat == null) { + config._isValid = false; + return; + } + + if (match[3]) { + for (i = 0, l = isoTimes.length; i < l; i++) { + if (isoTimes[i][1].exec(match[3])) { + // match[2] should be 'T' or space + timeFormat = (match[2] || ' ') + isoTimes[i][0]; + break; + } + } + + if (timeFormat == null) { + config._isValid = false; + return; + } + } + + if (!allowTime && timeFormat != null) { + config._isValid = false; + return; + } + + if (match[4]) { + if (tzRegex.exec(match[4])) { + tzFormat = 'Z'; + } else { + config._isValid = false; + return; + } + } + + config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); + configFromStringAndFormat(config); + } else { + config._isValid = false; + } + } // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 + + + var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/; + + function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { + var result = [untruncateYear(yearStr), defaultLocaleMonthsShort.indexOf(monthStr), parseInt(dayStr, 10), parseInt(hourStr, 10), parseInt(minuteStr, 10)]; + + if (secondStr) { + result.push(parseInt(secondStr, 10)); + } + + return result; + } + + function untruncateYear(yearStr) { + var year = parseInt(yearStr, 10); + + if (year <= 49) { + return 2000 + year; + } else if (year <= 999) { + return 1900 + year; + } + + return year; + } + + function preprocessRFC2822(s) { + // Remove comments and folding whitespace and replace multiple-spaces with a single space + return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, ''); + } + + function checkWeekday(weekdayStr, parsedInput, config) { + if (weekdayStr) { + // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check. + var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), + weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay(); + + if (weekdayProvided !== weekdayActual) { + getParsingFlags(config).weekdayMismatch = true; + config._isValid = false; + return false; + } + } + + return true; + } + + var obsOffsets = { + UT: 0, + GMT: 0, + EDT: -4 * 60, + EST: -5 * 60, + CDT: -5 * 60, + CST: -6 * 60, + MDT: -6 * 60, + MST: -7 * 60, + PDT: -7 * 60, + PST: -8 * 60 + }; + + function calculateOffset(obsOffset, militaryOffset, numOffset) { + if (obsOffset) { + return obsOffsets[obsOffset]; + } else if (militaryOffset) { + // the only allowed military tz is Z + return 0; + } else { + var hm = parseInt(numOffset, 10); + var m = hm % 100, + h = (hm - m) / 100; + return h * 60 + m; + } + } // date and time from ref 2822 format + + + function configFromRFC2822(config) { + var match = rfc2822.exec(preprocessRFC2822(config._i)); + + if (match) { + var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]); + + if (!checkWeekday(match[1], parsedArray, config)) { + return; + } + + config._a = parsedArray; + config._tzm = calculateOffset(match[8], match[9], match[10]); + config._d = createUTCDate.apply(null, config._a); + + config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); + + getParsingFlags(config).rfc2822 = true; + } else { + config._isValid = false; + } + } // date from iso format or fallback + - function configFromString(config) { - var matched = aspNetJsonRegex.exec(config._i); + function configFromString(config) { + var matched = aspNetJsonRegex.exec(config._i); - if (matched !== null) { - config._d = new Date(+matched[1]); - return; - } + if (matched !== null) { + config._d = new Date(+matched[1]); + return; + } - configFromISO(config); - - if (config._isValid === false) { - delete config._isValid; - } else { - return; - } + configFromISO(config); + + if (config._isValid === false) { + delete config._isValid; + } else { + return; + } - configFromRFC2822(config); - - if (config._isValid === false) { - delete config._isValid; - } else { - return; - } // Final attempt, use Input Fallback - - - hooks.createFromInputFallback(config); - } - - hooks.createFromInputFallback = deprecate('value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + 'discouraged and will be removed in an upcoming major release. Please refer to ' + 'http://momentjs.com/guides/#/warnings/js-date/ for more info.', function (config) { - config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); - }); // constant that refers to the ISO standard - - hooks.ISO_8601 = function () {}; // constant that refers to the RFC 2822 form - - - hooks.RFC_2822 = function () {}; // date from string and format string - - - function configFromStringAndFormat(config) { - // TODO: Move this to another part of the creation flow to prevent circular deps - if (config._f === hooks.ISO_8601) { - configFromISO(config); - return; - } + configFromRFC2822(config); + + if (config._isValid === false) { + delete config._isValid; + } else { + return; + } // Final attempt, use Input Fallback + + + hooks.createFromInputFallback(config); + } + + hooks.createFromInputFallback = deprecate('value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + 'discouraged and will be removed in an upcoming major release. Please refer to ' + 'http://momentjs.com/guides/#/warnings/js-date/ for more info.', function (config) { + config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); + }); // constant that refers to the ISO standard + + hooks.ISO_8601 = function () {}; // constant that refers to the RFC 2822 form + + + hooks.RFC_2822 = function () {}; // date from string and format string + + + function configFromStringAndFormat(config) { + // TODO: Move this to another part of the creation flow to prevent circular deps + if (config._f === hooks.ISO_8601) { + configFromISO(config); + return; + } - if (config._f === hooks.RFC_2822) { - configFromRFC2822(config); - return; - } - - config._a = []; - getParsingFlags(config).empty = true; // This array is used to make a Date, either with `new Date` or `Date.UTC` + if (config._f === hooks.RFC_2822) { + configFromRFC2822(config); + return; + } + + config._a = []; + getParsingFlags(config).empty = true; // This array is used to make a Date, either with `new Date` or `Date.UTC` - var string = '' + config._i, - i, - parsedInput, - tokens, - token, - skipped, - stringLength = string.length, - totalParsedInputLength = 0; - tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; + var string = '' + config._i, + i, + parsedInput, + tokens, + token, + skipped, + stringLength = string.length, + totalParsedInputLength = 0; + tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; - for (i = 0; i < tokens.length; i++) { - token = tokens[i]; - parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; // console.log('token', token, 'parsedInput', parsedInput, - // 'regex', getParseRegexForToken(token, config)); + for (i = 0; i < tokens.length; i++) { + token = tokens[i]; + parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; // console.log('token', token, 'parsedInput', parsedInput, + // 'regex', getParseRegexForToken(token, config)); - if (parsedInput) { - skipped = string.substr(0, string.indexOf(parsedInput)); + if (parsedInput) { + skipped = string.substr(0, string.indexOf(parsedInput)); - if (skipped.length > 0) { - getParsingFlags(config).unusedInput.push(skipped); - } + if (skipped.length > 0) { + getParsingFlags(config).unusedInput.push(skipped); + } - string = string.slice(string.indexOf(parsedInput) + parsedInput.length); - totalParsedInputLength += parsedInput.length; - } // don't parse if it's not a known token + string = string.slice(string.indexOf(parsedInput) + parsedInput.length); + totalParsedInputLength += parsedInput.length; + } // don't parse if it's not a known token - if (formatTokenFunctions[token]) { - if (parsedInput) { - getParsingFlags(config).empty = false; - } else { - getParsingFlags(config).unusedTokens.push(token); - } + if (formatTokenFunctions[token]) { + if (parsedInput) { + getParsingFlags(config).empty = false; + } else { + getParsingFlags(config).unusedTokens.push(token); + } - addTimeToArrayFromToken(token, parsedInput, config); - } else if (config._strict && !parsedInput) { - getParsingFlags(config).unusedTokens.push(token); - } - } // add remaining unparsed input length to the string + addTimeToArrayFromToken(token, parsedInput, config); + } else if (config._strict && !parsedInput) { + getParsingFlags(config).unusedTokens.push(token); + } + } // add remaining unparsed input length to the string - getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; + getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; - if (string.length > 0) { - getParsingFlags(config).unusedInput.push(string); - } // clear _12h flag if hour is <= 12 + if (string.length > 0) { + getParsingFlags(config).unusedInput.push(string); + } // clear _12h flag if hour is <= 12 - if (config._a[HOUR] <= 12 && getParsingFlags(config).bigHour === true && config._a[HOUR] > 0) { - getParsingFlags(config).bigHour = undefined; - } + if (config._a[HOUR] <= 12 && getParsingFlags(config).bigHour === true && config._a[HOUR] > 0) { + getParsingFlags(config).bigHour = undefined; + } - getParsingFlags(config).parsedDateParts = config._a.slice(0); - getParsingFlags(config).meridiem = config._meridiem; // handle meridiem + getParsingFlags(config).parsedDateParts = config._a.slice(0); + getParsingFlags(config).meridiem = config._meridiem; // handle meridiem - config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); - configFromArray(config); - checkOverflow(config); - } + config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); + configFromArray(config); + checkOverflow(config); + } - function meridiemFixWrap(locale, hour, meridiem) { - var isPm; + function meridiemFixWrap(locale, hour, meridiem) { + var isPm; - if (meridiem == null) { - // nothing to do - return hour; - } + if (meridiem == null) { + // nothing to do + return hour; + } - if (locale.meridiemHour != null) { - return locale.meridiemHour(hour, meridiem); - } else if (locale.isPM != null) { - // Fallback - isPm = locale.isPM(meridiem); + if (locale.meridiemHour != null) { + return locale.meridiemHour(hour, meridiem); + } else if (locale.isPM != null) { + // Fallback + isPm = locale.isPM(meridiem); - if (isPm && hour < 12) { - hour += 12; - } - - if (!isPm && hour === 12) { - hour = 0; - } - - return hour; - } else { - // this is not supposed to happen - return hour; - } - } // date from string and array of format strings - - - function configFromStringAndArray(config) { - var tempConfig, bestMoment, scoreToBeat, i, currentScore; - - if (config._f.length === 0) { - getParsingFlags(config).invalidFormat = true; - config._d = new Date(NaN); - return; - } - - for (i = 0; i < config._f.length; i++) { - currentScore = 0; - tempConfig = copyConfig({}, config); - - if (config._useUTC != null) { - tempConfig._useUTC = config._useUTC; - } - - tempConfig._f = config._f[i]; - configFromStringAndFormat(tempConfig); - - if (!isValid(tempConfig)) { - continue; - } // if there is any input that was not parsed add a penalty for that format - - - currentScore += getParsingFlags(tempConfig).charsLeftOver; //or tokens - - currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; - getParsingFlags(tempConfig).score = currentScore; - - if (scoreToBeat == null || currentScore < scoreToBeat) { - scoreToBeat = currentScore; - bestMoment = tempConfig; - } - } - - extend(config, bestMoment || tempConfig); - } - - function configFromObject(config) { - if (config._d) { - return; - } - - var i = normalizeObjectUnits(config._i); - config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) { - return obj && parseInt(obj, 10); - }); - configFromArray(config); - } - - function createFromConfig(config) { - var res = new Moment(checkOverflow(prepareConfig(config))); - - if (res._nextDay) { - // Adding is smart enough around DST - res.add(1, 'd'); - res._nextDay = undefined; - } - - return res; - } - - function prepareConfig(config) { - var input = config._i, - format = config._f; - config._locale = config._locale || getLocale(config._l); - - if (input === null || format === undefined && input === '') { - return createInvalid({ - nullInput: true - }); - } - - if (typeof input === 'string') { - config._i = input = config._locale.preparse(input); - } - - if (isMoment(input)) { - return new Moment(checkOverflow(input)); - } else if (isDate(input)) { - config._d = input; - } else if (isArray(format)) { - configFromStringAndArray(config); - } else if (format) { - configFromStringAndFormat(config); - } else { - configFromInput(config); - } - - if (!isValid(config)) { - config._d = null; - } - - return config; - } - - function configFromInput(config) { - var input = config._i; - - if (isUndefined(input)) { - config._d = new Date(hooks.now()); - } else if (isDate(input)) { - config._d = new Date(input.valueOf()); - } else if (typeof input === 'string') { - configFromString(config); - } else if (isArray(input)) { - config._a = map(input.slice(0), function (obj) { - return parseInt(obj, 10); - }); - configFromArray(config); - } else if (isObject(input)) { - configFromObject(config); - } else if (isNumber(input)) { - // from milliseconds - config._d = new Date(input); - } else { - hooks.createFromInputFallback(config); - } - } - - function createLocalOrUTC(input, format, locale, strict, isUTC) { - var c = {}; - - if (locale === true || locale === false) { - strict = locale; - locale = undefined; - } - - if (isObject(input) && isObjectEmpty(input) || isArray(input) && input.length === 0) { - input = undefined; - } // object construction must be done this way. - // https://github.com/moment/moment/issues/1423 - - - c._isAMomentObject = true; - c._useUTC = c._isUTC = isUTC; - c._l = locale; - c._i = input; - c._f = format; - c._strict = strict; - return createFromConfig(c); - } - - function createLocal(input, format, locale, strict) { - return createLocalOrUTC(input, format, locale, strict, false); - } - - var prototypeMin = deprecate('moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', function () { - var other = createLocal.apply(null, arguments); - - if (this.isValid() && other.isValid()) { - return other < this ? this : other; - } else { - return createInvalid(); - } - }); - var prototypeMax = deprecate('moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', function () { - var other = createLocal.apply(null, arguments); - - if (this.isValid() && other.isValid()) { - return other > this ? this : other; - } else { - return createInvalid(); - } - }); // Pick a moment m from moments so that m[fn](other) is true for all - // other. This relies on the function fn to be transitive. - // - // moments should either be an array of moment objects or an array, whose - // first element is an array of moment objects. - - function pickBy(fn, moments) { - var res, i; - - if (moments.length === 1 && isArray(moments[0])) { - moments = moments[0]; - } - - if (!moments.length) { - return createLocal(); - } - - res = moments[0]; - - for (i = 1; i < moments.length; ++i) { - if (!moments[i].isValid() || moments[i][fn](res)) { - res = moments[i]; - } - } - - return res; - } // TODO: Use [].sort instead? - - - function min() { - var args = [].slice.call(arguments, 0); - return pickBy('isBefore', args); - } - - function max() { - var args = [].slice.call(arguments, 0); - return pickBy('isAfter', args); - } - - var now = function now() { - return Date.now ? Date.now() : +new Date(); - }; - - var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond']; - - function isDurationValid(m) { - for (var key in m) { - if (!(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) { - return false; - } - } - - var unitHasDecimal = false; - - for (var i = 0; i < ordering.length; ++i) { - if (m[ordering[i]]) { - if (unitHasDecimal) { - return false; // only allow non-integers for smallest unit - } - - if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) { - unitHasDecimal = true; - } - } - } - - return true; - } - - function isValid$1() { - return this._isValid; - } - - function createInvalid$1() { - return createDuration(NaN); - } - - function Duration(duration) { - var normalizedInput = normalizeObjectUnits(duration), - years = normalizedInput.year || 0, - quarters = normalizedInput.quarter || 0, - months = normalizedInput.month || 0, - weeks = normalizedInput.week || 0, - days = normalizedInput.day || 0, - hours = normalizedInput.hour || 0, - minutes = normalizedInput.minute || 0, - seconds = normalizedInput.second || 0, - milliseconds = normalizedInput.millisecond || 0; - this._isValid = isDurationValid(normalizedInput); // representation for dateAddRemove - - this._milliseconds = +milliseconds + seconds * 1e3 + // 1000 - minutes * 6e4 + // 1000 * 60 - hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 - // Because of dateAddRemove treats 24 hours as different from a - // day when working around DST, we need to store them separately - - this._days = +days + weeks * 7; // It is impossible to translate months into days without knowing - // which months you are are talking about, so we have to store - // it separately. - - this._months = +months + quarters * 3 + years * 12; - this._data = {}; - this._locale = getLocale(); - - this._bubble(); - } - - function isDuration(obj) { - return obj instanceof Duration; - } - - function absRound(number) { - if (number < 0) { - return Math.round(-1 * number) * -1; - } else { - return Math.round(number); - } - } // FORMATTING - - - function offset(token, separator) { - addFormatToken(token, 0, 0, function () { - var offset = this.utcOffset(); - var sign = '+'; - - if (offset < 0) { - offset = -offset; - sign = '-'; - } - - return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~offset % 60, 2); - }); - } - - offset('Z', ':'); - offset('ZZ', ''); // PARSING - - addRegexToken('Z', matchShortOffset); - addRegexToken('ZZ', matchShortOffset); - addParseToken(['Z', 'ZZ'], function (input, array, config) { - config._useUTC = true; - config._tzm = offsetFromString(matchShortOffset, input); - }); // HELPERS - // timezone chunker - // '+10:00' > ['10', '00'] - // '-1530' > ['-15', '30'] - - var chunkOffset = /([\+\-]|\d\d)/gi; - - function offsetFromString(matcher, string) { - var matches = (string || '').match(matcher); - - if (matches === null) { - return null; - } - - var chunk = matches[matches.length - 1] || []; - var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; - var minutes = +(parts[1] * 60) + toInt(parts[2]); - return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes; - } // Return a moment from input, that is local/utc/zone equivalent to model. - - - function cloneWithOffset(input, model) { - var res, diff; - - if (model._isUTC) { - res = model.clone(); - diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); // Use low-level api, because this fn is low-level api. - - res._d.setTime(res._d.valueOf() + diff); - - hooks.updateOffset(res, false); - return res; - } else { - return createLocal(input).local(); - } - } - - function getDateOffset(m) { - // On Firefox.24 Date#getTimezoneOffset returns a floating point. - // https://github.com/moment/moment/pull/1871 - return -Math.round(m._d.getTimezoneOffset() / 15) * 15; - } // HOOKS - // This function will be called whenever a moment is mutated. - // It is intended to keep the offset in sync with the timezone. - - - hooks.updateOffset = function () {}; // MOMENTS - // keepLocalTime = true means only change the timezone, without - // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> - // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset - // +0200, so we adjust the time as needed, to be valid. - // - // Keeping the time actually adds/subtracts (one hour) - // from the actual represented time. That is why we call updateOffset - // a second time. In case it wants us to change the offset again - // _changeInProgress == true case, then we have to adjust, because - // there is no such time in the given timezone. - - - function getSetOffset(input, keepLocalTime, keepMinutes) { - var offset = this._offset || 0, - localAdjust; - - if (!this.isValid()) { - return input != null ? this : NaN; - } - - if (input != null) { - if (typeof input === 'string') { - input = offsetFromString(matchShortOffset, input); - - if (input === null) { - return this; - } - } else if (Math.abs(input) < 16 && !keepMinutes) { - input = input * 60; - } - - if (!this._isUTC && keepLocalTime) { - localAdjust = getDateOffset(this); - } - - this._offset = input; - this._isUTC = true; - - if (localAdjust != null) { - this.add(localAdjust, 'm'); - } - - if (offset !== input) { - if (!keepLocalTime || this._changeInProgress) { - addSubtract(this, createDuration(input - offset, 'm'), 1, false); - } else if (!this._changeInProgress) { - this._changeInProgress = true; - hooks.updateOffset(this, true); - this._changeInProgress = null; - } - } - - return this; - } else { - return this._isUTC ? offset : getDateOffset(this); - } - } - - function getSetZone(input, keepLocalTime) { - if (input != null) { - if (typeof input !== 'string') { - input = -input; - } - - this.utcOffset(input, keepLocalTime); - return this; - } else { - return -this.utcOffset(); - } - } - - function setOffsetToUTC(keepLocalTime) { - return this.utcOffset(0, keepLocalTime); - } - - function setOffsetToLocal(keepLocalTime) { - if (this._isUTC) { - this.utcOffset(0, keepLocalTime); - this._isUTC = false; - - if (keepLocalTime) { - this.subtract(getDateOffset(this), 'm'); - } - } - - return this; - } - - function setOffsetToParsedOffset() { - if (this._tzm != null) { - this.utcOffset(this._tzm, false, true); - } else if (typeof this._i === 'string') { - var tZone = offsetFromString(matchOffset, this._i); - - if (tZone != null) { - this.utcOffset(tZone); - } else { - this.utcOffset(0, true); - } - } - - return this; - } - - function hasAlignedHourOffset(input) { - if (!this.isValid()) { - return false; - } - - input = input ? createLocal(input).utcOffset() : 0; - return (this.utcOffset() - input) % 60 === 0; - } - - function isDaylightSavingTime() { - return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset(); - } - - function isDaylightSavingTimeShifted() { - if (!isUndefined(this._isDSTShifted)) { - return this._isDSTShifted; - } - - var c = {}; - copyConfig(c, this); - c = prepareConfig(c); - - if (c._a) { - var other = c._isUTC ? createUTC(c._a) : createLocal(c._a); - this._isDSTShifted = this.isValid() && compareArrays(c._a, other.toArray()) > 0; - } else { - this._isDSTShifted = false; - } - - return this._isDSTShifted; - } - - function isLocal() { - return this.isValid() ? !this._isUTC : false; - } - - function isUtcOffset() { - return this.isValid() ? this._isUTC : false; - } - - function isUtc() { - return this.isValid() ? this._isUTC && this._offset === 0 : false; - } // ASP.NET json date format regex - - - var aspNetRegex = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/; // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html - // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere - // and further modified to allow for strings containing both week and day - - var isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; - - function createDuration(input, key) { - var duration = input, - // matching against regexp is expensive, do it on demand - match = null, - sign, - ret, - diffRes; - - if (isDuration(input)) { - duration = { - ms: input._milliseconds, - d: input._days, - M: input._months - }; - } else if (isNumber(input)) { - duration = {}; - - if (key) { - duration[key] = input; - } else { - duration.milliseconds = input; - } - } else if (!!(match = aspNetRegex.exec(input))) { - sign = match[1] === '-' ? -1 : 1; - duration = { - y: 0, - d: toInt(match[DATE]) * sign, - h: toInt(match[HOUR]) * sign, - m: toInt(match[MINUTE]) * sign, - s: toInt(match[SECOND]) * sign, - ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match - - }; - } else if (!!(match = isoRegex.exec(input))) { - sign = match[1] === '-' ? -1 : match[1] === '+' ? 1 : 1; - duration = { - y: parseIso(match[2], sign), - M: parseIso(match[3], sign), - w: parseIso(match[4], sign), - d: parseIso(match[5], sign), - h: parseIso(match[6], sign), - m: parseIso(match[7], sign), - s: parseIso(match[8], sign) - }; - } else if (duration == null) { - // checks for null or undefined - duration = {}; - } else if (_typeof(duration) === 'object' && ('from' in duration || 'to' in duration)) { - diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to)); - duration = {}; - duration.ms = diffRes.milliseconds; - duration.M = diffRes.months; - } - - ret = new Duration(duration); - - if (isDuration(input) && hasOwnProp(input, '_locale')) { - ret._locale = input._locale; - } - - return ret; - } - - createDuration.fn = Duration.prototype; - createDuration.invalid = createInvalid$1; - - function parseIso(inp, sign) { - // We'd normally use ~~inp for this, but unfortunately it also - // converts floats to ints. - // inp may be undefined, so careful calling replace on it. - var res = inp && parseFloat(inp.replace(',', '.')); // apply sign while we're at it - - return (isNaN(res) ? 0 : res) * sign; - } - - function positiveMomentsDifference(base, other) { - var res = { - milliseconds: 0, - months: 0 - }; - res.months = other.month() - base.month() + (other.year() - base.year()) * 12; - - if (base.clone().add(res.months, 'M').isAfter(other)) { - --res.months; - } - - res.milliseconds = +other - +base.clone().add(res.months, 'M'); - return res; - } - - function momentsDifference(base, other) { - var res; - - if (!(base.isValid() && other.isValid())) { - return { - milliseconds: 0, - months: 0 - }; - } - - other = cloneWithOffset(other, base); - - if (base.isBefore(other)) { - res = positiveMomentsDifference(base, other); - } else { - res = positiveMomentsDifference(other, base); - res.milliseconds = -res.milliseconds; - res.months = -res.months; - } - - return res; - } // TODO: remove 'name' arg after deprecation is removed - - - function createAdder(direction, name) { - return function (val, period) { - var dur, tmp; //invert the arguments, but complain about it - - if (period !== null && !isNaN(+period)) { - deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'); - tmp = val; - val = period; - period = tmp; - } - - val = typeof val === 'string' ? +val : val; - dur = createDuration(val, period); - addSubtract(this, dur, direction); - return this; - }; - } - - function addSubtract(mom, duration, isAdding, updateOffset) { - var milliseconds = duration._milliseconds, - days = absRound(duration._days), - months = absRound(duration._months); - - if (!mom.isValid()) { - // No op - return; - } - - updateOffset = updateOffset == null ? true : updateOffset; - - if (months) { - setMonth(mom, get(mom, 'Month') + months * isAdding); - } - - if (days) { - set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); - } - - if (milliseconds) { - mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); - } - - if (updateOffset) { - hooks.updateOffset(mom, days || months); - } - } - - var add = createAdder(1, 'add'); - var subtract = createAdder(-1, 'subtract'); - - function getCalendarFormat(myMoment, now) { - var diff = myMoment.diff(now, 'days', true); - return diff < -6 ? 'sameElse' : diff < -1 ? 'lastWeek' : diff < 0 ? 'lastDay' : diff < 1 ? 'sameDay' : diff < 2 ? 'nextDay' : diff < 7 ? 'nextWeek' : 'sameElse'; - } - - function calendar$1(time, formats) { - // We want to compare the start of today, vs this. - // Getting start-of-today depends on whether we're local/utc/offset or not. - var now = time || createLocal(), - sod = cloneWithOffset(now, this).startOf('day'), - format = hooks.calendarFormat(this, sod) || 'sameElse'; - var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]); - return this.format(output || this.localeData().calendar(format, this, createLocal(now))); - } - - function clone() { - return new Moment(this); - } - - function isAfter(input, units) { - var localInput = isMoment(input) ? input : createLocal(input); - - if (!(this.isValid() && localInput.isValid())) { - return false; - } - - units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); - - if (units === 'millisecond') { - return this.valueOf() > localInput.valueOf(); - } else { - return localInput.valueOf() < this.clone().startOf(units).valueOf(); - } - } - - function isBefore(input, units) { - var localInput = isMoment(input) ? input : createLocal(input); - - if (!(this.isValid() && localInput.isValid())) { - return false; - } - - units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); - - if (units === 'millisecond') { - return this.valueOf() < localInput.valueOf(); - } else { - return this.clone().endOf(units).valueOf() < localInput.valueOf(); - } - } - - function isBetween(from, to, units, inclusivity) { - inclusivity = inclusivity || '()'; - return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) && (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units)); - } - - function isSame(input, units) { - var localInput = isMoment(input) ? input : createLocal(input), - inputMs; - - if (!(this.isValid() && localInput.isValid())) { - return false; - } - - units = normalizeUnits(units || 'millisecond'); - - if (units === 'millisecond') { - return this.valueOf() === localInput.valueOf(); - } else { - inputMs = localInput.valueOf(); - return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); - } - } - - function isSameOrAfter(input, units) { - return this.isSame(input, units) || this.isAfter(input, units); - } - - function isSameOrBefore(input, units) { - return this.isSame(input, units) || this.isBefore(input, units); - } - - function diff(input, units, asFloat) { - var that, zoneDelta, output; - - if (!this.isValid()) { - return NaN; - } - - that = cloneWithOffset(input, this); - - if (!that.isValid()) { - return NaN; - } - - zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; - units = normalizeUnits(units); - - switch (units) { - case 'year': - output = monthDiff(this, that) / 12; - break; - - case 'month': - output = monthDiff(this, that); - break; - - case 'quarter': - output = monthDiff(this, that) / 3; - break; - - case 'second': - output = (this - that) / 1e3; - break; - // 1000 - - case 'minute': - output = (this - that) / 6e4; - break; - // 1000 * 60 - - case 'hour': - output = (this - that) / 36e5; - break; - // 1000 * 60 * 60 - - case 'day': - output = (this - that - zoneDelta) / 864e5; - break; - // 1000 * 60 * 60 * 24, negate dst - - case 'week': - output = (this - that - zoneDelta) / 6048e5; - break; - // 1000 * 60 * 60 * 24 * 7, negate dst - - default: - output = this - that; - } - - return asFloat ? output : absFloor(output); - } - - function monthDiff(a, b) { - // difference in months - var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()), - // b is in (anchor - 1 month, anchor + 1 month) - anchor = a.clone().add(wholeMonthDiff, 'months'), - anchor2, - adjust; - - if (b - anchor < 0) { - anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); // linear across the month - - adjust = (b - anchor) / (anchor - anchor2); - } else { - anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); // linear across the month - - adjust = (b - anchor) / (anchor2 - anchor); - } //check for negative zero, return zero if negative zero - - - return -(wholeMonthDiff + adjust) || 0; - } - - hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; - hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; - - function toString() { - return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); - } - - function toISOString(keepOffset) { - if (!this.isValid()) { - return null; - } - - var utc = keepOffset !== true; - var m = utc ? this.clone().utc() : this; - - if (m.year() < 0 || m.year() > 9999) { - return formatMoment(m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'); - } - - if (isFunction(Date.prototype.toISOString)) { - // native implementation is ~50x faster, use it when we can - if (utc) { - return this.toDate().toISOString(); - } else { - return new Date(this.valueOf() + this.utcOffset() * 60 * 1000).toISOString().replace('Z', formatMoment(m, 'Z')); - } - } - - return formatMoment(m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'); - } - /** - * Return a human readable representation of a moment that can - * also be evaluated to get a new moment which is the same - * - * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects - */ - - - function inspect() { - if (!this.isValid()) { - return 'moment.invalid(/* ' + this._i + ' */)'; - } - - var func = 'moment'; - var zone = ''; - - if (!this.isLocal()) { - func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; - zone = 'Z'; - } - - var prefix = '[' + func + '("]'; - var year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY'; - var datetime = '-MM-DD[T]HH:mm:ss.SSS'; - var suffix = zone + '[")]'; - return this.format(prefix + year + datetime + suffix); - } - - function format(inputString) { - if (!inputString) { - inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat; - } - - var output = formatMoment(this, inputString); - return this.localeData().postformat(output); - } - - function from(time, withoutSuffix) { - if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) { - return createDuration({ - to: this, - from: time - }).locale(this.locale()).humanize(!withoutSuffix); - } else { - return this.localeData().invalidDate(); - } - } - - function fromNow(withoutSuffix) { - return this.from(createLocal(), withoutSuffix); - } - - function to(time, withoutSuffix) { - if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) { - return createDuration({ - from: this, - to: time - }).locale(this.locale()).humanize(!withoutSuffix); - } else { - return this.localeData().invalidDate(); - } - } + if (isPm && hour < 12) { + hour += 12; + } + + if (!isPm && hour === 12) { + hour = 0; + } + + return hour; + } else { + // this is not supposed to happen + return hour; + } + } // date from string and array of format strings + + + function configFromStringAndArray(config) { + var tempConfig, bestMoment, scoreToBeat, i, currentScore; + + if (config._f.length === 0) { + getParsingFlags(config).invalidFormat = true; + config._d = new Date(NaN); + return; + } + + for (i = 0; i < config._f.length; i++) { + currentScore = 0; + tempConfig = copyConfig({}, config); + + if (config._useUTC != null) { + tempConfig._useUTC = config._useUTC; + } + + tempConfig._f = config._f[i]; + configFromStringAndFormat(tempConfig); + + if (!isValid(tempConfig)) { + continue; + } // if there is any input that was not parsed add a penalty for that format + + + currentScore += getParsingFlags(tempConfig).charsLeftOver; //or tokens + + currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; + getParsingFlags(tempConfig).score = currentScore; + + if (scoreToBeat == null || currentScore < scoreToBeat) { + scoreToBeat = currentScore; + bestMoment = tempConfig; + } + } + + extend(config, bestMoment || tempConfig); + } + + function configFromObject(config) { + if (config._d) { + return; + } + + var i = normalizeObjectUnits(config._i); + config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) { + return obj && parseInt(obj, 10); + }); + configFromArray(config); + } + + function createFromConfig(config) { + var res = new Moment(checkOverflow(prepareConfig(config))); + + if (res._nextDay) { + // Adding is smart enough around DST + res.add(1, 'd'); + res._nextDay = undefined; + } + + return res; + } + + function prepareConfig(config) { + var input = config._i, + format = config._f; + config._locale = config._locale || getLocale(config._l); + + if (input === null || format === undefined && input === '') { + return createInvalid({ + nullInput: true + }); + } + + if (typeof input === 'string') { + config._i = input = config._locale.preparse(input); + } + + if (isMoment(input)) { + return new Moment(checkOverflow(input)); + } else if (isDate(input)) { + config._d = input; + } else if (isArray(format)) { + configFromStringAndArray(config); + } else if (format) { + configFromStringAndFormat(config); + } else { + configFromInput(config); + } + + if (!isValid(config)) { + config._d = null; + } + + return config; + } + + function configFromInput(config) { + var input = config._i; + + if (isUndefined(input)) { + config._d = new Date(hooks.now()); + } else if (isDate(input)) { + config._d = new Date(input.valueOf()); + } else if (typeof input === 'string') { + configFromString(config); + } else if (isArray(input)) { + config._a = map(input.slice(0), function (obj) { + return parseInt(obj, 10); + }); + configFromArray(config); + } else if (isObject(input)) { + configFromObject(config); + } else if (isNumber(input)) { + // from milliseconds + config._d = new Date(input); + } else { + hooks.createFromInputFallback(config); + } + } + + function createLocalOrUTC(input, format, locale, strict, isUTC) { + var c = {}; + + if (locale === true || locale === false) { + strict = locale; + locale = undefined; + } + + if (isObject(input) && isObjectEmpty(input) || isArray(input) && input.length === 0) { + input = undefined; + } // object construction must be done this way. + // https://github.com/moment/moment/issues/1423 + + + c._isAMomentObject = true; + c._useUTC = c._isUTC = isUTC; + c._l = locale; + c._i = input; + c._f = format; + c._strict = strict; + return createFromConfig(c); + } + + function createLocal(input, format, locale, strict) { + return createLocalOrUTC(input, format, locale, strict, false); + } + + var prototypeMin = deprecate('moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', function () { + var other = createLocal.apply(null, arguments); + + if (this.isValid() && other.isValid()) { + return other < this ? this : other; + } else { + return createInvalid(); + } + }); + var prototypeMax = deprecate('moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', function () { + var other = createLocal.apply(null, arguments); + + if (this.isValid() && other.isValid()) { + return other > this ? this : other; + } else { + return createInvalid(); + } + }); // Pick a moment m from moments so that m[fn](other) is true for all + // other. This relies on the function fn to be transitive. + // + // moments should either be an array of moment objects or an array, whose + // first element is an array of moment objects. + + function pickBy(fn, moments) { + var res, i; + + if (moments.length === 1 && isArray(moments[0])) { + moments = moments[0]; + } + + if (!moments.length) { + return createLocal(); + } + + res = moments[0]; + + for (i = 1; i < moments.length; ++i) { + if (!moments[i].isValid() || moments[i][fn](res)) { + res = moments[i]; + } + } + + return res; + } // TODO: Use [].sort instead? + + + function min() { + var args = [].slice.call(arguments, 0); + return pickBy('isBefore', args); + } + + function max() { + var args = [].slice.call(arguments, 0); + return pickBy('isAfter', args); + } + + var now = function now() { + return Date.now ? Date.now() : +new Date(); + }; + + var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond']; + + function isDurationValid(m) { + for (var key in m) { + if (!(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) { + return false; + } + } + + var unitHasDecimal = false; + + for (var i = 0; i < ordering.length; ++i) { + if (m[ordering[i]]) { + if (unitHasDecimal) { + return false; // only allow non-integers for smallest unit + } + + if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) { + unitHasDecimal = true; + } + } + } + + return true; + } + + function isValid$1() { + return this._isValid; + } + + function createInvalid$1() { + return createDuration(NaN); + } + + function Duration(duration) { + var normalizedInput = normalizeObjectUnits(duration), + years = normalizedInput.year || 0, + quarters = normalizedInput.quarter || 0, + months = normalizedInput.month || 0, + weeks = normalizedInput.week || 0, + days = normalizedInput.day || 0, + hours = normalizedInput.hour || 0, + minutes = normalizedInput.minute || 0, + seconds = normalizedInput.second || 0, + milliseconds = normalizedInput.millisecond || 0; + this._isValid = isDurationValid(normalizedInput); // representation for dateAddRemove + + this._milliseconds = +milliseconds + seconds * 1e3 + // 1000 + minutes * 6e4 + // 1000 * 60 + hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 + // Because of dateAddRemove treats 24 hours as different from a + // day when working around DST, we need to store them separately + + this._days = +days + weeks * 7; // It is impossible to translate months into days without knowing + // which months you are are talking about, so we have to store + // it separately. + + this._months = +months + quarters * 3 + years * 12; + this._data = {}; + this._locale = getLocale(); + + this._bubble(); + } + + function isDuration(obj) { + return obj instanceof Duration; + } + + function absRound(number) { + if (number < 0) { + return Math.round(-1 * number) * -1; + } else { + return Math.round(number); + } + } // FORMATTING + + + function offset(token, separator) { + addFormatToken(token, 0, 0, function () { + var offset = this.utcOffset(); + var sign = '+'; + + if (offset < 0) { + offset = -offset; + sign = '-'; + } + + return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~offset % 60, 2); + }); + } + + offset('Z', ':'); + offset('ZZ', ''); // PARSING + + addRegexToken('Z', matchShortOffset); + addRegexToken('ZZ', matchShortOffset); + addParseToken(['Z', 'ZZ'], function (input, array, config) { + config._useUTC = true; + config._tzm = offsetFromString(matchShortOffset, input); + }); // HELPERS + // timezone chunker + // '+10:00' > ['10', '00'] + // '-1530' > ['-15', '30'] + + var chunkOffset = /([\+\-]|\d\d)/gi; + + function offsetFromString(matcher, string) { + var matches = (string || '').match(matcher); + + if (matches === null) { + return null; + } + + var chunk = matches[matches.length - 1] || []; + var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; + var minutes = +(parts[1] * 60) + toInt(parts[2]); + return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes; + } // Return a moment from input, that is local/utc/zone equivalent to model. + + + function cloneWithOffset(input, model) { + var res, diff; + + if (model._isUTC) { + res = model.clone(); + diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); // Use low-level api, because this fn is low-level api. + + res._d.setTime(res._d.valueOf() + diff); + + hooks.updateOffset(res, false); + return res; + } else { + return createLocal(input).local(); + } + } + + function getDateOffset(m) { + // On Firefox.24 Date#getTimezoneOffset returns a floating point. + // https://github.com/moment/moment/pull/1871 + return -Math.round(m._d.getTimezoneOffset() / 15) * 15; + } // HOOKS + // This function will be called whenever a moment is mutated. + // It is intended to keep the offset in sync with the timezone. + + + hooks.updateOffset = function () {}; // MOMENTS + // keepLocalTime = true means only change the timezone, without + // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> + // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset + // +0200, so we adjust the time as needed, to be valid. + // + // Keeping the time actually adds/subtracts (one hour) + // from the actual represented time. That is why we call updateOffset + // a second time. In case it wants us to change the offset again + // _changeInProgress == true case, then we have to adjust, because + // there is no such time in the given timezone. + + + function getSetOffset(input, keepLocalTime, keepMinutes) { + var offset = this._offset || 0, + localAdjust; + + if (!this.isValid()) { + return input != null ? this : NaN; + } + + if (input != null) { + if (typeof input === 'string') { + input = offsetFromString(matchShortOffset, input); + + if (input === null) { + return this; + } + } else if (Math.abs(input) < 16 && !keepMinutes) { + input = input * 60; + } + + if (!this._isUTC && keepLocalTime) { + localAdjust = getDateOffset(this); + } + + this._offset = input; + this._isUTC = true; + + if (localAdjust != null) { + this.add(localAdjust, 'm'); + } + + if (offset !== input) { + if (!keepLocalTime || this._changeInProgress) { + addSubtract(this, createDuration(input - offset, 'm'), 1, false); + } else if (!this._changeInProgress) { + this._changeInProgress = true; + hooks.updateOffset(this, true); + this._changeInProgress = null; + } + } + + return this; + } else { + return this._isUTC ? offset : getDateOffset(this); + } + } + + function getSetZone(input, keepLocalTime) { + if (input != null) { + if (typeof input !== 'string') { + input = -input; + } + + this.utcOffset(input, keepLocalTime); + return this; + } else { + return -this.utcOffset(); + } + } + + function setOffsetToUTC(keepLocalTime) { + return this.utcOffset(0, keepLocalTime); + } + + function setOffsetToLocal(keepLocalTime) { + if (this._isUTC) { + this.utcOffset(0, keepLocalTime); + this._isUTC = false; + + if (keepLocalTime) { + this.subtract(getDateOffset(this), 'm'); + } + } + + return this; + } + + function setOffsetToParsedOffset() { + if (this._tzm != null) { + this.utcOffset(this._tzm, false, true); + } else if (typeof this._i === 'string') { + var tZone = offsetFromString(matchOffset, this._i); + + if (tZone != null) { + this.utcOffset(tZone); + } else { + this.utcOffset(0, true); + } + } + + return this; + } + + function hasAlignedHourOffset(input) { + if (!this.isValid()) { + return false; + } + + input = input ? createLocal(input).utcOffset() : 0; + return (this.utcOffset() - input) % 60 === 0; + } + + function isDaylightSavingTime() { + return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset(); + } + + function isDaylightSavingTimeShifted() { + if (!isUndefined(this._isDSTShifted)) { + return this._isDSTShifted; + } + + var c = {}; + copyConfig(c, this); + c = prepareConfig(c); + + if (c._a) { + var other = c._isUTC ? createUTC(c._a) : createLocal(c._a); + this._isDSTShifted = this.isValid() && compareArrays(c._a, other.toArray()) > 0; + } else { + this._isDSTShifted = false; + } + + return this._isDSTShifted; + } + + function isLocal() { + return this.isValid() ? !this._isUTC : false; + } + + function isUtcOffset() { + return this.isValid() ? this._isUTC : false; + } + + function isUtc() { + return this.isValid() ? this._isUTC && this._offset === 0 : false; + } // ASP.NET json date format regex + + + var aspNetRegex = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/; // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html + // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere + // and further modified to allow for strings containing both week and day + + var isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; + + function createDuration(input, key) { + var duration = input, + // matching against regexp is expensive, do it on demand + match = null, + sign, + ret, + diffRes; + + if (isDuration(input)) { + duration = { + ms: input._milliseconds, + d: input._days, + M: input._months + }; + } else if (isNumber(input)) { + duration = {}; + + if (key) { + duration[key] = input; + } else { + duration.milliseconds = input; + } + } else if (!!(match = aspNetRegex.exec(input))) { + sign = match[1] === '-' ? -1 : 1; + duration = { + y: 0, + d: toInt(match[DATE]) * sign, + h: toInt(match[HOUR]) * sign, + m: toInt(match[MINUTE]) * sign, + s: toInt(match[SECOND]) * sign, + ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match + + }; + } else if (!!(match = isoRegex.exec(input))) { + sign = match[1] === '-' ? -1 : match[1] === '+' ? 1 : 1; + duration = { + y: parseIso(match[2], sign), + M: parseIso(match[3], sign), + w: parseIso(match[4], sign), + d: parseIso(match[5], sign), + h: parseIso(match[6], sign), + m: parseIso(match[7], sign), + s: parseIso(match[8], sign) + }; + } else if (duration == null) { + // checks for null or undefined + duration = {}; + } else if (_typeof(duration) === 'object' && ('from' in duration || 'to' in duration)) { + diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to)); + duration = {}; + duration.ms = diffRes.milliseconds; + duration.M = diffRes.months; + } + + ret = new Duration(duration); + + if (isDuration(input) && hasOwnProp(input, '_locale')) { + ret._locale = input._locale; + } + + return ret; + } + + createDuration.fn = Duration.prototype; + createDuration.invalid = createInvalid$1; + + function parseIso(inp, sign) { + // We'd normally use ~~inp for this, but unfortunately it also + // converts floats to ints. + // inp may be undefined, so careful calling replace on it. + var res = inp && parseFloat(inp.replace(',', '.')); // apply sign while we're at it + + return (isNaN(res) ? 0 : res) * sign; + } + + function positiveMomentsDifference(base, other) { + var res = { + milliseconds: 0, + months: 0 + }; + res.months = other.month() - base.month() + (other.year() - base.year()) * 12; + + if (base.clone().add(res.months, 'M').isAfter(other)) { + --res.months; + } + + res.milliseconds = +other - +base.clone().add(res.months, 'M'); + return res; + } + + function momentsDifference(base, other) { + var res; + + if (!(base.isValid() && other.isValid())) { + return { + milliseconds: 0, + months: 0 + }; + } + + other = cloneWithOffset(other, base); + + if (base.isBefore(other)) { + res = positiveMomentsDifference(base, other); + } else { + res = positiveMomentsDifference(other, base); + res.milliseconds = -res.milliseconds; + res.months = -res.months; + } + + return res; + } // TODO: remove 'name' arg after deprecation is removed + + + function createAdder(direction, name) { + return function (val, period) { + var dur, tmp; //invert the arguments, but complain about it + + if (period !== null && !isNaN(+period)) { + deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'); + tmp = val; + val = period; + period = tmp; + } + + val = typeof val === 'string' ? +val : val; + dur = createDuration(val, period); + addSubtract(this, dur, direction); + return this; + }; + } + + function addSubtract(mom, duration, isAdding, updateOffset) { + var milliseconds = duration._milliseconds, + days = absRound(duration._days), + months = absRound(duration._months); + + if (!mom.isValid()) { + // No op + return; + } + + updateOffset = updateOffset == null ? true : updateOffset; + + if (months) { + setMonth(mom, get(mom, 'Month') + months * isAdding); + } + + if (days) { + set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); + } + + if (milliseconds) { + mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); + } + + if (updateOffset) { + hooks.updateOffset(mom, days || months); + } + } + + var add = createAdder(1, 'add'); + var subtract = createAdder(-1, 'subtract'); + + function getCalendarFormat(myMoment, now) { + var diff = myMoment.diff(now, 'days', true); + return diff < -6 ? 'sameElse' : diff < -1 ? 'lastWeek' : diff < 0 ? 'lastDay' : diff < 1 ? 'sameDay' : diff < 2 ? 'nextDay' : diff < 7 ? 'nextWeek' : 'sameElse'; + } + + function calendar$1(time, formats) { + // We want to compare the start of today, vs this. + // Getting start-of-today depends on whether we're local/utc/offset or not. + var now = time || createLocal(), + sod = cloneWithOffset(now, this).startOf('day'), + format = hooks.calendarFormat(this, sod) || 'sameElse'; + var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]); + return this.format(output || this.localeData().calendar(format, this, createLocal(now))); + } + + function clone() { + return new Moment(this); + } + + function isAfter(input, units) { + var localInput = isMoment(input) ? input : createLocal(input); + + if (!(this.isValid() && localInput.isValid())) { + return false; + } + + units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); + + if (units === 'millisecond') { + return this.valueOf() > localInput.valueOf(); + } else { + return localInput.valueOf() < this.clone().startOf(units).valueOf(); + } + } + + function isBefore(input, units) { + var localInput = isMoment(input) ? input : createLocal(input); + + if (!(this.isValid() && localInput.isValid())) { + return false; + } + + units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); + + if (units === 'millisecond') { + return this.valueOf() < localInput.valueOf(); + } else { + return this.clone().endOf(units).valueOf() < localInput.valueOf(); + } + } + + function isBetween(from, to, units, inclusivity) { + inclusivity = inclusivity || '()'; + return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) && (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units)); + } + + function isSame(input, units) { + var localInput = isMoment(input) ? input : createLocal(input), + inputMs; + + if (!(this.isValid() && localInput.isValid())) { + return false; + } + + units = normalizeUnits(units || 'millisecond'); + + if (units === 'millisecond') { + return this.valueOf() === localInput.valueOf(); + } else { + inputMs = localInput.valueOf(); + return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); + } + } + + function isSameOrAfter(input, units) { + return this.isSame(input, units) || this.isAfter(input, units); + } + + function isSameOrBefore(input, units) { + return this.isSame(input, units) || this.isBefore(input, units); + } + + function diff(input, units, asFloat) { + var that, zoneDelta, output; + + if (!this.isValid()) { + return NaN; + } + + that = cloneWithOffset(input, this); + + if (!that.isValid()) { + return NaN; + } + + zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; + units = normalizeUnits(units); + + switch (units) { + case 'year': + output = monthDiff(this, that) / 12; + break; + + case 'month': + output = monthDiff(this, that); + break; + + case 'quarter': + output = monthDiff(this, that) / 3; + break; + + case 'second': + output = (this - that) / 1e3; + break; + // 1000 + + case 'minute': + output = (this - that) / 6e4; + break; + // 1000 * 60 + + case 'hour': + output = (this - that) / 36e5; + break; + // 1000 * 60 * 60 + + case 'day': + output = (this - that - zoneDelta) / 864e5; + break; + // 1000 * 60 * 60 * 24, negate dst + + case 'week': + output = (this - that - zoneDelta) / 6048e5; + break; + // 1000 * 60 * 60 * 24 * 7, negate dst + + default: + output = this - that; + } + + return asFloat ? output : absFloor(output); + } + + function monthDiff(a, b) { + // difference in months + var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()), + // b is in (anchor - 1 month, anchor + 1 month) + anchor = a.clone().add(wholeMonthDiff, 'months'), + anchor2, + adjust; + + if (b - anchor < 0) { + anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); // linear across the month + + adjust = (b - anchor) / (anchor - anchor2); + } else { + anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); // linear across the month + + adjust = (b - anchor) / (anchor2 - anchor); + } //check for negative zero, return zero if negative zero + + + return -(wholeMonthDiff + adjust) || 0; + } + + hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; + hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; + + function toString() { + return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); + } + + function toISOString(keepOffset) { + if (!this.isValid()) { + return null; + } + + var utc = keepOffset !== true; + var m = utc ? this.clone().utc() : this; + + if (m.year() < 0 || m.year() > 9999) { + return formatMoment(m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'); + } + + if (isFunction(Date.prototype.toISOString)) { + // native implementation is ~50x faster, use it when we can + if (utc) { + return this.toDate().toISOString(); + } else { + return new Date(this.valueOf() + this.utcOffset() * 60 * 1000).toISOString().replace('Z', formatMoment(m, 'Z')); + } + } + + return formatMoment(m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'); + } + /** + * Return a human readable representation of a moment that can + * also be evaluated to get a new moment which is the same + * + * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects + */ + + + function inspect() { + if (!this.isValid()) { + return 'moment.invalid(/* ' + this._i + ' */)'; + } + + var func = 'moment'; + var zone = ''; + + if (!this.isLocal()) { + func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; + zone = 'Z'; + } + + var prefix = '[' + func + '("]'; + var year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY'; + var datetime = '-MM-DD[T]HH:mm:ss.SSS'; + var suffix = zone + '[")]'; + return this.format(prefix + year + datetime + suffix); + } + + function format(inputString) { + if (!inputString) { + inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat; + } + + var output = formatMoment(this, inputString); + return this.localeData().postformat(output); + } + + function from(time, withoutSuffix) { + if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) { + return createDuration({ + to: this, + from: time + }).locale(this.locale()).humanize(!withoutSuffix); + } else { + return this.localeData().invalidDate(); + } + } + + function fromNow(withoutSuffix) { + return this.from(createLocal(), withoutSuffix); + } + + function to(time, withoutSuffix) { + if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) { + return createDuration({ + from: this, + to: time + }).locale(this.locale()).humanize(!withoutSuffix); + } else { + return this.localeData().invalidDate(); + } + } - function toNow(withoutSuffix) { - return this.to(createLocal(), withoutSuffix); - } // If passed a locale key, it will set the locale for this - // instance. Otherwise, it will return the locale configuration - // variables for this instance. - - - function locale(key) { - var newLocaleData; - - if (key === undefined) { - return this._locale._abbr; - } else { - newLocaleData = getLocale(key); - - if (newLocaleData != null) { - this._locale = newLocaleData; - } - - return this; - } - } - - var lang = deprecate('moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', function (key) { - if (key === undefined) { - return this.localeData(); - } else { - return this.locale(key); - } - }); - - function localeData() { - return this._locale; - } - - function startOf(units) { - units = normalizeUnits(units); // the following switch intentionally omits break keywords - // to utilize falling through the cases. - - switch (units) { - case 'year': - this.month(0); - - /* falls through */ - - case 'quarter': - case 'month': - this.date(1); - - /* falls through */ - - case 'week': - case 'isoWeek': - case 'day': - case 'date': - this.hours(0); - - /* falls through */ - - case 'hour': - this.minutes(0); - - /* falls through */ - - case 'minute': - this.seconds(0); - - /* falls through */ - - case 'second': - this.milliseconds(0); - } // weeks are a special case - - - if (units === 'week') { - this.weekday(0); - } - - if (units === 'isoWeek') { - this.isoWeekday(1); - } // quarters are also special - - - if (units === 'quarter') { - this.month(Math.floor(this.month() / 3) * 3); - } - - return this; - } - - function endOf(units) { - units = normalizeUnits(units); - - if (units === undefined || units === 'millisecond') { - return this; - } // 'date' is an alias for 'day', so it should be considered as such. - - - if (units === 'date') { - units = 'day'; - } - - return this.startOf(units).add(1, units === 'isoWeek' ? 'week' : units).subtract(1, 'ms'); - } - - function valueOf() { - return this._d.valueOf() - (this._offset || 0) * 60000; - } - - function unix() { - return Math.floor(this.valueOf() / 1000); - } - - function toDate() { - return new Date(this.valueOf()); - } - - function toArray() { - var m = this; - return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]; - } - - function toObject() { - var m = this; - return { - years: m.year(), - months: m.month(), - date: m.date(), - hours: m.hours(), - minutes: m.minutes(), - seconds: m.seconds(), - milliseconds: m.milliseconds() - }; - } + function toNow(withoutSuffix) { + return this.to(createLocal(), withoutSuffix); + } // If passed a locale key, it will set the locale for this + // instance. Otherwise, it will return the locale configuration + // variables for this instance. + + + function locale(key) { + var newLocaleData; + + if (key === undefined) { + return this._locale._abbr; + } else { + newLocaleData = getLocale(key); + + if (newLocaleData != null) { + this._locale = newLocaleData; + } + + return this; + } + } + + var lang = deprecate('moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', function (key) { + if (key === undefined) { + return this.localeData(); + } else { + return this.locale(key); + } + }); + + function localeData() { + return this._locale; + } + + function startOf(units) { + units = normalizeUnits(units); // the following switch intentionally omits break keywords + // to utilize falling through the cases. + + switch (units) { + case 'year': + this.month(0); + + /* falls through */ + + case 'quarter': + case 'month': + this.date(1); + + /* falls through */ + + case 'week': + case 'isoWeek': + case 'day': + case 'date': + this.hours(0); + + /* falls through */ + + case 'hour': + this.minutes(0); + + /* falls through */ + + case 'minute': + this.seconds(0); + + /* falls through */ + + case 'second': + this.milliseconds(0); + } // weeks are a special case + + + if (units === 'week') { + this.weekday(0); + } + + if (units === 'isoWeek') { + this.isoWeekday(1); + } // quarters are also special + + + if (units === 'quarter') { + this.month(Math.floor(this.month() / 3) * 3); + } + + return this; + } + + function endOf(units) { + units = normalizeUnits(units); + + if (units === undefined || units === 'millisecond') { + return this; + } // 'date' is an alias for 'day', so it should be considered as such. + + + if (units === 'date') { + units = 'day'; + } + + return this.startOf(units).add(1, units === 'isoWeek' ? 'week' : units).subtract(1, 'ms'); + } + + function valueOf() { + return this._d.valueOf() - (this._offset || 0) * 60000; + } + + function unix() { + return Math.floor(this.valueOf() / 1000); + } + + function toDate() { + return new Date(this.valueOf()); + } + + function toArray() { + var m = this; + return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]; + } + + function toObject() { + var m = this; + return { + years: m.year(), + months: m.month(), + date: m.date(), + hours: m.hours(), + minutes: m.minutes(), + seconds: m.seconds(), + milliseconds: m.milliseconds() + }; + } - function toJSON() { - // new Date(NaN).toJSON() === null - return this.isValid() ? this.toISOString() : null; - } - - function isValid$2() { - return isValid(this); - } - - function parsingFlags() { - return extend({}, getParsingFlags(this)); - } + function toJSON() { + // new Date(NaN).toJSON() === null + return this.isValid() ? this.toISOString() : null; + } + + function isValid$2() { + return isValid(this); + } + + function parsingFlags() { + return extend({}, getParsingFlags(this)); + } - function invalidAt() { - return getParsingFlags(this).overflow; - } - - function creationData() { - return { - input: this._i, - format: this._f, - locale: this._locale, - isUTC: this._isUTC, - strict: this._strict - }; - } // FORMATTING + function invalidAt() { + return getParsingFlags(this).overflow; + } + + function creationData() { + return { + input: this._i, + format: this._f, + locale: this._locale, + isUTC: this._isUTC, + strict: this._strict + }; + } // FORMATTING - addFormatToken(0, ['gg', 2], 0, function () { - return this.weekYear() % 100; - }); - addFormatToken(0, ['GG', 2], 0, function () { - return this.isoWeekYear() % 100; - }); - - function addWeekYearFormatToken(token, getter) { - addFormatToken(0, [token, token.length], 0, getter); - } - - addWeekYearFormatToken('gggg', 'weekYear'); - addWeekYearFormatToken('ggggg', 'weekYear'); - addWeekYearFormatToken('GGGG', 'isoWeekYear'); - addWeekYearFormatToken('GGGGG', 'isoWeekYear'); // ALIASES - - addUnitAlias('weekYear', 'gg'); - addUnitAlias('isoWeekYear', 'GG'); // PRIORITY - - addUnitPriority('weekYear', 1); - addUnitPriority('isoWeekYear', 1); // PARSING - - addRegexToken('G', matchSigned); - addRegexToken('g', matchSigned); - addRegexToken('GG', match1to2, match2); - addRegexToken('gg', match1to2, match2); - addRegexToken('GGGG', match1to4, match4); - addRegexToken('gggg', match1to4, match4); - addRegexToken('GGGGG', match1to6, match6); - addRegexToken('ggggg', match1to6, match6); - addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) { - week[token.substr(0, 2)] = toInt(input); - }); - addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { - week[token] = hooks.parseTwoDigitYear(input); - }); // MOMENTS - - function getSetWeekYear(input) { - return getSetWeekYearHelper.call(this, input, this.week(), this.weekday(), this.localeData()._week.dow, this.localeData()._week.doy); - } - - function getSetISOWeekYear(input) { - return getSetWeekYearHelper.call(this, input, this.isoWeek(), this.isoWeekday(), 1, 4); - } - - function getISOWeeksInYear() { - return weeksInYear(this.year(), 1, 4); - } + addFormatToken(0, ['gg', 2], 0, function () { + return this.weekYear() % 100; + }); + addFormatToken(0, ['GG', 2], 0, function () { + return this.isoWeekYear() % 100; + }); + + function addWeekYearFormatToken(token, getter) { + addFormatToken(0, [token, token.length], 0, getter); + } + + addWeekYearFormatToken('gggg', 'weekYear'); + addWeekYearFormatToken('ggggg', 'weekYear'); + addWeekYearFormatToken('GGGG', 'isoWeekYear'); + addWeekYearFormatToken('GGGGG', 'isoWeekYear'); // ALIASES + + addUnitAlias('weekYear', 'gg'); + addUnitAlias('isoWeekYear', 'GG'); // PRIORITY + + addUnitPriority('weekYear', 1); + addUnitPriority('isoWeekYear', 1); // PARSING + + addRegexToken('G', matchSigned); + addRegexToken('g', matchSigned); + addRegexToken('GG', match1to2, match2); + addRegexToken('gg', match1to2, match2); + addRegexToken('GGGG', match1to4, match4); + addRegexToken('gggg', match1to4, match4); + addRegexToken('GGGGG', match1to6, match6); + addRegexToken('ggggg', match1to6, match6); + addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) { + week[token.substr(0, 2)] = toInt(input); + }); + addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { + week[token] = hooks.parseTwoDigitYear(input); + }); // MOMENTS + + function getSetWeekYear(input) { + return getSetWeekYearHelper.call(this, input, this.week(), this.weekday(), this.localeData()._week.dow, this.localeData()._week.doy); + } + + function getSetISOWeekYear(input) { + return getSetWeekYearHelper.call(this, input, this.isoWeek(), this.isoWeekday(), 1, 4); + } + + function getISOWeeksInYear() { + return weeksInYear(this.year(), 1, 4); + } - function getWeeksInYear() { - var weekInfo = this.localeData()._week; + function getWeeksInYear() { + var weekInfo = this.localeData()._week; - return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); - } + return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); + } - function getSetWeekYearHelper(input, week, weekday, dow, doy) { - var weeksTarget; + function getSetWeekYearHelper(input, week, weekday, dow, doy) { + var weeksTarget; - if (input == null) { - return weekOfYear(this, dow, doy).year; - } else { - weeksTarget = weeksInYear(input, dow, doy); + if (input == null) { + return weekOfYear(this, dow, doy).year; + } else { + weeksTarget = weeksInYear(input, dow, doy); - if (week > weeksTarget) { - week = weeksTarget; - } + if (week > weeksTarget) { + week = weeksTarget; + } - return setWeekAll.call(this, input, week, weekday, dow, doy); - } - } + return setWeekAll.call(this, input, week, weekday, dow, doy); + } + } - function setWeekAll(weekYear, week, weekday, dow, doy) { - var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), - date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); - this.year(date.getUTCFullYear()); - this.month(date.getUTCMonth()); - this.date(date.getUTCDate()); - return this; - } // FORMATTING - - - addFormatToken('Q', 0, 'Qo', 'quarter'); // ALIASES - - addUnitAlias('quarter', 'Q'); // PRIORITY - - addUnitPriority('quarter', 7); // PARSING - - addRegexToken('Q', match1); - addParseToken('Q', function (input, array) { - array[MONTH] = (toInt(input) - 1) * 3; - }); // MOMENTS - - function getSetQuarter(input) { - return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); - } // FORMATTING + function setWeekAll(weekYear, week, weekday, dow, doy) { + var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), + date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); + this.year(date.getUTCFullYear()); + this.month(date.getUTCMonth()); + this.date(date.getUTCDate()); + return this; + } // FORMATTING + + + addFormatToken('Q', 0, 'Qo', 'quarter'); // ALIASES + + addUnitAlias('quarter', 'Q'); // PRIORITY + + addUnitPriority('quarter', 7); // PARSING + + addRegexToken('Q', match1); + addParseToken('Q', function (input, array) { + array[MONTH] = (toInt(input) - 1) * 3; + }); // MOMENTS + + function getSetQuarter(input) { + return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); + } // FORMATTING - addFormatToken('D', ['DD', 2], 'Do', 'date'); // ALIASES + addFormatToken('D', ['DD', 2], 'Do', 'date'); // ALIASES - addUnitAlias('date', 'D'); // PRIORITY - - addUnitPriority('date', 9); // PARSING + addUnitAlias('date', 'D'); // PRIORITY + + addUnitPriority('date', 9); // PARSING - addRegexToken('D', match1to2); - addRegexToken('DD', match1to2, match2); - addRegexToken('Do', function (isStrict, locale) { - // TODO: Remove "ordinalParse" fallback in next major release. - return isStrict ? locale._dayOfMonthOrdinalParse || locale._ordinalParse : locale._dayOfMonthOrdinalParseLenient; - }); - addParseToken(['D', 'DD'], DATE); - addParseToken('Do', function (input, array) { - array[DATE] = toInt(input.match(match1to2)[0]); - }); // MOMENTS + addRegexToken('D', match1to2); + addRegexToken('DD', match1to2, match2); + addRegexToken('Do', function (isStrict, locale) { + // TODO: Remove "ordinalParse" fallback in next major release. + return isStrict ? locale._dayOfMonthOrdinalParse || locale._ordinalParse : locale._dayOfMonthOrdinalParseLenient; + }); + addParseToken(['D', 'DD'], DATE); + addParseToken('Do', function (input, array) { + array[DATE] = toInt(input.match(match1to2)[0]); + }); // MOMENTS - var getSetDayOfMonth = makeGetSet('Date', true); // FORMATTING + var getSetDayOfMonth = makeGetSet('Date', true); // FORMATTING - addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); // ALIASES + addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); // ALIASES - addUnitAlias('dayOfYear', 'DDD'); // PRIORITY + addUnitAlias('dayOfYear', 'DDD'); // PRIORITY - addUnitPriority('dayOfYear', 4); // PARSING + addUnitPriority('dayOfYear', 4); // PARSING - addRegexToken('DDD', match1to3); - addRegexToken('DDDD', match3); - addParseToken(['DDD', 'DDDD'], function (input, array, config) { - config._dayOfYear = toInt(input); - }); // HELPERS - // MOMENTS + addRegexToken('DDD', match1to3); + addRegexToken('DDDD', match3); + addParseToken(['DDD', 'DDDD'], function (input, array, config) { + config._dayOfYear = toInt(input); + }); // HELPERS + // MOMENTS - function getSetDayOfYear(input) { - var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1; - return input == null ? dayOfYear : this.add(input - dayOfYear, 'd'); - } // FORMATTING + function getSetDayOfYear(input) { + var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1; + return input == null ? dayOfYear : this.add(input - dayOfYear, 'd'); + } // FORMATTING - addFormatToken('m', ['mm', 2], 0, 'minute'); // ALIASES + addFormatToken('m', ['mm', 2], 0, 'minute'); // ALIASES - addUnitAlias('minute', 'm'); // PRIORITY + addUnitAlias('minute', 'm'); // PRIORITY - addUnitPriority('minute', 14); // PARSING + addUnitPriority('minute', 14); // PARSING - addRegexToken('m', match1to2); - addRegexToken('mm', match1to2, match2); - addParseToken(['m', 'mm'], MINUTE); // MOMENTS - - var getSetMinute = makeGetSet('Minutes', false); // FORMATTING - - addFormatToken('s', ['ss', 2], 0, 'second'); // ALIASES - - addUnitAlias('second', 's'); // PRIORITY - - addUnitPriority('second', 15); // PARSING - - addRegexToken('s', match1to2); - addRegexToken('ss', match1to2, match2); - addParseToken(['s', 'ss'], SECOND); // MOMENTS - - var getSetSecond = makeGetSet('Seconds', false); // FORMATTING - - addFormatToken('S', 0, 0, function () { - return ~~(this.millisecond() / 100); - }); - addFormatToken(0, ['SS', 2], 0, function () { - return ~~(this.millisecond() / 10); - }); - addFormatToken(0, ['SSS', 3], 0, 'millisecond'); - addFormatToken(0, ['SSSS', 4], 0, function () { - return this.millisecond() * 10; - }); - addFormatToken(0, ['SSSSS', 5], 0, function () { - return this.millisecond() * 100; - }); - addFormatToken(0, ['SSSSSS', 6], 0, function () { - return this.millisecond() * 1000; - }); - addFormatToken(0, ['SSSSSSS', 7], 0, function () { - return this.millisecond() * 10000; - }); - addFormatToken(0, ['SSSSSSSS', 8], 0, function () { - return this.millisecond() * 100000; - }); - addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { - return this.millisecond() * 1000000; - }); // ALIASES - - addUnitAlias('millisecond', 'ms'); // PRIORITY - - addUnitPriority('millisecond', 16); // PARSING - - addRegexToken('S', match1to3, match1); - addRegexToken('SS', match1to3, match2); - addRegexToken('SSS', match1to3, match3); - var token; - - for (token = 'SSSS'; token.length <= 9; token += 'S') { - addRegexToken(token, matchUnsigned); - } - - function parseMs(input, array) { - array[MILLISECOND] = toInt(('0.' + input) * 1000); - } - - for (token = 'S'; token.length <= 9; token += 'S') { - addParseToken(token, parseMs); - } // MOMENTS - - - var getSetMillisecond = makeGetSet('Milliseconds', false); // FORMATTING - - addFormatToken('z', 0, 0, 'zoneAbbr'); - addFormatToken('zz', 0, 0, 'zoneName'); // MOMENTS - - function getZoneAbbr() { - return this._isUTC ? 'UTC' : ''; - } - - function getZoneName() { - return this._isUTC ? 'Coordinated Universal Time' : ''; - } - - var proto = Moment.prototype; - proto.add = add; - proto.calendar = calendar$1; - proto.clone = clone; - proto.diff = diff; - proto.endOf = endOf; - proto.format = format; - proto.from = from; - proto.fromNow = fromNow; - proto.to = to; - proto.toNow = toNow; - proto.get = stringGet; - proto.invalidAt = invalidAt; - proto.isAfter = isAfter; - proto.isBefore = isBefore; - proto.isBetween = isBetween; - proto.isSame = isSame; - proto.isSameOrAfter = isSameOrAfter; - proto.isSameOrBefore = isSameOrBefore; - proto.isValid = isValid$2; - proto.lang = lang; - proto.locale = locale; - proto.localeData = localeData; - proto.max = prototypeMax; - proto.min = prototypeMin; - proto.parsingFlags = parsingFlags; - proto.set = stringSet; - proto.startOf = startOf; - proto.subtract = subtract; - proto.toArray = toArray; - proto.toObject = toObject; - proto.toDate = toDate; - proto.toISOString = toISOString; - proto.inspect = inspect; - proto.toJSON = toJSON; - proto.toString = toString; - proto.unix = unix; - proto.valueOf = valueOf; - proto.creationData = creationData; - proto.year = getSetYear; - proto.isLeapYear = getIsLeapYear; - proto.weekYear = getSetWeekYear; - proto.isoWeekYear = getSetISOWeekYear; - proto.quarter = proto.quarters = getSetQuarter; - proto.month = getSetMonth; - proto.daysInMonth = getDaysInMonth; - proto.week = proto.weeks = getSetWeek; - proto.isoWeek = proto.isoWeeks = getSetISOWeek; - proto.weeksInYear = getWeeksInYear; - proto.isoWeeksInYear = getISOWeeksInYear; - proto.date = getSetDayOfMonth; - proto.day = proto.days = getSetDayOfWeek; - proto.weekday = getSetLocaleDayOfWeek; - proto.isoWeekday = getSetISODayOfWeek; - proto.dayOfYear = getSetDayOfYear; - proto.hour = proto.hours = getSetHour; - proto.minute = proto.minutes = getSetMinute; - proto.second = proto.seconds = getSetSecond; - proto.millisecond = proto.milliseconds = getSetMillisecond; - proto.utcOffset = getSetOffset; - proto.utc = setOffsetToUTC; - proto.local = setOffsetToLocal; - proto.parseZone = setOffsetToParsedOffset; - proto.hasAlignedHourOffset = hasAlignedHourOffset; - proto.isDST = isDaylightSavingTime; - proto.isLocal = isLocal; - proto.isUtcOffset = isUtcOffset; - proto.isUtc = isUtc; - proto.isUTC = isUtc; - proto.zoneAbbr = getZoneAbbr; - proto.zoneName = getZoneName; - proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth); - proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth); - proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear); - proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone); - proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted); - - function createUnix(input) { - return createLocal(input * 1000); - } - - function createInZone() { - return createLocal.apply(null, arguments).parseZone(); - } - - function preParsePostFormat(string) { - return string; - } - - var proto$1 = Locale.prototype; - proto$1.calendar = calendar; - proto$1.longDateFormat = longDateFormat; - proto$1.invalidDate = invalidDate; - proto$1.ordinal = ordinal; - proto$1.preparse = preParsePostFormat; - proto$1.postformat = preParsePostFormat; - proto$1.relativeTime = relativeTime; - proto$1.pastFuture = pastFuture; - proto$1.set = set; - proto$1.months = localeMonths; - proto$1.monthsShort = localeMonthsShort; - proto$1.monthsParse = localeMonthsParse; - proto$1.monthsRegex = monthsRegex; - proto$1.monthsShortRegex = monthsShortRegex; - proto$1.week = localeWeek; - proto$1.firstDayOfYear = localeFirstDayOfYear; - proto$1.firstDayOfWeek = localeFirstDayOfWeek; - proto$1.weekdays = localeWeekdays; - proto$1.weekdaysMin = localeWeekdaysMin; - proto$1.weekdaysShort = localeWeekdaysShort; - proto$1.weekdaysParse = localeWeekdaysParse; - proto$1.weekdaysRegex = weekdaysRegex; - proto$1.weekdaysShortRegex = weekdaysShortRegex; - proto$1.weekdaysMinRegex = weekdaysMinRegex; - proto$1.isPM = localeIsPM; - proto$1.meridiem = localeMeridiem; - - function get$1(format, index, field, setter) { - var locale = getLocale(); - var utc = createUTC().set(setter, index); - return locale[field](utc, format); - } - - function listMonthsImpl(format, index, field) { - if (isNumber(format)) { - index = format; - format = undefined; - } - - format = format || ''; - - if (index != null) { - return get$1(format, index, field, 'month'); - } - - var i; - var out = []; - - for (i = 0; i < 12; i++) { - out[i] = get$1(format, i, field, 'month'); - } - - return out; - } // () - // (5) - // (fmt, 5) - // (fmt) - // (true) - // (true, 5) - // (true, fmt, 5) - // (true, fmt) - - - function listWeekdaysImpl(localeSorted, format, index, field) { - if (typeof localeSorted === 'boolean') { - if (isNumber(format)) { - index = format; - format = undefined; - } - - format = format || ''; - } else { - format = localeSorted; - index = format; - localeSorted = false; - - if (isNumber(format)) { - index = format; - format = undefined; - } - - format = format || ''; - } - - var locale = getLocale(), - shift = localeSorted ? locale._week.dow : 0; - - if (index != null) { - return get$1(format, (index + shift) % 7, field, 'day'); - } - - var i; - var out = []; - - for (i = 0; i < 7; i++) { - out[i] = get$1(format, (i + shift) % 7, field, 'day'); - } - - return out; - } - - function listMonths(format, index) { - return listMonthsImpl(format, index, 'months'); - } - - function listMonthsShort(format, index) { - return listMonthsImpl(format, index, 'monthsShort'); - } - - function listWeekdays(localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); - } - - function listWeekdaysShort(localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); - } - - function listWeekdaysMin(localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); - } - - getSetGlobalLocale('en', { - dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, - ordinal: function ordinal(number) { - var b = number % 10, - output = toInt(number % 100 / 10) === 1 ? 'th' : b === 1 ? 'st' : b === 2 ? 'nd' : b === 3 ? 'rd' : 'th'; - return number + output; - } - }); // Side effect imports - - hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale); - hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale); - var mathAbs = Math.abs; - - function abs() { - var data = this._data; - this._milliseconds = mathAbs(this._milliseconds); - this._days = mathAbs(this._days); - this._months = mathAbs(this._months); - data.milliseconds = mathAbs(data.milliseconds); - data.seconds = mathAbs(data.seconds); - data.minutes = mathAbs(data.minutes); - data.hours = mathAbs(data.hours); - data.months = mathAbs(data.months); - data.years = mathAbs(data.years); - return this; - } - - function addSubtract$1(duration, input, value, direction) { - var other = createDuration(input, value); - duration._milliseconds += direction * other._milliseconds; - duration._days += direction * other._days; - duration._months += direction * other._months; - return duration._bubble(); - } // supports only 2.0-style add(1, 's') or add(duration) - - - function add$1(input, value) { - return addSubtract$1(this, input, value, 1); - } // supports only 2.0-style subtract(1, 's') or subtract(duration) - - - function subtract$1(input, value) { - return addSubtract$1(this, input, value, -1); - } - - function absCeil(number) { - if (number < 0) { - return Math.floor(number); - } else { - return Math.ceil(number); - } - } - - function bubble() { - var milliseconds = this._milliseconds; - var days = this._days; - var months = this._months; - var data = this._data; - var seconds, minutes, hours, years, monthsFromDays; // if we have a mix of positive and negative values, bubble down first - // check: https://github.com/moment/moment/issues/2166 - - if (!(milliseconds >= 0 && days >= 0 && months >= 0 || milliseconds <= 0 && days <= 0 && months <= 0)) { - milliseconds += absCeil(monthsToDays(months) + days) * 864e5; - days = 0; - months = 0; - } // The following code bubbles up values, see the tests for - // examples of what that means. - - - data.milliseconds = milliseconds % 1000; - seconds = absFloor(milliseconds / 1000); - data.seconds = seconds % 60; - minutes = absFloor(seconds / 60); - data.minutes = minutes % 60; - hours = absFloor(minutes / 60); - data.hours = hours % 24; - days += absFloor(hours / 24); // convert days to months - - monthsFromDays = absFloor(daysToMonths(days)); - months += monthsFromDays; - days -= absCeil(monthsToDays(monthsFromDays)); // 12 months -> 1 year - - years = absFloor(months / 12); - months %= 12; - data.days = days; - data.months = months; - data.years = years; - return this; - } - - function daysToMonths(days) { - // 400 years have 146097 days (taking into account leap year rules) - // 400 years have 12 months === 4800 - return days * 4800 / 146097; - } - - function monthsToDays(months) { - // the reverse of daysToMonths - return months * 146097 / 4800; - } - - function as(units) { - if (!this.isValid()) { - return NaN; - } - - var days; - var months; - var milliseconds = this._milliseconds; - units = normalizeUnits(units); - - if (units === 'month' || units === 'year') { - days = this._days + milliseconds / 864e5; - months = this._months + daysToMonths(days); - return units === 'month' ? months : months / 12; - } else { - // handle milliseconds separately because of floating point math errors (issue #1867) - days = this._days + Math.round(monthsToDays(this._months)); - - switch (units) { - case 'week': - return days / 7 + milliseconds / 6048e5; - - case 'day': - return days + milliseconds / 864e5; - - case 'hour': - return days * 24 + milliseconds / 36e5; - - case 'minute': - return days * 1440 + milliseconds / 6e4; - - case 'second': - return days * 86400 + milliseconds / 1000; - // Math.floor prevents floating point math errors here - - case 'millisecond': - return Math.floor(days * 864e5) + milliseconds; - - default: - throw new Error('Unknown unit ' + units); - } - } - } // TODO: Use this.as('ms')? - - - function valueOf$1() { - if (!this.isValid()) { - return NaN; - } - - return this._milliseconds + this._days * 864e5 + this._months % 12 * 2592e6 + toInt(this._months / 12) * 31536e6; - } - - function makeAs(alias) { - return function () { - return this.as(alias); - }; - } - - var asMilliseconds = makeAs('ms'); - var asSeconds = makeAs('s'); - var asMinutes = makeAs('m'); - var asHours = makeAs('h'); - var asDays = makeAs('d'); - var asWeeks = makeAs('w'); - var asMonths = makeAs('M'); - var asYears = makeAs('y'); - - function clone$1() { - return createDuration(this); - } - - function get$2(units) { - units = normalizeUnits(units); - return this.isValid() ? this[units + 's']() : NaN; - } - - function makeGetter(name) { - return function () { - return this.isValid() ? this._data[name] : NaN; - }; - } - - var milliseconds = makeGetter('milliseconds'); - var seconds = makeGetter('seconds'); - var minutes = makeGetter('minutes'); - var hours = makeGetter('hours'); - var days = makeGetter('days'); - var months = makeGetter('months'); - var years = makeGetter('years'); - - function weeks() { - return absFloor(this.days() / 7); - } - - var round = Math.round; - var thresholds = { - ss: 44, - // a few seconds to seconds - s: 45, - // seconds to minute - m: 45, - // minutes to hour - h: 22, - // hours to day - d: 26, - // days to month - M: 11 // months to year - - }; // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize - - function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { - return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); - } - - function relativeTime$1(posNegDuration, withoutSuffix, locale) { - var duration = createDuration(posNegDuration).abs(); - var seconds = round(duration.as('s')); - var minutes = round(duration.as('m')); - var hours = round(duration.as('h')); - var days = round(duration.as('d')); - var months = round(duration.as('M')); - var years = round(duration.as('y')); - var a = seconds <= thresholds.ss && ['s', seconds] || seconds < thresholds.s && ['ss', seconds] || minutes <= 1 && ['m'] || minutes < thresholds.m && ['mm', minutes] || hours <= 1 && ['h'] || hours < thresholds.h && ['hh', hours] || days <= 1 && ['d'] || days < thresholds.d && ['dd', days] || months <= 1 && ['M'] || months < thresholds.M && ['MM', months] || years <= 1 && ['y'] || ['yy', years]; - a[2] = withoutSuffix; - a[3] = +posNegDuration > 0; - a[4] = locale; - return substituteTimeAgo.apply(null, a); - } // This function allows you to set the rounding function for relative time strings - - - function getSetRelativeTimeRounding(roundingFunction) { - if (roundingFunction === undefined) { - return round; - } - - if (typeof roundingFunction === 'function') { - round = roundingFunction; - return true; - } - - return false; - } // This function allows you to set a threshold for relative time strings - - - function getSetRelativeTimeThreshold(threshold, limit) { - if (thresholds[threshold] === undefined) { - return false; - } - - if (limit === undefined) { - return thresholds[threshold]; - } - - thresholds[threshold] = limit; - - if (threshold === 's') { - thresholds.ss = limit - 1; - } - - return true; - } - - function humanize(withSuffix) { - if (!this.isValid()) { - return this.localeData().invalidDate(); - } - - var locale = this.localeData(); - var output = relativeTime$1(this, !withSuffix, locale); - - if (withSuffix) { - output = locale.pastFuture(+this, output); - } - - return locale.postformat(output); - } - - var abs$1 = Math.abs; - - function sign(x) { - return (x > 0) - (x < 0) || +x; - } - - function toISOString$1() { - // for ISO strings we do not use the normal bubbling rules: - // * milliseconds bubble up until they become hours - // * days do not bubble at all - // * months bubble up until they become years - // This is because there is no context-free conversion between hours and days - // (think of clock changes) - // and also not between days and months (28-31 days per month) - if (!this.isValid()) { - return this.localeData().invalidDate(); - } - - var seconds = abs$1(this._milliseconds) / 1000; - var days = abs$1(this._days); - var months = abs$1(this._months); - var minutes, hours, years; // 3600 seconds -> 60 minutes -> 1 hour - - minutes = absFloor(seconds / 60); - hours = absFloor(minutes / 60); - seconds %= 60; - minutes %= 60; // 12 months -> 1 year - - years = absFloor(months / 12); - months %= 12; // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js - - var Y = years; - var M = months; - var D = days; - var h = hours; - var m = minutes; - var s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : ''; - var total = this.asSeconds(); - - if (!total) { - // this is the same as C#'s (Noda) and python (isodate)... - // but not other JS (goog.date) - return 'P0D'; - } - - var totalSign = total < 0 ? '-' : ''; - var ymSign = sign(this._months) !== sign(total) ? '-' : ''; - var daysSign = sign(this._days) !== sign(total) ? '-' : ''; - var hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : ''; - return totalSign + 'P' + (Y ? ymSign + Y + 'Y' : '') + (M ? ymSign + M + 'M' : '') + (D ? daysSign + D + 'D' : '') + (h || m || s ? 'T' : '') + (h ? hmsSign + h + 'H' : '') + (m ? hmsSign + m + 'M' : '') + (s ? hmsSign + s + 'S' : ''); - } - - var proto$2 = Duration.prototype; - proto$2.isValid = isValid$1; - proto$2.abs = abs; - proto$2.add = add$1; - proto$2.subtract = subtract$1; - proto$2.as = as; - proto$2.asMilliseconds = asMilliseconds; - proto$2.asSeconds = asSeconds; - proto$2.asMinutes = asMinutes; - proto$2.asHours = asHours; - proto$2.asDays = asDays; - proto$2.asWeeks = asWeeks; - proto$2.asMonths = asMonths; - proto$2.asYears = asYears; - proto$2.valueOf = valueOf$1; - proto$2._bubble = bubble; - proto$2.clone = clone$1; - proto$2.get = get$2; - proto$2.milliseconds = milliseconds; - proto$2.seconds = seconds; - proto$2.minutes = minutes; - proto$2.hours = hours; - proto$2.days = days; - proto$2.weeks = weeks; - proto$2.months = months; - proto$2.years = years; - proto$2.humanize = humanize; - proto$2.toISOString = toISOString$1; - proto$2.toString = toISOString$1; - proto$2.toJSON = toISOString$1; - proto$2.locale = locale; - proto$2.localeData = localeData; - proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1); - proto$2.lang = lang; // Side effect imports - // FORMATTING - - addFormatToken('X', 0, 0, 'unix'); - addFormatToken('x', 0, 0, 'valueOf'); // PARSING - - addRegexToken('x', matchSigned); - addRegexToken('X', matchTimestamp); - addParseToken('X', function (input, array, config) { - config._d = new Date(parseFloat(input, 10) * 1000); - }); - addParseToken('x', function (input, array, config) { - config._d = new Date(toInt(input)); - }); // Side effect imports - - hooks.version = '2.22.2'; - setHookCallback(createLocal); - hooks.fn = proto; - hooks.min = min; - hooks.max = max; - hooks.now = now; - hooks.utc = createUTC; - hooks.unix = createUnix; - hooks.months = listMonths; - hooks.isDate = isDate; - hooks.locale = getSetGlobalLocale; - hooks.invalid = createInvalid; - hooks.duration = createDuration; - hooks.isMoment = isMoment; - hooks.weekdays = listWeekdays; - hooks.parseZone = createInZone; - hooks.localeData = getLocale; - hooks.isDuration = isDuration; - hooks.monthsShort = listMonthsShort; - hooks.weekdaysMin = listWeekdaysMin; - hooks.defineLocale = defineLocale; - hooks.updateLocale = updateLocale; - hooks.locales = listLocales; - hooks.weekdaysShort = listWeekdaysShort; - hooks.normalizeUnits = normalizeUnits; - hooks.relativeTimeRounding = getSetRelativeTimeRounding; - hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; - hooks.calendarFormat = getCalendarFormat; - hooks.prototype = proto; // currently HTML5 input type only supports 24-hour formats - - hooks.HTML5_FMT = { - DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', - // - DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', - // - DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', - // - DATE: 'YYYY-MM-DD', - // - TIME: 'HH:mm', - // - TIME_SECONDS: 'HH:mm:ss', - // - TIME_MS: 'HH:mm:ss.SSS', - // - WEEK: 'YYYY-[W]WW', - // - MONTH: 'YYYY-MM' // - - }; - return hooks; - }); - }); - - // 7.2.9 SameValue(x, y) - var _sameValue = Object.is || function is(x, y) { - // eslint-disable-next-line no-self-compare - return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; - }; - - // @@search logic - _fixReWks('search', 1, function (defined, SEARCH, $search, maybeCallNative) { - return [ - // `String.prototype.search` method - // https://tc39.github.io/ecma262/#sec-string.prototype.search - function search(regexp) { - var O = defined(this); - var fn = regexp == undefined ? undefined : regexp[SEARCH]; - return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O)); - }, - // `RegExp.prototype[@@search]` method - // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search - function (regexp) { - var res = maybeCallNative($search, regexp, this); - if (res.done) return res.value; - var rx = _anObject(regexp); - var S = String(this); - var previousLastIndex = rx.lastIndex; - if (!_sameValue(previousLastIndex, 0)) rx.lastIndex = 0; - var result = _regexpExecAbstract(rx, S); - if (!_sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex; - return result === null ? -1 : result.index; - } - ]; - }); - - // 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties) - _export(_export.S + _export.F * !_descriptors, 'Object', { defineProperties: _objectDps }); - - // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) - _export(_export.S + _export.F * !_descriptors, 'Object', { defineProperty: _objectDp.f }); - - var momentRange = createCommonjsModule(function (module, exports) { - !function (t, e) { - module.exports = e(moment); - }(commonjsGlobal, function (t) { - return function (t) { - function e(r) { - if (n[r]) return n[r].exports; - var o = n[r] = { - i: r, - l: !1, - exports: {} - }; - return t[r].call(o.exports, o, o.exports, e), o.l = !0, o.exports; - } - - var n = {}; - return e.m = t, e.c = n, e.i = function (t) { - return t; - }, e.d = function (t, n, r) { - e.o(t, n) || Object.defineProperty(t, n, { - configurable: !1, - enumerable: !0, - get: r - }); - }, e.n = function (t) { - var n = t && t.__esModule ? function () { - return t.default; - } : function () { - return t; - }; - return e.d(n, "a", n), n; - }, e.o = function (t, e) { - return Object.prototype.hasOwnProperty.call(t, e); - }, e.p = "", e(e.s = 3); - }([function (t, e, n) { - - var r = n(5)(); - - t.exports = function (t) { - return t !== r && null !== t; - }; - }, function (t, e, n) { - - t.exports = n(18)() ? Symbol : n(20); - }, function (e, n) { - e.exports = t; - }, function (t, e, n) { - - function r(t) { - return t && t.__esModule ? t : { - default: t - }; - } - - function o(t, e, n) { - return e in t ? Object.defineProperty(t, e, { - value: n, - enumerable: !0, - configurable: !0, - writable: !0 - }) : t[e] = n, t; - } - - function i(t, e) { - if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); - } - - function u(t) { - return t.range = function (e, n) { - var r = this; - return "string" == typeof e && y.hasOwnProperty(e) ? new h(t(r).startOf(e), t(r).endOf(e)) : new h(e, n); - }, t.rangeFromInterval = function (e) { - var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1, - r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : t(); - if (t.isMoment(r) || (r = t(r)), !r.isValid()) throw new Error("Invalid date."); - var o = r.clone().add(n, e), - i = []; - return i.push(t.min(r, o)), i.push(t.max(r, o)), new h(i); - }, t.rangeFromISOString = function (e) { - var n = a(e), - r = t.parseZone(n[0]), - o = t.parseZone(n[1]); - return new h(r, o); - }, t.parseZoneRange = t.rangeFromISOString, t.fn.range = t.range, t.range.constructor = h, t.isRange = function (t) { - return t instanceof h; - }, t.fn.within = function (t) { - return t.contains(this.toDate()); - }, t; - } - - function a(t) { - return t.split("/"); - } - - Object.defineProperty(e, "__esModule", { - value: !0 - }), e.DateRange = void 0; - - var s = function () { - function t(t, e) { - var n = [], - r = !0, - o = !1, - i = void 0; - - try { - for (var u, a = t[Symbol.iterator](); !(r = (u = a.next()).done) && (n.push(u.value), !e || n.length !== e); r = !0) { - } - } catch (t) { - o = !0, i = t; - } finally { - try { - !r && a.return && a.return(); - } finally { - if (o) throw i; - } - } - - return n; - } - - return function (e, n) { - if (Array.isArray(e)) return e; - if (Symbol.iterator in Object(e)) return t(e, n); - throw new TypeError("Invalid attempt to destructure non-iterable instance"); - }; - }(), - c = "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 = function () { - function t(t, e) { - for (var n = 0; n < e.length; n++) { - var r = e[n]; - r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, r.key, r); - } - } - - return function (e, n, r) { - return n && t(e.prototype, n), r && t(e, r), e; - }; - }(); - - e.extendMoment = u; - - var l = n(2), - v = r(l), - d = n(1), - p = r(d), - y = { - year: !0, - quarter: !0, - month: !0, - week: !0, - day: !0, - hour: !0, - minute: !0, - second: !0 - }, - h = e.DateRange = function () { - function t(e, n) { - i(this, t); - var r = e, - o = n; - if (1 === arguments.length || void 0 === n) if ("object" === (void 0 === e ? "undefined" : c(e)) && 2 === e.length) { - var u = s(e, 2); - r = u[0], o = u[1]; - } else if ("string" == typeof e) { - var f = a(e), - l = s(f, 2); - r = l[0], o = l[1]; - } - this.start = r || 0 === r ? (0, v.default)(r) : (0, v.default)(-864e13), this.end = o || 0 === o ? (0, v.default)(o) : (0, v.default)(864e13); - } - - return f(t, [{ - key: "adjacent", - value: function value(t) { - var e = this.start.isSame(t.end), - n = this.end.isSame(t.start); - return e && t.start.valueOf() <= this.start.valueOf() || n && t.end.valueOf() >= this.end.valueOf(); - } - }, { - key: "add", - value: function value(t) { - var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : { - adjacent: !1 - }; - return this.overlaps(t, e) ? new this.constructor(v.default.min(this.start, t.start), v.default.max(this.end, t.end)) : null; - } - }, { - key: "by", - value: function value(t) { - var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : { - excludeEnd: !1, - step: 1 - }, - n = this; - return o({}, p.default.iterator, function () { - var r = e.step || 1, - o = Math.abs(n.start.diff(n.end, t)) / r, - i = e.excludeEnd || !1, - u = 0; - return e.hasOwnProperty("exclusive") && (i = e.exclusive), { - next: function next() { - var e = n.start.clone().add(u * r, t), - a = i ? !(u < o) : !(u <= o); - return u++, { - done: a, - value: a ? void 0 : e - }; - } - }; - }); - } - }, { - key: "byRange", - value: function value(t) { - var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : { - excludeEnd: !1, - step: 1 - }, - n = this, - r = e.step || 1, - i = this.valueOf() / t.valueOf() / r, - u = Math.floor(i), - a = e.excludeEnd || !1, - s = 0; - return e.hasOwnProperty("exclusive") && (a = e.exclusive), o({}, p.default.iterator, function () { - return u === 1 / 0 ? { - done: !0 - } : { - next: function next() { - var e = (0, v.default)(n.start.valueOf() + t.valueOf() * s * r), - o = u === i && a ? !(s < u) : !(s <= u); - return s++, { - done: o, - value: o ? void 0 : e - }; - } - }; - }); - } - }, { - key: "center", - value: function value() { - var t = this.start.valueOf() + this.diff() / 2; - return (0, v.default)(t); - } - }, { - key: "clone", - value: function value() { - return new this.constructor(this.start.clone(), this.end.clone()); - } - }, { - key: "contains", - value: function value(e) { - var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : { - excludeStart: !1, - excludeEnd: !1 - }, - r = this.start.valueOf(), - o = this.end.valueOf(), - i = e.valueOf(), - u = e.valueOf(), - a = n.excludeStart || !1, - s = n.excludeEnd || !1; - n.hasOwnProperty("exclusive") && (a = s = n.exclusive), e instanceof t && (i = e.start.valueOf(), u = e.end.valueOf()); - var c = r < i || r <= i && !a, - f = o > u || o >= u && !s; - return c && f; - } - }, { - key: "diff", - value: function value(t, e) { - return this.end.diff(this.start, t, e); - } - }, { - key: "duration", - value: function value(t, e) { - return this.diff(t, e); - } - }, { - key: "intersect", - value: function value(t) { - var e = this.start.valueOf(), - n = this.end.valueOf(), - r = t.start.valueOf(), - o = t.end.valueOf(), - i = e == n, - u = r == o; - - if (i) { - var a = e; - if (a == r || a == o) return null; - if (a > r && a < o) return this.clone(); - } else if (u) { - var s = r; - if (s == e || s == n) return null; - if (s > e && s < n) return new this.constructor(s, s); - } - - return e <= r && r < n && n < o ? new this.constructor(r, n) : r < e && e < o && o <= n ? new this.constructor(e, o) : r < e && e <= n && n < o ? this.clone() : e <= r && r <= o && o <= n ? new this.constructor(r, o) : null; - } - }, { - key: "isEqual", - value: function value(t) { - return this.start.isSame(t.start) && this.end.isSame(t.end); - } - }, { - key: "isSame", - value: function value(t) { - return this.isEqual(t); - } - }, { - key: "overlaps", - value: function value(t) { - var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : { - adjacent: !1 - }, - n = null !== this.intersect(t); - return e.adjacent && !n ? this.adjacent(t) : n; - } - }, { - key: "reverseBy", - value: function value(t) { - var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : { - excludeStart: !1, - step: 1 - }, - n = this; - return o({}, p.default.iterator, function () { - var r = e.step || 1, - o = Math.abs(n.start.diff(n.end, t)) / r, - i = e.excludeStart || !1, - u = 0; - return e.hasOwnProperty("exclusive") && (i = e.exclusive), { - next: function next() { - var e = n.end.clone().subtract(u * r, t), - a = i ? !(u < o) : !(u <= o); - return u++, { - done: a, - value: a ? void 0 : e - }; - } - }; - }); - } - }, { - key: "reverseByRange", - value: function value(t) { - var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : { - excludeStart: !1, - step: 1 - }, - n = this, - r = e.step || 1, - i = this.valueOf() / t.valueOf() / r, - u = Math.floor(i), - a = e.excludeStart || !1, - s = 0; - return e.hasOwnProperty("exclusive") && (a = e.exclusive), o({}, p.default.iterator, function () { - return u === 1 / 0 ? { - done: !0 - } : { - next: function next() { - var e = (0, v.default)(n.end.valueOf() - t.valueOf() * s * r), - o = u === i && a ? !(s < u) : !(s <= u); - return s++, { - done: o, - value: o ? void 0 : e - }; - } - }; - }); - } - }, { - key: "snapTo", - value: function value(t) { - var e = this.clone(); - return e.start.isSame((0, v.default)(-864e13)) || (e.start = e.start.startOf(t)), e.end.isSame((0, v.default)(864e13)) || (e.end = e.end.endOf(t)), e; - } - }, { - key: "subtract", - value: function value(t) { - var e = this.start.valueOf(), - n = this.end.valueOf(), - r = t.start.valueOf(), - o = t.end.valueOf(); - return null === this.intersect(t) ? [this] : r <= e && e < n && n <= o ? [] : r <= e && e < o && o < n ? [new this.constructor(o, n)] : e < r && r < n && n <= o ? [new this.constructor(e, r)] : e < r && r < o && o < n ? [new this.constructor(e, r), new this.constructor(o, n)] : e < r && r < n && o < n ? [new this.constructor(e, r), new this.constructor(r, n)] : []; - } - }, { - key: "toDate", - value: function value() { - return [this.start.toDate(), this.end.toDate()]; - } - }, { - key: "toString", - value: function value() { - return this.start.format() + "/" + this.end.format(); - } - }, { - key: "valueOf", - value: function value() { - return this.end.valueOf() - this.start.valueOf(); - } - }]), t; - }(); - }, function (t, e, n) { - - var r, - o = n(6), - i = n(13), - u = n(9), - a = n(15); - r = t.exports = function (t, e) { - var n, r, u, s, c; - return arguments.length < 2 || "string" != typeof t ? (s = e, e = t, t = null) : s = arguments[2], null == t ? (n = u = !0, r = !1) : (n = a.call(t, "c"), r = a.call(t, "e"), u = a.call(t, "w")), c = { - value: e, - configurable: n, - enumerable: r, - writable: u - }, s ? o(i(s), c) : c; - }, r.gs = function (t, e, n) { - var r, s, c, f; - return "string" != typeof t ? (c = n, n = e, e = t, t = null) : c = arguments[3], null == e ? e = void 0 : u(e) ? null == n ? n = void 0 : u(n) || (c = n, n = void 0) : (c = e, e = n = void 0), null == t ? (r = !0, s = !1) : (r = a.call(t, "c"), s = a.call(t, "e")), f = { - get: e, - set: n, - configurable: r, - enumerable: s - }, c ? o(i(c), f) : f; - }; - }, function (t, e, n) { - - t.exports = function () {}; - }, function (t, e, n) { - - t.exports = n(7)() ? Object.assign : n(8); - }, function (t, e, n) { - - t.exports = function () { - var t, - e = Object.assign; - return "function" == typeof e && (t = { - foo: "raz" - }, e(t, { - bar: "dwa" - }, { - trzy: "trzy" - }), t.foo + t.bar + t.trzy === "razdwatrzy"); - }; - }, function (t, e, n) { - - var r = n(10), - o = n(14), - i = Math.max; - - t.exports = function (t, e) { - var n, - u, - a, - s = i(arguments.length, 2); - - for (t = Object(o(t)), a = function a(r) { - try { - t[r] = e[r]; - } catch (t) { - n || (n = t); - } - }, u = 1; u < s; ++u) { - e = arguments[u], r(e).forEach(a); - } - - if (void 0 !== n) throw n; - return t; - }; - }, function (t, e, n) { - - t.exports = function (t) { - return "function" == typeof t; - }; - }, function (t, e, n) { - - t.exports = n(11)() ? Object.keys : n(12); - }, function (t, e, n) { - - t.exports = function () { - try { - return !0; - } catch (t) { - return !1; - } - }; - }, function (t, e, n) { - - var r = n(0), - o = Object.keys; - - t.exports = function (t) { - return o(r(t) ? Object(t) : t); - }; - }, function (t, e, n) { - - var r = n(0), - o = Array.prototype.forEach, - i = Object.create, - u = function u(t, e) { - var n; - - for (n in t) { - e[n] = t[n]; - } - }; - - t.exports = function (t) { - var e = i(null); - return o.call(arguments, function (t) { - r(t) && u(Object(t), e); - }), e; - }; - }, function (t, e, n) { - - var r = n(0); - - t.exports = function (t) { - if (!r(t)) throw new TypeError("Cannot use null or undefined"); - return t; - }; - }, function (t, e, n) { - - t.exports = n(16)() ? String.prototype.contains : n(17); - }, function (t, e, n) { - - var r = "razdwatrzy"; - - t.exports = function () { - return "function" == typeof r.contains && !0 === r.contains("dwa") && !1 === r.contains("foo"); - }; - }, function (t, e, n) { - - var r = String.prototype.indexOf; - - t.exports = function (t) { - return r.call(this, t, arguments[1]) > -1; - }; - }, function (t, e, n) { - - var r = { - object: !0, - symbol: !0 - }; - - t.exports = function () { - if ("function" != typeof Symbol) return !1; - - try { - } catch (t) { - return !1; - } - - return !!r[_typeof(Symbol.iterator)] && !!r[_typeof(Symbol.toPrimitive)] && !!r[_typeof(Symbol.toStringTag)]; - }; - }, function (t, e, n) { - - t.exports = function (t) { - return !!t && ("symbol" == _typeof(t) || !!t.constructor && "Symbol" === t.constructor.name && "Symbol" === t[t.constructor.toStringTag]); - }; - }, function (t, e, n) { - - var r, - o, - _i, - u, - a = n(4), - s = n(21), - c = Object.create, - f = Object.defineProperties, - l = Object.defineProperty, - v = Object.prototype, - d = c(null); - - if ("function" == typeof Symbol) { - r = Symbol; - - try { - String(r()), u = !0; - } catch (t) {} - } - - var p = function () { - var t = c(null); - return function (e) { - for (var n, r, o = 0; t[e + (o || "")];) { - ++o; - } - - return e += o || "", t[e] = !0, n = "@@" + e, l(v, n, a.gs(null, function (t) { - r || (r = !0, l(this, n, a(t)), r = !1); - })), n; - }; - }(); - - _i = function i(t) { - if (this instanceof _i) throw new TypeError("Symbol is not a constructor"); - return o(t); - }, t.exports = o = function t(e) { - var n; - if (this instanceof t) throw new TypeError("Symbol is not a constructor"); - return u ? r(e) : (n = c(_i.prototype), e = void 0 === e ? "" : String(e), f(n, { - __description__: a("", e), - __name__: a("", p(e)) - })); - }, f(o, { - for: a(function (t) { - return d[t] ? d[t] : d[t] = o(String(t)); - }), - keyFor: a(function (t) { - var e; - s(t); - - for (e in d) { - if (d[e] === t) return e; - } - }), - hasInstance: a("", r && r.hasInstance || o("hasInstance")), - isConcatSpreadable: a("", r && r.isConcatSpreadable || o("isConcatSpreadable")), - iterator: a("", r && r.iterator || o("iterator")), - match: a("", r && r.match || o("match")), - replace: a("", r && r.replace || o("replace")), - search: a("", r && r.search || o("search")), - species: a("", r && r.species || o("species")), - split: a("", r && r.split || o("split")), - toPrimitive: a("", r && r.toPrimitive || o("toPrimitive")), - toStringTag: a("", r && r.toStringTag || o("toStringTag")), - unscopables: a("", r && r.unscopables || o("unscopables")) - }), f(_i.prototype, { - constructor: a(o), - toString: a("", function () { - return this.__name__; - }) - }), f(o.prototype, { - toString: a(function () { - return "Symbol (" + s(this).__description__ + ")"; - }), - valueOf: a(function () { - return s(this); - }) - }), l(o.prototype, o.toPrimitive, a("", function () { - var t = s(this); - return "symbol" == _typeof(t) ? t : t.toString(); - })), l(o.prototype, o.toStringTag, a("c", "Symbol")), l(_i.prototype, o.toStringTag, a("c", o.prototype[o.toStringTag])), l(_i.prototype, o.toPrimitive, a("c", o.prototype[o.toPrimitive])); - }, function (t, e, n) { - - var r = n(19); - - t.exports = function (t) { - if (!r(t)) throw new TypeError(t + " is not a symbol"); - return t; - }; - }]); - }); - }); - var momentRange$1 = unwrapExports(momentRange); - - var moment$1 = momentRange$1.extendMoment(moment); - var TIME_SERIES = { - day: function day(range$$1) { - return Array.from(range$$1.by('day')).map(function (d) { - return d.format('YYYY-MM-DDT00:00:00.000'); - }); - }, - month: function month(range$$1) { - return Array.from(range$$1.snapTo('month').by('month')).map(function (d) { - return d.format('YYYY-MM-01T00:00:00.000'); - }); - }, - year: function year(range$$1) { - return Array.from(range$$1.snapTo('year').by('year')).map(function (d) { - return d.format('YYYY-01-01T00:00:00.000'); - }); - }, - hour: function hour(range$$1) { - return Array.from(range$$1.by('hour')).map(function (d) { - return d.format('YYYY-MM-DDTHH:00:00.000'); - }); - }, - week: function week(range$$1) { - return Array.from(range$$1.snapTo('isoweek').by('week')).map(function (d) { - return d.startOf('isoweek').format('YYYY-MM-DDT00:00:00.000'); - }); - } - }; - /** - * Provides a convenient interface for data manipulation. - */ - - var ResultSet = - /*#__PURE__*/ - function () { - function ResultSet(loadResponse) { - _classCallCheck(this, ResultSet); - - this.loadResponse = loadResponse; - } - - _createClass(ResultSet, [{ - key: "series", - value: function series(pivotConfig) { - var _this = this; - - return this.seriesNames(pivotConfig).map(function (_ref) { - var title = _ref.title, - key = _ref.key; - return { - title: title, - series: _this.chartPivot(pivotConfig).map(function (_ref2) { - var category = _ref2.category, - x = _ref2.x, - obj = _objectWithoutProperties(_ref2, ["category", "x"]); - - return { - value: obj[key], - category: category, - x: x - }; - }) - }; - }); - } - }, { - key: "axisValues", - value: function axisValues(axis) { - var query = this.loadResponse.query; - return function (row) { - var value = function value(measure) { - return axis.filter(function (d) { - return d !== 'measures'; - }).map(function (d) { - return row[d] != null ? row[d] : null; - }).concat(measure ? [measure] : []); - }; - - if (axis.find(function (d) { - return d === 'measures'; - }) && (query.measures || []).length) { - return query.measures.map(value); - } - - return [value()]; - }; - } - }, { - key: "axisValuesString", - value: function axisValuesString(axisValues, delimiter) { - var formatValue = function formatValue(v) { - if (v == null) { - return '∅'; - } else if (v === '') { - return '[Empty string]'; - } else { - return v; - } - }; - - return axisValues.map(formatValue).join(delimiter || ', '); - } - }, { - key: "normalizePivotConfig", - value: function normalizePivotConfig(pivotConfig) { - var query = this.loadResponse.query; - var timeDimensions = (query.timeDimensions || []).filter(function (td) { - return !!td.granularity; - }); - pivotConfig = pivotConfig || (timeDimensions.length ? { - x: timeDimensions.map(function (td) { - return td.dimension; - }), - y: query.dimensions || [] - } : { - x: query.dimensions || [], - y: [] - }); - pivotConfig.x = pivotConfig.x || []; - pivotConfig.y = pivotConfig.y || []; - var allIncludedDimensions = pivotConfig.x.concat(pivotConfig.y); - var allDimensions = timeDimensions.map(function (td) { - return td.dimension; - }).concat(query.dimensions); - pivotConfig.x = pivotConfig.x.concat(allDimensions.filter(function (d) { - return allIncludedDimensions.indexOf(d) === -1; - })); - - if (!pivotConfig.x.concat(pivotConfig.y).find(function (d) { - return d === 'measures'; - })) { - pivotConfig.y = pivotConfig.y.concat(['measures']); - } - - if (!(query.measures || []).length) { - pivotConfig.x = pivotConfig.x.filter(function (d) { - return d !== 'measures'; - }); - pivotConfig.y = pivotConfig.y.filter(function (d) { - return d !== 'measures'; - }); - } - - if (pivotConfig.fillMissingDates == null) { - pivotConfig.fillMissingDates = true; - } - - return pivotConfig; - } - }, { - key: "timeSeries", - value: function timeSeries(timeDimension) { - if (!timeDimension.granularity) { - return null; - } - - var dateRange = timeDimension.dateRange; - - if (!dateRange) { - var dates = pipe(map(function (row) { - return row[timeDimension.dimension] && moment$1(row[timeDimension.dimension]); - }), filter(function (r) { - return !!r; - }))(this.loadResponse.data); - dateRange = dates.length && [reduce(minBy(function (d) { - return d.toDate(); - }), dates[0], dates), reduce(maxBy(function (d) { - return d.toDate(); - }), dates[0], dates)] || null; - } - - if (!dateRange) { - return null; - } - - var start = moment$1(dateRange[0]).format('YYYY-MM-DD 00:00:00'); - var end = moment$1(dateRange[1]).format('YYYY-MM-DD 23:59:59'); - var range$$1 = moment$1.range(start, end); - - if (!TIME_SERIES[timeDimension.granularity]) { - throw new Error("Unsupported time granularity: ".concat(timeDimension.granularity)); - } - - return TIME_SERIES[timeDimension.granularity](range$$1); - } - }, { - key: "pivot", - value: function pivot(pivotConfig) { - var _this2 = this; - - pivotConfig = this.normalizePivotConfig(pivotConfig); - var groupByXAxis = groupBy(function (_ref3) { - var xValues = _ref3.xValues; - return _this2.axisValuesString(xValues); - }); // eslint-disable-next-line no-unused-vars - - var measureValue = function measureValue(row, measure, xValues) { - return row[measure]; - }; - - if (pivotConfig.fillMissingDates && pivotConfig.x.length === 1 && equals(pivotConfig.x, (this.loadResponse.query.timeDimensions || []).filter(function (td) { - return !!td.granularity; - }).map(function (td) { - return td.dimension; - }))) { - var series = this.timeSeries(this.loadResponse.query.timeDimensions[0]); - - if (series) { - groupByXAxis = function groupByXAxis(rows) { - var byXValues = groupBy(function (_ref4) { - var xValues = _ref4.xValues; - return moment$1(xValues[0]).format(moment$1.HTML5_FMT.DATETIME_LOCAL_MS); - }, rows); - return series.map(function (d) { - return _defineProperty({}, d, byXValues[d] || [{ - xValues: [d], - row: {} - }]); - }).reduce(function (a, b) { - return Object.assign(a, b); - }, {}); - }; // eslint-disable-next-line no-unused-vars - - - measureValue = function measureValue(row, measure, xValues) { - return row[measure] || 0; - }; - } - } - - var xGrouped = pipe(map(function (row) { - return _this2.axisValues(pivotConfig.x)(row).map(function (xValues) { - return { - xValues: xValues, - row: row - }; - }); - }), unnest, groupByXAxis, toPairs)(this.loadResponse.data); - var allYValues = pipe(map( // eslint-disable-next-line no-unused-vars - function (_ref6) { - var _ref7 = _slicedToArray(_ref6, 2), - xValuesString = _ref7[0], - rows = _ref7[1]; - - return unnest( // collect Y values only from filled rows - rows.filter(function (_ref8) { - var row = _ref8.row; - return Object.keys(row).length > 0; - }).map(function (_ref9) { - var row = _ref9.row; - return _this2.axisValues(pivotConfig.y)(row); - })); - }), unnest, uniq)(xGrouped); // eslint-disable-next-line no-unused-vars - - return xGrouped.map(function (_ref10) { - var _ref11 = _slicedToArray(_ref10, 2), - xValuesString = _ref11[0], - rows = _ref11[1]; - - var xValues = rows[0].xValues; - var yGrouped = pipe(map(function (_ref12) { - var row = _ref12.row; - return _this2.axisValues(pivotConfig.y)(row).map(function (yValues) { - return { - yValues: yValues, - row: row - }; - }); - }), unnest, groupBy(function (_ref13) { - var yValues = _ref13.yValues; - return _this2.axisValuesString(yValues); - }))(rows); - return { - xValues: xValues, - yValuesArray: unnest(allYValues.map(function (yValues) { - var measure = pivotConfig.x.find(function (d) { - return d === 'measures'; - }) ? ResultSet.measureFromAxis(xValues) : ResultSet.measureFromAxis(yValues); - return (yGrouped[_this2.axisValuesString(yValues)] || [{ - row: {} - }]).map(function (_ref14) { - var row = _ref14.row; - return [yValues, measureValue(row, measure, xValues)]; - }); - })) - }; - }); - } - }, { - key: "pivotedRows", - value: function pivotedRows(pivotConfig) { - // TODO - return this.chartPivot(pivotConfig); - } - /** - * Returns normalized query result data in the following format. - * - * ```js - * // For query - * { - * measures: ['Stories.count'], - * timeDimensions: [{ - * dimension: 'Stories.time', - * dateRange: ['2015-01-01', '2015-12-31'], - * granularity: 'month' - * }] - * } - * - * // ResultSet.chartPivot() will return - * [ - * { "x":"2015-01-01T00:00:00", "Stories.count": 27120 }, - * { "x":"2015-02-01T00:00:00", "Stories.count": 25861 }, - * { "x": "2015-03-01T00:00:00", "Stories.count": 29661 }, - * //... - * ] - * ``` - * @param pivotConfig - */ - - }, { - key: "chartPivot", - value: function chartPivot(pivotConfig) { - var _this3 = this; - - return this.pivot(pivotConfig).map(function (_ref15) { - var xValues = _ref15.xValues, - yValuesArray = _ref15.yValuesArray; - return _objectSpread({ - category: _this3.axisValuesString(xValues, ', '), - // TODO deprecated - x: _this3.axisValuesString(xValues, ', ') - }, yValuesArray.map(function (_ref16) { - var _ref17 = _slicedToArray(_ref16, 2), - yValues = _ref17[0], - m = _ref17[1]; - - return _defineProperty({}, _this3.axisValuesString(yValues, ', '), m && Number.parseFloat(m)); - }).reduce(function (a, b) { - return Object.assign(a, b); - }, {})); - }); - } - /** - * Returns normalized query result data prepared for visualization in the table format. - * - * For example - * - * ```js - * // For query - * { - * measures: ['Stories.count'], - * timeDimensions: [{ - * dimension: 'Stories.time', - * dateRange: ['2015-01-01', '2015-12-31'], - * granularity: 'month' - * }] - * } - * - * // ResultSet.tablePivot() will return - * [ - * { "Stories.time": "2015-01-01T00:00:00", "Stories.count": 27120 }, - * { "Stories.time": "2015-02-01T00:00:00", "Stories.count": 25861 }, - * { "Stories.time": "2015-03-01T00:00:00", "Stories.count": 29661 }, - * //... - * ] - * ``` - * @param pivotConfig - * @returns {Array} of pivoted rows - */ - - }, { - key: "tablePivot", - value: function tablePivot(pivotConfig) { - var normalizedPivotConfig = this.normalizePivotConfig(pivotConfig); - - var valueToObject = function valueToObject(valuesArray, measureValue) { - return function (field, index) { - return _defineProperty({}, field === 'measures' ? valuesArray[index] : field, field === 'measures' ? measureValue : valuesArray[index]); - }; - }; - - return this.pivot(normalizedPivotConfig).map(function (_ref20) { - var xValues = _ref20.xValues, - yValuesArray = _ref20.yValuesArray; - return yValuesArray.map(function (_ref21) { - var _ref22 = _slicedToArray(_ref21, 2), - yValues = _ref22[0], - m = _ref22[1]; - - return normalizedPivotConfig.x.map(valueToObject(xValues, m)).concat(normalizedPivotConfig.y.map(valueToObject(yValues, m))).reduce(function (a, b) { - return Object.assign(a, b); - }, {}); - }).reduce(function (a, b) { - return Object.assign(a, b); - }, {}); - }); - } - /** - * Returns array of column definitions for `tablePivot`. - * - * For example - * - * ```js - * // For query - * { - * measures: ['Stories.count'], - * timeDimensions: [{ - * dimension: 'Stories.time', - * dateRange: ['2015-01-01', '2015-12-31'], - * granularity: 'month' - * }] - * } - * - * // ResultSet.tableColumns() will return - * [ - * { key: "Stories.time", title: "Stories Time" }, - * { key: "Stories.count", title: "Stories Count" }, - * //... - * ] - * ``` - * @param pivotConfig - * @returns {Array} of columns - */ - - }, { - key: "tableColumns", - value: function tableColumns(pivotConfig) { - var _this4 = this; - - var normalizedPivotConfig = this.normalizePivotConfig(pivotConfig); - - var column = function column(field) { - return field === 'measures' ? (_this4.query().measures || []).map(function (m) { - return { - key: m, - title: _this4.loadResponse.annotation.measures[m].title - }; - }) : [{ - key: field, - title: (_this4.loadResponse.annotation.dimensions[field] || _this4.loadResponse.annotation.timeDimensions[field]).title - }]; - }; - - return normalizedPivotConfig.x.map(column).concat(normalizedPivotConfig.y.map(column)).reduce(function (a, b) { - return a.concat(b); - }); - } - }, { - key: "totalRow", - value: function totalRow() { - return this.chartPivot()[0]; - } - }, { - key: "categories", - value: function categories(pivotConfig) { - // TODO - return this.chartPivot(pivotConfig); - } - /** - * Returns the array of series objects, containing `key` and `title` parameters. - * - * ```js - * // For query - * { - * measures: ['Stories.count'], - * timeDimensions: [{ - * dimension: 'Stories.time', - * dateRange: ['2015-01-01', '2015-12-31'], - * granularity: 'month' - * }] - * } - * - * // ResultSet.seriesNames() will return - * [ - * { "key":"Stories.count", "title": "Stories Count" } - * ] - * ``` - * @param pivotConfig - * @returns {Array} of series names - */ - - }, { - key: "seriesNames", - value: function seriesNames(pivotConfig) { - var _this5 = this; - - pivotConfig = this.normalizePivotConfig(pivotConfig); - return pipe(map(this.axisValues(pivotConfig.y)), unnest, uniq)(this.loadResponse.data).map(function (axisValues) { - return { - title: _this5.axisValuesString(pivotConfig.y.find(function (d) { - return d === 'measures'; - }) ? dropLast$1(1, axisValues).concat(_this5.loadResponse.annotation.measures[ResultSet.measureFromAxis(axisValues)].title) : axisValues, ', '), - key: _this5.axisValuesString(axisValues) - }; - }); - } - }, { - key: "query", - value: function query() { - return this.loadResponse.query; - } - }, { - key: "rawData", - value: function rawData() { - return this.loadResponse.data; - } - }], [{ - key: "measureFromAxis", - value: function measureFromAxis(axisValues) { - return axisValues[axisValues.length - 1]; - } - }]); - - return ResultSet; - }(); - - var SqlQuery = - /*#__PURE__*/ - function () { - function SqlQuery(sqlQuery) { - _classCallCheck(this, SqlQuery); - - this.sqlQuery = sqlQuery; - } - - _createClass(SqlQuery, [{ - key: "rawQuery", - value: function rawQuery() { - return this.sqlQuery.sql; - } - }, { - key: "sql", - value: function sql() { - return this.rawQuery().sql[0]; - } - }]); - - return SqlQuery; - }(); - - var memberMap = function memberMap(memberArray) { - return fromPairs(memberArray.map(function (m) { - return [m.name, m]; - })); - }; - - var operators = { - string: [{ - name: 'contains', - title: 'contains' - }, { - name: 'notContains', - title: 'does not contain' - }, { - name: 'equals', - title: 'equals' - }, { - name: 'notEquals', - title: 'does not equal' - }, { - name: 'set', - title: 'is set' - }, { - name: 'notSet', - title: 'is not set' - }], - number: [{ - name: 'equals', - title: 'equals' - }, { - name: 'notEquals', - title: 'does not equal' - }, { - name: 'set', - title: 'is set' - }, { - name: 'notSet', - title: 'is not set' - }, { - name: 'gt', - title: '>' - }, { - name: 'gte', - title: '>=' - }, { - name: 'lt', - title: '<' - }, { - name: 'lte', - title: '<=' - }] - }; - - var Meta = - /*#__PURE__*/ - function () { - function Meta(metaResponse) { - _classCallCheck(this, Meta); - - this.meta = metaResponse; - var cubes = this.meta.cubes; - this.cubes = cubes; - this.cubesMap = fromPairs(cubes.map(function (c) { - return [c.name, { - measures: memberMap(c.measures), - dimensions: memberMap(c.dimensions), - segments: memberMap(c.segments) - }]; - })); - } - - _createClass(Meta, [{ - key: "membersForQuery", - value: function membersForQuery(query, memberType) { - return unnest(this.cubes.map(function (c) { - return c[memberType]; - })); - } - }, { - key: "resolveMember", - value: function resolveMember(memberName, memberType) { - var _this = this; - - var _memberName$split = memberName.split('.'), - _memberName$split2 = _slicedToArray(_memberName$split, 1), - cube = _memberName$split2[0]; - - if (!this.cubesMap[cube]) { - return { - title: memberName, - error: "Cube not found ".concat(cube, " for path '").concat(memberName, "'") - }; - } - - var memberTypes = Array.isArray(memberType) ? memberType : [memberType]; - var member = memberTypes.map(function (type$$1) { - return _this.cubesMap[cube][type$$1] && _this.cubesMap[cube][type$$1][memberName]; - }).find(function (m) { - return m; - }); - - if (!member) { - return { - title: memberName, - error: "Path not found '".concat(memberName, "'") - }; - } - - return member; - } - }, { - key: "defaultTimeDimensionNameFor", - value: function defaultTimeDimensionNameFor(memberName) { - var _this2 = this; - - var _memberName$split3 = memberName.split('.'), - _memberName$split4 = _slicedToArray(_memberName$split3, 1), - cube = _memberName$split4[0]; - - if (!this.cubesMap[cube]) { - return null; - } - - return Object.keys(this.cubesMap[cube].dimensions || {}).find(function (d) { - return _this2.cubesMap[cube].dimensions[d].type === 'time'; - }); - } - }, { - key: "filterOperatorsForMember", - value: function filterOperatorsForMember(memberName, memberType) { - var member = this.resolveMember(memberName, memberType); - return operators[member.type] || operators.string; - } - }]); - - return Meta; - }(); - - var ProgressResult = - /*#__PURE__*/ - function () { - function ProgressResult(progressResponse) { - _classCallCheck(this, ProgressResult); - - this.progressResponse = progressResponse; - } - - _createClass(ProgressResult, [{ - key: "stage", - value: function stage() { - return this.progressResponse.stage; - } - }, { - key: "timeElapsed", - value: function timeElapsed() { - return this.progressResponse.timeElapsed; - } - }]); - - return ProgressResult; - }(); - - var API_URL = "https://statsbot.co/cubejs-api/v1"; - var mutexCounter = 0; - var MUTEX_ERROR = 'Mutex has been changed'; - - var mutexPromise = function mutexPromise(promise) { - return new Promise(function (resolve, reject) { - promise.then(function (r) { - return resolve(r); - }, function (e) { - return e !== MUTEX_ERROR && reject(e); - }); - }); - }; - /** - * Main class for accessing Cube.js API - * @order -5 - */ - - - var CubejsApi = - /*#__PURE__*/ - function () { - function CubejsApi(apiToken, options) { - _classCallCheck(this, CubejsApi); - - options = options || {}; - this.apiToken = apiToken; - this.apiUrl = options.apiUrl || API_URL; - } - - _createClass(CubejsApi, [{ - key: "request", - value: function request(url, config) { - return browserPonyfill("".concat(this.apiUrl).concat(url), Object.assign({ - headers: { - Authorization: this.apiToken, - 'Content-Type': 'application/json' - } - }, config || {})); - } - }, { - key: "loadMethod", - value: function loadMethod(request, toResult, options, callback) { - var mutexValue = ++mutexCounter; - - if (typeof options === 'function' && !callback) { - callback = options; - options = undefined; - } - - options = options || {}; - var mutexKey = options.mutexKey || 'default'; - - if (options.mutexObj) { - options.mutexObj[mutexKey] = mutexValue; - } - - var checkMutex = function checkMutex() { - if (options.mutexObj && options.mutexObj[mutexKey] !== mutexValue) { - throw MUTEX_ERROR; - } - }; - - var loadImpl = - /*#__PURE__*/ - function () { - var _ref = _asyncToGenerator( - /*#__PURE__*/ - regeneratorRuntime.mark(function _callee() { - var response, body; - return regeneratorRuntime.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - _context.next = 2; - return request(); - - case 2: - response = _context.sent; - - if (!(response.status === 502)) { - _context.next = 6; - break; - } - - checkMutex(); - return _context.abrupt("return", loadImpl()); - - case 6: - _context.next = 8; - return response.json(); - - case 8: - body = _context.sent; - - if (!(body.error === 'Continue wait')) { - _context.next = 13; - break; - } - - checkMutex(); - - if (options.progressCallback) { - options.progressCallback(new ProgressResult(body)); - } - - return _context.abrupt("return", loadImpl()); - - case 13: - if (!(response.status !== 200)) { - _context.next = 16; - break; - } - - checkMutex(); - throw new Error(body.error); - - case 16: - checkMutex(); - return _context.abrupt("return", toResult(body)); - - case 18: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - return function loadImpl() { - return _ref.apply(this, arguments); - }; - }(); - - if (callback) { - mutexPromise(loadImpl()).then(function (r) { - return callback(null, r); - }, function (e) { - return callback(e); - }); - } else { - return mutexPromise(loadImpl()); - } - } - /** - * Fetch data for passed `query`. - * - * ```js - * import cubejs from '@cubejs-client/core'; - * import Chart from 'chart.js'; - * import chartjsConfig from './toChartjsData'; - * - * const cubejsApi = cubejs('CUBEJS_TOKEN'); - * - * const resultSet = await cubejsApi.load({ - * measures: ['Stories.count'], - * timeDimensions: [{ - * dimension: 'Stories.time', - * dateRange: ['2015-01-01', '2015-12-31'], - * granularity: 'month' - * }] - * }); - * - * const context = document.getElementById('myChart'); - * new Chart(context, chartjsConfig(resultSet)); - * ``` - * @param query - [Query object](query-format) - * @param options - * @param callback - * @returns {Promise} for {@link ResultSet} if `callback` isn't passed - */ - - }, { - key: "load", - value: function load(query, options, callback) { - var _this = this; - - return this.loadMethod(function () { - return _this.request("/load?query=".concat(encodeURIComponent(JSON.stringify(query)))); - }, function (body) { - return new ResultSet(body); - }, options, callback); - } - /** - * Get generated SQL string for given `query`. - * @param query - [Query object](query-format) - * @param options - * @param callback - * @return {Promise} for {@link SqlQuery} if `callback` isn't passed - */ - - }, { - key: "sql", - value: function sql(query, options, callback) { - var _this2 = this; - - return this.loadMethod(function () { - return _this2.request("/sql?query=".concat(JSON.stringify(query))); - }, function (body) { - return new SqlQuery(body); - }, options, callback); - } - /** - * Get meta description of cubes available for querying. - * @param options - * @param callback - * @return {Promise} for {@link Meta} if `callback` isn't passed - */ - - }, { - key: "meta", - value: function meta(options, callback) { - var _this3 = this; - - return this.loadMethod(function () { - return _this3.request("/meta"); - }, function (body) { - return new Meta(body); - }, options, callback); - } - }]); - - return CubejsApi; - }(); - /** - * Create instance of `CubejsApi`. - * API entry point. - * - * ```javascript - import cubejs from '@cubejs-client/core'; - - const cubejsApi = cubejs( - 'CUBEJS-API-TOKEN', - { apiUrl: 'http://localhost:4000/cubejs-api/v1' } - ); - ``` - * @name cubejs - * @param apiToken - [API token](security) is used to authorize requests and determine SQL database you're accessing. - * In the development mode, Cube.js Backend will print the API token to the console on on startup. - * @param options - options object. - * @param options.apiUrl - URL of your Cube.js Backend. - * By default, in the development environment it is `http://localhost:4000/cubejs-api/v1`. - * @returns {CubejsApi} - * @order -10 - */ - - - var index = (function (apiToken, options) { - return new CubejsApi(apiToken, options); - }); - - return index; + addRegexToken('m', match1to2); + addRegexToken('mm', match1to2, match2); + addParseToken(['m', 'mm'], MINUTE); // MOMENTS + + var getSetMinute = makeGetSet('Minutes', false); // FORMATTING + + addFormatToken('s', ['ss', 2], 0, 'second'); // ALIASES + + addUnitAlias('second', 's'); // PRIORITY + + addUnitPriority('second', 15); // PARSING + + addRegexToken('s', match1to2); + addRegexToken('ss', match1to2, match2); + addParseToken(['s', 'ss'], SECOND); // MOMENTS + + var getSetSecond = makeGetSet('Seconds', false); // FORMATTING + + addFormatToken('S', 0, 0, function () { + return ~~(this.millisecond() / 100); + }); + addFormatToken(0, ['SS', 2], 0, function () { + return ~~(this.millisecond() / 10); + }); + addFormatToken(0, ['SSS', 3], 0, 'millisecond'); + addFormatToken(0, ['SSSS', 4], 0, function () { + return this.millisecond() * 10; + }); + addFormatToken(0, ['SSSSS', 5], 0, function () { + return this.millisecond() * 100; + }); + addFormatToken(0, ['SSSSSS', 6], 0, function () { + return this.millisecond() * 1000; + }); + addFormatToken(0, ['SSSSSSS', 7], 0, function () { + return this.millisecond() * 10000; + }); + addFormatToken(0, ['SSSSSSSS', 8], 0, function () { + return this.millisecond() * 100000; + }); + addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { + return this.millisecond() * 1000000; + }); // ALIASES + + addUnitAlias('millisecond', 'ms'); // PRIORITY + + addUnitPriority('millisecond', 16); // PARSING + + addRegexToken('S', match1to3, match1); + addRegexToken('SS', match1to3, match2); + addRegexToken('SSS', match1to3, match3); + var token; + + for (token = 'SSSS'; token.length <= 9; token += 'S') { + addRegexToken(token, matchUnsigned); + } + + function parseMs(input, array) { + array[MILLISECOND] = toInt(('0.' + input) * 1000); + } + + for (token = 'S'; token.length <= 9; token += 'S') { + addParseToken(token, parseMs); + } // MOMENTS + + + var getSetMillisecond = makeGetSet('Milliseconds', false); // FORMATTING + + addFormatToken('z', 0, 0, 'zoneAbbr'); + addFormatToken('zz', 0, 0, 'zoneName'); // MOMENTS + + function getZoneAbbr() { + return this._isUTC ? 'UTC' : ''; + } + + function getZoneName() { + return this._isUTC ? 'Coordinated Universal Time' : ''; + } + + var proto = Moment.prototype; + proto.add = add; + proto.calendar = calendar$1; + proto.clone = clone; + proto.diff = diff; + proto.endOf = endOf; + proto.format = format; + proto.from = from; + proto.fromNow = fromNow; + proto.to = to; + proto.toNow = toNow; + proto.get = stringGet; + proto.invalidAt = invalidAt; + proto.isAfter = isAfter; + proto.isBefore = isBefore; + proto.isBetween = isBetween; + proto.isSame = isSame; + proto.isSameOrAfter = isSameOrAfter; + proto.isSameOrBefore = isSameOrBefore; + proto.isValid = isValid$2; + proto.lang = lang; + proto.locale = locale; + proto.localeData = localeData; + proto.max = prototypeMax; + proto.min = prototypeMin; + proto.parsingFlags = parsingFlags; + proto.set = stringSet; + proto.startOf = startOf; + proto.subtract = subtract; + proto.toArray = toArray; + proto.toObject = toObject; + proto.toDate = toDate; + proto.toISOString = toISOString; + proto.inspect = inspect; + proto.toJSON = toJSON; + proto.toString = toString; + proto.unix = unix; + proto.valueOf = valueOf; + proto.creationData = creationData; + proto.year = getSetYear; + proto.isLeapYear = getIsLeapYear; + proto.weekYear = getSetWeekYear; + proto.isoWeekYear = getSetISOWeekYear; + proto.quarter = proto.quarters = getSetQuarter; + proto.month = getSetMonth; + proto.daysInMonth = getDaysInMonth; + proto.week = proto.weeks = getSetWeek; + proto.isoWeek = proto.isoWeeks = getSetISOWeek; + proto.weeksInYear = getWeeksInYear; + proto.isoWeeksInYear = getISOWeeksInYear; + proto.date = getSetDayOfMonth; + proto.day = proto.days = getSetDayOfWeek; + proto.weekday = getSetLocaleDayOfWeek; + proto.isoWeekday = getSetISODayOfWeek; + proto.dayOfYear = getSetDayOfYear; + proto.hour = proto.hours = getSetHour; + proto.minute = proto.minutes = getSetMinute; + proto.second = proto.seconds = getSetSecond; + proto.millisecond = proto.milliseconds = getSetMillisecond; + proto.utcOffset = getSetOffset; + proto.utc = setOffsetToUTC; + proto.local = setOffsetToLocal; + proto.parseZone = setOffsetToParsedOffset; + proto.hasAlignedHourOffset = hasAlignedHourOffset; + proto.isDST = isDaylightSavingTime; + proto.isLocal = isLocal; + proto.isUtcOffset = isUtcOffset; + proto.isUtc = isUtc; + proto.isUTC = isUtc; + proto.zoneAbbr = getZoneAbbr; + proto.zoneName = getZoneName; + proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth); + proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth); + proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear); + proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone); + proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted); + + function createUnix(input) { + return createLocal(input * 1000); + } + + function createInZone() { + return createLocal.apply(null, arguments).parseZone(); + } + + function preParsePostFormat(string) { + return string; + } + + var proto$1 = Locale.prototype; + proto$1.calendar = calendar; + proto$1.longDateFormat = longDateFormat; + proto$1.invalidDate = invalidDate; + proto$1.ordinal = ordinal; + proto$1.preparse = preParsePostFormat; + proto$1.postformat = preParsePostFormat; + proto$1.relativeTime = relativeTime; + proto$1.pastFuture = pastFuture; + proto$1.set = set; + proto$1.months = localeMonths; + proto$1.monthsShort = localeMonthsShort; + proto$1.monthsParse = localeMonthsParse; + proto$1.monthsRegex = monthsRegex; + proto$1.monthsShortRegex = monthsShortRegex; + proto$1.week = localeWeek; + proto$1.firstDayOfYear = localeFirstDayOfYear; + proto$1.firstDayOfWeek = localeFirstDayOfWeek; + proto$1.weekdays = localeWeekdays; + proto$1.weekdaysMin = localeWeekdaysMin; + proto$1.weekdaysShort = localeWeekdaysShort; + proto$1.weekdaysParse = localeWeekdaysParse; + proto$1.weekdaysRegex = weekdaysRegex; + proto$1.weekdaysShortRegex = weekdaysShortRegex; + proto$1.weekdaysMinRegex = weekdaysMinRegex; + proto$1.isPM = localeIsPM; + proto$1.meridiem = localeMeridiem; + + function get$1(format, index, field, setter) { + var locale = getLocale(); + var utc = createUTC().set(setter, index); + return locale[field](utc, format); + } + + function listMonthsImpl(format, index, field) { + if (isNumber(format)) { + index = format; + format = undefined; + } + + format = format || ''; + + if (index != null) { + return get$1(format, index, field, 'month'); + } + + var i; + var out = []; + + for (i = 0; i < 12; i++) { + out[i] = get$1(format, i, field, 'month'); + } + + return out; + } // () + // (5) + // (fmt, 5) + // (fmt) + // (true) + // (true, 5) + // (true, fmt, 5) + // (true, fmt) + + + function listWeekdaysImpl(localeSorted, format, index, field) { + if (typeof localeSorted === 'boolean') { + if (isNumber(format)) { + index = format; + format = undefined; + } + + format = format || ''; + } else { + format = localeSorted; + index = format; + localeSorted = false; + + if (isNumber(format)) { + index = format; + format = undefined; + } + + format = format || ''; + } + + var locale = getLocale(), + shift = localeSorted ? locale._week.dow : 0; + + if (index != null) { + return get$1(format, (index + shift) % 7, field, 'day'); + } + + var i; + var out = []; + + for (i = 0; i < 7; i++) { + out[i] = get$1(format, (i + shift) % 7, field, 'day'); + } + + return out; + } + + function listMonths(format, index) { + return listMonthsImpl(format, index, 'months'); + } + + function listMonthsShort(format, index) { + return listMonthsImpl(format, index, 'monthsShort'); + } + + function listWeekdays(localeSorted, format, index) { + return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); + } + + function listWeekdaysShort(localeSorted, format, index) { + return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); + } + + function listWeekdaysMin(localeSorted, format, index) { + return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); + } + + getSetGlobalLocale('en', { + dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, + ordinal: function ordinal(number) { + var b = number % 10, + output = toInt(number % 100 / 10) === 1 ? 'th' : b === 1 ? 'st' : b === 2 ? 'nd' : b === 3 ? 'rd' : 'th'; + return number + output; + } + }); // Side effect imports + + hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale); + hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale); + var mathAbs = Math.abs; + + function abs() { + var data = this._data; + this._milliseconds = mathAbs(this._milliseconds); + this._days = mathAbs(this._days); + this._months = mathAbs(this._months); + data.milliseconds = mathAbs(data.milliseconds); + data.seconds = mathAbs(data.seconds); + data.minutes = mathAbs(data.minutes); + data.hours = mathAbs(data.hours); + data.months = mathAbs(data.months); + data.years = mathAbs(data.years); + return this; + } + + function addSubtract$1(duration, input, value, direction) { + var other = createDuration(input, value); + duration._milliseconds += direction * other._milliseconds; + duration._days += direction * other._days; + duration._months += direction * other._months; + return duration._bubble(); + } // supports only 2.0-style add(1, 's') or add(duration) + + + function add$1(input, value) { + return addSubtract$1(this, input, value, 1); + } // supports only 2.0-style subtract(1, 's') or subtract(duration) + + + function subtract$1(input, value) { + return addSubtract$1(this, input, value, -1); + } + + function absCeil(number) { + if (number < 0) { + return Math.floor(number); + } else { + return Math.ceil(number); + } + } + + function bubble() { + var milliseconds = this._milliseconds; + var days = this._days; + var months = this._months; + var data = this._data; + var seconds, minutes, hours, years, monthsFromDays; // if we have a mix of positive and negative values, bubble down first + // check: https://github.com/moment/moment/issues/2166 + + if (!(milliseconds >= 0 && days >= 0 && months >= 0 || milliseconds <= 0 && days <= 0 && months <= 0)) { + milliseconds += absCeil(monthsToDays(months) + days) * 864e5; + days = 0; + months = 0; + } // The following code bubbles up values, see the tests for + // examples of what that means. + + + data.milliseconds = milliseconds % 1000; + seconds = absFloor(milliseconds / 1000); + data.seconds = seconds % 60; + minutes = absFloor(seconds / 60); + data.minutes = minutes % 60; + hours = absFloor(minutes / 60); + data.hours = hours % 24; + days += absFloor(hours / 24); // convert days to months + + monthsFromDays = absFloor(daysToMonths(days)); + months += monthsFromDays; + days -= absCeil(monthsToDays(monthsFromDays)); // 12 months -> 1 year + + years = absFloor(months / 12); + months %= 12; + data.days = days; + data.months = months; + data.years = years; + return this; + } + + function daysToMonths(days) { + // 400 years have 146097 days (taking into account leap year rules) + // 400 years have 12 months === 4800 + return days * 4800 / 146097; + } + + function monthsToDays(months) { + // the reverse of daysToMonths + return months * 146097 / 4800; + } + + function as(units) { + if (!this.isValid()) { + return NaN; + } + + var days; + var months; + var milliseconds = this._milliseconds; + units = normalizeUnits(units); + + if (units === 'month' || units === 'year') { + days = this._days + milliseconds / 864e5; + months = this._months + daysToMonths(days); + return units === 'month' ? months : months / 12; + } else { + // handle milliseconds separately because of floating point math errors (issue #1867) + days = this._days + Math.round(monthsToDays(this._months)); + + switch (units) { + case 'week': + return days / 7 + milliseconds / 6048e5; + + case 'day': + return days + milliseconds / 864e5; + + case 'hour': + return days * 24 + milliseconds / 36e5; + + case 'minute': + return days * 1440 + milliseconds / 6e4; + + case 'second': + return days * 86400 + milliseconds / 1000; + // Math.floor prevents floating point math errors here + + case 'millisecond': + return Math.floor(days * 864e5) + milliseconds; + + default: + throw new Error('Unknown unit ' + units); + } + } + } // TODO: Use this.as('ms')? + + + function valueOf$1() { + if (!this.isValid()) { + return NaN; + } + + return this._milliseconds + this._days * 864e5 + this._months % 12 * 2592e6 + toInt(this._months / 12) * 31536e6; + } + + function makeAs(alias) { + return function () { + return this.as(alias); + }; + } + + var asMilliseconds = makeAs('ms'); + var asSeconds = makeAs('s'); + var asMinutes = makeAs('m'); + var asHours = makeAs('h'); + var asDays = makeAs('d'); + var asWeeks = makeAs('w'); + var asMonths = makeAs('M'); + var asYears = makeAs('y'); + + function clone$1() { + return createDuration(this); + } + + function get$2(units) { + units = normalizeUnits(units); + return this.isValid() ? this[units + 's']() : NaN; + } + + function makeGetter(name) { + return function () { + return this.isValid() ? this._data[name] : NaN; + }; + } + + var milliseconds = makeGetter('milliseconds'); + var seconds = makeGetter('seconds'); + var minutes = makeGetter('minutes'); + var hours = makeGetter('hours'); + var days = makeGetter('days'); + var months = makeGetter('months'); + var years = makeGetter('years'); + + function weeks() { + return absFloor(this.days() / 7); + } + + var round = Math.round; + var thresholds = { + ss: 44, + // a few seconds to seconds + s: 45, + // seconds to minute + m: 45, + // minutes to hour + h: 22, + // hours to day + d: 26, + // days to month + M: 11 // months to year + + }; // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize + + function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { + return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); + } + + function relativeTime$1(posNegDuration, withoutSuffix, locale) { + var duration = createDuration(posNegDuration).abs(); + var seconds = round(duration.as('s')); + var minutes = round(duration.as('m')); + var hours = round(duration.as('h')); + var days = round(duration.as('d')); + var months = round(duration.as('M')); + var years = round(duration.as('y')); + var a = seconds <= thresholds.ss && ['s', seconds] || seconds < thresholds.s && ['ss', seconds] || minutes <= 1 && ['m'] || minutes < thresholds.m && ['mm', minutes] || hours <= 1 && ['h'] || hours < thresholds.h && ['hh', hours] || days <= 1 && ['d'] || days < thresholds.d && ['dd', days] || months <= 1 && ['M'] || months < thresholds.M && ['MM', months] || years <= 1 && ['y'] || ['yy', years]; + a[2] = withoutSuffix; + a[3] = +posNegDuration > 0; + a[4] = locale; + return substituteTimeAgo.apply(null, a); + } // This function allows you to set the rounding function for relative time strings + + + function getSetRelativeTimeRounding(roundingFunction) { + if (roundingFunction === undefined) { + return round; + } + + if (typeof roundingFunction === 'function') { + round = roundingFunction; + return true; + } + + return false; + } // This function allows you to set a threshold for relative time strings + + + function getSetRelativeTimeThreshold(threshold, limit) { + if (thresholds[threshold] === undefined) { + return false; + } + + if (limit === undefined) { + return thresholds[threshold]; + } + + thresholds[threshold] = limit; + + if (threshold === 's') { + thresholds.ss = limit - 1; + } + + return true; + } + + function humanize(withSuffix) { + if (!this.isValid()) { + return this.localeData().invalidDate(); + } + + var locale = this.localeData(); + var output = relativeTime$1(this, !withSuffix, locale); + + if (withSuffix) { + output = locale.pastFuture(+this, output); + } + + return locale.postformat(output); + } + + var abs$1 = Math.abs; + + function sign(x) { + return (x > 0) - (x < 0) || +x; + } + + function toISOString$1() { + // for ISO strings we do not use the normal bubbling rules: + // * milliseconds bubble up until they become hours + // * days do not bubble at all + // * months bubble up until they become years + // This is because there is no context-free conversion between hours and days + // (think of clock changes) + // and also not between days and months (28-31 days per month) + if (!this.isValid()) { + return this.localeData().invalidDate(); + } + + var seconds = abs$1(this._milliseconds) / 1000; + var days = abs$1(this._days); + var months = abs$1(this._months); + var minutes, hours, years; // 3600 seconds -> 60 minutes -> 1 hour + + minutes = absFloor(seconds / 60); + hours = absFloor(minutes / 60); + seconds %= 60; + minutes %= 60; // 12 months -> 1 year + + years = absFloor(months / 12); + months %= 12; // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js + + var Y = years; + var M = months; + var D = days; + var h = hours; + var m = minutes; + var s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : ''; + var total = this.asSeconds(); + + if (!total) { + // this is the same as C#'s (Noda) and python (isodate)... + // but not other JS (goog.date) + return 'P0D'; + } + + var totalSign = total < 0 ? '-' : ''; + var ymSign = sign(this._months) !== sign(total) ? '-' : ''; + var daysSign = sign(this._days) !== sign(total) ? '-' : ''; + var hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : ''; + return totalSign + 'P' + (Y ? ymSign + Y + 'Y' : '') + (M ? ymSign + M + 'M' : '') + (D ? daysSign + D + 'D' : '') + (h || m || s ? 'T' : '') + (h ? hmsSign + h + 'H' : '') + (m ? hmsSign + m + 'M' : '') + (s ? hmsSign + s + 'S' : ''); + } + + var proto$2 = Duration.prototype; + proto$2.isValid = isValid$1; + proto$2.abs = abs; + proto$2.add = add$1; + proto$2.subtract = subtract$1; + proto$2.as = as; + proto$2.asMilliseconds = asMilliseconds; + proto$2.asSeconds = asSeconds; + proto$2.asMinutes = asMinutes; + proto$2.asHours = asHours; + proto$2.asDays = asDays; + proto$2.asWeeks = asWeeks; + proto$2.asMonths = asMonths; + proto$2.asYears = asYears; + proto$2.valueOf = valueOf$1; + proto$2._bubble = bubble; + proto$2.clone = clone$1; + proto$2.get = get$2; + proto$2.milliseconds = milliseconds; + proto$2.seconds = seconds; + proto$2.minutes = minutes; + proto$2.hours = hours; + proto$2.days = days; + proto$2.weeks = weeks; + proto$2.months = months; + proto$2.years = years; + proto$2.humanize = humanize; + proto$2.toISOString = toISOString$1; + proto$2.toString = toISOString$1; + proto$2.toJSON = toISOString$1; + proto$2.locale = locale; + proto$2.localeData = localeData; + proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1); + proto$2.lang = lang; // Side effect imports + // FORMATTING + + addFormatToken('X', 0, 0, 'unix'); + addFormatToken('x', 0, 0, 'valueOf'); // PARSING + + addRegexToken('x', matchSigned); + addRegexToken('X', matchTimestamp); + addParseToken('X', function (input, array, config) { + config._d = new Date(parseFloat(input, 10) * 1000); + }); + addParseToken('x', function (input, array, config) { + config._d = new Date(toInt(input)); + }); // Side effect imports + + hooks.version = '2.22.2'; + setHookCallback(createLocal); + hooks.fn = proto; + hooks.min = min; + hooks.max = max; + hooks.now = now; + hooks.utc = createUTC; + hooks.unix = createUnix; + hooks.months = listMonths; + hooks.isDate = isDate; + hooks.locale = getSetGlobalLocale; + hooks.invalid = createInvalid; + hooks.duration = createDuration; + hooks.isMoment = isMoment; + hooks.weekdays = listWeekdays; + hooks.parseZone = createInZone; + hooks.localeData = getLocale; + hooks.isDuration = isDuration; + hooks.monthsShort = listMonthsShort; + hooks.weekdaysMin = listWeekdaysMin; + hooks.defineLocale = defineLocale; + hooks.updateLocale = updateLocale; + hooks.locales = listLocales; + hooks.weekdaysShort = listWeekdaysShort; + hooks.normalizeUnits = normalizeUnits; + hooks.relativeTimeRounding = getSetRelativeTimeRounding; + hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; + hooks.calendarFormat = getCalendarFormat; + hooks.prototype = proto; // currently HTML5 input type only supports 24-hour formats + + hooks.HTML5_FMT = { + DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', + // + DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', + // + DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', + // + DATE: 'YYYY-MM-DD', + // + TIME: 'HH:mm', + // + TIME_SECONDS: 'HH:mm:ss', + // + TIME_MS: 'HH:mm:ss.SSS', + // + WEEK: 'YYYY-[W]WW', + // + MONTH: 'YYYY-MM' // + + }; + return hooks; + }); + }); + + // @@search logic + _fixReWks('search', 1, function (defined, SEARCH, $search) { + // 21.1.3.15 String.prototype.search(regexp) + return [function search(regexp) { + var O = defined(this); + var fn = regexp == undefined ? undefined : regexp[SEARCH]; + return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O)); + }, $search]; + }); + + // 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties) + _export(_export.S + _export.F * !_descriptors, 'Object', { defineProperties: _objectDps }); + + // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) + _export(_export.S + _export.F * !_descriptors, 'Object', { defineProperty: _objectDp.f }); + + var momentRange = createCommonjsModule(function (module, exports) { + !function (t, e) { + module.exports = e(moment); + }(commonjsGlobal, function (t) { + return function (t) { + function e(r) { + if (n[r]) return n[r].exports; + var o = n[r] = { + i: r, + l: !1, + exports: {} + }; + return t[r].call(o.exports, o, o.exports, e), o.l = !0, o.exports; + } + + var n = {}; + return e.m = t, e.c = n, e.i = function (t) { + return t; + }, e.d = function (t, n, r) { + e.o(t, n) || Object.defineProperty(t, n, { + configurable: !1, + enumerable: !0, + get: r + }); + }, e.n = function (t) { + var n = t && t.__esModule ? function () { + return t.default; + } : function () { + return t; + }; + return e.d(n, "a", n), n; + }, e.o = function (t, e) { + return Object.prototype.hasOwnProperty.call(t, e); + }, e.p = "", e(e.s = 3); + }([function (t, e, n) { + + var r = n(5)(); + + t.exports = function (t) { + return t !== r && null !== t; + }; + }, function (t, e, n) { + + t.exports = n(18)() ? Symbol : n(20); + }, function (e, n) { + e.exports = t; + }, function (t, e, n) { + + function r(t) { + return t && t.__esModule ? t : { + default: t + }; + } + + function o(t, e, n) { + return e in t ? Object.defineProperty(t, e, { + value: n, + enumerable: !0, + configurable: !0, + writable: !0 + }) : t[e] = n, t; + } + + function i(t, e) { + if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); + } + + function u(t) { + return t.range = function (e, n) { + var r = this; + return "string" == typeof e && y.hasOwnProperty(e) ? new h(t(r).startOf(e), t(r).endOf(e)) : new h(e, n); + }, t.rangeFromInterval = function (e) { + var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1, + r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : t(); + if (t.isMoment(r) || (r = t(r)), !r.isValid()) throw new Error("Invalid date."); + var o = r.clone().add(n, e), + i = []; + return i.push(t.min(r, o)), i.push(t.max(r, o)), new h(i); + }, t.rangeFromISOString = function (e) { + var n = a(e), + r = t.parseZone(n[0]), + o = t.parseZone(n[1]); + return new h(r, o); + }, t.parseZoneRange = t.rangeFromISOString, t.fn.range = t.range, t.range.constructor = h, t.isRange = function (t) { + return t instanceof h; + }, t.fn.within = function (t) { + return t.contains(this.toDate()); + }, t; + } + + function a(t) { + return t.split("/"); + } + + Object.defineProperty(e, "__esModule", { + value: !0 + }), e.DateRange = void 0; + + var s = function () { + function t(t, e) { + var n = [], + r = !0, + o = !1, + i = void 0; + + try { + for (var u, a = t[Symbol.iterator](); !(r = (u = a.next()).done) && (n.push(u.value), !e || n.length !== e); r = !0) { + } + } catch (t) { + o = !0, i = t; + } finally { + try { + !r && a.return && a.return(); + } finally { + if (o) throw i; + } + } + + return n; + } + + return function (e, n) { + if (Array.isArray(e)) return e; + if (Symbol.iterator in Object(e)) return t(e, n); + throw new TypeError("Invalid attempt to destructure non-iterable instance"); + }; + }(), + c = "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 = function () { + function t(t, e) { + for (var n = 0; n < e.length; n++) { + var r = e[n]; + r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, r.key, r); + } + } + + return function (e, n, r) { + return n && t(e.prototype, n), r && t(e, r), e; + }; + }(); + + e.extendMoment = u; + + var l = n(2), + v = r(l), + d = n(1), + p = r(d), + y = { + year: !0, + quarter: !0, + month: !0, + week: !0, + day: !0, + hour: !0, + minute: !0, + second: !0 + }, + h = e.DateRange = function () { + function t(e, n) { + i(this, t); + var r = e, + o = n; + if (1 === arguments.length || void 0 === n) if ("object" === (void 0 === e ? "undefined" : c(e)) && 2 === e.length) { + var u = s(e, 2); + r = u[0], o = u[1]; + } else if ("string" == typeof e) { + var f = a(e), + l = s(f, 2); + r = l[0], o = l[1]; + } + this.start = r || 0 === r ? (0, v.default)(r) : (0, v.default)(-864e13), this.end = o || 0 === o ? (0, v.default)(o) : (0, v.default)(864e13); + } + + return f(t, [{ + key: "adjacent", + value: function value(t) { + var e = this.start.isSame(t.end), + n = this.end.isSame(t.start); + return e && t.start.valueOf() <= this.start.valueOf() || n && t.end.valueOf() >= this.end.valueOf(); + } + }, { + key: "add", + value: function value(t) { + var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : { + adjacent: !1 + }; + return this.overlaps(t, e) ? new this.constructor(v.default.min(this.start, t.start), v.default.max(this.end, t.end)) : null; + } + }, { + key: "by", + value: function value(t) { + var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : { + excludeEnd: !1, + step: 1 + }, + n = this; + return o({}, p.default.iterator, function () { + var r = e.step || 1, + o = Math.abs(n.start.diff(n.end, t)) / r, + i = e.excludeEnd || !1, + u = 0; + return e.hasOwnProperty("exclusive") && (i = e.exclusive), { + next: function next() { + var e = n.start.clone().add(u * r, t), + a = i ? !(u < o) : !(u <= o); + return u++, { + done: a, + value: a ? void 0 : e + }; + } + }; + }); + } + }, { + key: "byRange", + value: function value(t) { + var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : { + excludeEnd: !1, + step: 1 + }, + n = this, + r = e.step || 1, + i = this.valueOf() / t.valueOf() / r, + u = Math.floor(i), + a = e.excludeEnd || !1, + s = 0; + return e.hasOwnProperty("exclusive") && (a = e.exclusive), o({}, p.default.iterator, function () { + return u === 1 / 0 ? { + done: !0 + } : { + next: function next() { + var e = (0, v.default)(n.start.valueOf() + t.valueOf() * s * r), + o = u === i && a ? !(s < u) : !(s <= u); + return s++, { + done: o, + value: o ? void 0 : e + }; + } + }; + }); + } + }, { + key: "center", + value: function value() { + var t = this.start.valueOf() + this.diff() / 2; + return (0, v.default)(t); + } + }, { + key: "clone", + value: function value() { + return new this.constructor(this.start.clone(), this.end.clone()); + } + }, { + key: "contains", + value: function value(e) { + var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : { + excludeStart: !1, + excludeEnd: !1 + }, + r = this.start.valueOf(), + o = this.end.valueOf(), + i = e.valueOf(), + u = e.valueOf(), + a = n.excludeStart || !1, + s = n.excludeEnd || !1; + n.hasOwnProperty("exclusive") && (a = s = n.exclusive), e instanceof t && (i = e.start.valueOf(), u = e.end.valueOf()); + var c = r < i || r <= i && !a, + f = o > u || o >= u && !s; + return c && f; + } + }, { + key: "diff", + value: function value(t, e) { + return this.end.diff(this.start, t, e); + } + }, { + key: "duration", + value: function value(t, e) { + return this.diff(t, e); + } + }, { + key: "intersect", + value: function value(t) { + var e = this.start.valueOf(), + n = this.end.valueOf(), + r = t.start.valueOf(), + o = t.end.valueOf(), + i = e == n, + u = r == o; + + if (i) { + var a = e; + if (a == r || a == o) return null; + if (a > r && a < o) return this.clone(); + } else if (u) { + var s = r; + if (s == e || s == n) return null; + if (s > e && s < n) return new this.constructor(s, s); + } + + return e <= r && r < n && n < o ? new this.constructor(r, n) : r < e && e < o && o <= n ? new this.constructor(e, o) : r < e && e <= n && n < o ? this.clone() : e <= r && r <= o && o <= n ? new this.constructor(r, o) : null; + } + }, { + key: "isEqual", + value: function value(t) { + return this.start.isSame(t.start) && this.end.isSame(t.end); + } + }, { + key: "isSame", + value: function value(t) { + return this.isEqual(t); + } + }, { + key: "overlaps", + value: function value(t) { + var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : { + adjacent: !1 + }, + n = null !== this.intersect(t); + return e.adjacent && !n ? this.adjacent(t) : n; + } + }, { + key: "reverseBy", + value: function value(t) { + var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : { + excludeStart: !1, + step: 1 + }, + n = this; + return o({}, p.default.iterator, function () { + var r = e.step || 1, + o = Math.abs(n.start.diff(n.end, t)) / r, + i = e.excludeStart || !1, + u = 0; + return e.hasOwnProperty("exclusive") && (i = e.exclusive), { + next: function next() { + var e = n.end.clone().subtract(u * r, t), + a = i ? !(u < o) : !(u <= o); + return u++, { + done: a, + value: a ? void 0 : e + }; + } + }; + }); + } + }, { + key: "reverseByRange", + value: function value(t) { + var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : { + excludeStart: !1, + step: 1 + }, + n = this, + r = e.step || 1, + i = this.valueOf() / t.valueOf() / r, + u = Math.floor(i), + a = e.excludeStart || !1, + s = 0; + return e.hasOwnProperty("exclusive") && (a = e.exclusive), o({}, p.default.iterator, function () { + return u === 1 / 0 ? { + done: !0 + } : { + next: function next() { + var e = (0, v.default)(n.end.valueOf() - t.valueOf() * s * r), + o = u === i && a ? !(s < u) : !(s <= u); + return s++, { + done: o, + value: o ? void 0 : e + }; + } + }; + }); + } + }, { + key: "snapTo", + value: function value(t) { + var e = this.clone(); + return e.start.isSame((0, v.default)(-864e13)) || (e.start = e.start.startOf(t)), e.end.isSame((0, v.default)(864e13)) || (e.end = e.end.endOf(t)), e; + } + }, { + key: "subtract", + value: function value(t) { + var e = this.start.valueOf(), + n = this.end.valueOf(), + r = t.start.valueOf(), + o = t.end.valueOf(); + return null === this.intersect(t) ? [this] : r <= e && e < n && n <= o ? [] : r <= e && e < o && o < n ? [new this.constructor(o, n)] : e < r && r < n && n <= o ? [new this.constructor(e, r)] : e < r && r < o && o < n ? [new this.constructor(e, r), new this.constructor(o, n)] : e < r && r < n && o < n ? [new this.constructor(e, r), new this.constructor(r, n)] : []; + } + }, { + key: "toDate", + value: function value() { + return [this.start.toDate(), this.end.toDate()]; + } + }, { + key: "toString", + value: function value() { + return this.start.format() + "/" + this.end.format(); + } + }, { + key: "valueOf", + value: function value() { + return this.end.valueOf() - this.start.valueOf(); + } + }]), t; + }(); + }, function (t, e, n) { + + var r, + o = n(6), + i = n(13), + u = n(9), + a = n(15); + r = t.exports = function (t, e) { + var n, r, u, s, c; + return arguments.length < 2 || "string" != typeof t ? (s = e, e = t, t = null) : s = arguments[2], null == t ? (n = u = !0, r = !1) : (n = a.call(t, "c"), r = a.call(t, "e"), u = a.call(t, "w")), c = { + value: e, + configurable: n, + enumerable: r, + writable: u + }, s ? o(i(s), c) : c; + }, r.gs = function (t, e, n) { + var r, s, c, f; + return "string" != typeof t ? (c = n, n = e, e = t, t = null) : c = arguments[3], null == e ? e = void 0 : u(e) ? null == n ? n = void 0 : u(n) || (c = n, n = void 0) : (c = e, e = n = void 0), null == t ? (r = !0, s = !1) : (r = a.call(t, "c"), s = a.call(t, "e")), f = { + get: e, + set: n, + configurable: r, + enumerable: s + }, c ? o(i(c), f) : f; + }; + }, function (t, e, n) { + + t.exports = function () {}; + }, function (t, e, n) { + + t.exports = n(7)() ? Object.assign : n(8); + }, function (t, e, n) { + + t.exports = function () { + var t, + e = Object.assign; + return "function" == typeof e && (t = { + foo: "raz" + }, e(t, { + bar: "dwa" + }, { + trzy: "trzy" + }), t.foo + t.bar + t.trzy === "razdwatrzy"); + }; + }, function (t, e, n) { + + var r = n(10), + o = n(14), + i = Math.max; + + t.exports = function (t, e) { + var n, + u, + a, + s = i(arguments.length, 2); + + for (t = Object(o(t)), a = function a(r) { + try { + t[r] = e[r]; + } catch (t) { + n || (n = t); + } + }, u = 1; u < s; ++u) { + e = arguments[u], r(e).forEach(a); + } + + if (void 0 !== n) throw n; + return t; + }; + }, function (t, e, n) { + + t.exports = function (t) { + return "function" == typeof t; + }; + }, function (t, e, n) { + + t.exports = n(11)() ? Object.keys : n(12); + }, function (t, e, n) { + + t.exports = function () { + try { + return !0; + } catch (t) { + return !1; + } + }; + }, function (t, e, n) { + + var r = n(0), + o = Object.keys; + + t.exports = function (t) { + return o(r(t) ? Object(t) : t); + }; + }, function (t, e, n) { + + var r = n(0), + o = Array.prototype.forEach, + i = Object.create, + u = function u(t, e) { + var n; + + for (n in t) { + e[n] = t[n]; + } + }; + + t.exports = function (t) { + var e = i(null); + return o.call(arguments, function (t) { + r(t) && u(Object(t), e); + }), e; + }; + }, function (t, e, n) { + + var r = n(0); + + t.exports = function (t) { + if (!r(t)) throw new TypeError("Cannot use null or undefined"); + return t; + }; + }, function (t, e, n) { + + t.exports = n(16)() ? String.prototype.contains : n(17); + }, function (t, e, n) { + + var r = "razdwatrzy"; + + t.exports = function () { + return "function" == typeof r.contains && !0 === r.contains("dwa") && !1 === r.contains("foo"); + }; + }, function (t, e, n) { + + var r = String.prototype.indexOf; + + t.exports = function (t) { + return r.call(this, t, arguments[1]) > -1; + }; + }, function (t, e, n) { + + var r = { + object: !0, + symbol: !0 + }; + + t.exports = function () { + if ("function" != typeof Symbol) return !1; + + try { + } catch (t) { + return !1; + } + + return !!r[_typeof(Symbol.iterator)] && !!r[_typeof(Symbol.toPrimitive)] && !!r[_typeof(Symbol.toStringTag)]; + }; + }, function (t, e, n) { + + t.exports = function (t) { + return !!t && ("symbol" == _typeof(t) || !!t.constructor && "Symbol" === t.constructor.name && "Symbol" === t[t.constructor.toStringTag]); + }; + }, function (t, e, n) { + + var r, + o, + _i, + u, + a = n(4), + s = n(21), + c = Object.create, + f = Object.defineProperties, + l = Object.defineProperty, + v = Object.prototype, + d = c(null); + + if ("function" == typeof Symbol) { + r = Symbol; + + try { + String(r()), u = !0; + } catch (t) {} + } + + var p = function () { + var t = c(null); + return function (e) { + for (var n, r, o = 0; t[e + (o || "")];) { + ++o; + } + + return e += o || "", t[e] = !0, n = "@@" + e, l(v, n, a.gs(null, function (t) { + r || (r = !0, l(this, n, a(t)), r = !1); + })), n; + }; + }(); + + _i = function i(t) { + if (this instanceof _i) throw new TypeError("Symbol is not a constructor"); + return o(t); + }, t.exports = o = function t(e) { + var n; + if (this instanceof t) throw new TypeError("Symbol is not a constructor"); + return u ? r(e) : (n = c(_i.prototype), e = void 0 === e ? "" : String(e), f(n, { + __description__: a("", e), + __name__: a("", p(e)) + })); + }, f(o, { + for: a(function (t) { + return d[t] ? d[t] : d[t] = o(String(t)); + }), + keyFor: a(function (t) { + var e; + s(t); + + for (e in d) { + if (d[e] === t) return e; + } + }), + hasInstance: a("", r && r.hasInstance || o("hasInstance")), + isConcatSpreadable: a("", r && r.isConcatSpreadable || o("isConcatSpreadable")), + iterator: a("", r && r.iterator || o("iterator")), + match: a("", r && r.match || o("match")), + replace: a("", r && r.replace || o("replace")), + search: a("", r && r.search || o("search")), + species: a("", r && r.species || o("species")), + split: a("", r && r.split || o("split")), + toPrimitive: a("", r && r.toPrimitive || o("toPrimitive")), + toStringTag: a("", r && r.toStringTag || o("toStringTag")), + unscopables: a("", r && r.unscopables || o("unscopables")) + }), f(_i.prototype, { + constructor: a(o), + toString: a("", function () { + return this.__name__; + }) + }), f(o.prototype, { + toString: a(function () { + return "Symbol (" + s(this).__description__ + ")"; + }), + valueOf: a(function () { + return s(this); + }) + }), l(o.prototype, o.toPrimitive, a("", function () { + var t = s(this); + return "symbol" == _typeof(t) ? t : t.toString(); + })), l(o.prototype, o.toStringTag, a("c", "Symbol")), l(_i.prototype, o.toStringTag, a("c", o.prototype[o.toStringTag])), l(_i.prototype, o.toPrimitive, a("c", o.prototype[o.toPrimitive])); + }, function (t, e, n) { + + var r = n(19); + + t.exports = function (t) { + if (!r(t)) throw new TypeError(t + " is not a symbol"); + return t; + }; + }]); + }); + }); + var momentRange$1 = unwrapExports(momentRange); + + var moment$1 = momentRange$1.extendMoment(moment); + var TIME_SERIES = { + day: function day(range$$1) { + return Array.from(range$$1.by('day')).map(function (d) { + return d.format('YYYY-MM-DDT00:00:00.000'); + }); + }, + month: function month(range$$1) { + return Array.from(range$$1.snapTo('month').by('month')).map(function (d) { + return d.format('YYYY-MM-01T00:00:00.000'); + }); + }, + year: function year(range$$1) { + return Array.from(range$$1.snapTo('year').by('year')).map(function (d) { + return d.format('YYYY-01-01T00:00:00.000'); + }); + }, + hour: function hour(range$$1) { + return Array.from(range$$1.by('hour')).map(function (d) { + return d.format('YYYY-MM-DDTHH:00:00.000'); + }); + }, + week: function week(range$$1) { + return Array.from(range$$1.snapTo('isoweek').by('week')).map(function (d) { + return d.startOf('isoweek').format('YYYY-MM-DDT00:00:00.000'); + }); + } + }; + /** + * Provides a convenient interface for data manipulation. + */ + + var ResultSet = + /*#__PURE__*/ + function () { + function ResultSet(loadResponse) { + _classCallCheck(this, ResultSet); + + this.loadResponse = loadResponse; + } + + _createClass(ResultSet, [{ + key: "series", + value: function series(pivotConfig) { + var _this = this; + + return this.seriesNames(pivotConfig).map(function (_ref) { + var title = _ref.title, + key = _ref.key; + return { + title: title, + series: _this.chartPivot(pivotConfig).map(function (_ref2) { + var category = _ref2.category, + x = _ref2.x, + obj = _objectWithoutProperties(_ref2, ["category", "x"]); + + return { + value: obj[key], + category: category, + x: x + }; + }) + }; + }); + } + }, { + key: "axisValues", + value: function axisValues(axis) { + var query = this.loadResponse.query; + return function (row) { + var value = function value(measure) { + return axis.filter(function (d) { + return d !== 'measures'; + }).map(function (d) { + return row[d] != null ? row[d] : null; + }).concat(measure ? [measure] : []); + }; + + if (axis.find(function (d) { + return d === 'measures'; + }) && (query.measures || []).length) { + return query.measures.map(value); + } + + return [value()]; + }; + } + }, { + key: "axisValuesString", + value: function axisValuesString(axisValues, delimiter) { + var formatValue = function formatValue(v) { + if (v == null) { + return '∅'; + } else if (v === '') { + return '[Empty string]'; + } else { + return v; + } + }; + + return axisValues.map(formatValue).join(delimiter || ', '); + } + }, { + key: "normalizePivotConfig", + value: function normalizePivotConfig(pivotConfig) { + var query = this.loadResponse.query; + var timeDimensions = (query.timeDimensions || []).filter(function (td) { + return !!td.granularity; + }); + pivotConfig = pivotConfig || (timeDimensions.length ? { + x: timeDimensions.map(function (td) { + return td.dimension; + }), + y: query.dimensions || [] + } : { + x: query.dimensions || [], + y: [] + }); + pivotConfig.x = pivotConfig.x || []; + pivotConfig.y = pivotConfig.y || []; + var allIncludedDimensions = pivotConfig.x.concat(pivotConfig.y); + var allDimensions = timeDimensions.map(function (td) { + return td.dimension; + }).concat(query.dimensions); + pivotConfig.x = pivotConfig.x.concat(allDimensions.filter(function (d) { + return allIncludedDimensions.indexOf(d) === -1; + })); + + if (!pivotConfig.x.concat(pivotConfig.y).find(function (d) { + return d === 'measures'; + })) { + pivotConfig.y = pivotConfig.y.concat(['measures']); + } + + if (!(query.measures || []).length) { + pivotConfig.x = pivotConfig.x.filter(function (d) { + return d !== 'measures'; + }); + pivotConfig.y = pivotConfig.y.filter(function (d) { + return d !== 'measures'; + }); + } + + if (pivotConfig.fillMissingDates == null) { + pivotConfig.fillMissingDates = true; + } + + return pivotConfig; + } + }, { + key: "timeSeries", + value: function timeSeries(timeDimension) { + if (!timeDimension.granularity) { + return null; + } + + var dateRange = timeDimension.dateRange; + + if (!dateRange) { + var dates = pipe(map(function (row) { + return row[timeDimension.dimension] && moment$1(row[timeDimension.dimension]); + }), filter(function (r) { + return !!r; + }))(this.loadResponse.data); + dateRange = dates.length && [reduce(minBy(function (d) { + return d.toDate(); + }), dates[0], dates), reduce(maxBy(function (d) { + return d.toDate(); + }), dates[0], dates)] || null; + } + + if (!dateRange) { + return null; + } + + var start = moment$1(dateRange[0]).format('YYYY-MM-DD 00:00:00'); + var end = moment$1(dateRange[1]).format('YYYY-MM-DD 23:59:59'); + var range$$1 = moment$1.range(start, end); + + if (!TIME_SERIES[timeDimension.granularity]) { + throw new Error("Unsupported time granularity: ".concat(timeDimension.granularity)); + } + + return TIME_SERIES[timeDimension.granularity](range$$1); + } + }, { + key: "pivot", + value: function pivot(pivotConfig) { + var _this2 = this; + + pivotConfig = this.normalizePivotConfig(pivotConfig); + var groupByXAxis = groupBy(function (_ref3) { + var xValues = _ref3.xValues; + return _this2.axisValuesString(xValues); + }); // eslint-disable-next-line no-unused-vars + + var measureValue = function measureValue(row, measure, xValues) { + return row[measure]; + }; + + if (pivotConfig.fillMissingDates && pivotConfig.x.length === 1 && equals(pivotConfig.x, (this.loadResponse.query.timeDimensions || []).filter(function (td) { + return !!td.granularity; + }).map(function (td) { + return td.dimension; + }))) { + var series = this.timeSeries(this.loadResponse.query.timeDimensions[0]); + + if (series) { + groupByXAxis = function groupByXAxis(rows) { + var byXValues = groupBy(function (_ref4) { + var xValues = _ref4.xValues; + return moment$1(xValues[0]).format(moment$1.HTML5_FMT.DATETIME_LOCAL_MS); + }, rows); + return series.map(function (d) { + return _defineProperty({}, d, byXValues[d] || [{ + xValues: [d], + row: {} + }]); + }).reduce(function (a, b) { + return Object.assign(a, b); + }, {}); + }; // eslint-disable-next-line no-unused-vars + + + measureValue = function measureValue(row, measure, xValues) { + return row[measure] || 0; + }; + } + } + + var xGrouped = pipe(map(function (row) { + return _this2.axisValues(pivotConfig.x)(row).map(function (xValues) { + return { + xValues: xValues, + row: row + }; + }); + }), unnest, groupByXAxis, toPairs)(this.loadResponse.data); + var allYValues = pipe(map( // eslint-disable-next-line no-unused-vars + function (_ref6) { + var _ref7 = _slicedToArray(_ref6, 2), + xValuesString = _ref7[0], + rows = _ref7[1]; + + return unnest( // collect Y values only from filled rows + rows.filter(function (_ref8) { + var row = _ref8.row; + return Object.keys(row).length > 0; + }).map(function (_ref9) { + var row = _ref9.row; + return _this2.axisValues(pivotConfig.y)(row); + })); + }), unnest, uniq)(xGrouped); // eslint-disable-next-line no-unused-vars + + return xGrouped.map(function (_ref10) { + var _ref11 = _slicedToArray(_ref10, 2), + xValuesString = _ref11[0], + rows = _ref11[1]; + + var xValues = rows[0].xValues; + var yGrouped = pipe(map(function (_ref12) { + var row = _ref12.row; + return _this2.axisValues(pivotConfig.y)(row).map(function (yValues) { + return { + yValues: yValues, + row: row + }; + }); + }), unnest, groupBy(function (_ref13) { + var yValues = _ref13.yValues; + return _this2.axisValuesString(yValues); + }))(rows); + return { + xValues: xValues, + yValuesArray: unnest(allYValues.map(function (yValues) { + var measure = pivotConfig.x.find(function (d) { + return d === 'measures'; + }) ? ResultSet.measureFromAxis(xValues) : ResultSet.measureFromAxis(yValues); + return (yGrouped[_this2.axisValuesString(yValues)] || [{ + row: {} + }]).map(function (_ref14) { + var row = _ref14.row; + return [yValues, measureValue(row, measure, xValues)]; + }); + })) + }; + }); + } + }, { + key: "pivotedRows", + value: function pivotedRows(pivotConfig) { + // TODO + return this.chartPivot(pivotConfig); + } + /** + * Returns normalized query result data in the following format. + * + * ```js + * // For query + * { + * measures: ['Stories.count'], + * timeDimensions: [{ + * dimension: 'Stories.time', + * dateRange: ['2015-01-01', '2015-12-31'], + * granularity: 'month' + * }] + * } + * + * // ResultSet.chartPivot() will return + * [ + * { "x":"2015-01-01T00:00:00", "Stories.count": 27120 }, + * { "x":"2015-02-01T00:00:00", "Stories.count": 25861 }, + * { "x": "2015-03-01T00:00:00", "Stories.count": 29661 }, + * //... + * ] + * ``` + * @param pivotConfig + */ + + }, { + key: "chartPivot", + value: function chartPivot(pivotConfig) { + var _this3 = this; + + return this.pivot(pivotConfig).map(function (_ref15) { + var xValues = _ref15.xValues, + yValuesArray = _ref15.yValuesArray; + return _objectSpread({ + category: _this3.axisValuesString(xValues, ', '), + // TODO deprecated + x: _this3.axisValuesString(xValues, ', ') + }, yValuesArray.map(function (_ref16) { + var _ref17 = _slicedToArray(_ref16, 2), + yValues = _ref17[0], + m = _ref17[1]; + + return _defineProperty({}, _this3.axisValuesString(yValues, ', '), m && Number.parseFloat(m)); + }).reduce(function (a, b) { + return Object.assign(a, b); + }, {})); + }); + } + /** + * Returns normalized query result data prepared for visualization in the table format. + * + * For example + * + * ```js + * // For query + * { + * measures: ['Stories.count'], + * timeDimensions: [{ + * dimension: 'Stories.time', + * dateRange: ['2015-01-01', '2015-12-31'], + * granularity: 'month' + * }] + * } + * + * // ResultSet.tablePivot() will return + * [ + * { "Stories.time": "2015-01-01T00:00:00", "Stories.count": 27120 }, + * { "Stories.time": "2015-02-01T00:00:00", "Stories.count": 25861 }, + * { "Stories.time": "2015-03-01T00:00:00", "Stories.count": 29661 }, + * //... + * ] + * ``` + * @param pivotConfig + * @returns {Array} of pivoted rows + */ + + }, { + key: "tablePivot", + value: function tablePivot(pivotConfig) { + var normalizedPivotConfig = this.normalizePivotConfig(pivotConfig); + + var valueToObject = function valueToObject(valuesArray, measureValue) { + return function (field, index) { + return _defineProperty({}, field === 'measures' ? valuesArray[index] : field, field === 'measures' ? measureValue : valuesArray[index]); + }; + }; + + return this.pivot(normalizedPivotConfig).map(function (_ref20) { + var xValues = _ref20.xValues, + yValuesArray = _ref20.yValuesArray; + return yValuesArray.map(function (_ref21) { + var _ref22 = _slicedToArray(_ref21, 2), + yValues = _ref22[0], + m = _ref22[1]; + + return normalizedPivotConfig.x.map(valueToObject(xValues, m)).concat(normalizedPivotConfig.y.map(valueToObject(yValues, m))).reduce(function (a, b) { + return Object.assign(a, b); + }, {}); + }).reduce(function (a, b) { + return Object.assign(a, b); + }, {}); + }); + } + /** + * Returns array of column definitions for `tablePivot`. + * + * For example + * + * ```js + * // For query + * { + * measures: ['Stories.count'], + * timeDimensions: [{ + * dimension: 'Stories.time', + * dateRange: ['2015-01-01', '2015-12-31'], + * granularity: 'month' + * }] + * } + * + * // ResultSet.tableColumns() will return + * [ + * { key: "Stories.time", title: "Stories Time" }, + * { key: "Stories.count", title: "Stories Count" }, + * //... + * ] + * ``` + * @param pivotConfig + * @returns {Array} of columns + */ + + }, { + key: "tableColumns", + value: function tableColumns(pivotConfig) { + var _this4 = this; + + var normalizedPivotConfig = this.normalizePivotConfig(pivotConfig); + + var column = function column(field) { + return field === 'measures' ? (_this4.query().measures || []).map(function (m) { + return { + key: m, + title: _this4.loadResponse.annotation.measures[m].title + }; + }) : [{ + key: field, + title: (_this4.loadResponse.annotation.dimensions[field] || _this4.loadResponse.annotation.timeDimensions[field]).title + }]; + }; + + return normalizedPivotConfig.x.map(column).concat(normalizedPivotConfig.y.map(column)).reduce(function (a, b) { + return a.concat(b); + }); + } + }, { + key: "totalRow", + value: function totalRow() { + return this.chartPivot()[0]; + } + }, { + key: "categories", + value: function categories(pivotConfig) { + // TODO + return this.chartPivot(pivotConfig); + } + /** + * Returns the array of series objects, containing `key` and `title` parameters. + * + * ```js + * // For query + * { + * measures: ['Stories.count'], + * timeDimensions: [{ + * dimension: 'Stories.time', + * dateRange: ['2015-01-01', '2015-12-31'], + * granularity: 'month' + * }] + * } + * + * // ResultSet.seriesNames() will return + * [ + * { "key":"Stories.count", "title": "Stories Count" } + * ] + * ``` + * @param pivotConfig + * @returns {Array} of series names + */ + + }, { + key: "seriesNames", + value: function seriesNames(pivotConfig) { + var _this5 = this; + + pivotConfig = this.normalizePivotConfig(pivotConfig); + return pipe(map(this.axisValues(pivotConfig.y)), unnest, uniq)(this.loadResponse.data).map(function (axisValues) { + return { + title: _this5.axisValuesString(pivotConfig.y.find(function (d) { + return d === 'measures'; + }) ? dropLast$1(1, axisValues).concat(_this5.loadResponse.annotation.measures[ResultSet.measureFromAxis(axisValues)].title) : axisValues, ', '), + key: _this5.axisValuesString(axisValues) + }; + }); + } + }, { + key: "query", + value: function query() { + return this.loadResponse.query; + } + }, { + key: "rawData", + value: function rawData() { + return this.loadResponse.data; + } + }], [{ + key: "measureFromAxis", + value: function measureFromAxis(axisValues) { + return axisValues[axisValues.length - 1]; + } + }]); + + return ResultSet; + }(); + + var SqlQuery = + /*#__PURE__*/ + function () { + function SqlQuery(sqlQuery) { + _classCallCheck(this, SqlQuery); + + this.sqlQuery = sqlQuery; + } + + _createClass(SqlQuery, [{ + key: "rawQuery", + value: function rawQuery() { + return this.sqlQuery.sql; + } + }, { + key: "sql", + value: function sql() { + return this.rawQuery().sql[0]; + } + }]); + + return SqlQuery; + }(); + + var memberMap = function memberMap(memberArray) { + return fromPairs(memberArray.map(function (m) { + return [m.name, m]; + })); + }; + + var operators = { + string: [{ + name: 'contains', + title: 'contains' + }, { + name: 'notContains', + title: 'does not contain' + }, { + name: 'equals', + title: 'equals' + }, { + name: 'notEquals', + title: 'does not equal' + }, { + name: 'set', + title: 'is set' + }, { + name: 'notSet', + title: 'is not set' + }], + number: [{ + name: 'equals', + title: 'equals' + }, { + name: 'notEquals', + title: 'does not equal' + }, { + name: 'set', + title: 'is set' + }, { + name: 'notSet', + title: 'is not set' + }, { + name: 'gt', + title: '>' + }, { + name: 'gte', + title: '>=' + }, { + name: 'lt', + title: '<' + }, { + name: 'lte', + title: '<=' + }] + }; + + var Meta = + /*#__PURE__*/ + function () { + function Meta(metaResponse) { + _classCallCheck(this, Meta); + + this.meta = metaResponse; + var cubes = this.meta.cubes; + this.cubes = cubes; + this.cubesMap = fromPairs(cubes.map(function (c) { + return [c.name, { + measures: memberMap(c.measures), + dimensions: memberMap(c.dimensions), + segments: memberMap(c.segments) + }]; + })); + } + + _createClass(Meta, [{ + key: "membersForQuery", + value: function membersForQuery(query, memberType) { + return unnest(this.cubes.map(function (c) { + return c[memberType]; + })); + } + }, { + key: "resolveMember", + value: function resolveMember(memberName, memberType) { + var _this = this; + + var _memberName$split = memberName.split('.'), + _memberName$split2 = _slicedToArray(_memberName$split, 1), + cube = _memberName$split2[0]; + + if (!this.cubesMap[cube]) { + return { + title: memberName, + error: "Cube not found ".concat(cube, " for path '").concat(memberName, "'") + }; + } + + var memberTypes = Array.isArray(memberType) ? memberType : [memberType]; + var member = memberTypes.map(function (type$$1) { + return _this.cubesMap[cube][type$$1] && _this.cubesMap[cube][type$$1][memberName]; + }).find(function (m) { + return m; + }); + + if (!member) { + return { + title: memberName, + error: "Path not found '".concat(memberName, "'") + }; + } + + return member; + } + }, { + key: "defaultTimeDimensionNameFor", + value: function defaultTimeDimensionNameFor(memberName) { + var _this2 = this; + + var _memberName$split3 = memberName.split('.'), + _memberName$split4 = _slicedToArray(_memberName$split3, 1), + cube = _memberName$split4[0]; + + if (!this.cubesMap[cube]) { + return null; + } + + return Object.keys(this.cubesMap[cube].dimensions || {}).find(function (d) { + return _this2.cubesMap[cube].dimensions[d].type === 'time'; + }); + } + }, { + key: "filterOperatorsForMember", + value: function filterOperatorsForMember(memberName, memberType) { + var member = this.resolveMember(memberName, memberType); + return operators[member.type] || operators.string; + } + }]); + + return Meta; + }(); + + var ProgressResult = + /*#__PURE__*/ + function () { + function ProgressResult(progressResponse) { + _classCallCheck(this, ProgressResult); + + this.progressResponse = progressResponse; + } + + _createClass(ProgressResult, [{ + key: "stage", + value: function stage() { + return this.progressResponse.stage; + } + }, { + key: "timeElapsed", + value: function timeElapsed() { + return this.progressResponse.timeElapsed; + } + }]); + + return ProgressResult; + }(); + + var TYPED = _uid('typed_array'); + var VIEW = _uid('view'); + var ABV = !!(_global.ArrayBuffer && _global.DataView); + var CONSTR = ABV; + var i$2 = 0; + var l = 9; + var Typed; + + var TypedArrayConstructors = ( + 'Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array' + ).split(','); + + while (i$2 < l) { + if (Typed = _global[TypedArrayConstructors[i$2++]]) { + _hide(Typed.prototype, TYPED, true); + _hide(Typed.prototype, VIEW, true); + } else CONSTR = false; + } + + var _typed = { + ABV: ABV, + CONSTR: CONSTR, + TYPED: TYPED, + VIEW: VIEW + }; + + // https://tc39.github.io/ecma262/#sec-toindex + + + var _toIndex = function (it) { + if (it === undefined) return 0; + var number = _toInteger(it); + var length = _toLength(number); + if (number !== length) throw RangeError('Wrong length!'); + return length; + }; + + var _arrayFill = function fill(value /* , start = 0, end = @length */) { + var O = _toObject(this); + var length = _toLength(O.length); + var aLen = arguments.length; + var index = _toAbsoluteIndex(aLen > 1 ? arguments[1] : undefined, length); + var end = aLen > 2 ? arguments[2] : undefined; + var endPos = end === undefined ? length : _toAbsoluteIndex(end, length); + while (endPos > index) O[index++] = value; + return O; + }; + + var _typedBuffer = createCommonjsModule(function (module, exports) { + + + + + + + + + + + + var gOPN = _objectGopn.f; + var dP = _objectDp.f; + + + var ARRAY_BUFFER = 'ArrayBuffer'; + var DATA_VIEW = 'DataView'; + var PROTOTYPE = 'prototype'; + var WRONG_LENGTH = 'Wrong length!'; + var WRONG_INDEX = 'Wrong index!'; + var $ArrayBuffer = _global[ARRAY_BUFFER]; + var $DataView = _global[DATA_VIEW]; + var Math = _global.Math; + var RangeError = _global.RangeError; + // eslint-disable-next-line no-shadow-restricted-names + var Infinity = _global.Infinity; + var BaseBuffer = $ArrayBuffer; + var abs = Math.abs; + var pow = Math.pow; + var floor = Math.floor; + var log = Math.log; + var LN2 = Math.LN2; + var BUFFER = 'buffer'; + var BYTE_LENGTH = 'byteLength'; + var BYTE_OFFSET = 'byteOffset'; + var $BUFFER = _descriptors ? '_b' : BUFFER; + var $LENGTH = _descriptors ? '_l' : BYTE_LENGTH; + var $OFFSET = _descriptors ? '_o' : BYTE_OFFSET; + + // IEEE754 conversions based on https://github.com/feross/ieee754 + function packIEEE754(value, mLen, nBytes) { + var buffer = new Array(nBytes); + var eLen = nBytes * 8 - mLen - 1; + var eMax = (1 << eLen) - 1; + var eBias = eMax >> 1; + var rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0; + var i = 0; + var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; + var e, m, c; + value = abs(value); + // eslint-disable-next-line no-self-compare + if (value != value || value === Infinity) { + // eslint-disable-next-line no-self-compare + m = value != value ? 1 : 0; + e = eMax; + } else { + e = floor(log(value) / LN2); + if (value * (c = pow(2, -e)) < 1) { + e--; + c *= 2; + } + if (e + eBias >= 1) { + value += rt / c; + } else { + value += rt * pow(2, 1 - eBias); + } + if (value * c >= 2) { + e++; + c /= 2; + } + if (e + eBias >= eMax) { + m = 0; + e = eMax; + } else if (e + eBias >= 1) { + m = (value * c - 1) * pow(2, mLen); + e = e + eBias; + } else { + m = value * pow(2, eBias - 1) * pow(2, mLen); + e = 0; + } + } + for (; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8); + e = e << mLen | m; + eLen += mLen; + for (; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8); + buffer[--i] |= s * 128; + return buffer; + } + function unpackIEEE754(buffer, mLen, nBytes) { + var eLen = nBytes * 8 - mLen - 1; + var eMax = (1 << eLen) - 1; + var eBias = eMax >> 1; + var nBits = eLen - 7; + var i = nBytes - 1; + var s = buffer[i--]; + var e = s & 127; + var m; + s >>= 7; + for (; nBits > 0; e = e * 256 + buffer[i], i--, nBits -= 8); + m = e & (1 << -nBits) - 1; + e >>= -nBits; + nBits += mLen; + for (; nBits > 0; m = m * 256 + buffer[i], i--, nBits -= 8); + if (e === 0) { + e = 1 - eBias; + } else if (e === eMax) { + return m ? NaN : s ? -Infinity : Infinity; + } else { + m = m + pow(2, mLen); + e = e - eBias; + } return (s ? -1 : 1) * m * pow(2, e - mLen); + } + + function unpackI32(bytes) { + return bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0]; + } + function packI8(it) { + return [it & 0xff]; + } + function packI16(it) { + return [it & 0xff, it >> 8 & 0xff]; + } + function packI32(it) { + return [it & 0xff, it >> 8 & 0xff, it >> 16 & 0xff, it >> 24 & 0xff]; + } + function packF64(it) { + return packIEEE754(it, 52, 8); + } + function packF32(it) { + return packIEEE754(it, 23, 4); + } + + function addGetter(C, key, internal) { + dP(C[PROTOTYPE], key, { get: function () { return this[internal]; } }); + } + + function get(view, bytes, index, isLittleEndian) { + var numIndex = +index; + var intIndex = _toIndex(numIndex); + if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX); + var store = view[$BUFFER]._b; + var start = intIndex + view[$OFFSET]; + var pack = store.slice(start, start + bytes); + return isLittleEndian ? pack : pack.reverse(); + } + function set(view, bytes, index, conversion, value, isLittleEndian) { + var numIndex = +index; + var intIndex = _toIndex(numIndex); + if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX); + var store = view[$BUFFER]._b; + var start = intIndex + view[$OFFSET]; + var pack = conversion(+value); + for (var i = 0; i < bytes; i++) store[start + i] = pack[isLittleEndian ? i : bytes - i - 1]; + } + + if (!_typed.ABV) { + $ArrayBuffer = function ArrayBuffer(length) { + _anInstance(this, $ArrayBuffer, ARRAY_BUFFER); + var byteLength = _toIndex(length); + this._b = _arrayFill.call(new Array(byteLength), 0); + this[$LENGTH] = byteLength; + }; + + $DataView = function DataView(buffer, byteOffset, byteLength) { + _anInstance(this, $DataView, DATA_VIEW); + _anInstance(buffer, $ArrayBuffer, DATA_VIEW); + var bufferLength = buffer[$LENGTH]; + var offset = _toInteger(byteOffset); + if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset!'); + byteLength = byteLength === undefined ? bufferLength - offset : _toLength(byteLength); + if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH); + this[$BUFFER] = buffer; + this[$OFFSET] = offset; + this[$LENGTH] = byteLength; + }; + + if (_descriptors) { + addGetter($ArrayBuffer, BYTE_LENGTH, '_l'); + addGetter($DataView, BUFFER, '_b'); + addGetter($DataView, BYTE_LENGTH, '_l'); + addGetter($DataView, BYTE_OFFSET, '_o'); + } + + _redefineAll($DataView[PROTOTYPE], { + getInt8: function getInt8(byteOffset) { + return get(this, 1, byteOffset)[0] << 24 >> 24; + }, + getUint8: function getUint8(byteOffset) { + return get(this, 1, byteOffset)[0]; + }, + getInt16: function getInt16(byteOffset /* , littleEndian */) { + var bytes = get(this, 2, byteOffset, arguments[1]); + return (bytes[1] << 8 | bytes[0]) << 16 >> 16; + }, + getUint16: function getUint16(byteOffset /* , littleEndian */) { + var bytes = get(this, 2, byteOffset, arguments[1]); + return bytes[1] << 8 | bytes[0]; + }, + getInt32: function getInt32(byteOffset /* , littleEndian */) { + return unpackI32(get(this, 4, byteOffset, arguments[1])); + }, + getUint32: function getUint32(byteOffset /* , littleEndian */) { + return unpackI32(get(this, 4, byteOffset, arguments[1])) >>> 0; + }, + getFloat32: function getFloat32(byteOffset /* , littleEndian */) { + return unpackIEEE754(get(this, 4, byteOffset, arguments[1]), 23, 4); + }, + getFloat64: function getFloat64(byteOffset /* , littleEndian */) { + return unpackIEEE754(get(this, 8, byteOffset, arguments[1]), 52, 8); + }, + setInt8: function setInt8(byteOffset, value) { + set(this, 1, byteOffset, packI8, value); + }, + setUint8: function setUint8(byteOffset, value) { + set(this, 1, byteOffset, packI8, value); + }, + setInt16: function setInt16(byteOffset, value /* , littleEndian */) { + set(this, 2, byteOffset, packI16, value, arguments[2]); + }, + setUint16: function setUint16(byteOffset, value /* , littleEndian */) { + set(this, 2, byteOffset, packI16, value, arguments[2]); + }, + setInt32: function setInt32(byteOffset, value /* , littleEndian */) { + set(this, 4, byteOffset, packI32, value, arguments[2]); + }, + setUint32: function setUint32(byteOffset, value /* , littleEndian */) { + set(this, 4, byteOffset, packI32, value, arguments[2]); + }, + setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) { + set(this, 4, byteOffset, packF32, value, arguments[2]); + }, + setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) { + set(this, 8, byteOffset, packF64, value, arguments[2]); + } + }); + } else { + if (!_fails(function () { + $ArrayBuffer(1); + }) || !_fails(function () { + new $ArrayBuffer(-1); // eslint-disable-line no-new + }) || _fails(function () { + new $ArrayBuffer(); // eslint-disable-line no-new + new $ArrayBuffer(1.5); // eslint-disable-line no-new + new $ArrayBuffer(NaN); // eslint-disable-line no-new + return $ArrayBuffer.name != ARRAY_BUFFER; + })) { + $ArrayBuffer = function ArrayBuffer(length) { + _anInstance(this, $ArrayBuffer); + return new BaseBuffer(_toIndex(length)); + }; + var ArrayBufferProto = $ArrayBuffer[PROTOTYPE] = BaseBuffer[PROTOTYPE]; + for (var keys = gOPN(BaseBuffer), j = 0, key; keys.length > j;) { + if (!((key = keys[j++]) in $ArrayBuffer)) _hide($ArrayBuffer, key, BaseBuffer[key]); + } + ArrayBufferProto.constructor = $ArrayBuffer; + } + // iOS Safari 7.x bug + var view = new $DataView(new $ArrayBuffer(2)); + var $setInt8 = $DataView[PROTOTYPE].setInt8; + view.setInt8(0, 2147483648); + view.setInt8(1, 2147483649); + if (view.getInt8(0) || !view.getInt8(1)) _redefineAll($DataView[PROTOTYPE], { + setInt8: function setInt8(byteOffset, value) { + $setInt8.call(this, byteOffset, value << 24 >> 24); + }, + setUint8: function setUint8(byteOffset, value) { + $setInt8.call(this, byteOffset, value << 24 >> 24); + } + }, true); + } + _setToStringTag($ArrayBuffer, ARRAY_BUFFER); + _setToStringTag($DataView, DATA_VIEW); + _hide($DataView[PROTOTYPE], _typed.VIEW, true); + exports[ARRAY_BUFFER] = $ArrayBuffer; + exports[DATA_VIEW] = $DataView; + }); + + var _arrayCopyWithin = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) { + var O = _toObject(this); + var len = _toLength(O.length); + var to = _toAbsoluteIndex(target, len); + var from = _toAbsoluteIndex(start, len); + var end = arguments.length > 2 ? arguments[2] : undefined; + var count = Math.min((end === undefined ? len : _toAbsoluteIndex(end, len)) - from, len - to); + var inc = 1; + if (from < to && to < from + count) { + inc = -1; + from += count - 1; + to += count - 1; + } + while (count-- > 0) { + if (from in O) O[to] = O[from]; + else delete O[to]; + to += inc; + from += inc; + } return O; + }; + + var _typedArray = createCommonjsModule(function (module) { + if (_descriptors) { + var LIBRARY = _library; + var global = _global; + var fails = _fails; + var $export = _export; + var $typed = _typed; + var $buffer = _typedBuffer; + var ctx = _ctx; + var anInstance = _anInstance; + var propertyDesc = _propertyDesc; + var hide = _hide; + var redefineAll = _redefineAll; + var toInteger = _toInteger; + var toLength = _toLength; + var toIndex = _toIndex; + var toAbsoluteIndex = _toAbsoluteIndex; + var toPrimitive = _toPrimitive; + var has = _has; + var classof = _classof; + var isObject = _isObject; + var toObject = _toObject; + var isArrayIter = _isArrayIter; + var create = _objectCreate; + var getPrototypeOf = _objectGpo; + var gOPN = _objectGopn.f; + var getIterFn = core_getIteratorMethod; + var uid = _uid; + var wks = _wks; + var createArrayMethod = _arrayMethods; + var createArrayIncludes = _arrayIncludes; + var speciesConstructor = _speciesConstructor; + var ArrayIterators = es6_array_iterator; + var Iterators = _iterators; + var $iterDetect = _iterDetect; + var setSpecies = _setSpecies; + var arrayFill = _arrayFill; + var arrayCopyWithin = _arrayCopyWithin; + var $DP = _objectDp; + var $GOPD = _objectGopd; + var dP = $DP.f; + var gOPD = $GOPD.f; + var RangeError = global.RangeError; + var TypeError = global.TypeError; + var Uint8Array = global.Uint8Array; + var ARRAY_BUFFER = 'ArrayBuffer'; + var SHARED_BUFFER = 'Shared' + ARRAY_BUFFER; + var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT'; + var PROTOTYPE = 'prototype'; + var ArrayProto = Array[PROTOTYPE]; + var $ArrayBuffer = $buffer.ArrayBuffer; + var $DataView = $buffer.DataView; + var arrayForEach = createArrayMethod(0); + var arrayFilter = createArrayMethod(2); + var arraySome = createArrayMethod(3); + var arrayEvery = createArrayMethod(4); + var arrayFind = createArrayMethod(5); + var arrayFindIndex = createArrayMethod(6); + var arrayIncludes = createArrayIncludes(true); + var arrayIndexOf = createArrayIncludes(false); + var arrayValues = ArrayIterators.values; + var arrayKeys = ArrayIterators.keys; + var arrayEntries = ArrayIterators.entries; + var arrayLastIndexOf = ArrayProto.lastIndexOf; + var arrayReduce = ArrayProto.reduce; + var arrayReduceRight = ArrayProto.reduceRight; + var arrayJoin = ArrayProto.join; + var arraySort = ArrayProto.sort; + var arraySlice = ArrayProto.slice; + var arrayToString = ArrayProto.toString; + var arrayToLocaleString = ArrayProto.toLocaleString; + var ITERATOR = wks('iterator'); + var TAG = wks('toStringTag'); + var TYPED_CONSTRUCTOR = uid('typed_constructor'); + var DEF_CONSTRUCTOR = uid('def_constructor'); + var ALL_CONSTRUCTORS = $typed.CONSTR; + var TYPED_ARRAY = $typed.TYPED; + var VIEW = $typed.VIEW; + var WRONG_LENGTH = 'Wrong length!'; + + var $map = createArrayMethod(1, function (O, length) { + return allocate(speciesConstructor(O, O[DEF_CONSTRUCTOR]), length); + }); + + var LITTLE_ENDIAN = fails(function () { + // eslint-disable-next-line no-undef + return new Uint8Array(new Uint16Array([1]).buffer)[0] === 1; + }); + + var FORCED_SET = !!Uint8Array && !!Uint8Array[PROTOTYPE].set && fails(function () { + new Uint8Array(1).set({}); + }); + + var toOffset = function (it, BYTES) { + var offset = toInteger(it); + if (offset < 0 || offset % BYTES) throw RangeError('Wrong offset!'); + return offset; + }; + + var validate = function (it) { + if (isObject(it) && TYPED_ARRAY in it) return it; + throw TypeError(it + ' is not a typed array!'); + }; + + var allocate = function (C, length) { + if (!(isObject(C) && TYPED_CONSTRUCTOR in C)) { + throw TypeError('It is not a typed array constructor!'); + } return new C(length); + }; + + var speciesFromList = function (O, list) { + return fromList(speciesConstructor(O, O[DEF_CONSTRUCTOR]), list); + }; + + var fromList = function (C, list) { + var index = 0; + var length = list.length; + var result = allocate(C, length); + while (length > index) result[index] = list[index++]; + return result; + }; + + var addGetter = function (it, key, internal) { + dP(it, key, { get: function () { return this._d[internal]; } }); + }; + + var $from = function from(source /* , mapfn, thisArg */) { + var O = toObject(source); + var aLen = arguments.length; + var mapfn = aLen > 1 ? arguments[1] : undefined; + var mapping = mapfn !== undefined; + var iterFn = getIterFn(O); + var i, length, values, result, step, iterator; + if (iterFn != undefined && !isArrayIter(iterFn)) { + for (iterator = iterFn.call(O), values = [], i = 0; !(step = iterator.next()).done; i++) { + values.push(step.value); + } O = values; + } + if (mapping && aLen > 2) mapfn = ctx(mapfn, arguments[2], 2); + for (i = 0, length = toLength(O.length), result = allocate(this, length); length > i; i++) { + result[i] = mapping ? mapfn(O[i], i) : O[i]; + } + return result; + }; + + var $of = function of(/* ...items */) { + var index = 0; + var length = arguments.length; + var result = allocate(this, length); + while (length > index) result[index] = arguments[index++]; + return result; + }; + + // iOS Safari 6.x fails here + var TO_LOCALE_BUG = !!Uint8Array && fails(function () { arrayToLocaleString.call(new Uint8Array(1)); }); + + var $toLocaleString = function toLocaleString() { + return arrayToLocaleString.apply(TO_LOCALE_BUG ? arraySlice.call(validate(this)) : validate(this), arguments); + }; + + var proto = { + copyWithin: function copyWithin(target, start /* , end */) { + return arrayCopyWithin.call(validate(this), target, start, arguments.length > 2 ? arguments[2] : undefined); + }, + every: function every(callbackfn /* , thisArg */) { + return arrayEvery(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + }, + fill: function fill(value /* , start, end */) { // eslint-disable-line no-unused-vars + return arrayFill.apply(validate(this), arguments); + }, + filter: function filter(callbackfn /* , thisArg */) { + return speciesFromList(this, arrayFilter(validate(this), callbackfn, + arguments.length > 1 ? arguments[1] : undefined)); + }, + find: function find(predicate /* , thisArg */) { + return arrayFind(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined); + }, + findIndex: function findIndex(predicate /* , thisArg */) { + return arrayFindIndex(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined); + }, + forEach: function forEach(callbackfn /* , thisArg */) { + arrayForEach(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + }, + indexOf: function indexOf(searchElement /* , fromIndex */) { + return arrayIndexOf(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); + }, + includes: function includes(searchElement /* , fromIndex */) { + return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); + }, + join: function join(separator) { // eslint-disable-line no-unused-vars + return arrayJoin.apply(validate(this), arguments); + }, + lastIndexOf: function lastIndexOf(searchElement /* , fromIndex */) { // eslint-disable-line no-unused-vars + return arrayLastIndexOf.apply(validate(this), arguments); + }, + map: function map(mapfn /* , thisArg */) { + return $map(validate(this), mapfn, arguments.length > 1 ? arguments[1] : undefined); + }, + reduce: function reduce(callbackfn /* , initialValue */) { // eslint-disable-line no-unused-vars + return arrayReduce.apply(validate(this), arguments); + }, + reduceRight: function reduceRight(callbackfn /* , initialValue */) { // eslint-disable-line no-unused-vars + return arrayReduceRight.apply(validate(this), arguments); + }, + reverse: function reverse() { + var that = this; + var length = validate(that).length; + var middle = Math.floor(length / 2); + var index = 0; + var value; + while (index < middle) { + value = that[index]; + that[index++] = that[--length]; + that[length] = value; + } return that; + }, + some: function some(callbackfn /* , thisArg */) { + return arraySome(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + }, + sort: function sort(comparefn) { + return arraySort.call(validate(this), comparefn); + }, + subarray: function subarray(begin, end) { + var O = validate(this); + var length = O.length; + var $begin = toAbsoluteIndex(begin, length); + return new (speciesConstructor(O, O[DEF_CONSTRUCTOR]))( + O.buffer, + O.byteOffset + $begin * O.BYTES_PER_ELEMENT, + toLength((end === undefined ? length : toAbsoluteIndex(end, length)) - $begin) + ); + } + }; + + var $slice = function slice(start, end) { + return speciesFromList(this, arraySlice.call(validate(this), start, end)); + }; + + var $set = function set(arrayLike /* , offset */) { + validate(this); + var offset = toOffset(arguments[1], 1); + var length = this.length; + var src = toObject(arrayLike); + var len = toLength(src.length); + var index = 0; + if (len + offset > length) throw RangeError(WRONG_LENGTH); + while (index < len) this[offset + index] = src[index++]; + }; + + var $iterators = { + entries: function entries() { + return arrayEntries.call(validate(this)); + }, + keys: function keys() { + return arrayKeys.call(validate(this)); + }, + values: function values() { + return arrayValues.call(validate(this)); + } + }; + + var isTAIndex = function (target, key) { + return isObject(target) + && target[TYPED_ARRAY] + && typeof key != 'symbol' + && key in target + && String(+key) == String(key); + }; + var $getDesc = function getOwnPropertyDescriptor(target, key) { + return isTAIndex(target, key = toPrimitive(key, true)) + ? propertyDesc(2, target[key]) + : gOPD(target, key); + }; + var $setDesc = function defineProperty(target, key, desc) { + if (isTAIndex(target, key = toPrimitive(key, true)) + && isObject(desc) + && has(desc, 'value') + && !has(desc, 'get') + && !has(desc, 'set') + // TODO: add validation descriptor w/o calling accessors + && !desc.configurable + && (!has(desc, 'writable') || desc.writable) + && (!has(desc, 'enumerable') || desc.enumerable) + ) { + target[key] = desc.value; + return target; + } return dP(target, key, desc); + }; + + if (!ALL_CONSTRUCTORS) { + $GOPD.f = $getDesc; + $DP.f = $setDesc; + } + + $export($export.S + $export.F * !ALL_CONSTRUCTORS, 'Object', { + getOwnPropertyDescriptor: $getDesc, + defineProperty: $setDesc + }); + + if (fails(function () { arrayToString.call({}); })) { + arrayToString = arrayToLocaleString = function toString() { + return arrayJoin.call(this); + }; + } + + var $TypedArrayPrototype$ = redefineAll({}, proto); + redefineAll($TypedArrayPrototype$, $iterators); + hide($TypedArrayPrototype$, ITERATOR, $iterators.values); + redefineAll($TypedArrayPrototype$, { + slice: $slice, + set: $set, + constructor: function () { /* noop */ }, + toString: arrayToString, + toLocaleString: $toLocaleString + }); + addGetter($TypedArrayPrototype$, 'buffer', 'b'); + addGetter($TypedArrayPrototype$, 'byteOffset', 'o'); + addGetter($TypedArrayPrototype$, 'byteLength', 'l'); + addGetter($TypedArrayPrototype$, 'length', 'e'); + dP($TypedArrayPrototype$, TAG, { + get: function () { return this[TYPED_ARRAY]; } + }); + + // eslint-disable-next-line max-statements + module.exports = function (KEY, BYTES, wrapper, CLAMPED) { + CLAMPED = !!CLAMPED; + var NAME = KEY + (CLAMPED ? 'Clamped' : '') + 'Array'; + var GETTER = 'get' + KEY; + var SETTER = 'set' + KEY; + var TypedArray = global[NAME]; + var Base = TypedArray || {}; + var TAC = TypedArray && getPrototypeOf(TypedArray); + var FORCED = !TypedArray || !$typed.ABV; + var O = {}; + var TypedArrayPrototype = TypedArray && TypedArray[PROTOTYPE]; + var getter = function (that, index) { + var data = that._d; + return data.v[GETTER](index * BYTES + data.o, LITTLE_ENDIAN); + }; + var setter = function (that, index, value) { + var data = that._d; + if (CLAMPED) value = (value = Math.round(value)) < 0 ? 0 : value > 0xff ? 0xff : value & 0xff; + data.v[SETTER](index * BYTES + data.o, value, LITTLE_ENDIAN); + }; + var addElement = function (that, index) { + dP(that, index, { + get: function () { + return getter(this, index); + }, + set: function (value) { + return setter(this, index, value); + }, + enumerable: true + }); + }; + if (FORCED) { + TypedArray = wrapper(function (that, data, $offset, $length) { + anInstance(that, TypedArray, NAME, '_d'); + var index = 0; + var offset = 0; + var buffer, byteLength, length, klass; + if (!isObject(data)) { + length = toIndex(data); + byteLength = length * BYTES; + buffer = new $ArrayBuffer(byteLength); + } else if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) { + buffer = data; + offset = toOffset($offset, BYTES); + var $len = data.byteLength; + if ($length === undefined) { + if ($len % BYTES) throw RangeError(WRONG_LENGTH); + byteLength = $len - offset; + if (byteLength < 0) throw RangeError(WRONG_LENGTH); + } else { + byteLength = toLength($length) * BYTES; + if (byteLength + offset > $len) throw RangeError(WRONG_LENGTH); + } + length = byteLength / BYTES; + } else if (TYPED_ARRAY in data) { + return fromList(TypedArray, data); + } else { + return $from.call(TypedArray, data); + } + hide(that, '_d', { + b: buffer, + o: offset, + l: byteLength, + e: length, + v: new $DataView(buffer) + }); + while (index < length) addElement(that, index++); + }); + TypedArrayPrototype = TypedArray[PROTOTYPE] = create($TypedArrayPrototype$); + hide(TypedArrayPrototype, 'constructor', TypedArray); + } else if (!fails(function () { + TypedArray(1); + }) || !fails(function () { + new TypedArray(-1); // eslint-disable-line no-new + }) || !$iterDetect(function (iter) { + new TypedArray(); // eslint-disable-line no-new + new TypedArray(null); // eslint-disable-line no-new + new TypedArray(1.5); // eslint-disable-line no-new + new TypedArray(iter); // eslint-disable-line no-new + }, true)) { + TypedArray = wrapper(function (that, data, $offset, $length) { + anInstance(that, TypedArray, NAME); + var klass; + // `ws` module bug, temporarily remove validation length for Uint8Array + // https://github.com/websockets/ws/pull/645 + if (!isObject(data)) return new Base(toIndex(data)); + if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) { + return $length !== undefined + ? new Base(data, toOffset($offset, BYTES), $length) + : $offset !== undefined + ? new Base(data, toOffset($offset, BYTES)) + : new Base(data); + } + if (TYPED_ARRAY in data) return fromList(TypedArray, data); + return $from.call(TypedArray, data); + }); + arrayForEach(TAC !== Function.prototype ? gOPN(Base).concat(gOPN(TAC)) : gOPN(Base), function (key) { + if (!(key in TypedArray)) hide(TypedArray, key, Base[key]); + }); + TypedArray[PROTOTYPE] = TypedArrayPrototype; + if (!LIBRARY) TypedArrayPrototype.constructor = TypedArray; + } + var $nativeIterator = TypedArrayPrototype[ITERATOR]; + var CORRECT_ITER_NAME = !!$nativeIterator + && ($nativeIterator.name == 'values' || $nativeIterator.name == undefined); + var $iterator = $iterators.values; + hide(TypedArray, TYPED_CONSTRUCTOR, true); + hide(TypedArrayPrototype, TYPED_ARRAY, NAME); + hide(TypedArrayPrototype, VIEW, true); + hide(TypedArrayPrototype, DEF_CONSTRUCTOR, TypedArray); + + if (CLAMPED ? new TypedArray(1)[TAG] != NAME : !(TAG in TypedArrayPrototype)) { + dP(TypedArrayPrototype, TAG, { + get: function () { return NAME; } + }); + } + + O[NAME] = TypedArray; + + $export($export.G + $export.W + $export.F * (TypedArray != Base), O); + + $export($export.S, NAME, { + BYTES_PER_ELEMENT: BYTES + }); + + $export($export.S + $export.F * fails(function () { Base.of.call(TypedArray, 1); }), NAME, { + from: $from, + of: $of + }); + + if (!(BYTES_PER_ELEMENT in TypedArrayPrototype)) hide(TypedArrayPrototype, BYTES_PER_ELEMENT, BYTES); + + $export($export.P, NAME, proto); + + setSpecies(NAME); + + $export($export.P + $export.F * FORCED_SET, NAME, { set: $set }); + + $export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators); + + if (!LIBRARY && TypedArrayPrototype.toString != arrayToString) TypedArrayPrototype.toString = arrayToString; + + $export($export.P + $export.F * fails(function () { + new TypedArray(1).slice(); + }), NAME, { slice: $slice }); + + $export($export.P + $export.F * (fails(function () { + return [1, 2].toLocaleString() != new TypedArray([1, 2]).toLocaleString(); + }) || !fails(function () { + TypedArrayPrototype.toLocaleString.call([1, 2]); + })), NAME, { toLocaleString: $toLocaleString }); + + Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator; + if (!LIBRARY && !CORRECT_ITER_NAME) hide(TypedArrayPrototype, ITERATOR, $iterator); + }; + } else module.exports = function () { /* empty */ }; + }); + + _typedArray('Uint8', 1, function (init) { + return function Uint8Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; + }); + + _export(_export.G + _export.W + _export.F * !_typed.ABV, { + DataView: _typedBuffer.DataView + }); + + var browserPonyfill = createCommonjsModule(function (module, exports) { + var __self__ = function (root) { + function F() { + this.fetch = false; + } + + F.prototype = root; + return new F(); + }(typeof self !== 'undefined' ? self : commonjsGlobal); + + (function (self) { + var irrelevant = function (exports) { + var support = { + searchParams: 'URLSearchParams' in self, + iterable: 'Symbol' in self && 'iterator' in Symbol, + blob: 'FileReader' in self && 'Blob' in self && function () { + try { + new Blob(); + return true; + } catch (e) { + return false; + } + }(), + formData: 'FormData' in self, + arrayBuffer: 'ArrayBuffer' in self + }; + + function isDataView(obj) { + return obj && DataView.prototype.isPrototypeOf(obj); + } + + if (support.arrayBuffer) { + var viewClasses = ['[object Int8Array]', '[object Uint8Array]', '[object Uint8ClampedArray]', '[object Int16Array]', '[object Uint16Array]', '[object Int32Array]', '[object Uint32Array]', '[object Float32Array]', '[object Float64Array]']; + + var isArrayBufferView = ArrayBuffer.isView || function (obj) { + return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1; + }; + } + + function normalizeName(name) { + if (typeof name !== 'string') { + name = String(name); + } + + if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) { + throw new TypeError('Invalid character in header field name'); + } + + return name.toLowerCase(); + } + + function normalizeValue(value) { + if (typeof value !== 'string') { + value = String(value); + } + + return value; + } // Build a destructive iterator for the value list + + + function iteratorFor(items) { + var iterator = { + next: function next() { + var value = items.shift(); + return { + done: value === undefined, + value: value + }; + } + }; + + if (support.iterable) { + iterator[Symbol.iterator] = function () { + return iterator; + }; + } + + return iterator; + } + + function Headers(headers) { + this.map = {}; + + if (headers instanceof Headers) { + headers.forEach(function (value, name) { + this.append(name, value); + }, this); + } else if (Array.isArray(headers)) { + headers.forEach(function (header) { + this.append(header[0], header[1]); + }, this); + } else if (headers) { + Object.getOwnPropertyNames(headers).forEach(function (name) { + this.append(name, headers[name]); + }, this); + } + } + + Headers.prototype.append = function (name, value) { + name = normalizeName(name); + value = normalizeValue(value); + var oldValue = this.map[name]; + this.map[name] = oldValue ? oldValue + ', ' + value : value; + }; + + Headers.prototype['delete'] = function (name) { + delete this.map[normalizeName(name)]; + }; + + Headers.prototype.get = function (name) { + name = normalizeName(name); + return this.has(name) ? this.map[name] : null; + }; + + Headers.prototype.has = function (name) { + return this.map.hasOwnProperty(normalizeName(name)); + }; + + Headers.prototype.set = function (name, value) { + this.map[normalizeName(name)] = normalizeValue(value); + }; + + Headers.prototype.forEach = function (callback, thisArg) { + for (var name in this.map) { + if (this.map.hasOwnProperty(name)) { + callback.call(thisArg, this.map[name], name, this); + } + } + }; + + Headers.prototype.keys = function () { + var items = []; + this.forEach(function (value, name) { + items.push(name); + }); + return iteratorFor(items); + }; + + Headers.prototype.values = function () { + var items = []; + this.forEach(function (value) { + items.push(value); + }); + return iteratorFor(items); + }; + + Headers.prototype.entries = function () { + var items = []; + this.forEach(function (value, name) { + items.push([name, value]); + }); + return iteratorFor(items); + }; + + if (support.iterable) { + Headers.prototype[Symbol.iterator] = Headers.prototype.entries; + } + + function consumed(body) { + if (body.bodyUsed) { + return Promise.reject(new TypeError('Already read')); + } + + body.bodyUsed = true; + } + + function fileReaderReady(reader) { + return new Promise(function (resolve, reject) { + reader.onload = function () { + resolve(reader.result); + }; + + reader.onerror = function () { + reject(reader.error); + }; + }); + } + + function readBlobAsArrayBuffer(blob) { + var reader = new FileReader(); + var promise = fileReaderReady(reader); + reader.readAsArrayBuffer(blob); + return promise; + } + + function readBlobAsText(blob) { + var reader = new FileReader(); + var promise = fileReaderReady(reader); + reader.readAsText(blob); + return promise; + } + + function readArrayBufferAsText(buf) { + var view = new Uint8Array(buf); + var chars = new Array(view.length); + + for (var i = 0; i < view.length; i++) { + chars[i] = String.fromCharCode(view[i]); + } + + return chars.join(''); + } + + function bufferClone(buf) { + if (buf.slice) { + return buf.slice(0); + } else { + var view = new Uint8Array(buf.byteLength); + view.set(new Uint8Array(buf)); + return view.buffer; + } + } + + function Body() { + this.bodyUsed = false; + + this._initBody = function (body) { + this._bodyInit = body; + + if (!body) { + this._bodyText = ''; + } else if (typeof body === 'string') { + this._bodyText = body; + } else if (support.blob && Blob.prototype.isPrototypeOf(body)) { + this._bodyBlob = body; + } else if (support.formData && FormData.prototype.isPrototypeOf(body)) { + this._bodyFormData = body; + } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { + this._bodyText = body.toString(); + } else if (support.arrayBuffer && support.blob && isDataView(body)) { + this._bodyArrayBuffer = bufferClone(body.buffer); // IE 10-11 can't handle a DataView body. + + this._bodyInit = new Blob([this._bodyArrayBuffer]); + } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { + this._bodyArrayBuffer = bufferClone(body); + } else { + this._bodyText = body = Object.prototype.toString.call(body); + } + + if (!this.headers.get('content-type')) { + if (typeof body === 'string') { + this.headers.set('content-type', 'text/plain;charset=UTF-8'); + } else if (this._bodyBlob && this._bodyBlob.type) { + this.headers.set('content-type', this._bodyBlob.type); + } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { + this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8'); + } + } + }; + + if (support.blob) { + this.blob = function () { + var rejected = consumed(this); + + if (rejected) { + return rejected; + } + + if (this._bodyBlob) { + return Promise.resolve(this._bodyBlob); + } else if (this._bodyArrayBuffer) { + return Promise.resolve(new Blob([this._bodyArrayBuffer])); + } else if (this._bodyFormData) { + throw new Error('could not read FormData body as blob'); + } else { + return Promise.resolve(new Blob([this._bodyText])); + } + }; + + this.arrayBuffer = function () { + if (this._bodyArrayBuffer) { + return consumed(this) || Promise.resolve(this._bodyArrayBuffer); + } else { + return this.blob().then(readBlobAsArrayBuffer); + } + }; + } + + this.text = function () { + var rejected = consumed(this); + + if (rejected) { + return rejected; + } + + if (this._bodyBlob) { + return readBlobAsText(this._bodyBlob); + } else if (this._bodyArrayBuffer) { + return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer)); + } else if (this._bodyFormData) { + throw new Error('could not read FormData body as text'); + } else { + return Promise.resolve(this._bodyText); + } + }; + + if (support.formData) { + this.formData = function () { + return this.text().then(decode); + }; + } + + this.json = function () { + return this.text().then(JSON.parse); + }; + + return this; + } // HTTP methods whose capitalization should be normalized + + + var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']; + + function normalizeMethod(method) { + var upcased = method.toUpperCase(); + return methods.indexOf(upcased) > -1 ? upcased : method; + } + + function Request(input, options) { + options = options || {}; + var body = options.body; + + if (input instanceof Request) { + if (input.bodyUsed) { + throw new TypeError('Already read'); + } + + this.url = input.url; + this.credentials = input.credentials; + + if (!options.headers) { + this.headers = new Headers(input.headers); + } + + this.method = input.method; + this.mode = input.mode; + this.signal = input.signal; + + if (!body && input._bodyInit != null) { + body = input._bodyInit; + input.bodyUsed = true; + } + } else { + this.url = String(input); + } + + this.credentials = options.credentials || this.credentials || 'same-origin'; + + if (options.headers || !this.headers) { + this.headers = new Headers(options.headers); + } + + this.method = normalizeMethod(options.method || this.method || 'GET'); + this.mode = options.mode || this.mode || null; + this.signal = options.signal || this.signal; + this.referrer = null; + + if ((this.method === 'GET' || this.method === 'HEAD') && body) { + throw new TypeError('Body not allowed for GET or HEAD requests'); + } + + this._initBody(body); + } + + Request.prototype.clone = function () { + return new Request(this, { + body: this._bodyInit + }); + }; + + function decode(body) { + var form = new FormData(); + body.trim().split('&').forEach(function (bytes) { + if (bytes) { + var split = bytes.split('='); + var name = split.shift().replace(/\+/g, ' '); + var value = split.join('=').replace(/\+/g, ' '); + form.append(decodeURIComponent(name), decodeURIComponent(value)); + } + }); + return form; + } + + function parseHeaders(rawHeaders) { + var headers = new Headers(); // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space + // https://tools.ietf.org/html/rfc7230#section-3.2 + + var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' '); + preProcessedHeaders.split(/\r?\n/).forEach(function (line) { + var parts = line.split(':'); + var key = parts.shift().trim(); + + if (key) { + var value = parts.join(':').trim(); + headers.append(key, value); + } + }); + return headers; + } + + Body.call(Request.prototype); + + function Response(bodyInit, options) { + if (!options) { + options = {}; + } + + this.type = 'default'; + this.status = options.status === undefined ? 200 : options.status; + this.ok = this.status >= 200 && this.status < 300; + this.statusText = 'statusText' in options ? options.statusText : 'OK'; + this.headers = new Headers(options.headers); + this.url = options.url || ''; + + this._initBody(bodyInit); + } + + Body.call(Response.prototype); + + Response.prototype.clone = function () { + return new Response(this._bodyInit, { + status: this.status, + statusText: this.statusText, + headers: new Headers(this.headers), + url: this.url + }); + }; + + Response.error = function () { + var response = new Response(null, { + status: 0, + statusText: '' + }); + response.type = 'error'; + return response; + }; + + var redirectStatuses = [301, 302, 303, 307, 308]; + + Response.redirect = function (url, status) { + if (redirectStatuses.indexOf(status) === -1) { + throw new RangeError('Invalid status code'); + } + + return new Response(null, { + status: status, + headers: { + location: url + } + }); + }; + + exports.DOMException = self.DOMException; + + try { + new exports.DOMException(); + } catch (err) { + exports.DOMException = function (message, name) { + this.message = message; + this.name = name; + var error = Error(message); + this.stack = error.stack; + }; + + exports.DOMException.prototype = Object.create(Error.prototype); + exports.DOMException.prototype.constructor = exports.DOMException; + } + + function fetch(input, init) { + return new Promise(function (resolve, reject) { + var request = new Request(input, init); + + if (request.signal && request.signal.aborted) { + return reject(new exports.DOMException('Aborted', 'AbortError')); + } + + var xhr = new XMLHttpRequest(); + + function abortXhr() { + xhr.abort(); + } + + xhr.onload = function () { + var options = { + status: xhr.status, + statusText: xhr.statusText, + headers: parseHeaders(xhr.getAllResponseHeaders() || '') + }; + options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL'); + var body = 'response' in xhr ? xhr.response : xhr.responseText; + resolve(new Response(body, options)); + }; + + xhr.onerror = function () { + reject(new TypeError('Network request failed')); + }; + + xhr.ontimeout = function () { + reject(new TypeError('Network request failed')); + }; + + xhr.onabort = function () { + reject(new exports.DOMException('Aborted', 'AbortError')); + }; + + xhr.open(request.method, request.url, true); + + if (request.credentials === 'include') { + xhr.withCredentials = true; + } else if (request.credentials === 'omit') { + xhr.withCredentials = false; + } + + if ('responseType' in xhr && support.blob) { + xhr.responseType = 'blob'; + } + + request.headers.forEach(function (value, name) { + xhr.setRequestHeader(name, value); + }); + + if (request.signal) { + request.signal.addEventListener('abort', abortXhr); + + xhr.onreadystatechange = function () { + // DONE (success or failure) + if (xhr.readyState === 4) { + request.signal.removeEventListener('abort', abortXhr); + } + }; + } + + xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit); + }); + } + + fetch.polyfill = true; + + if (!self.fetch) { + self.fetch = fetch; + self.Headers = Headers; + self.Request = Request; + self.Response = Response; + } + + exports.Headers = Headers; + exports.Request = Request; + exports.Response = Response; + exports.fetch = fetch; + return exports; + }({}); + })(__self__); + + delete __self__.fetch.polyfill; + exports = __self__.fetch; // To enable: import fetch from 'cross-fetch' + + exports.default = __self__.fetch; // For TypeScript consumers without esModuleInterop. + + exports.fetch = __self__.fetch; // To enable: import {fetch} from 'cross-fetch' + + exports.Headers = __self__.Headers; + exports.Request = __self__.Request; + exports.Response = __self__.Response; + module.exports = exports; + }); + var browserPonyfill_1 = browserPonyfill.fetch; + var browserPonyfill_2 = browserPonyfill.Headers; + var browserPonyfill_3 = browserPonyfill.Request; + var browserPonyfill_4 = browserPonyfill.Response; + + /** + * + * + * @author Jerry Bendy + * @licence MIT + * + */ + + (function (self) { + + var nativeURLSearchParams = self.URLSearchParams && self.URLSearchParams.prototype.get ? self.URLSearchParams : null, + isSupportObjectConstructor = nativeURLSearchParams && new nativeURLSearchParams({ + a: 1 + }).toString() === 'a=1', + // There is a bug in safari 10.1 (and earlier) that incorrectly decodes `%2B` as an empty space and not a plus. + decodesPlusesCorrectly = nativeURLSearchParams && new nativeURLSearchParams('s=%2B').get('s') === '+', + __URLSearchParams__ = "__URLSearchParams__", + // Fix bug in Edge which cannot encode ' &' correctly + encodesAmpersandsCorrectly = nativeURLSearchParams ? function () { + var ampersandTest = new nativeURLSearchParams(); + ampersandTest.append('s', ' &'); + return ampersandTest.toString() === 's=+%26'; + }() : true, + prototype = URLSearchParamsPolyfill.prototype, + iterable = !!(self.Symbol && self.Symbol.iterator); + + if (nativeURLSearchParams && isSupportObjectConstructor && decodesPlusesCorrectly && encodesAmpersandsCorrectly) { + return; + } + /** + * Make a URLSearchParams instance + * + * @param {object|string|URLSearchParams} search + * @constructor + */ + + + function URLSearchParamsPolyfill(search) { + search = search || ""; // support construct object with another URLSearchParams instance + + if (search instanceof URLSearchParams || search instanceof URLSearchParamsPolyfill) { + search = search.toString(); + } + + this[__URLSearchParams__] = parseToDict(search); + } + /** + * Appends a specified key/value pair as a new search parameter. + * + * @param {string} name + * @param {string} value + */ + + + prototype.append = function (name, value) { + appendTo(this[__URLSearchParams__], name, value); + }; + /** + * Deletes the given search parameter, and its associated value, + * from the list of all search parameters. + * + * @param {string} name + */ + + + prototype['delete'] = function (name) { + delete this[__URLSearchParams__][name]; + }; + /** + * Returns the first value associated to the given search parameter. + * + * @param {string} name + * @returns {string|null} + */ + + + prototype.get = function (name) { + var dict = this[__URLSearchParams__]; + return name in dict ? dict[name][0] : null; + }; + /** + * Returns all the values association with a given search parameter. + * + * @param {string} name + * @returns {Array} + */ + + + prototype.getAll = function (name) { + var dict = this[__URLSearchParams__]; + return name in dict ? dict[name].slice(0) : []; + }; + /** + * Returns a Boolean indicating if such a search parameter exists. + * + * @param {string} name + * @returns {boolean} + */ + + + prototype.has = function (name) { + return name in this[__URLSearchParams__]; + }; + /** + * Sets the value associated to a given search parameter to + * the given value. If there were several values, delete the + * others. + * + * @param {string} name + * @param {string} value + */ + + + prototype.set = function set(name, value) { + this[__URLSearchParams__][name] = ['' + value]; + }; + /** + * Returns a string containg a query string suitable for use in a URL. + * + * @returns {string} + */ + + + prototype.toString = function () { + var dict = this[__URLSearchParams__], + query = [], + i, + key, + name, + value; + + for (key in dict) { + name = encode(key); + + for (i = 0, value = dict[key]; i < value.length; i++) { + query.push(name + '=' + encode(value[i])); + } + } + + return query.join('&'); + }; // There is a bug in Safari 10.1 and `Proxy`ing it is not enough. + + + var forSureUsePolyfill = !decodesPlusesCorrectly; + var useProxy = !forSureUsePolyfill && nativeURLSearchParams && !isSupportObjectConstructor && self.Proxy; + /* + * Apply polifill to global object and append other prototype into it + */ + + Object.defineProperty(self, 'URLSearchParams', { + value: useProxy ? // Safari 10.0 doesn't support Proxy, so it won't extend URLSearchParams on safari 10.0 + new Proxy(nativeURLSearchParams, { + construct: function construct(target, args) { + return new target(new URLSearchParamsPolyfill(args[0]).toString()); + } + }) : URLSearchParamsPolyfill + }); + var USPProto = self.URLSearchParams.prototype; + USPProto.polyfill = true; + /** + * + * @param {function} callback + * @param {object} thisArg + */ + + USPProto.forEach = USPProto.forEach || function (callback, thisArg) { + var dict = parseToDict(this.toString()); + Object.getOwnPropertyNames(dict).forEach(function (name) { + dict[name].forEach(function (value) { + callback.call(thisArg, value, name, this); + }, this); + }, this); + }; + /** + * Sort all name-value pairs + */ + + + USPProto.sort = USPProto.sort || function () { + var dict = parseToDict(this.toString()), + keys = [], + k, + i, + j; + + for (k in dict) { + keys.push(k); + } + + keys.sort(); + + for (i = 0; i < keys.length; i++) { + this['delete'](keys[i]); + } + + for (i = 0; i < keys.length; i++) { + var key = keys[i], + values = dict[key]; + + for (j = 0; j < values.length; j++) { + this.append(key, values[j]); + } + } + }; + /** + * Returns an iterator allowing to go through all keys of + * the key/value pairs contained in this object. + * + * @returns {function} + */ + + + USPProto.keys = USPProto.keys || function () { + var items = []; + this.forEach(function (item, name) { + items.push(name); + }); + return makeIterator(items); + }; + /** + * Returns an iterator allowing to go through all values of + * the key/value pairs contained in this object. + * + * @returns {function} + */ + + + USPProto.values = USPProto.values || function () { + var items = []; + this.forEach(function (item) { + items.push(item); + }); + return makeIterator(items); + }; + /** + * Returns an iterator allowing to go through all key/value + * pairs contained in this object. + * + * @returns {function} + */ + + + USPProto.entries = USPProto.entries || function () { + var items = []; + this.forEach(function (item, name) { + items.push([name, item]); + }); + return makeIterator(items); + }; + + if (iterable) { + USPProto[self.Symbol.iterator] = USPProto[self.Symbol.iterator] || USPProto.entries; + } + + function encode(str) { + var replace = { + '!': '%21', + "'": '%27', + '(': '%28', + ')': '%29', + '~': '%7E', + '%20': '+', + '%00': '\x00' + }; + return encodeURIComponent(str).replace(/[!'\(\)~]|%20|%00/g, function (match) { + return replace[match]; + }); + } + + function decode(str) { + return str.replace(/[ +]/g, '%20').replace(/(%[a-f0-9]{2})+/ig, function (match) { + return decodeURIComponent(match); + }); + } + + function makeIterator(arr) { + var iterator = { + next: function next() { + var value = arr.shift(); + return { + done: value === undefined, + value: value + }; + } + }; + + if (iterable) { + iterator[self.Symbol.iterator] = function () { + return iterator; + }; + } + + return iterator; + } + + function parseToDict(search) { + var dict = {}; + + if (_typeof(search) === "object") { + // if `search` is an array, treat it as a sequence + if (isArray(search)) { + for (var i = 0; i < search.length; i++) { + var item = search[i]; + + if (isArray(item) && item.length === 2) { + appendTo(dict, item[0], item[1]); + } else { + throw new TypeError("Failed to construct 'URLSearchParams': Sequence initializer must only contain pair elements"); + } + } + } else { + for (var key in search) { + if (search.hasOwnProperty(key)) { + appendTo(dict, key, search[key]); + } + } + } + } else { + // remove first '?' + if (search.indexOf("?") === 0) { + search = search.slice(1); + } + + var pairs = search.split("&"); + + for (var j = 0; j < pairs.length; j++) { + var value = pairs[j], + index = value.indexOf('='); + + if (-1 < index) { + appendTo(dict, decode(value.slice(0, index)), decode(value.slice(index + 1))); + } else { + if (value) { + appendTo(dict, decode(value), ''); + } + } + } + } + + return dict; + } + + function appendTo(dict, name, value) { + var val = typeof value === 'string' ? value : value !== null && value !== undefined && typeof value.toString === 'function' ? value.toString() : JSON.stringify(value); + + if (name in dict) { + dict[name].push(val); + } else { + dict[name] = [val]; + } + } + + function isArray(val) { + return !!val && '[object Array]' === Object.prototype.toString.call(val); + } + })(typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof window !== 'undefined' ? window : commonjsGlobal); + + var HttpTransport = + /*#__PURE__*/ + function () { + function HttpTransport(_ref) { + var authorization = _ref.authorization, + apiUrl = _ref.apiUrl; + + _classCallCheck(this, HttpTransport); + + this.authorization = authorization; + this.apiUrl = apiUrl; + } + + _createClass(HttpTransport, [{ + key: "request", + value: function request(method, params) { + var _this = this; + + var searchParams = new URLSearchParams(params && Object.keys(params).map(function (k) { + return _defineProperty({}, k, _typeof(params[k]) === 'object' ? JSON.stringify(params[k]) : params[k]); + }).reduce(function (a, b) { + return _objectSpread({}, a, b); + }, {})); + + var runRequest = function runRequest() { + return browserPonyfill("".concat(_this.apiUrl).concat(method, "?").concat(searchParams), { + headers: { + Authorization: _this.authorization, + 'Content-Type': 'application/json' + } + }); + }; + + return { + subscribe: function () { + var _subscribe = _asyncToGenerator( + /*#__PURE__*/ + regeneratorRuntime.mark(function _callee(callback) { + var _this2 = this; + + var result; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return runRequest(); + + case 2: + result = _context.sent; + return _context.abrupt("return", callback(result, function () { + return _this2.subscribe(callback); + })); + + case 4: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + return function subscribe(_x) { + return _subscribe.apply(this, arguments); + }; + }() + }; + } + }]); + + return HttpTransport; + }(); + + var API_URL = "https://statsbot.co/cubejs-api/v1"; + var mutexCounter = 0; + var MUTEX_ERROR = 'Mutex has been changed'; + + var mutexPromise = function mutexPromise(promise) { + return new Promise(function (resolve, reject) { + promise.then(function (r) { + return resolve(r); + }, function (e) { + return e !== MUTEX_ERROR && reject(e); + }); + }); + }; + /** + * Main class for accessing Cube.js API + * @order -5 + */ + + + var CubejsApi = + /*#__PURE__*/ + function () { + function CubejsApi(apiToken, options) { + _classCallCheck(this, CubejsApi); + + if (_typeof(apiToken) === 'object') { + options = apiToken; + apiToken = undefined; + } + + options = options || {}; + this.apiToken = apiToken; + this.apiUrl = options.apiUrl || API_URL; + this.transport = options.transport || new HttpTransport({ + authorization: apiToken, + apiUrl: this.apiUrl + }); + this.pollInterval = options.pollInterval || 5; + } + + _createClass(CubejsApi, [{ + key: "request", + value: function request(method, params) { + return this.transport.request(method, params); + } + }, { + key: "loadMethod", + value: function loadMethod(request, toResult, options, callback) { + var _this = this; + + var mutexValue = ++mutexCounter; + + if (typeof options === 'function' && !callback) { + callback = options; + options = undefined; + } + + options = options || {}; + var mutexKey = options.mutexKey || 'default'; + + if (options.mutexObj) { + options.mutexObj[mutexKey] = mutexValue; + } + + var requestInstance = request(); + var unsubscribed = false; + + var checkMutex = + /*#__PURE__*/ + function () { + var _ref = _asyncToGenerator( + /*#__PURE__*/ + regeneratorRuntime.mark(function _callee() { + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + if (!(options.mutexObj && options.mutexObj[mutexKey] !== mutexValue)) { + _context.next = 6; + break; + } + + unsubscribed = true; + + if (!requestInstance.unsubscribe) { + _context.next = 5; + break; + } + + _context.next = 5; + return requestInstance.unsubscribe(); + + case 5: + throw MUTEX_ERROR; + + case 6: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + return function checkMutex() { + return _ref.apply(this, arguments); + }; + }(); + + var loadImpl = + /*#__PURE__*/ + function () { + var _ref2 = _asyncToGenerator( + /*#__PURE__*/ + regeneratorRuntime.mark(function _callee4(response, next) { + var subscribeNext, continueWait, body, error, result; + return regeneratorRuntime.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + subscribeNext = + /*#__PURE__*/ + function () { + var _ref3 = _asyncToGenerator( + /*#__PURE__*/ + regeneratorRuntime.mark(function _callee2() { + return regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + if (!(options.subscribe && !unsubscribed)) { + _context2.next = 8; + break; + } + + if (!requestInstance.unsubscribe) { + _context2.next = 5; + break; + } + + return _context2.abrupt("return", next()); + + case 5: + _context2.next = 7; + return new Promise(function (resolve) { + return setTimeout(function () { + return resolve(); + }, _this.pollInterval * 1000); + }); + + case 7: + return _context2.abrupt("return", next()); + + case 8: + return _context2.abrupt("return", null); + + case 9: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + + return function subscribeNext() { + return _ref3.apply(this, arguments); + }; + }(); + + continueWait = + /*#__PURE__*/ + function () { + var _ref4 = _asyncToGenerator( + /*#__PURE__*/ + regeneratorRuntime.mark(function _callee3(wait) { + return regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + if (unsubscribed) { + _context3.next = 5; + break; + } + + if (!wait) { + _context3.next = 4; + break; + } + + _context3.next = 4; + return new Promise(function (resolve) { + return setTimeout(function () { + return resolve(); + }, _this.pollInterval * 1000); + }); + + case 4: + return _context3.abrupt("return", next()); + + case 5: + return _context3.abrupt("return", null); + + case 6: + case "end": + return _context3.stop(); + } + } + }, _callee3, this); + })); + + return function continueWait(_x3) { + return _ref4.apply(this, arguments); + }; + }(); + + if (!(response.status === 502)) { + _context4.next = 6; + break; + } + + _context4.next = 5; + return checkMutex(); + + case 5: + return _context4.abrupt("return", continueWait(true)); + + case 6: + _context4.next = 8; + return response.json(); + + case 8: + body = _context4.sent; + + if (!(body.error === 'Continue wait')) { + _context4.next = 14; + break; + } + + _context4.next = 12; + return checkMutex(); + + case 12: + if (options.progressCallback) { + options.progressCallback(new ProgressResult(body)); + } + + return _context4.abrupt("return", continueWait()); + + case 14: + if (!(response.status !== 200)) { + _context4.next = 27; + break; + } + + _context4.next = 17; + return checkMutex(); + + case 17: + if (!(!options.subscribe && requestInstance.unsubscribe)) { + _context4.next = 20; + break; + } + + _context4.next = 20; + return requestInstance.unsubscribe(); + + case 20: + error = new Error(body.error); // TODO error class + + if (!callback) { + _context4.next = 25; + break; + } + + callback(error); + _context4.next = 26; + break; + + case 25: + throw error; + + case 26: + return _context4.abrupt("return", subscribeNext()); + + case 27: + _context4.next = 29; + return checkMutex(); + + case 29: + if (!(!options.subscribe && requestInstance.unsubscribe)) { + _context4.next = 32; + break; + } + + _context4.next = 32; + return requestInstance.unsubscribe(); + + case 32: + result = toResult(body); + + if (!callback) { + _context4.next = 37; + break; + } + + callback(null, result); + _context4.next = 38; + break; + + case 37: + return _context4.abrupt("return", result); + + case 38: + return _context4.abrupt("return", subscribeNext()); + + case 39: + case "end": + return _context4.stop(); + } + } + }, _callee4, this); + })); + + return function loadImpl(_x, _x2) { + return _ref2.apply(this, arguments); + }; + }(); + + var promise = mutexPromise(requestInstance.subscribe(loadImpl)); + + if (callback) { + return { + unsubscribe: function () { + var _unsubscribe = _asyncToGenerator( + /*#__PURE__*/ + regeneratorRuntime.mark(function _callee5() { + return regeneratorRuntime.wrap(function _callee5$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + unsubscribed = true; + + if (!requestInstance.unsubscribe) { + _context5.next = 3; + break; + } + + return _context5.abrupt("return", requestInstance.unsubscribe()); + + case 3: + return _context5.abrupt("return", null); + + case 4: + case "end": + return _context5.stop(); + } + } + }, _callee5, this); + })); + + return function unsubscribe() { + return _unsubscribe.apply(this, arguments); + }; + }() + }; + } else { + return promise; + } + } + /** + * Fetch data for passed `query`. + * + * ```js + * import cubejs from '@cubejs-client/core'; + * import Chart from 'chart.js'; + * import chartjsConfig from './toChartjsData'; + * + * const cubejsApi = cubejs('CUBEJS_TOKEN'); + * + * const resultSet = await cubejsApi.load({ + * measures: ['Stories.count'], + * timeDimensions: [{ + * dimension: 'Stories.time', + * dateRange: ['2015-01-01', '2015-12-31'], + * granularity: 'month' + * }] + * }); + * + * const context = document.getElementById('myChart'); + * new Chart(context, chartjsConfig(resultSet)); + * ``` + * @param query - [Query object](query-format) + * @param options + * @param callback + * @returns {Promise} for {@link ResultSet} if `callback` isn't passed + */ + + }, { + key: "load", + value: function load(query, options, callback) { + var _this2 = this; + + return this.loadMethod(function () { + return _this2.request("load", { + query: query + }); + }, function (body) { + return new ResultSet(body); + }, options, callback); + } + /** + * Get generated SQL string for given `query`. + * @param query - [Query object](query-format) + * @param options + * @param callback + * @return {Promise} for {@link SqlQuery} if `callback` isn't passed + */ + + }, { + key: "sql", + value: function sql(query, options, callback) { + var _this3 = this; + + return this.loadMethod(function () { + return _this3.request("sql", { + query: query + }); + }, function (body) { + return new SqlQuery(body); + }, options, callback); + } + /** + * Get meta description of cubes available for querying. + * @param options + * @param callback + * @return {Promise} for {@link Meta} if `callback` isn't passed + */ + + }, { + key: "meta", + value: function meta(options, callback) { + var _this4 = this; + + return this.loadMethod(function () { + return _this4.request("meta"); + }, function (body) { + return new Meta(body); + }, options, callback); + } + }, { + key: "subscribe", + value: function subscribe(query, options, callback) { + var _this5 = this; + + return this.loadMethod(function () { + return _this5.request("subscribe", { + query: query + }); + }, function (body) { + return new ResultSet(body); + }, _objectSpread({}, options, { + subscribe: true + }), callback); + } + }]); + + return CubejsApi; + }(); + /** + * Create instance of `CubejsApi`. + * API entry point. + * + * ```javascript + import cubejs from '@cubejs-client/core'; + + const cubejsApi = cubejs( + 'CUBEJS-API-TOKEN', + { apiUrl: 'http://localhost:4000/cubejs-api/v1' } + ); + ``` + * @name cubejs + * @param apiToken - [API token](security) is used to authorize requests and determine SQL database you're accessing. + * In the development mode, Cube.js Backend will print the API token to the console on on startup. + * @param options - options object. + * @param options.apiUrl - URL of your Cube.js Backend. + * By default, in the development environment it is `http://localhost:4000/cubejs-api/v1`. + * @returns {CubejsApi} + * @order -10 + */ + + + var index = (function (apiToken, options) { + return new CubejsApi(apiToken, options); + }); + + exports.default = index; + exports.HttpTransport = HttpTransport; + + Object.defineProperty(exports, '__esModule', { value: true }); })); diff --git a/packages/cubejs-client-core/package.json b/packages/cubejs-client-core/package.json index e06a6ed15d577..c53b6a26f1bb4 100644 --- a/packages/cubejs-client-core/package.json +++ b/packages/cubejs-client-core/package.json @@ -10,7 +10,8 @@ "cross-fetch": "^3.0.2", "moment": "^2.22.2", "moment-range": "^4.0.1", - "ramda": "^0.25.0" + "ramda": "^0.25.0", + "url-search-params-polyfill": "^7.0.0" }, "scripts": { "test": "jest" diff --git a/packages/cubejs-client-core/src/HttpTransport.js b/packages/cubejs-client-core/src/HttpTransport.js new file mode 100644 index 0000000000000..2271c15bf399e --- /dev/null +++ b/packages/cubejs-client-core/src/HttpTransport.js @@ -0,0 +1,32 @@ +import fetch from 'cross-fetch'; +import 'url-search-params-polyfill'; + +class HttpTransport { + constructor({ authorization, apiUrl }) { + this.authorization = authorization; + this.apiUrl = apiUrl; + } + + request(method, params) { + const searchParams = new URLSearchParams( + params && Object.keys(params) + .map(k => ({ [k]: typeof params[k] === 'object' ? JSON.stringify(params[k]) : params[k] })) + .reduce((a, b) => ({ ...a, ...b }), {}) + ); + + const runRequest = () => fetch( + `${this.apiUrl}${method}?${searchParams}`, { + headers: { Authorization: this.authorization, 'Content-Type': 'application/json' } + } + ); + + return { + async subscribe(callback) { + const result = await runRequest(); + return callback(result, () => this.subscribe(callback)); + } + }; + } +} + +export default HttpTransport; diff --git a/packages/cubejs-client-core/src/ProgressResult.js b/packages/cubejs-client-core/src/ProgressResult.js index 700645eda412e..fd02aec278540 100644 --- a/packages/cubejs-client-core/src/ProgressResult.js +++ b/packages/cubejs-client-core/src/ProgressResult.js @@ -10,4 +10,4 @@ export default class ProgressResult { timeElapsed() { return this.progressResponse.timeElapsed; } -} \ No newline at end of file +} diff --git a/packages/cubejs-client-core/src/SqlQuery.js b/packages/cubejs-client-core/src/SqlQuery.js index 6afa04e0e77ee..9a9a2b6ea84ba 100644 --- a/packages/cubejs-client-core/src/SqlQuery.js +++ b/packages/cubejs-client-core/src/SqlQuery.js @@ -10,4 +10,4 @@ export default class SqlQuery { sql() { return this.rawQuery().sql[0]; } -} \ No newline at end of file +} diff --git a/packages/cubejs-client-core/src/index.js b/packages/cubejs-client-core/src/index.js index c2635a0410166..1472e59a7d9c4 100644 --- a/packages/cubejs-client-core/src/index.js +++ b/packages/cubejs-client-core/src/index.js @@ -6,11 +6,11 @@ * @menuOrder 2 */ -import fetch from 'cross-fetch'; import ResultSet from './ResultSet'; import SqlQuery from './SqlQuery'; import Meta from './Meta'; import ProgressResult from './ProgressResult'; +import HttpTransport from './HttpTransport'; const API_URL = process.env.CUBEJS_API_URL; @@ -18,11 +18,9 @@ let mutexCounter = 0; const MUTEX_ERROR = 'Mutex has been changed'; -const mutexPromise = (promise) => { - return new Promise((resolve, reject) => { - promise.then(r => resolve(r), e => e !== MUTEX_ERROR && reject(e)); - }); -}; +const mutexPromise = (promise) => new Promise((resolve, reject) => { + promise.then(r => resolve(r), e => e !== MUTEX_ERROR && reject(e)); +}); /** * Main class for accessing Cube.js API @@ -30,16 +28,19 @@ const mutexPromise = (promise) => { */ class CubejsApi { constructor(apiToken, options) { + if (typeof apiToken === 'object') { + options = apiToken; + apiToken = undefined; + } options = options || {}; this.apiToken = apiToken; this.apiUrl = options.apiUrl || API_URL; + this.transport = options.transport || new HttpTransport({ authorization: apiToken, apiUrl: this.apiUrl }); + this.pollInterval = options.pollInterval || 5; } - request(url, config) { - return fetch( - `${this.apiUrl}${url}`, - Object.assign({ headers: { Authorization: this.apiToken, 'Content-Type': 'application/json' }}, config || {}) - ); + request(method, params) { + return this.transport.request(method, params); } loadMethod(request, toResult, options, callback) { @@ -56,37 +57,97 @@ class CubejsApi { options.mutexObj[mutexKey] = mutexValue; } - const checkMutex = () => { + const requestInstance = request(); + + let unsubscribed = false; + + const checkMutex = async () => { if (options.mutexObj && options.mutexObj[mutexKey] !== mutexValue) { + unsubscribed = true; + if (requestInstance.unsubscribe) { + await requestInstance.unsubscribe(); + } throw MUTEX_ERROR; } }; - const loadImpl = async () => { - const response = await request(); + const loadImpl = async (response, next) => { + const subscribeNext = async () => { + if (options.subscribe && !unsubscribed) { + if (requestInstance.unsubscribe) { + return next(); + } else { + await new Promise(resolve => setTimeout(() => resolve(), this.pollInterval * 1000)); + return next(); + } + } + return null; + }; + + const continueWait = async (wait) => { + if (!unsubscribed) { + if (wait) { + await new Promise(resolve => setTimeout(() => resolve(), this.pollInterval * 1000)); + } + return next(); + } + return null; + }; + if (response.status === 502) { - checkMutex(); - return loadImpl(); // TODO backoff wait + await checkMutex(); + return continueWait(true); } const body = await response.json(); if (body.error === 'Continue wait') { - checkMutex(); + await checkMutex(); if (options.progressCallback) { options.progressCallback(new ProgressResult(body)); } - return loadImpl(); + return continueWait(); } if (response.status !== 200) { - checkMutex(); - throw new Error(body.error); // TODO error class + await checkMutex(); + if (!options.subscribe && requestInstance.unsubscribe) { + await requestInstance.unsubscribe(); + } + const error = new Error(body.error); // TODO error class + if (callback) { + callback(error); + } else { + throw error; + } + + return subscribeNext(); + } + await checkMutex(); + if (!options.subscribe && requestInstance.unsubscribe) { + await requestInstance.unsubscribe(); } - checkMutex(); - return toResult(body); + const result = toResult(body); + if (callback) { + callback(null, result); + } else { + return result; + } + + return subscribeNext(); }; + + const promise = mutexPromise(requestInstance.subscribe(loadImpl)); + if (callback) { - mutexPromise(loadImpl()).then(r => callback(null, r), e => callback(e)); + return { + unsubscribe: async () => { + unsubscribed = true; + if (requestInstance.unsubscribe) { + return requestInstance.unsubscribe(); + } + return null; + } + }; } else { - return mutexPromise(loadImpl()); + return promise; } } @@ -119,7 +180,7 @@ class CubejsApi { */ load(query, options, callback) { return this.loadMethod( - () => this.request(`/load?query=${encodeURIComponent(JSON.stringify(query))}`), + () => this.request(`load`, { query }), (body) => new ResultSet(body), options, callback @@ -135,7 +196,7 @@ class CubejsApi { */ sql(query, options, callback) { return this.loadMethod( - () => this.request(`/sql?query=${JSON.stringify(query)}`), + () => this.request(`sql`, { query }), (body) => new SqlQuery(body), options, callback @@ -150,12 +211,21 @@ class CubejsApi { */ meta(options, callback) { return this.loadMethod( - () => this.request(`/meta`), + () => this.request(`meta`), (body) => new Meta(body), options, callback ); } + + subscribe(query, options, callback) { + return this.loadMethod( + () => this.request(`subscribe`, { query }), + (body) => new ResultSet(body), + { ...options, subscribe: true }, + callback + ); + } } /** @@ -179,6 +249,6 @@ class CubejsApi { * @returns {CubejsApi} * @order -10 */ -export default (apiToken, options) => { - return new CubejsApi(apiToken, options); -}; +export default (apiToken, options) => new CubejsApi(apiToken, options); + +export { HttpTransport }; diff --git a/packages/cubejs-client-core/yarn.lock b/packages/cubejs-client-core/yarn.lock index d3e04a0e57150..d51e46bc766e4 100644 --- a/packages/cubejs-client-core/yarn.lock +++ b/packages/cubejs-client-core/yarn.lock @@ -3829,6 +3829,11 @@ urix@^0.1.0: resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= +url-search-params-polyfill@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/url-search-params-polyfill/-/url-search-params-polyfill-7.0.0.tgz#98b56ed29e67710588fdc3c361083b0f78303d95" + integrity sha512-0SEH3s+wCNbxEE/rWUalN004ICNi23Q74Ksc0gS2kG8EXnbayxGOrV97JdwnIVPKZ75Xk0hvKXvtIC4xReLMgg== + use@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" diff --git a/packages/cubejs-client-ws-transport/.gitignore b/packages/cubejs-client-ws-transport/.gitignore new file mode 100644 index 0000000000000..77738287f0e61 --- /dev/null +++ b/packages/cubejs-client-ws-transport/.gitignore @@ -0,0 +1 @@ +dist/ \ No newline at end of file diff --git a/packages/cubejs-client-ws-transport/LICENSE b/packages/cubejs-client-ws-transport/LICENSE new file mode 100644 index 0000000000000..64c33a59bfd7a --- /dev/null +++ b/packages/cubejs-client-ws-transport/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Statsbot, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/packages/cubejs-client-ws-transport/README.md b/packages/cubejs-client-ws-transport/README.md new file mode 100644 index 0000000000000..ea8b2a9cac8b3 --- /dev/null +++ b/packages/cubejs-client-ws-transport/README.md @@ -0,0 +1,9 @@ +# Cube.js WebSocket Transport + +Cube.js Client WebSocket Transport + +[Learn more](https://github.com/cube-js/cube.js#getting-started) + +### License + +Cube.js Client WebSocket Transport is [MIT licensed](./LICENSE). \ No newline at end of file diff --git a/packages/cubejs-client-ws-transport/package.json b/packages/cubejs-client-ws-transport/package.json new file mode 100644 index 0000000000000..4705b28d2eaaa --- /dev/null +++ b/packages/cubejs-client-ws-transport/package.json @@ -0,0 +1,26 @@ +{ + "name": "@cubejs-client/ws-transport", + "version": "0.10.61", + "description": "Cube.js WebSocket transport", + "main": "dist/cubejs-client-ws-transport.js", + "author": "Statsbot, Inc.", + "dependencies": { + "@babel/runtime": "^7.1.2", + "core-js": "^2.5.3", + "isomorphic-ws": "^4.0.1" + }, + "files": [ + "src", + "dist" + ], + "license": "MIT", + "devDependencies": { + "@babel/core": "^7.3.3", + "@babel/preset-env": "^7.3.1", + "babel-jest": "^24.1.0", + "jest": "^24.1.0" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/cubejs-client-ws-transport/src/index.js b/packages/cubejs-client-ws-transport/src/index.js new file mode 100644 index 0000000000000..97a18e77157e7 --- /dev/null +++ b/packages/cubejs-client-ws-transport/src/index.js @@ -0,0 +1,161 @@ +import WebSocket from 'isomorphic-ws'; + +class WebSocketTransportResult { + constructor({ status, message }) { + this.status = status; + this.result = message; + } + + async json() { + return this.result; + } +} + +class WebSocketTransport { + constructor({ authorization, apiUrl, hearBeatInterval }) { + this.authorization = authorization; + this.apiUrl = apiUrl; + this.messageCounter = 1; + this.messageIdToSubscription = {}; + this.messageQueue = []; + this.hearBeatInterval = hearBeatInterval || 60; + } + + initSocket() { + if (this.ws) { + return this.ws.initPromise; + } + + const ws = new WebSocket(this.apiUrl); + + ws.messageIdSent = {}; + + ws.sendMessage = (message) => { + if (!message.messageId || message.messageId && !ws.messageIdSent[message.messageId]) { + ws.send(JSON.stringify(message)); + ws.messageIdSent[message.messageId] = true; + } + }; + + ws.sendQueue = () => { + this.messageQueue.forEach(message => ws.sendMessage(message)); + this.messageQueue = []; + }; + + ws.reconcile = () => { + if (new Date().getTime() - ws.lastMessageTimestamp.getTime() > 4 * this.hearBeatInterval * 1000) { + ws.close(); + } else { + Object.keys(this.messageIdToSubscription).forEach(messageId => { + ws.sendMessage(this.messageIdToSubscription[messageId].message); + }); + } + }; + + ws.lastMessageTimestamp = new Date(); + + ws.initPromise = new Promise(resolve => { + ws.onopen = () => { + ws.sendMessage({ authorization: this.authorization }); + }; + + ws.onmessage = (message) => { + ws.lastMessageTimestamp = new Date(); + message = JSON.parse(message.data); + if (message.handshake) { + ws.reconcile(); + ws.reconcileTimer = setInterval(() => { + ws.messageIdSent = {}; + ws.reconcile(); + }, this.hearBeatInterval * 1000); + resolve(); + } + if (this.messageIdToSubscription[message.messageId]) { + this.messageIdToSubscription[message.messageId].callback(new WebSocketTransportResult(message)); + } + ws.sendQueue(); + }; + + ws.onclose = () => { + if (ws && ws.readyState !== WebSocket.CLOSED && ws.readyState !== WebSocket.CLOSING) { + ws.close(); + } + if (ws.reconcileTimer) { + clearInterval(ws.reconcileTimer); + ws.reconcileTimer = null; + } + if (this.ws === ws) { + this.ws = null; + if (Object.keys(this.messageIdToSubscription).length) { + this.initSocket(); + } + } + }; + + ws.onerror = ws.onclose; + }); + + this.ws = ws; + + return this.ws.initPromise; + } + + sendMessage(message) { + if (message.unsubscribe && this.messageQueue.find(m => m.messageId === message.unsubscribe)) { + this.messageQueue = this.messageQueue.filter(m => m.messageId !== message.unsubscribe); + } else { + this.messageQueue.push(message); + } + setTimeout(async () => { + await this.initSocket(); + this.ws.sendQueue(); + }, 100); + } + + request(method, params) { + const message = { + messageId: this.messageCounter++, + method, + params + }; + + const pendingResults = []; + let nextMessage = null; + + const runNextMessage = () => { + if (nextMessage) { + nextMessage(pendingResults.pop()); + nextMessage = null; + } + }; + + this.messageIdToSubscription[message.messageId] = { + message, + callback: (result) => { + pendingResults.push(result); + runNextMessage(); + } + }; + + const transport = this; + + return { + async subscribe(callback) { + transport.sendMessage(message); + const result = await new Promise((resolve) => { + nextMessage = resolve; + if (pendingResults.length) { + runNextMessage(); + } + }); + return callback(result, () => this.subscribe(callback)); + }, + async unsubscribe() { + transport.sendMessage({ unsubscribe: message.messageId }); + delete transport.messageIdToSubscription[message.messageId]; + } + }; + } +} + +export default WebSocketTransport; diff --git a/packages/cubejs-client-ws-transport/yarn.lock b/packages/cubejs-client-ws-transport/yarn.lock new file mode 100644 index 0000000000000..4c49f867f8817 --- /dev/null +++ b/packages/cubejs-client-ws-transport/yarn.lock @@ -0,0 +1,4194 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.5.5.tgz#bc0782f6d69f7b7d49531219699b988f669a8f9d" + integrity sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw== + dependencies: + "@babel/highlight" "^7.0.0" + +"@babel/core@^7.1.0", "@babel/core@^7.3.3": + version "7.6.4" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.6.4.tgz#6ebd9fe00925f6c3e177bb726a188b5f578088ff" + integrity sha512-Rm0HGw101GY8FTzpWSyRbki/jzq+/PkNQJ+nSulrdY6gFGOsNseCqD6KHRYe2E+EdzuBdr2pxCp6s4Uk6eJ+XQ== + dependencies: + "@babel/code-frame" "^7.5.5" + "@babel/generator" "^7.6.4" + "@babel/helpers" "^7.6.2" + "@babel/parser" "^7.6.4" + "@babel/template" "^7.6.0" + "@babel/traverse" "^7.6.3" + "@babel/types" "^7.6.3" + convert-source-map "^1.1.0" + debug "^4.1.0" + json5 "^2.1.0" + lodash "^4.17.13" + resolve "^1.3.2" + semver "^5.4.1" + source-map "^0.5.0" + +"@babel/generator@^7.4.0", "@babel/generator@^7.6.3", "@babel/generator@^7.6.4": + version "7.6.4" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.6.4.tgz#a4f8437287bf9671b07f483b76e3bb731bc97671" + integrity sha512-jsBuXkFoZxk0yWLyGI9llT9oiQ2FeTASmRFE32U+aaDTfoE92t78eroO7PTpU/OrYq38hlcDM6vbfLDaOLy+7w== + dependencies: + "@babel/types" "^7.6.3" + jsesc "^2.5.1" + lodash "^4.17.13" + source-map "^0.5.0" + +"@babel/helper-annotate-as-pure@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0.tgz#323d39dd0b50e10c7c06ca7d7638e6864d8c5c32" + integrity sha512-3UYcJUj9kvSLbLbUIfQTqzcy5VX7GRZ/CCDrnOaZorFFM01aXp1+GJwuFGV4NDDoAS+mOUyHcO6UD/RfqOks3Q== + dependencies: + "@babel/types" "^7.0.0" + +"@babel/helper-builder-binary-assignment-operator-visitor@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.1.0.tgz#6b69628dfe4087798e0c4ed98e3d4a6b2fbd2f5f" + integrity sha512-qNSR4jrmJ8M1VMM9tibvyRAHXQs2PmaksQF7c1CGJNipfe3D8p+wgNwgso/P2A2r2mdgBWAXljNWR0QRZAMW8w== + dependencies: + "@babel/helper-explode-assignable-expression" "^7.1.0" + "@babel/types" "^7.0.0" + +"@babel/helper-call-delegate@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-call-delegate/-/helper-call-delegate-7.4.4.tgz#87c1f8ca19ad552a736a7a27b1c1fcf8b1ff1f43" + integrity sha512-l79boDFJ8S1c5hvQvG+rc+wHw6IuH7YldmRKsYtpbawsxURu/paVy57FZMomGK22/JckepaikOkY0MoAmdyOlQ== + dependencies: + "@babel/helper-hoist-variables" "^7.4.4" + "@babel/traverse" "^7.4.4" + "@babel/types" "^7.4.4" + +"@babel/helper-define-map@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.5.5.tgz#3dec32c2046f37e09b28c93eb0b103fd2a25d369" + integrity sha512-fTfxx7i0B5NJqvUOBBGREnrqbTxRh7zinBANpZXAVDlsZxYdclDp467G1sQ8VZYMnAURY3RpBUAgOYT9GfzHBg== + dependencies: + "@babel/helper-function-name" "^7.1.0" + "@babel/types" "^7.5.5" + lodash "^4.17.13" + +"@babel/helper-explode-assignable-expression@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.1.0.tgz#537fa13f6f1674df745b0c00ec8fe4e99681c8f6" + integrity sha512-NRQpfHrJ1msCHtKjbzs9YcMmJZOg6mQMmGRB+hbamEdG5PNpaSm95275VD92DvJKuyl0s2sFiDmMZ+EnnvufqA== + dependencies: + "@babel/traverse" "^7.1.0" + "@babel/types" "^7.0.0" + +"@babel/helper-function-name@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz#a0ceb01685f73355d4360c1247f582bfafc8ff53" + integrity sha512-A95XEoCpb3TO+KZzJ4S/5uW5fNe26DjBGqf1o9ucyLyCmi1dXq/B3c8iaWTfBk3VvetUxl16e8tIrd5teOCfGw== + dependencies: + "@babel/helper-get-function-arity" "^7.0.0" + "@babel/template" "^7.1.0" + "@babel/types" "^7.0.0" + +"@babel/helper-get-function-arity@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz#83572d4320e2a4657263734113c42868b64e49c3" + integrity sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ== + dependencies: + "@babel/types" "^7.0.0" + +"@babel/helper-hoist-variables@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.4.4.tgz#0298b5f25c8c09c53102d52ac4a98f773eb2850a" + integrity sha512-VYk2/H/BnYbZDDg39hr3t2kKyifAm1W6zHRfhx8jGjIHpQEBv9dry7oQ2f3+J703TLu69nYdxsovl0XYfcnK4w== + dependencies: + "@babel/types" "^7.4.4" + +"@babel/helper-member-expression-to-functions@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.5.5.tgz#1fb5b8ec4453a93c439ee9fe3aeea4a84b76b590" + integrity sha512-5qZ3D1uMclSNqYcXqiHoA0meVdv+xUEex9em2fqMnrk/scphGlGgg66zjMrPJESPwrFJ6sbfFQYUSa0Mz7FabA== + dependencies: + "@babel/types" "^7.5.5" + +"@babel/helper-module-imports@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.0.0.tgz#96081b7111e486da4d2cd971ad1a4fe216cc2e3d" + integrity sha512-aP/hlLq01DWNEiDg4Jn23i+CXxW/owM4WpDLFUbpjxe4NS3BhLVZQ5i7E0ZrxuQ/vwekIeciyamgB1UIYxxM6A== + dependencies: + "@babel/types" "^7.0.0" + +"@babel/helper-module-transforms@^7.1.0", "@babel/helper-module-transforms@^7.4.4": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.5.5.tgz#f84ff8a09038dcbca1fd4355661a500937165b4a" + integrity sha512-jBeCvETKuJqeiaCdyaheF40aXnnU1+wkSiUs/IQg3tB85up1LyL8x77ClY8qJpuRJUcXQo+ZtdNESmZl4j56Pw== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-simple-access" "^7.1.0" + "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/template" "^7.4.4" + "@babel/types" "^7.5.5" + lodash "^4.17.13" + +"@babel/helper-optimise-call-expression@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.0.0.tgz#a2920c5702b073c15de51106200aa8cad20497d5" + integrity sha512-u8nd9NQePYNQV8iPWu/pLLYBqZBa4ZaY1YWRFMuxrid94wKI1QNt67NEZ7GAe5Kc/0LLScbim05xZFWkAdrj9g== + dependencies: + "@babel/types" "^7.0.0" + +"@babel/helper-plugin-utils@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz#bbb3fbee98661c569034237cc03967ba99b4f250" + integrity sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA== + +"@babel/helper-regex@^7.0.0", "@babel/helper-regex@^7.4.4": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.5.5.tgz#0aa6824f7100a2e0e89c1527c23936c152cab351" + integrity sha512-CkCYQLkfkiugbRDO8eZn6lRuR8kzZoGXCg3149iTk5se7g6qykSpy3+hELSwquhu+TgHn8nkLiBwHvNX8Hofcw== + dependencies: + lodash "^4.17.13" + +"@babel/helper-remap-async-to-generator@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.1.0.tgz#361d80821b6f38da75bd3f0785ece20a88c5fe7f" + integrity sha512-3fOK0L+Fdlg8S5al8u/hWE6vhufGSn0bN09xm2LXMy//REAF8kDCrYoOBKYmA8m5Nom+sV9LyLCwrFynA8/slg== + dependencies: + "@babel/helper-annotate-as-pure" "^7.0.0" + "@babel/helper-wrap-function" "^7.1.0" + "@babel/template" "^7.1.0" + "@babel/traverse" "^7.1.0" + "@babel/types" "^7.0.0" + +"@babel/helper-replace-supers@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.5.5.tgz#f84ce43df031222d2bad068d2626cb5799c34bc2" + integrity sha512-XvRFWrNnlsow2u7jXDuH4jDDctkxbS7gXssrP4q2nUD606ukXHRvydj346wmNg+zAgpFx4MWf4+usfC93bElJg== + dependencies: + "@babel/helper-member-expression-to-functions" "^7.5.5" + "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/traverse" "^7.5.5" + "@babel/types" "^7.5.5" + +"@babel/helper-simple-access@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.1.0.tgz#65eeb954c8c245beaa4e859da6188f39d71e585c" + integrity sha512-Vk+78hNjRbsiu49zAPALxTb+JUQCz1aolpd8osOF16BGnLtseD21nbHgLPGUwrXEurZgiCOUmvs3ExTu4F5x6w== + dependencies: + "@babel/template" "^7.1.0" + "@babel/types" "^7.0.0" + +"@babel/helper-split-export-declaration@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz#ff94894a340be78f53f06af038b205c49d993677" + integrity sha512-Ro/XkzLf3JFITkW6b+hNxzZ1n5OQ80NvIUdmHspih1XAhtN3vPTuUFT4eQnela+2MaZ5ulH+iyP513KJrxbN7Q== + dependencies: + "@babel/types" "^7.4.4" + +"@babel/helper-wrap-function@^7.1.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.2.0.tgz#c4e0012445769e2815b55296ead43a958549f6fa" + integrity sha512-o9fP1BZLLSrYlxYEYyl2aS+Flun5gtjTIG8iln+XuEzQTs0PLagAGSXUcqruJwD5fM48jzIEggCKpIfWTcR7pQ== + dependencies: + "@babel/helper-function-name" "^7.1.0" + "@babel/template" "^7.1.0" + "@babel/traverse" "^7.1.0" + "@babel/types" "^7.2.0" + +"@babel/helpers@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.6.2.tgz#681ffe489ea4dcc55f23ce469e58e59c1c045153" + integrity sha512-3/bAUL8zZxYs1cdX2ilEE0WobqbCmKWr/889lf2SS0PpDcpEIY8pb1CCyz0pEcX3pEb+MCbks1jIokz2xLtGTA== + dependencies: + "@babel/template" "^7.6.0" + "@babel/traverse" "^7.6.2" + "@babel/types" "^7.6.0" + +"@babel/highlight@^7.0.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.5.0.tgz#56d11312bd9248fa619591d02472be6e8cb32540" + integrity sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ== + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^4.0.0" + +"@babel/parser@^7.1.0", "@babel/parser@^7.4.3", "@babel/parser@^7.6.0", "@babel/parser@^7.6.3", "@babel/parser@^7.6.4": + version "7.6.4" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.4.tgz#cb9b36a7482110282d5cb6dd424ec9262b473d81" + integrity sha512-D8RHPW5qd0Vbyo3qb+YjO5nvUVRTXFLQ/FsDxJU2Nqz4uB5EnUN0ZQSEYpvTIbRuttig1XbHWU5oMeQwQSAA+A== + +"@babel/plugin-proposal-async-generator-functions@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.2.0.tgz#b289b306669dce4ad20b0252889a15768c9d417e" + integrity sha512-+Dfo/SCQqrwx48ptLVGLdE39YtWRuKc/Y9I5Fy0P1DDBB9lsAHpjcEJQt+4IifuSOSTLBKJObJqMvaO1pIE8LQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-remap-async-to-generator" "^7.1.0" + "@babel/plugin-syntax-async-generators" "^7.2.0" + +"@babel/plugin-proposal-dynamic-import@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.5.0.tgz#e532202db4838723691b10a67b8ce509e397c506" + integrity sha512-x/iMjggsKTFHYC6g11PL7Qy58IK8H5zqfm9e6hu4z1iH2IRyAp9u9dL80zA6R76yFovETFLKz2VJIC2iIPBuFw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-dynamic-import" "^7.2.0" + +"@babel/plugin-proposal-json-strings@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.2.0.tgz#568ecc446c6148ae6b267f02551130891e29f317" + integrity sha512-MAFV1CA/YVmYwZG0fBQyXhmj0BHCB5egZHCKWIFVv/XCxAeVGIHfos3SwDck4LvCllENIAg7xMKOG5kH0dzyUg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-json-strings" "^7.2.0" + +"@babel/plugin-proposal-object-rest-spread@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.6.2.tgz#8ffccc8f3a6545e9f78988b6bf4fe881b88e8096" + integrity sha512-LDBXlmADCsMZV1Y9OQwMc0MyGZ8Ta/zlD9N67BfQT8uYwkRswiu2hU6nJKrjrt/58aH/vqfQlR/9yId/7A2gWw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-object-rest-spread" "^7.2.0" + +"@babel/plugin-proposal-optional-catch-binding@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.2.0.tgz#135d81edb68a081e55e56ec48541ece8065c38f5" + integrity sha512-mgYj3jCcxug6KUcX4OBoOJz3CMrwRfQELPQ5560F70YQUBZB7uac9fqaWamKR1iWUzGiK2t0ygzjTScZnVz75g== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" + +"@babel/plugin-proposal-unicode-property-regex@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.6.2.tgz#05413762894f41bfe42b9a5e80919bd575dcc802" + integrity sha512-NxHETdmpeSCtiatMRYWVJo7266rrvAC3DTeG5exQBIH/fMIUK7ejDNznBbn3HQl/o9peymRRg7Yqkx6PdUXmMw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.4.4" + regexpu-core "^4.6.0" + +"@babel/plugin-syntax-async-generators@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.2.0.tgz#69e1f0db34c6f5a0cf7e2b3323bf159a76c8cb7f" + integrity sha512-1ZrIRBv2t0GSlcwVoQ6VgSLpLgiN/FVQUzt9znxo7v2Ov4jJrs8RY8tv0wvDmFN3qIdMKWrmMMW6yZ0G19MfGg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-dynamic-import@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.2.0.tgz#69c159ffaf4998122161ad8ebc5e6d1f55df8612" + integrity sha512-mVxuJ0YroI/h/tbFTPGZR8cv6ai+STMKNBq0f8hFxsxWjl94qqhsb+wXbpNMDPU3cfR1TIsVFzU3nXyZMqyK4w== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-json-strings@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.2.0.tgz#72bd13f6ffe1d25938129d2a186b11fd62951470" + integrity sha512-5UGYnMSLRE1dqqZwug+1LISpA403HzlSfsg6P9VXU6TBjcSHeNlw4DxDx7LgpF+iKZoOG/+uzqoRHTdcUpiZNg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz#3b7a3e733510c57e820b9142a6579ac8b0dfad2e" + integrity sha512-t0JKGgqk2We+9may3t0xDdmneaXmyxq0xieYcKHxIsrJO64n1OiMWNUtc5gQK1PA0NpdCRrtZp4z+IUaKugrSA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-optional-catch-binding@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.2.0.tgz#a94013d6eda8908dfe6a477e7f9eda85656ecf5c" + integrity sha512-bDe4xKNhb0LI7IvZHiA13kff0KEfaGX/Hv4lMA9+7TEc63hMNvfKo6ZFpXhKuEp+II/q35Gc4NoMeDZyaUbj9w== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-arrow-functions@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.2.0.tgz#9aeafbe4d6ffc6563bf8f8372091628f00779550" + integrity sha512-ER77Cax1+8/8jCB9fo4Ud161OZzWN5qawi4GusDuRLcDbDG+bIGYY20zb2dfAFdTRGzrfq2xZPvF0R64EHnimg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-async-to-generator@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.5.0.tgz#89a3848a0166623b5bc481164b5936ab947e887e" + integrity sha512-mqvkzwIGkq0bEF1zLRRiTdjfomZJDV33AH3oQzHVGkI2VzEmXLpKKOBvEVaFZBJdN0XTyH38s9j/Kiqr68dggg== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-remap-async-to-generator" "^7.1.0" + +"@babel/plugin-transform-block-scoped-functions@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.2.0.tgz#5d3cc11e8d5ddd752aa64c9148d0db6cb79fd190" + integrity sha512-ntQPR6q1/NKuphly49+QiQiTN0O63uOwjdD6dhIjSWBI5xlrbUFh720TIpzBhpnrLfv2tNH/BXvLIab1+BAI0w== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-block-scoping@^7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.6.3.tgz#6e854e51fbbaa84351b15d4ddafe342f3a5d542a" + integrity sha512-7hvrg75dubcO3ZI2rjYTzUrEuh1E9IyDEhhB6qfcooxhDA33xx2MasuLVgdxzcP6R/lipAC6n9ub9maNW6RKdw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + lodash "^4.17.13" + +"@babel/plugin-transform-classes@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.5.5.tgz#d094299d9bd680a14a2a0edae38305ad60fb4de9" + integrity sha512-U2htCNK/6e9K7jGyJ++1p5XRU+LJjrwtoiVn9SzRlDT2KubcZ11OOwy3s24TjHxPgxNwonCYP7U2K51uVYCMDg== + dependencies: + "@babel/helper-annotate-as-pure" "^7.0.0" + "@babel/helper-define-map" "^7.5.5" + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.5.5" + "@babel/helper-split-export-declaration" "^7.4.4" + globals "^11.1.0" + +"@babel/plugin-transform-computed-properties@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.2.0.tgz#83a7df6a658865b1c8f641d510c6f3af220216da" + integrity sha512-kP/drqTxY6Xt3NNpKiMomfgkNn4o7+vKxK2DDKcBG9sHj51vHqMBGy8wbDS/J4lMxnqs153/T3+DmCEAkC5cpA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-destructuring@^7.6.0": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.6.0.tgz#44bbe08b57f4480094d57d9ffbcd96d309075ba6" + integrity sha512-2bGIS5P1v4+sWTCnKNDZDxbGvEqi0ijeqM/YqHtVGrvG2y0ySgnEEhXErvE9dA0bnIzY9bIzdFK0jFA46ASIIQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-dotall-regex@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.6.2.tgz#44abb948b88f0199a627024e1508acaf8dc9b2f9" + integrity sha512-KGKT9aqKV+9YMZSkowzYoYEiHqgaDhGmPNZlZxX6UeHC4z30nC1J9IrZuGqbYFB1jaIGdv91ujpze0exiVK8bA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.4.4" + regexpu-core "^4.6.0" + +"@babel/plugin-transform-duplicate-keys@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.5.0.tgz#c5dbf5106bf84cdf691222c0974c12b1df931853" + integrity sha512-igcziksHizyQPlX9gfSjHkE2wmoCH3evvD2qR5w29/Dk0SMKE/eOI7f1HhBdNhR/zxJDqrgpoDTq5YSLH/XMsQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-exponentiation-operator@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.2.0.tgz#a63868289e5b4007f7054d46491af51435766008" + integrity sha512-umh4hR6N7mu4Elq9GG8TOu9M0bakvlsREEC+ialrQN6ABS4oDQ69qJv1VtR3uxlKMCQMCvzk7vr17RHKcjx68A== + dependencies: + "@babel/helper-builder-binary-assignment-operator-visitor" "^7.1.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-for-of@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.4.4.tgz#0267fc735e24c808ba173866c6c4d1440fc3c556" + integrity sha512-9T/5Dlr14Z9TIEXLXkt8T1DU7F24cbhwhMNUziN3hB1AXoZcdzPcTiKGRn/6iOymDqtTKWnr/BtRKN9JwbKtdQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-function-name@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.4.4.tgz#e1436116abb0610c2259094848754ac5230922ad" + integrity sha512-iU9pv7U+2jC9ANQkKeNF6DrPy4GBa4NWQtl6dHB4Pb3izX2JOEvDTFarlNsBj/63ZEzNNIAMs3Qw4fNCcSOXJA== + dependencies: + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-literals@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.2.0.tgz#690353e81f9267dad4fd8cfd77eafa86aba53ea1" + integrity sha512-2ThDhm4lI4oV7fVQ6pNNK+sx+c/GM5/SaML0w/r4ZB7sAneD/piDJtwdKlNckXeyGK7wlwg2E2w33C/Hh+VFCg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-member-expression-literals@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.2.0.tgz#fa10aa5c58a2cb6afcf2c9ffa8cb4d8b3d489a2d" + integrity sha512-HiU3zKkSU6scTidmnFJ0bMX8hz5ixC93b4MHMiYebmk2lUVNGOboPsqQvx5LzooihijUoLR/v7Nc1rbBtnc7FA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-modules-amd@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.5.0.tgz#ef00435d46da0a5961aa728a1d2ecff063e4fb91" + integrity sha512-n20UsQMKnWrltocZZm24cRURxQnWIvsABPJlw/fvoy9c6AgHZzoelAIzajDHAQrDpuKFFPPcFGd7ChsYuIUMpg== + dependencies: + "@babel/helper-module-transforms" "^7.1.0" + "@babel/helper-plugin-utils" "^7.0.0" + babel-plugin-dynamic-import-node "^2.3.0" + +"@babel/plugin-transform-modules-commonjs@^7.6.0": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.6.0.tgz#39dfe957de4420445f1fcf88b68a2e4aa4515486" + integrity sha512-Ma93Ix95PNSEngqomy5LSBMAQvYKVe3dy+JlVJSHEXZR5ASL9lQBedMiCyVtmTLraIDVRE3ZjTZvmXXD2Ozw3g== + dependencies: + "@babel/helper-module-transforms" "^7.4.4" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-simple-access" "^7.1.0" + babel-plugin-dynamic-import-node "^2.3.0" + +"@babel/plugin-transform-modules-systemjs@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.5.0.tgz#e75266a13ef94202db2a0620977756f51d52d249" + integrity sha512-Q2m56tyoQWmuNGxEtUyeEkm6qJYFqs4c+XyXH5RAuYxObRNz9Zgj/1g2GMnjYp2EUyEy7YTrxliGCXzecl/vJg== + dependencies: + "@babel/helper-hoist-variables" "^7.4.4" + "@babel/helper-plugin-utils" "^7.0.0" + babel-plugin-dynamic-import-node "^2.3.0" + +"@babel/plugin-transform-modules-umd@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.2.0.tgz#7678ce75169f0877b8eb2235538c074268dd01ae" + integrity sha512-BV3bw6MyUH1iIsGhXlOK6sXhmSarZjtJ/vMiD9dNmpY8QXFFQTj+6v92pcfy1iqa8DeAfJFwoxcrS/TUZda6sw== + dependencies: + "@babel/helper-module-transforms" "^7.1.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-named-capturing-groups-regex@^7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.6.3.tgz#aaa6e409dd4fb2e50b6e2a91f7e3a3149dbce0cf" + integrity sha512-jTkk7/uE6H2s5w6VlMHeWuH+Pcy2lmdwFoeWCVnvIrDUnB5gQqTVI8WfmEAhF2CDEarGrknZcmSFg1+bkfCoSw== + dependencies: + regexpu-core "^4.6.0" + +"@babel/plugin-transform-new-target@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.4.4.tgz#18d120438b0cc9ee95a47f2c72bc9768fbed60a5" + integrity sha512-r1z3T2DNGQwwe2vPGZMBNjioT2scgWzK9BCnDEh+46z8EEwXBq24uRzd65I7pjtugzPSj921aM15RpESgzsSuA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-object-super@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.5.5.tgz#c70021df834073c65eb613b8679cc4a381d1a9f9" + integrity sha512-un1zJQAhSosGFBduPgN/YFNvWVpRuHKU7IHBglLoLZsGmruJPOo6pbInneflUdmq7YvSVqhpPs5zdBvLnteltQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.5.5" + +"@babel/plugin-transform-parameters@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.4.4.tgz#7556cf03f318bd2719fe4c922d2d808be5571e16" + integrity sha512-oMh5DUO1V63nZcu/ZVLQFqiihBGo4OpxJxR1otF50GMeCLiRx5nUdtokd+u9SuVJrvvuIh9OosRFPP4pIPnwmw== + dependencies: + "@babel/helper-call-delegate" "^7.4.4" + "@babel/helper-get-function-arity" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-property-literals@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.2.0.tgz#03e33f653f5b25c4eb572c98b9485055b389e905" + integrity sha512-9q7Dbk4RhgcLp8ebduOpCbtjh7C0itoLYHXd9ueASKAG/is5PQtMR5VJGka9NKqGhYEGn5ITahd4h9QeBMylWQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-regenerator@^7.4.5": + version "7.4.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.4.5.tgz#629dc82512c55cee01341fb27bdfcb210354680f" + integrity sha512-gBKRh5qAaCWntnd09S8QC7r3auLCqq5DI6O0DlfoyDjslSBVqBibrMdsqO+Uhmx3+BlOmE/Kw1HFxmGbv0N9dA== + dependencies: + regenerator-transform "^0.14.0" + +"@babel/plugin-transform-reserved-words@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.2.0.tgz#4792af87c998a49367597d07fedf02636d2e1634" + integrity sha512-fz43fqW8E1tAB3DKF19/vxbpib1fuyCwSPE418ge5ZxILnBhWyhtPgz8eh1RCGGJlwvksHkyxMxh0eenFi+kFw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-shorthand-properties@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.2.0.tgz#6333aee2f8d6ee7e28615457298934a3b46198f0" + integrity sha512-QP4eUM83ha9zmYtpbnyjTLAGKQritA5XW/iG9cjtuOI8s1RuL/3V6a3DeSHfKutJQ+ayUfeZJPcnCYEQzaPQqg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-spread@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.6.2.tgz#fc77cf798b24b10c46e1b51b1b88c2bf661bb8dd" + integrity sha512-DpSvPFryKdK1x+EDJYCy28nmAaIMdxmhot62jAXF/o99iA33Zj2Lmcp3vDmz+MUh0LNYVPvfj5iC3feb3/+PFg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-sticky-regex@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.2.0.tgz#a1e454b5995560a9c1e0d537dfc15061fd2687e1" + integrity sha512-KKYCoGaRAf+ckH8gEL3JHUaFVyNHKe3ASNsZ+AlktgHevvxGigoIttrEJb8iKN03Q7Eazlv1s6cx2B2cQ3Jabw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.0.0" + +"@babel/plugin-transform-template-literals@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.4.4.tgz#9d28fea7bbce637fb7612a0750989d8321d4bcb0" + integrity sha512-mQrEC4TWkhLN0z8ygIvEL9ZEToPhG5K7KDW3pzGqOfIGZ28Jb0POUkeWcoz8HnHvhFy6dwAT1j8OzqN8s804+g== + dependencies: + "@babel/helper-annotate-as-pure" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-typeof-symbol@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.2.0.tgz#117d2bcec2fbf64b4b59d1f9819894682d29f2b2" + integrity sha512-2LNhETWYxiYysBtrBTqL8+La0jIoQQnIScUJc74OYvUGRmkskNY4EzLCnjHBzdmb38wqtTaixpo1NctEcvMDZw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-unicode-regex@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.6.2.tgz#b692aad888a7e8d8b1b214be6b9dc03d5031f698" + integrity sha512-orZI6cWlR3nk2YmYdb0gImrgCUwb5cBUwjf6Ks6dvNVvXERkwtJWOQaEOjPiu0Gu1Tq6Yq/hruCZZOOi9F34Dw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.4.4" + regexpu-core "^4.6.0" + +"@babel/preset-env@^7.3.1": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.6.3.tgz#9e1bf05a2e2d687036d24c40e4639dc46cef2271" + integrity sha512-CWQkn7EVnwzlOdR5NOm2+pfgSNEZmvGjOhlCHBDq0J8/EStr+G+FvPEiz9B56dR6MoiUFjXhfE4hjLoAKKJtIQ== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-proposal-async-generator-functions" "^7.2.0" + "@babel/plugin-proposal-dynamic-import" "^7.5.0" + "@babel/plugin-proposal-json-strings" "^7.2.0" + "@babel/plugin-proposal-object-rest-spread" "^7.6.2" + "@babel/plugin-proposal-optional-catch-binding" "^7.2.0" + "@babel/plugin-proposal-unicode-property-regex" "^7.6.2" + "@babel/plugin-syntax-async-generators" "^7.2.0" + "@babel/plugin-syntax-dynamic-import" "^7.2.0" + "@babel/plugin-syntax-json-strings" "^7.2.0" + "@babel/plugin-syntax-object-rest-spread" "^7.2.0" + "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" + "@babel/plugin-transform-arrow-functions" "^7.2.0" + "@babel/plugin-transform-async-to-generator" "^7.5.0" + "@babel/plugin-transform-block-scoped-functions" "^7.2.0" + "@babel/plugin-transform-block-scoping" "^7.6.3" + "@babel/plugin-transform-classes" "^7.5.5" + "@babel/plugin-transform-computed-properties" "^7.2.0" + "@babel/plugin-transform-destructuring" "^7.6.0" + "@babel/plugin-transform-dotall-regex" "^7.6.2" + "@babel/plugin-transform-duplicate-keys" "^7.5.0" + "@babel/plugin-transform-exponentiation-operator" "^7.2.0" + "@babel/plugin-transform-for-of" "^7.4.4" + "@babel/plugin-transform-function-name" "^7.4.4" + "@babel/plugin-transform-literals" "^7.2.0" + "@babel/plugin-transform-member-expression-literals" "^7.2.0" + "@babel/plugin-transform-modules-amd" "^7.5.0" + "@babel/plugin-transform-modules-commonjs" "^7.6.0" + "@babel/plugin-transform-modules-systemjs" "^7.5.0" + "@babel/plugin-transform-modules-umd" "^7.2.0" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.6.3" + "@babel/plugin-transform-new-target" "^7.4.4" + "@babel/plugin-transform-object-super" "^7.5.5" + "@babel/plugin-transform-parameters" "^7.4.4" + "@babel/plugin-transform-property-literals" "^7.2.0" + "@babel/plugin-transform-regenerator" "^7.4.5" + "@babel/plugin-transform-reserved-words" "^7.2.0" + "@babel/plugin-transform-shorthand-properties" "^7.2.0" + "@babel/plugin-transform-spread" "^7.6.2" + "@babel/plugin-transform-sticky-regex" "^7.2.0" + "@babel/plugin-transform-template-literals" "^7.4.4" + "@babel/plugin-transform-typeof-symbol" "^7.2.0" + "@babel/plugin-transform-unicode-regex" "^7.6.2" + "@babel/types" "^7.6.3" + browserslist "^4.6.0" + core-js-compat "^3.1.1" + invariant "^2.2.2" + js-levenshtein "^1.1.3" + semver "^5.5.0" + +"@babel/runtime@^7.1.2": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.6.3.tgz#935122c74c73d2240cafd32ddb5fc2a6cd35cf1f" + integrity sha512-kq6anf9JGjW8Nt5rYfEuGRaEAaH1mkv3Bbu6rYvLOpPh/RusSJXuKPEAoZ7L7gybZkchE8+NV5g9vKF4AGAtsA== + dependencies: + regenerator-runtime "^0.13.2" + +"@babel/template@^7.1.0", "@babel/template@^7.4.0", "@babel/template@^7.4.4", "@babel/template@^7.6.0": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.6.0.tgz#7f0159c7f5012230dad64cca42ec9bdb5c9536e6" + integrity sha512-5AEH2EXD8euCk446b7edmgFdub/qfH1SN6Nii3+fyXP807QRx9Q73A2N5hNwRRslC2H9sNzaFhsPubkS4L8oNQ== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.6.0" + "@babel/types" "^7.6.0" + +"@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.4.4", "@babel/traverse@^7.5.5", "@babel/traverse@^7.6.2", "@babel/traverse@^7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.6.3.tgz#66d7dba146b086703c0fb10dd588b7364cec47f9" + integrity sha512-unn7P4LGsijIxaAJo/wpoU11zN+2IaClkQAxcJWBNCMS6cmVh802IyLHNkAjQ0iYnRS3nnxk5O3fuXW28IMxTw== + dependencies: + "@babel/code-frame" "^7.5.5" + "@babel/generator" "^7.6.3" + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/parser" "^7.6.3" + "@babel/types" "^7.6.3" + debug "^4.1.0" + globals "^11.1.0" + lodash "^4.17.13" + +"@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.5.5", "@babel/types@^7.6.0", "@babel/types@^7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.6.3.tgz#3f07d96f854f98e2fbd45c64b0cb942d11e8ba09" + integrity sha512-CqbcpTxMcpuQTMhjI37ZHVgjBkysg5icREQIEZ0eG1yCNwg3oy+5AaLiOKmjsCj6nqOsa6Hf0ObjRVwokb7srA== + dependencies: + esutils "^2.0.2" + lodash "^4.17.13" + to-fast-properties "^2.0.0" + +"@cnakazawa/watch@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.3.tgz#099139eaec7ebf07a27c1786a3ff64f39464d2ef" + integrity sha512-r5160ogAvGyHsal38Kux7YYtodEKOj89RGb28ht1jh3SJb08VwRwAKKJL0bGb04Zd/3r9FL3BFIc3bBidYffCA== + dependencies: + exec-sh "^0.3.2" + minimist "^1.2.0" + +"@jest/console@^24.7.1", "@jest/console@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.9.0.tgz#79b1bc06fb74a8cfb01cbdedf945584b1b9707f0" + integrity sha512-Zuj6b8TnKXi3q4ymac8EQfc3ea/uhLeCGThFqXeC8H9/raaH8ARPUTdId+XyGd03Z4In0/VjD2OYFcBF09fNLQ== + dependencies: + "@jest/source-map" "^24.9.0" + chalk "^2.0.1" + slash "^2.0.0" + +"@jest/core@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-24.9.0.tgz#2ceccd0b93181f9c4850e74f2a9ad43d351369c4" + integrity sha512-Fogg3s4wlAr1VX7q+rhV9RVnUv5tD7VuWfYy1+whMiWUrvl7U3QJSJyWcDio9Lq2prqYsZaeTv2Rz24pWGkJ2A== + dependencies: + "@jest/console" "^24.7.1" + "@jest/reporters" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + ansi-escapes "^3.0.0" + chalk "^2.0.1" + exit "^0.1.2" + graceful-fs "^4.1.15" + jest-changed-files "^24.9.0" + jest-config "^24.9.0" + jest-haste-map "^24.9.0" + jest-message-util "^24.9.0" + jest-regex-util "^24.3.0" + jest-resolve "^24.9.0" + jest-resolve-dependencies "^24.9.0" + jest-runner "^24.9.0" + jest-runtime "^24.9.0" + jest-snapshot "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" + jest-watcher "^24.9.0" + micromatch "^3.1.10" + p-each-series "^1.0.0" + realpath-native "^1.1.0" + rimraf "^2.5.4" + slash "^2.0.0" + strip-ansi "^5.0.0" + +"@jest/environment@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-24.9.0.tgz#21e3afa2d65c0586cbd6cbefe208bafade44ab18" + integrity sha512-5A1QluTPhvdIPFYnO3sZC3smkNeXPVELz7ikPbhUj0bQjB07EoE9qtLrem14ZUYWdVayYbsjVwIiL4WBIMV4aQ== + dependencies: + "@jest/fake-timers" "^24.9.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + jest-mock "^24.9.0" + +"@jest/fake-timers@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.9.0.tgz#ba3e6bf0eecd09a636049896434d306636540c93" + integrity sha512-eWQcNa2YSwzXWIMC5KufBh3oWRIijrQFROsIqt6v/NS9Io/gknw1jsAC9c+ih/RQX4A3O7SeWAhQeN0goKhT9A== + dependencies: + "@jest/types" "^24.9.0" + jest-message-util "^24.9.0" + jest-mock "^24.9.0" + +"@jest/reporters@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-24.9.0.tgz#86660eff8e2b9661d042a8e98a028b8d631a5b43" + integrity sha512-mu4X0yjaHrffOsWmVLzitKmmmWSQ3GGuefgNscUSWNiUNcEOSEQk9k3pERKEQVBb0Cnn88+UESIsZEMH3o88Gw== + dependencies: + "@jest/environment" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + chalk "^2.0.1" + exit "^0.1.2" + glob "^7.1.2" + istanbul-lib-coverage "^2.0.2" + istanbul-lib-instrument "^3.0.1" + istanbul-lib-report "^2.0.4" + istanbul-lib-source-maps "^3.0.1" + istanbul-reports "^2.2.6" + jest-haste-map "^24.9.0" + jest-resolve "^24.9.0" + jest-runtime "^24.9.0" + jest-util "^24.9.0" + jest-worker "^24.6.0" + node-notifier "^5.4.2" + slash "^2.0.0" + source-map "^0.6.0" + string-length "^2.0.0" + +"@jest/source-map@^24.3.0", "@jest/source-map@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-24.9.0.tgz#0e263a94430be4b41da683ccc1e6bffe2a191714" + integrity sha512-/Xw7xGlsZb4MJzNDgB7PW5crou5JqWiBQaz6xyPd3ArOg2nfn/PunV8+olXbbEZzNl591o5rWKE9BRDaFAuIBg== + dependencies: + callsites "^3.0.0" + graceful-fs "^4.1.15" + source-map "^0.6.0" + +"@jest/test-result@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.9.0.tgz#11796e8aa9dbf88ea025757b3152595ad06ba0ca" + integrity sha512-XEFrHbBonBJ8dGp2JmF8kP/nQI/ImPpygKHwQ/SY+es59Z3L5PI4Qb9TQQMAEeYsThG1xF0k6tmG0tIKATNiiA== + dependencies: + "@jest/console" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/istanbul-lib-coverage" "^2.0.0" + +"@jest/test-sequencer@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-24.9.0.tgz#f8f334f35b625a4f2f355f2fe7e6036dad2e6b31" + integrity sha512-6qqsU4o0kW1dvA95qfNog8v8gkRN9ph6Lz7r96IvZpHdNipP2cBcb07J1Z45mz/VIS01OHJ3pY8T5fUY38tg4A== + dependencies: + "@jest/test-result" "^24.9.0" + jest-haste-map "^24.9.0" + jest-runner "^24.9.0" + jest-runtime "^24.9.0" + +"@jest/transform@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-24.9.0.tgz#4ae2768b296553fadab09e9ec119543c90b16c56" + integrity sha512-TcQUmyNRxV94S0QpMOnZl0++6RMiqpbH/ZMccFB/amku6Uwvyb1cjYX7xkp5nGNkbX4QPH/FcB6q1HBTHynLmQ== + dependencies: + "@babel/core" "^7.1.0" + "@jest/types" "^24.9.0" + babel-plugin-istanbul "^5.1.0" + chalk "^2.0.1" + convert-source-map "^1.4.0" + fast-json-stable-stringify "^2.0.0" + graceful-fs "^4.1.15" + jest-haste-map "^24.9.0" + jest-regex-util "^24.9.0" + jest-util "^24.9.0" + micromatch "^3.1.10" + pirates "^4.0.1" + realpath-native "^1.1.0" + slash "^2.0.0" + source-map "^0.6.1" + write-file-atomic "2.4.1" + +"@jest/types@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.9.0.tgz#63cb26cb7500d069e5a389441a7c6ab5e909fc59" + integrity sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw== + dependencies: + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^1.1.1" + "@types/yargs" "^13.0.0" + +"@types/babel__core@^7.1.0": + version "7.1.3" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.3.tgz#e441ea7df63cd080dfcd02ab199e6d16a735fc30" + integrity sha512-8fBo0UR2CcwWxeX7WIIgJ7lXjasFxoYgRnFHUj+hRvKkpiBJbxhdAPTCY6/ZKM0uxANFVzt4yObSLuTiTnazDA== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + "@types/babel__generator" "*" + "@types/babel__template" "*" + "@types/babel__traverse" "*" + +"@types/babel__generator@*": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.0.tgz#f1ec1c104d1bb463556ecb724018ab788d0c172a" + integrity sha512-c1mZUu4up5cp9KROs/QAw0gTeHrw/x7m52LcnvMxxOZ03DmLwPV0MlGmlgzV3cnSdjhJOZsj7E7FHeioai+egw== + dependencies: + "@babel/types" "^7.0.0" + +"@types/babel__template@*": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.0.2.tgz#4ff63d6b52eddac1de7b975a5223ed32ecea9307" + integrity sha512-/K6zCpeW7Imzgab2bLkLEbz0+1JlFSrUMdw7KoIIu+IUdu51GWaBZpd3y1VXGVXzynvGa4DaIaxNZHiON3GXUg== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + +"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": + version "7.0.7" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.7.tgz#2496e9ff56196cc1429c72034e07eab6121b6f3f" + integrity sha512-CeBpmX1J8kWLcDEnI3Cl2Eo6RfbGvzUctA+CjZUhOKDFbLfcr7fc4usEqLNWetrlJd7RhAkyYe2czXop4fICpw== + dependencies: + "@babel/types" "^7.3.0" + +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff" + integrity sha512-hRJD2ahnnpLgsj6KWMYSrmXkM3rm2Dl1qkx6IOFD5FnuNPXJIG5L0dhgKXCYTRMGzU4n0wImQ/xfmRc4POUFlg== + +"@types/istanbul-lib-report@*": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz#e5471e7fa33c61358dd38426189c037a58433b8c" + integrity sha512-3BUTyMzbZa2DtDI2BkERNC6jJw2Mr2Y0oGI7mRxYNBPxppbtEK1F66u3bKwU2g+wxwWI7PAoRpJnOY1grJqzHg== + dependencies: + "@types/istanbul-lib-coverage" "*" + +"@types/istanbul-reports@^1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-1.1.1.tgz#7a8cbf6a406f36c8add871625b278eaf0b0d255a" + integrity sha512-UpYjBi8xefVChsCoBpKShdxTllC9pwISirfoZsUa2AAdQg/Jd2KQGtSbw+ya7GPo7x/wAPlH6JBhKhAsXUEZNA== + dependencies: + "@types/istanbul-lib-coverage" "*" + "@types/istanbul-lib-report" "*" + +"@types/stack-utils@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" + integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== + +"@types/yargs-parser@*": + version "13.1.0" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-13.1.0.tgz#c563aa192f39350a1d18da36c5a8da382bbd8228" + integrity sha512-gCubfBUZ6KxzoibJ+SCUc/57Ms1jz5NjHe4+dI2krNmU5zCPAphyLJYyTOg06ueIyfj+SaCUqmzun7ImlxDcKg== + +"@types/yargs@^13.0.0": + version "13.0.3" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-13.0.3.tgz#76482af3981d4412d65371a318f992d33464a380" + integrity sha512-K8/LfZq2duW33XW/tFwEAfnZlqIfVsoyRB3kfXdPXYhl0nfM8mmh7GS0jg7WrX2Dgq/0Ha/pR1PaR+BvmWwjiQ== + dependencies: + "@types/yargs-parser" "*" + +abab@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.2.tgz#a2fba1b122c69a85caa02d10f9270c7219709a9d" + integrity sha512-2scffjvioEmNz0OyDSLGWDfKCVwaKc6l9Pm9kOIREU13ClXZvHpg/nRL5xyjSSSLhOnXqft2HpsAzNEEA8cFFg== + +abbrev@1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" + integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== + +acorn-globals@^4.1.0: + version "4.3.4" + resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.3.4.tgz#9fa1926addc11c97308c4e66d7add0d40c3272e7" + integrity sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A== + dependencies: + acorn "^6.0.1" + acorn-walk "^6.0.1" + +acorn-walk@^6.0.1: + version "6.2.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-6.2.0.tgz#123cb8f3b84c2171f1f7fb252615b1c78a6b1a8c" + integrity sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA== + +acorn@^5.5.3: + version "5.7.3" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" + integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== + +acorn@^6.0.1: + version "6.3.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.3.0.tgz#0087509119ffa4fc0a0041d1e93a417e68cb856e" + integrity sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA== + +ajv@^6.5.5: + version "6.10.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" + integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw== + dependencies: + fast-deep-equal "^2.0.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +ansi-escapes@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" + integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= + +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= + +ansi-regex@^4.0.0, ansi-regex@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" + integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== + +ansi-styles@^3.2.0, ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +anymatch@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" + integrity sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw== + dependencies: + micromatch "^3.1.4" + normalize-path "^2.1.1" + +aproba@^1.0.3: + version "1.2.0" + resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" + integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== + +are-we-there-yet@~1.1.2: + version "1.1.5" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" + integrity sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w== + dependencies: + delegates "^1.0.0" + readable-stream "^2.0.6" + +arr-diff@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" + integrity sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA= + +arr-flatten@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== + +arr-union@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" + integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= + +array-equal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" + integrity sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM= + +array-unique@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" + integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= + +asn1@~0.2.3: + version "0.2.4" + resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" + integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== + dependencies: + safer-buffer "~2.1.0" + +assert-plus@1.0.0, assert-plus@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= + +assign-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" + integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= + +astral-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" + integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== + +async-limiter@~1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" + integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= + +atob@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" + integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== + +aws-sign2@~0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" + integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= + +aws4@^1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" + integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ== + +babel-jest@^24.1.0, babel-jest@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.9.0.tgz#3fc327cb8467b89d14d7bc70e315104a783ccd54" + integrity sha512-ntuddfyiN+EhMw58PTNL1ph4C9rECiQXjI4nMMBKBaNjXvqLdkXpPRcMSr4iyBrJg/+wz9brFUD6RhOAT6r4Iw== + dependencies: + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/babel__core" "^7.1.0" + babel-plugin-istanbul "^5.1.0" + babel-preset-jest "^24.9.0" + chalk "^2.4.2" + slash "^2.0.0" + +babel-plugin-dynamic-import-node@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz#f00f507bdaa3c3e3ff6e7e5e98d90a7acab96f7f" + integrity sha512-o6qFkpeQEBxcqt0XYlWzAVxNCSCZdUgcR8IRlhD/8DylxjjO4foPcvTW0GGKa/cVt3rvxZ7o5ippJ+/0nvLhlQ== + dependencies: + object.assign "^4.1.0" + +babel-plugin-istanbul@^5.1.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-5.2.0.tgz#df4ade83d897a92df069c4d9a25cf2671293c854" + integrity sha512-5LphC0USA8t4i1zCtjbbNb6jJj/9+X6P37Qfirc/70EQ34xKlMW+a1RHGwxGI+SwWpNwZ27HqvzAobeqaXwiZw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + find-up "^3.0.0" + istanbul-lib-instrument "^3.3.0" + test-exclude "^5.2.3" + +babel-plugin-jest-hoist@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.9.0.tgz#4f837091eb407e01447c8843cbec546d0002d756" + integrity sha512-2EMA2P8Vp7lG0RAzr4HXqtYwacfMErOuv1U3wrvxHX6rD1sV6xS3WXG3r8TRQ2r6w8OhvSdWt+z41hQNwNm3Xw== + dependencies: + "@types/babel__traverse" "^7.0.6" + +babel-preset-jest@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.9.0.tgz#192b521e2217fb1d1f67cf73f70c336650ad3cdc" + integrity sha512-izTUuhE4TMfTRPF92fFwD2QfdXaZW08qvWTFCI51V8rW5x00UuPgc3ajRoWofXOuxjfcOM5zzSYsQS3H8KGCAg== + dependencies: + "@babel/plugin-syntax-object-rest-spread" "^7.0.0" + babel-plugin-jest-hoist "^24.9.0" + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= + +base@^0.11.1: + version "0.11.2" + resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" + integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== + dependencies: + cache-base "^1.0.1" + class-utils "^0.3.5" + component-emitter "^1.2.1" + define-property "^1.0.0" + isobject "^3.0.1" + mixin-deep "^1.2.0" + pascalcase "^0.1.1" + +bcrypt-pbkdf@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" + integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= + dependencies: + tweetnacl "^0.14.3" + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +braces@^2.3.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" + integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== + dependencies: + arr-flatten "^1.1.0" + array-unique "^0.3.2" + extend-shallow "^2.0.1" + fill-range "^4.0.0" + isobject "^3.0.1" + repeat-element "^1.1.2" + snapdragon "^0.8.1" + snapdragon-node "^2.0.1" + split-string "^3.0.2" + to-regex "^3.0.1" + +browser-process-hrtime@^0.1.2: + version "0.1.3" + resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz#616f00faef1df7ec1b5bf9cfe2bdc3170f26c7b4" + integrity sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw== + +browser-resolve@^1.11.3: + version "1.11.3" + resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.3.tgz#9b7cbb3d0f510e4cb86bdbd796124d28b5890af6" + integrity sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ== + dependencies: + resolve "1.1.7" + +browserslist@^4.6.0, browserslist@^4.7.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.7.0.tgz#9ee89225ffc07db03409f2fee524dc8227458a17" + integrity sha512-9rGNDtnj+HaahxiVV38Gn8n8Lr8REKsel68v1sPFfIGEK6uSXTY3h9acgiT1dZVtOOUtifo/Dn8daDQ5dUgVsA== + dependencies: + caniuse-lite "^1.0.30000989" + electron-to-chromium "^1.3.247" + node-releases "^1.1.29" + +bser@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.0.tgz#65fc784bf7f87c009b973c12db6546902fa9c7b5" + integrity sha512-8zsjWrQkkBoLK6uxASk1nJ2SKv97ltiGDo6A3wA0/yRPz+CwmEyDo0hUrhIuukG2JHpAl3bvFIixw2/3Hi0DOg== + dependencies: + node-int64 "^0.4.0" + +buffer-from@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" + integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== + +cache-base@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" + integrity sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== + dependencies: + collection-visit "^1.0.0" + component-emitter "^1.2.1" + get-value "^2.0.6" + has-value "^1.0.0" + isobject "^3.0.1" + set-value "^2.0.0" + to-object-path "^0.3.0" + union-value "^1.0.0" + unset-value "^1.0.0" + +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +camelcase@^5.0.0, camelcase@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + +caniuse-lite@^1.0.30000989: + version "1.0.30000999" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000999.tgz#427253a69ad7bea4aa8d8345687b8eec51ca0e43" + integrity sha512-1CUyKyecPeksKwXZvYw0tEoaMCo/RwBlXmEtN5vVnabvO0KPd9RQLcaAuR9/1F+KDMv6esmOFWlsXuzDk+8rxg== + +capture-exit@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" + integrity sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g== + dependencies: + rsvp "^4.8.4" + +caseless@~0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" + integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= + +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chownr@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.3.tgz#42d837d5239688d55f303003a508230fa6727142" + integrity sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw== + +ci-info@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" + integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== + +class-utils@^0.3.5: + version "0.3.6" + resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" + integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== + dependencies: + arr-union "^3.1.0" + define-property "^0.2.5" + isobject "^3.0.0" + static-extend "^0.1.1" + +cliui@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" + integrity sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA== + dependencies: + string-width "^3.1.0" + strip-ansi "^5.2.0" + wrap-ansi "^5.1.0" + +co@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= + +collection-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= + dependencies: + map-visit "^1.0.0" + object-visit "^1.0.0" + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= + +combined-stream@^1.0.6, combined-stream@~1.0.6: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + +commander@2.20.0: + version "2.20.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" + integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== + +component-emitter@^1.2.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" + integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + +console-control-strings@^1.0.0, console-control-strings@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" + integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= + +convert-source-map@^1.1.0, convert-source-map@^1.4.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.6.0.tgz#51b537a8c43e0f04dec1993bffcdd504e758ac20" + integrity sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A== + dependencies: + safe-buffer "~5.1.1" + +copy-descriptor@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" + integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= + +core-js-compat@^3.1.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.3.1.tgz#7a22cb813bdf673b9929b90da5cbf6b3f5a72f70" + integrity sha512-R5gisVHlU8ZXrr05qjER3SJ8pp8cYxhWQ0doIfuGhLqtHf9b3eLzzr1ZEfI7MX9JJFwVT+HuyToULupnHl0Ghw== + dependencies: + browserslist "^4.7.0" + semver "^6.3.0" + +core-js@^2.5.3: + version "2.6.10" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.10.tgz#8a5b8391f8cc7013da703411ce5b585706300d7f" + integrity sha512-I39t74+4t+zau64EN1fE5v2W31Adtc/REhzWN+gWRRXg6WH5qAsZm62DHpQ1+Yhe4047T55jvzz7MUqF/dBBlA== + +core-util-is@1.0.2, core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= + +cross-spawn@^6.0.0: + version "6.0.5" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" + integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== + dependencies: + nice-try "^1.0.4" + path-key "^2.0.1" + semver "^5.5.0" + shebang-command "^1.2.0" + which "^1.2.9" + +cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": + version "0.3.8" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" + integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== + +cssstyle@^1.0.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-1.4.0.tgz#9d31328229d3c565c61e586b02041a28fccdccf1" + integrity sha512-GBrLZYZ4X4x6/QEoBnIrqb8B/f5l4+8me2dkom/j1Gtbxy0kBv6OGzKuAsGM75bkGwGAFkt56Iwg28S3XTZgSA== + dependencies: + cssom "0.3.x" + +dashdash@^1.12.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= + dependencies: + assert-plus "^1.0.0" + +data-urls@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-1.1.0.tgz#15ee0582baa5e22bb59c77140da8f9c76963bbfe" + integrity sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ== + dependencies: + abab "^2.0.0" + whatwg-mimetype "^2.2.0" + whatwg-url "^7.0.0" + +debug@^2.2.0, debug@^2.3.3: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + +debug@^3.2.6: + version "3.2.6" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" + integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== + dependencies: + ms "^2.1.1" + +debug@^4.1.0, debug@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" + integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== + dependencies: + ms "^2.1.1" + +decamelize@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= + +decode-uri-component@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" + integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= + +deep-extend@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" + integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== + +deep-is@~0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= + +define-properties@^1.1.2, define-properties@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" + integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== + dependencies: + object-keys "^1.0.12" + +define-property@^0.2.5: + version "0.2.5" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= + dependencies: + is-descriptor "^0.1.0" + +define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= + dependencies: + is-descriptor "^1.0.0" + +define-property@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== + dependencies: + is-descriptor "^1.0.2" + isobject "^3.0.1" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= + +delegates@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" + integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= + +detect-libc@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" + integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= + +detect-newline@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" + integrity sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I= + +diff-sequences@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.9.0.tgz#5715d6244e2aa65f48bba0bc972db0b0b11e95b5" + integrity sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew== + +domexception@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/domexception/-/domexception-1.0.1.tgz#937442644ca6a31261ef36e3ec677fe805582c90" + integrity sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug== + dependencies: + webidl-conversions "^4.0.2" + +ecc-jsbn@~0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" + integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= + dependencies: + jsbn "~0.1.0" + safer-buffer "^2.1.0" + +electron-to-chromium@^1.3.247: + version "1.3.282" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.282.tgz#16118ae9c79a32ea93a17591d5b16e28d10fc08d" + integrity sha512-irSaDeCGgfMu1OA30bhqIBr+dx+pDJjRbwCpob7YWqVZbzXblybNzPGklVnWqv4EXxbkEAzQYqiNCqNTgu00lQ== + +emoji-regex@^7.0.1: + version "7.0.3" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" + integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== + +end-of-stream@^1.1.0: + version "1.4.4" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== + dependencies: + once "^1.4.0" + +error-ex@^1.3.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== + dependencies: + is-arrayish "^0.2.1" + +es-abstract@^1.5.1: + version "1.15.0" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.15.0.tgz#8884928ec7e40a79e3c9bc812d37d10c8b24cc57" + integrity sha512-bhkEqWJ2t2lMeaJDuk7okMkJWI/yqgH/EoGwpcvv0XW9RWQsRspI4wt6xuyuvMvvQE3gg/D9HXppgk21w78GyQ== + dependencies: + es-to-primitive "^1.2.0" + function-bind "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.0" + is-callable "^1.1.4" + is-regex "^1.0.4" + object-inspect "^1.6.0" + object-keys "^1.1.1" + string.prototype.trimleft "^2.1.0" + string.prototype.trimright "^2.1.0" + +es-to-primitive@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.0.tgz#edf72478033456e8dda8ef09e00ad9650707f377" + integrity sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg== + dependencies: + is-callable "^1.1.4" + is-date-object "^1.0.1" + is-symbol "^1.0.2" + +escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= + +escodegen@^1.9.1: + version "1.12.0" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.12.0.tgz#f763daf840af172bb3a2b6dd7219c0e17f7ff541" + integrity sha512-TuA+EhsanGcme5T3R0L80u4t8CpbXQjegRmf7+FPTJrtCTErXFeelblRgHQa1FofEzqYYJmJ/OqjTwREp9qgmg== + dependencies: + esprima "^3.1.3" + estraverse "^4.2.0" + esutils "^2.0.2" + optionator "^0.8.1" + optionalDependencies: + source-map "~0.6.1" + +esprima@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" + integrity sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM= + +estraverse@^4.2.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== + +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + +exec-sh@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.2.tgz#6738de2eb7c8e671d0366aea0b0db8c6f7d7391b" + integrity sha512-9sLAvzhI5nc8TpuQUh4ahMdCrWT00wPWz7j47/emR5+2qEfoZP5zzUXvx+vdx+H6ohhnsYC31iX04QLYJK8zTg== + +execa@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" + integrity sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA== + dependencies: + cross-spawn "^6.0.0" + get-stream "^4.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + +exit@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" + integrity sha1-BjJjj42HfMghB9MKD/8aF8uhzQw= + +expand-brackets@^2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" + integrity sha1-t3c14xXOMPa27/D4OwQVGiJEliI= + dependencies: + debug "^2.3.3" + define-property "^0.2.5" + extend-shallow "^2.0.1" + posix-character-classes "^0.1.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +expect@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-24.9.0.tgz#b75165b4817074fa4a157794f46fe9f1ba15b6ca" + integrity sha512-wvVAx8XIol3Z5m9zvZXiyZOQ+sRJqNTIm6sGjdWlaZIeupQGO3WbYI+15D/AmEwZywL6wtJkbAbJtzkOfBuR0Q== + dependencies: + "@jest/types" "^24.9.0" + ansi-styles "^3.2.0" + jest-get-type "^24.9.0" + jest-matcher-utils "^24.9.0" + jest-message-util "^24.9.0" + jest-regex-util "^24.9.0" + +extend-shallow@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= + dependencies: + is-extendable "^0.1.0" + +extend-shallow@^3.0.0, extend-shallow@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + integrity sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg= + dependencies: + assign-symbols "^1.0.0" + is-extendable "^1.0.1" + +extend@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" + integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== + +extglob@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" + integrity sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw== + dependencies: + array-unique "^0.3.2" + define-property "^1.0.0" + expand-brackets "^2.1.4" + extend-shallow "^2.0.1" + fragment-cache "^0.2.1" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +extsprintf@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" + integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= + +extsprintf@^1.2.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" + integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= + +fast-deep-equal@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" + integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= + +fast-json-stable-stringify@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= + +fast-levenshtein@~2.0.4: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= + +fb-watchman@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.0.tgz#54e9abf7dfa2f26cd9b1636c588c1afc05de5d58" + integrity sha1-VOmr99+i8mzZsWNsWIwa/AXeXVg= + dependencies: + bser "^2.0.0" + +fill-range@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" + integrity sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc= + dependencies: + extend-shallow "^2.0.1" + is-number "^3.0.0" + repeat-string "^1.6.1" + to-regex-range "^2.1.0" + +find-up@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== + dependencies: + locate-path "^3.0.0" + +for-in@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= + +forever-agent@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= + +form-data@~2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" + integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.6" + mime-types "^2.1.12" + +fragment-cache@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" + integrity sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk= + dependencies: + map-cache "^0.2.2" + +fs-minipass@^1.2.5: + version "1.2.7" + resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" + integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== + dependencies: + minipass "^2.6.0" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= + +fsevents@^1.2.7: + version "1.2.9" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.9.tgz#3f5ed66583ccd6f400b5a00db6f7e861363e388f" + integrity sha512-oeyj2H3EjjonWcFjD5NvZNE9Rqe4UW+nQBU2HNeKw0koVLEFIhtyETyAakeAM3de7Z/SW5kcA+fZUait9EApnw== + dependencies: + nan "^2.12.1" + node-pre-gyp "^0.12.0" + +function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== + +gauge@~2.7.3: + version "2.7.4" + resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" + integrity sha1-LANAXHU4w51+s3sxcCLjJfsBi/c= + dependencies: + aproba "^1.0.3" + console-control-strings "^1.0.0" + has-unicode "^2.0.0" + object-assign "^4.1.0" + signal-exit "^3.0.0" + string-width "^1.0.1" + strip-ansi "^3.0.1" + wide-align "^1.1.0" + +get-caller-file@^2.0.1: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + +get-stream@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" + integrity sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w== + dependencies: + pump "^3.0.0" + +get-value@^2.0.3, get-value@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" + integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= + +getpass@^0.1.1: + version "0.1.7" + resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= + dependencies: + assert-plus "^1.0.0" + +glob@^7.1.1, glob@^7.1.2, glob@^7.1.3: + version "7.1.4" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" + integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^11.1.0: + version "11.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== + +graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.2.tgz#6f0952605d0140c1cfdb138ed005775b92d67b02" + integrity sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q== + +growly@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" + integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= + +handlebars@^4.1.2: + version "4.4.3" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.4.3.tgz#180bae52c1d0e9ec0c15d7e82a4362d662762f6e" + integrity sha512-B0W4A2U1ww3q7VVthTKfh+epHx+q4mCt6iK+zEAzbMBpWQAwxCeKxEGpj/1oQTpzPXDNSOG7hmG14TsISH50yw== + dependencies: + neo-async "^2.6.0" + optimist "^0.6.1" + source-map "^0.6.1" + optionalDependencies: + uglify-js "^3.1.4" + +har-schema@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" + integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= + +har-validator@~5.1.0: + version "5.1.3" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080" + integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g== + dependencies: + ajv "^6.5.5" + har-schema "^2.0.0" + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= + +has-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" + integrity sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q= + +has-unicode@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" + integrity sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= + +has-value@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" + integrity sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8= + dependencies: + get-value "^2.0.3" + has-values "^0.1.4" + isobject "^2.0.0" + +has-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" + integrity sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc= + dependencies: + get-value "^2.0.6" + has-values "^1.0.0" + isobject "^3.0.0" + +has-values@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" + integrity sha1-bWHeldkd/Km5oCCJrThL/49it3E= + +has-values@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" + integrity sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= + dependencies: + is-number "^3.0.0" + kind-of "^4.0.0" + +has@^1.0.1, has@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" + integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== + dependencies: + function-bind "^1.1.1" + +hosted-git-info@^2.1.4: + version "2.8.5" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.5.tgz#759cfcf2c4d156ade59b0b2dfabddc42a6b9c70c" + integrity sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg== + +html-encoding-sniffer@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz#e70d84b94da53aa375e11fe3a351be6642ca46f8" + integrity sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw== + dependencies: + whatwg-encoding "^1.0.1" + +http-signature@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" + integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= + dependencies: + assert-plus "^1.0.0" + jsprim "^1.2.2" + sshpk "^1.7.0" + +iconv-lite@0.4.24, iconv-lite@^0.4.4: + version "0.4.24" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== + dependencies: + safer-buffer ">= 2.1.2 < 3" + +ignore-walk@^3.0.1: + version "3.0.3" + resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.3.tgz#017e2447184bfeade7c238e4aefdd1e8f95b1e37" + integrity sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw== + dependencies: + minimatch "^3.0.4" + +import-local@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/import-local/-/import-local-2.0.0.tgz#55070be38a5993cf18ef6db7e961f5bee5c5a09d" + integrity sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ== + dependencies: + pkg-dir "^3.0.0" + resolve-cwd "^2.0.0" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@~2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +ini@~1.3.0: + version "1.3.5" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" + integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== + +invariant@^2.2.2, invariant@^2.2.4: + version "2.2.4" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" + integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== + dependencies: + loose-envify "^1.0.0" + +is-accessor-descriptor@^0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= + dependencies: + kind-of "^3.0.2" + +is-accessor-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + integrity sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ== + dependencies: + kind-of "^6.0.0" + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= + +is-buffer@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== + +is-callable@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" + integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA== + +is-ci@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" + integrity sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w== + dependencies: + ci-info "^2.0.0" + +is-data-descriptor@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= + dependencies: + kind-of "^3.0.2" + +is-data-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" + integrity sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ== + dependencies: + kind-of "^6.0.0" + +is-date-object@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" + integrity sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY= + +is-descriptor@^0.1.0: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + integrity sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg== + dependencies: + is-accessor-descriptor "^0.1.6" + is-data-descriptor "^0.1.4" + kind-of "^5.0.0" + +is-descriptor@^1.0.0, is-descriptor@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + integrity sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg== + dependencies: + is-accessor-descriptor "^1.0.0" + is-data-descriptor "^1.0.0" + kind-of "^6.0.2" + +is-extendable@^0.1.0, is-extendable@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= + +is-extendable@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + integrity sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA== + dependencies: + is-plain-object "^2.0.4" + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= + +is-generator-fn@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" + integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== + +is-number@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= + dependencies: + kind-of "^3.0.2" + +is-plain-object@^2.0.3, is-plain-object@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== + dependencies: + isobject "^3.0.1" + +is-regex@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" + integrity sha1-VRdIm1RwkbCTDglWVM7SXul+lJE= + dependencies: + has "^1.0.1" + +is-stream@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= + +is-symbol@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38" + integrity sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw== + dependencies: + has-symbols "^1.0.0" + +is-typedarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= + +is-windows@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== + +is-wsl@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" + integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0= + +isarray@1.0.0, isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= + +isobject@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= + dependencies: + isarray "1.0.0" + +isobject@^3.0.0, isobject@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= + +isomorphic-ws@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz#55fd4cd6c5e6491e76dc125938dd863f5cd4f2dc" + integrity sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w== + +isstream@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= + +istanbul-lib-coverage@^2.0.2, istanbul-lib-coverage@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz#675f0ab69503fad4b1d849f736baaca803344f49" + integrity sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA== + +istanbul-lib-instrument@^3.0.1, istanbul-lib-instrument@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-3.3.0.tgz#a5f63d91f0bbc0c3e479ef4c5de027335ec6d630" + integrity sha512-5nnIN4vo5xQZHdXno/YDXJ0G+I3dAm4XgzfSVTPLQpj/zAV2dV6Juy0yaf10/zrJOJeHoN3fraFe+XRq2bFVZA== + dependencies: + "@babel/generator" "^7.4.0" + "@babel/parser" "^7.4.3" + "@babel/template" "^7.4.0" + "@babel/traverse" "^7.4.3" + "@babel/types" "^7.4.0" + istanbul-lib-coverage "^2.0.5" + semver "^6.0.0" + +istanbul-lib-report@^2.0.4: + version "2.0.8" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-2.0.8.tgz#5a8113cd746d43c4889eba36ab10e7d50c9b4f33" + integrity sha512-fHBeG573EIihhAblwgxrSenp0Dby6tJMFR/HvlerBsrCTD5bkUuoNtn3gVh29ZCS824cGGBPn7Sg7cNk+2xUsQ== + dependencies: + istanbul-lib-coverage "^2.0.5" + make-dir "^2.1.0" + supports-color "^6.1.0" + +istanbul-lib-source-maps@^3.0.1: + version "3.0.6" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.6.tgz#284997c48211752ec486253da97e3879defba8c8" + integrity sha512-R47KzMtDJH6X4/YW9XTx+jrLnZnscW4VpNN+1PViSYTejLVPWv7oov+Duf8YQSPyVRUvueQqz1TcsC6mooZTXw== + dependencies: + debug "^4.1.1" + istanbul-lib-coverage "^2.0.5" + make-dir "^2.1.0" + rimraf "^2.6.3" + source-map "^0.6.1" + +istanbul-reports@^2.2.6: + version "2.2.6" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-2.2.6.tgz#7b4f2660d82b29303a8fe6091f8ca4bf058da1af" + integrity sha512-SKi4rnMyLBKe0Jy2uUdx28h8oG7ph2PPuQPvIAh31d+Ci+lSiEu4C+h3oBPuJ9+mPKhOyW0M8gY4U5NM1WLeXA== + dependencies: + handlebars "^4.1.2" + +jest-changed-files@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.9.0.tgz#08d8c15eb79a7fa3fc98269bc14b451ee82f8039" + integrity sha512-6aTWpe2mHF0DhL28WjdkO8LyGjs3zItPET4bMSeXU6T3ub4FPMw+mcOcbdGXQOAfmLcxofD23/5Bl9Z4AkFwqg== + dependencies: + "@jest/types" "^24.9.0" + execa "^1.0.0" + throat "^4.0.0" + +jest-cli@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.9.0.tgz#ad2de62d07472d419c6abc301fc432b98b10d2af" + integrity sha512-+VLRKyitT3BWoMeSUIHRxV/2g8y9gw91Jh5z2UmXZzkZKpbC08CSehVxgHUwTpy+HwGcns/tqafQDJW7imYvGg== + dependencies: + "@jest/core" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + chalk "^2.0.1" + exit "^0.1.2" + import-local "^2.0.0" + is-ci "^2.0.0" + jest-config "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" + prompts "^2.0.1" + realpath-native "^1.1.0" + yargs "^13.3.0" + +jest-config@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.9.0.tgz#fb1bbc60c73a46af03590719efa4825e6e4dd1b5" + integrity sha512-RATtQJtVYQrp7fvWg6f5y3pEFj9I+H8sWw4aKxnDZ96mob5i5SD6ZEGWgMLXQ4LE8UurrjbdlLWdUeo+28QpfQ== + dependencies: + "@babel/core" "^7.1.0" + "@jest/test-sequencer" "^24.9.0" + "@jest/types" "^24.9.0" + babel-jest "^24.9.0" + chalk "^2.0.1" + glob "^7.1.1" + jest-environment-jsdom "^24.9.0" + jest-environment-node "^24.9.0" + jest-get-type "^24.9.0" + jest-jasmine2 "^24.9.0" + jest-regex-util "^24.3.0" + jest-resolve "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" + micromatch "^3.1.10" + pretty-format "^24.9.0" + realpath-native "^1.1.0" + +jest-diff@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.9.0.tgz#931b7d0d5778a1baf7452cb816e325e3724055da" + integrity sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ== + dependencies: + chalk "^2.0.1" + diff-sequences "^24.9.0" + jest-get-type "^24.9.0" + pretty-format "^24.9.0" + +jest-docblock@^24.3.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-24.9.0.tgz#7970201802ba560e1c4092cc25cbedf5af5a8ce2" + integrity sha512-F1DjdpDMJMA1cN6He0FNYNZlo3yYmOtRUnktrT9Q37njYzC5WEaDdmbynIgy0L/IvXvvgsG8OsqhLPXTpfmZAA== + dependencies: + detect-newline "^2.1.0" + +jest-each@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.9.0.tgz#eb2da602e2a610898dbc5f1f6df3ba86b55f8b05" + integrity sha512-ONi0R4BvW45cw8s2Lrx8YgbeXL1oCQ/wIDwmsM3CqM/nlblNCPmnC3IPQlMbRFZu3wKdQ2U8BqM6lh3LJ5Bsog== + dependencies: + "@jest/types" "^24.9.0" + chalk "^2.0.1" + jest-get-type "^24.9.0" + jest-util "^24.9.0" + pretty-format "^24.9.0" + +jest-environment-jsdom@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.9.0.tgz#4b0806c7fc94f95edb369a69cc2778eec2b7375b" + integrity sha512-Zv9FV9NBRzLuALXjvRijO2351DRQeLYXtpD4xNvfoVFw21IOKNhZAEUKcbiEtjTkm2GsJ3boMVgkaR7rN8qetA== + dependencies: + "@jest/environment" "^24.9.0" + "@jest/fake-timers" "^24.9.0" + "@jest/types" "^24.9.0" + jest-mock "^24.9.0" + jest-util "^24.9.0" + jsdom "^11.5.1" + +jest-environment-node@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.9.0.tgz#333d2d2796f9687f2aeebf0742b519f33c1cbfd3" + integrity sha512-6d4V2f4nxzIzwendo27Tr0aFm+IXWa0XEUnaH6nU0FMaozxovt+sfRvh4J47wL1OvF83I3SSTu0XK+i4Bqe7uA== + dependencies: + "@jest/environment" "^24.9.0" + "@jest/fake-timers" "^24.9.0" + "@jest/types" "^24.9.0" + jest-mock "^24.9.0" + jest-util "^24.9.0" + +jest-get-type@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.9.0.tgz#1684a0c8a50f2e4901b6644ae861f579eed2ef0e" + integrity sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q== + +jest-haste-map@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.9.0.tgz#b38a5d64274934e21fa417ae9a9fbeb77ceaac7d" + integrity sha512-kfVFmsuWui2Sj1Rp1AJ4D9HqJwE4uwTlS/vO+eRUaMmd54BFpli2XhMQnPC2k4cHFVbB2Q2C+jtI1AGLgEnCjQ== + dependencies: + "@jest/types" "^24.9.0" + anymatch "^2.0.0" + fb-watchman "^2.0.0" + graceful-fs "^4.1.15" + invariant "^2.2.4" + jest-serializer "^24.9.0" + jest-util "^24.9.0" + jest-worker "^24.9.0" + micromatch "^3.1.10" + sane "^4.0.3" + walker "^1.0.7" + optionalDependencies: + fsevents "^1.2.7" + +jest-jasmine2@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.9.0.tgz#1f7b1bd3242c1774e62acabb3646d96afc3be6a0" + integrity sha512-Cq7vkAgaYKp+PsX+2/JbTarrk0DmNhsEtqBXNwUHkdlbrTBLtMJINADf2mf5FkowNsq8evbPc07/qFO0AdKTzw== + dependencies: + "@babel/traverse" "^7.1.0" + "@jest/environment" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + chalk "^2.0.1" + co "^4.6.0" + expect "^24.9.0" + is-generator-fn "^2.0.0" + jest-each "^24.9.0" + jest-matcher-utils "^24.9.0" + jest-message-util "^24.9.0" + jest-runtime "^24.9.0" + jest-snapshot "^24.9.0" + jest-util "^24.9.0" + pretty-format "^24.9.0" + throat "^4.0.0" + +jest-leak-detector@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.9.0.tgz#b665dea7c77100c5c4f7dfcb153b65cf07dcf96a" + integrity sha512-tYkFIDsiKTGwb2FG1w8hX9V0aUb2ot8zY/2nFg087dUageonw1zrLMP4W6zsRO59dPkTSKie+D4rhMuP9nRmrA== + dependencies: + jest-get-type "^24.9.0" + pretty-format "^24.9.0" + +jest-matcher-utils@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.9.0.tgz#f5b3661d5e628dffe6dd65251dfdae0e87c3a073" + integrity sha512-OZz2IXsu6eaiMAwe67c1T+5tUAtQyQx27/EMEkbFAGiw52tB9em+uGbzpcgYVpA8wl0hlxKPZxrly4CXU/GjHA== + dependencies: + chalk "^2.0.1" + jest-diff "^24.9.0" + jest-get-type "^24.9.0" + pretty-format "^24.9.0" + +jest-message-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.9.0.tgz#527f54a1e380f5e202a8d1149b0ec872f43119e3" + integrity sha512-oCj8FiZ3U0hTP4aSui87P4L4jC37BtQwUMqk+zk/b11FR19BJDeZsZAvIHutWnmtw7r85UmR3CEWZ0HWU2mAlw== + dependencies: + "@babel/code-frame" "^7.0.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/stack-utils" "^1.0.1" + chalk "^2.0.1" + micromatch "^3.1.10" + slash "^2.0.0" + stack-utils "^1.0.1" + +jest-mock@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.9.0.tgz#c22835541ee379b908673ad51087a2185c13f1c6" + integrity sha512-3BEYN5WbSq9wd+SyLDES7AHnjH9A/ROBwmz7l2y+ol+NtSFO8DYiEBzoO1CeFc9a8DYy10EO4dDFVv/wN3zl1w== + dependencies: + "@jest/types" "^24.9.0" + +jest-pnp-resolver@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz#ecdae604c077a7fbc70defb6d517c3c1c898923a" + integrity sha512-pgFw2tm54fzgYvc/OHrnysABEObZCUNFnhjoRjaVOCN8NYc032/gVjPaHD4Aq6ApkSieWtfKAFQtmDKAmhupnQ== + +jest-regex-util@^24.3.0, jest-regex-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.9.0.tgz#c13fb3380bde22bf6575432c493ea8fe37965636" + integrity sha512-05Cmb6CuxaA+Ys6fjr3PhvV3bGQmO+2p2La4hFbU+W5uOc479f7FdLXUWXw4pYMAhhSZIuKHwSXSu6CsSBAXQA== + +jest-resolve-dependencies@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.9.0.tgz#ad055198959c4cfba8a4f066c673a3f0786507ab" + integrity sha512-Fm7b6AlWnYhT0BXy4hXpactHIqER7erNgIsIozDXWl5dVm+k8XdGVe1oTg1JyaFnOxarMEbax3wyRJqGP2Pq+g== + dependencies: + "@jest/types" "^24.9.0" + jest-regex-util "^24.3.0" + jest-snapshot "^24.9.0" + +jest-resolve@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.9.0.tgz#dff04c7687af34c4dd7e524892d9cf77e5d17321" + integrity sha512-TaLeLVL1l08YFZAt3zaPtjiVvyy4oSA6CRe+0AFPPVX3Q/VI0giIWWoAvoS5L96vj9Dqxj4fB5p2qrHCmTU/MQ== + dependencies: + "@jest/types" "^24.9.0" + browser-resolve "^1.11.3" + chalk "^2.0.1" + jest-pnp-resolver "^1.2.1" + realpath-native "^1.1.0" + +jest-runner@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.9.0.tgz#574fafdbd54455c2b34b4bdf4365a23857fcdf42" + integrity sha512-KksJQyI3/0mhcfspnxxEOBueGrd5E4vV7ADQLT9ESaCzz02WnbdbKWIf5Mkaucoaj7obQckYPVX6JJhgUcoWWg== + dependencies: + "@jest/console" "^24.7.1" + "@jest/environment" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + chalk "^2.4.2" + exit "^0.1.2" + graceful-fs "^4.1.15" + jest-config "^24.9.0" + jest-docblock "^24.3.0" + jest-haste-map "^24.9.0" + jest-jasmine2 "^24.9.0" + jest-leak-detector "^24.9.0" + jest-message-util "^24.9.0" + jest-resolve "^24.9.0" + jest-runtime "^24.9.0" + jest-util "^24.9.0" + jest-worker "^24.6.0" + source-map-support "^0.5.6" + throat "^4.0.0" + +jest-runtime@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.9.0.tgz#9f14583af6a4f7314a6a9d9f0226e1a781c8e4ac" + integrity sha512-8oNqgnmF3v2J6PVRM2Jfuj8oX3syKmaynlDMMKQ4iyzbQzIG6th5ub/lM2bCMTmoTKM3ykcUYI2Pw9xwNtjMnw== + dependencies: + "@jest/console" "^24.7.1" + "@jest/environment" "^24.9.0" + "@jest/source-map" "^24.3.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/yargs" "^13.0.0" + chalk "^2.0.1" + exit "^0.1.2" + glob "^7.1.3" + graceful-fs "^4.1.15" + jest-config "^24.9.0" + jest-haste-map "^24.9.0" + jest-message-util "^24.9.0" + jest-mock "^24.9.0" + jest-regex-util "^24.3.0" + jest-resolve "^24.9.0" + jest-snapshot "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" + realpath-native "^1.1.0" + slash "^2.0.0" + strip-bom "^3.0.0" + yargs "^13.3.0" + +jest-serializer@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.9.0.tgz#e6d7d7ef96d31e8b9079a714754c5d5c58288e73" + integrity sha512-DxYipDr8OvfrKH3Kel6NdED3OXxjvxXZ1uIY2I9OFbGg+vUkkg7AGvi65qbhbWNPvDckXmzMPbK3u3HaDO49bQ== + +jest-snapshot@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.9.0.tgz#ec8e9ca4f2ec0c5c87ae8f925cf97497b0e951ba" + integrity sha512-uI/rszGSs73xCM0l+up7O7a40o90cnrk429LOiK3aeTvfC0HHmldbd81/B7Ix81KSFe1lwkbl7GnBGG4UfuDew== + dependencies: + "@babel/types" "^7.0.0" + "@jest/types" "^24.9.0" + chalk "^2.0.1" + expect "^24.9.0" + jest-diff "^24.9.0" + jest-get-type "^24.9.0" + jest-matcher-utils "^24.9.0" + jest-message-util "^24.9.0" + jest-resolve "^24.9.0" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + pretty-format "^24.9.0" + semver "^6.2.0" + +jest-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.9.0.tgz#7396814e48536d2e85a37de3e4c431d7cb140162" + integrity sha512-x+cZU8VRmOJxbA1K5oDBdxQmdq0OIdADarLxk0Mq+3XS4jgvhG/oKGWcIDCtPG0HgjxOYvF+ilPJQsAyXfbNOg== + dependencies: + "@jest/console" "^24.9.0" + "@jest/fake-timers" "^24.9.0" + "@jest/source-map" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + callsites "^3.0.0" + chalk "^2.0.1" + graceful-fs "^4.1.15" + is-ci "^2.0.0" + mkdirp "^0.5.1" + slash "^2.0.0" + source-map "^0.6.0" + +jest-validate@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.9.0.tgz#0775c55360d173cd854e40180756d4ff52def8ab" + integrity sha512-HPIt6C5ACwiqSiwi+OfSSHbK8sG7akG8eATl+IPKaeIjtPOeBUd/g3J7DghugzxrGjI93qS/+RPKe1H6PqvhRQ== + dependencies: + "@jest/types" "^24.9.0" + camelcase "^5.3.1" + chalk "^2.0.1" + jest-get-type "^24.9.0" + leven "^3.1.0" + pretty-format "^24.9.0" + +jest-watcher@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.9.0.tgz#4b56e5d1ceff005f5b88e528dc9afc8dd4ed2b3b" + integrity sha512-+/fLOfKPXXYJDYlks62/4R4GoT+GU1tYZed99JSCOsmzkkF7727RqKrjNAxtfO4YpGv11wybgRvCjR73lK2GZw== + dependencies: + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/yargs" "^13.0.0" + ansi-escapes "^3.0.0" + chalk "^2.0.1" + jest-util "^24.9.0" + string-length "^2.0.0" + +jest-worker@^24.6.0, jest-worker@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.9.0.tgz#5dbfdb5b2d322e98567898238a9697bcce67b3e5" + integrity sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw== + dependencies: + merge-stream "^2.0.0" + supports-color "^6.1.0" + +jest@^24.1.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-24.9.0.tgz#987d290c05a08b52c56188c1002e368edb007171" + integrity sha512-YvkBL1Zm7d2B1+h5fHEOdyjCG+sGMz4f8D86/0HiqJ6MB4MnDc8FgP5vdWsGnemOQro7lnYo8UakZ3+5A0jxGw== + dependencies: + import-local "^2.0.0" + jest-cli "^24.9.0" + +js-levenshtein@^1.1.3: + version "1.1.6" + resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d" + integrity sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g== + +"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +jsbn@~0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= + +jsdom@^11.5.1: + version "11.12.0" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.12.0.tgz#1a80d40ddd378a1de59656e9e6dc5a3ba8657bc8" + integrity sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw== + dependencies: + abab "^2.0.0" + acorn "^5.5.3" + acorn-globals "^4.1.0" + array-equal "^1.0.0" + cssom ">= 0.3.2 < 0.4.0" + cssstyle "^1.0.0" + data-urls "^1.0.0" + domexception "^1.0.1" + escodegen "^1.9.1" + html-encoding-sniffer "^1.0.2" + left-pad "^1.3.0" + nwsapi "^2.0.7" + parse5 "4.0.0" + pn "^1.1.0" + request "^2.87.0" + request-promise-native "^1.0.5" + sax "^1.2.4" + symbol-tree "^3.2.2" + tough-cookie "^2.3.4" + w3c-hr-time "^1.0.1" + webidl-conversions "^4.0.2" + whatwg-encoding "^1.0.3" + whatwg-mimetype "^2.1.0" + whatwg-url "^6.4.1" + ws "^5.2.0" + xml-name-validator "^3.0.0" + +jsesc@^2.5.1: + version "2.5.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" + integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== + +jsesc@~0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" + integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0= + +json-parse-better-errors@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" + integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-schema@0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= + +json-stringify-safe@~5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= + +json5@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.1.tgz#81b6cb04e9ba496f1c7005d07b4368a2638f90b6" + integrity sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ== + dependencies: + minimist "^1.2.0" + +jsprim@^1.2.2: + version "1.4.1" + resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" + integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= + dependencies: + assert-plus "1.0.0" + extsprintf "1.3.0" + json-schema "0.2.3" + verror "1.10.0" + +kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= + dependencies: + is-buffer "^1.1.5" + +kind-of@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= + dependencies: + is-buffer "^1.1.5" + +kind-of@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" + integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== + +kind-of@^6.0.0, kind-of@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" + integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA== + +kleur@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" + integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== + +left-pad@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.3.0.tgz#5b8a3a7765dfe001261dde915589e782f8c94d1e" + integrity sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA== + +leven@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" + integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== + +levn@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= + dependencies: + prelude-ls "~1.1.2" + type-check "~0.3.2" + +load-json-file@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" + integrity sha1-L19Fq5HjMhYjT9U62rZo607AmTs= + dependencies: + graceful-fs "^4.1.2" + parse-json "^4.0.0" + pify "^3.0.0" + strip-bom "^3.0.0" + +locate-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" + integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== + dependencies: + p-locate "^3.0.0" + path-exists "^3.0.0" + +lodash.sortby@^4.7.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" + integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= + +lodash@^4.17.11, lodash@^4.17.13: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + +loose-envify@^1.0.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" + integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== + dependencies: + js-tokens "^3.0.0 || ^4.0.0" + +make-dir@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" + integrity sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA== + dependencies: + pify "^4.0.1" + semver "^5.6.0" + +makeerror@1.0.x: + version "1.0.11" + resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" + integrity sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw= + dependencies: + tmpl "1.0.x" + +map-cache@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= + +map-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= + dependencies: + object-visit "^1.0.0" + +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + +micromatch@^3.1.10, micromatch@^3.1.4: + version "3.1.10" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" + integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + braces "^2.3.1" + define-property "^2.0.2" + extend-shallow "^3.0.2" + extglob "^2.0.4" + fragment-cache "^0.2.1" + kind-of "^6.0.2" + nanomatch "^1.2.9" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.2" + +mime-db@1.40.0: + version "1.40.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.40.0.tgz#a65057e998db090f732a68f6c276d387d4126c32" + integrity sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA== + +mime-types@^2.1.12, mime-types@~2.1.19: + version "2.1.24" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.24.tgz#b6f8d0b3e951efb77dedeca194cff6d16f676f81" + integrity sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ== + dependencies: + mime-db "1.40.0" + +minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== + dependencies: + brace-expansion "^1.1.7" + +minimist@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= + +minimist@^1.1.1, minimist@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= + +minimist@~0.0.1: + version "0.0.10" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" + integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8= + +minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" + integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== + dependencies: + safe-buffer "^5.1.2" + yallist "^3.0.0" + +minizlib@^1.2.1: + version "1.3.3" + resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" + integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== + dependencies: + minipass "^2.9.0" + +mixin-deep@^1.2.0: + version "1.3.2" + resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" + integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA== + dependencies: + for-in "^1.0.2" + is-extendable "^1.0.1" + +mkdirp@^0.5.0, mkdirp@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= + dependencies: + minimist "0.0.8" + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= + +ms@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +nan@^2.12.1: + version "2.14.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" + integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== + +nanomatch@^1.2.9: + version "1.2.13" + resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" + integrity sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA== + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + define-property "^2.0.2" + extend-shallow "^3.0.2" + fragment-cache "^0.2.1" + is-windows "^1.0.2" + kind-of "^6.0.2" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= + +needle@^2.2.1: + version "2.4.0" + resolved "https://registry.yarnpkg.com/needle/-/needle-2.4.0.tgz#6833e74975c444642590e15a750288c5f939b57c" + integrity sha512-4Hnwzr3mi5L97hMYeNl8wRW/Onhy4nUKR/lVemJ8gJedxxUyBLm9kkrDColJvoSfwi0jCNhD+xCdOtiGDQiRZg== + dependencies: + debug "^3.2.6" + iconv-lite "^0.4.4" + sax "^1.2.4" + +neo-async@^2.6.0: + version "2.6.1" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c" + integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw== + +nice-try@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" + integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== + +node-int64@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= + +node-modules-regexp@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" + integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= + +node-notifier@^5.4.2: + version "5.4.3" + resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.4.3.tgz#cb72daf94c93904098e28b9c590fd866e464bd50" + integrity sha512-M4UBGcs4jeOK9CjTsYwkvH6/MzuUmGCyTW+kCY7uO+1ZVr0+FHGdPdIf5CCLqAaxnRrWidyoQlNkMIIVwbKB8Q== + dependencies: + growly "^1.3.0" + is-wsl "^1.1.0" + semver "^5.5.0" + shellwords "^0.1.1" + which "^1.3.0" + +node-pre-gyp@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.12.0.tgz#39ba4bb1439da030295f899e3b520b7785766149" + integrity sha512-4KghwV8vH5k+g2ylT+sLTjy5wmUOb9vPhnM8NHvRf9dHmnW/CndrFXy2aRPaPST6dugXSdHXfeaHQm77PIz/1A== + dependencies: + detect-libc "^1.0.2" + mkdirp "^0.5.1" + needle "^2.2.1" + nopt "^4.0.1" + npm-packlist "^1.1.6" + npmlog "^4.0.2" + rc "^1.2.7" + rimraf "^2.6.1" + semver "^5.3.0" + tar "^4" + +node-releases@^1.1.29: + version "1.1.35" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.35.tgz#32a74a3cd497aa77f23d509f483475fd160e4c48" + integrity sha512-JGcM/wndCN/2elJlU0IGdVEJQQnJwsLbgPCFd2pY7V0mxf17bZ0Gb/lgOtL29ZQhvEX5shnVhxQyZz3ex94N8w== + dependencies: + semver "^6.3.0" + +nopt@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" + integrity sha1-0NRoWv1UFRk8jHUFYC0NF81kR00= + dependencies: + abbrev "1" + osenv "^0.1.4" + +normalize-package-data@^2.3.2: + version "2.5.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" + integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== + dependencies: + hosted-git-info "^2.1.4" + resolve "^1.10.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + +normalize-path@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" + integrity sha1-GrKLVW4Zg2Oowab35vogE3/mrtk= + dependencies: + remove-trailing-separator "^1.0.1" + +npm-bundled@^1.0.1: + version "1.0.6" + resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.0.6.tgz#e7ba9aadcef962bb61248f91721cd932b3fe6bdd" + integrity sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g== + +npm-packlist@^1.1.6: + version "1.4.6" + resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.6.tgz#53ba3ed11f8523079f1457376dd379ee4ea42ff4" + integrity sha512-u65uQdb+qwtGvEJh/DgQgW1Xg7sqeNbmxYyrvlNznaVTjV3E5P6F/EFjM+BVHXl7JJlsdG8A64M0XI8FI/IOlg== + dependencies: + ignore-walk "^3.0.1" + npm-bundled "^1.0.1" + +npm-run-path@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= + dependencies: + path-key "^2.0.0" + +npmlog@^4.0.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" + integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== + dependencies: + are-we-there-yet "~1.1.2" + console-control-strings "~1.1.0" + gauge "~2.7.3" + set-blocking "~2.0.0" + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= + +nwsapi@^2.0.7: + version "2.1.4" + resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.1.4.tgz#e006a878db23636f8e8a67d33ca0e4edf61a842f" + integrity sha512-iGfd9Y6SFdTNldEy2L0GUhcarIutFmk+MPWIn9dmj8NMIup03G08uUF2KGbbmv/Ux4RT0VZJoP/sVbWA6d/VIw== + +oauth-sign@~0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" + integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== + +object-assign@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= + +object-copy@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= + dependencies: + copy-descriptor "^0.1.0" + define-property "^0.2.5" + kind-of "^3.0.3" + +object-inspect@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.6.0.tgz#c70b6cbf72f274aab4c34c0c82f5167bf82cf15b" + integrity sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ== + +object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" + integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== + +object-visit@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= + dependencies: + isobject "^3.0.0" + +object.assign@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" + integrity sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w== + dependencies: + define-properties "^1.1.2" + function-bind "^1.1.1" + has-symbols "^1.0.0" + object-keys "^1.0.11" + +object.getownpropertydescriptors@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16" + integrity sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY= + dependencies: + define-properties "^1.1.2" + es-abstract "^1.5.1" + +object.pick@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" + integrity sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c= + dependencies: + isobject "^3.0.1" + +once@^1.3.0, once@^1.3.1, once@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +optimist@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" + integrity sha1-2j6nRob6IaGaERwybpDrFaAZZoY= + dependencies: + minimist "~0.0.1" + wordwrap "~0.0.2" + +optionator@^0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" + integrity sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q= + dependencies: + deep-is "~0.1.3" + fast-levenshtein "~2.0.4" + levn "~0.3.0" + prelude-ls "~1.1.2" + type-check "~0.3.2" + wordwrap "~1.0.0" + +os-homedir@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= + +os-tmpdir@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= + +osenv@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" + integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== + dependencies: + os-homedir "^1.0.0" + os-tmpdir "^1.0.0" + +p-each-series@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-each-series/-/p-each-series-1.0.0.tgz#930f3d12dd1f50e7434457a22cd6f04ac6ad7f71" + integrity sha1-kw89Et0fUOdDRFeiLNbwSsatf3E= + dependencies: + p-reduce "^1.0.0" + +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= + +p-limit@^2.0.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.1.tgz#aa07a788cc3151c939b5131f63570f0dd2009537" + integrity sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg== + dependencies: + p-try "^2.0.0" + +p-locate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" + integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== + dependencies: + p-limit "^2.0.0" + +p-reduce@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-reduce/-/p-reduce-1.0.0.tgz#18c2b0dd936a4690a529f8231f58a0fdb6a47dfa" + integrity sha1-GMKw3ZNqRpClKfgjH1ig/bakffo= + +p-try@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== + +parse-json@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" + integrity sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA= + dependencies: + error-ex "^1.3.1" + json-parse-better-errors "^1.0.1" + +parse5@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" + integrity sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA== + +pascalcase@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" + integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= + +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + +path-key@^2.0.0, path-key@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= + +path-parse@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" + integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== + +path-type@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" + integrity sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg== + dependencies: + pify "^3.0.0" + +performance-now@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" + integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= + +pify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY= + +pify@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" + integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== + +pirates@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" + integrity sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA== + dependencies: + node-modules-regexp "^1.0.0" + +pkg-dir@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3" + integrity sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw== + dependencies: + find-up "^3.0.0" + +pn@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb" + integrity sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA== + +posix-character-classes@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" + integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= + +prelude-ls@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= + +pretty-format@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.9.0.tgz#12fac31b37019a4eea3c11aa9a959eb7628aa7c9" + integrity sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA== + dependencies: + "@jest/types" "^24.9.0" + ansi-regex "^4.0.0" + ansi-styles "^3.2.0" + react-is "^16.8.4" + +private@^0.1.6: + version "0.1.8" + resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" + integrity sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg== + +process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== + +prompts@^2.0.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.2.1.tgz#f901dd2a2dfee080359c0e20059b24188d75ad35" + integrity sha512-VObPvJiWPhpZI6C5m60XOzTfnYg/xc/an+r9VYymj9WJW3B/DIH+REzjpAACPf8brwPeP+7vz3bIim3S+AaMjw== + dependencies: + kleur "^3.0.3" + sisteransi "^1.0.3" + +psl@^1.1.24, psl@^1.1.28: + version "1.4.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.4.0.tgz#5dd26156cdb69fa1fdb8ab1991667d3f80ced7c2" + integrity sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw== + +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + +punycode@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= + +punycode@^2.1.0, punycode@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + +qs@~6.5.2: + version "6.5.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" + integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== + +rc@^1.2.7: + version "1.2.8" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" + integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== + dependencies: + deep-extend "^0.6.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" + +react-is@^16.8.4: + version "16.10.2" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.10.2.tgz#984120fd4d16800e9a738208ab1fba422d23b5ab" + integrity sha512-INBT1QEgtcCCgvccr5/86CfD71fw9EPmDxgiJX4I2Ddr6ZsV6iFXsuby+qWJPtmNuMY0zByTsG4468P7nHuNWA== + +read-pkg-up@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-4.0.0.tgz#1b221c6088ba7799601c808f91161c66e58f8978" + integrity sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA== + dependencies: + find-up "^3.0.0" + read-pkg "^3.0.0" + +read-pkg@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389" + integrity sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k= + dependencies: + load-json-file "^4.0.0" + normalize-package-data "^2.3.2" + path-type "^3.0.0" + +readable-stream@^2.0.6: + version "2.3.6" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" + integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +realpath-native@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/realpath-native/-/realpath-native-1.1.0.tgz#2003294fea23fb0672f2476ebe22fcf498a2d65c" + integrity sha512-wlgPA6cCIIg9gKz0fgAPjnzh4yR/LnXovwuo9hvyGvx3h8nX4+/iLZplfUWasXpqD8BdnGnP5njOFjkUwPzvjA== + dependencies: + util.promisify "^1.0.0" + +regenerate-unicode-properties@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.1.0.tgz#ef51e0f0ea4ad424b77bf7cb41f3e015c70a3f0e" + integrity sha512-LGZzkgtLY79GeXLm8Dp0BVLdQlWICzBnJz/ipWUgo59qBaZ+BHtq51P2q1uVZlppMuUAT37SDk39qUbjTWB7bA== + dependencies: + regenerate "^1.4.0" + +regenerate@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11" + integrity sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg== + +regenerator-runtime@^0.13.2: + version "0.13.3" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz#7cf6a77d8f5c6f60eb73c5fc1955b2ceb01e6bf5" + integrity sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw== + +regenerator-transform@^0.14.0: + version "0.14.1" + resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.1.tgz#3b2fce4e1ab7732c08f665dfdb314749c7ddd2fb" + integrity sha512-flVuee02C3FKRISbxhXl9mGzdbWUVHubl1SMaknjxkFB1/iqpJhArQUvRxOOPEc/9tAiX0BaQ28FJH10E4isSQ== + dependencies: + private "^0.1.6" + +regex-not@^1.0.0, regex-not@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" + integrity sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A== + dependencies: + extend-shallow "^3.0.2" + safe-regex "^1.1.0" + +regexpu-core@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.6.0.tgz#2037c18b327cfce8a6fea2a4ec441f2432afb8b6" + integrity sha512-YlVaefl8P5BnFYOITTNzDvan1ulLOiXJzCNZxduTIosN17b87h3bvG9yHMoHaRuo88H4mQ06Aodj5VtYGGGiTg== + dependencies: + regenerate "^1.4.0" + regenerate-unicode-properties "^8.1.0" + regjsgen "^0.5.0" + regjsparser "^0.6.0" + unicode-match-property-ecmascript "^1.0.4" + unicode-match-property-value-ecmascript "^1.1.0" + +regjsgen@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.5.0.tgz#a7634dc08f89209c2049adda3525711fb97265dd" + integrity sha512-RnIrLhrXCX5ow/E5/Mh2O4e/oa1/jW0eaBKTSy3LaCj+M3Bqvm97GWDp2yUtzIs4LEn65zR2yiYGFqb2ApnzDA== + +regjsparser@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.6.0.tgz#f1e6ae8b7da2bae96c99399b868cd6c933a2ba9c" + integrity sha512-RQ7YyokLiQBomUJuUG8iGVvkgOLxwyZM8k6d3q5SAXpg4r5TZJZigKFvC6PpD+qQ98bCDC5YelPeA3EucDoNeQ== + dependencies: + jsesc "~0.5.0" + +remove-trailing-separator@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" + integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= + +repeat-element@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" + integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g== + +repeat-string@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= + +request-promise-core@1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.2.tgz#339f6aababcafdb31c799ff158700336301d3346" + integrity sha512-UHYyq1MO8GsefGEt7EprS8UrXsm1TxEvFUX1IMTuSLU2Rh7fTIdFtl8xD7JiEYiWU2dl+NYAjCTksTehQUxPag== + dependencies: + lodash "^4.17.11" + +request-promise-native@^1.0.5: + version "1.0.7" + resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.7.tgz#a49868a624bdea5069f1251d0a836e0d89aa2c59" + integrity sha512-rIMnbBdgNViL37nZ1b3L/VfPOpSi0TqVDQPAvO6U14lMzOLrt5nilxCQqtDKhZeDiW0/hkCXGoQjhgJd/tCh6w== + dependencies: + request-promise-core "1.1.2" + stealthy-require "^1.1.1" + tough-cookie "^2.3.3" + +request@^2.87.0: + version "2.88.0" + resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" + integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg== + dependencies: + aws-sign2 "~0.7.0" + aws4 "^1.8.0" + caseless "~0.12.0" + combined-stream "~1.0.6" + extend "~3.0.2" + forever-agent "~0.6.1" + form-data "~2.3.2" + har-validator "~5.1.0" + http-signature "~1.2.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.19" + oauth-sign "~0.9.0" + performance-now "^2.1.0" + qs "~6.5.2" + safe-buffer "^5.1.2" + tough-cookie "~2.4.3" + tunnel-agent "^0.6.0" + uuid "^3.3.2" + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= + +require-main-filename@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" + integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== + +resolve-cwd@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a" + integrity sha1-AKn3OHVW4nA46uIyyqNypqWbZlo= + dependencies: + resolve-from "^3.0.0" + +resolve-from@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" + integrity sha1-six699nWiBvItuZTM17rywoYh0g= + +resolve-url@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" + integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= + +resolve@1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" + integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= + +resolve@^1.10.0, resolve@^1.3.2: + version "1.12.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.0.tgz#3fc644a35c84a48554609ff26ec52b66fa577df6" + integrity sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w== + dependencies: + path-parse "^1.0.6" + +ret@~0.1.10: + version "0.1.15" + resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" + integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== + +rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.3: + version "2.7.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" + integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== + dependencies: + glob "^7.1.3" + +rsvp@^4.8.4: + version "4.8.5" + resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" + integrity sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA== + +safe-buffer@^5.0.1, safe-buffer@^5.1.2: + version "5.2.0" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" + integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== + +safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +safe-regex@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" + integrity sha1-QKNmnzsHfR6UPURinhV91IAjvy4= + dependencies: + ret "~0.1.10" + +"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +sane@^4.0.3: + version "4.1.0" + resolved "https://registry.yarnpkg.com/sane/-/sane-4.1.0.tgz#ed881fd922733a6c461bc189dc2b6c006f3ffded" + integrity sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA== + dependencies: + "@cnakazawa/watch" "^1.0.3" + anymatch "^2.0.0" + capture-exit "^2.0.0" + exec-sh "^0.3.2" + execa "^1.0.0" + fb-watchman "^2.0.0" + micromatch "^3.1.4" + minimist "^1.1.1" + walker "~1.0.5" + +sax@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" + integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== + +"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.6.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" + integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== + +semver@^6.0.0, semver@^6.2.0, semver@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + +set-blocking@^2.0.0, set-blocking@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= + +set-value@^2.0.0, set-value@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" + integrity sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw== + dependencies: + extend-shallow "^2.0.1" + is-extendable "^0.1.1" + is-plain-object "^2.0.3" + split-string "^3.0.1" + +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= + dependencies: + shebang-regex "^1.0.0" + +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= + +shellwords@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" + integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww== + +signal-exit@^3.0.0, signal-exit@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= + +sisteransi@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.3.tgz#98168d62b79e3a5e758e27ae63c4a053d748f4eb" + integrity sha512-SbEG75TzH8G7eVXFSN5f9EExILKfly7SUvVY5DhhYLvfhKqhDFY0OzevWa/zwak0RLRfWS5AvfMWpd9gJvr5Yg== + +slash@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" + integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== + +snapdragon-node@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" + integrity sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw== + dependencies: + define-property "^1.0.0" + isobject "^3.0.0" + snapdragon-util "^3.0.1" + +snapdragon-util@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" + integrity sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ== + dependencies: + kind-of "^3.2.0" + +snapdragon@^0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" + integrity sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg== + dependencies: + base "^0.11.1" + debug "^2.2.0" + define-property "^0.2.5" + extend-shallow "^2.0.1" + map-cache "^0.2.2" + source-map "^0.5.6" + source-map-resolve "^0.5.0" + use "^3.1.0" + +source-map-resolve@^0.5.0: + version "0.5.2" + resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" + integrity sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA== + dependencies: + atob "^2.1.1" + decode-uri-component "^0.2.0" + resolve-url "^0.2.1" + source-map-url "^0.4.0" + urix "^0.1.0" + +source-map-support@^0.5.6: + version "0.5.13" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" + integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map-url@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" + integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= + +source-map@^0.5.0, source-map@^0.5.6: + version "0.5.7" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= + +source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +spdx-correct@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4" + integrity sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q== + dependencies: + spdx-expression-parse "^3.0.0" + spdx-license-ids "^3.0.0" + +spdx-exceptions@^2.1.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz#2ea450aee74f2a89bfb94519c07fcd6f41322977" + integrity sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA== + +spdx-expression-parse@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" + integrity sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg== + dependencies: + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" + +spdx-license-ids@^3.0.0: + version "3.0.5" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz#3694b5804567a458d3c8045842a6358632f62654" + integrity sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q== + +split-string@^3.0.1, split-string@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" + integrity sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw== + dependencies: + extend-shallow "^3.0.0" + +sshpk@^1.7.0: + version "1.16.1" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" + integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== + dependencies: + asn1 "~0.2.3" + assert-plus "^1.0.0" + bcrypt-pbkdf "^1.0.0" + dashdash "^1.12.0" + ecc-jsbn "~0.1.1" + getpass "^0.1.1" + jsbn "~0.1.0" + safer-buffer "^2.0.2" + tweetnacl "~0.14.0" + +stack-utils@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-1.0.2.tgz#33eba3897788558bebfc2db059dc158ec36cebb8" + integrity sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA== + +static-extend@^0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= + dependencies: + define-property "^0.2.5" + object-copy "^0.1.0" + +stealthy-require@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" + integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks= + +string-length@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/string-length/-/string-length-2.0.0.tgz#d40dbb686a3ace960c1cffca562bf2c45f8363ed" + integrity sha1-1A27aGo6zpYMHP/KVivyxF+DY+0= + dependencies: + astral-regex "^1.0.0" + strip-ansi "^4.0.0" + +string-width@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +"string-width@^1.0.2 || 2": + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +string-width@^3.0.0, string-width@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" + integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== + dependencies: + emoji-regex "^7.0.1" + is-fullwidth-code-point "^2.0.0" + strip-ansi "^5.1.0" + +string.prototype.trimleft@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz#6cc47f0d7eb8d62b0f3701611715a3954591d634" + integrity sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw== + dependencies: + define-properties "^1.1.3" + function-bind "^1.1.1" + +string.prototype.trimright@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz#669d164be9df9b6f7559fa8e89945b168a5a6c58" + integrity sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg== + dependencies: + define-properties "^1.1.3" + function-bind "^1.1.1" + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + +strip-ansi@^3.0.0, strip-ansi@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= + dependencies: + ansi-regex "^3.0.0" + +strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== + dependencies: + ansi-regex "^4.1.0" + +strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= + +strip-eof@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= + +strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= + +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +supports-color@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-6.1.0.tgz#0764abc69c63d5ac842dd4867e8d025e880df8f3" + integrity sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ== + dependencies: + has-flag "^3.0.0" + +symbol-tree@^3.2.2: + version "3.2.4" + resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" + integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== + +tar@^4: + version "4.4.13" + resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525" + integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA== + dependencies: + chownr "^1.1.1" + fs-minipass "^1.2.5" + minipass "^2.8.6" + minizlib "^1.2.1" + mkdirp "^0.5.0" + safe-buffer "^5.1.2" + yallist "^3.0.3" + +test-exclude@^5.2.3: + version "5.2.3" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-5.2.3.tgz#c3d3e1e311eb7ee405e092dac10aefd09091eac0" + integrity sha512-M+oxtseCFO3EDtAaGH7iiej3CBkzXqFMbzqYAACdzKui4eZA+pq3tZEwChvOdNfa7xxy8BfbmgJSIr43cC/+2g== + dependencies: + glob "^7.1.3" + minimatch "^3.0.4" + read-pkg-up "^4.0.0" + require-main-filename "^2.0.0" + +throat@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" + integrity sha1-iQN8vJLFarGJJua6TLsgDhVnKmo= + +tmpl@1.0.x: + version "1.0.4" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" + integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= + +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= + +to-object-path@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= + dependencies: + kind-of "^3.0.2" + +to-regex-range@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + integrity sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg= + dependencies: + is-number "^3.0.0" + repeat-string "^1.6.1" + +to-regex@^3.0.1, to-regex@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" + integrity sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw== + dependencies: + define-property "^2.0.2" + extend-shallow "^3.0.2" + regex-not "^1.0.2" + safe-regex "^1.1.0" + +tough-cookie@^2.3.3, tough-cookie@^2.3.4: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" + integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== + dependencies: + psl "^1.1.28" + punycode "^2.1.1" + +tough-cookie@~2.4.3: + version "2.4.3" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781" + integrity sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ== + dependencies: + psl "^1.1.24" + punycode "^1.4.1" + +tr46@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-1.0.1.tgz#a8b13fd6bfd2489519674ccde55ba3693b706d09" + integrity sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk= + dependencies: + punycode "^2.1.0" + +tunnel-agent@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= + dependencies: + safe-buffer "^5.0.1" + +tweetnacl@^0.14.3, tweetnacl@~0.14.0: + version "0.14.5" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= + +type-check@~0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= + dependencies: + prelude-ls "~1.1.2" + +uglify-js@^3.1.4: + version "3.6.1" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.6.1.tgz#ae7688c50e1bdcf2f70a0e162410003cf9798311" + integrity sha512-+dSJLJpXBb6oMHP+Yvw8hUgElz4gLTh82XuX68QiJVTXaE5ibl6buzhNkQdYhBlIhozWOC9ge16wyRmjG4TwVQ== + dependencies: + commander "2.20.0" + source-map "~0.6.1" + +unicode-canonical-property-names-ecmascript@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz#2619800c4c825800efdd8343af7dd9933cbe2818" + integrity sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ== + +unicode-match-property-ecmascript@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz#8ed2a32569961bce9227d09cd3ffbb8fed5f020c" + integrity sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg== + dependencies: + unicode-canonical-property-names-ecmascript "^1.0.4" + unicode-property-aliases-ecmascript "^1.0.4" + +unicode-match-property-value-ecmascript@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.1.0.tgz#5b4b426e08d13a80365e0d657ac7a6c1ec46a277" + integrity sha512-hDTHvaBk3RmFzvSl0UVrUmC3PuW9wKVnpoUDYH0JDkSIovzw+J5viQmeYHxVSBptubnr7PbH2e0fnpDRQnQl5g== + +unicode-property-aliases-ecmascript@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.5.tgz#a9cc6cc7ce63a0a3023fc99e341b94431d405a57" + integrity sha512-L5RAqCfXqAwR3RriF8pM0lU0w4Ryf/GgzONwi6KnL1taJQa7x1TCxdJnILX59WIGOwR57IVxn7Nej0fz1Ny6fw== + +union-value@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" + integrity sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg== + dependencies: + arr-union "^3.1.0" + get-value "^2.0.6" + is-extendable "^0.1.1" + set-value "^2.0.1" + +unset-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" + integrity sha1-g3aHP30jNRef+x5vw6jtDfyKtVk= + dependencies: + has-value "^0.3.1" + isobject "^3.0.0" + +uri-js@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" + integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== + dependencies: + punycode "^2.1.0" + +urix@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= + +use@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" + integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== + +util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + +util.promisify@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030" + integrity sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA== + dependencies: + define-properties "^1.1.2" + object.getownpropertydescriptors "^2.0.3" + +uuid@^3.3.2: + version "3.3.3" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" + integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== + +validate-npm-package-license@^3.0.1: + version "3.0.4" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" + integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== + dependencies: + spdx-correct "^3.0.0" + spdx-expression-parse "^3.0.0" + +verror@1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" + integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= + dependencies: + assert-plus "^1.0.0" + core-util-is "1.0.2" + extsprintf "^1.2.0" + +w3c-hr-time@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz#82ac2bff63d950ea9e3189a58a65625fedf19045" + integrity sha1-gqwr/2PZUOqeMYmlimViX+3xkEU= + dependencies: + browser-process-hrtime "^0.1.2" + +walker@^1.0.7, walker@~1.0.5: + version "1.0.7" + resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" + integrity sha1-L3+bj9ENZ3JisYqITijRlhjgKPs= + dependencies: + makeerror "1.0.x" + +webidl-conversions@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" + integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== + +whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3: + version "1.0.5" + resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0" + integrity sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw== + dependencies: + iconv-lite "0.4.24" + +whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" + integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== + +whatwg-url@^6.4.1: + version "6.5.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.5.0.tgz#f2df02bff176fd65070df74ad5ccbb5a199965a8" + integrity sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ== + dependencies: + lodash.sortby "^4.7.0" + tr46 "^1.0.1" + webidl-conversions "^4.0.2" + +whatwg-url@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-7.0.0.tgz#fde926fa54a599f3adf82dff25a9f7be02dc6edd" + integrity sha512-37GeVSIJ3kn1JgKyjiYNmSLP1yzbpb29jdmwBSgkD9h40/hyrR/OifpVUndji3tmwGgD8qpw7iQu3RSbCrBpsQ== + dependencies: + lodash.sortby "^4.7.0" + tr46 "^1.0.1" + webidl-conversions "^4.0.2" + +which-module@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= + +which@^1.2.9, which@^1.3.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" + integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== + dependencies: + isexe "^2.0.0" + +wide-align@^1.1.0: + version "1.1.3" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" + integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== + dependencies: + string-width "^1.0.2 || 2" + +wordwrap@~0.0.2: + version "0.0.3" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" + integrity sha1-o9XabNXAvAAI03I0u68b7WMFkQc= + +wordwrap@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= + +wrap-ansi@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09" + integrity sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q== + dependencies: + ansi-styles "^3.2.0" + string-width "^3.0.0" + strip-ansi "^5.0.0" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + +write-file-atomic@2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.1.tgz#d0b05463c188ae804396fd5ab2a370062af87529" + integrity sha512-TGHFeZEZMnv+gBFRfjAcxL5bPHrsGKtnb4qsFAws7/vlh+QfwAaySIw4AXP9ZskTTh5GWu3FLuJhsWVdiJPGvg== + dependencies: + graceful-fs "^4.1.11" + imurmurhash "^0.1.4" + signal-exit "^3.0.2" + +ws@^5.2.0: + version "5.2.2" + resolved "https://registry.yarnpkg.com/ws/-/ws-5.2.2.tgz#dffef14866b8e8dc9133582514d1befaf96e980f" + integrity sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA== + dependencies: + async-limiter "~1.0.0" + +xml-name-validator@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" + integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== + +y18n@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" + integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== + +yallist@^3.0.0, yallist@^3.0.3: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" + integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== + +yargs-parser@^13.1.1: + version "13.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.1.tgz#d26058532aa06d365fe091f6a1fc06b2f7e5eca0" + integrity sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + +yargs@^13.3.0: + version "13.3.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.0.tgz#4c657a55e07e5f2cf947f8a366567c04a0dedc83" + integrity sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA== + dependencies: + cliui "^5.0.0" + find-up "^3.0.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^3.0.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^13.1.1" diff --git a/packages/cubejs-react/dist/cubejs-react.esm.js b/packages/cubejs-react/dist/cubejs-react.esm.js index d44ec078e4270..5f59a638ca402 100644 --- a/packages/cubejs-react/dist/cubejs-react.esm.js +++ b/packages/cubejs-react/dist/cubejs-react.esm.js @@ -10,7 +10,7 @@ import _getPrototypeOf from '@babel/runtime/helpers/getPrototypeOf'; import _createClass from '@babel/runtime/helpers/createClass'; import _inherits from '@babel/runtime/helpers/inherits'; import React, { createContext, useState, useContext, useEffect } from 'react'; -import { func, object, any, bool, array } from 'prop-types'; +import { func, object, any, bool } from 'prop-types'; import { equals, toPairs, fromPairs } from 'ramda'; import _extends from '@babel/runtime/helpers/extends'; import _objectSpread from '@babel/runtime/helpers/objectSpread'; @@ -734,7 +734,7 @@ var CubeProvider = function CubeProvider(_ref) { CubeProvider.propTypes = { cubejsApi: object.isRequired, - children: array.isRequired + children: any.isRequired }; var useCubeQuery = (function (query) { @@ -765,6 +765,7 @@ var useCubeQuery = (function (query) { setError = _useState10[1]; var context = useContext(CubeContext); + var subscribeRequest = null; useEffect(function () { function loadQuery() { return _loadQuery.apply(this, arguments); @@ -774,49 +775,97 @@ var useCubeQuery = (function (query) { _loadQuery = _asyncToGenerator( /*#__PURE__*/ _regeneratorRuntime.mark(function _callee() { + var cubejsApi; return _regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: - if (!(query && isQueryPresent(query) && !equals(currentQuery, query))) { - _context.next = 16; + if (!(query && isQueryPresent(query))) { + _context.next = 25; break; } - setCurrentQuery(query); + if (!equals(currentQuery, query)) { + setCurrentQuery(query); + } + setLoading(true); _context.prev = 3; - _context.t0 = setResultSet; + + if (!subscribeRequest) { + _context.next = 8; + break; + } + _context.next = 7; - return (options.cubejsApi || context && context.cubejsApi).load(query, { + return subscribeRequest.unsubscribe(); + + case 7: + subscribeRequest = null; + + case 8: + cubejsApi = options.cubejsApi || context && context.cubejsApi; + + if (!options.subscribe) { + _context.next = 13; + break; + } + + subscribeRequest = cubejsApi.subscribe(query, { mutexObj: mutexObj, mutexKey: 'query' + }, function (e, result) { + setLoading(false); + + if (e) { + setError(e); + } else { + setResultSet(result); + } }); + _context.next = 19; + break; - case 7: + case 13: + _context.t0 = setResultSet; + _context.next = 16; + return cubejsApi.load(query, { + mutexObj: mutexObj, + mutexKey: 'query' + }); + + case 16: _context.t1 = _context.sent; (0, _context.t0)(_context.t1); setLoading(false); - _context.next = 16; + + case 19: + _context.next = 25; break; - case 12: - _context.prev = 12; + case 21: + _context.prev = 21; _context.t2 = _context["catch"](3); setError(_context.t2); setLoading(false); - case 16: + case 25: case "end": return _context.stop(); } } - }, _callee, this, [[3, 12]]); + }, _callee, this, [[3, 21]]); })); return _loadQuery.apply(this, arguments); } loadQuery(); + return function () { + if (subscribeRequest) { + subscribeRequest.unsubscribe(); + subscribeRequest = null; + } + }; }, [query, options.cubejsApi, context]); return { isLoading: isLoading, diff --git a/packages/cubejs-react/dist/cubejs-react.js b/packages/cubejs-react/dist/cubejs-react.js index f937332833210..349e906d26733 100644 --- a/packages/cubejs-react/dist/cubejs-react.js +++ b/packages/cubejs-react/dist/cubejs-react.js @@ -741,7 +741,7 @@ var CubeProvider = function CubeProvider(_ref) { CubeProvider.propTypes = { cubejsApi: PropTypes.object.isRequired, - children: PropTypes.array.isRequired + children: PropTypes.any.isRequired }; var useCubeQuery = (function (query) { @@ -772,6 +772,7 @@ var useCubeQuery = (function (query) { setError = _useState10[1]; var context = React.useContext(CubeContext); + var subscribeRequest = null; React.useEffect(function () { function loadQuery() { return _loadQuery.apply(this, arguments); @@ -781,49 +782,97 @@ var useCubeQuery = (function (query) { _loadQuery = _asyncToGenerator( /*#__PURE__*/ _regeneratorRuntime.mark(function _callee() { + var cubejsApi; return _regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: - if (!(query && isQueryPresent(query) && !ramda.equals(currentQuery, query))) { - _context.next = 16; + if (!(query && isQueryPresent(query))) { + _context.next = 25; break; } - setCurrentQuery(query); + if (!ramda.equals(currentQuery, query)) { + setCurrentQuery(query); + } + setLoading(true); _context.prev = 3; - _context.t0 = setResultSet; + + if (!subscribeRequest) { + _context.next = 8; + break; + } + _context.next = 7; - return (options.cubejsApi || context && context.cubejsApi).load(query, { + return subscribeRequest.unsubscribe(); + + case 7: + subscribeRequest = null; + + case 8: + cubejsApi = options.cubejsApi || context && context.cubejsApi; + + if (!options.subscribe) { + _context.next = 13; + break; + } + + subscribeRequest = cubejsApi.subscribe(query, { mutexObj: mutexObj, mutexKey: 'query' + }, function (e, result) { + setLoading(false); + + if (e) { + setError(e); + } else { + setResultSet(result); + } }); + _context.next = 19; + break; - case 7: + case 13: + _context.t0 = setResultSet; + _context.next = 16; + return cubejsApi.load(query, { + mutexObj: mutexObj, + mutexKey: 'query' + }); + + case 16: _context.t1 = _context.sent; (0, _context.t0)(_context.t1); setLoading(false); - _context.next = 16; + + case 19: + _context.next = 25; break; - case 12: - _context.prev = 12; + case 21: + _context.prev = 21; _context.t2 = _context["catch"](3); setError(_context.t2); setLoading(false); - case 16: + case 25: case "end": return _context.stop(); } } - }, _callee, this, [[3, 12]]); + }, _callee, this, [[3, 21]]); })); return _loadQuery.apply(this, arguments); } loadQuery(); + return function () { + if (subscribeRequest) { + subscribeRequest.unsubscribe(); + subscribeRequest = null; + } + }; }, [query, options.cubejsApi, context]); return { isLoading: isLoading, diff --git a/packages/cubejs-react/dist/cubejs-react.umd.js b/packages/cubejs-react/dist/cubejs-react.umd.js index e3230222df532..48f7662ce0cc1 100644 --- a/packages/cubejs-react/dist/cubejs-react.umd.js +++ b/packages/cubejs-react/dist/cubejs-react.umd.js @@ -20,7 +20,7 @@ }); var _core = createCommonjsModule(function (module) { - var core = module.exports = { version: '2.6.5' }; + var core = module.exports = { version: '2.5.7' }; if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef }); var _core_1 = _core.version; @@ -116,31 +116,14 @@ return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); }; - var _library = false; - - var _shared = createCommonjsModule(function (module) { - var SHARED = '__core-js_shared__'; - var store = _global[SHARED] || (_global[SHARED] = {}); - - (module.exports = function (key, value) { - return store[key] || (store[key] = value !== undefined ? value : {}); - })('versions', []).push({ - version: _core.version, - mode: 'global', - copyright: '© 2019 Denis Pushkarev (zloirock.ru)' - }); - }); - - var _functionToString = _shared('native-function-to-string', Function.toString); - var _redefine = createCommonjsModule(function (module) { var SRC = _uid('src'); - var TO_STRING = 'toString'; - var TPL = ('' + _functionToString).split(TO_STRING); + var $toString = Function[TO_STRING]; + var TPL = ('' + $toString).split(TO_STRING); _core.inspectSource = function (it) { - return _functionToString.call(it); + return $toString.call(it); }; (module.exports = function (O, key, val, safe) { @@ -160,7 +143,7 @@ } // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative })(Function.prototype, TO_STRING, function toString() { - return typeof this == 'function' && this[SRC] || _functionToString.call(this); + return typeof this == 'function' && this[SRC] || $toString.call(this); }); }); @@ -274,6 +257,21 @@ return _cof(arg) == 'Array'; }; + var _library = false; + + var _shared = createCommonjsModule(function (module) { + var SHARED = '__core-js_shared__'; + var store = _global[SHARED] || (_global[SHARED] = {}); + + (module.exports = function (key, value) { + return store[key] || (store[key] = value !== undefined ? value : {}); + })('versions', []).push({ + version: _core.version, + mode: 'global', + copyright: '© 2018 Denis Pushkarev (zloirock.ru)' + }); + }); + var _wks = createCommonjsModule(function (module) { var store = _shared('wks'); @@ -371,20 +369,6 @@ } }); - function _typeof(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof = function (obj) { - return typeof obj; - }; - } else { - _typeof = function (obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; - } - - return _typeof(obj); - } - function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); @@ -1579,7 +1563,7 @@ }); function _isPlaceholder(a) { - return a != null && _typeof(a) === 'object' && a['@@functional/placeholder'] === true; + return a != null && typeof a === 'object' && a['@@functional/placeholder'] === true; } /** @@ -1590,7 +1574,6 @@ * @param {Function} fn The function to curry. * @return {Function} The curried function. */ - function _curry1(fn) { return function f1(a) { if (arguments.length === 0 || _isPlaceholder(a)) { @@ -1620,10 +1603,7 @@ * var t = R.always('Tee'); * t(); //=> 'Tee' */ - - var always = - /*#__PURE__*/ - _curry1(function always(val) { + var always = /*#__PURE__*/_curry1(function always(val) { return function () { return val; }; @@ -1644,10 +1624,7 @@ * * R.F(); //=> false */ - - var F = - /*#__PURE__*/ - always(false); + var F = /*#__PURE__*/always(false); /** * A function that always returns `true`. Any passed in parameters are ignored. @@ -1664,10 +1641,7 @@ * * R.T(); //=> true */ - - var T = - /*#__PURE__*/ - always(true); + var T = /*#__PURE__*/always(true); /** * A special placeholder value used to specify "gaps" within curried functions, @@ -1696,167 +1670,6 @@ * greet('Alice'); //=> 'Hello, Alice!' */ - var f$2 = {}.propertyIsEnumerable; - - var _objectPie = { - f: f$2 - }; - - var gOPD = Object.getOwnPropertyDescriptor; - - var f$3 = _descriptors ? gOPD : function getOwnPropertyDescriptor(O, P) { - O = _toIobject(O); - P = _toPrimitive(P, true); - if (_ie8DomDefine) try { - return gOPD(O, P); - } catch (e) { /* empty */ } - if (_has(O, P)) return _propertyDesc(!_objectPie.f.call(O, P), O[P]); - }; - - var _objectGopd = { - f: f$3 - }; - - // Works with __proto__ only. Old v8 can't work with null proto objects. - /* eslint-disable no-proto */ - - - var check = function (O, proto) { - _anObject(O); - if (!_isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!"); - }; - var _setProto = { - set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line - function (test, buggy, set) { - try { - set = _ctx(Function.call, _objectGopd.f(Object.prototype, '__proto__').set, 2); - set(test, []); - buggy = !(test instanceof Array); - } catch (e) { buggy = true; } - return function setPrototypeOf(O, proto) { - check(O, proto); - if (buggy) O.__proto__ = proto; - else set(O, proto); - return O; - }; - }({}, false) : undefined), - check: check - }; - - var setPrototypeOf = _setProto.set; - var _inheritIfRequired = function (that, target, C) { - var S = target.constructor; - var P; - if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && _isObject(P) && setPrototypeOf) { - setPrototypeOf(that, P); - } return that; - }; - - // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) - - var hiddenKeys = _enumBugKeys.concat('length', 'prototype'); - - var f$4 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { - return _objectKeysInternal(O, hiddenKeys); - }; - - var _objectGopn = { - f: f$4 - }; - - var _stringWs = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + - '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; - - var space = '[' + _stringWs + ']'; - var non = '\u200b\u0085'; - var ltrim = RegExp('^' + space + space + '*'); - var rtrim = RegExp(space + space + '*$'); - - var exporter = function (KEY, exec, ALIAS) { - var exp = {}; - var FORCE = _fails(function () { - return !!_stringWs[KEY]() || non[KEY]() != non; - }); - var fn = exp[KEY] = FORCE ? exec(trim) : _stringWs[KEY]; - if (ALIAS) exp[ALIAS] = fn; - _export(_export.P + _export.F * FORCE, 'String', exp); - }; - - // 1 -> String#trimLeft - // 2 -> String#trimRight - // 3 -> String#trim - var trim = exporter.trim = function (string, TYPE) { - string = String(_defined(string)); - if (TYPE & 1) string = string.replace(ltrim, ''); - if (TYPE & 2) string = string.replace(rtrim, ''); - return string; - }; - - var _stringTrim = exporter; - - var gOPN = _objectGopn.f; - var gOPD$1 = _objectGopd.f; - var dP$1 = _objectDp.f; - var $trim = _stringTrim.trim; - var NUMBER = 'Number'; - var $Number = _global[NUMBER]; - var Base = $Number; - var proto$1 = $Number.prototype; - // Opera ~12 has broken Object#toString - var BROKEN_COF = _cof(_objectCreate(proto$1)) == NUMBER; - var TRIM = 'trim' in String.prototype; - - // 7.1.3 ToNumber(argument) - var toNumber = function (argument) { - var it = _toPrimitive(argument, false); - if (typeof it == 'string' && it.length > 2) { - it = TRIM ? it.trim() : $trim(it, 3); - var first = it.charCodeAt(0); - var third, radix, maxCode; - if (first === 43 || first === 45) { - third = it.charCodeAt(2); - if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix - } else if (first === 48) { - switch (it.charCodeAt(1)) { - case 66: case 98: radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i - case 79: case 111: radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i - default: return +it; - } - for (var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++) { - code = digits.charCodeAt(i); - // parseInt parses a string to a first unavailable symbol - // but ToNumber should return NaN if a string contains unavailable symbols - if (code < 48 || code > maxCode) return NaN; - } return parseInt(digits, radix); - } - } return +it; - }; - - if (!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')) { - $Number = function Number(value) { - var it = arguments.length < 1 ? 0 : value; - var that = this; - return that instanceof $Number - // check on 1..constructor(foo) case - && (BROKEN_COF ? _fails(function () { proto$1.valueOf.call(that); }) : _cof(that) != NUMBER) - ? _inheritIfRequired(new Base(toNumber(it)), that, $Number) : toNumber(it); - }; - for (var keys = _descriptors ? gOPN(Base) : ( - // ES3: - 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + - // ES6 (in case, if modules with ES6 Number statics required before): - 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + - 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger' - ).split(','), j = 0, key$1; keys.length > j; j++) { - if (_has(Base, key$1 = keys[j]) && !_has($Number, key$1)) { - dP$1($Number, key$1, gOPD$1(Base, key$1)); - } - } - $Number.prototype = proto$1; - proto$1.constructor = $Number; - _redefine(_global, NUMBER, $Number); - } - /** * Optimized internal two-arity curry function. * @@ -1865,18 +1678,15 @@ * @param {Function} fn The function to curry. * @return {Function} The curried function. */ - function _curry2(fn) { return function f2(a, b) { switch (arguments.length) { case 0: return f2; - case 1: return _isPlaceholder(a) ? f2 : _curry1(function (_b) { return fn(a, _b); }); - default: return _isPlaceholder(a) && _isPlaceholder(b) ? f2 : _isPlaceholder(a) ? _curry1(function (_a) { return fn(_a, b); @@ -1904,10 +1714,7 @@ * R.add(2, 3); //=> 5 * R.add(7)(10); //=> 17 */ - - var add = - /*#__PURE__*/ - _curry2(function add(a, b) { + var add = /*#__PURE__*/_curry2(function add(a, b) { return Number(a) + Number(b); }); @@ -1929,20 +1736,17 @@ var len1 = set1.length; var len2 = set2.length; var result = []; - idx = 0; + idx = 0; while (idx < len1) { result[result.length] = set1[idx]; idx += 1; } - idx = 0; - while (idx < len2) { result[result.length] = set2[idx]; idx += 1; } - return result; } @@ -1953,57 +1757,46 @@ return function () { return fn.apply(this, arguments); }; - case 1: return function (a0) { return fn.apply(this, arguments); }; - case 2: return function (a0, a1) { return fn.apply(this, arguments); }; - case 3: return function (a0, a1, a2) { return fn.apply(this, arguments); }; - case 4: return function (a0, a1, a2, a3) { return fn.apply(this, arguments); }; - case 5: return function (a0, a1, a2, a3, a4) { return fn.apply(this, arguments); }; - case 6: return function (a0, a1, a2, a3, a4, a5) { return fn.apply(this, arguments); }; - case 7: return function (a0, a1, a2, a3, a4, a5, a6) { return fn.apply(this, arguments); }; - case 8: return function (a0, a1, a2, a3, a4, a5, a6, a7) { return fn.apply(this, arguments); }; - case 9: return function (a0, a1, a2, a3, a4, a5, a6, a7, a8) { return fn.apply(this, arguments); }; - case 10: return function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) { return fn.apply(this, arguments); }; - default: throw new Error('First argument to _arity must be a non-negative integer no greater than ten'); } @@ -2019,33 +1812,26 @@ * @param {Function} fn The function to curry. * @return {Function} The curried function. */ - function _curryN(length, received, fn) { return function () { var combined = []; var argsIdx = 0; var left = length; var combinedIdx = 0; - while (combinedIdx < received.length || argsIdx < arguments.length) { var result; - if (combinedIdx < received.length && (!_isPlaceholder(received[combinedIdx]) || argsIdx >= arguments.length)) { result = received[combinedIdx]; } else { result = arguments[argsIdx]; argsIdx += 1; } - combined[combinedIdx] = result; - if (!_isPlaceholder(result)) { left -= 1; } - combinedIdx += 1; } - return left <= 0 ? fn.apply(this, combined) : _arity(left, _curryN(length, combined, fn)); }; } @@ -2092,14 +1878,10 @@ * var g = f(3); * g(4); //=> 10 */ - - var curryN = - /*#__PURE__*/ - _curry2(function curryN(length, fn) { + var curryN = /*#__PURE__*/_curry2(function curryN(length, fn) { if (length === 1) { return _curry1(fn); } - return _arity(length, _curryN(length, [], fn)); }); @@ -2111,18 +1893,15 @@ * @param {Function} fn The function to curry. * @return {Function} The curried function. */ - function _curry3(fn) { return function f3(a, b, c) { switch (arguments.length) { case 0: return f3; - case 1: return _isPlaceholder(a) ? f3 : _curry2(function (_b, _c) { return fn(a, _b, _c); }); - case 2: return _isPlaceholder(a) && _isPlaceholder(b) ? f3 : _isPlaceholder(a) ? _curry2(function (_a, _c) { return fn(_a, b, _c); @@ -2131,7 +1910,6 @@ }) : _curry1(function (_c) { return fn(a, b, _c); }); - default: return _isPlaceholder(a) && _isPlaceholder(b) && _isPlaceholder(c) ? f3 : _isPlaceholder(a) && _isPlaceholder(b) ? _curry2(function (_a, _b) { return fn(_a, _b, c); @@ -2150,64 +1928,6 @@ }; } - // 21.2.5.3 get RegExp.prototype.flags - - var _flags = function () { - var that = _anObject(this); - var result = ''; - if (that.global) result += 'g'; - if (that.ignoreCase) result += 'i'; - if (that.multiline) result += 'm'; - if (that.unicode) result += 'u'; - if (that.sticky) result += 'y'; - return result; - }; - - // 21.2.5.3 get RegExp.prototype.flags() - if (_descriptors && /./g.flags != 'g') _objectDp.f(RegExp.prototype, 'flags', { - configurable: true, - get: _flags - }); - - var TO_STRING = 'toString'; - var $toString = /./[TO_STRING]; - - var define = function (fn) { - _redefine(RegExp.prototype, TO_STRING, fn, true); - }; - - // 21.2.5.14 RegExp.prototype.toString() - if (_fails(function () { return $toString.call({ source: 'a', flags: 'b' }) != '/a/b'; })) { - define(function toString() { - var R = _anObject(this); - return '/'.concat(R.source, '/', - 'flags' in R ? R.flags : !_descriptors && R instanceof RegExp ? _flags.call(R) : undefined); - }); - // FF44- RegExp#toString has a wrong name - } else if ($toString.name != TO_STRING) { - define(function toString() { - return $toString.call(this); - }); - } - - var DateProto = Date.prototype; - var INVALID_DATE = 'Invalid Date'; - var TO_STRING$1 = 'toString'; - var $toString$1 = DateProto[TO_STRING$1]; - var getTime = DateProto.getTime; - if (new Date(NaN) + '' != INVALID_DATE) { - _redefine(DateProto, TO_STRING$1, function toString() { - var value = getTime.call(this); - // eslint-disable-next-line no-self-compare - return value === value ? $toString$1.call(this) : INVALID_DATE; - }); - } - - // 22.1.2.2 / 15.4.3.2 Array.isArray(arg) - - - _export(_export.S, 'Array', { isArray: _isArray }); - /** * Tests whether or not an object is an array. * @@ -2242,43 +1962,36 @@ * @param {Function} fn default ramda implementation * @return {Function} A function that dispatches on object in list position */ - function _dispatchable(methodNames, xf, fn) { return function () { if (arguments.length === 0) { return fn(); } - var args = Array.prototype.slice.call(arguments, 0); var obj = args.pop(); - if (!_isArray$1(obj)) { var idx = 0; - while (idx < methodNames.length) { if (typeof obj[methodNames[idx]] === 'function') { return obj[methodNames[idx]].apply(obj, args); } - idx += 1; } - if (_isTransformer(obj)) { var transducer = xf.apply(null, args); return transducer(obj); } } - return fn.apply(this, arguments); }; } var _xfBase = { - init: function init() { + init: function () { return this.xf['@@transducer/init'](); }, - result: function result(_result) { - return this.xf['@@transducer/result'](_result); + result: function (result) { + return this.xf['@@transducer/result'](result); } }; @@ -2299,10 +2012,7 @@ * R.max(789, 123); //=> 789 * R.max('a', 'b'); //=> 'b' */ - - var max$1 = - /*#__PURE__*/ - _curry2(function max(a, b) { + var max$1 = /*#__PURE__*/_curry2(function max(a, b) { return b > a ? b : a; }); @@ -2310,546 +2020,132 @@ var idx = 0; var len = functor.length; var result = Array(len); - while (idx < len) { result[idx] = fn(functor[idx]); idx += 1; } - return result; } - var _arrayReduce = function (that, callbackfn, aLen, memo, isRight) { - _aFunction(callbackfn); - var O = _toObject(that); - var self = _iobject(O); - var length = _toLength(O.length); - var index = isRight ? length - 1 : 0; - var i = isRight ? -1 : 1; - if (aLen < 2) for (;;) { - if (index in self) { - memo = self[index]; - index += i; - break; - } - index += i; - if (isRight ? index < 0 : length <= index) { - throw TypeError('Reduce of empty array with no initial value'); - } + function _isString(x) { + return Object.prototype.toString.call(x) === '[object String]'; + } + + /** + * Tests whether or not an object is similar to an array. + * + * @private + * @category Type + * @category List + * @sig * -> Boolean + * @param {*} x The object to test. + * @return {Boolean} `true` if `x` has a numeric length property and extreme indices defined; `false` otherwise. + * @example + * + * _isArrayLike([]); //=> true + * _isArrayLike(true); //=> false + * _isArrayLike({}); //=> false + * _isArrayLike({length: 10}); //=> false + * _isArrayLike({0: 'zero', 9: 'nine', length: 10}); //=> true + */ + var _isArrayLike = /*#__PURE__*/_curry1(function isArrayLike(x) { + if (_isArray$1(x)) { + return true; } - for (;isRight ? index >= 0 : length > index; index += i) if (index in self) { - memo = callbackfn(memo, self[index], index, O); + if (!x) { + return false; } - return memo; - }; - - _export(_export.P + _export.F * !_strictMethod([].reduce, true), 'Array', { - // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue]) - reduce: function reduce(callbackfn /* , initialValue */) { - return _arrayReduce(this, callbackfn, arguments.length, arguments[1], false); + if (typeof x !== 'object') { + return false; + } + if (_isString(x)) { + return false; + } + if (x.nodeType === 1) { + return !!x.length; + } + if (x.length === 0) { + return true; + } + if (x.length > 0) { + return x.hasOwnProperty(0) && x.hasOwnProperty(x.length - 1); } + return false; }); - var f$5 = _wks; - - var _wksExt = { - f: f$5 - }; - - var defineProperty = _objectDp.f; - var _wksDefine = function (name) { - var $Symbol = _core.Symbol || (_core.Symbol = _global.Symbol || {}); - if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: _wksExt.f(name) }); - }; - - _wksDefine('asyncIterator'); + var XWrap = /*#__PURE__*/function () { + function XWrap(fn) { + this.f = fn; + } + XWrap.prototype['@@transducer/init'] = function () { + throw new Error('init not implemented on XWrap'); + }; + XWrap.prototype['@@transducer/result'] = function (acc) { + return acc; + }; + XWrap.prototype['@@transducer/step'] = function (acc, x) { + return this.f(acc, x); + }; - var _meta = createCommonjsModule(function (module) { - var META = _uid('meta'); + return XWrap; + }(); + function _xwrap(fn) { + return new XWrap(fn); + } - var setDesc = _objectDp.f; - var id = 0; - var isExtensible = Object.isExtensible || function () { - return true; - }; - var FREEZE = !_fails(function () { - return isExtensible(Object.preventExtensions({})); + /** + * Creates a function that is bound to a context. + * Note: `R.bind` does not provide the additional argument-binding capabilities of + * [Function.prototype.bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind). + * + * @func + * @memberOf R + * @since v0.6.0 + * @category Function + * @category Object + * @sig (* -> *) -> {*} -> (* -> *) + * @param {Function} fn The function to bind to context + * @param {Object} thisObj The context to bind `fn` to + * @return {Function} A function that will execute in the context of `thisObj`. + * @see R.partial + * @example + * + * var log = R.bind(console.log, console); + * R.pipe(R.assoc('a', 2), R.tap(log), R.assoc('a', 3))({a: 1}); //=> {a: 3} + * // logs {a: 2} + * @symb R.bind(f, o)(a, b) = f.call(o, a, b) + */ + var bind = /*#__PURE__*/_curry2(function bind(fn, thisObj) { + return _arity(fn.length, function () { + return fn.apply(thisObj, arguments); + }); }); - var setMeta = function (it) { - setDesc(it, META, { value: { - i: 'O' + ++id, // object ID - w: {} // weak collections IDs - } }); - }; - var fastKey = function (it, create) { - // return primitive with prefix - if (!_isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; - if (!_has(it, META)) { - // can't set metadata to uncaught frozen object - if (!isExtensible(it)) return 'F'; - // not necessary to add metadata - if (!create) return 'E'; - // add missing metadata - setMeta(it); - // return object ID - } return it[META].i; - }; - var getWeak = function (it, create) { - if (!_has(it, META)) { - // can't set metadata to uncaught frozen object - if (!isExtensible(it)) return true; - // not necessary to add metadata - if (!create) return false; - // add missing metadata - setMeta(it); - // return hash weak collections IDs - } return it[META].w; - }; - // add metadata on freeze-family methods calling - var onFreeze = function (it) { - if (FREEZE && meta.NEED && isExtensible(it) && !_has(it, META)) setMeta(it); - return it; - }; - var meta = module.exports = { - KEY: META, - NEED: false, - fastKey: fastKey, - getWeak: getWeak, - onFreeze: onFreeze - }; - }); - var _meta_1 = _meta.KEY; - var _meta_2 = _meta.NEED; - var _meta_3 = _meta.fastKey; - var _meta_4 = _meta.getWeak; - var _meta_5 = _meta.onFreeze; - - var f$6 = Object.getOwnPropertySymbols; - - var _objectGops = { - f: f$6 - }; - - // all enumerable object keys, includes symbols - - - - var _enumKeys = function (it) { - var result = _objectKeys(it); - var getSymbols = _objectGops.f; - if (getSymbols) { - var symbols = getSymbols(it); - var isEnum = _objectPie.f; - var i = 0; - var key; - while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key); - } return result; - }; - - // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window - - var gOPN$1 = _objectGopn.f; - var toString$1 = {}.toString; - - var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames - ? Object.getOwnPropertyNames(window) : []; - - var getWindowNames = function (it) { - try { - return gOPN$1(it); - } catch (e) { - return windowNames.slice(); - } - }; - - var f$7 = function getOwnPropertyNames(it) { - return windowNames && toString$1.call(it) == '[object Window]' ? getWindowNames(it) : gOPN$1(_toIobject(it)); - }; - - var _objectGopnExt = { - f: f$7 - }; - - // ECMAScript 6 symbols shim - - - - - - var META = _meta.KEY; - - - - - - - - - - - - - - - - - - - - var gOPD$2 = _objectGopd.f; - var dP$2 = _objectDp.f; - var gOPN$2 = _objectGopnExt.f; - var $Symbol = _global.Symbol; - var $JSON = _global.JSON; - var _stringify = $JSON && $JSON.stringify; - var PROTOTYPE$2 = 'prototype'; - var HIDDEN = _wks('_hidden'); - var TO_PRIMITIVE = _wks('toPrimitive'); - var isEnum = {}.propertyIsEnumerable; - var SymbolRegistry = _shared('symbol-registry'); - var AllSymbols = _shared('symbols'); - var OPSymbols = _shared('op-symbols'); - var ObjectProto$1 = Object[PROTOTYPE$2]; - var USE_NATIVE$1 = typeof $Symbol == 'function'; - var QObject = _global.QObject; - // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 - var setter = !QObject || !QObject[PROTOTYPE$2] || !QObject[PROTOTYPE$2].findChild; - - // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 - var setSymbolDesc = _descriptors && _fails(function () { - return _objectCreate(dP$2({}, 'a', { - get: function () { return dP$2(this, 'a', { value: 7 }).a; } - })).a != 7; - }) ? function (it, key, D) { - var protoDesc = gOPD$2(ObjectProto$1, key); - if (protoDesc) delete ObjectProto$1[key]; - dP$2(it, key, D); - if (protoDesc && it !== ObjectProto$1) dP$2(ObjectProto$1, key, protoDesc); - } : dP$2; - - var wrap = function (tag) { - var sym = AllSymbols[tag] = _objectCreate($Symbol[PROTOTYPE$2]); - sym._k = tag; - return sym; - }; - - var isSymbol = USE_NATIVE$1 && typeof $Symbol.iterator == 'symbol' ? function (it) { - return typeof it == 'symbol'; - } : function (it) { - return it instanceof $Symbol; - }; - - var $defineProperty = function defineProperty(it, key, D) { - if (it === ObjectProto$1) $defineProperty(OPSymbols, key, D); - _anObject(it); - key = _toPrimitive(key, true); - _anObject(D); - if (_has(AllSymbols, key)) { - if (!D.enumerable) { - if (!_has(it, HIDDEN)) dP$2(it, HIDDEN, _propertyDesc(1, {})); - it[HIDDEN][key] = true; - } else { - if (_has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false; - D = _objectCreate(D, { enumerable: _propertyDesc(0, false) }); - } return setSymbolDesc(it, key, D); - } return dP$2(it, key, D); - }; - var $defineProperties = function defineProperties(it, P) { - _anObject(it); - var keys = _enumKeys(P = _toIobject(P)); - var i = 0; - var l = keys.length; - var key; - while (l > i) $defineProperty(it, key = keys[i++], P[key]); - return it; - }; - var $create = function create(it, P) { - return P === undefined ? _objectCreate(it) : $defineProperties(_objectCreate(it), P); - }; - var $propertyIsEnumerable = function propertyIsEnumerable(key) { - var E = isEnum.call(this, key = _toPrimitive(key, true)); - if (this === ObjectProto$1 && _has(AllSymbols, key) && !_has(OPSymbols, key)) return false; - return E || !_has(this, key) || !_has(AllSymbols, key) || _has(this, HIDDEN) && this[HIDDEN][key] ? E : true; - }; - var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) { - it = _toIobject(it); - key = _toPrimitive(key, true); - if (it === ObjectProto$1 && _has(AllSymbols, key) && !_has(OPSymbols, key)) return; - var D = gOPD$2(it, key); - if (D && _has(AllSymbols, key) && !(_has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true; - return D; - }; - var $getOwnPropertyNames = function getOwnPropertyNames(it) { - var names = gOPN$2(_toIobject(it)); - var result = []; - var i = 0; - var key; - while (names.length > i) { - if (!_has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key); - } return result; - }; - var $getOwnPropertySymbols = function getOwnPropertySymbols(it) { - var IS_OP = it === ObjectProto$1; - var names = gOPN$2(IS_OP ? OPSymbols : _toIobject(it)); - var result = []; - var i = 0; - var key; - while (names.length > i) { - if (_has(AllSymbols, key = names[i++]) && (IS_OP ? _has(ObjectProto$1, key) : true)) result.push(AllSymbols[key]); - } return result; - }; - - // 19.4.1.1 Symbol([description]) - if (!USE_NATIVE$1) { - $Symbol = function Symbol() { - if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!'); - var tag = _uid(arguments.length > 0 ? arguments[0] : undefined); - var $set = function (value) { - if (this === ObjectProto$1) $set.call(OPSymbols, value); - if (_has(this, HIDDEN) && _has(this[HIDDEN], tag)) this[HIDDEN][tag] = false; - setSymbolDesc(this, tag, _propertyDesc(1, value)); - }; - if (_descriptors && setter) setSymbolDesc(ObjectProto$1, tag, { configurable: true, set: $set }); - return wrap(tag); - }; - _redefine($Symbol[PROTOTYPE$2], 'toString', function toString() { - return this._k; - }); - - _objectGopd.f = $getOwnPropertyDescriptor; - _objectDp.f = $defineProperty; - _objectGopn.f = _objectGopnExt.f = $getOwnPropertyNames; - _objectPie.f = $propertyIsEnumerable; - _objectGops.f = $getOwnPropertySymbols; - - if (_descriptors && !_library) { - _redefine(ObjectProto$1, 'propertyIsEnumerable', $propertyIsEnumerable, true); - } - - _wksExt.f = function (name) { - return wrap(_wks(name)); - }; - } - - _export(_export.G + _export.W + _export.F * !USE_NATIVE$1, { Symbol: $Symbol }); - - for (var es6Symbols = ( - // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 - 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' - ).split(','), j$1 = 0; es6Symbols.length > j$1;)_wks(es6Symbols[j$1++]); - - for (var wellKnownSymbols = _objectKeys(_wks.store), k = 0; wellKnownSymbols.length > k;) _wksDefine(wellKnownSymbols[k++]); - - _export(_export.S + _export.F * !USE_NATIVE$1, 'Symbol', { - // 19.4.2.1 Symbol.for(key) - 'for': function (key) { - return _has(SymbolRegistry, key += '') - ? SymbolRegistry[key] - : SymbolRegistry[key] = $Symbol(key); - }, - // 19.4.2.5 Symbol.keyFor(sym) - keyFor: function keyFor(sym) { - if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!'); - for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key; - }, - useSetter: function () { setter = true; }, - useSimple: function () { setter = false; } - }); - - _export(_export.S + _export.F * !USE_NATIVE$1, 'Object', { - // 19.1.2.2 Object.create(O [, Properties]) - create: $create, - // 19.1.2.4 Object.defineProperty(O, P, Attributes) - defineProperty: $defineProperty, - // 19.1.2.3 Object.defineProperties(O, Properties) - defineProperties: $defineProperties, - // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) - getOwnPropertyDescriptor: $getOwnPropertyDescriptor, - // 19.1.2.7 Object.getOwnPropertyNames(O) - getOwnPropertyNames: $getOwnPropertyNames, - // 19.1.2.8 Object.getOwnPropertySymbols(O) - getOwnPropertySymbols: $getOwnPropertySymbols - }); - - // 24.3.2 JSON.stringify(value [, replacer [, space]]) - $JSON && _export(_export.S + _export.F * (!USE_NATIVE$1 || _fails(function () { - var S = $Symbol(); - // MS Edge converts symbol values to JSON as {} - // WebKit converts symbol values to JSON as null - // V8 throws on boxed symbols - return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}'; - })), 'JSON', { - stringify: function stringify(it) { - var args = [it]; - var i = 1; - var replacer, $replacer; - while (arguments.length > i) args.push(arguments[i++]); - $replacer = replacer = args[1]; - if (!_isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined - if (!_isArray(replacer)) replacer = function (key, value) { - if (typeof $replacer == 'function') value = $replacer.call(this, key, value); - if (!isSymbol(value)) return value; - }; - args[1] = replacer; - return _stringify.apply($JSON, args); - } - }); - - // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) - $Symbol[PROTOTYPE$2][TO_PRIMITIVE] || _hide($Symbol[PROTOTYPE$2], TO_PRIMITIVE, $Symbol[PROTOTYPE$2].valueOf); - // 19.4.3.5 Symbol.prototype[@@toStringTag] - _setToStringTag($Symbol, 'Symbol'); - // 20.2.1.9 Math[@@toStringTag] - _setToStringTag(Math, 'Math', true); - // 24.3.3 JSON[@@toStringTag] - _setToStringTag(_global.JSON, 'JSON', true); - - function _isString(x) { - return Object.prototype.toString.call(x) === '[object String]'; - } - - /** - * Tests whether or not an object is similar to an array. - * - * @private - * @category Type - * @category List - * @sig * -> Boolean - * @param {*} x The object to test. - * @return {Boolean} `true` if `x` has a numeric length property and extreme indices defined; `false` otherwise. - * @example - * - * _isArrayLike([]); //=> true - * _isArrayLike(true); //=> false - * _isArrayLike({}); //=> false - * _isArrayLike({length: 10}); //=> false - * _isArrayLike({0: 'zero', 9: 'nine', length: 10}); //=> true - */ - - var _isArrayLike = - /*#__PURE__*/ - _curry1(function isArrayLike(x) { - if (_isArray$1(x)) { - return true; - } - - if (!x) { - return false; - } - - if (_typeof(x) !== 'object') { - return false; - } - - if (_isString(x)) { - return false; - } - - if (x.nodeType === 1) { - return !!x.length; - } - - if (x.length === 0) { - return true; - } - if (x.length > 0) { - return x.hasOwnProperty(0) && x.hasOwnProperty(x.length - 1); - } - - return false; - }); - - var XWrap = - /*#__PURE__*/ - function () { - function XWrap(fn) { - this.f = fn; - } - - XWrap.prototype['@@transducer/init'] = function () { - throw new Error('init not implemented on XWrap'); - }; - - XWrap.prototype['@@transducer/result'] = function (acc) { - return acc; - }; - - XWrap.prototype['@@transducer/step'] = function (acc, x) { - return this.f(acc, x); - }; - - return XWrap; - }(); - - function _xwrap(fn) { - return new XWrap(fn); - } - - /** - * Creates a function that is bound to a context. - * Note: `R.bind` does not provide the additional argument-binding capabilities of - * [Function.prototype.bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind). - * - * @func - * @memberOf R - * @since v0.6.0 - * @category Function - * @category Object - * @sig (* -> *) -> {*} -> (* -> *) - * @param {Function} fn The function to bind to context - * @param {Object} thisObj The context to bind `fn` to - * @return {Function} A function that will execute in the context of `thisObj`. - * @see R.partial - * @example - * - * var log = R.bind(console.log, console); - * R.pipe(R.assoc('a', 2), R.tap(log), R.assoc('a', 3))({a: 1}); //=> {a: 3} - * // logs {a: 2} - * @symb R.bind(f, o)(a, b) = f.call(o, a, b) - */ - - var bind = - /*#__PURE__*/ - _curry2(function bind(fn, thisObj) { - return _arity(fn.length, function () { - return fn.apply(thisObj, arguments); - }); - }); - - function _arrayReduce$1(xf, acc, list) { + function _arrayReduce(xf, acc, list) { var idx = 0; var len = list.length; - while (idx < len) { acc = xf['@@transducer/step'](acc, list[idx]); - if (acc && acc['@@transducer/reduced']) { acc = acc['@@transducer/value']; break; } - idx += 1; } - return xf['@@transducer/result'](acc); } function _iterableReduce(xf, acc, iter) { var step = iter.next(); - while (!step.done) { acc = xf['@@transducer/step'](acc, step.value); - if (acc && acc['@@transducer/reduced']) { acc = acc['@@transducer/value']; break; } - step = iter.next(); } - return xf['@@transducer/result'](acc); } @@ -2858,27 +2154,23 @@ } var symIterator = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator'; + function _reduce(fn, acc, list) { if (typeof fn === 'function') { fn = _xwrap(fn); } - if (_isArrayLike(list)) { - return _arrayReduce$1(fn, acc, list); + return _arrayReduce(fn, acc, list); } - if (typeof list['fantasy-land/reduce'] === 'function') { return _methodReduce(fn, acc, list, 'fantasy-land/reduce'); } - if (list[symIterator] != null) { return _iterableReduce(fn, acc, list[symIterator]()); } - if (typeof list.next === 'function') { return _iterableReduce(fn, acc, list); } - if (typeof list.reduce === 'function') { return _methodReduce(fn, acc, list, 'reduce'); } @@ -2886,17 +2178,13 @@ throw new TypeError('reduce: list must be array or iterable'); } - var XMap = - /*#__PURE__*/ - function () { + var XMap = /*#__PURE__*/function () { function XMap(f, xf) { this.xf = xf; this.f = f; } - XMap.prototype['@@transducer/init'] = _xfBase.init; XMap.prototype['@@transducer/result'] = _xfBase.result; - XMap.prototype['@@transducer/step'] = function (result, input) { return this.xf['@@transducer/step'](result, this.f(input)); }; @@ -2904,74 +2192,43 @@ return XMap; }(); - var _xmap = - /*#__PURE__*/ - _curry2(function _xmap(f, xf) { + var _xmap = /*#__PURE__*/_curry2(function _xmap(f, xf) { return new XMap(f, xf); }); - // most Object methods by ES6 should accept primitives - - - - var _objectSap = function (KEY, exec) { - var fn = (_core.Object || {})[KEY] || Object[KEY]; - var exp = {}; - exp[KEY] = exec(fn); - _export(_export.S + _export.F * _fails(function () { fn(1); }), 'Object', exp); - }; - - // 19.1.2.14 Object.keys(O) - - - - _objectSap('keys', function () { - return function keys(it) { - return _objectKeys(_toObject(it)); - }; - }); - function _has$1(prop, obj) { return Object.prototype.hasOwnProperty.call(obj, prop); } - var toString$2 = Object.prototype.toString; - - var _isArguments = function _isArguments() { - return toString$2.call(arguments) === '[object Arguments]' ? function _isArguments(x) { - return toString$2.call(x) === '[object Arguments]'; + var toString$1 = Object.prototype.toString; + var _isArguments = function () { + return toString$1.call(arguments) === '[object Arguments]' ? function _isArguments(x) { + return toString$1.call(x) === '[object Arguments]'; } : function _isArguments(x) { return _has$1('callee', x); }; }; - var hasEnumBug = ! - /*#__PURE__*/ - { - toString: null - }.propertyIsEnumerable('toString'); - var nonEnumerableProps = ['constructor', 'valueOf', 'isPrototypeOf', 'toString', 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; // Safari bug - - var hasArgsEnumBug = - /*#__PURE__*/ - function () { + // cover IE < 9 keys issues + var hasEnumBug = ! /*#__PURE__*/{ toString: null }.propertyIsEnumerable('toString'); + var nonEnumerableProps = ['constructor', 'valueOf', 'isPrototypeOf', 'toString', 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; + // Safari bug + var hasArgsEnumBug = /*#__PURE__*/function () { return arguments.propertyIsEnumerable('length'); }(); var contains = function contains(list, item) { var idx = 0; - while (idx < list.length) { if (list[idx] === item) { return true; } - idx += 1; } - return false; }; + /** * Returns a list containing the names of all the enumerable own properties of * the supplied object. @@ -2990,46 +2247,33 @@ * * R.keys({a: 1, b: 2, c: 3}); //=> ['a', 'b', 'c'] */ - - var _keys = typeof Object.keys === 'function' && !hasArgsEnumBug ? function keys(obj) { return Object(obj) !== obj ? [] : Object.keys(obj); } : function keys(obj) { if (Object(obj) !== obj) { return []; } - var prop, nIdx; var ks = []; - var checkArgsLength = hasArgsEnumBug && _isArguments(obj); - for (prop in obj) { if (_has$1(prop, obj) && (!checkArgsLength || prop !== 'length')) { ks[ks.length] = prop; } } - if (hasEnumBug) { nIdx = nonEnumerableProps.length - 1; - while (nIdx >= 0) { prop = nonEnumerableProps[nIdx]; - if (_has$1(prop, obj) && !contains(ks, prop)) { ks[ks.length] = prop; } - nIdx -= 1; } } - return ks; }; - - var keys$1 = - /*#__PURE__*/ - _curry1(_keys); + var keys = /*#__PURE__*/_curry1(_keys); /** * Takes a function and @@ -3066,24 +2310,17 @@ * @symb R.map(f, { x: a, y: b }) = { x: f(a), y: f(b) } * @symb R.map(f, functor_o) = functor_o.map(f) */ - - var map = - /*#__PURE__*/ - _curry2( - /*#__PURE__*/ - _dispatchable(['fantasy-land/map', 'map'], _xmap, function map(fn, functor) { + var map = /*#__PURE__*/_curry2( /*#__PURE__*/_dispatchable(['fantasy-land/map', 'map'], _xmap, function map(fn, functor) { switch (Object.prototype.toString.call(functor)) { case '[object Function]': return curryN(functor.length, function () { return fn.call(this, functor.apply(this, arguments)); }); - case '[object Object]': return _reduce(function (acc, key) { acc[key] = fn(functor[key]); return acc; - }, {}, keys$1(functor)); - + }, {}, keys(functor)); default: return _map(fn, functor); } @@ -3107,22 +2344,16 @@ * R.path(['a', 'b'], {a: {b: 2}}); //=> 2 * R.path(['a', 'b'], {c: {b: 2}}); //=> undefined */ - - var path = - /*#__PURE__*/ - _curry2(function path(paths, obj) { + var path = /*#__PURE__*/_curry2(function path(paths, obj) { var val = obj; var idx = 0; - while (idx < paths.length) { if (val == null) { return; } - val = val[paths[idx]]; idx += 1; } - return val; }); @@ -3145,9 +2376,7 @@ * R.prop('x', {}); //=> undefined */ - var prop = - /*#__PURE__*/ - _curry2(function prop(p, obj) { + var prop = /*#__PURE__*/_curry2(function prop(p, obj) { return path([p], obj); }); @@ -3176,10 +2405,7 @@ * @symb R.pluck('x', [{x: 1, y: 2}, {x: 3, y: 4}, {x: 5, y: 6}]) = [1, 3, 5] * @symb R.pluck(0, [[1, 2], [3, 4], [5, 6]]) = [1, 3, 5] */ - - var pluck = - /*#__PURE__*/ - _curry2(function pluck(p, list) { + var pluck = /*#__PURE__*/_curry2(function pluck(p, list) { return map(prop(p), list); }); @@ -3229,10 +2455,7 @@ * * @symb R.reduce(f, a, [b, c, d]) = f(f(f(a, b), c), d) */ - - var reduce = - /*#__PURE__*/ - _curry3(_reduce); + var reduce = /*#__PURE__*/_curry3(_reduce); /** * ap applies a list of functions to a list of values. @@ -3260,29 +2483,24 @@ * R.ap(R.concat, R.toUpper)('Ramda') //=> 'RamdaRAMDA' * @symb R.ap([f, g], [a, b]) = [f(a), f(b), g(a), g(b)] */ - - var ap = - /*#__PURE__*/ - _curry2(function ap(applyF, applyX) { + var ap = /*#__PURE__*/_curry2(function ap(applyF, applyX) { return typeof applyX['fantasy-land/ap'] === 'function' ? applyX['fantasy-land/ap'](applyF) : typeof applyF.ap === 'function' ? applyF.ap(applyX) : typeof applyF === 'function' ? function (x) { return applyF(x)(applyX(x)); - } : // else + } : + // else _reduce(function (acc, f) { return _concat(acc, map(f, applyX)); }, [], applyF); }); - // 20.1.2.3 Number.isInteger(number) - - var floor$1 = Math.floor; - var _isInteger = function isInteger(it) { - return !_isObject(it) && isFinite(it) && floor$1(it) === it; - }; - - // 20.1.2.3 Number.isInteger(number) - - - _export(_export.S, 'Number', { isInteger: _isInteger }); + /** + * Determine if the passed argument is an integer. + * + * @private + * @param {*} n + * @category Type + * @return {Boolean} + */ function _isFunction(x) { return Object.prototype.toString.call(x) === '[object Function]'; @@ -3305,10 +2523,7 @@ * var madd3 = R.liftN(3, (...args) => R.sum(args)); * madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7] */ - - var liftN = - /*#__PURE__*/ - _curry2(function liftN(arity, fn) { + var liftN = /*#__PURE__*/_curry2(function liftN(arity, fn) { var lifted = curryN(arity, fn); return curryN(arity, function () { return _reduce(ap, map(lifted, arguments[0]), Array.prototype.slice.call(arguments, 1)); @@ -3337,10 +2552,7 @@ * * madd5([1,2], [3], [4, 5], [6], [7, 8]); //=> [21, 22, 22, 23, 22, 23, 23, 24] */ - - var lift = - /*#__PURE__*/ - _curry1(function lift(fn) { + var lift = /*#__PURE__*/_curry1(function lift(fn) { return liftN(fn.length, fn); }); @@ -3385,10 +2597,7 @@ * var g = f(3); * g(4); //=> 10 */ - - var curry = - /*#__PURE__*/ - _curry1(function curry(fn) { + var curry = /*#__PURE__*/_curry1(function curry(fn) { return curryN(fn.length, fn); }); @@ -3424,10 +2633,7 @@ * format({indent: 2, value: 'foo\nbar\nbaz\n'}); //=> ' foo\n bar\n baz\n' * @symb R.call(f, a, b) = f(a, b) */ - - var call = - /*#__PURE__*/ - curry(function call(fn) { + var call = /*#__PURE__*/curry(function call(fn) { return fn.apply(this, Array.prototype.slice.call(arguments, 1)); }); @@ -3437,7 +2643,6 @@ * * @private */ - function _makeFlat(recursive) { return function flatt(list) { var value, jlen, j; @@ -3450,7 +2655,6 @@ value = recursive ? flatt(list[idx]) : list[idx]; j = 0; jlen = value.length; - while (j < jlen) { result[result.length] = value[j]; j += 1; @@ -3458,10 +2662,8 @@ } else { result[result.length] = list[idx]; } - idx += 1; } - return result; }; } @@ -3473,13 +2675,13 @@ }; } - var preservingReduced = function preservingReduced(xf) { + var preservingReduced = function (xf) { return { '@@transducer/init': _xfBase.init, - '@@transducer/result': function transducerResult(result) { + '@@transducer/result': function (result) { return xf['@@transducer/result'](result); }, - '@@transducer/step': function transducerStep(result, input) { + '@@transducer/step': function (result, input) { var ret = xf['@@transducer/step'](result, input); return ret['@@transducer/reduced'] ? _forceReduced(ret) : ret; } @@ -3490,18 +2692,16 @@ var rxf = preservingReduced(xf); return { '@@transducer/init': _xfBase.init, - '@@transducer/result': function transducerResult(result) { + '@@transducer/result': function (result) { return rxf['@@transducer/result'](result); }, - '@@transducer/step': function transducerStep(result, input) { + '@@transducer/step': function (result, input) { return !_isArrayLike(input) ? _reduce(rxf, result, [input]) : _reduce(rxf, result, input); } }; }; - var _xchain = - /*#__PURE__*/ - _curry2(function _xchain(f, xf) { + var _xchain = /*#__PURE__*/_curry2(function _xchain(f, xf) { return map(f, _flatCat(xf)); }); @@ -3527,72 +2727,15 @@ * * R.chain(R.append, R.head)([1, 2, 3]); //=> [1, 2, 3, 1] */ - - var chain = - /*#__PURE__*/ - _curry2( - /*#__PURE__*/ - _dispatchable(['fantasy-land/chain', 'chain'], _xchain, function chain(fn, monad) { + var chain = /*#__PURE__*/_curry2( /*#__PURE__*/_dispatchable(['fantasy-land/chain', 'chain'], _xchain, function chain(fn, monad) { if (typeof monad === 'function') { return function (x) { return fn(monad(x))(x); }; } - return _makeFlat(false)(map(fn, monad)); })); - // 7.2.8 IsRegExp(argument) - - - var MATCH = _wks('match'); - var _isRegexp = function (it) { - var isRegExp; - return _isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : _cof(it) == 'RegExp'); - }; - - var dP$3 = _objectDp.f; - var gOPN$3 = _objectGopn.f; - - - var $RegExp = _global.RegExp; - var Base$1 = $RegExp; - var proto$2 = $RegExp.prototype; - var re1 = /a/g; - var re2 = /a/g; - // "new" creates a new object, old webkit buggy here - var CORRECT_NEW = new $RegExp(re1) !== re1; - - if (_descriptors && (!CORRECT_NEW || _fails(function () { - re2[_wks('match')] = false; - // RegExp constructor can alter flags and IsRegExp works correct with @@match - return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i'; - }))) { - $RegExp = function RegExp(p, f) { - var tiRE = this instanceof $RegExp; - var piRE = _isRegexp(p); - var fiU = f === undefined; - return !tiRE && piRE && p.constructor === $RegExp && fiU ? p - : _inheritIfRequired(CORRECT_NEW - ? new Base$1(piRE && !fiU ? p.source : p, f) - : Base$1((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? _flags.call(p) : f) - , tiRE ? this : proto$2, $RegExp); - }; - var proxy = function (key) { - key in $RegExp || dP$3($RegExp, key, { - configurable: true, - get: function () { return Base$1[key]; }, - set: function (it) { Base$1[key] = it; } - }); - }; - for (var keys$2 = gOPN$3(Base$1), i$1 = 0; keys$2.length > i$1;) proxy(keys$2[i$1++]); - proto$2.constructor = $RegExp; - $RegExp.prototype = proto$2; - _redefine(_global, 'RegExp', $RegExp); - } - - _setSpecies('RegExp'); - /** * Gives a single-word string description of the (native) type of a value, * returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not @@ -3618,10 +2761,7 @@ * R.type(() => {}); //=> "Function" * R.type(undefined); //=> "Undefined" */ - - var type = - /*#__PURE__*/ - _curry1(function type(val) { + var type = /*#__PURE__*/_curry1(function type(val) { return val === null ? 'Null' : val === undefined ? 'Undefined' : Object.prototype.toString.call(val).slice(8, -1); }); @@ -3644,10 +2784,7 @@ * R.not(0); //=> true * R.not(1); //=> false */ - - var not = - /*#__PURE__*/ - _curry1(function not(a) { + var not = /*#__PURE__*/_curry1(function not(a) { return !a; }); @@ -3673,10 +2810,7 @@ * isNil(7); //=> false * isNotNil(7); //=> true */ - - var complement = - /*#__PURE__*/ - lift(not); + var complement = /*#__PURE__*/lift(not); function _pipe(f, g) { return function () { @@ -3694,15 +2828,12 @@ * @param {String} methodname property to check for a custom implementation * @return {Object} Whatever the return value of the method is. */ - function _checkForMethod(methodname, fn) { return function () { var length = arguments.length; - if (length === 0) { return fn(); } - var obj = arguments[length - 1]; return _isArray$1(obj) || typeof obj[methodname] !== 'function' ? fn.apply(this, arguments) : obj[methodname].apply(obj, Array.prototype.slice.call(arguments, 0, length - 1)); }; @@ -3732,12 +2863,7 @@ * R.slice(-3, -1, ['a', 'b', 'c', 'd']); //=> ['b', 'c'] * R.slice(0, 3, 'ramda'); //=> 'ram' */ - - var slice = - /*#__PURE__*/ - _curry3( - /*#__PURE__*/ - _checkForMethod('slice', function slice(fromIndex, toIndex, list) { + var slice = /*#__PURE__*/_curry3( /*#__PURE__*/_checkForMethod('slice', function slice(fromIndex, toIndex, list) { return Array.prototype.slice.call(list, fromIndex, toIndex); })); @@ -3768,14 +2894,7 @@ * R.tail('a'); //=> '' * R.tail(''); //=> '' */ - - var tail = - /*#__PURE__*/ - _curry1( - /*#__PURE__*/ - _checkForMethod('tail', - /*#__PURE__*/ - slice(1, Infinity))); + var tail = /*#__PURE__*/_curry1( /*#__PURE__*/_checkForMethod('tail', /*#__PURE__*/slice(1, Infinity))); /** * Performs left-to-right function composition. The leftmost function may have @@ -3800,318 +2919,13 @@ * f(3, 4); // -(3^4) + 1 * @symb R.pipe(f, g, h)(a, b) = h(g(f(a, b))) */ - function pipe() { if (arguments.length === 0) { throw new Error('pipe requires at least one argument'); } - return _arity(arguments[0].length, reduce(_pipe, arguments[0], tail(arguments))); } - var at = _stringAt(true); - - // `AdvanceStringIndex` abstract operation - // https://tc39.github.io/ecma262/#sec-advancestringindex - var _advanceStringIndex = function (S, index, unicode) { - return index + (unicode ? at(S, index).length : 1); - }; - - var builtinExec = RegExp.prototype.exec; - - // `RegExpExec` abstract operation - // https://tc39.github.io/ecma262/#sec-regexpexec - var _regexpExecAbstract = function (R, S) { - var exec = R.exec; - if (typeof exec === 'function') { - var result = exec.call(R, S); - if (typeof result !== 'object') { - throw new TypeError('RegExp exec method returned something other than an Object or null'); - } - return result; - } - if (_classof(R) !== 'RegExp') { - throw new TypeError('RegExp#exec called on incompatible receiver'); - } - return builtinExec.call(R, S); - }; - - var nativeExec = RegExp.prototype.exec; - // This always refers to the native implementation, because the - // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js, - // which loads this file before patching the method. - var nativeReplace = String.prototype.replace; - - var patchedExec = nativeExec; - - var LAST_INDEX = 'lastIndex'; - - var UPDATES_LAST_INDEX_WRONG = (function () { - var re1 = /a/, - re2 = /b*/g; - nativeExec.call(re1, 'a'); - nativeExec.call(re2, 'a'); - return re1[LAST_INDEX] !== 0 || re2[LAST_INDEX] !== 0; - })(); - - // nonparticipating capturing group, copied from es5-shim's String#split patch. - var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; - - var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED; - - if (PATCH) { - patchedExec = function exec(str) { - var re = this; - var lastIndex, reCopy, match, i; - - if (NPCG_INCLUDED) { - reCopy = new RegExp('^' + re.source + '$(?!\\s)', _flags.call(re)); - } - if (UPDATES_LAST_INDEX_WRONG) lastIndex = re[LAST_INDEX]; - - match = nativeExec.call(re, str); - - if (UPDATES_LAST_INDEX_WRONG && match) { - re[LAST_INDEX] = re.global ? match.index + match[0].length : lastIndex; - } - if (NPCG_INCLUDED && match && match.length > 1) { - // Fix browsers whose `exec` methods don't consistently return `undefined` - // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/ - // eslint-disable-next-line no-loop-func - nativeReplace.call(match[0], reCopy, function () { - for (i = 1; i < arguments.length - 2; i++) { - if (arguments[i] === undefined) match[i] = undefined; - } - }); - } - - return match; - }; - } - - var _regexpExec = patchedExec; - - _export({ - target: 'RegExp', - proto: true, - forced: _regexpExec !== /./.exec - }, { - exec: _regexpExec - }); - - var SPECIES$3 = _wks('species'); - - var REPLACE_SUPPORTS_NAMED_GROUPS = !_fails(function () { - // #replace needs built-in support for named groups. - // #match works fine because it just return the exec results, even if it has - // a "grops" property. - var re = /./; - re.exec = function () { - var result = []; - result.groups = { a: '7' }; - return result; - }; - return ''.replace(re, '$') !== '7'; - }); - - var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = (function () { - // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec - var re = /(?:)/; - var originalExec = re.exec; - re.exec = function () { return originalExec.apply(this, arguments); }; - var result = 'ab'.split(re); - return result.length === 2 && result[0] === 'a' && result[1] === 'b'; - })(); - - var _fixReWks = function (KEY, length, exec) { - var SYMBOL = _wks(KEY); - - var DELEGATES_TO_SYMBOL = !_fails(function () { - // String methods call symbol-named RegEp methods - var O = {}; - O[SYMBOL] = function () { return 7; }; - return ''[KEY](O) != 7; - }); - - var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL ? !_fails(function () { - // Symbol-named RegExp methods call .exec - var execCalled = false; - var re = /a/; - re.exec = function () { execCalled = true; return null; }; - if (KEY === 'split') { - // RegExp[@@split] doesn't call the regex's exec method, but first creates - // a new one. We need to return the patched regex when creating the new one. - re.constructor = {}; - re.constructor[SPECIES$3] = function () { return re; }; - } - re[SYMBOL](''); - return !execCalled; - }) : undefined; - - if ( - !DELEGATES_TO_SYMBOL || - !DELEGATES_TO_EXEC || - (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) || - (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC) - ) { - var nativeRegExpMethod = /./[SYMBOL]; - var fns = exec( - _defined, - SYMBOL, - ''[KEY], - function maybeCallNative(nativeMethod, regexp, str, arg2, forceStringMethod) { - if (regexp.exec === _regexpExec) { - if (DELEGATES_TO_SYMBOL && !forceStringMethod) { - // The native String method already delegates to @@method (this - // polyfilled function), leasing to infinite recursion. - // We avoid it by directly calling the native @@method method. - return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) }; - } - return { done: true, value: nativeMethod.call(str, regexp, arg2) }; - } - return { done: false }; - } - ); - var strfn = fns[0]; - var rxfn = fns[1]; - - _redefine(String.prototype, KEY, strfn); - _hide(RegExp.prototype, SYMBOL, length == 2 - // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) - // 21.2.5.11 RegExp.prototype[@@split](string, limit) - ? function (string, arg) { return rxfn.call(string, this, arg); } - // 21.2.5.6 RegExp.prototype[@@match](string) - // 21.2.5.9 RegExp.prototype[@@search](string) - : function (string) { return rxfn.call(string, this); } - ); - } - }; - - var $min = Math.min; - var $push = [].push; - var $SPLIT = 'split'; - var LENGTH = 'length'; - var LAST_INDEX$1 = 'lastIndex'; - var MAX_UINT32 = 0xffffffff; - - // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError - var SUPPORTS_Y = !_fails(function () { }); - - // @@split logic - _fixReWks('split', 2, function (defined, SPLIT, $split, maybeCallNative) { - var internalSplit; - if ( - 'abbc'[$SPLIT](/(b)*/)[1] == 'c' || - 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 || - 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 || - '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 || - '.'[$SPLIT](/()()/)[LENGTH] > 1 || - ''[$SPLIT](/.?/)[LENGTH] - ) { - // based on es5-shim implementation, need to rework it - internalSplit = function (separator, limit) { - var string = String(this); - if (separator === undefined && limit === 0) return []; - // If `separator` is not a regex, use native split - if (!_isRegexp(separator)) return $split.call(string, separator, limit); - var output = []; - var flags = (separator.ignoreCase ? 'i' : '') + - (separator.multiline ? 'm' : '') + - (separator.unicode ? 'u' : '') + - (separator.sticky ? 'y' : ''); - var lastLastIndex = 0; - var splitLimit = limit === undefined ? MAX_UINT32 : limit >>> 0; - // Make `global` and avoid `lastIndex` issues by working with a copy - var separatorCopy = new RegExp(separator.source, flags + 'g'); - var match, lastIndex, lastLength; - while (match = _regexpExec.call(separatorCopy, string)) { - lastIndex = separatorCopy[LAST_INDEX$1]; - if (lastIndex > lastLastIndex) { - output.push(string.slice(lastLastIndex, match.index)); - if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1)); - lastLength = match[0][LENGTH]; - lastLastIndex = lastIndex; - if (output[LENGTH] >= splitLimit) break; - } - if (separatorCopy[LAST_INDEX$1] === match.index) separatorCopy[LAST_INDEX$1]++; // Avoid an infinite loop - } - if (lastLastIndex === string[LENGTH]) { - if (lastLength || !separatorCopy.test('')) output.push(''); - } else output.push(string.slice(lastLastIndex)); - return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output; - }; - // Chakra, V8 - } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) { - internalSplit = function (separator, limit) { - return separator === undefined && limit === 0 ? [] : $split.call(this, separator, limit); - }; - } else { - internalSplit = $split; - } - - return [ - // `String.prototype.split` method - // https://tc39.github.io/ecma262/#sec-string.prototype.split - function split(separator, limit) { - var O = defined(this); - var splitter = separator == undefined ? undefined : separator[SPLIT]; - return splitter !== undefined - ? splitter.call(separator, O, limit) - : internalSplit.call(String(O), separator, limit); - }, - // `RegExp.prototype[@@split]` method - // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split - // - // NOTE: This cannot be properly polyfilled in engines that don't support - // the 'y' flag. - function (regexp, limit) { - var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== $split); - if (res.done) return res.value; - - var rx = _anObject(regexp); - var S = String(this); - var C = _speciesConstructor(rx, RegExp); - - var unicodeMatching = rx.unicode; - var flags = (rx.ignoreCase ? 'i' : '') + - (rx.multiline ? 'm' : '') + - (rx.unicode ? 'u' : '') + - (SUPPORTS_Y ? 'y' : 'g'); - - // ^(? + rx + ) is needed, in combination with some S slicing, to - // simulate the 'y' flag. - var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags); - var lim = limit === undefined ? MAX_UINT32 : limit >>> 0; - if (lim === 0) return []; - if (S.length === 0) return _regexpExecAbstract(splitter, S) === null ? [S] : []; - var p = 0; - var q = 0; - var A = []; - while (q < S.length) { - splitter.lastIndex = SUPPORTS_Y ? q : 0; - var z = _regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q)); - var e; - if ( - z === null || - (e = $min(_toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p - ) { - q = _advanceStringIndex(S, q, unicodeMatching); - } else { - A.push(S.slice(p, q)); - if (A.length === lim) return A; - for (var i = 1; i <= z.length - 1; i++) { - A.push(z[i]); - if (A.length === lim) return A; - } - q = p = e; - } - } - A.push(S.slice(p)); - return A; - } - ]; - }); - /** * Returns a new list or string with the elements or characters in reverse * order. @@ -4136,10 +2950,7 @@ * R.reverse('a'); //=> 'a' * R.reverse(''); //=> '' */ - - var reverse = - /*#__PURE__*/ - _curry1(function reverse(list) { + var reverse = /*#__PURE__*/_curry1(function reverse(list) { return _isString(list) ? list.split('').reverse().join('') : Array.prototype.slice.call(list, 0).reverse(); }); @@ -4167,73 +2978,19 @@ * * @symb R.compose(f, g, h)(a, b) = f(g(h(a, b))) */ - function compose() { if (arguments.length === 0) { throw new Error('compose requires at least one argument'); } - return pipe.apply(this, reverse(arguments)); } - var $sort = [].sort; - var test = [1, 2, 3]; - - _export(_export.P + _export.F * (_fails(function () { - // IE8- - test.sort(undefined); - }) || !_fails(function () { - // V8 bug - test.sort(null); - // Old WebKit - }) || !_strictMethod($sort)), 'Array', { - // 22.1.3.25 Array.prototype.sort(comparefn) - sort: function sort(comparefn) { - return comparefn === undefined - ? $sort.call(_toObject(this)) - : $sort.call(_toObject(this), _aFunction(comparefn)); - } - }); - - var $indexOf = _arrayIncludes(false); - var $native = [].indexOf; - var NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0; - - _export(_export.P + _export.F * (NEGATIVE_ZERO || !_strictMethod($native)), 'Array', { - // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex]) - indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { - return NEGATIVE_ZERO - // convert -0 to +0 - ? $native.apply(this, arguments) || 0 - : $indexOf(this, searchElement, arguments[1]); - } - }); - - var dP$4 = _objectDp.f; - var FProto = Function.prototype; - var nameRE = /^\s*function ([^ (]*)/; - var NAME$1 = 'name'; - - // 19.2.4.2 name - NAME$1 in FProto || _descriptors && dP$4(FProto, NAME$1, { - configurable: true, - get: function () { - try { - return ('' + this).match(nameRE)[1]; - } catch (e) { - return ''; - } - } - }); - function _arrayFromIterator(iter) { var list = []; var next; - while (!(next = iter.next()).done) { list.push(next.value); } - return list; } @@ -4245,47 +3002,11 @@ if (pred(x, list[idx])) { return true; } - idx += 1; } - return false; } - // @@match logic - _fixReWks('match', 1, function (defined, MATCH, $match, maybeCallNative) { - return [ - // `String.prototype.match` method - // https://tc39.github.io/ecma262/#sec-string.prototype.match - function match(regexp) { - var O = defined(this); - var fn = regexp == undefined ? undefined : regexp[MATCH]; - return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); - }, - // `RegExp.prototype[@@match]` method - // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match - function (regexp) { - var res = maybeCallNative($match, regexp, this); - if (res.done) return res.value; - var rx = _anObject(regexp); - var S = String(this); - if (!rx.global) return _regexpExecAbstract(rx, S); - var fullUnicode = rx.unicode; - rx.lastIndex = 0; - var A = []; - var n = 0; - var result; - while ((result = _regexpExecAbstract(rx, S)) !== null) { - var matchStr = String(result[0]); - A[n] = matchStr; - if (matchStr === '') rx.lastIndex = _advanceStringIndex(S, _toLength(rx.lastIndex), fullUnicode); - n++; - } - return n === 0 ? null : A; - } - ]; - }); - function _functionName(f) { // String(x => x) evaluates to "x => x", so the pattern may not match. var match = String(f).match(/^function (\w*)/); @@ -4315,10 +3036,7 @@ * R.identical(0, -0); //=> false * R.identical(NaN, NaN); //=> true */ - - var identical = - /*#__PURE__*/ - _curry2(function identical(a, b) { + var identical = /*#__PURE__*/_curry2(function identical(a, b) { // SameValue algorithm if (a === b) { // Steps 1-5, 7-10 @@ -4343,14 +3061,13 @@ function _uniqContentEquals(aIterator, bIterator, stackA, stackB) { var a = _arrayFromIterator(aIterator); - var b = _arrayFromIterator(bIterator); function eq(_a, _b) { return _equals(_a, _b, stackA.slice(), stackB.slice()); - } // if *a* array contains any element that is not included in *b* - + } + // if *a* array contains any element that is not included in *b* return !_containsWith(function (b, aItem) { return !_containsWith(eq, aItem, b); }, b, a); @@ -4386,43 +3103,33 @@ if (typeof a.constructor === 'function' && _functionName(a.constructor) === 'Promise') { return a === b; } - break; - case 'Boolean': case 'Number': case 'String': - if (!(_typeof(a) === _typeof(b) && identical(a.valueOf(), b.valueOf()))) { + if (!(typeof a === typeof b && identical(a.valueOf(), b.valueOf()))) { return false; } - break; - case 'Date': if (!identical(a.valueOf(), b.valueOf())) { return false; } - break; - case 'Error': return a.name === b.name && a.message === b.message; - case 'RegExp': if (!(a.source === b.source && a.global === b.global && a.ignoreCase === b.ignoreCase && a.multiline === b.multiline && a.sticky === b.sticky && a.unicode === b.unicode)) { return false; } - break; } var idx = stackA.length - 1; - while (idx >= 0) { if (stackA[idx] === a) { return stackB[idx] === b; } - idx -= 1; } @@ -4433,14 +3140,12 @@ } return _uniqContentEquals(a.entries(), b.entries(), stackA.concat([a]), stackB.concat([b])); - case 'Set': if (a.size !== b.size) { return false; } return _uniqContentEquals(a.values(), b.values(), stackA.concat([a]), stackB.concat([b])); - case 'Arguments': case 'Array': case 'Object': @@ -4461,32 +3166,27 @@ case 'Float64Array': case 'ArrayBuffer': break; - default: // Values of other types are only equal if identical. return false; } - var keysA = keys$1(a); - - if (keysA.length !== keys$1(b).length) { + var keysA = keys(a); + if (keysA.length !== keys(b).length) { return false; } var extendedStackA = stackA.concat([a]); var extendedStackB = stackB.concat([b]); - idx = keysA.length - 1; + idx = keysA.length - 1; while (idx >= 0) { var key = keysA[idx]; - if (!(_has$1(key, b) && _equals(b[key], a[key], extendedStackA, extendedStackB))) { return false; } - idx -= 1; } - return true; } @@ -4515,53 +3215,42 @@ * var b = {}; b.v = b; * R.equals(a, b); //=> true */ - - var equals = - /*#__PURE__*/ - _curry2(function equals(a, b) { + var equals = /*#__PURE__*/_curry2(function equals(a, b) { return _equals(a, b, [], []); }); function _indexOf(list, a, idx) { - var inf, item; // Array.prototype.indexOf doesn't exist below IE9 - + var inf, item; + // Array.prototype.indexOf doesn't exist below IE9 if (typeof list.indexOf === 'function') { - switch (_typeof(a)) { + switch (typeof a) { case 'number': if (a === 0) { // manually crawl the list to distinguish between +0 and -0 inf = 1 / a; - while (idx < list.length) { item = list[idx]; - if (item === 0 && 1 / item === inf) { return idx; } - idx += 1; } - return -1; } else if (a !== a) { // NaN while (idx < list.length) { item = list[idx]; - if (typeof item === 'number' && item !== item) { return idx; } - idx += 1; } - return -1; - } // non-zero numbers can utilise Set - - + } + // non-zero numbers can utilise Set return list.indexOf(a, idx); - // all these types can utilise Set + // all these types can utilise Set case 'string': case 'boolean': case 'function': @@ -4573,19 +3262,15 @@ // null can utilise Set return list.indexOf(a, idx); } - } - } // anything else not covered above, defer to R.equals - - + } + // anything else not covered above, defer to R.equals while (idx < list.length) { if (equals(list[idx], a)) { return idx; } - idx += 1; } - return -1; } @@ -4593,158 +3278,13 @@ return _indexOf(list, a, 0) >= 0; } - var max$2 = Math.max; - var min$2 = Math.min; - var floor$2 = Math.floor; - var SUBSTITUTION_SYMBOLS = /\$([$&`']|\d\d?|<[^>]*>)/g; - var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&`']|\d\d?)/g; - - var maybeToString = function (it) { - return it === undefined ? it : String(it); - }; - - // @@replace logic - _fixReWks('replace', 2, function (defined, REPLACE, $replace, maybeCallNative) { - return [ - // `String.prototype.replace` method - // https://tc39.github.io/ecma262/#sec-string.prototype.replace - function replace(searchValue, replaceValue) { - var O = defined(this); - var fn = searchValue == undefined ? undefined : searchValue[REPLACE]; - return fn !== undefined - ? fn.call(searchValue, O, replaceValue) - : $replace.call(String(O), searchValue, replaceValue); - }, - // `RegExp.prototype[@@replace]` method - // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace - function (regexp, replaceValue) { - var res = maybeCallNative($replace, regexp, this, replaceValue); - if (res.done) return res.value; - - var rx = _anObject(regexp); - var S = String(this); - var functionalReplace = typeof replaceValue === 'function'; - if (!functionalReplace) replaceValue = String(replaceValue); - var global = rx.global; - if (global) { - var fullUnicode = rx.unicode; - rx.lastIndex = 0; - } - var results = []; - while (true) { - var result = _regexpExecAbstract(rx, S); - if (result === null) break; - results.push(result); - if (!global) break; - var matchStr = String(result[0]); - if (matchStr === '') rx.lastIndex = _advanceStringIndex(S, _toLength(rx.lastIndex), fullUnicode); - } - var accumulatedResult = ''; - var nextSourcePosition = 0; - for (var i = 0; i < results.length; i++) { - result = results[i]; - var matched = String(result[0]); - var position = max$2(min$2(_toInteger(result.index), S.length), 0); - var captures = []; - // NOTE: This is equivalent to - // captures = result.slice(1).map(maybeToString) - // but for some reason `nativeSlice.call(result, 1, result.length)` (called in - // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and - // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it. - for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j])); - var namedCaptures = result.groups; - if (functionalReplace) { - var replacerArgs = [matched].concat(captures, position, S); - if (namedCaptures !== undefined) replacerArgs.push(namedCaptures); - var replacement = String(replaceValue.apply(undefined, replacerArgs)); - } else { - replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue); - } - if (position >= nextSourcePosition) { - accumulatedResult += S.slice(nextSourcePosition, position) + replacement; - nextSourcePosition = position + matched.length; - } - } - return accumulatedResult + S.slice(nextSourcePosition); - } - ]; - - // https://tc39.github.io/ecma262/#sec-getsubstitution - function getSubstitution(matched, str, position, captures, namedCaptures, replacement) { - var tailPos = position + matched.length; - var m = captures.length; - var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED; - if (namedCaptures !== undefined) { - namedCaptures = _toObject(namedCaptures); - symbols = SUBSTITUTION_SYMBOLS; - } - return $replace.call(replacement, symbols, function (match, ch) { - var capture; - switch (ch.charAt(0)) { - case '$': return '$'; - case '&': return matched; - case '`': return str.slice(0, position); - case "'": return str.slice(tailPos); - case '<': - capture = namedCaptures[ch.slice(1, -1)]; - break; - default: // \d\d? - var n = +ch; - if (n === 0) return match; - if (n > m) { - var f = floor$2(n / 10); - if (f === 0) return match; - if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1); - return match; - } - capture = captures[n - 1]; - } - return capture === undefined ? '' : capture; - }); - } - }); - function _quote(s) { var escaped = s.replace(/\\/g, '\\\\').replace(/[\b]/g, '\\b') // \b matches word boundary; [\b] matches backspace .replace(/\f/g, '\\f').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\t/g, '\\t').replace(/\v/g, '\\v').replace(/\0/g, '\\0'); + return '"' + escaped.replace(/"/g, '\\"') + '"'; } - // 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() - - var getTime$1 = Date.prototype.getTime; - var $toISOString = Date.prototype.toISOString; - - var lz = function (num) { - return num > 9 ? num : '0' + num; - }; - - // PhantomJS / old WebKit has a broken implementations - var _dateToIsoString = (_fails(function () { - return $toISOString.call(new Date(-5e13 - 1)) != '0385-07-25T07:06:39.999Z'; - }) || !_fails(function () { - $toISOString.call(new Date(NaN)); - })) ? function toISOString() { - if (!isFinite(getTime$1.call(this))) throw RangeError('Invalid time value'); - var d = this; - var y = d.getUTCFullYear(); - var m = d.getUTCMilliseconds(); - var s = y < 0 ? '-' : y > 9999 ? '+' : ''; - return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) + - '-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) + - 'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) + - ':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z'; - } : $toISOString; - - // 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() - - - - // PhantomJS / old WebKit has a broken implementations - _export(_export.P + _export.F * (Date.prototype.toISOString !== _dateToIsoString), 'Date', { - toISOString: _dateToIsoString - }); - /** * Polyfill from . */ @@ -4773,10 +3313,8 @@ if (fn(list[idx])) { result[result.length] = list[idx]; } - idx += 1; } - return result; } @@ -4784,17 +3322,13 @@ return Object.prototype.toString.call(x) === '[object Object]'; } - var XFilter = - /*#__PURE__*/ - function () { + var XFilter = /*#__PURE__*/function () { function XFilter(f, xf) { this.xf = xf; this.f = f; } - XFilter.prototype['@@transducer/init'] = _xfBase.init; XFilter.prototype['@@transducer/result'] = _xfBase.result; - XFilter.prototype['@@transducer/step'] = function (result, input) { return this.f(input) ? this.xf['@@transducer/step'](result, input) : result; }; @@ -4802,9 +3336,7 @@ return XFilter; }(); - var _xfilter = - /*#__PURE__*/ - _curry2(function _xfilter(f, xf) { + var _xfilter = /*#__PURE__*/_curry2(function _xfilter(f, xf) { return new XFilter(f, xf); }); @@ -4835,19 +3367,14 @@ * * R.filter(isEven, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4} */ - - var filter = - /*#__PURE__*/ - _curry2( - /*#__PURE__*/ - _dispatchable(['filter'], _xfilter, function (pred, filterable) { + var filter = /*#__PURE__*/_curry2( /*#__PURE__*/_dispatchable(['filter'], _xfilter, function (pred, filterable) { return _isObject$1(filterable) ? _reduce(function (acc, key) { if (pred(filterable[key])) { acc[key] = filterable[key]; } - return acc; - }, {}, keys$1(filterable)) : // else + }, {}, keys(filterable)) : + // else _filter(pred, filterable); })); @@ -4875,10 +3402,7 @@ * * R.reject(isOdd, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4} */ - - var reject = - /*#__PURE__*/ - _curry2(function reject(pred, filterable) { + var reject = /*#__PURE__*/_curry2(function reject(pred, filterable) { return filter(_complement(pred), filterable); }); @@ -4886,52 +3410,43 @@ var recur = function recur(y) { var xs = seen.concat([x]); return _contains(y, xs) ? '' : _toString(y, xs); - }; // mapPairs :: (Object, [String]) -> [String] - + }; - var mapPairs = function mapPairs(obj, keys) { + // mapPairs :: (Object, [String]) -> [String] + var mapPairs = function (obj, keys$$1) { return _map(function (k) { return _quote(k) + ': ' + recur(obj[k]); - }, keys.slice().sort()); + }, keys$$1.slice().sort()); }; switch (Object.prototype.toString.call(x)) { case '[object Arguments]': return '(function() { return arguments; }(' + _map(recur, x).join(', ') + '))'; - case '[object Array]': return '[' + _map(recur, x).concat(mapPairs(x, reject(function (k) { - return /^\d+$/.test(k); - }, keys$1(x)))).join(', ') + ']'; - + return (/^\d+$/.test(k) + ); + }, keys(x)))).join(', ') + ']'; case '[object Boolean]': - return _typeof(x) === 'object' ? 'new Boolean(' + recur(x.valueOf()) + ')' : x.toString(); - + return typeof x === 'object' ? 'new Boolean(' + recur(x.valueOf()) + ')' : x.toString(); case '[object Date]': return 'new Date(' + (isNaN(x.valueOf()) ? recur(NaN) : _quote(_toISOString(x))) + ')'; - case '[object Null]': return 'null'; - case '[object Number]': - return _typeof(x) === 'object' ? 'new Number(' + recur(x.valueOf()) + ')' : 1 / x === -Infinity ? '-0' : x.toString(10); - + return typeof x === 'object' ? 'new Number(' + recur(x.valueOf()) + ')' : 1 / x === -Infinity ? '-0' : x.toString(10); case '[object String]': - return _typeof(x) === 'object' ? 'new String(' + recur(x.valueOf()) + ')' : _quote(x); - + return typeof x === 'object' ? 'new String(' + recur(x.valueOf()) + ')' : _quote(x); case '[object Undefined]': return 'undefined'; - default: if (typeof x.toString === 'function') { var repr = x.toString(); - if (repr !== '[object Object]') { return repr; } } - - return '{' + mapPairs(x, keys$1(x)).join(', ') + '}'; + return '{' + mapPairs(x, keys(x)).join(', ') + '}'; } } @@ -4971,10 +3486,7 @@ * R.toString({foo: 1, bar: 2, baz: 3}); //=> '{"bar": 2, "baz": 3, "foo": 1}' * R.toString(new Date('2001-02-03T04:05:06Z')); //=> 'new Date("2001-02-03T04:05:06.000Z")' */ - - var toString$3 = - /*#__PURE__*/ - _curry1(function toString(val) { + var toString$2 = /*#__PURE__*/_curry1(function toString(val) { return _toString(val, []); }); @@ -5005,10 +3517,7 @@ * * @symb R.converge(f, [g, h])(a, b) = f(g(a, b), h(a, b)) */ - - var converge = - /*#__PURE__*/ - _curry2(function converge(after, fns) { + var converge = /*#__PURE__*/_curry2(function converge(after, fns) { return curryN(reduce(max$1, 0, pluck('length', fns)), function () { var args = arguments; var context = this; @@ -5018,9 +3527,7 @@ }); }); - var XReduceBy = - /*#__PURE__*/ - function () { + var XReduceBy = /*#__PURE__*/function () { function XReduceBy(valueFn, valueAcc, keyFn, xf) { this.valueFn = valueFn; this.valueAcc = valueAcc; @@ -5028,27 +3535,21 @@ this.xf = xf; this.inputs = {}; } - XReduceBy.prototype['@@transducer/init'] = _xfBase.init; - XReduceBy.prototype['@@transducer/result'] = function (result) { var key; - for (key in this.inputs) { if (_has$1(key, this.inputs)) { result = this.xf['@@transducer/step'](result, this.inputs[key]); - if (result['@@transducer/reduced']) { result = result['@@transducer/value']; break; } } } - this.inputs = null; return this.xf['@@transducer/result'](result); }; - XReduceBy.prototype['@@transducer/step'] = function (result, input) { var key = this.keyFn(input); this.inputs[key] = this.inputs[key] || [key, this.valueAcc]; @@ -5059,9 +3560,7 @@ return XReduceBy; }(); - var _xreduceBy = - /*#__PURE__*/ - _curryN(4, [], function _xreduceBy(valueFn, valueAcc, keyFn, xf) { + var _xreduceBy = /*#__PURE__*/_curryN(4, [], function _xreduceBy(valueFn, valueAcc, keyFn, xf) { return new XReduceBy(valueFn, valueAcc, keyFn, xf); }); @@ -5109,12 +3608,7 @@ * // 'F': ['Bart'] * // } */ - - var reduceBy = - /*#__PURE__*/ - _curryN(4, [], - /*#__PURE__*/ - _dispatchable([], _xreduceBy, function reduceBy(valueFn, valueAcc, keyFn, list) { + var reduceBy = /*#__PURE__*/_curryN(4, [], /*#__PURE__*/_dispatchable([], _xreduceBy, function reduceBy(valueFn, valueAcc, keyFn, list) { return _reduce(function (acc, elt) { var key = keyFn(elt); acc[key] = valueFn(_has$1(key, acc) ? acc[key] : valueAcc, elt); @@ -5146,10 +3640,7 @@ * var letters = ['a', 'b', 'A', 'a', 'B', 'c']; * R.countBy(R.toLower)(letters); //=> {'a': 3, 'b': 2, 'c': 1} */ - - var countBy = - /*#__PURE__*/ - reduceBy(function (acc, elem) { + var countBy = /*#__PURE__*/reduceBy(function (acc, elem) { return acc + 1; }, 0); @@ -5168,14 +3659,9 @@ * * R.dec(42); //=> 41 */ + var dec = /*#__PURE__*/add(-1); - var dec = - /*#__PURE__*/ - add(-1); - - var XDropRepeatsWith = - /*#__PURE__*/ - function () { + var XDropRepeatsWith = /*#__PURE__*/function () { function XDropRepeatsWith(pred, xf) { this.xf = xf; this.pred = pred; @@ -5185,16 +3671,13 @@ XDropRepeatsWith.prototype['@@transducer/init'] = _xfBase.init; XDropRepeatsWith.prototype['@@transducer/result'] = _xfBase.result; - XDropRepeatsWith.prototype['@@transducer/step'] = function (result, input) { var sameAsLast = false; - if (!this.seenFirstValue) { this.seenFirstValue = true; } else if (this.pred(this.lastValue, input)) { sameAsLast = true; } - this.lastValue = input; return sameAsLast ? result : this.xf['@@transducer/step'](result, input); }; @@ -5202,9 +3685,7 @@ return XDropRepeatsWith; }(); - var _xdropRepeatsWith = - /*#__PURE__*/ - _curry2(function _xdropRepeatsWith(pred, xf) { + var _xdropRepeatsWith = /*#__PURE__*/_curry2(function _xdropRepeatsWith(pred, xf) { return new XDropRepeatsWith(pred, xf); }); @@ -5234,10 +3715,7 @@ * @symb R.nth(0, [a, b, c]) = a * @symb R.nth(1, [a, b, c]) = b */ - - var nth = - /*#__PURE__*/ - _curry2(function nth(offset, list) { + var nth = /*#__PURE__*/_curry2(function nth(offset, list) { var idx = offset < 0 ? list.length + offset : offset; return _isString(list) ? list.charAt(idx) : list[idx]; }); @@ -5262,10 +3740,7 @@ * R.last('abc'); //=> 'c' * R.last(''); //=> '' */ - - var last = - /*#__PURE__*/ - nth(-1); + var last = /*#__PURE__*/nth(-1); /** * Returns a new list without any consecutively repeating elements. Equality is @@ -5288,28 +3763,19 @@ * var l = [1, -1, 1, 3, 4, -4, -4, -5, 5, 3, 3]; * R.dropRepeatsWith(R.eqBy(Math.abs), l); //=> [1, 3, 4, -5, 3] */ - - var dropRepeatsWith = - /*#__PURE__*/ - _curry2( - /*#__PURE__*/ - _dispatchable([], _xdropRepeatsWith, function dropRepeatsWith(pred, list) { + var dropRepeatsWith = /*#__PURE__*/_curry2( /*#__PURE__*/_dispatchable([], _xdropRepeatsWith, function dropRepeatsWith(pred, list) { var result = []; var idx = 1; var len = list.length; - if (len !== 0) { result[0] = list[0]; - while (idx < len) { if (!pred(last(result), list[idx])) { result[result.length] = list[idx]; } - idx += 1; } } - return result; })); @@ -5331,16 +3797,7 @@ * * R.dropRepeats([1, 1, 1, 2, 3, 4, 4, 2, 2]); //=> [1, 2, 3, 4, 2] */ - - var dropRepeats = - /*#__PURE__*/ - _curry1( - /*#__PURE__*/ - _dispatchable([], - /*#__PURE__*/ - _xdropRepeatsWith(equals), - /*#__PURE__*/ - dropRepeatsWith(equals))); + var dropRepeats = /*#__PURE__*/_curry1( /*#__PURE__*/_dispatchable([], /*#__PURE__*/_xdropRepeatsWith(equals), /*#__PURE__*/dropRepeatsWith(equals))); /** * Returns a new function much like the supplied one, except that the first two @@ -5362,10 +3819,7 @@ * R.flip(mergeThree)(1, 2, 3); //=> [2, 1, 3] * @symb R.flip(f)(a, b, c) = f(b, a, c) */ - - var flip = - /*#__PURE__*/ - _curry1(function flip(fn) { + var flip = /*#__PURE__*/_curry1(function flip(fn) { return curryN(fn.length, function (a, b) { var args = Array.prototype.slice.call(arguments, 0); args[0] = b; @@ -5390,18 +3844,13 @@ * * R.fromPairs([['a', 1], ['b', 2], ['c', 3]]); //=> {a: 1, b: 2, c: 3} */ - - var fromPairs = - /*#__PURE__*/ - _curry1(function fromPairs(pairs) { + var fromPairs = /*#__PURE__*/_curry1(function fromPairs(pairs) { var result = {}; var idx = 0; - while (idx < pairs.length) { result[pairs[idx][0]] = pairs[idx][1]; idx += 1; } - return result; }); @@ -5445,18 +3894,10 @@ * // 'F': [{name: 'Eddy', score: 58}] * // } */ - - var groupBy = - /*#__PURE__*/ - _curry2( - /*#__PURE__*/ - _checkForMethod('groupBy', - /*#__PURE__*/ - reduceBy(function (acc, item) { + var groupBy = /*#__PURE__*/_curry2( /*#__PURE__*/_checkForMethod('groupBy', /*#__PURE__*/reduceBy(function (acc, item) { if (acc == null) { acc = []; } - acc.push(item); return acc; }, null))); @@ -5482,10 +3923,7 @@ * R.head('abc'); //=> 'a' * R.head(''); //=> '' */ - - var head = - /*#__PURE__*/ - nth(0); + var head = /*#__PURE__*/nth(0); function _identity(x) { return x; @@ -5510,10 +3948,7 @@ * R.identity(obj) === obj; //=> true * @symb R.identity(a) = a */ - - var identity = - /*#__PURE__*/ - _curry1(_identity); + var identity = /*#__PURE__*/_curry1(_identity); /** * Increments its argument. @@ -5530,10 +3965,7 @@ * * R.inc(42); //=> 43 */ - - var inc = - /*#__PURE__*/ - add(1); + var inc = /*#__PURE__*/add(1); /** * Given a function that generates a key, turns a list of objects into an @@ -5557,10 +3989,7 @@ * R.indexBy(R.prop('id'), list); * //=> {abc: {id: 'abc', title: 'B'}, xyz: {id: 'xyz', title: 'A'}} */ - - var indexBy = - /*#__PURE__*/ - reduceBy(function (acc, elem) { + var indexBy = /*#__PURE__*/reduceBy(function (acc, elem) { return elem; }, null); @@ -5588,268 +4017,32 @@ * R.init('a'); //=> '' * R.init(''); //=> '' */ + var init = /*#__PURE__*/slice(0, -1); - var init = - /*#__PURE__*/ - slice(0, -1); - - var _validateCollection = function (it, TYPE) { - if (!_isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!'); - return it; - }; - - var dP$5 = _objectDp.f; - - - - - - - - - - var fastKey = _meta.fastKey; - - var SIZE = _descriptors ? '_s' : 'size'; - - var getEntry = function (that, key) { - // fast case - var index = fastKey(key); - var entry; - if (index !== 'F') return that._i[index]; - // frozen object case - for (entry = that._f; entry; entry = entry.n) { - if (entry.k == key) return entry; - } - }; - - var _collectionStrong = { - getConstructor: function (wrapper, NAME, IS_MAP, ADDER) { - var C = wrapper(function (that, iterable) { - _anInstance(that, C, NAME, '_i'); - that._t = NAME; // collection type - that._i = _objectCreate(null); // index - that._f = undefined; // first entry - that._l = undefined; // last entry - that[SIZE] = 0; // size - if (iterable != undefined) _forOf(iterable, IS_MAP, that[ADDER], that); - }); - _redefineAll(C.prototype, { - // 23.1.3.1 Map.prototype.clear() - // 23.2.3.2 Set.prototype.clear() - clear: function clear() { - for (var that = _validateCollection(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) { - entry.r = true; - if (entry.p) entry.p = entry.p.n = undefined; - delete data[entry.i]; - } - that._f = that._l = undefined; - that[SIZE] = 0; - }, - // 23.1.3.3 Map.prototype.delete(key) - // 23.2.3.4 Set.prototype.delete(value) - 'delete': function (key) { - var that = _validateCollection(this, NAME); - var entry = getEntry(that, key); - if (entry) { - var next = entry.n; - var prev = entry.p; - delete that._i[entry.i]; - entry.r = true; - if (prev) prev.n = next; - if (next) next.p = prev; - if (that._f == entry) that._f = next; - if (that._l == entry) that._l = prev; - that[SIZE]--; - } return !!entry; - }, - // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined) - // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined) - forEach: function forEach(callbackfn /* , that = undefined */) { - _validateCollection(this, NAME); - var f = _ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); - var entry; - while (entry = entry ? entry.n : this._f) { - f(entry.v, entry.k, this); - // revert to the last existing entry - while (entry && entry.r) entry = entry.p; - } - }, - // 23.1.3.7 Map.prototype.has(key) - // 23.2.3.7 Set.prototype.has(value) - has: function has(key) { - return !!getEntry(_validateCollection(this, NAME), key); - } - }); - if (_descriptors) dP$5(C.prototype, 'size', { - get: function () { - return _validateCollection(this, NAME)[SIZE]; - } - }); - return C; - }, - def: function (that, key, value) { - var entry = getEntry(that, key); - var prev, index; - // change existing entry - if (entry) { - entry.v = value; - // create new entry - } else { - that._l = entry = { - i: index = fastKey(key, true), // <- index - k: key, // <- key - v: value, // <- value - p: prev = that._l, // <- previous entry - n: undefined, // <- next entry - r: false // <- removed - }; - if (!that._f) that._f = entry; - if (prev) prev.n = entry; - that[SIZE]++; - // add to index - if (index !== 'F') that._i[index] = entry; - } return that; - }, - getEntry: getEntry, - setStrong: function (C, NAME, IS_MAP) { - // add .keys, .values, .entries, [@@iterator] - // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11 - _iterDefine(C, NAME, function (iterated, kind) { - this._t = _validateCollection(iterated, NAME); // target - this._k = kind; // kind - this._l = undefined; // previous - }, function () { - var that = this; - var kind = that._k; - var entry = that._l; - // revert to the last existing entry - while (entry && entry.r) entry = entry.p; - // get next entry - if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) { - // or finish the iteration - that._t = undefined; - return _iterStep(1); - } - // return step by kind - if (kind == 'keys') return _iterStep(0, entry.k); - if (kind == 'values') return _iterStep(0, entry.v); - return _iterStep(0, [entry.k, entry.v]); - }, IS_MAP ? 'entries' : 'values', !IS_MAP, true); - - // add [@@species], 23.1.2.2, 23.2.2.2 - _setSpecies(NAME); - } - }; - - var _collection = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) { - var Base = _global[NAME]; - var C = Base; - var ADDER = IS_MAP ? 'set' : 'add'; - var proto = C && C.prototype; - var O = {}; - var fixMethod = function (KEY) { - var fn = proto[KEY]; - _redefine(proto, KEY, - KEY == 'delete' ? function (a) { - return IS_WEAK && !_isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); - } : KEY == 'has' ? function has(a) { - return IS_WEAK && !_isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); - } : KEY == 'get' ? function get(a) { - return IS_WEAK && !_isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a); - } : KEY == 'add' ? function add(a) { fn.call(this, a === 0 ? 0 : a); return this; } - : function set(a, b) { fn.call(this, a === 0 ? 0 : a, b); return this; } - ); - }; - if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !_fails(function () { - new C().entries().next(); - }))) { - // create collection constructor - C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); - _redefineAll(C.prototype, methods); - _meta.NEED = true; - } else { - var instance = new C(); - // early implementations not supports chaining - var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance; - // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false - var THROWS_ON_PRIMITIVES = _fails(function () { instance.has(1); }); - // most early implementations doesn't supports iterables, most modern - not close it correctly - var ACCEPT_ITERABLES = _iterDetect(function (iter) { new C(iter); }); // eslint-disable-line no-new - // for early implementations -0 and +0 not the same - var BUGGY_ZERO = !IS_WEAK && _fails(function () { - // V8 ~ Chromium 42- fails only with 5+ elements - var $instance = new C(); - var index = 5; - while (index--) $instance[ADDER](index, index); - return !$instance.has(-0); - }); - if (!ACCEPT_ITERABLES) { - C = wrapper(function (target, iterable) { - _anInstance(target, C, NAME); - var that = _inheritIfRequired(new Base(), target, C); - if (iterable != undefined) _forOf(iterable, IS_MAP, that[ADDER], that); - return that; - }); - C.prototype = proto; - proto.constructor = C; - } - if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) { - fixMethod('delete'); - fixMethod('has'); - IS_MAP && fixMethod('get'); - } - if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER); - // weak collections should not contains .clear method - if (IS_WEAK && proto.clear) delete proto.clear; - } - - _setToStringTag(C, NAME); - - O[NAME] = C; - _export(_export.G + _export.W + _export.F * (C != Base), O); - - if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP); - - return C; - }; - - var SET = 'Set'; - - // 23.2 Set Objects - var es6_set = _collection(SET, function (get) { - return function Set() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; - }, { - // 23.2.3.1 Set.prototype.add(value) - add: function add(value) { - return _collectionStrong.def(_validateCollection(this, SET), value = value === 0 ? 0 : value, value); - } - }, _collectionStrong); - - var _Set = - /*#__PURE__*/ - function () { + var _Set = /*#__PURE__*/function () { function _Set() { /* globals Set */ this._nativeSet = typeof Set === 'function' ? new Set() : null; this._items = {}; - } // until we figure out why jsdoc chokes on this + } + + // until we figure out why jsdoc chokes on this // @param item The item to add to the Set // @returns {boolean} true if the item did not exist prior, otherwise false // - - _Set.prototype.add = function (item) { return !hasOrAdd(item, true, this); - }; // + }; + + // // @param item The item to check for existence in the Set // @returns {boolean} true if the item exists in the Set, otherwise false // - - _Set.prototype.has = function (item) { return hasOrAdd(item, false, this); - }; // + }; + + // // Combines the logic for checking whether an item is a member of the set and // for adding a new item to the set. // @@ -5859,16 +4052,12 @@ // @param set The set instance to check or add to. // @return {boolean} true if the item already existed, otherwise false. // - - return _Set; }(); function hasOrAdd(item, shouldAdd, set) { - var type = _typeof(item); - + var type = typeof item; var prevSize, newSize; - switch (type) { case 'string': case 'number': @@ -5880,18 +4069,14 @@ if (shouldAdd) { set._items['-0'] = true; } - return false; } - } // these types can all utilise the native Set - - + } + // these types can all utilise the native Set if (set._nativeSet !== null) { if (shouldAdd) { prevSize = set._nativeSet.size; - set._nativeSet.add(item); - newSize = set._nativeSet.size; return newSize === prevSize; } else { @@ -5903,7 +4088,6 @@ set._items[type] = {}; set._items[type][item] = true; } - return false; } else if (item in set._items[type]) { return true; @@ -5911,7 +4095,6 @@ if (shouldAdd) { set._items[type][item] = true; } - return false; } } @@ -5921,21 +4104,18 @@ // representing [ falseExists, trueExists ] if (type in set._items) { var bIdx = item ? 1 : 0; - if (set._items[type][bIdx]) { return true; } else { if (shouldAdd) { set._items[type][bIdx] = true; } - return false; } } else { if (shouldAdd) { set._items[type] = item ? [false, true] : [true, false]; } - return false; } @@ -5944,9 +4124,7 @@ if (set._nativeSet !== null) { if (shouldAdd) { prevSize = set._nativeSet.size; - set._nativeSet.add(item); - newSize = set._nativeSet.size; return newSize === prevSize; } else { @@ -5957,18 +4135,14 @@ if (shouldAdd) { set._items[type] = [item]; } - return false; } - if (!_contains(item, set._items[type])) { if (shouldAdd) { set._items[type].push(item); } - return false; } - return true; } @@ -5979,7 +4153,6 @@ if (shouldAdd) { set._items[type] = true; } - return false; } @@ -5989,40 +4162,31 @@ if (shouldAdd) { set._items['null'] = true; } - return false; } - return true; } - /* falls through */ - default: // reduce the search size of heterogeneous sets by creating buckets // for each type. type = Object.prototype.toString.call(item); - if (!(type in set._items)) { if (shouldAdd) { set._items[type] = [item]; } - return false; - } // scan through all previously applied items - - + } + // scan through all previously applied items if (!_contains(item, set._items[type])) { if (shouldAdd) { set._items[type].push(item); } - return false; } - return true; } - } // A simple Set type that honours R.equals semantics + } /** * Returns a new list containing only one copy of each element in the original @@ -6042,10 +4206,7 @@ * * R.uniqBy(Math.abs, [-1, -5, 2, 10, 1, 2]); //=> [-1, -5, 2, 10] */ - - var uniqBy = - /*#__PURE__*/ - _curry2(function uniqBy(fn, list) { + var uniqBy = /*#__PURE__*/_curry2(function uniqBy(fn, list) { var set = new _Set(); var result = []; var idx = 0; @@ -6054,14 +4215,11 @@ while (idx < list.length) { item = list[idx]; appliedItem = fn(item); - if (set.add(appliedItem)) { result.push(item); } - idx += 1; } - return result; }); @@ -6082,49 +4240,7 @@ * R.uniq([1, '1']); //=> [1, '1'] * R.uniq([[42], [42]]); //=> [[42]] */ - - var uniq = - /*#__PURE__*/ - uniqBy(identity); - - // 19.1.2.1 Object.assign(target, source, ...) - - - - - - var $assign = Object.assign; - - // should work with symbols and should have deterministic property order (V8 bug) - var _objectAssign = !$assign || _fails(function () { - var A = {}; - var B = {}; - // eslint-disable-next-line no-undef - var S = Symbol(); - var K = 'abcdefghijklmnopqrst'; - A[S] = 7; - K.split('').forEach(function (k) { B[k] = k; }); - return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; - }) ? function assign(target, source) { // eslint-disable-line no-unused-vars - var T = _toObject(target); - var aLen = arguments.length; - var index = 1; - var getSymbols = _objectGops.f; - var isEnum = _objectPie.f; - while (aLen > index) { - var S = _iobject(arguments[index++]); - var keys = getSymbols ? _objectKeys(S).concat(getSymbols(S)) : _objectKeys(S); - var length = keys.length; - var j = 0; - var key; - while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key]; - } return T; - } : $assign; - - // 19.1.3.1 Object.assign(target, source) - - - _export(_export.S + _export.F, 'Object', { assign: _objectAssign }); + var uniq = /*#__PURE__*/uniqBy(identity); /** * Turns a named method with a specified arity into a function that can be @@ -6153,18 +4269,13 @@ * @symb R.invoker(1, 'method')(a, o) = o['method'](a) * @symb R.invoker(2, 'method')(a, b, o) = o['method'](a, b) */ - - var invoker = - /*#__PURE__*/ - _curry2(function invoker(arity, method) { + var invoker = /*#__PURE__*/_curry2(function invoker(arity, method) { return curryN(arity + 1, function () { var target = arguments[arity]; - if (target != null && _isFunction(target[method])) { return target[method].apply(target, Array.prototype.slice.call(arguments, 0, arity)); } - - throw new TypeError(toString$3(target) + ' does not have a method named "' + method + '"'); + throw new TypeError(toString$2(target) + ' does not have a method named "' + method + '"'); }); }); @@ -6187,10 +4298,7 @@ * spacer(['a', 2, 3.4]); //=> 'a 2 3.4' * R.join('|', [1, 2, 3]); //=> '1|2|3' */ - - var join = - /*#__PURE__*/ - invoker(1, 'join'); + var join = /*#__PURE__*/invoker(1, 'join'); /** * juxt applies a list of functions to a list of values. @@ -6209,33 +4317,12 @@ * getRange(3, 4, 9, -3); //=> [-3, 9] * @symb R.juxt([f, g, h])(a, b) = [f(a, b), g(a, b), h(a, b)] */ - - var juxt = - /*#__PURE__*/ - _curry1(function juxt(fns) { + var juxt = /*#__PURE__*/_curry1(function juxt(fns) { return converge(function () { return Array.prototype.slice.call(arguments, 0); }, fns); }); - var $native$1 = [].lastIndexOf; - var NEGATIVE_ZERO$1 = !!$native$1 && 1 / [1].lastIndexOf(1, -0) < 0; - - _export(_export.P + _export.F * (NEGATIVE_ZERO$1 || !_strictMethod($native$1)), 'Array', { - // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex]) - lastIndexOf: function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { - // convert -0 to +0 - if (NEGATIVE_ZERO$1) return $native$1.apply(this, arguments) || 0; - var O = _toIobject(this); - var length = _toLength(O.length); - var index = length - 1; - if (arguments.length > 1) index = Math.min(index, _toInteger(arguments[1])); - if (index < 0) index = length + index; - for (;index >= 0; index--) if (index in O) if (O[index] === searchElement) return index || 0; - return -1; - } - }); - /** * Adds together all the elements of a list. * @@ -6251,10 +4338,7 @@ * * R.sum([2,4,6,8,100,1]); //=> 121 */ - - var sum = - /*#__PURE__*/ - reduce(add, 0); + var sum = /*#__PURE__*/reduce(add, 0); /** * A customisable version of [`R.memoize`](#memoize). `memoizeWith` takes an @@ -6285,18 +4369,13 @@ * factorial(5); //=> 120 * count; //=> 1 */ - - var memoizeWith = - /*#__PURE__*/ - _curry2(function memoizeWith(mFn, fn) { + var memoizeWith = /*#__PURE__*/_curry2(function memoizeWith(mFn, fn) { var cache = {}; return _arity(fn.length, function () { var key = mFn.apply(this, arguments); - if (!_has$1(key, cache)) { cache[key] = fn.apply(this, arguments); } - return cache[key]; }); }); @@ -6329,11 +4408,8 @@ * factorial(5); //=> 120 * count; //=> 1 */ - - var memoize = - /*#__PURE__*/ - memoizeWith(function () { - return toString$3(arguments); + var memoize = /*#__PURE__*/memoizeWith(function () { + return toString$2(arguments); }); /** @@ -6356,10 +4432,7 @@ * triple(4); //=> 12 * R.multiply(2, 5); //=> 10 */ - - var multiply = - /*#__PURE__*/ - _curry2(function multiply(a, b) { + var multiply = /*#__PURE__*/_curry2(function multiply(a, b) { return a * b; }); @@ -6395,12 +4468,7 @@ * greetMsJaneJones('Hello'); //=> 'Hello, Ms. Jane Jones!' * @symb R.partialRight(f, [a, b])(c, d) = f(c, d, a, b) */ - - var partialRight = - /*#__PURE__*/ - _createPartialApplicator( - /*#__PURE__*/ - flip(_concat)); + var partialRight = /*#__PURE__*/_createPartialApplicator( /*#__PURE__*/flip(_concat)); /** * Takes a predicate and a list or other `Filterable` object and returns the @@ -6426,10 +4494,7 @@ * R.partition(R.contains('s'), { a: 'sss', b: 'ttt', foo: 'bars' }); * // => [ { a: 'sss', foo: 'bars' }, { b: 'ttt' } ] */ - - var partition = - /*#__PURE__*/ - juxt([filter, reject]); + var partition = /*#__PURE__*/juxt([filter, reject]); /** * Similar to `pick` except that this one includes a `key: undefined` pair for @@ -6449,20 +4514,15 @@ * R.pickAll(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4} * R.pickAll(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, e: undefined, f: undefined} */ - - var pickAll = - /*#__PURE__*/ - _curry2(function pickAll(names, obj) { + var pickAll = /*#__PURE__*/_curry2(function pickAll(names, obj) { var result = {}; var idx = 0; var len = names.length; - while (idx < len) { var name = names[idx]; result[name] = obj[name]; idx += 1; } - return result; }); @@ -6481,10 +4541,7 @@ * * R.product([2,4,6,8,100,1]); //=> 38400 */ - - var product = - /*#__PURE__*/ - reduce(multiply, 1); + var product = /*#__PURE__*/reduce(multiply, 1); /** * Accepts a function `fn` and a list of transformer functions and returns a @@ -6515,19 +4572,14 @@ * R.useWith(Math.pow, [R.dec, R.inc])(3)(4); //=> 32 * @symb R.useWith(f, [g, h])(a, b) = f(g(a), h(b)) */ - - var useWith = - /*#__PURE__*/ - _curry2(function useWith(fn, transformers) { + var useWith = /*#__PURE__*/_curry2(function useWith(fn, transformers) { return curryN(transformers.length, function () { var args = []; var idx = 0; - while (idx < transformers.length) { args.push(transformers[idx].call(this, arguments[idx])); idx += 1; } - return fn.apply(this, args.concat(Array.prototype.slice.call(arguments, transformers.length))); }); }); @@ -6551,10 +4603,7 @@ * var kids = [abby, fred]; * R.project(['name', 'grade'], kids); //=> [{name: 'Abby', grade: 2}, {name: 'Fred', grade: 7}] */ - - var project = - /*#__PURE__*/ - useWith(_map, [pickAll, identity]); // passing `identity` gives correct arity + var project = /*#__PURE__*/useWith(_map, [pickAll, identity]); // passing `identity` gives correct arity /** * Splits a string into an array of strings based on the given @@ -6576,10 +4625,7 @@ * * R.split('.', 'a.b.c.xyz.d'); //=> ['a', 'b', 'c', 'xyz', 'd'] */ - - var split = - /*#__PURE__*/ - invoker(1, 'split'); + var split = /*#__PURE__*/invoker(1, 'split'); /** * The lower case version of a string. @@ -6596,10 +4642,7 @@ * * R.toLower('XYZ'); //=> 'xyz' */ - - var toLower = - /*#__PURE__*/ - invoker(0, 'toLowerCase'); + var toLower = /*#__PURE__*/invoker(0, 'toLowerCase'); /** * Converts an object into an array of key, value arrays. Only the object's @@ -6619,18 +4662,13 @@ * * R.toPairs({a: 1, b: 2, c: 3}); //=> [['a', 1], ['b', 2], ['c', 3]] */ - - var toPairs = - /*#__PURE__*/ - _curry1(function toPairs(obj) { + var toPairs = /*#__PURE__*/_curry1(function toPairs(obj) { var pairs = []; - for (var prop in obj) { if (_has$1(prop, obj)) { pairs[pairs.length] = [prop, obj[prop]]; } } - return pairs; }); @@ -6649,10 +4687,7 @@ * * R.toUpper('abc'); //=> 'ABC' */ - - var toUpper = - /*#__PURE__*/ - invoker(0, 'toUpperCase'); + var toUpper = /*#__PURE__*/invoker(0, 'toUpperCase'); /** * Initializes a transducer using supplied iterator function. Returns a single @@ -6701,22 +4736,12 @@ * var firstOddTransducer = R.compose(R.filter(isOdd), R.take(1)); * R.transduce(firstOddTransducer, R.flip(R.append), [], R.range(0, 100)); //=> [1] */ - - var transduce = - /*#__PURE__*/ - curryN(4, function transduce(xf, fn, acc, list) { + var transduce = /*#__PURE__*/curryN(4, function transduce(xf, fn, acc, list) { return _reduce(xf(typeof fn === 'function' ? _xwrap(fn) : fn), acc, list); }); - // 21.1.3.25 String.prototype.trim() - _stringTrim('trim', function ($trim) { - return function trim() { - return $trim(this, 3); - }; - }); - - var ws = "\t\n\x0B\f\r \xA0\u1680\u180E\u2000\u2001\u2002\u2003" + "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" + "\u2029\uFEFF"; - var zeroWidth = "\u200B"; + var ws = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028' + '\u2029\uFEFF'; + var zeroWidth = '\u200b'; var hasProtoTrim = typeof String.prototype.trim === 'function'; /** * Removes (strips) whitespace from both ends of the string. @@ -6733,12 +4758,7 @@ * R.trim(' xyz '); //=> 'xyz' * R.map(R.trim, R.split(',', 'x, y, z')); //=> ['x', 'y', 'z'] */ - - var _trim = !hasProtoTrim || - /*#__PURE__*/ - ws.trim() || ! - /*#__PURE__*/ - zeroWidth.trim() ? function trim(str) { + var _trim = !hasProtoTrim || /*#__PURE__*/ws.trim() || ! /*#__PURE__*/zeroWidth.trim() ? function trim(str) { var beginRx = new RegExp('^[' + ws + '][' + ws + ']*'); var endRx = new RegExp('[' + ws + '][' + ws + ']*$'); return str.replace(beginRx, '').replace(endRx, ''); @@ -6763,12 +4783,7 @@ * * R.union([1, 2, 3], [2, 3, 4]); //=> [1, 2, 3, 4] */ - - var union = - /*#__PURE__*/ - _curry2( - /*#__PURE__*/ - compose(uniq, _concat)); + var union = /*#__PURE__*/_curry2( /*#__PURE__*/compose(uniq, _concat)); /** * Shorthand for `R.chain(R.identity)`, which removes one level of nesting from @@ -6787,10 +4802,7 @@ * R.unnest([1, [2], [[3]]]); //=> [1, 2, [3]] * R.unnest([[1, 2], [3, 4], [5, 6]]); //=> [1, 2, 3, 4, 5, 6] */ - - var unnest = - /*#__PURE__*/ - chain(_identity); + var unnest = /*#__PURE__*/chain(_identity); var isQueryPresent = (function (query) { return query.measures && query.measures.length || query.dimensions && query.dimensions.length || query.timeDimensions && query.timeDimensions.length; @@ -7070,223 +5082,220 @@ var $filter = _arrayMethods(2); - _export(_export.P + _export.F * !_strictMethod([].filter, true), 'Array', { - // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg]) - filter: function filter(callbackfn /* , thisArg */) { - return $filter(this, callbackfn, arguments[1]); - } - }); - - // 19.1.3.19 Object.setPrototypeOf(O, proto) - - _export(_export.S, 'Object', { setPrototypeOf: _setProto.set }); - - var $forEach = _arrayMethods(0); - var STRICT = _strictMethod([].forEach, true); - - _export(_export.P + _export.F * !STRICT, 'Array', { - // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg]) - forEach: function forEach(callbackfn /* , thisArg */) { - return $forEach(this, callbackfn, arguments[1]); - } - }); - - // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) - _export(_export.S, 'Object', { create: _objectCreate }); - - var runtime = createCommonjsModule(function (module) { - /** - * Copyright (c) 2014-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - !function (global) { - - var Op = Object.prototype; - var hasOwn = Op.hasOwnProperty; - var undefined; // More compressible than void 0. - - var $Symbol = typeof Symbol === "function" ? Symbol : {}; - var iteratorSymbol = $Symbol.iterator || "@@iterator"; - var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; - var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; - var runtime = global.regeneratorRuntime; - - if (runtime) { - { - // If regeneratorRuntime is defined globally and we're in a module, - // make the exports object identical to regeneratorRuntime. - module.exports = runtime; - } // Don't bother evaluating the rest of this file if the runtime was - // already defined globally. - - - return; - } // Define the runtime globally (as expected by generated code) as either - // module.exports (if we're in a module) or a new, empty object. - - - runtime = global.regeneratorRuntime = module.exports; - - function wrap(innerFn, outerFn, self, tryLocsList) { - // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. - var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; - var generator = Object.create(protoGenerator.prototype); - var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next, - // .throw, and .return methods. - - generator._invoke = makeInvokeMethod(innerFn, self, context); - return generator; - } - - runtime.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion - // record like context.tryEntries[i].completion. This interface could - // have been (and was previously) designed to take a closure to be - // invoked without arguments, but in all the cases we care about we - // already have an existing method we want to call, so there's no need - // to create a new function object. We can even get away with assuming - // the method takes exactly one argument, since that happens to be true - // in every case, so we don't have to touch the arguments object. The - // only additional allocation required is the completion record, which - // has a stable shape and so hopefully should be cheap to allocate. - - function tryCatch(fn, obj, arg) { - try { - return { - type: "normal", - arg: fn.call(obj, arg) - }; - } catch (err) { - return { - type: "throw", - arg: err - }; - } - } - - var GenStateSuspendedStart = "suspendedStart"; - var GenStateSuspendedYield = "suspendedYield"; - var GenStateExecuting = "executing"; - var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as - // breaking out of the dispatch switch statement. - - var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and - // .constructor.prototype properties for functions that return Generator - // objects. For full spec compliance, you may wish to configure your - // minifier not to mangle the names of these two functions. - - function Generator() {} - - function GeneratorFunction() {} - - function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that - // don't natively support it. - - - var IteratorPrototype = {}; - - IteratorPrototype[iteratorSymbol] = function () { - return this; - }; + _export(_export.P + _export.F * !_strictMethod([].filter, true), 'Array', { + // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg]) + filter: function filter(callbackfn /* , thisArg */) { + return $filter(this, callbackfn, arguments[1]); + } + }); - var getProto = Object.getPrototypeOf; - var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); + var dP$1 = _objectDp.f; + var FProto = Function.prototype; + var nameRE = /^\s*function ([^ (]*)/; + var NAME$1 = 'name'; - if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { - // This environment has a native %IteratorPrototype%; use it instead - // of the polyfill. - IteratorPrototype = NativeIteratorPrototype; + // 19.2.4.2 name + NAME$1 in FProto || _descriptors && dP$1(FProto, NAME$1, { + configurable: true, + get: function () { + try { + return ('' + this).match(nameRE)[1]; + } catch (e) { + return ''; } + } + }); - var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); - GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; - GeneratorFunctionPrototype.constructor = GeneratorFunction; - GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction"; // Helper for defining the .next, .throw, and .return methods of the - // Iterator interface in terms of a single ._invoke method. + var runtime = createCommonjsModule(function (module) { + /** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ - function defineIteratorMethods(prototype) { - ["next", "throw", "return"].forEach(function (method) { - prototype[method] = function (arg) { - return this._invoke(method, arg); - }; - }); + !(function(global) { + + var Op = Object.prototype; + var hasOwn = Op.hasOwnProperty; + var undefined; // More compressible than void 0. + var $Symbol = typeof Symbol === "function" ? Symbol : {}; + var iteratorSymbol = $Symbol.iterator || "@@iterator"; + var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; + var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; + var runtime = global.regeneratorRuntime; + if (runtime) { + { + // If regeneratorRuntime is defined globally and we're in a module, + // make the exports object identical to regeneratorRuntime. + module.exports = runtime; } + // Don't bother evaluating the rest of this file if the runtime was + // already defined globally. + return; + } - runtime.isGeneratorFunction = function (genFun) { - var ctor = typeof genFun === "function" && genFun.constructor; - return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can - // do is to check its .name property. - (ctor.displayName || ctor.name) === "GeneratorFunction" : false; - }; + // Define the runtime globally (as expected by generated code) as either + // module.exports (if we're in a module) or a new, empty object. + runtime = global.regeneratorRuntime = module.exports; - runtime.mark = function (genFun) { - if (Object.setPrototypeOf) { - Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); - } else { - genFun.__proto__ = GeneratorFunctionPrototype; + function wrap(innerFn, outerFn, self, tryLocsList) { + // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. + var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; + var generator = Object.create(protoGenerator.prototype); + var context = new Context(tryLocsList || []); - if (!(toStringTagSymbol in genFun)) { - genFun[toStringTagSymbol] = "GeneratorFunction"; - } - } + // The ._invoke method unifies the implementations of the .next, + // .throw, and .return methods. + generator._invoke = makeInvokeMethod(innerFn, self, context); - genFun.prototype = Object.create(Gp); - return genFun; - }; // Within the body of any async function, `await x` is transformed to - // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test - // `hasOwn.call(value, "__await")` to determine if the yielded value is - // meant to be awaited. + return generator; + } + runtime.wrap = wrap; + + // Try/catch helper to minimize deoptimizations. Returns a completion + // record like context.tryEntries[i].completion. This interface could + // have been (and was previously) designed to take a closure to be + // invoked without arguments, but in all the cases we care about we + // already have an existing method we want to call, so there's no need + // to create a new function object. We can even get away with assuming + // the method takes exactly one argument, since that happens to be true + // in every case, so we don't have to touch the arguments object. The + // only additional allocation required is the completion record, which + // has a stable shape and so hopefully should be cheap to allocate. + function tryCatch(fn, obj, arg) { + try { + return { type: "normal", arg: fn.call(obj, arg) }; + } catch (err) { + return { type: "throw", arg: err }; + } + } + + var GenStateSuspendedStart = "suspendedStart"; + var GenStateSuspendedYield = "suspendedYield"; + var GenStateExecuting = "executing"; + var GenStateCompleted = "completed"; + + // Returning this object from the innerFn has the same effect as + // breaking out of the dispatch switch statement. + var ContinueSentinel = {}; + + // Dummy constructor functions that we use as the .constructor and + // .constructor.prototype properties for functions that return Generator + // objects. For full spec compliance, you may wish to configure your + // minifier not to mangle the names of these two functions. + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + + // This is a polyfill for %IteratorPrototype% for environments that + // don't natively support it. + var IteratorPrototype = {}; + IteratorPrototype[iteratorSymbol] = function () { + return this; + }; + var getProto = Object.getPrototypeOf; + var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); + if (NativeIteratorPrototype && + NativeIteratorPrototype !== Op && + hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { + // This environment has a native %IteratorPrototype%; use it instead + // of the polyfill. + IteratorPrototype = NativeIteratorPrototype; + } - runtime.awrap = function (arg) { - return { - __await: arg + var Gp = GeneratorFunctionPrototype.prototype = + Generator.prototype = Object.create(IteratorPrototype); + GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; + GeneratorFunctionPrototype.constructor = GeneratorFunction; + GeneratorFunctionPrototype[toStringTagSymbol] = + GeneratorFunction.displayName = "GeneratorFunction"; + + // Helper for defining the .next, .throw, and .return methods of the + // Iterator interface in terms of a single ._invoke method. + function defineIteratorMethods(prototype) { + ["next", "throw", "return"].forEach(function(method) { + prototype[method] = function(arg) { + return this._invoke(method, arg); }; - }; + }); + } - function AsyncIterator(generator) { - function invoke(method, arg, resolve, reject) { - var record = tryCatch(generator[method], generator, arg); + runtime.isGeneratorFunction = function(genFun) { + var ctor = typeof genFun === "function" && genFun.constructor; + return ctor + ? ctor === GeneratorFunction || + // For the native GeneratorFunction constructor, the best we can + // do is to check its .name property. + (ctor.displayName || ctor.name) === "GeneratorFunction" + : false; + }; - if (record.type === "throw") { - reject(record.arg); - } else { - var result = record.arg; - var value = result.value; - - if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) { - return Promise.resolve(value.__await).then(function (value) { - invoke("next", value, resolve, reject); - }, function (err) { - invoke("throw", err, resolve, reject); - }); - } + runtime.mark = function(genFun) { + if (Object.setPrototypeOf) { + Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); + } else { + genFun.__proto__ = GeneratorFunctionPrototype; + if (!(toStringTagSymbol in genFun)) { + genFun[toStringTagSymbol] = "GeneratorFunction"; + } + } + genFun.prototype = Object.create(Gp); + return genFun; + }; + + // Within the body of any async function, `await x` is transformed to + // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test + // `hasOwn.call(value, "__await")` to determine if the yielded value is + // meant to be awaited. + runtime.awrap = function(arg) { + return { __await: arg }; + }; - return Promise.resolve(value).then(function (unwrapped) { - // When a yielded Promise is resolved, its final value becomes - // the .value of the Promise<{value,done}> result for the - // current iteration. - result.value = unwrapped; - resolve(result); - }, function (error) { - // If a rejected Promise was yielded, throw the rejection back - // into the async generator function so it can be handled there. - return invoke("throw", error, resolve, reject); + function AsyncIterator(generator) { + function invoke(method, arg, resolve, reject) { + var record = tryCatch(generator[method], generator, arg); + if (record.type === "throw") { + reject(record.arg); + } else { + var result = record.arg; + var value = result.value; + if (value && + typeof value === "object" && + hasOwn.call(value, "__await")) { + return Promise.resolve(value.__await).then(function(value) { + invoke("next", value, resolve, reject); + }, function(err) { + invoke("throw", err, resolve, reject); }); } + + return Promise.resolve(value).then(function(unwrapped) { + // When a yielded Promise is resolved, its final value becomes + // the .value of the Promise<{value,done}> result for the + // current iteration. + result.value = unwrapped; + resolve(result); + }, function(error) { + // If a rejected Promise was yielded, throw the rejection back + // into the async generator function so it can be handled there. + return invoke("throw", error, resolve, reject); + }); } + } - var previousPromise; + var previousPromise; - function enqueue(method, arg) { - function callInvokeWithMethodAndArg() { - return new Promise(function (resolve, reject) { - invoke(method, arg, resolve, reject); - }); - } + function enqueue(method, arg) { + function callInvokeWithMethodAndArg() { + return new Promise(function(resolve, reject) { + invoke(method, arg, resolve, reject); + }); + } - return previousPromise = // If enqueue has been called before, then we want to wait until + return previousPromise = + // If enqueue has been called before, then we want to wait until // all previous Promises have been resolved before calling invoke, // so that results are always delivered in the correct order. If // enqueue has not been called before, then it is important to @@ -7298,504 +5307,524 @@ // execute code before the first await. Since we implement simple // async functions in terms of async generators, it is especially // important to get this right, even though it requires care. - previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later - // invocations of the iterator. - callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); - } // Define the unified helper method that is used to implement .next, - // .throw, and .return (see defineIteratorMethods). - - - this._invoke = enqueue; + previousPromise ? previousPromise.then( + callInvokeWithMethodAndArg, + // Avoid propagating failures to Promises returned by later + // invocations of the iterator. + callInvokeWithMethodAndArg + ) : callInvokeWithMethodAndArg(); } - defineIteratorMethods(AsyncIterator.prototype); - - AsyncIterator.prototype[asyncIteratorSymbol] = function () { - return this; - }; - - runtime.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of - // AsyncIterator objects; they just return a Promise for the value of - // the final result produced by the iterator. + // Define the unified helper method that is used to implement .next, + // .throw, and .return (see defineIteratorMethods). + this._invoke = enqueue; + } - runtime.async = function (innerFn, outerFn, self, tryLocsList) { - var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList)); - return runtime.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator. - : iter.next().then(function (result) { - return result.done ? result.value : iter.next(); - }); - }; + defineIteratorMethods(AsyncIterator.prototype); + AsyncIterator.prototype[asyncIteratorSymbol] = function () { + return this; + }; + runtime.AsyncIterator = AsyncIterator; + + // Note that simple async functions are implemented on top of + // AsyncIterator objects; they just return a Promise for the value of + // the final result produced by the iterator. + runtime.async = function(innerFn, outerFn, self, tryLocsList) { + var iter = new AsyncIterator( + wrap(innerFn, outerFn, self, tryLocsList) + ); - function makeInvokeMethod(innerFn, self, context) { - var state = GenStateSuspendedStart; - return function invoke(method, arg) { - if (state === GenStateExecuting) { - throw new Error("Generator is already running"); - } + return runtime.isGeneratorFunction(outerFn) + ? iter // If outerFn is a generator, return the full iterator. + : iter.next().then(function(result) { + return result.done ? result.value : iter.next(); + }); + }; - if (state === GenStateCompleted) { - if (method === "throw") { - throw arg; - } // Be forgiving, per 25.3.3.3.3 of the spec: - // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume + function makeInvokeMethod(innerFn, self, context) { + var state = GenStateSuspendedStart; + return function invoke(method, arg) { + if (state === GenStateExecuting) { + throw new Error("Generator is already running"); + } - return doneResult(); + if (state === GenStateCompleted) { + if (method === "throw") { + throw arg; } - context.method = method; - context.arg = arg; - - while (true) { - var delegate = context.delegate; + // Be forgiving, per 25.3.3.3.3 of the spec: + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume + return doneResult(); + } - if (delegate) { - var delegateResult = maybeInvokeDelegate(delegate, context); + context.method = method; + context.arg = arg; - if (delegateResult) { - if (delegateResult === ContinueSentinel) continue; - return delegateResult; - } + while (true) { + var delegate = context.delegate; + if (delegate) { + var delegateResult = maybeInvokeDelegate(delegate, context); + if (delegateResult) { + if (delegateResult === ContinueSentinel) continue; + return delegateResult; } + } - if (context.method === "next") { - // Setting context._sent for legacy support of Babel's - // function.sent implementation. - context.sent = context._sent = context.arg; - } else if (context.method === "throw") { - if (state === GenStateSuspendedStart) { - state = GenStateCompleted; - throw context.arg; - } + if (context.method === "next") { + // Setting context._sent for legacy support of Babel's + // function.sent implementation. + context.sent = context._sent = context.arg; - context.dispatchException(context.arg); - } else if (context.method === "return") { - context.abrupt("return", context.arg); + } else if (context.method === "throw") { + if (state === GenStateSuspendedStart) { + state = GenStateCompleted; + throw context.arg; } - state = GenStateExecuting; - var record = tryCatch(innerFn, self, context); + context.dispatchException(context.arg); - if (record.type === "normal") { - // If an exception is thrown from innerFn, we leave state === - // GenStateExecuting and loop back for another invocation. - state = context.done ? GenStateCompleted : GenStateSuspendedYield; + } else if (context.method === "return") { + context.abrupt("return", context.arg); + } - if (record.arg === ContinueSentinel) { - continue; - } + state = GenStateExecuting; - return { - value: record.arg, - done: context.done - }; - } else if (record.type === "throw") { - state = GenStateCompleted; // Dispatch the exception by looping back around to the - // context.dispatchException(context.arg) call above. + var record = tryCatch(innerFn, self, context); + if (record.type === "normal") { + // If an exception is thrown from innerFn, we leave state === + // GenStateExecuting and loop back for another invocation. + state = context.done + ? GenStateCompleted + : GenStateSuspendedYield; - context.method = "throw"; - context.arg = record.arg; - } - } - }; - } // Call delegate.iterator[context.method](context.arg) and handle the - // result, either by returning a { value, done } result from the - // delegate iterator, or by modifying context.method and context.arg, - // setting context.delegate to null, and returning the ContinueSentinel. - - - function maybeInvokeDelegate(delegate, context) { - var method = delegate.iterator[context.method]; - - if (method === undefined) { - // A .throw or .return when the delegate iterator has no .throw - // method always terminates the yield* loop. - context.delegate = null; - - if (context.method === "throw") { - if (delegate.iterator.return) { - // If the delegate iterator has a return method, give it a - // chance to clean up. - context.method = "return"; - context.arg = undefined; - maybeInvokeDelegate(delegate, context); - - if (context.method === "throw") { - // If maybeInvokeDelegate(context) changed context.method from - // "return" to "throw", let that override the TypeError below. - return ContinueSentinel; - } + if (record.arg === ContinueSentinel) { + continue; } + return { + value: record.arg, + done: context.done + }; + + } else if (record.type === "throw") { + state = GenStateCompleted; + // Dispatch the exception by looping back around to the + // context.dispatchException(context.arg) call above. context.method = "throw"; - context.arg = new TypeError("The iterator does not provide a 'throw' method"); + context.arg = record.arg; } - - return ContinueSentinel; } + }; + } - var record = tryCatch(method, delegate.iterator, context.arg); + // Call delegate.iterator[context.method](context.arg) and handle the + // result, either by returning a { value, done } result from the + // delegate iterator, or by modifying context.method and context.arg, + // setting context.delegate to null, and returning the ContinueSentinel. + function maybeInvokeDelegate(delegate, context) { + var method = delegate.iterator[context.method]; + if (method === undefined) { + // A .throw or .return when the delegate iterator has no .throw + // method always terminates the yield* loop. + context.delegate = null; - if (record.type === "throw") { - context.method = "throw"; - context.arg = record.arg; - context.delegate = null; - return ContinueSentinel; - } + if (context.method === "throw") { + if (delegate.iterator.return) { + // If the delegate iterator has a return method, give it a + // chance to clean up. + context.method = "return"; + context.arg = undefined; + maybeInvokeDelegate(delegate, context); - var info = record.arg; + if (context.method === "throw") { + // If maybeInvokeDelegate(context) changed context.method from + // "return" to "throw", let that override the TypeError below. + return ContinueSentinel; + } + } - if (!info) { context.method = "throw"; - context.arg = new TypeError("iterator result is not an object"); - context.delegate = null; - return ContinueSentinel; + context.arg = new TypeError( + "The iterator does not provide a 'throw' method"); } - if (info.done) { - // Assign the result of the finished delegate to the temporary - // variable specified by delegate.resultName (see delegateYield). - context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield). + return ContinueSentinel; + } - context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the - // exception, let the outer generator proceed normally. If - // context.method was "next", forget context.arg since it has been - // "consumed" by the delegate iterator. If context.method was - // "return", allow the original .return call to continue in the - // outer generator. + var record = tryCatch(method, delegate.iterator, context.arg); - if (context.method !== "return") { - context.method = "next"; - context.arg = undefined; - } - } else { - // Re-yield the result returned by the delegate method. - return info; - } // The delegate iterator is finished, so forget it and continue with - // the outer generator. + if (record.type === "throw") { + context.method = "throw"; + context.arg = record.arg; + context.delegate = null; + return ContinueSentinel; + } + var info = record.arg; + if (! info) { + context.method = "throw"; + context.arg = new TypeError("iterator result is not an object"); context.delegate = null; return ContinueSentinel; - } // Define Generator.prototype.{next,throw,return} in terms of the - // unified ._invoke helper method. + } + if (info.done) { + // Assign the result of the finished delegate to the temporary + // variable specified by delegate.resultName (see delegateYield). + context[delegate.resultName] = info.value; + + // Resume execution at the desired location (see delegateYield). + context.next = delegate.nextLoc; + + // If context.method was "throw" but the delegate handled the + // exception, let the outer generator proceed normally. If + // context.method was "next", forget context.arg since it has been + // "consumed" by the delegate iterator. If context.method was + // "return", allow the original .return call to continue in the + // outer generator. + if (context.method !== "return") { + context.method = "next"; + context.arg = undefined; + } - defineIteratorMethods(Gp); - Gp[toStringTagSymbol] = "Generator"; // A Generator should always return itself as the iterator object when the - // @@iterator function is called on it. Some browsers' implementations of the - // iterator prototype chain incorrectly implement this, causing the Generator - // object to not be returned from this call. This ensures that doesn't happen. - // See https://github.com/facebook/regenerator/issues/274 for more details. + } else { + // Re-yield the result returned by the delegate method. + return info; + } - Gp[iteratorSymbol] = function () { - return this; - }; + // The delegate iterator is finished, so forget it and continue with + // the outer generator. + context.delegate = null; + return ContinueSentinel; + } - Gp.toString = function () { - return "[object Generator]"; - }; + // Define Generator.prototype.{next,throw,return} in terms of the + // unified ._invoke helper method. + defineIteratorMethods(Gp); - function pushTryEntry(locs) { - var entry = { - tryLoc: locs[0] - }; + Gp[toStringTagSymbol] = "Generator"; - if (1 in locs) { - entry.catchLoc = locs[1]; - } + // A Generator should always return itself as the iterator object when the + // @@iterator function is called on it. Some browsers' implementations of the + // iterator prototype chain incorrectly implement this, causing the Generator + // object to not be returned from this call. This ensures that doesn't happen. + // See https://github.com/facebook/regenerator/issues/274 for more details. + Gp[iteratorSymbol] = function() { + return this; + }; - if (2 in locs) { - entry.finallyLoc = locs[2]; - entry.afterLoc = locs[3]; - } + Gp.toString = function() { + return "[object Generator]"; + }; - this.tryEntries.push(entry); - } + function pushTryEntry(locs) { + var entry = { tryLoc: locs[0] }; - function resetTryEntry(entry) { - var record = entry.completion || {}; - record.type = "normal"; - delete record.arg; - entry.completion = record; + if (1 in locs) { + entry.catchLoc = locs[1]; } - function Context(tryLocsList) { - // The root entry object (effectively a try statement without a catch - // or a finally block) gives us a place to store values thrown from - // locations where there is no enclosing try statement. - this.tryEntries = [{ - tryLoc: "root" - }]; - tryLocsList.forEach(pushTryEntry, this); - this.reset(true); + if (2 in locs) { + entry.finallyLoc = locs[2]; + entry.afterLoc = locs[3]; } - runtime.keys = function (object) { - var keys = []; - - for (var key in object) { - keys.push(key); - } - - keys.reverse(); // Rather than returning an object with a next method, we keep - // things simple and return the next function itself. + this.tryEntries.push(entry); + } - return function next() { - while (keys.length) { - var key = keys.pop(); + function resetTryEntry(entry) { + var record = entry.completion || {}; + record.type = "normal"; + delete record.arg; + entry.completion = record; + } - if (key in object) { - next.value = key; - next.done = false; - return next; - } - } // To avoid creating an additional object, we just hang the .value - // and .done properties off the next function object itself. This - // also ensures that the minifier will not anonymize the function. + function Context(tryLocsList) { + // The root entry object (effectively a try statement without a catch + // or a finally block) gives us a place to store values thrown from + // locations where there is no enclosing try statement. + this.tryEntries = [{ tryLoc: "root" }]; + tryLocsList.forEach(pushTryEntry, this); + this.reset(true); + } + runtime.keys = function(object) { + var keys = []; + for (var key in object) { + keys.push(key); + } + keys.reverse(); + + // Rather than returning an object with a next method, we keep + // things simple and return the next function itself. + return function next() { + while (keys.length) { + var key = keys.pop(); + if (key in object) { + next.value = key; + next.done = false; + return next; + } + } - next.done = true; - return next; - }; + // To avoid creating an additional object, we just hang the .value + // and .done properties off the next function object itself. This + // also ensures that the minifier will not anonymize the function. + next.done = true; + return next; }; + }; - function values(iterable) { - if (iterable) { - var iteratorMethod = iterable[iteratorSymbol]; - - if (iteratorMethod) { - return iteratorMethod.call(iterable); - } + function values(iterable) { + if (iterable) { + var iteratorMethod = iterable[iteratorSymbol]; + if (iteratorMethod) { + return iteratorMethod.call(iterable); + } - if (typeof iterable.next === "function") { - return iterable; - } + if (typeof iterable.next === "function") { + return iterable; + } - if (!isNaN(iterable.length)) { - var i = -1, - next = function next() { - while (++i < iterable.length) { - if (hasOwn.call(iterable, i)) { - next.value = iterable[i]; - next.done = false; - return next; - } + if (!isNaN(iterable.length)) { + var i = -1, next = function next() { + while (++i < iterable.length) { + if (hasOwn.call(iterable, i)) { + next.value = iterable[i]; + next.done = false; + return next; } + } - next.value = undefined; - next.done = true; - return next; - }; - - return next.next = next; - } - } // Return an iterator with no values. - - - return { - next: doneResult - }; - } + next.value = undefined; + next.done = true; - runtime.values = values; + return next; + }; - function doneResult() { - return { - value: undefined, - done: true - }; + return next.next = next; + } } - Context.prototype = { - constructor: Context, - reset: function reset(skipTempReset) { - this.prev = 0; - this.next = 0; // Resetting context._sent for legacy support of Babel's - // function.sent implementation. + // Return an iterator with no values. + return { next: doneResult }; + } + runtime.values = values; - this.sent = this._sent = undefined; - this.done = false; - this.delegate = null; - this.method = "next"; - this.arg = undefined; - this.tryEntries.forEach(resetTryEntry); + function doneResult() { + return { value: undefined, done: true }; + } - if (!skipTempReset) { - for (var name in this) { - // Not sure about the optimal order of these conditions: - if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) { - this[name] = undefined; - } + Context.prototype = { + constructor: Context, + + reset: function(skipTempReset) { + this.prev = 0; + this.next = 0; + // Resetting context._sent for legacy support of Babel's + // function.sent implementation. + this.sent = this._sent = undefined; + this.done = false; + this.delegate = null; + + this.method = "next"; + this.arg = undefined; + + this.tryEntries.forEach(resetTryEntry); + + if (!skipTempReset) { + for (var name in this) { + // Not sure about the optimal order of these conditions: + if (name.charAt(0) === "t" && + hasOwn.call(this, name) && + !isNaN(+name.slice(1))) { + this[name] = undefined; } } - }, - stop: function stop() { - this.done = true; - var rootEntry = this.tryEntries[0]; - var rootRecord = rootEntry.completion; - - if (rootRecord.type === "throw") { - throw rootRecord.arg; - } + } + }, - return this.rval; - }, - dispatchException: function dispatchException(exception) { - if (this.done) { - throw exception; - } + stop: function() { + this.done = true; - var context = this; + var rootEntry = this.tryEntries[0]; + var rootRecord = rootEntry.completion; + if (rootRecord.type === "throw") { + throw rootRecord.arg; + } - function handle(loc, caught) { - record.type = "throw"; - record.arg = exception; - context.next = loc; + return this.rval; + }, - if (caught) { - // If the dispatched exception was caught by a catch block, - // then let that catch block handle the exception normally. - context.method = "next"; - context.arg = undefined; - } + dispatchException: function(exception) { + if (this.done) { + throw exception; + } - return !!caught; + var context = this; + function handle(loc, caught) { + record.type = "throw"; + record.arg = exception; + context.next = loc; + + if (caught) { + // If the dispatched exception was caught by a catch block, + // then let that catch block handle the exception normally. + context.method = "next"; + context.arg = undefined; } - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - var record = entry.completion; + return !! caught; + } - if (entry.tryLoc === "root") { - // Exception thrown outside of any try block that could handle - // it, so set the completion value of the entire function to - // throw the exception. - return handle("end"); - } + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + var record = entry.completion; - if (entry.tryLoc <= this.prev) { - var hasCatch = hasOwn.call(entry, "catchLoc"); - var hasFinally = hasOwn.call(entry, "finallyLoc"); - - if (hasCatch && hasFinally) { - if (this.prev < entry.catchLoc) { - return handle(entry.catchLoc, true); - } else if (this.prev < entry.finallyLoc) { - return handle(entry.finallyLoc); - } - } else if (hasCatch) { - if (this.prev < entry.catchLoc) { - return handle(entry.catchLoc, true); - } - } else if (hasFinally) { - if (this.prev < entry.finallyLoc) { - return handle(entry.finallyLoc); - } - } else { - throw new Error("try statement without catch or finally"); - } - } - } - }, - abrupt: function abrupt(type, arg) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - - if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { - var finallyEntry = entry; - break; - } + if (entry.tryLoc === "root") { + // Exception thrown outside of any try block that could handle + // it, so set the completion value of the entire function to + // throw the exception. + return handle("end"); } - if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) { - // Ignore the finally entry if control is not jumping to a - // location outside the try/catch block. - finallyEntry = null; - } + if (entry.tryLoc <= this.prev) { + var hasCatch = hasOwn.call(entry, "catchLoc"); + var hasFinally = hasOwn.call(entry, "finallyLoc"); + + if (hasCatch && hasFinally) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } else if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } - var record = finallyEntry ? finallyEntry.completion : {}; - record.type = type; - record.arg = arg; + } else if (hasCatch) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } - if (finallyEntry) { - this.method = "next"; - this.next = finallyEntry.finallyLoc; - return ContinueSentinel; - } + } else if (hasFinally) { + if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } - return this.complete(record); - }, - complete: function complete(record, afterLoc) { - if (record.type === "throw") { - throw record.arg; + } else { + throw new Error("try statement without catch or finally"); + } } + } + }, - if (record.type === "break" || record.type === "continue") { - this.next = record.arg; - } else if (record.type === "return") { - this.rval = this.arg = record.arg; - this.method = "return"; - this.next = "end"; - } else if (record.type === "normal" && afterLoc) { - this.next = afterLoc; + abrupt: function(type, arg) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc <= this.prev && + hasOwn.call(entry, "finallyLoc") && + this.prev < entry.finallyLoc) { + var finallyEntry = entry; + break; } + } - return ContinueSentinel; - }, - finish: function finish(finallyLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; + if (finallyEntry && + (type === "break" || + type === "continue") && + finallyEntry.tryLoc <= arg && + arg <= finallyEntry.finallyLoc) { + // Ignore the finally entry if control is not jumping to a + // location outside the try/catch block. + finallyEntry = null; + } - if (entry.finallyLoc === finallyLoc) { - this.complete(entry.completion, entry.afterLoc); - resetTryEntry(entry); - return ContinueSentinel; - } - } - }, - "catch": function _catch(tryLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; + var record = finallyEntry ? finallyEntry.completion : {}; + record.type = type; + record.arg = arg; - if (entry.tryLoc === tryLoc) { - var record = entry.completion; + if (finallyEntry) { + this.method = "next"; + this.next = finallyEntry.finallyLoc; + return ContinueSentinel; + } - if (record.type === "throw") { - var thrown = record.arg; - resetTryEntry(entry); - } + return this.complete(record); + }, - return thrown; - } - } // The context.catch method must only be called with a location - // argument that corresponds to a known catch block. + complete: function(record, afterLoc) { + if (record.type === "throw") { + throw record.arg; + } + if (record.type === "break" || + record.type === "continue") { + this.next = record.arg; + } else if (record.type === "return") { + this.rval = this.arg = record.arg; + this.method = "return"; + this.next = "end"; + } else if (record.type === "normal" && afterLoc) { + this.next = afterLoc; + } - throw new Error("illegal catch attempt"); - }, - delegateYield: function delegateYield(iterable, resultName, nextLoc) { - this.delegate = { - iterator: values(iterable), - resultName: resultName, - nextLoc: nextLoc - }; + return ContinueSentinel; + }, - if (this.method === "next") { - // Deliberately forget the last sent value so that we don't - // accidentally pass it on to the delegate. - this.arg = undefined; + finish: function(finallyLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.finallyLoc === finallyLoc) { + this.complete(entry.completion, entry.afterLoc); + resetTryEntry(entry); + return ContinueSentinel; } + } + }, - return ContinueSentinel; + "catch": function(tryLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc === tryLoc) { + var record = entry.completion; + if (record.type === "throw") { + var thrown = record.arg; + resetTryEntry(entry); + } + return thrown; + } } - }; - }( // In sloppy mode, unbound `this` refers to the global object, fallback to + + // The context.catch method must only be called with a location + // argument that corresponds to a known catch block. + throw new Error("illegal catch attempt"); + }, + + delegateYield: function(iterable, resultName, nextLoc) { + this.delegate = { + iterator: values(iterable), + resultName: resultName, + nextLoc: nextLoc + }; + + if (this.method === "next") { + // Deliberately forget the last sent value so that we don't + // accidentally pass it on to the delegate. + this.arg = undefined; + } + + return ContinueSentinel; + } + }; + })( + // In sloppy mode, unbound `this` refers to the global object, fallback to // Function constructor if we're in global strict mode. That is sadly a form // of indirect eval which violates Content Security Policy. - function () { - return this || (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" && self; - }() || Function("return this")()); + (function() { + return this || (typeof self === "object" && self); + })() || Function("return this")() + ); }); var QueryBuilder = @@ -8234,7 +6263,7 @@ CubeProvider.propTypes = { cubejsApi: PropTypes.object.isRequired, - children: PropTypes.array.isRequired + children: PropTypes.any.isRequired }; var useCubeQuery = (function (query) { @@ -8265,6 +6294,7 @@ setError = _useState10[1]; var context = React.useContext(CubeContext); + var subscribeRequest = null; React.useEffect(function () { function loadQuery() { return _loadQuery.apply(this, arguments); @@ -8274,49 +6304,97 @@ _loadQuery = _asyncToGenerator( /*#__PURE__*/ regeneratorRuntime.mark(function _callee() { + var cubejsApi; return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: - if (!(query && isQueryPresent(query) && !equals(currentQuery, query))) { - _context.next = 16; + if (!(query && isQueryPresent(query))) { + _context.next = 25; break; } - setCurrentQuery(query); + if (!equals(currentQuery, query)) { + setCurrentQuery(query); + } + setLoading(true); _context.prev = 3; - _context.t0 = setResultSet; + + if (!subscribeRequest) { + _context.next = 8; + break; + } + _context.next = 7; - return (options.cubejsApi || context && context.cubejsApi).load(query, { + return subscribeRequest.unsubscribe(); + + case 7: + subscribeRequest = null; + + case 8: + cubejsApi = options.cubejsApi || context && context.cubejsApi; + + if (!options.subscribe) { + _context.next = 13; + break; + } + + subscribeRequest = cubejsApi.subscribe(query, { mutexObj: mutexObj, mutexKey: 'query' + }, function (e, result) { + setLoading(false); + + if (e) { + setError(e); + } else { + setResultSet(result); + } }); + _context.next = 19; + break; - case 7: + case 13: + _context.t0 = setResultSet; + _context.next = 16; + return cubejsApi.load(query, { + mutexObj: mutexObj, + mutexKey: 'query' + }); + + case 16: _context.t1 = _context.sent; (0, _context.t0)(_context.t1); setLoading(false); - _context.next = 16; + + case 19: + _context.next = 25; break; - case 12: - _context.prev = 12; + case 21: + _context.prev = 21; _context.t2 = _context["catch"](3); setError(_context.t2); setLoading(false); - case 16: + case 25: case "end": return _context.stop(); } } - }, _callee, this, [[3, 12]]); + }, _callee, this, [[3, 21]]); })); return _loadQuery.apply(this, arguments); } loadQuery(); + return function () { + if (subscribeRequest) { + subscribeRequest.unsubscribe(); + subscribeRequest = null; + } + }; }, [query, options.cubejsApi, context]); return { isLoading: isLoading, diff --git a/packages/cubejs-react/src/CubeProvider.jsx b/packages/cubejs-react/src/CubeProvider.jsx index 109f995cd622a..52b0ab6e348fa 100644 --- a/packages/cubejs-react/src/CubeProvider.jsx +++ b/packages/cubejs-react/src/CubeProvider.jsx @@ -10,7 +10,7 @@ const CubeProvider = ({ cubejsApi, children }) => ( CubeProvider.propTypes = { cubejsApi: PropTypes.object.isRequired, - children: PropTypes.array.isRequired + children: PropTypes.any.isRequired }; export default CubeProvider; diff --git a/packages/cubejs-react/src/useCubeQuery.js b/packages/cubejs-react/src/useCubeQuery.js index 7bb14a723810c..d1ec73090ae4c 100644 --- a/packages/cubejs-react/src/useCubeQuery.js +++ b/packages/cubejs-react/src/useCubeQuery.js @@ -13,17 +13,40 @@ export default (query, options = {}) => { const [error, setError] = useState(null); const context = useContext(CubeContext); + let subscribeRequest = null; + useEffect(() => { async function loadQuery() { - if (query && isQueryPresent(query) && !equals(currentQuery, query)) { - setCurrentQuery(query); + if (query && isQueryPresent(query)) { + if (!equals(currentQuery, query)) { + setCurrentQuery(query); + } setLoading(true); try { - setResultSet(await (options.cubejsApi || context && context.cubejsApi).load(query, { - mutexObj, - mutexKey: 'query' - })); - setLoading(false); + if (subscribeRequest) { + await subscribeRequest.unsubscribe(); + subscribeRequest = null; + } + const cubejsApi = options.cubejsApi || context && context.cubejsApi; + if (options.subscribe) { + subscribeRequest = cubejsApi.subscribe(query, { + mutexObj, + mutexKey: 'query' + }, (e, result) => { + setLoading(false); + if (e) { + setError(e); + } else { + setResultSet(result); + } + }); + } else { + setResultSet(await cubejsApi.load(query, { + mutexObj, + mutexKey: 'query' + })); + setLoading(false); + } } catch (e) { setError(e); setLoading(false); @@ -31,6 +54,12 @@ export default (query, options = {}) => { } } loadQuery(); + return () => { + if (subscribeRequest) { + subscribeRequest.unsubscribe(); + subscribeRequest = null; + } + }; }, [query, options.cubejsApi, context]); return { isLoading, resultSet, error }; diff --git a/packages/cubejs-server-core/core/index.js b/packages/cubejs-server-core/core/index.js index 4b71fb9e96993..5992ccadd9849 100644 --- a/packages/cubejs-server-core/core/index.js +++ b/packages/cubejs-server-core/core/index.js @@ -191,22 +191,35 @@ class CubejsServerCore { async initApp(app) { checkEnvForPlaceholders(); - const apiGateway = new ApiGateway( - this.apiSecret, - this.getCompilerApi.bind(this), - this.getOrchestratorApi.bind(this), - this.logger, { - basePath: this.options.basePath, - checkAuthMiddleware: this.options.checkAuthMiddleware, - queryTransformer: this.options.queryTransformer - } - ); + const apiGateway = this.apiGateway(); apiGateway.initApp(app); if (this.options.devServer) { this.devServer.initDevEnv(app); } } + initSubscriptionServer(sendMessage) { + checkEnvForPlaceholders(); + const apiGateway = this.apiGateway(); + return apiGateway.initSubscriptionServer(sendMessage); + } + + apiGateway() { + if (!this.apiGatewayInstance) { + this.apiGatewayInstance = new ApiGateway( + this.apiSecret, + this.getCompilerApi.bind(this), + this.getOrchestratorApi.bind(this), + this.logger, { + basePath: this.options.basePath, + checkAuthMiddleware: this.options.checkAuthMiddleware, + queryTransformer: this.options.queryTransformer + } + ); + } + return this.apiGatewayInstance; + } + getCompilerApi(context) { const appId = this.contextToAppId(context); if (!this.appIdToCompilerApi[appId]) { diff --git a/packages/cubejs-server/WebSocketServer.js b/packages/cubejs-server/WebSocketServer.js new file mode 100644 index 0000000000000..8a338b7cf6c8a --- /dev/null +++ b/packages/cubejs-server/WebSocketServer.js @@ -0,0 +1,56 @@ +const WebSocket = require('ws'); +const crypto = require('crypto'); +const util = require('util'); + +class WebSocketServer { + constructor(serverCore, options) { + options = options || {}; + this.serverCore = serverCore; + this.processSubscriptionsInterval = options.processSubscriptionsInterval || 5; + } + + initServer(server) { + this.wsServer = new WebSocket.Server({ server }); + + const connectionIdToSocket = {}; + + const subscriptionServer = this.serverCore.initSubscriptionServer((connectionId, message) => { + if (!connectionIdToSocket[connectionId]) { + throw new Error(`Socket for ${connectionId} is not found found`); + } + connectionIdToSocket[connectionId].send(JSON.stringify(message)); + }); + + this.wsServer.on('connection', (ws) => { + const connectionId = crypto.randomBytes(8).toString('hex'); + connectionIdToSocket[connectionId] = ws; + ws.on('message', async (message) => { + await subscriptionServer.processMessage(connectionId, message); + }); + + ws.on('close', async () => { + await subscriptionServer.disconnect(connectionId); + }); + + ws.on('error', async () => { + await subscriptionServer.disconnect(connectionId); + }); + }); + + this.subscriptionsTimer = setInterval(async () => { + await subscriptionServer.processSubscriptions(); + }, this.processSubscriptionsInterval * 1000); + } + + async close() { + if (this.wsServer) { + const close = util.promisify(this.wsServer.close.bind(this.wsServer)); + await close(); + } + if (this.subscriptionsTimer) { + clearInterval(this.subscriptionsTimer); + } + } +} + +module.exports = WebSocketServer; diff --git a/packages/cubejs-server/index.js b/packages/cubejs-server/index.js index e37bad7432d49..d3f343867b7d9 100644 --- a/packages/cubejs-server/index.js +++ b/packages/cubejs-server/index.js @@ -1,11 +1,14 @@ /* eslint-disable global-require */ require('dotenv').config(); const CubejsServerCore = require('@cubejs-backend/server-core'); +const WebSocketServer = require('./WebSocketServer'); class CubejsServer { constructor(config) { config = config || {}; + config.webSockets = config.webSockets || (process.env.CUBEJS_WEB_SOCKETS === 'true'); this.core = CubejsServerCore.create(config); + this.webSockets = config.webSockets; this.redirector = null; this.server = null; } @@ -31,7 +34,8 @@ class CubejsServer { const PORT = process.env.PORT || 4000; const TLS_PORT = process.env.TLS_PORT || 4433; - if (process.env.CUBEJS_ENABLE_TLS === "true") { + const enableTls = process.env.CUBEJS_ENABLE_TLS === "true"; + if (enableTls) { this.redirector = http.createServer((req, res) => { res.writeHead(301, { Location: `https://${req.headers.host}:${TLS_PORT}${req.url}` @@ -39,32 +43,35 @@ class CubejsServer { res.end(); }); this.redirector.listen(PORT); - this.server = Object.keys(options).length ? https.createServer(options, app) : https.createServer(app); - this.server.listen(TLS_PORT, err => { - if (err) { - this.server = null; - this.redirector = null; - reject(err); - return; - } + } + + const httpOrHttps = enableTls ? https : http; + this.server = Object.keys(options).length ? + httpOrHttps.createServer(options, app) : httpOrHttps.createServer(app); + + if (this.webSockets) { + this.socketServer = new WebSocketServer(this.core, this.core.options); + this.socketServer.initServer(this.server); + } + + this.server.listen(enableTls ? TLS_PORT : PORT, err => { + if (err) { + this.server = null; + this.redirector = null; + reject(err); + return; + } + if (this.redirector) { this.redirector.close = util.promisify(this.redirector.close); - this.server.close = util.promisify(this.server.close); - resolve({ - app, port: PORT, tlsPort: TLS_PORT, server: this.server - }); - }); - } else { - this.server = Object.keys(options).length ? http.createServer(options, app) : http.createServer(app); - this.server.listen(PORT, err => { - if (err) { - this.server = null; - this.redirector = null; - reject(err); - return; - } - resolve({ app, port: PORT, server: this.server }); + } + this.server.close = util.promisify(this.server.close); + resolve({ + app, + port: PORT, + tlsPort: process.env.CUBEJS_ENABLE_TLS === "true" ? TLS_PORT : undefined, + server: this.server }); - } + }); }); } catch (e) { if (this.core.event) { @@ -78,6 +85,9 @@ class CubejsServer { async close() { try { + if (this.socketServer) { + await this.socketServer.close(); + } if (!this.server) { throw new Error("CubeServer is not started."); } diff --git a/packages/cubejs-server/package.json b/packages/cubejs-server/package.json index 22fc3aa49292a..4f61c8f80d278 100644 --- a/packages/cubejs-server/package.json +++ b/packages/cubejs-server/package.json @@ -26,7 +26,8 @@ "dotenv": "^8.1.0", "express": "^4.17.1", "jsonwebtoken": "^8.4.0", - "node-machine-id": "^1.1.10" + "node-machine-id": "^1.1.10", + "ws": "^7.1.2" }, "devDependencies": { "eslint": "^4.14.0", diff --git a/packages/cubejs-server/yarn.lock b/packages/cubejs-server/yarn.lock index 3456929f17f71..b6b710f878e52 100644 --- a/packages/cubejs-server/yarn.lock +++ b/packages/cubejs-server/yarn.lock @@ -124,9 +124,10 @@ exec-sh "^0.3.2" minimist "^1.2.0" -"@cubejs-backend/api-gateway@^0.10.34": - version "0.10.34" - resolved "https://registry.yarnpkg.com/@cubejs-backend/api-gateway/-/api-gateway-0.10.34.tgz#ebec7fbe6412ebfa16e15d815c6332777f05c1f7" +"@cubejs-backend/api-gateway@^0.10.62": + version "0.10.62" + resolved "https://registry.yarnpkg.com/@cubejs-backend/api-gateway/-/api-gateway-0.10.62.tgz#83ad2894f7442e85d4fb00ee173070e53ff60a86" + integrity sha512-825CLVww9aOajKAwAE0S8vg4YWykMNZktA/pb9lASLNMmykm7om+gnVcphyIPc2c5W5iADbnH+X1uoqYKhkOQg== dependencies: "@hapi/joi" "^14.0.6" chrono-node "^1.3.11" @@ -134,16 +135,18 @@ moment "^2.24.0" ramda "^0.25.0" -"@cubejs-backend/query-orchestrator@^0.10.35": - version "0.10.35" - resolved "https://registry.yarnpkg.com/@cubejs-backend/query-orchestrator/-/query-orchestrator-0.10.35.tgz#13b6c6b2158e4505ed7d0e8eba9786c32742962d" +"@cubejs-backend/query-orchestrator@^0.10.58": + version "0.10.58" + resolved "https://registry.yarnpkg.com/@cubejs-backend/query-orchestrator/-/query-orchestrator-0.10.58.tgz#868a8beb933d3a1ade4d63cc0093c104610756a5" + integrity sha512-ePcXWinoCB23/MnlVBEMNB0rdJ1yFvGOwIHo0ruHtX07c5sMYrrEecL97Vz3vdoFd125eE8/CsppnecVAKdPKw== dependencies: ramda "^0.24.1" redis "^2.8.0" -"@cubejs-backend/schema-compiler@^0.10.41": - version "0.10.41" - resolved "https://registry.yarnpkg.com/@cubejs-backend/schema-compiler/-/schema-compiler-0.10.41.tgz#0a5203e3ad05d654809374b18c91cbaf87a728bf" +"@cubejs-backend/schema-compiler@^0.10.62": + version "0.10.62" + resolved "https://registry.yarnpkg.com/@cubejs-backend/schema-compiler/-/schema-compiler-0.10.62.tgz#942beb89a02c7a22bc85de50d8916928193870d5" + integrity sha512-f/2rR6ZEs0y0DrprFcSAzb58bFk69o0QlRnGS9WWFtsmQ3NuboGx4IW9SRTSdba2RPijiOVXfnmduBIDqw8e0w== dependencies: "@hapi/joi" "^14.3.1" babel-generator "^6.25.0" @@ -158,14 +161,14 @@ ramda "^0.24.1" syntax-error "^1.3.0" -"@cubejs-backend/server-core@^0.10.43": - version "0.10.43" - resolved "https://registry.yarnpkg.com/@cubejs-backend/server-core/-/server-core-0.10.43.tgz#4fa6b7da653bcdab1250627deb8d4b47c6e7c385" - integrity sha512-TRtdP8AORvW2w9dD9a6jIcALTeytsLgEUM+l6H/1hvU0WuOrez8NPfrGEQp4BPz5yUfBEaIZG3VhN1OLENkNKA== +"@cubejs-backend/server-core@^0.10.62": + version "0.10.62" + resolved "https://registry.yarnpkg.com/@cubejs-backend/server-core/-/server-core-0.10.62.tgz#a892dc64405e0fb0c168c9d0f86ce2dc72161046" + integrity sha512-v07eDsRd1lwQo/Fp/x2DqvnDlhpRpzM6yJRgWsiwUomUW8wuCbbNRENk1olxT1na7G4PwR+TcjO/c5K0/OXtUA== dependencies: - "@cubejs-backend/api-gateway" "^0.10.34" - "@cubejs-backend/query-orchestrator" "^0.10.35" - "@cubejs-backend/schema-compiler" "^0.10.41" + "@cubejs-backend/api-gateway" "^0.10.62" + "@cubejs-backend/query-orchestrator" "^0.10.58" + "@cubejs-backend/schema-compiler" "^0.10.62" analytics-node "^3.4.0-beta.1" codesandbox-import-utils "^1.3.8" cross-spawn "^6.0.5" @@ -600,7 +603,7 @@ astral-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" -async-limiter@~1.0.0: +async-limiter@^1.0.0, async-limiter@~1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" @@ -4436,6 +4439,13 @@ ws@^5.2.0: dependencies: async-limiter "~1.0.0" +ws@^7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.1.2.tgz#c672d1629de8bb27a9699eb599be47aeeedd8f73" + integrity sha512-gftXq3XI81cJCgkUiAVixA0raD9IVmXqsylCrjRygw4+UOOGzPoxnQ6r/CnVL9i+mDncJo94tSkyrtuuQVBmrg== + dependencies: + async-limiter "^1.0.0" + xml-name-validator@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" diff --git a/rollup.config.js b/rollup.config.js index e1775ed92b334..7abce0b9a38f0 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -136,7 +136,9 @@ const bundle = (name, globalName, baseConfig) => { export default bundle('cubejs-client-core', 'cubejs', { input: "packages/cubejs-client-core/src/index.js", -}).concat(bundle('cubejs-react', 'cubejsReact', { +}).concat(bundle('cubejs-client-ws-transport', 'CubejsWebSocketTransport', { + input: "packages/cubejs-client-ws-transport/src/index.js", +})).concat(bundle('cubejs-react', 'cubejsReact', { input: "packages/cubejs-react/src/index.js", external: [ 'react',